Brahim Bousnguar

Notes · Article

A bigger context window also fits more mistakes

By · · 10 min read

"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), 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.

Gemini 2.5 playing Pokémon, in tokens

The agent started to loop at a tenth of the window

Window advertised1,000,000

Where it started to loopabout 100,000

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.

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.

Drew Breunig's four failures, 2025

The model can't choose what it ignores

FailureWhat happens

PoisoningA mistake gets in, and the model keeps coming back to it

DistractionThe model follows the context more than its training

ConfusionUnrelated text changes the answer

ClashNew information or tools contradict the prompt

From his post "How Long Contexts Fail", June 2025. The wording is shortened.

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.

One job, three names

The fixes moved from the prompt into plain code

  1. 2023Prompt engineeringA person writes the right prompt by hand.
  2. 2025Context engineeringA system assembles what the model reads.
  3. 2026Harness engineeringPlain code picks the tools, prunes and summarises.

The job stays the same: the right context for the right model.

The years are his for the first two names. He gives no year for the third; 2026 is mine.

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.

A stuck agent, the next 30 proposals

The fix for a stuck agent is to delete its context

Keep the contextUnder 2% gained
  • At up to twice the cost
  • A summary doesn't free it
Delete the context4.5% to 9.2% gained
  • The code, the notes and the plan stay in files
  • A fresh agent picks them up
Figures from "Scaling Discovery Requires Forgetting", Shangyin Tan and colleagues, as reported in Drew Breunig's post on context inertia.

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.

My coding sessions, last 30 days

One session in four passes his 200,000-token line

1,130sessions measured, largest context of each

283went past 200,000 tokens

0went past 300,000

Half of them stayed under 95,000 tokens.

My numbers on November 26, from Claude Code's session files. Input tokens of the largest request in each session, subagents not counted.

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.

A rules file over the limit

The file was read, minus its middle

  1. The startThe first 45% of the limit, kept as written
  2. The middleReplaced by a digest of picked lines. Long paragraphs are gone
  3. The endThe last 15%, kept as written

Four sections of rules never reached the agent. The log said nothing.

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%.

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.

Three promises, three problems

Each fix prepares the next problem

The promiseThe problem it brought

2024Put everything in a bigger windowMore room for mistakes, and the agent loops

2025The model runs the harness for hoursIt holds on to one idea and won't let go

2027The agent remembers everythingOld notes that contradict each other

The first two rows are from the talk. The third is his guess for 2027, not a measurement.

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.

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.

Plain text: bigger-context-window-fits-more-mistakes.md · Atom feed · All notes

Contact

Say hello.

b.bousnguar@gmail.com

SAP Commerce Cloud, MuleSoft and Salesforce integration · Nantes · EN / FR