Context rot: why a long Claude Code chat gives worse answers
There is a moment in a long Claude Code session where the answers start to slip. It forgets a decision you made an hour ago, it reaches for a detail buried near the top of the chat and gets it slightly wrong, it loses the thread. I used to blame the model. Then I learned the name for what was actually happening: context rot. It is real, it is documented, and once you understand it you stop fighting it and start working around it.
What context rot is
Context rot is the drop in accuracy and recall that happens as the context window fills up. Anthropic's own docs put it plainly: as the token count grows, accuracy and recall degrade. It is not that the model runs out of room and errors, it is that its ability to reliably use everything in a very full window gets worse before that.
Why it happens
A language model does not read a long context like a database looks up a row. It weighs every token against every other token, and its attention is a finite budget spread across the whole window. A few things follow from that:
- Attention gets diluted. With 5,000 tokens in context, each fact gets a lot of the model's focus. With 300,000, that same fact is competing with far more, and the signal thins out.
- The middle is the weak spot. Models tend to recall the very start and the very end of a long context better than the middle. A crucial detail dropped halfway through a giant chat is the easiest thing for it to lose.
- Noise crowds out signal. Old tool outputs, abandoned tangents, and stale file dumps do not just sit there harmlessly. They are all still in the window, all still competing for attention, all still nudging the model's answer.
Why "paste everything" backfires
The instinct when an agent misses something is to give it more: paste the whole file, paste the docs, paste the last three related conversations. It feels thorough. It usually makes things worse.
More context is not more understanding. Past a point, every extra token you add is one more thing diluting the model's attention and one more chance for it to anchor on the wrong detail. The goal is not the most context, it is the most relevant context.
The best-performing sessions I run are lean on purpose. The model does better with a tight, current window than with a huge one where the important part is buried.
What to do about it
You cannot switch rot off, but you can keep a session on the good side of it:
- Keep the window focused. Carry what the current task needs and let the rest age out. See managing context in Claude Code.
- Reset or summarize at the right moments. A fresh session for a new task, a
/compactfor a long one. The decision guide for /clear versus /compact covers which to use when. - Do not paste what the agent can read itself. A path the agent opens on demand is better than a file pinned in context forever.
- Push bulky reading into sub-agents. A sub-agent does the heavy exploration in its own window and returns a short summary, so the noise never reaches your main session.
Curating context instead of hoarding it is one of the highest-leverage habits in Claude Code. It is also one of several that quietly affect your speed and cost, which I have collected in the pricey-habits rundown.
More in Reference