Context window limits explained: what fills it and what to do
A context window is the total text a model can read at once: instructions, history, tool results and its own reply, measured in tokens. Many current Claude models allow up to 1M tokens, others 200k. When it fills, the request fails or older content must be summarized or dropped.
What a context window is
The context window is the model's working memory for one request. It is separate from the data the model was trained on. Everything you want the model to consider has to fit inside it, and so does the answer it writes. The unit is the token, a piece of text smaller than a word on average.
Nothing carries over between requests unless you send it again. A chat app or agent keeps the illusion of memory by resending the whole conversation each turn, so the window fills a little more with every message.
How big is it?
Anthropic's documentation says many current Claude models, including Claude Opus 5.5, Claude Sonnet 5.5 and Claude Sonnet 4.6, have a 1M-token window, and that a single request can produce up to 128k output tokens. Other models, such as Claude Sonnet 4.5, have a 200k-token window. Check the model comparison table for the exact figure of the model you use, because it changes with each release. Other providers publish their own numbers.
What fills it in Claude Code
In an agent, the instructions and the tools take space before you type a word, and every tool call adds more:
- The system prompt, CLAUDE.md and any loaded skills.
- Tool and MCP server definitions. Claude Code defers many of them, so mostly names enter context until a tool is used.
- Every file the agent reads and every command output it receives.
- The full back-and-forth so far, including the model's reasoning on models that keep it.
- Images and documents. Many pages add up fast.
Why agents get worse as it grows
A bigger window is not automatically better. Anthropic describes context rot: as the number of tokens grows, accuracy and recall degrade, so what you put in matters as much as how much fits. This is why an agent can lose track of an early instruction late in a long session even though it is technically still inside the window.
Cost grows too. Claude Code resends the conversation with each request, so a short question late in a long session still pays for the whole history, mostly at the cheaper cached rate.
Context window vs memory vs RAG
These three solve different problems. The context window is what the model sees right now. Memory is information stored outside the window, such as a file or a graph, that you load when needed and that survives a new session. Retrieval (RAG) is the step that picks which stored pieces to place in the window for the current question. A larger window raises the ceiling on the first one. It does not give you the second or third.
What to do about it
- Check usage. In Claude Code, /context shows what is using space and /usage shows plan consumption.
- Clear between unrelated tasks with /clear, and compact long sessions with /compact.
- Write decisions and facts to a file or memory so a new session can start small and read them.
- Hand verbose work, like test runs, to a subagent so only a summary returns.
- Use compaction or context editing if you call the API yourself.
Where a node fits
A NodePress node is the memory part. Agents in a node share a thread and a memory graph on your own computer, so a fact learned in one session can be read by the next, or by a different agent, without replaying the chat. It does not enlarge any model's window. It lets each agent read only the part of the task it needs.
Do it with a NodePress node
- Create a node on your computer and name it for the project.
- Paste the one line into your agent so it joins over the NodePress MCP server.
- Tell the agent to save decisions and findings to the node's memory as it works.
- Start a new session when context gets heavy; it reads the memory instead of a long history.
If your task needs one very large input read as a whole, memory will not help; you need a model with a window that fits it, or you must split the input.
Questions people ask
What is a context window?
The amount of text, in tokens, a model can read in one request. It includes your instructions, the history, tool results and the model's own reply.
How big is Claude's context window?
Anthropic lists 1M tokens for many current models and 200k for others, such as Claude Sonnet 4.5. Check the model comparison table for yours.
What happens when the context window is full?
The API returns a "prompt is too long" error, or tools like Claude Code compact the conversation by summarizing older parts.
Why does Claude get worse as the conversation gets long?
Anthropic calls it context rot: recall and accuracy degrade as the token count grows, so a longer window is not automatically better.
Is context the same as memory?
No. Context is what the model sees now. Memory is stored outside the window and loaded when needed.
Related
- Context length exceeded / prompt is too long: how to fix it
- Claude Code context window full: what to do
- How to give AI agents shared memory
- How to keep an AI agent's state across restarts and crashes
- How to stop re-prompting your AI every session
- How to get AI agents talking to each other
- How to get AI agents talking to each other