The Claude Code context window: a solo developer's guide

Read the window, compact on purpose, and keep what must last outside the session.

By · Published

The Claude Code context window is the amount of text the model can consider at once: the system prompt, your instructions, the files it read, tool results and the conversation. Its size depends on the model, from 200,000 tokens to 1 million on recent models, and everything in the session draws on that one budget.

This guide shows how to see what fills the window, what /compact keeps and loses, and when project state belongs outside the session.

How large is the Claude Code context window?

The size comes from the model Claude Code runs on. Anthropic's context windows documentation lists a 1 million token window on recent models, with no beta header, and 200,000 tokens on others. In Claude Code, the model configuration page lists which models run with 1 million tokens by default and which ones need a [1m] variant, such as opus[1m], selected with /model.

Situation Window
Recent models with a native long context 1 million tokens by default
Other models 200,000 tokens, or 1 million through a [1m] variant where offered

A larger window costs more per session and only postpones the moment the conversation has to be summarized. It helps for one large refactor; it does not replace a written record on a project that lasts months.

How do you check context usage in Claude Code?

Run /context. The commands reference describes it as a colored grid of current usage, with suggestions for context-heavy tools and memory files; /context all expands the breakdown per item.

Check it at the start of a session, not only near the limit. If tool definitions dominate before you have done anything, disconnecting MCP servers you are not using frees more room than any compaction. If memory files are large, trim them to what the agent cannot infer from the code.

What does /compact do, and when should you run it?

/compact summarizes the conversation so far and continues from that summary. It accepts focus instructions, for example /compact keep the auth refactor decisions and the failing tests. Claude Code also compacts on its own as the conversation approaches the limit; /autocompact sets how full the window gets before it does.

A summary keeps the outline: current task, main decisions, file paths. It drops detail: exact diffs, long tool output, the reasoning behind rejected options. That is why a freshly compacted session sometimes rereads files or proposes a fix it had already ruled out.

Compact at task boundaries, with your own instructions, rather than waiting for the automatic version in the middle of a refactor. Before compacting, write down anything that must survive. /clear is the other option: it starts a new conversation with an empty context while keeping project memory.

What loads before you type anything?

Every session starts with a fixed cost:

  • CLAUDE.md. The memory documentation says Claude Code reads it at the start of every session; the project-root file survives compaction. Files in subdirectories load when Claude works in that folder. Claude Code reads AGENTS.md only when there is no CLAUDE.md.
  • MCP tool definitions. Each connected server adds its tool list.
  • Skills. Only each skill's description loads at the start; the full body loads when the skill is used (skills documentation). Keep descriptions to a sentence or two that name when the skill applies.

Keep CLAUDE.md to rules and conventions the agent would otherwise get wrong. Long background belongs in files the agent opens only when a task needs them.

What is context engineering in practice?

Context engineering is choosing what enters the window, not fitting more in. Three layers cover most projects:

  1. Always loaded: CLAUDE.md, with build commands, conventions and the few rules that prevent real mistakes.
  2. Opened on demand: a decisions file, per-module notes, a list of dead ends, read only when relevant.
  3. Retrieved: what the agent searches for at the moment it needs it, instead of what you preload.

A minimal repository version is three committed files: CLAUDE.md for durable rules, a dated decisions log with the rejected alternative, and a dead-ends list with why each approach failed. Any agent that reads the repository picks them up.

When should you compact, use a skill, or move state out of the session?

  • Compact when the session is still productive and you only need recent decisions preserved to finish the current task.
  • Use a skill when the knowledge is a repeatable procedure. If you keep pasting the same steps, they belong in a skill that loads only when needed.
  • Move state out of the session when it must survive the session or reach another agent. A Cursor or Codex conversation cannot read Claude Code's summary, and a teammate's agent cannot read yours.

Where an external project workspace fits

A project workspace holds decisions, current state and history once, and every agent reads the part it needs. With Fileaify, agents reach the project over REST or the MCP connector, propose changes that you review, and the next conversation starts from the published record. Keys are a separate matter: they stay in Fileaify's vault, and the agent uses them through vault:// references without receiving the value.

The cost is one more service in the loop and the need to trust where the project lives. Compaction is free and immediate; a written, shared record is durable. Use /compact to finish the task, skills for repeatable procedures, and a shared record so the next session does not ask you to explain the project again. The comparison with AGENTS.md and CLAUDE.md shows what belongs in the repository and what belongs in Fileaify.

How does this hold up across agents and sessions?

Three tests apply to any setup: does the context survive a new conversation, does it survive a switch between Claude Code, Codex and Cursor, and does it keep two agents from producing two versions of the same fact?

A workspace read over MCP or REST passes the first two because the context lives outside any one tool. For documentation, Fileaify proposals carry the revision they are based on, so a change written against an outdated version is refused instead of overwriting the newer one. For code, the repository and pull requests remain the place where concurrent edits are resolved. Tools such as Pieces and Context7 cover other parts of the problem: personal working memory and current library documentation.

Sources

Try it

The demo runs on a prepared project, with no account. To keep your own project's context outside the session, create a free workspace and give your agent https://fileaify.com/agent.

Common questions

Does Claude Code compact automatically?

Yes. As the conversation approaches the model's limit, Claude Code summarizes it automatically. You can also run /compact yourself with focus instructions, and /autocompact sets how full the window gets before automatic compaction.

Why is the context partly full before I type anything?

The system prompt, tool definitions from connected MCP servers, CLAUDE.md and skill descriptions load at session start. Run /context to see the breakdown; disconnecting servers you are not using often frees more room than compacting.

Does a new conversation lose my project decisions?

Yes, if they only lived in the conversation. The project-root CLAUDE.md is reloaded and survives compaction, but decisions, dead ends and current state belong in files or a shared project workspace that the next session reads.

Can two agents share the same context window?

No. A Cursor or Codex session cannot read Claude Code's conversation or its compaction summary. Shared state has to live outside the session, in the repository or in a project workspace every agent can query.

Written with AI assistance, reviewed by Stéphane Mermet and checked against the product. Fileaify publishes this guide and sells the service it describes.