Context rot
Definition
The gradual decline in a model's accuracy and instruction-following as its context fills up with long, stale or irrelevant content.
In more detail
Even within the advertised window, models tend to miss details and follow early instructions less closely as input grows. It is one reason to keep context lean and to start fresh sessions for new tasks.
Related terms
Compaction
Summarising earlier parts of a long conversation and replacing them with the summary to free context space for the work still to do.
Context engineering
Deciding what information, tools and history a model sees at each step, and what to leave out, to get the result you want.
Context window
The maximum number of tokens a model can consider in one request, covering both the input you send and the output it writes.
Context isolation
Running a subtask in a separate context window so raw tool output and intermediate noise never enter the parent conversation.
Context poisoning
When a wrong fact, hallucination or bad tool result enters an agent's context and keeps steering later steps in the wrong direction.
Lost in the middle
The finding that language models use information at the start and end of a long context better than information buried in the middle.
Read more about Context rot
- Context rot: why long contexts fail and what to do
Why models get worse as their context fills up, from lost-in-the-middle to distractors and poisoned context, and the practical fixes for agents and RAG.
- Context engineering
Deciding what instructions, documents, tools and history a model sees at each step.
- Agent memory and compaction in practice
Keep long Claude Code sessions accurate with compaction, CLAUDE.md, auto memory, subagents and a summarise-and-restart routine, and know what survives each.