[{"data":1,"prerenderedAt":53},["ShallowReactive",2],{"blog-claude-code-context-window":3,"blog-related-claude-code-context-window":36},{"slug":4,"title":5,"description":6,"category":7,"categoryId":8,"keyword":9,"date":10,"minutes":11,"body":12,"html":13,"headings":14},"claude-code-context-window","Claude Code's context window: why it fills up and what to do","Why Claude Code's context window fills up, what loads before you type, and the commands (\u002Fcontext, \u002Fcompact, \u002Fclear) that stop you running out mid-task.","Usage & limits","usage-limits","claude code context window","2026-11-17",5,"Claude Code's context window holds everything the model can see in a session: your messages, every file it read, every command output, your CLAUDE.md, loaded skills and tool lists. It fills faster than most people expect because file reads and test output are far bigger than your prompts. Claude Code compacts automatically near the limit, so you rarely hit a hard wall, but a bloated context still costs you quality and plan usage.\n\n## What is actually in Claude Code's context window?\n\nBefore you type a word, Claude Code has already loaded a base layer: the system prompt, your `~\u002F.claude\u002FCLAUDE.md`, the project's `CLAUDE.md`, the start of auto memory (`MEMORY.md`), the names of MCP tools and the descriptions of your skills. Then every turn adds to it:\n\n- the files Claude reads (a 2,000-line file is a lot of tokens);\n- search results and command output, especially test runs and build logs;\n- Claude's own answers and its thinking;\n- rules that load when Claude touches matching files;\n- output from hooks.\n\nTwo things are not in it. A subagent works in its own context window, and only its summary comes back to yours. And a skill's full body loads only when the skill is invoked, which is why long, situational instructions belong in skills rather than in CLAUDE.md.\n\n## How do I see how full it is?\n\nRun `\u002Fcontext` in a session. It gives a live breakdown by category (system, memory files, MCP, messages, free space) with suggestions, and it tells you which CLAUDE.md and memory files actually loaded. `\u002Fmemory` opens those files for editing.\n\nYou can also put the usage in your status line (see the status line page in the official docs) so it is always in view. If the breakdown surprises you, the usual culprits are a huge CLAUDE.md, many MCP servers, or one enormous tool result that has been sitting in the conversation for an hour.\n\n## What happens when it gets full?\n\nClaude Code compacts the conversation on its own as you approach the limit: it replaces the history with a structured summary and carries on. What survives is more than you might fear:\n\n| Item | After compaction |\n| --- | --- |\n| Project-root CLAUDE.md and auto memory | Re-injected from disk |\n| The plan from plan mode | Re-injected from disk |\n| Up to five recently read or edited files | Re-read (large ones come back as a path only) |\n| Invoked skill bodies | Re-injected, with size caps |\n| Background commands and subagents | Keep running |\n| Your early instructions, given only in chat | Summarized, and may lose detail |\n\nThe last row is the one that bites. A rule you stated in message three of a long session may be paraphrased away. Anything that must always hold goes in CLAUDE.md, not in the conversation. Rules with `paths:` frontmatter and nested CLAUDE.md files load on demand, so they are summarized away like everything else; if a rule has to persist, put it in the project-root file.\n\nIf one file or tool output is so large that the context refills right after every summary, Claude Code stops auto-compacting after a few attempts and shows an error instead of looping. The fix is to stop reading that file whole.\n\n## When should I \u002Fcompact, \u002Fclear or start a new session?\n\nThe three commands do different jobs.\n\n- **`\u002Fclear`** starts a fresh conversation in the same session. Use it between unrelated tasks. Old conversation crowds out the files you need next and is re-read on every message. Run `\u002Frename` first if you want to find the old one again with `\u002Fresume`.\n- **`\u002Fcompact \u003Cfocus>`** summarizes and keeps going. Use it in the middle of one long task, with a focus: `\u002Fcompact keep the failing test names and the auth refactor decisions`. A focused summary beats the automatic guess.\n- **A new session** is right when the task is done. Sessions are independent; what carries over is CLAUDE.md and auto memory.\n\nTwo more controls are worth knowing. `\u002Frewind` lets you pick a message and choose Summarize from here or Summarize up to here, which compacts only part of the conversation. And `\u002Fautocompact` (also a `--autocompact` flag) sets how full the window gets before the automatic pass runs, if you want it to compact earlier than the default. The accepted values and defaults depend on your model, so read the model configuration page before changing it.\n\nYou can also add a standing instruction to CLAUDE.md so every compaction knows what to keep:\n\n```md\n# Compact instructions\n\nWhen you compact, keep: the list of files changed, failing test output,\nand any decision we made about the data model.\n```\n\n## How do I stop filling it up so fast?\n\nMost of the gain comes from a handful of habits:\n\n1. **Be specific.** \"Add input validation to `login()` in `auth.ts`\" reads one file. \"Improve the codebase\" reads fifty.\n2. **Delegate big reads.** Ask a subagent to investigate and report. The file contents stay in its window, and you get a summary. See [Claude Code subagents](\u002Fblog\u002Fclaude-code-subagents).\n3. **Trim CLAUDE.md.** It loads every session. Aim for essentials, and move workflow-specific instructions into skills, which load only when used. See [how to write a CLAUDE.md](\u002Fblog\u002Fclaude-md-guide).\n4. **Prune MCP servers.** Tool definitions are deferred by default, so idle servers cost little, but disable the ones you do not use. Command-line tools like `gh` add no per-tool listing at all.\n5. **Filter noisy output.** A hook can cut a test run to its last 100 lines before Claude sees it.\n6. **Plan first.** Plan mode explores and proposes before editing, which avoids reading and writing a whole wrong approach.\n\nA bigger window helps but does not remove the problem. Some models run with a one-million-token window, depending on model and plan (check the model configuration page for yours). More room is not free: Claude Code sends the whole conversation with each request, so a long session draws more from your plan on every turn, even for a one-line question. That is the link between context and your limits; [Claude Code usage limits](\u002Fblog\u002Fclaude-code-usage-limits) covers the other half.\n\n## Why does a long session eat my usage?\n\nBecause the history is re-read each turn, at the cheaper cached rate but still re-read. A session left open all day is expensive per message. The first message after a long break also misses the prompt cache and reprocesses everything. `\u002Fcompact` itself is a large request, since it reads the conversation it summarizes, while `\u002Fclear` costs nothing. So: clear when the task changes, compact with a focus when it does not, and do not leave a heavy session parked for hours if you will not return to it.\n\n## In Relais\n\nRelais shows how full a session's context is under the composer, turning orange from 70%, with a Compact button for when it is time. Sessions are ordinary Claude Code sessions, so `\u002Fcontext`, `\u002Fcompact` and `\u002Fclear` work the same. See [features](\u002Ffeatures) for the composer, and the [FAQ](\u002Ffaq) for how Relais relates to your Claude plan.","\u003Cp>Claude Code&#39;s context window holds everything the model can see in a session: your messages, every file it read, every command output, your CLAUDE.md, loaded skills and tool lists. It fills faster than most people expect because file reads and test output are far bigger than your prompts. Claude Code compacts automatically near the limit, so you rarely hit a hard wall, but a bloated context still costs you quality and plan usage.\u003C\u002Fp>\n\u003Ch2 id=\"what-is-actually-in-claude-code-39-s-context-window\">\u003Ca class=\"anchor\" href=\"#what-is-actually-in-claude-code-39-s-context-window\" aria-label=\"Link to this section\">#\u003C\u002Fa>What is actually in Claude Code&#39;s context window?\u003C\u002Fh2>\n\u003Cp>Before you type a word, Claude Code has already loaded a base layer: the system prompt, your \u003Ccode>~\u002F.claude\u002FCLAUDE.md\u003C\u002Fcode>, the project&#39;s \u003Ccode>CLAUDE.md\u003C\u002Fcode>, the start of auto memory (\u003Ccode>MEMORY.md\u003C\u002Fcode>), the names of MCP tools and the descriptions of your skills. Then every turn adds to it:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>the files Claude reads (a 2,000-line file is a lot of tokens);\u003C\u002Fli>\n\u003Cli>search results and command output, especially test runs and build logs;\u003C\u002Fli>\n\u003Cli>Claude&#39;s own answers and its thinking;\u003C\u002Fli>\n\u003Cli>rules that load when Claude touches matching files;\u003C\u002Fli>\n\u003Cli>output from hooks.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Two things are not in it. A subagent works in its own context window, and only its summary comes back to yours. And a skill&#39;s full body loads only when the skill is invoked, which is why long, situational instructions belong in skills rather than in CLAUDE.md.\u003C\u002Fp>\n\u003Ch2 id=\"how-do-i-see-how-full-it-is\">\u003Ca class=\"anchor\" href=\"#how-do-i-see-how-full-it-is\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do I see how full it is?\u003C\u002Fh2>\n\u003Cp>Run \u003Ccode>\u002Fcontext\u003C\u002Fcode> in a session. It gives a live breakdown by category (system, memory files, MCP, messages, free space) with suggestions, and it tells you which CLAUDE.md and memory files actually loaded. \u003Ccode>\u002Fmemory\u003C\u002Fcode> opens those files for editing.\u003C\u002Fp>\n\u003Cp>You can also put the usage in your status line (see the status line page in the official docs) so it is always in view. If the breakdown surprises you, the usual culprits are a huge CLAUDE.md, many MCP servers, or one enormous tool result that has been sitting in the conversation for an hour.\u003C\u002Fp>\n\u003Ch2 id=\"what-happens-when-it-gets-full\">\u003Ca class=\"anchor\" href=\"#what-happens-when-it-gets-full\" aria-label=\"Link to this section\">#\u003C\u002Fa>What happens when it gets full?\u003C\u002Fh2>\n\u003Cp>Claude Code compacts the conversation on its own as you approach the limit: it replaces the history with a structured summary and carries on. What survives is more than you might fear:\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>Item\u003C\u002Fth>\u003Cth>After compaction\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Project-root CLAUDE.md and auto memory\u003C\u002Ftd>\u003Ctd>Re-injected from disk\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>The plan from plan mode\u003C\u002Ftd>\u003Ctd>Re-injected from disk\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Up to five recently read or edited files\u003C\u002Ftd>\u003Ctd>Re-read (large ones come back as a path only)\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Invoked skill bodies\u003C\u002Ftd>\u003Ctd>Re-injected, with size caps\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Background commands and subagents\u003C\u002Ftd>\u003Ctd>Keep running\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Your early instructions, given only in chat\u003C\u002Ftd>\u003Ctd>Summarized, and may lose detail\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>The last row is the one that bites. A rule you stated in message three of a long session may be paraphrased away. Anything that must always hold goes in CLAUDE.md, not in the conversation. Rules with \u003Ccode>paths:\u003C\u002Fcode> frontmatter and nested CLAUDE.md files load on demand, so they are summarized away like everything else; if a rule has to persist, put it in the project-root file.\u003C\u002Fp>\n\u003Cp>If one file or tool output is so large that the context refills right after every summary, Claude Code stops auto-compacting after a few attempts and shows an error instead of looping. The fix is to stop reading that file whole.\u003C\u002Fp>\n\u003Ch2 id=\"when-should-i-compact-clear-or-start-a-new-session\">\u003Ca class=\"anchor\" href=\"#when-should-i-compact-clear-or-start-a-new-session\" aria-label=\"Link to this section\">#\u003C\u002Fa>When should I \u002Fcompact, \u002Fclear or start a new session?\u003C\u002Fh2>\n\u003Cp>The three commands do different jobs.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ccode>\u002Fclear\u003C\u002Fcode>\u003C\u002Fstrong> starts a fresh conversation in the same session. Use it between unrelated tasks. Old conversation crowds out the files you need next and is re-read on every message. Run \u003Ccode>\u002Frename\u003C\u002Fcode> first if you want to find the old one again with \u003Ccode>\u002Fresume\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>\u002Fcompact &lt;focus&gt;\u003C\u002Fcode>\u003C\u002Fstrong> summarizes and keeps going. Use it in the middle of one long task, with a focus: \u003Ccode>\u002Fcompact keep the failing test names and the auth refactor decisions\u003C\u002Fcode>. A focused summary beats the automatic guess.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A new session\u003C\u002Fstrong> is right when the task is done. Sessions are independent; what carries over is CLAUDE.md and auto memory.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Two more controls are worth knowing. \u003Ccode>\u002Frewind\u003C\u002Fcode> lets you pick a message and choose Summarize from here or Summarize up to here, which compacts only part of the conversation. And \u003Ccode>\u002Fautocompact\u003C\u002Fcode> (also a \u003Ccode>--autocompact\u003C\u002Fcode> flag) sets how full the window gets before the automatic pass runs, if you want it to compact earlier than the default. The accepted values and defaults depend on your model, so read the model configuration page before changing it.\u003C\u002Fp>\n\u003Cp>You can also add a standing instruction to CLAUDE.md so every compaction knows what to keep:\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"md\">\u003Ccode># Compact instructions\n\nWhen you compact, keep: the list of files changed, failing test output,\nand any decision we made about the data model.\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2 id=\"how-do-i-stop-filling-it-up-so-fast\">\u003Ca class=\"anchor\" href=\"#how-do-i-stop-filling-it-up-so-fast\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do I stop filling it up so fast?\u003C\u002Fh2>\n\u003Cp>Most of the gain comes from a handful of habits:\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>Be specific.\u003C\u002Fstrong> &quot;Add input validation to \u003Ccode>login()\u003C\u002Fcode> in \u003Ccode>auth.ts\u003C\u002Fcode>&quot; reads one file. &quot;Improve the codebase&quot; reads fifty.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Delegate big reads.\u003C\u002Fstrong> Ask a subagent to investigate and report. The file contents stay in its window, and you get a summary. See \u003Ca href=\"\u002Fblog\u002Fclaude-code-subagents\">Claude Code subagents\u003C\u002Fa>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Trim CLAUDE.md.\u003C\u002Fstrong> It loads every session. Aim for essentials, and move workflow-specific instructions into skills, which load only when used. See \u003Ca href=\"\u002Fblog\u002Fclaude-md-guide\">how to write a CLAUDE.md\u003C\u002Fa>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Prune MCP servers.\u003C\u002Fstrong> Tool definitions are deferred by default, so idle servers cost little, but disable the ones you do not use. Command-line tools like \u003Ccode>gh\u003C\u002Fcode> add no per-tool listing at all.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Filter noisy output.\u003C\u002Fstrong> A hook can cut a test run to its last 100 lines before Claude sees it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Plan first.\u003C\u002Fstrong> Plan mode explores and proposes before editing, which avoids reading and writing a whole wrong approach.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>A bigger window helps but does not remove the problem. Some models run with a one-million-token window, depending on model and plan (check the model configuration page for yours). More room is not free: Claude Code sends the whole conversation with each request, so a long session draws more from your plan on every turn, even for a one-line question. That is the link between context and your limits; \u003Ca href=\"\u002Fblog\u002Fclaude-code-usage-limits\">Claude Code usage limits\u003C\u002Fa> covers the other half.\u003C\u002Fp>\n\u003Ch2 id=\"why-does-a-long-session-eat-my-usage\">\u003Ca class=\"anchor\" href=\"#why-does-a-long-session-eat-my-usage\" aria-label=\"Link to this section\">#\u003C\u002Fa>Why does a long session eat my usage?\u003C\u002Fh2>\n\u003Cp>Because the history is re-read each turn, at the cheaper cached rate but still re-read. A session left open all day is expensive per message. The first message after a long break also misses the prompt cache and reprocesses everything. \u003Ccode>\u002Fcompact\u003C\u002Fcode> itself is a large request, since it reads the conversation it summarizes, while \u003Ccode>\u002Fclear\u003C\u002Fcode> costs nothing. So: clear when the task changes, compact with a focus when it does not, and do not leave a heavy session parked for hours if you will not return to it.\u003C\u002Fp>\n\u003Ch2 id=\"in-relais\">\u003Ca class=\"anchor\" href=\"#in-relais\" aria-label=\"Link to this section\">#\u003C\u002Fa>In Relais\u003C\u002Fh2>\n\u003Cp>Relais shows how full a session&#39;s context is under the composer, turning orange from 70%, with a Compact button for when it is time. Sessions are ordinary Claude Code sessions, so \u003Ccode>\u002Fcontext\u003C\u002Fcode>, \u003Ccode>\u002Fcompact\u003C\u002Fcode> and \u003Ccode>\u002Fclear\u003C\u002Fcode> work the same. See \u003Ca href=\"\u002Ffeatures\">features\u003C\u002Fa> for the composer, and the \u003Ca href=\"\u002Ffaq\">FAQ\u003C\u002Fa> for how Relais relates to your Claude plan.\u003C\u002Fp>\n",[15,18,21,24,27,30,33],{"id":16,"text":17},"what-is-actually-in-claude-code-39-s-context-window","What is actually in Claude Code&#39;s context window?",{"id":19,"text":20},"how-do-i-see-how-full-it-is","How do I see how full it is?",{"id":22,"text":23},"what-happens-when-it-gets-full","What happens when it gets full?",{"id":25,"text":26},"when-should-i-compact-clear-or-start-a-new-session","When should I \u002Fcompact, \u002Fclear or start a new session?",{"id":28,"text":29},"how-do-i-stop-filling-it-up-so-fast","How do I stop filling it up so fast?",{"id":31,"text":32},"why-does-a-long-session-eat-my-usage","Why does a long session eat my usage?",{"id":34,"text":35},"in-relais","In Relais",[37,42,47],{"slug":38,"title":39,"description":40,"category":7,"categoryId":8,"keyword":41,"date":10,"minutes":11},"claude-code-usage-limits","Claude Code usage limits: the 5-hour window and weekly cap","How Claude Code's 5-hour window and weekly limit work, what makes you hit them, how to check usage, and what to do the moment Claude Code stops.","claude code usage limits",{"slug":43,"title":44,"description":45,"category":7,"categoryId":8,"keyword":46,"date":10,"minutes":11},"claude-code-pro-vs-max","Claude Pro or Max for Claude Code: which plan fits you?","Claude Pro or Max for Claude Code? How to decide from your own usage: how often you hit the limit, how many sessions you run, and what else you could do.","claude pro vs max claude code",{"slug":48,"title":49,"description":50,"category":7,"categoryId":8,"keyword":51,"date":10,"minutes":52},"claude-code-multiple-accounts","How to use several Claude accounts with Claude Code","Keep a personal plan and a work seat signed in to Claude Code at once with CLAUDE_CONFIG_DIR, switch cleanly, and avoid the API key trap. Commands included.","claude code multiple accounts",4,1794931098788]