The context window is the total span of text — measured in tokens — that a model can read and reason over at once. In Claude Code, it holds everything the model is currently aware of: your messages, the system prompt, your CLAUDE.md and other memory files, the contents of files Claude has read, the output of tools and shell commands it has run, and its own prior responses.
Every action in a session consumes context. Reading a large file, running a verbose command, or pulling in MCP resources all add tokens, and long back-and-forth conversations accumulate them. The model has a fixed maximum window (newer Claude models support large windows), and Claude Code shows roughly how much of it is in use. As you approach the limit, the session is compacted — earlier turns are condensed into a summary so work can continue. You can trigger this manually with /compact or reset entirely with /clear when switching tasks.
Because context is finite and shared by everything in the session, managing it well matters: keep CLAUDE.md focused, lean on subagents to do scoped work in their own separate context, and clear or compact when starting an unrelated task. For exact limits and behavior, which change as models and the CLI evolve, see the official Claude Code docs.
Why it matters
Understanding the context window helps you avoid the most common Claude Code frustrations: responses that seem to \"forget\" earlier instructions, degraded quality in long sessions, and wasted tokens. Knowing what fills the window lets you keep relevant information in view, offload work to subagents, and compact or clear at the right moment — which directly improves how accurate and useful Claude Code is on real tasks.
Related terms
See Context Window in action across releases — browse the Claude Code changelog.
Get release alerts