OmniscioGuidesClaude Code context window
The Claude Code context window: how big it is and what fills it
Every Claude Code session runs inside one context window, and everything the agent knows lives in it: your instructions, the files it read, the tools it was offered, and the conversation so far. Fable 5.1, Fable 5, Sonnet 5 and later, Haiku 5.5 and Opus 4.7 and later get a 1M-token window by default; Opus 4.6 and Sonnet 4.6 get 200K unless you pick their [1m] variant. This page covers what the window holds, what fills it, how to see what is in it, and what happens when it fills. The Sources list at the foot of the page names every source and the day it was read.
Sources read October 24, 2026. By the Omniscio team. Updated .
What the context window is
Claude Code's context window holds everything Claude knows about your session: your instructions, the files it reads, its own responses, and content that never appears in your terminal. Anthropic's list of what it holds names the conversation history, file contents, command outputs, your CLAUDE.md, auto memory, loaded skills, and system instructions. As you work, context fills up.
- The window follows the model. Claude Code's status line field reads
200000by default and1000000for models with extended context. - Each new session starts fresh. A new session does not carry the conversation history from previous sessions with it. That is what auto memory and
CLAUDE.mdare for. - A subagent gets its own window. A subagent starts fresh unless it is a fork, and either way its tool calls stay out of yours. Only a summary comes back.
How big it is, per model
Anthropic's Claude Code documentation names the models that reach a million tokens: Fable models, Sonnet 5 and later, Haiku 5.5, Opus 4.6 and later, and Sonnet 4.6 support a 1 million token context window for long sessions with large codebases.
Which of those runs at the large window by default is a separate question, and the answer changes what you have to do to get it. Fable 5.1, Fable 5, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later run with the 1M window by default, with no [1m] suffix needed, including on Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry and Claude apps gateway sessions. Opus 4.6 and Sonnet 4.6 reach 1M only through their [1m] variant, and access to that variant depends on your plan: on Max, Team and Enterprise plans Opus 4.6 with 1M context is included with the subscription, while Sonnet 4.6 with 1M context needs usage credits on every subscription plan, including Max; the Anthropic API and pay-as-you-go have full access to both. On the Anthropic API, Haiku 5.5 runs with the 1M context window on every plan.
| Models | Context window | How you get it |
|---|---|---|
| Fable 5.1, Fable 5, Sonnet 5 and later, Haiku 5.5, Opus 4.7 and later | 1M tokens | By default, with no [1m] suffix |
Opus 4.6, Sonnet 4.6 with the [1m] variant | 1M tokens | The [1m] variant, and access depends on your plan |
| Opus 4.6, Sonnet 4.6 without it | 200K tokens | The standard window |
The table covers the current models the Claude Code documentation names. It is not every model Claude Code can run.
When the number on your screen is not the model's real window
Two settings make the number Claude Code uses differ from the model's published window, and both matter if you run through a gateway:
CLAUDE_CODE_DISABLE_1M_CONTEXT=1keeps sessions at a 200K window. Claude Code removes the[1m]variants from the model picker and treats a model that runs at 1M by default as having a 200K window, so sessions compact at that boundary with auto-compaction on and stop there with it off.CLAUDE_CODE_MAX_CONTEXT_TOKENSsets the window Claude Code should assume for a model ID, but how it applies depends on the ID. Claude Code treats an ID as a provider or custom spelling when it does not start withclaude-, in any casing, or when it carries a suffix Claude Code strips when reading it, such as the@YYYYMMDDdate used on Google Cloud's Agent Platform. The variable works on its own only for such a spelling that carries no[1m]. For an ID it does resolve, or a bareclaude-name, it takes effect only when you also setDISABLE_COMPACT, which turns all compaction off. For a spelling that does carry[1m], Claude Code assumes a 1M window and the variable does not apply on its own: setCLAUDE_CODE_DISABLE_1M_CONTEXT=1alongside it to size the ID as that spelling without the suffix. Which IDs it applies to sets out all three cases.
One cause of an unexpected 200K ceiling is a model ID Claude Code cannot recognize: it assumes 200K tokens for an ID it cannot match to a model, and tells you so in a startup warning, which you fix by giving Claude Code the real window or updating it. Two others are CLAUDE_CODE_DISABLE_1M_CONTEXT and running Opus 4.6 or Sonnet 4.6 without their [1m] variant: unset the variable, or select the [1m] variant.
What fills it
Context fills in two stages: a batch before you type, and a trickle as Claude works. Anthropic's own walkthrough of a session names what loads in each.
Before you type anything
- Your
CLAUDE.mdfiles.AGENTS.mdfiles can load in place of them. - Auto memory.
- MCP tool names and server instructions.
- Skill descriptions, which load even though the full skill body does not.
- Whatever else your setup adds, such as an output style or text from
--append-system-prompt.
Claude Code loads CLAUDE.md and CLAUDE.local.md from your working directory and every directory above it, and concatenates them rather than letting them override each other, from the filesystem root down to where you launched. Claude gets the whole of each CLAUDE.md that loads at launch as long as the file is 4 MiB or smaller; a file over 4 MiB is skipped, and none of it loads. A CLAUDE.md in a subdirectory below where you launched, and a rule with paths: frontmatter, load on demand instead, once Claude reads, writes or edits the file they match. Auto memory loads the first 200 lines of MEMORY.md, or the first 25KB, whichever comes first, at the start of every conversation.
As Claude works
- Every file read adds to context, including file contents Claude pulled in itself.
- Path-scoped rules load alongside the files they match.
- Tool results arrive, including command output.
- Claude Code also adds notes of its own: a note when a file Claude read earlier changes on disk, and the commit and pull request attribution lines. You can remove the commit and pull request instructions with
includeGitInstructions, and change the attribution lines withattribution.
What each feature costs
| Feature | When it loads | What it costs |
|---|---|---|
CLAUDE.md | Session start | The full content of each file, on every request |
| Output styles | Session start, and on each switch | The active style's full instructions, on every request |
| Skills | Descriptions at start, the full body when used | Low while only the descriptions are loaded |
| MCP servers | Tool names at start, schemas on demand | Low until a specific tool is used |
| Code intelligence | After edits and on lookup | Low, and it replaces file reads you would otherwise pay for |
| Subagents | When spawned | Isolated from the main session |
| Hooks | On trigger | Nothing, unless the hook returns extra context |
MCP tool definitions are deferred by default, so only tool names and server instructions enter context at session start and adding more servers has little effect until a tool is used. A skill's description loads at the start but its body only loads when the skill is used.
How to see what is in it
Four views show the window, and each answers a different question. /context is the one to reach for first.
/context, the breakdown
Run /context for a live breakdown by category with optimization suggestions, including which CLAUDE.md and auto memory files loaded. Anthropic's commands reference describes it as visualizing current context usage as a colored grid, with suggestions for context-heavy tools, memory bloat, and capacity warnings. Pass all to expand the per-item breakdown, which fullscreen mode collapses by default so the grid stays visible.
When the conversation has grown past the window, the warning appears at the top of that same output and says how far over the limit you are and which command frees space. Anthropic's error reference covers that warning and the two commands it names, and the error messages guide here covers what each of those messages means.
The status line, the number on every message
The status line is a shell script you configure, and Claude Code hands it JSON on stdin each time it redraws. These are the context_window fields about the window:
| Field | What it gives you |
|---|---|
context_window.used_percentage | The percentage of the window in use, pre-calculated |
context_window.remaining_percentage | The percentage still free |
context_window.total_input_tokens, total_output_tokens | Token counts currently in the window, from the most recent API response |
context_window.context_window_size | The window itself: 200000 by default, or 1000000 for extended-context models |
context_window.current_usage | The same counts broken out by category, for when you need cache hits separate from fresh input |
used_percentage is calculated from input tokens only, from input_tokens plus the cache creation and cache read counts. Output tokens are not counted, and both current_usage and the two percentages can be null early in a session: current_usage is null before the first API call and again right after a /compact until the next response repopulates it. One setting moves the number away from the thing it appears to measure: while CLAUDE_CODE_AUTO_COMPACT_WINDOW is set, used_percentage measures against the model's full window, so it does not indicate when compaction will run. The simplest accurate reading is used_percentage. You do not have to write the script yourself: describe what you want to the /statusline command and it configures one, and Anthropic's own walkthrough builds one that shows the model, the directory and the context percentage as a bar.
Verbose mode, and the count beside the spinner
- Verbose mode adds a token counter to the notification row showing the size of your context as the last API response reported it.
- The count beside the spinner is a different number. As in
Deciphering… (10m 27s · ↓ 5.5k tokens), it counts the output the current turn has produced, so your prompt and the conversation history do not move it. It resets at the start of each turn and when Claude Code compacts.
Adjacent views that are not about the window
/usage shows session cost, plan usage limits and activity stats, and /cost and /stats are aliases for it. That is the plan and spend view rather than the window view. /memory opens the CLAUDE.md files and auto memory entries that /context counts, so the two are worth using together: one shows the cost, the other edits it.
When the window fills
A full window does not end your session. Claude Code manages context automatically as you approach the limit: it clears older tool outputs first, then summarizes the conversation if it needs to. Your requests and key code snippets are preserved, and detailed instructions from early in the conversation may be lost. Persistent rules belong in CLAUDE.md rather than in conversation history.
When the automatic pass runs
With no window of your own, Claude Code compacts when the conversation reaches the model's context limit, with five exceptions:
- Cloud sessions compact as the conversation approaches the model's limit.
- Sonnet 4.6 and Opus 4.6 without extended context compact at the 200K boundary.
- When you set
CLAUDE_CODE_DISABLE_1M_CONTEXT=1, models with a native 1M window, such as Sonnet 5 and the Fable models, compact at the 200K boundary. - Models running with a native 1M window compact before the window fills, at about 967K tokens by default.
- A session on a model ID Claude Code does not recognize compacts at the window it assumes for that ID.
Moving that point yourself
Anthropic's model configuration page lists four ways to set the window, plus one for a single subagent:
/autocompactwith a token count, such as/autocompact 500k, saves a window for the current model in your user settings and applies it to the session./autocompact autoreturns to the window tuned for your model. A higher-priority settings scope such as managed settings wins over it: the command saves your value, but the session keeps that scope's window, and the command says so.autoCompactWindowin a settings file sets one for every model, and takes a number from100000to1000000. A window you saved for a model with/autocompacttakes precedence over this key in the same file for that model.--autocompactat launch overrides your saved setting for that one launch without changing it, andclaude --autocompact autoruns at the tuned window even when your saved setting has a value. Unlike/autocompact, the flag is not preempted by a higher-priority settings scope.CLAUDE_CODE_AUTO_COMPACT_WINDOW, for scripts and cloud environments, takes precedence over the command, the flag and theautoCompactWindowsetting, unless the value is one Claude Code ignores. A number with no suffix is read as that many tokens, soCLAUDE_CODE_AUTO_COMPACT_WINDOW=200means 200 tokens even though/autocompact 200means 200,000.- A subagent's own
autoCompactWindowfrontmatter sets a window for that one subagent. While the environment variable is set, the subagent uses that instead and the field has no effect, unless Claude Code ignores the variable's value.
Whichever you use, Claude Code caps the window at the model's context window.
Compaction while you are away
Idle compaction is on by default. It compacts a long conversation you have stepped away from shortly before its prompt cache expires, so your next message sends a summary instead of the whole conversation, and the conversation shows a line beginning Compacted while idle, before the prompt cache expired when you come back. It needs an interactive session, auto-compaction on, a one-hour prompt cache TTL, feature flags Claude Code can fetch, and about 54 minutes of idle time with the computer awake, and it fires once the conversation has reached a token threshold that defaults to 200,000.
Where this page stops
A window that has already filled prints its own lines, and the wording of each one, what it means, and the step that clears it are the error messages guide’s job rather than this page’s, which is about the window itself. What survives a compaction, mechanism by mechanism, is on Anthropic's context window page.
Keeping the window lean
Token costs scale with context size, so a leaner window is a cheaper one as well as a roomier one. These are the levers Anthropic documents, roughly in the order they pay off.
- Clear between tasks. Run
/clearwhen you switch to unrelated work. Stale context costs tokens on every later message. Use/renamebefore clearing so you can find the session again, then/resumeto return to it. - Delegate large reads. Send research to a subagent so the file contents stay in its window rather than yours. Only a summary comes back.
- Trim what loads at startup. Your
CLAUDE.mdfiles cost tokens on every request, so keep them to instructions Claude cannot get from the code. Move instructions that only matter sometimes into a skill, which loads its body on demand, or into a path-scoped rule, which loads only alongside the files it matches. - Disable MCP servers you are not using with
/mcp, and prefer a CLI tool over an MCP server where one exists:gh,aws,gcloudandsentry-cliadd no per-tool listing at all. - Install code intelligence plugins for typed languages, so Claude navigates by symbol instead of reading several candidate files to find one definition.
- Offload processing to hooks and skills. A hook runs externally and costs nothing unless it returns extra context, so filtering test output or summarizing a large command's output in a hook keeps that output out of the window.
- Compact earlier, or with a focus.
/autocompact 500kmoves the automatic pass earlier, and/compactwith instructions lets you control what the summary preserves. - Reach for a larger window only if you need one. The 1M-context models listed above exist for long sessions over large codebases, and compaction works the same way at the larger limit.
What does not help
- Turning auto-compact off does not keep the window from filling. It removes the pass that normally handles it, so you have to compact yourself.
- A larger window does not help with the API's 32MB request-size limit. That applies to the raw request body before tokenization and is separate from the context window.
- Compaction does not keep a path-scoped rule loaded: Anthropic's table has Claude Code reload
paths:rules on demand, so one comes back once Claude touches a matching file again. A rule that must survive outright needs itspaths:frontmatter dropped, or the move to the project-rootCLAUDE.md.
What users report
Anthropic's pages describe how the window is meant to work. These are reports from users in the Claude Code issue tracker, each named and dated as the report itself names them, and each is the reporter's own measurement rather than anything Anthropic states. They are here because they are the cases where the window fills faster than the reader expected. None of them is a claim we can check, and none of them changes the documentation above.
- A large baseline before any work. Issue 91689, opened by engintas243524 on September 3, 2026, reports measuring the first assistant turn's usage across ten fresh sessions and finding totals between 40,613 and 43,344 tokens in one project and between 44,252 and 69,534 in another, with
cache_read_input_tokensidentical at 7,298 across five sessions in the same project. The reporter is explicit that the explanation they reached is by elimination rather than by direct measurement, and that trimming their ownCLAUDE.mdand disabling plugins moved the figure by only a few percent. - One oversized MCP tool, and a session that cannot continue. Issue 102389, opened by nurma-zimran on October 15, 2026, reports an MCP server whose generated
createandupdatetools each carry an input schema of about 2.99 MB, while every other tool on the same server is under 13 KB. Once tool search returned one of them, every request came back over the 1M-token limit, and the reporter reports that auto-compact ran four times in about ninety seconds without helping, because discovered tools survive compaction.
Each of these links to the report it comes from, so you can read it in full and see whether it matches what you are seeing. Claude Code changes often, and a report that has since been fixed reads exactly like one that has not.
Watching the window across many sessions
Omniscio is the desktop app we make for running many Claude Code sessions at once, and the context window is one of the things it keeps in front of you. The Context Details page in our library describes the popover that breaks down what is filling a session's window right now: a summary row of used tokens against the maximum with the categories that make up the used total, then expandable sections, one per CLI-side source, each showing its own token count. It is read-only, and it opens from the session's three-dot menu or from an optional donut-ring indicator in the header that is off by default.
Two more pieces are about the window filling rather than reading it. Context usage warnings put a line in the chat at 75% and at 90% of the window, both off by default, so a long session warns you before it compacts. Out-of-context stall recovery covers the case where a single heavy turn fills the window mid-generation and the agent stops with no closing message: Omniscio sends a "Please continue" nudge so the CLI compacts and the agent finishes, up to three times, then hands the session back to you if it still cannot finish. The features page lists the rest of it, and the download page has the installers.
Sources
Every figure, command and rule on this page rests on one of these. All were read on October 24, 2026.
- How Claude Code works, for the definition of the window, what it holds, sessions starting fresh, the context Claude Code adds on its own, and clearing older tool outputs before summarizing.
- Explore the context window, for what loads before you type and as Claude works, the 1M-context models, the options before the automatic pass, and what survives a compaction.
- Model configuration, for the models that reach 1M, the default-1M list, the
[1m]rule and the plan table,CLAUDE_CODE_DISABLE_1M_CONTEXT,CLAUDE_CODE_MAX_CONTEXT_TOKENS, the assumed 200K window for an unrecognized model ID, the default compaction thresholds, and every way to set the auto-compact window. - Set the auto-compact window, for the precedence between
/autocompact,autoCompactWindow,--autocompactandCLAUDE_CODE_AUTO_COMPACT_WINDOW, and for the managed-settings override. - Subagents, for the auto-compact window a subagent can set in its own frontmatter.
- Customize your status line, for the
context_windowfields, theused_percentageformula, and the null values early in a session and after a compaction. - All settings, for idle compaction, its conditions and its threshold.
- Commands reference, for
/context,/compact,/clear,/autocompact,/memory,/usageand/statusline. - How Claude remembers your project, for the
CLAUDE.mdloading order and the 4 MiB limit, and for the auto memory read limit. - Extend Claude Code, for the context cost of each feature.
- Manage costs effectively, for reducing token usage, for the token count beside the spinner, and for the CLI-over-MCP and code-intelligence advice.
- Connect Claude Code to tools via MCP, for deferred tool definitions.
- Error reference, for the warning
/contextprints once the conversation is past the window, and for the 32MB request-size limit. - Claude Code issue tracker reports, quoted as their openers name them: issue 91689 (engintas243524, September 3, 2026) and issue 102389 (nurma-zimran, October 15, 2026).
- Our own library pages, for the Context Details popover, the 75% and 90% warnings, and stall recovery: context details, context warnings and context stall recovery.
Claude Code ships often, and the model list, the compaction thresholds and the window figures move with it. Read the pages above again before you trust a copy of this one from a few months back.
Common questions
How big is the Claude Code context window?
Anthropic's Claude Code documentation says Fable models, Sonnet 5 and later, Haiku 5.5, Opus 4.6 and later, and Sonnet 4.6 support a 1 million token context window. Fable 5.1, Fable 5, Sonnet 5 and later, Haiku 5.5 and Opus 4.7 and later run at that window by default, while Opus 4.6 and Sonnet 4.6 need the [1m] variant. Claude Code's own status line field reads 200000 by default, or 1000000 for models with extended context.
How do I see how full it is?
Run /context for a live breakdown by category with optimization suggestions. A configured status line can show the figure continuously, from the context_window fields Claude Code passes it, and used_percentage is the simplest number to use. Verbose mode adds a token counter to the notification row showing the size of your context as the last API response reported it.
What happens when it fills up?
Claude Code clears older tool outputs first, then summarizes the conversation if it needs to. With no window of your own it compacts when the conversation reaches the model's context limit, and there are five documented exceptions. You can also move that point yourself with /autocompact, autoCompactWindow, --autocompact or CLAUDE_CODE_AUTO_COMPACT_WINDOW. Anthropic's context window page lists what survives the summary, and the error messages guide here covers every message a filled window prints.
Should I run /clear or /compact?
/clear starts a new conversation with empty context, so the old conversation no longer fills the window. It is not gone: /resume brings it back, and in the same Claude Code process the rewind menu's previous-session entry restores it. /compact summarizes the conversation so far and keeps you in the same session. To free space while continuing the same conversation, use /compact. Pass it focus instructions to choose what the summary keeps.