Overview
Claude Code's documentation includes an interactive explorer of the context
window: a simulation of how context fills during a session, showing what loads
automatically, what each file read costs, and when rules and hooks fire. Pairing
that mental model with the in-session /context command lets you design leaner
prompts, CLAUDE.md files, and MCP setups.
What consumes context
Loaded at session start:
- System prompt: core behavior instructions, always first.
- Auto memory (MEMORY.md): the first 200 lines or 25KB of Claude's notes.
- Environment info: working directory, platform, git status.
- MCP tool names: listed so Claude knows what is available; full schemas stay
deferred and load on demand via tool search.
- Skill descriptions: so Claude can decide when to use a skill; full content
loads only when used.
- CLAUDE.md: loaded fully every request.
Loaded as you work:
- File reads and tool results, which accumulate.
- Conversation history, until compaction.
Startup Token Costs and What Survives Compaction
The interactive explorer attaches an illustrative token cost to each thing that loads before your first prompt. These numbers are labeled "illustrative" on the page, but they show the relative weight of each startup load:
System prompt 4,200 tokens
Project CLAUDE.md 1,800 tokens
Auto memory (MEMORY.md) 680 tokens
Skill descriptions 450 tokens
~/.claude/CLAUDE.md 320 tokens
Environment info 280 tokens
MCP tools (deferred) 120 tokens
When a long session compacts, what happens to each instruction depends on how it loaded:
| Mechanism |
After compaction |
| System prompt and output style |
Unchanged; not part of message history |
| Project-root CLAUDE.md and unscoped rules |
Re-injected from disk |
| Auto memory |
Re-injected from disk |
Rules with paths: frontmatter |
Lost until a matching file is read again |
| Nested CLAUDE.md in subdirectories |
Lost until a file in that subdirectory is read again |
| Invoked skill bodies |
Re-injected, capped at 5,000 tokens per skill and 25,000 tokens total; oldest dropped first |
| Hooks |
Not applicable; hooks run as code, not context |
Use the explorer and /context
- Open the interactive explorer in the context window docs to see how a session
fills and what each event costs.
- In a live session, run
/context to see what is currently consuming context.
- Identify the heaviest contributors: an oversized CLAUDE.md, eager skills, large
pasted content, or many large file reads.
Design leaner setups
- Trim CLAUDE.md: keep it to always-needed rules; move reference material to
on-demand skills. Aim to keep it small.
- Defer skills: skill descriptions load each session, but set
disable-model-invocation: true for user-only skills so nothing loads until you
invoke them.
- Rely on MCP tool search: tool names load at start with schemas deferred, so
idle MCP tools cost little.
- Prefer file references over giant pastes: write large content to a file and
ask Claude to read it.
Manage context mid-session
/clear resets to an empty context (the conversation is saved).
/compact [instructions] replaces history with a focused summary.
/context re-checks composition after changes.
Source