Context rot: why AI agents get worse the longer they run
An AI agent gets less reliable the longer it runs, because everything it has read so far stays in front of it. Chroma tested 18 models and every one did worse as the input grew, also on simple tasks. A window of a million tokens says how much fits. It does not say how much is used well.
Is a big context window a big memory?
No. You would expect a model to read token 10,000 as well as token 100. It does not. Chroma’s test covered 18 models, among them GPT-4.1, Claude 4, Gemini 2.5 and Qwen3. Across all experiments the results got worse as the input got longer.
What does more text do to the same question?
Chroma asked the same questions in two ways: with only the parts that matter, and with the same parts inside a long chat of about 113,000 tokens. With the focused input the models answered well. With the long one every model family did worse. The answer was in there both times. In the long version the model first has to find it, and that is where it slips. Thinking modes helped on both, and the gap stayed.
Why is one lookalike enough?
Passages that look like the answer and are not pull the score down. One already lowers it, four lower it more. In an agent those lookalikes are old tool results, an earlier version of a file, or a plan you dropped. That last reading is ours.
Why does attention run out?
Anthropic calls attention a budget. Every token attends to every other one, so the number of pairs grows with the square of the length. Give a model ten times as much to read and there are a hundred times as many pairs to keep track of (that arithmetic is ours). Every new token uses up some of the budget.
What does a good system do about it?
Anthropic’s aim is the smallest possible set of high-signal tokens. For long jobs there are three ways to get there:
- Compact. Keep decisions and open bugs, drop repeated tool output.
- Take notes. Write progress to a file outside the window and read it back when needed.
- Use subagents. Each explores with tens of thousands of tokens and returns 1,000 to 2,000.
Does clearing old tool results help?
Yes, and it is measured. On a web search test of 100 turns, clearing stale tool results cut token use by 84%. Clearing plus a memory file raised the score by 39% on agentic search; clearing alone by 29%. Without clearing, those 100-turn runs failed because the window was full.
A related habit: keep the path, drop the page. A good agent holds a file path or a link and loads the content only when a step needs it. Manus calls that restorable compression.
Why can a timestamp cost ten times as much?
Because of the cache. Manus gave these prices for Claude Sonnet: cached input costs $0.30 per million tokens, uncached input $3. The cache holds as long as the start of the prompt is the same as last time. Put the current time, to the second, at the top of the system prompt and everything after it is read again at full price. Manus reads about 100 tokens for every one it writes, so this is most of the bill.
Which habits keep an agent sharp?
- Few tools, no overlap. If you cannot say which tool fits, the agent cannot either.
- Do not add or remove tools halfway through a task.
- Leave failed attempts in view. The model sees the error and changes course.
- Let it keep a todo file and update it each step, so the goal stays near the end of what it reads.
Splitting work over several agents is one way to keep each window small. It has a price of its own: read when more agents give worse answers.
Sources
- Chroma Research, Context Rot
- Anthropic, Effective context engineering for AI agents
- Anthropic, Managing context on the Claude Developer Platform
- Manus, Context Engineering for AI Agents
Building an agent that has to stay sharp over a long job? Tell us what it should do.
Facts checked on 28 November 2026.