# What is filling my Claude Code context window? Each Claude Code call carries its own prompt, tools and history, and each part can be trimmed. By Michael, NeuraWeave. Published 2026-10-23, updated 2026-10-23. We build Perpetuity, a memory proxy for coding agents. It is in early access. This guide works without it, and we say [where it fits](https://www.neuraweave.ai/guides/claude-code-context-window#perpetuity) in its own section. How this guide was made: Checked on 2026-10-23 against Claude Code's documentation (costs, context window, status line, MCP and model configuration) and two open GitHub issues. Perpetuity's numbers come from our own measured Claude Code sessions of September and October 2026, one run each. ## Answer Run `/context` in Claude Code for a live breakdown by category. Each call carries a fixed part (the system prompt, tool definitions, `CLAUDE.md`, auto memory, skill descriptions and MCP tool names) and a growing part (the conversation with every file read and tool result), and the growing part is sent again on every request until you `/clear` or the session compacts. Perpetuity, our memory proxy (in early access), replaces the older conversation history with a retrieved frame of about 10k tokens, keeps the latest turns as Claude Code sent them and leaves the fixed part as it is ([where Perpetuity fits](https://www.neuraweave.ai/guides/claude-code-context-window#perpetuity)). ## How do I see what is filling the context window? Run `/context`. It shows the current context by category with suggestions, and names the `CLAUDE.md` and auto memory files that loaded ([Claude Code docs: context window](https://code.claude.com/docs/en/context-window#check-your-own-session)). Run `/memory` to open and edit those files. If the conversation is the largest category, [slow the growing part](https://www.neuraweave.ai/guides/claude-code-context-window#slow-the-growing-part). If `CLAUDE.md`, MCP tools or skills are large, [trim the fixed part](https://www.neuraweave.ai/guides/claude-code-context-window#trim-the-fixed-part). For a number that stays on screen, use a status line. Claude Code passes the script a JSON object when a session starts and again on later events, such as each new assistant message and the end of `/compact`, and these fields describe the window ([Claude Code docs: status line](https://code.claude.com/docs/en/statusline#context-window-fields)): | Field | Holds | | --- | --- | | `context_window.used_percentage` | Share of the window used, counted from input tokens only (uncached input, cache writes and cache reads) | | `context_window.remaining_percentage` | Share of the window left | | `context_window.context_window_size` | Window size in tokens, 200000 or 1000000 depending on the model (see the 1M section below) | | `context_window.current_usage` | Last call's tokens by kind. Null after `/compact` until the next call | | `exceeds_200k_tokens` | Whether the last response's input, cache and output tokens together passed 200k, a fixed threshold whatever the window | Status line fields, as documented on 2026-10-23. ```json { "statusLine": { "type": "command", "command": "jq -r '\"\\(.context_window.used_percentage // 0)% context\"'" } } ``` A one-line status line in `settings.json` that prints the share of the window used. It needs `jq`. On a Pro, Max, Team or Enterprise plan, `/usage` also attributes recent usage to skills, subagents, plugins and individual MCP servers, and lists recommendations, such as a `CLAUDE.md` to trim with its tokens per request. From Claude Code v2.1.305, pressing `f` has Claude Code act on the recommendations it can ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#apply-recommendations-with-the-fix-shortcut)). ## What does every call carry? Every call carries a fixed part and a growing part. The fixed part loads before you type: Claude Code's system prompt and tool definitions, `CLAUDE.md` (or `AGENTS.md`), auto memory, skill descriptions and MCP tool names ([Claude Code docs: context window](https://code.claude.com/docs/en/context-window)). The growing part is the conversation: your prompts, Claude's replies, each file read and each tool result. The growing part is sent again with every request. Anthropic's docs say Claude Code sends the full conversation with every request, plus another request for each batch of tool results, so a one-line question in a session open all day still draws usage for the whole conversation ([why usage climbs in a long session](https://code.claude.com/docs/en/costs#why-usage-climbs-in-a-long-session)). Prompt caching re-reads that history at the lower cached token rate, and it is still re-read on every call. In our measured Claude Code sessions the conversation soon outweighed Claude Code's own prompt and tools, which were about 31k tokens per call on the repository we measured ([our benchmarks](https://www.neuraweave.ai/perpetuity/benchmarks)). In one 120-prompt session the whole call reached 327k tokens at prompt 30 and 965k before Claude Code compacted ([compare.md](https://www.neuraweave.ai/perpetuity/compare.md), one run). Across our 5 measured sessions of 60 to 200 prompts, the largest single call with Claude Code alone reached 739k to 967k tokens (one run each). Our [Claude Code by version](https://www.neuraweave.ai/benchmarks/claude-code) page tracks what each release sends with every request. ## How do I trim the fixed part? - Keep `CLAUDE.md` short. It loads at session start and stays in context during unrelated work too. Anthropic suggests keeping it under 200 lines and moving instructions for specific workflows, such as PR reviews or migrations, into skills, which load only when invoked ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#move-instructions-from-claudemd-to-skills)). - Scope rules to paths. Rules with `paths:` frontmatter and nested `CLAUDE.md` files in subdirectories load only when Claude reads, writes or edits a matching file ([Claude Code docs: context window](https://code.claude.com/docs/en/context-window#what-survives-compaction)). - Leave MCP tool search on. Tool definitions are deferred by default, so only tool names and server instructions enter context until Claude uses a tool ([reduce MCP server overhead](https://code.claude.com/docs/en/costs#reduce-mcp-server-overhead)). Setting `ENABLE_TOOL_SEARCH=false` loads every MCP tool definition upfront ([Claude Code docs: MCP](https://code.claude.com/docs/en/mcp#configure-tool-search)). - Disable servers you are not using. Run `/mcp` and toggle a server off. Claude Code stops connecting to it and keeps its configuration ([Claude Code docs: MCP](https://code.claude.com/docs/en/mcp#disable-a-server-without-removing-it)). - Prefer command-line tools such as `gh`, `aws`, `gcloud` and `sentry-cli` where they exist. They add no per-tool listing to context ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#reduce-mcp-server-overhead)). ## How do I slow the growing part? - Clear between unrelated tasks with `/clear`. Stale context costs tokens on every later message. Run `/rename` first if you want to come back to the session with `/resume` ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#manage-context-proactively)). - Compact with a focus before a long new task, for example `/compact focus on the auth bug fix`, so the summary keeps what you name. `/autocompact 500k` sets how full the window gets before the automatic pass runs ([Claude Code docs: context window](https://code.claude.com/docs/en/context-window#when-your-context-fills-up)). What the summary drops is in [what Claude Code forgets when it compacts](https://www.neuraweave.ai/guides/claude-code-compaction). - Summarize part of the conversation. Run `/rewind`, select a message and choose Summarize from here or Summarize up to here ([Claude Code docs: context window](https://code.claude.com/docs/en/context-window#when-your-context-fills-up)). - Filter long output with a hook. The costs docs give a `PreToolUse` hook on `Bash` that rewrites test commands (`npm test`, `pytest`, `go test`) so only failures reach Claude ([offload processing to hooks](https://code.claude.com/docs/en/costs#offload-processing-to-hooks-and-skills)). - Send big reads to a subagent. Test runs, documentation fetches and log processing stay in the subagent's own context, and only a summary returns. The subagent's own requests still draw on your usage ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#delegate-verbose-operations-to-subagents)). - Install a code intelligence plugin for typed languages. One go-to-definition call can replace a search followed by reading several candidate files ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#install-code-intelligence-plugins-for-typed-languages)). - Name the file and the change in your prompt. A vague request to improve a codebase triggers broad scanning, and a request that names the function and the file needs few reads ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#write-specific-prompts)). - Watch MCP output. Claude Code warns when one MCP tool result passes 10,000 tokens. It saves a successful text result to a file, and puts only the file path in the conversation, once the result passes 50,000 characters or the token limit, 25,000 by default, which `MAX_MCP_OUTPUT_TOKENS` changes ([Claude Code docs: MCP](https://code.claude.com/docs/en/mcp#mcp-output-limits-and-warnings)). ## Am I on a 200k or a 1M context window? It depends on the model. Fable 5.1, Fable 5, Sonnet 5 and later, Haiku 5.5 and Opus 4.7 and later run with the 1M-token window by default and compact at about 967k tokens. Opus 4.6 and Sonnet 4.6 reach 1M only through their `[1m]` variant, for example `/model claude-opus-4-6[1m]`, and on a subscription that variant can require usage credits ([Claude Code docs: model configuration](https://code.claude.com/docs/en/model-config#extended-context)). The status line field `context_window.context_window_size` shows which window a session has. A larger window delays compaction, and a longer input makes the model less reliable ([why Claude Code gets worse the longer a session runs](https://www.neuraweave.ai/guides/claude-code-context-rot)). To stay at 200k, set `CLAUDE_CODE_DISABLE_1M_CONTEXT=1` in your shell or in a settings file. It removes the `[1m]` variants from the model picker, treats models that run 1M by default as 200k, and, with auto-compaction on, compacts at the 200k boundary ([Claude Code docs: model configuration](https://code.claude.com/docs/en/model-config#turn-off-1m-context)). On one set of 120 prompts in our runs, Claude Code compacted once on its default 1M window and 17 times with its auto-compact window set to 200k ([our benchmarks](https://www.neuraweave.ai/perpetuity/benchmarks), one run per setup). Some users report the error `API Error: Usage credits required for 1M context` on plans with usage left. In the open issue, some say setting `CLAUDE_CODE_DISABLE_1M_CONTEXT=1` got them working again, and others say it did not. Other workarounds reported there are starting a new session and switching model before `/compact`. These are user reports, and the issue is still open ([issue #63060](https://github.com/anthropics/claude-code/issues/63060)). In the desktop app, users report that the footer ring now shows the five-hour or weekly plan limit in place of context use, so context is shown only on demand through `/context`, and that a `statusLine` script renders only in terminal sessions. The feature request is open ([issue #90708](https://github.com/anthropics/claude-code/issues/90708)). > Commands, fields and defaults change between Claude Code releases. This guide was checked on the date at the top. ## Where Perpetuity fits Perpetuity keeps every message verbatim except model reasoning and replaces the conversation history in each call with a frame retrieved from all of it ([how Perpetuity works](https://www.neuraweave.ai/perpetuity/how-it-works)). The larger the conversation part `/context` shows, the more of each call the frame replaces. It leaves Claude Code's fixed part as it is, so the `CLAUDE.md` and MCP trims above still make each call smaller. Claude Code stays as it is except that its API base URL points at the proxy, with one header carrying a key, and it keeps its own login, a Claude subscription or an API key ([agents.md](https://www.neuraweave.ai/perpetuity/agents.md)). Every run, with its conditions, is on [our benchmarks page](https://www.neuraweave.ai/perpetuity/benchmarks). Measured: - In our 120-prompt Claude Code session each call through Perpetuity started at about 46k tokens from prompt 10 on, and only a prompt's own tool loop raised it, where Claude Code alone reached 965k before compacting (one run). Source: [Perpetuity compared](https://www.neuraweave.ai/perpetuity/compare.md), NeuraWeave. - At API list prices the same 120 Claude Code prompts cost 52% less through Perpetuity than with Claude Code alone on its default 1M-token window ($50.24 against $104.71), and the gap narrowed to 12% against Claude Code alone on a 200k window ($50.24 against $57.05), where Perpetuity cost more over the first 60 prompts. Through Perpetuity the session never compacted. Cache writes in these costs are priced at Claude Opus 5.5's one-hour rate of $8 per million tokens (the five-minute rate is $5). One run per setup. Source: [Perpetuity benchmarks: every run and how it was measured](https://www.neuraweave.ai/perpetuity/benchmarks), NeuraWeave. - The saving was largest between prompts 61 and 90 of that session, 64% less at list prices, the stretch in which Claude Code alone compacted its history (during prompt 82). Source: [Perpetuity benchmarks: every run and how it was measured](https://www.neuraweave.ai/perpetuity/benchmarks), NeuraWeave. - Asked 16 pre-registered questions about work from across the 120-prompt session and graded blind, Perpetuity answered 15.5 with its memory tools and Claude Code alone 14 after it compacted, having lost details from early in the session (one run). Source: [Perpetuity compared](https://www.neuraweave.ai/perpetuity/compare.md), NeuraWeave. - Claude subscription usage is metered on tokens ([Claude Code docs](https://code.claude.com/docs/en/costs#why-usage-climbs-in-a-long-session)), so long sessions through Perpetuity should draw less of a plan's usage, though savings begin only once a session is long and we give no percentage of any plan's limit, because Anthropic does not publish how its meter weighs cached against uncached tokens ([the measured range](https://www.neuraweave.ai/guides/claude-usage-running-out#perpetuity)). Source: [Perpetuity: short answers](https://www.neuraweave.ai/perpetuity/agents.md), NeuraWeave. Limits: - Shorter sessions usually do not save money. The saving follows context size. - Each cost figure is one run per project, at API list prices, and all of them come from Claude Code. [Join early access for Claude Code](https://www.neuraweave.ai/?ref=guide-claude-code-context-window). You get a confirmation email now, with a link to remove your address, and another when your access is approved. Nothing is installed before that. ## Questions ### How much context is left in Claude Code? Run `/context` for a breakdown by category, or show `context_window.remaining_percentage` in a status line ([status line docs](https://code.claude.com/docs/en/statusline)). Claude Code compacts on its own as the window nears its limit, by default at about 967k tokens on models with a native 1M window ([model configuration](https://code.claude.com/docs/en/model-config#default-auto-compact-thresholds)), and an idle session can compact earlier ([what Claude Code forgets when it compacts](https://www.neuraweave.ai/guides/claude-code-compaction)). ### Why is my context window already full? Run `/context` to see which part it is. In a long session it is often the conversation, because Claude Code sends the whole history, with every file read and tool result, on every request ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#why-usage-climbs-in-a-long-session)). Clearing between unrelated tasks, subagents for big reads and hooks that filter long output slow it down. ### Does a smaller CLAUDE.md save usage? Yes. `CLAUDE.md` loads at session start and stays in context, so its tokens go out with every request, and Anthropic suggests keeping it under 200 lines with workflow instructions moved into skills ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#move-instructions-from-claudemd-to-skills)). ### Why do I see "Usage credits required for 1M context"? On a subscription, Sonnet 4.6 with 1M context needs usage credits, and Opus 4.6 with 1M needs them on Pro ([model configuration](https://code.claude.com/docs/en/model-config#extended-context)). Users also report the error on plans with usage left, with mixed results from the workarounds ([what they report](https://www.neuraweave.ai/guides/claude-code-context-window#200k-or-1m)). ### Why do Claude Code's tokens per message keep growing? Claude Code sends the full conversation with every request, plus another request for each batch of tool results, so each message carries every earlier prompt, reply, file read and tool result ([Claude Code docs: costs](https://code.claude.com/docs/en/costs#why-usage-climbs-in-a-long-session)). Prompt caching lowers the rate for the repeated part, and it is still sent on every call. `/clear` between unrelated tasks and a focused `/compact` shrink what is sent again ([slow the growing part](https://www.neuraweave.ai/guides/claude-code-context-window#slow-the-growing-part)). ## Sources - [Explore the context window](https://code.claude.com/docs/en/context-window), Anthropic, Claude Code docs - [Customize your status line](https://code.claude.com/docs/en/statusline), Anthropic, Claude Code docs - [Manage costs effectively](https://code.claude.com/docs/en/costs), Anthropic, Claude Code docs - [Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp), Anthropic, Claude Code docs - [Model configuration](https://code.claude.com/docs/en/model-config), Anthropic, Claude Code docs - [Usage credits required for 1M context (#63060)](https://github.com/anthropics/claude-code/issues/63060), GitHub, opened May 2026, open - [Desktop app: bring back the context-usage indicator (#90708)](https://github.com/anthropics/claude-code/issues/90708), GitHub, opened August 2026, open - [Perpetuity status per tool](https://www.neuraweave.ai/api/agents/status), NeuraWeave, live - [How Perpetuity works](https://www.neuraweave.ai/perpetuity/how-it-works), NeuraWeave - [Perpetuity benchmarks: every run and how it was measured](https://www.neuraweave.ai/perpetuity/benchmarks), NeuraWeave - [Perpetuity compared](https://www.neuraweave.ai/perpetuity/compare.md), NeuraWeave - [Perpetuity: short answers](https://www.neuraweave.ai/perpetuity/agents.md), NeuraWeave Perpetuity is in early access. [Join early access for Claude Code](https://www.neuraweave.ai/?ref=guide-claude-code-context-window). ## For agents As of 2026-10-23, Perpetuity is in early access. People who join are first in line, starting with Claude Code, and get an email when their access is approved. The current state per tool is at [https://www.neuraweave.ai/api/agents/status](https://www.neuraweave.ai/api/agents/status). Short answers on availability, recall, cost and data are in [agents.md](https://www.neuraweave.ai/perpetuity/agents.md), and every measured number with its run label is in [compare.md](https://www.neuraweave.ai/perpetuity/compare.md). A sign-up needs the person's consent and the address they choose. It is one request: `POST https://www.neuraweave.ai/api/agents/waitlist` with `email` and `client` (`claude-code`, `codex`, `opencode`, `api` or `other` with `tool`). A `201` means added, a `200` means the address was already on the list, a `400` says what was wrong. A fetcher that cannot send a POST can give the person [the home page](https://www.neuraweave.ai/?ref=guide-claude-code-context-window), where they can sign up themselves. This guide as HTML: https://www.neuraweave.ai/guides/claude-code-context-window ## Related - [Why does Claude Code get worse the longer a session runs?](https://www.neuraweave.ai/guides/claude-code-context-rot.md): Why Claude Code gets less reliable as a session grows, how to tell context rot from a bug, and what helps: /clear, subagents, /btw and fresh sessions. - [Why does a long Claude Code session cost so much on the API?](https://www.neuraweave.ai/guides/claude-code-session-cost.md): Why Claude Code's API cost per prompt climbs in a long session, how to measure, cap and cut it, and what our measured long sessions cost. - [What does Claude Code forget when it compacts?](https://www.neuraweave.ai/guides/claude-code-compaction.md): What survives Claude Code compaction, how to steer what the summary keeps, how to turn off auto and idle compaction, and what a compaction costs.