Heads up: some links below are referral links. They cost you nothing extra and never change what we recommend. How this site makes money.
The short answer
Claude Code's context window is the session's working memory. It holds far more than your
conversation: the system prompt, your project's CLAUDE.md, auto memory, the names of every
MCP tool you have connected, your skill descriptions, every file Claude has read, every tool result,
and the full back-and-forth — including content that never appears in your terminal.
You don't have to guess at any of this. Run /context for a live
breakdown by category, with optimisation suggestions and a list of which CLAUDE.md and auto
memory files actually loaded.
This page is about Claude Code specifically. For the window in the Claude app and on paid plans, see Claude's context window explained.
| Command | What it does |
|---|---|
/context | Live breakdown of your actual usage by category |
/compact | Replace the conversation with a structured summary |
/compact focus on <topic> | Summarise, keeping what you choose |
/autocompact 500k | Set how full the window gets before auto-compaction |
/clear | Wipe the conversation when switching to unrelated work |
/rewind | Summarise from, or up to, a chosen message |
/memory | Open and edit the memory files that loaded |
What's in there before you type a word
A common surprise: the window is already partly full at startup. Before your first prompt, Claude Code
loads your CLAUDE.md, auto memory, MCP tool names, and your skill descriptions (not
the skills themselves — full skill content loads only when one is actually used).
Then, as Claude works, each file it reads adds to the window, path-scoped rules load alongside the files they match, and hook output gets added too.
This is why "my context filled up fast and I barely said anything" is normal. Most of a typical session's context is project knowledge and tool results, not your words.
What happens when it fills up
A full context window does not end your session. Claude Code compacts automatically as you approach the limit — it summarises the conversation history so far and carries on.
The point at which that automatic pass runs depends on your model and configuration, so there is no
single number worth quoting here. /context shows you where you actually stand, and the
official docs list the per-model thresholds.
What survives compaction — and what doesn't
This is the part that trips people up, because it isn't uniform. Content loaded from disk comes back; content that lived in the conversation gets summarised away.
| Mechanism | After compaction |
|---|---|
| System prompt and output style | Unchanged — never part of message history |
Project-root CLAUDE.md, unscoped rules, auto memory | Re-injected from disk |
| A plan written in plan mode | Re-injected from disk |
Rules with paths: frontmatter, nested CLAUDE.md | Reloaded only as Claude reads matching files again |
| Files Claude read or edited | Up to five re-read, most recently modified first |
| Invoked skill bodies | Re-injected — capped at 5,000 tokens per skill and 25,000 total, oldest dropped first |
| Skill descriptions | Not reloaded |
| Context added earlier by hooks | Summarised with everything else |
Two practical consequences worth knowing:
- A file over 5,000 tokens comes back as a path reference, not its content — it
shows as
Referenced filerather thanRead. Its rules still reload. - If a rule must survive compaction, don't scope it by path. Drop the
paths:frontmatter or move it into the project-rootCLAUDE.md.
Because truncation keeps the start of a skill file, put the instructions that matter most near
the top of your SKILL.md.
Taking control before the automatic pass
Automatic compaction guesses what's important. You'll usually get a better result acting first:
- Compact with a focus.
/compact focus on the auth bug fixkeeps what you name instead of what the automatic pass infers. Worth doing before starting a long new task. - Clear between unrelated tasks.
/clear— old conversation crowds out the files you need next and costs tokens on every single message until it's gone. - Compact earlier.
/autocompact 500ksets how full the window gets before the automatic pass fires. - Summarise part of a session.
/rewind, pick a message, then Summarize from here or Summarize up to here.
The highest-leverage habit is delegating big reads to a subagent. A subagent works in its own separate context window, so the files it opens never touch yours — only its summary and a small metadata trailer come back. For research across many files, that's the difference between spending your window and spending someone else's.
Getting a bigger window instead of a smaller conversation
Sometimes the answer isn't a tighter session, it's more room. Fable 5, Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support a 1 million token context window.
Selection isn't identical across models: some are chosen as a [1m] model variant, while
Sonnet 5 runs at 1M with no [1m] variant to pick. Availability also depends on
your plan, so check the extended-context docs for your setup. Compaction still works the same way at the
larger limit.
Be honest with yourself about whether you need it. A 1M window costs more per message once it's full, and a disciplined 200K session with subagents doing the heavy reading often beats a sprawling one.
Common questions
How do I check my actual context usage in Claude Code?
Does Claude Code stop working when the context window is full?
Can I change when auto-compaction kicks in?
Why does my context fill up before I've done much?
Do my skills reload after compaction?
Claude Code is included with paid Claude plans
The 1M-token window is available on Fable 5, Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 — availability varies by plan.