Key takeaways
- The context window is the working memory of one session, separate from training data and from the allowance a plan provides.
- Everything counts: the system prompt, instructions, file contents, command output and the reply being written.
- Compaction replaces older turns with a summary so a session can keep going, which is why a long conversation can forget an early detail.
The Claude Code context window is the amount of text a model can consider while it answers: the system prompt, your instructions, the files it opens, the output of every command, and the reply it is writing. Think of it as working memory for one session. It is separate from the data the model was trained on, and separate from the usage allowance your plan gives you.
Tokens, plainly
Models count tokens rather than words. A token is a fragment of a word, and the ratio shifts with code, punctuation and language. Images, PDF pages, tool definitions and thinking all add tokens. Anthropic's context windows page notes that the output counts too, reasoning included.
What is already in there before you type
- the system prompt and environment details
- project and personal CLAUDE.md, or AGENTS.md
- auto memory
- names of MCP tools and descriptions of skills
- then, as work proceeds, file contents, search results, command output, diffs and replies
That list explains why a single question can still land in a session that is a third full.
How large it is
Anthropic's page, read in November 2026, lists a 1M-token window for many current Claude models and 200k for others, with up to 128k output tokens on the larger ones. The figure belongs to the model, and it differs from the maximum output setting for one response. Anthropic can change these numbers, so check the page rather than a screenshot.
Room is not the same as quality. The same page warns that accuracy and recall fall as the token count rises, an effect it calls context rot. A larger window buys space, not attention.
Compaction, step by step
Claude Code summarises older history so a session can continue. It does this on its own near the limit, and /compact does it on demand with optional instructions about what to keep. Compaction is itself a request, because it reads the conversation it is replacing.
What survives is documented, and it is worth knowing before you trust a summary:
| Item | After compaction |
|---|---|
| System prompt, output style | Still apply |
| Root CLAUDE.md, unscoped rules, auto memory | Re-injected from disk |
| Files read or edited | Up to five re-read, newest first |
| Skill bodies | Re-injected, capped per skill and in total |
| Path-scoped rules, nested CLAUDE.md | Reloaded on demand, not carried |
| Old tool output | Summarised or dropped |
A rule that must outlast compaction belongs in the root CLAUDE.md, not in a file-scoped rule.
Long sessions and the bill
Every turn sends the conversation again. Prompt caching lowers the price of the repeated prefix, not the number of tokens in it. A one-line question late in a long session still carries the whole history, and compaction adds a large read of its own. /clear costs nothing and leaves the repository untouched. /usage shows a session estimate and, on a subscription, the plan bars that matter more than the dollar figure.
Where a tracker fits
UsageAtlas keeps the part a session forgets: daily tokens, models, requests, estimated cost, supported limits and reset times across Claude Code, Codex, Cursor, OpenCode and other tools. It is a free and open source desktop app, and local tracking needs no account. It reads usage records, not prompts.
It reports usage windows, not the context window itself, so /context remains the live view of this session. Cost figures are estimates, not a bill.
FAQ
Does compaction delete code?
No. It rewrites the conversation, not your files. Code on disk is untouched. Claude may simply need to read a file again.
Is the window the same on every Claude model?
No. As of November 2026, Anthropic lists 1M tokens for many current models and 200k for others, and says the figures can change.
Can I avoid compaction entirely?
Only by keeping sessions short. /clear between tasks, fewer file reads and procedures moved into skills all reduce how often the automatic pass runs.
Frequently asked questions
Is the context window a limit on how much I can use in a month?
No. It limits one conversation. A monthly or weekly allowance is a separate accounting of model calls across your account.
Why does a large file use up so much of the window?
A file is read into the conversation as text, and text is measured in tokens. A large file can consume more of the window than dozens of short messages.
Can I see what is filling the window?
Yes. The /context command in Claude Code breaks the window down by category, including which memory and instruction files were loaded.
Sources
- Claude Code context windowAnthropic
- Context window versus usage windowUsageAtlas