---
title: A bigger context window also fits more mistakes
description: In 2024, million-token context windows were supposed to end RAG. Drew Breunig's talk shows why they didn't. A long context fails in four known ways, the six fixes fit in sixteen lines of code, and the newest fix for a stuck agent is to delete its context. Held against my own 1,130 coding sessions.
date: 2026-11-26
tags: context engineering, AI agents, RAG, context window, harness engineering, agent memory
---

"You can throw everything in there, but the LLM cannot choose what it ignores." That's Drew Breunig on long context windows. In 2024, people said a window of a million tokens would end RAG: put every document in the prompt and let the model sort it out. It didn't work that way. A longer context holds more information, and it holds more mistakes too.

I wanted to know where I stand, so I measured my own coding sessions. In the last 30 days, one in four went past the size where he starts to worry. I also found a rules file that one of my agents had been reading with its middle cut out.

The talk is [How Contexts Fail (and How to Fix Them)](https://youtu.be/btuLWMpzwtI), 43 minutes, published on November 24 by the Agentic AI Foundation. Drew Breunig works at cmpnd.ai, the team behind DSPy, a Python library for building AI workflows. He has a book on the subject coming at O'Reilly and his examples use DSPy, so he has something to sell. Most of what he says is backed by papers that other people wrote, and I link them at the end.

## The year RAG was declared dead

At the end of 2024, the plan was simple: make the context window big enough and stop choosing what goes in. The context window is everything a model reads before it answers. It's counted in tokens, pieces of words. RAG, where you fetch only the text a question needs, looked like extra work that would soon be useless.

The windows did grow, from about 100,000 tokens to a million. Google's launch post for Gemini 1.5 Pro was mostly about that number.

Then Google's own technical report on Gemini 2.5 told another story. The team had the model play Pokémon, a slow game that makes a good test for agents. Once the context grew well past 100,000 tokens, the agent "showed a tendency toward favoring repeating actions from its vast history rather than synthesizing novel plans." It looped. That was at a tenth of the window in the marketing.

Drew found this in the appendix. "I'm convinced the marketing people just never read the appendix," he says.

<figure class="fd-fig kf" aria-labelledby="cf1-cap" data-desc="Two bars for Gemini playing Pokémon. The context window Google advertised: 1,000,000 tokens. In red, where the agent started to repeat its past actions: about 100,000 tokens, a tenth of the window.">
<p class="kf-kick">Gemini 2.5 playing Pokémon, in tokens</p>
<p class="kf-title">The agent started to loop <em class="is-alert">at a tenth of the window</em></p>
<div class="kf-bars kf-seq">
<p class="kf-bar"><span>Window advertised</span><span class="kf-track"><i style="--v:100"></i></span><b data-count="1000000">1,000,000</b></p>
<p class="kf-bar is-alert"><span>Where it started to loop</span><span class="kf-track"><i style="--v:10"></i></span><b>about 100,000</b></p>
</div>
<figcaption id="cf1-cap">From Google's Gemini 2.5 report, as quoted in Drew Breunig's post. The report says "significantly beyond 100k tokens", and he calls the finding anecdotal.</figcaption>
</figure>

## A long context fails in four ways

He named four failures in June 2025, and they still hold. Each one has a small story.

- **Poisoning.** A mistake gets into the context and the model keeps coming back to it. In the Pokémon runs, he says, the model decided it needed tea to get past a guard. Tea only exists in the 2004 remake. It was playing the 1996 game, where the guard wants another drink. The wrong item was on its to-do list, and it spent tokens looking for something that wasn't there.
- **Distraction.** The context gets so long that the model follows it more than what it learned in training. A paper called "Do as I say, Not as I Do" tests this. The instruction says to answer in Russian. Then come examples where the answer is in French. With three such examples, a small model, Gemma 3 12B, answered in Russian less than half the time.
- **Confusion.** Text that has nothing to do with the task still changes the answer. His example is a person asking how to reduce a medicine they're running out of. Asked as a patient, they're sent to the hospital. Written as a doctor's note, the same facts get the full schedule.
- **Clash.** New information or tools arrive that contradict what's already in the prompt. He turns off the memory feature of his chat apps for this reason: notes about one project leak into another.

The second one is the one I recognise. Think of a long session where you tweak a page's layout ten times. Every failed attempt stays in the context as an example. "How many bad examples have you seeded in that exchange?" he asks.

<figure class="fd-fig kf" aria-labelledby="cf2-cap" data-desc="The four ways a long context fails, each with what happens. Poisoning: a mistake gets in, and the model keeps coming back to it. Distraction: the model follows the context more than its training. Confusion: unrelated text changes the answer. Clash: new information or tools contradict the prompt.">
<p class="kf-kick">Drew Breunig's four failures, 2025</p>
<p class="kf-title">The model <em>can't choose what it ignores</em></p>
<div class="kf-swap is-short kf-seq">
<p class="kf-swap-h"><span>Failure</span><span>What happens</span></p>
<p><span>Poisoning</span><em>A mistake gets in, and the model keeps coming back to it</em></p>
<p><span>Distraction</span><em>The model follows the context more than its training</em></p>
<p><span>Confusion</span><em>Unrelated text changes the answer</em></p>
<p><span>Clash</span><em>New information or tools contradict the prompt</em></p>
</div>
<figcaption id="cf2-cap">From his post "How Long Contexts Fail", June 2025. The wording is shortened.</figcaption>
</figure>

## Six fixes, in sixteen lines of code

What surprised him is that the list of fixes hasn't grown. He wrote down six in 2025, and every new trick since is one of them under a new name.

- **Bring in the right text.** That's RAG, and skills: fetch what this task needs, and only that.
- **Pick the tools.** Load only the tools and skills the task needs. He met a company whose agents had become bad overnight. Their software was loading 600 skills for every engineer.
- **Quarantine.** Give a job to a subagent, a second agent that starts with an empty context and sends back only its result.
- **Prune.** Cut what is no longer needed, such as the output of old tool calls.
- **Offload.** Store notes outside the context, in a file or a database, and read them back later.
- **Summarise.** Replace a long history with a short summary. Coding tools call it compaction.

So RAG didn't die. It's the first line of the list.

Then he shows the code. An agent is a `while` loop around a model with tools. A small, fast model answers one yes-or-no question at a time: is this tool needed for this request? Is this step of the history still needed? With that, four of the six fixes take about sixteen lines of Python.

That code is the harness: everything around the model that decides what it reads. He follows the name of the job over three years. In 2023, we wrote the right prompt by hand, and called it prompt engineering. In 2025, a system assembled the context, and it became context engineering. Now the fixes are plain code that gives the same result every time, and people say harness engineering. "But the job is the same," he says.

<figure class="fd-fig kf" aria-labelledby="cf3-cap" data-desc="Three names for one job, as a timeline. 2023, prompt engineering: a person writes the right prompt by hand. 2025, context engineering: a system assembles what the model reads. Highlighted, 2026, harness engineering: plain code picks the tools, prunes and summarises. Under the timeline: the job stays the same, the right context for the right model.">
<p class="kf-kick">One job, three names</p>
<p class="kf-title">The fixes moved from the prompt <em>into plain code</em></p>
<ol class="kf-steps is-time">
<li><small>2023</small><b>Prompt engineering</b><span>A person writes the right prompt by hand.</span></li>
<li><small>2025</small><b>Context engineering</b><span>A system assembles what the model reads.</span></li>
<li class="is-key"><small>2026</small><b>Harness engineering</b><span>Plain code picks the tools, prunes and summarises.</span></li>
</ol>
<p class="kf-note">The job stays the same: the right context for the right model.</p>
<figcaption id="cf3-cap">The years are his for the first two names. He gives no year for the third; 2026 is mine.</figcaption>
</figure>

## An agent trained to persist doesn't let go

In 2025 the labs made a new promise: the model will run the harness itself, for hours. So they trained models to be persistent. That brought two new failures.

The first he calls fighting the weights. A model is trained with certain tools, in a certain way of working. Ask for something else and it resists. His example is the system prompt of Claude Code. It asks for tool calls in parallel again and again, because the training was mostly one call at a time. "Anywhere you see repetition and all caps, you're fighting the weights."

The second is context inertia. An agent commits to one idea and keeps at it after the evidence says stop. Three papers from this autumn measured it:

- In one long run, the last improvement came after 231 million tokens. Of the final 1,500 turns, 98% made no tool call at all.
- Summarising didn't help. The agent stayed in the same idea after each compaction.
- Deleting the context did. In a Berkeley and Stanford study, runs that forgot gained 4.5% to 9.2% over the next 30 proposals. Runs that kept everything gained under 2%, at up to twice the cost.

Anthropic built the same thing and called it Memento. In one experiment, the agent stops after an hour and a half and writes a note. A fresh agent starts with the code, the environment and that note, and nothing else.

How does a fresh agent know where to pick up? The work is still there. The code, the notes and the plan live in files, outside the context. Only the conversation is gone.

<figure class="fd-fig kf" aria-labelledby="cf4-cap" data-desc="Two cards for an agent that has stopped improving. On the left, in red, keep the context: under 2% gained over the next 30 proposals, at up to twice the cost, and summarising doesn't free it. On the right, highlighted, delete the context: 4.5% to 9.2% gained over the same 30 proposals, and the code, the notes and the plan stay in files.">
<p class="kf-kick">A stuck agent, the next 30 proposals</p>
<p class="kf-title">The fix for a stuck agent is to <em>delete its context</em></p>
<div class="kf-cards">
<div class="is-alert"><small>Keep the context</small><b>Under 2% gained</b><ul><li>At up to twice the cost</li><li>A summary doesn't free it</li></ul></div>
<div class="is-key"><small>Delete the context</small><b>4.5% to 9.2% gained</b><ul><li>The code, the notes and the plan stay in files</li><li>A fresh agent picks them up</li></ul></div>
</div>
<figcaption id="cf4-cap">Figures from "Scaling Discovery Requires Forgetting", Shangyin Tan and colleagues, as reported in Drew Breunig's post on context inertia.</figcaption>
</figure>

## One in four of my sessions passes his line

His own habit is simple. Around 200,000 tokens he gets wary, and before a big job he resets. When someone tells him their coding agent got worse, his first question is the size of their context. "Delete your context. I'm not joking."

So I counted. My coding agent, Claude Code, keeps one file per session on my machine. I read the 1,130 files of the last 30 days and took the largest context each session reached, subagents left out.

Half of them stayed under 95,000 tokens. But 283, one in four, went past 200,000. None passed 300,000, and the largest stopped at 279,412. I suppose that's where the tool's automatic summary steps in. I haven't checked.

That makes 283 sessions where the model had a lot of old attempts to imitate. I can't say how many of them went wrong because of it. I only know that I never looked at the size before starting something big.

On tools, I'm far from the company with 600 skills. I have 38 of my own, and only a name and a description of each is loaded until one is used.

<figure class="fd-fig kf" aria-labelledby="cf5-cap" data-desc="My Claude Code sessions over 30 days, as three big numbers. 1,130 sessions measured. Highlighted, 283 went past 200,000 tokens, one in four. 0 went past 300,000. Under the numbers: half of them stayed under 95,000 tokens.">
<p class="kf-kick">My coding sessions, last 30 days</p>
<p class="kf-title">One session in four passes <em>his 200,000-token line</em></p>
<div class="kf-stats">
<p><b data-count="1130">1,130</b><span>sessions measured, largest context of each</span></p>
<p class="is-key"><b data-count="283">283</b><span>went past 200,000 tokens</span></p>
<p><b>0</b><span>went past 300,000</span></p>
</div>
<p class="kf-note">Half of them stayed under 95,000 tokens.</p>
<figcaption id="cf5-cap">My numbers on November 26, from Claude Code's session files. Input tokens of the largest request in each session, subagents not counted.</figcaption>
</figure>

## A fix in code can cut the wrong part

Moving the fixes into code has a cost: the code decides, and it doesn't tell you. I found that out this week.

My personal assistants run on OpenClaw, an open-source agent that lives on my machine. Each one reads a rules file at the start of every conversation. OpenClaw limits that file to 20,000 characters by default. That's pruning, one of the six fixes, and it's a reasonable one.

One assistant's file had grown to 23,921 characters. A longer file isn't refused. The agent gets the first 45%, then a digest of lines picked from the whole file, then the last 15%. Long paragraphs in the middle are simply gone. Four sections of rules had not reached that agent for at least two weeks. Nothing in the log said so.

I only saw it because a new rule I was adding would have landed in the missing part. The fix was one setting, a higher limit for that agent.

A harness that prunes for you is a good thing. But read how it prunes, and check what your agent really receives.

<figure class="fd-fig kf" aria-labelledby="cf6-cap" data-desc="What an agent receives from a rules file of 23,921 characters when the limit is 20,000, as three layers. The start: the first 45% of the limit, kept as written. In red, the middle: replaced by a digest of picked lines, and long paragraphs are gone. The end: the last 15%, kept as written. Under the layers: four sections of rules never reached the agent, and the log said nothing.">
<p class="kf-kick">A rules file over the limit</p>
<p class="kf-title">The file was read, <em class="is-alert">minus its middle</em></p>
<ol class="kf-stack">
<li><small>The start</small><span>The first 45% of the limit, kept as written</span></li>
<li class="is-alert"><small>The middle</small><span>Replaced by a digest of picked lines. Long paragraphs are gone</span></li>
<li><small>The end</small><span>The last 15%, kept as written</span></li>
</ol>
<p class="kf-note">Four sections of rules never reached the agent. The log said nothing.</p>
<figcaption id="cf6-cap">My setup, found on November 26. The shares are from OpenClaw's code as I read it, in the version I run; the digest takes about 35%.</figcaption>
</figure>

## Each fix prepares the next problem

His summary of three years: "The solutions we build into the models create our problems tomorrow." Long windows let in more information, and more bad information. Persistent models run longer tasks, and they run them past the point where they should stop.

His guess for 2027 is memory. Personal agents now write their own notes and skills. Few people have run one for more than three months. He has run one for six, and he opened the skills it wrote. They get worse over time, because the agent solves a problem one way for one task, then finds another way for the next, and keeps both. "We need to start thinking about forgetting strategically," he says. Nobody has a method yet.

I see the start of it. My coding agent keeps notes from one session to the next: 520 files today. An index of one line per note is loaded into every session, and it has a size limit. On November 22 it hit that limit, and some lines had to move into sub-pages. That only makes room. It doesn't forget anything.

So what should stay, and who decides? I don't have an answer. My notes only grow.

<figure class="fd-fig kf" aria-labelledby="cf7-cap" data-desc="Three promises and the problem each one brought. 2024: put everything in a bigger window; the problem, more room for mistakes, and the agent loops. 2025: the model runs the harness for hours; the problem, it holds on to one idea and won't let go. 2027, his guess: the agent remembers everything; the problem, old notes that contradict each other. The problems column is highlighted.">
<p class="kf-kick">Three promises, three problems</p>
<p class="kf-title">Each fix <em>prepares the next problem</em></p>
<div class="kf-swap is-3">
<p class="kf-swap-h"><small></small><span>The promise</span><span>The problem it brought</span></p>
<p><small>2024</small><span>Put everything in a bigger window</span><em>More room for mistakes, and the agent loops</em></p>
<p><small>2025</small><span>The model runs the harness for hours</span><em>It holds on to one idea and won't let go</em></p>
<p><small>2027</small><span>The agent remembers everything</span><em>Old notes that contradict each other</em></p>
</div>
<figcaption id="cf7-cap">The first two rows are from the talk. The third is his guess for 2027, not a measurement.</figcaption>
</figure>

## Try it

Before your next big task, look at the size of your context. In Claude Code, `/context` shows it. If it's past 200,000 tokens, write down where you are in a file and start a fresh session from that file. Then open one rules file your agent reads, and check how much of it arrives.

- [How Contexts Fail (and How to Fix Them)](https://youtu.be/btuLWMpzwtI), the talk. The four failures start [at 3:48](https://youtu.be/btuLWMpzwtI?t=228), the six fixes [at 9:11](https://youtu.be/btuLWMpzwtI?t=551), the two new failures [at 16:53](https://youtu.be/btuLWMpzwtI?t=1013).
- [How Long Contexts Fail](https://www.dbreunig.com/2025/06/22/how-contexts-fail-and-how-to-fix-them.html) and [How to Fix Your Context](https://www.dbreunig.com/2025/06/26/how-to-fix-your-context.html), his two posts from June 2025.
- [Don't Fight the Weights](https://www.dbreunig.com/2025/11/11/don-t-fight-the-weights.html) and [Context Inertia: When Agents Won't Let Go](https://www.dbreunig.com/2026/10/14/context-inertia.html), his posts on the two newer failures.
- [Scaling Discovery Requires Forgetting](https://arxiv.org/abs/2610.20563), [Stateless Language Agents](https://arxiv.org/html/2610.07625v1) and [Do as I say, Not as I Do](https://arxiv.org/html/2605.20382v3), three of the papers behind the numbers.
- [RAG is what you do, a tool call is how you do it](/notes/rag-is-what-tool-call-is-how.html): my note on what RAG means once you stop arguing about vectors.
- [Design with an elephant, review with a goldfish](/notes/elephant-goldfish-spec-review.html): a fresh session as a reviewer, the same idea applied to specifications.
- [Fork your agent's harness, keep the winner](/notes/fork-your-agents-harness.html): what a harness is, and how to improve one with tests.

If you measure your own sessions, tell me what you find with "Reply by email" below. I'd like to know if one in four is normal.
