Context Window as Shared Budget & Context Rot
CoreOptimize the context window and manage token budgets · Difficulty 3/5
Explanation
The Context Window as a Shared Budget
The Context Window is not reserved for one purpose -- it is a single shared budget that the system prompt, conversation history, tool definitions, tool results, retrieved documents, and the model's own response all compete for. Every token spent on one of these categories is a token unavailable to the others.
Context Rot / Drift
Bloated context degrades output quality: as low-signal tokens accumulate (verbose tool output, stale history, redundant retrieved documents), the model loses the thread among them, even though the Context Window technically still has room. This is context rot, or context drift.
The governing guidance is to curate the window to the smallest set of high-signal tokens the task needs -- curation beats raw capacity. A larger Context Window does not fix context rot; it only postpones when the same degradation shows up, because the discipline that matters is what the model actually *sees* on a given call, not what it *could* fit.
Common exam traps
- Assuming a bigger Context Window removes the need to curate. Longer windows still suffer context rot; the fix is disciplined curation of what's included, not just more room to include more.
Key Takeaways
- The context window is one shared budget across system prompt, history, tools, results, retrieved docs, and the response
- Context rot/drift is quality degradation caused by low-signal tokens crowding the window, not by running out of room
- Curate to the smallest set of high-signal tokens rather than relying on raw context capacity
- A bigger context window does not eliminate the need for curation
Glossary Terms
The maximum amount of text (measured in tokens) that Claude can process in a single request. Includes both input tokens (prompt, history, tool results) and output tokens. Exceeding the context window causes an error or requires context management strategies.
The fundamental unit of text processing for Claude. Roughly 3-4 characters or about 0.75 words in English. Used for measuring input, output, and context window size. Costs are calculated per input and output token.
Related Concepts