Everything Claude "knows" in a single request — the system prompt, tools, the whole conversation, retrieved documents, and the answer it's about to write — has to fit in one finite budget of tokens: the context window. Fill the window below and watch what gets squeezed, why quality drops near the edge, and where the answer goes when there's no room left.
A token is roughly ¾ of a word. Slide each part of the request and watch the budget. Two things to notice: the output needs reserved space (if input eats it all, the answer gets truncated), and as you approach the limit, models get slower and more error-prone — recall in the "muddy middle" of a stuffed window degrades (sometimes called context rot).
| Segment | Notes |
|---|---|
| System prompt | Role + standing instructions. Fixed cost every turn. |
| Tool definitions | Every tool's name/description/schema is tokens, every turn. Too many tools = bloat + worse selection. |
| Conversation history | Grows every turn in an agent loop — the main thing that fills long runs. |
| Retrieved context (RAG) | Documents you inject. Retrieve relevant chunks, not everything. |
| Output reservation | max_tokens for the reply. Must fit alongside the input. |
max_tokens, and compaction for long runs.Curated companion: Anthropic — Effective context engineering for AI agents.