Context Rot and Context Drift
AdvancedManage the context window as a shared, finite budget · Difficulty 2/5
Explanation
Context Rot
Models suffer **Context Rot**: attention degrades as the window fills with irrelevant or stale content, even when there is technically still room left in the window. The problem is not running out of space -- it's that low-signal tokens crowd out the high-signal ones the model needs to attend to.
Context Drift
Context drift is when the model gradually loses track of instructions or facts over a long interaction. The telltale symptom: a long agent session starts ignoring earlier instructions and quality drops, even though nothing about the task changed.
Countering It
Compaction, pruning, isolation, and re-stating key constraints counter drift -- they are the active techniques that keep a long session's context high-signal instead of letting it decay.
Common exam traps
- Reaching for "raise temperature" or "add more prohibitions" when a session starts ignoring earlier instructions. The actual fix is compacting older turns into a summary and pruning stale tool output -- temperature and prohibition count don't address a full, low-signal context window.
Key Takeaways
- Context rot is attention degradation from irrelevant/stale content filling the window, not from running out of room
- Context drift is the gradual loss of track of instructions or facts over a long interaction
- Compaction, pruning, isolation, and re-stating key constraints counter drift
- Raising temperature or adding more prohibitions does not fix context rot or context drift
Glossary Terms
The practice of actively reducing a conversation's token footprint so it fits within the model's context window without silent truncation. Encompasses multiple strategies — rolling window eviction, progressive summarization, external storage with retrieval, and prompt caching — each with different loss profiles and complexity trade-offs. Understanding this menu of options, and knowing what must never be compressed, is a core Domain 5 skill.
Attention degradation caused by a context window filling with irrelevant, stale, or low-signal content, even when technically there is still room left in the window. Distinct from running out of space (a hard context-window limit) and from position effects (attention bias by location within the window) -- context rot is specifically about signal-to-noise degrading as low-value tokens accumulate.
The observed phenomenon where Claude (and other LLMs) give less attention to content in the middle of a long context window compared to content at the beginning and end. Critical information should be placed at the start (system prompt) or end (most recent user turn) of the context.
Related Concepts