Build with live web data

Claude Code Context Window: What Fills It, What It Costs

Ninad Pathak
Claude Code Context Window — TinyFish Insights

If you've used Claude Code in long sessions, you probably noticed the auto-compaction that happens mid-conversation. That's the Claude Code context window reaching the model's limit. But by this point, Claude has already started to forget earlier instructions or miss nuances from earlier instructions.

So I ran some tests on what the window consists of, what fills it, and how to optimize your Claude Code context window for long-running sessions. The rest of this piece is how to work inside it so Claude keeps following the instructions you gave earlier and its answers stay accurate.

TL;DR

  • Claude's context window is its working memory: instructions, conversation history, file contents, and tool results, plus room for its next reply.
  • Each request resends the active context. Caching makes repeated input cheaper, but cached tokens still occupy the window.
  • Run /compact with details to preserve, or tune /autocompact to summarize earlier. Use /clear when old discussion stops helping, saving a handoff for unfinished work.
  • Keep CLAUDE.md focused, load detailed workflows through skills, and disable unused MCP servers to keep unneeded material out.
  • Use subagents for research summaries, /btw for side questions, and /branch for alternative approaches. Branches separate discussion while sharing working files.
  • Use TinyFish when web research needs structured search results or page content as Markdown. This avoids bringing raw HTML and navigation into the conversation.

What is the Claude Code context window?

The context window is everything the model can read while it writes its next reply.

In Claude Code that means your whole conversation history so far. That makes the window the model's working memory, as distinct from what it learned in training.

Everything in a request counts against it. That means:

  • The system prompt
  • Every prior message
  • Tool result
  • Tool definitions
  • and the output Claude is about to write

Claude Code adds file contents, command output, CLAUDE.md, auto memory, and loaded skills on top of your conversation.

The Claude Code context window size is up to one million tokens on current models. It compacts the conversation when it nears that limit.

Claude's 1 million context window and how to turn it on

On the API the million-token window is already on. Inside Claude Code, it depends on your plan.

Claude Fable 5.1, Opus 5, and Sonnet 5 carry the 1M-token context window without a beta header, and so do Claude Fable 5, Opus 4.8, Opus 4.7, Opus 4.6, and Sonnet 4.6, which are now considered legacy models that are still available.

On Max, Team, and Enterprise plans, Opus is upgraded to 1M automatically. Pick a 1M variant by adding the 1m suffix in square brackets to an alias or a full model name.

text
/model opus[1m]
/model sonnet[1m]
/model claude-opus-4-8[1m]


To make it permanent, put the same string in the model key of your settings file or in the ANTHROPIC_MODEL environment variable. Sonnet 5 is the exception with no 1m variant, because it always runs at 1M and compacts on its own at about 967K.

What's in your Claude Code context before you type anything

The Claude Code context window has a stack of instructions, the tool definitions, and elements from memory before you enter the first prompt. You don't see any of this on the frontend.

What loads at startup

ComponentLoadsTokens
System prompt, with the built-in tool definitionsEvery request4,200 in the docs; 4.1k plus 7.1k of tools in our capture
Auto memorySession start779 in our capture
Environment infoSession startNo figure
MCP tool names and server instructionsSession startNo figure
Skill descriptions, one line per installed skillEvery request6.3k in our capture
User-level CLAUDE.mdSession startNo figure
Project CLAUDE.md, with any file it imports through an @path mentionSession start1,800 in the docs
Path-scoped rules in the .claude/rules directory and nested CLAUDE.md filesOn demand, when Claude reads a matching fileNo figure

MCP tools used to be the largest line. Scott Spence's capture from September 2025 showed 82,000 tokens of MCP tools, which was 41 percent of his window, with every server loaded upfront.

But that has changed and tool search now defers the schemas by default. Only tool names and server instructions load at start and the full definition arrives when Claude first calls that tool.

Web context fills a window faster than anything else however. We tested it by fetching some docs pages using Claude Code's built-in web_fetch tool and saw it consumed over 50% of the context within the first few calls.

Three ways to fetch the same web page into Claude Code context window

What entered the windowApproximate tokensSource
Raw HTML of the Claude Code costs page142,400Our curl measurement, four characters per token
Visible text of the same page8,800Our measurement, same method
A typical page as a plain fetch, then through TinyFish Fetch18,400 versus 1,240TinyFish's published average, a vendor figure with no published sample

The built-in WebFetch tool does not handle Claude raw HTML. It converts the page to Markdown, runs your prompt against it with a small model, and returns that model's answer. So the raw case arises when Claude runs curl in Bash or an MCP scraper returns the page unfiltered.

How Claude Code assembles the window under the hood

Every message becomes a fresh request, ordered so the rarely changing parts come first. There are three context layers in every request, sent in that fixed order, and Drew Breunig's teardown of the leaked source shows the system prompt itself split by a boundary marker into two halves.

Everything above the boundary marker is cached across every user, and everything below varies per session. Caching requires the prefix to remain the exact same. That's why, if you change the system prompt or the model or add or remove an MCP server mid-conversation, the full context has to be loaded again.

CLAUDE.md sits ahead of your whole conversation, and a mid-session edit does not apply until the next /clear, /compact, or restart. When it does apply, everything behind it is reprocessed at full price. So we edit it between tasks, then compact.

How to check your usage with /context

Run the /context command and Claude Code shows the full context usage. Each category gets a token count, and it shows the room left before compaction.

I ran this command on an empty project directory with Fable 5.1 selected as the model and this is what the context window of Claude Code has by default.

So the session held 18,300 tokens before any real prompt, and only ten tokens were in messages.

The rest is startup content, where the built-in tools cost more than the prompt itself and the thirty-six skill descriptions cost more than either.

The MCP line shows tool search at work, with 161 tools at zero tokens because their schemas are deferred. The autocompact buffer is the headroom Claude Code reserves for the summary. At 33K on this model, it means the conversation is compacted at about 967K.

How the token accounting works

You pay for the whole window on every request, and caching changes the price without changing the size. Nothing in the terminal shows either fact.

  • Each message resends the window. Claude Code sends your full conversation history with every request, and every tool call adds another request carrying that batch of results. So a one-line question in a session open all day still ships the whole day's history.
  • Caching lowers the price and leaves the size alone. Cached tokens bill at a tenth of the base input rate on current models, and Claude Code places the cache breakpoints for you. But those tokens still occupy the window in full.
  • Thinking tokens count too. Extended thinking is billed as output, and thinking tokens count toward the context window limit as well. So lowering effort with the /effort command cuts both the bill and the space each turn consumes.

Run the /usage command to see the four numbers behind this. In the docs' own example, 940K of cache reads sit beside 1.2K of fresh input, so 91 percent of the input tokens came from cache.

What a full context window does to Claude Code's output quality

A full window also makes the answers worse, termed context rot. The more the context window holds, the worse Claude recalls what is in it. That's why Anthropic treats context as a finite resource.

You, as the user, see it as Claude forgetting earlier instructions and making more mistakes.

The best-practices guide has a simple test for it: If you have corrected Claude more than twice on the same issue in one session, the window is cluttered with failed approaches and can be fixed by starting a new session.

A full window is slower too. Turns take about a second under 25K tokens of context and about four seconds near 300K, after which turn timings seem to flatten out.

Raw web pages make context windows and turn timings worse. When Claude ingests raw HTML (navbars, HTML tags, footers, etc), it pollutes the context window with unnecessary tokens. The better way is to hand processed data right back to Claude.

Context windows and the associated costs

The cost of a Claude Code session is directly proportional to the average size of its window, because every request ships the whole context. Take two sessions doing the same forty requests of work on Sonnet 5 at Anthropic's list prices in September 2026, with these assumptions:

  • Input at $2 per million tokens
  • Output at $10 per million tokens
  • Cache reads at $0.20 per million tokens
  • A ninety percent cache hit rate
  • Two thousand output tokens a request

One session is maintained lean while another is bloated with additional context.

The lean session starts at 20K and ends at 80K, so the average request carries 50K. The bloated one starts at 60K because of upfront MCP schemas and a long CLAUDE.md, then absorbs a few raw fetches and averages 180K.

Session (40 requests, Sonnet 5)Input tokens sentInput cost, warm cacheInput cost, cold cacheTotal with output
Lean, 50K average window2.0M$0.76$4.00$1.56
Bloated, 180K average window7.2M$2.74$14.40$3.54

So the bloated session costs 2.3x the lean one with a warm cache, and on input alone it costs 3.6x when the cache is cold (Cold is what you pay after a break longer than the cache lifetime, which is five minutes on an API key).

Opus 5 lists at $5 per million input tokens and $25 per million output. At those rates the same two sessions come to $3.90 and $8.84 warm.

How engineers at TinyFish manage context windows

Since we build web infrastructure for agents, our agentic workflows run inside Claude Code for hours at a time. And we expect our users to be doing the same.

So, I spoke to a couple engineers on the team to understand what are some interesting ways they use to manage context limits. Here’s a quick summary.

  1. Compact manually at a fixed breakpoint.
  2. Set the auto-compact window to match, or turn auto-compact off in scripted sessions.
  3. Clear instead of compact when the task changes, after writing a handoff file.
  4. Keep CLAUDE.md focused and move detailed workflows into skills.
  5. Send file-heavy research to subagents and take back a summary.
  6. Route web reads through a fetch that returns clean text, not raw HTML.
  7. Disable MCP servers the project doesn't need.
  8. Use /btw for side questions about the current conversation.
  9. Branch the conversation to explore another approach.
  10. Use a language server to find definitions and references.
  11. Keep manually invoked skills out of startup context.

1. Run /compact at a fixed breakpoint

Rather than letting Claude Code auto-compact at 97% context window (the default), one dev on our team mentioned they manually run /compact at fixed breakpoints.

That provides enough room to work longer sessions as Claude Code can summarize more frequently, letting it capture more of the nuance at each compaction.

"I don't think it's efficient to let Claude Code compact the full context window and expect it to retain everything. Compaction takes 200k tokens and converts them into a 1000 odd tokens. There's no way it can retain nuance here. Instead, I run /compact at a much smaller breakpoint."

They also pass a focus so the summary keeps what the next hour needs.

text
/compact Keep the list of files we changed, the failing test names, and the decision to keep the retry logic in the client. Drop the exploration of the old auth module.

Compaction reads the whole conversation to summarise it, so it runs cheaply while the cache is warm.

Afterwards CLAUDE.md, memory, the plan from plan mode, and up to five recently modified files reload from disk, and invoked skills come back with each SKILL.md capped at 5,000 tokens.

If only the tail of the conversation went wrong, run /rewind and pick a message to summarise from, which truncates back to a prefix the cache already holds.

2. Tune Claude's auto-compact

Setting a smaller auto-compact window makes Claude summarize earlier, including when you forget to run /compact yourself. You can save that setting for future sessions or choose a window for a single run.

"When I'm focused on a bug, it's unlikely I will run the manual compact on time. Instead of forgetting the manual command, I tune the auto-compact behavior these days to the threshold that has worked well for my workflows. "

For example, to use a 600K auto-compact window in a session with a 1M context window, run:

text
/autocompact 600k


Claude saves this in your user settings.

If an environment variable or a higher-priority setting overrides it, the command reports that instead of applying your choice. To try the same window for one session, use the autocompact flag:

bash
claude --autocompact 600k


With automatic compaction tuned to your requirements, Claude summarizes at the right points. Of course you lose a bit of the customizability and direction that comes with manual compaction, you at least won't work inside a session with context rot.

If a scripted run needs explicit control over compaction, launch it with DISABLE_AUTO_COMPACT=1. That disables automatic compaction while leaving /compact available. The run can then hit the context limit, so the script needs a way to stop or continue in a fresh session.

3. Start a fresh conversation when the task changes

If your previous conversation no longer helps with the next task, it's best to run /clear to start a fresh conversation. You can also use it when Claude Code has been responding inaccurately multiple times.

"For me, clearing is a decision about what I still need from the conversation. I might be working in the same files, but that doesn't mean the old debugging discussion helps with a new task. I simply ask Claude to write a handoff file, and run /clear for a new conversation."

If you're continuing unfinished work, save the details you'll need before clearing. For example:

text
Write a handoff note to docs/handoff-payments.md with:
- Changed files and their current state.
- Failing tests and the commands that produced those failures.
- Decisions to preserve, with the reason for each.
- The next step and the exact command to run.

It's tempting to assume Claude Code wrote the file accurately, but I definitely recommend taking the time to read through if that context is important. If there's something missing in the handoff, ask Claude to add it. Then run:

text
/clear payments-refactor


In the new conversation, enter:

text
Read @docs/handoff-payments.md and continue from the next step.


Claude starts with its project instructions and the handoff you provide. Your files remain on disk, and the old conversation is still available through /resume.

The name after /clear labels that previous conversation so you can find it again.

4. Keep CLAUDE.md lean

Your project CLAUDE.md loads at session start, including instructions for workflows you might not always need. So, keeping it focused on shared project rules leaves less reference material in the Claude Code context window.

"My CLAUDE.md should only have instructions that apply across tasks and projects. That includes my preferences in coding styles, function naming, response styles, etc. If the Claude.MD file becomes too specialized, I usually notice it based on the responses and will tell the agent to either discard or rewrite it. "

Anthropic recommends under 200 lines per CLAUDE.md file. Start by moving a detailed workflow, such as database migrations, into a skill that Claude can load when that work comes up. For example:

text
Move the database migration workflow from CLAUDE.md into .claude/skills/database-migrations/SKILL.md. Add a description that tells Claude to use it when creating or reviewing migrations. Preserve the workflow's instructions, and keep project-wide rules in CLAUDE.md. Show me the diff.


Once Claude is done, review the diff for any instructions Claude missed and add those too. In a new session, the skill's description loads at startup and the full migration workflow loads when invoked.

5. Give file-heavy research to a subagent

A subagent can investigate a question in its own context window and return a summary to the main conversation. That keeps the files it reads out of the main window while giving Claude the findings it needs to continue.

"For most of the tasks, I no longer read Claude Code's reasoning. Just give me the findings with enough reasoning to judge whether those findings are correct so I can verify from there on.
Tasks like these shouldn't even run in your main agent's context. Ask Claude to pass the task to a subagent so the main agent only gets a summary of the findings without wasting the context window."

Give the subagent a specific question and describe the result you want back. For example:

text
Use a subagent to find where this repository constructs a Stripe client. Return a table with:
- File path and line number.
- Whether the client reads its configuration from environment variables or a config object.
- Anything you couldn't determine from the code.

Do not change files. Keep full file contents out of the report.

When it finishes, the main conversation receives the report while the detailed reads stay with the subagent. Claude can then inspect a specific location if a finding needs more work. If the report omits the evidence for a claim, ask the subagent for the relevant file and line before acting on it.

The subagent still uses tokens but since they are separate from the main agent's window, it doesn't degrade your main agent's performance.

6. Control web fetch or process raw HTML before adding to the session

A web read can add markup and navigation that Claude doesn't need for the task. TinyFish Fetch extracts page content as Markdown so you can bring clean text into a session without the raw HTML.

"TinyFish Search and fetch results are designed to be agent ready, already formatted for the context window and token savings. That saves hundreds of thousands of tokens that'd otherwise be wasted when Claude Code runs the default raw web fetches."

Add the TinyFish MCP server to Claude Code from your terminal:

bash
claude mcp add --transport http tinyfish https://agent.tinyfish.ai/mcp


Complete the browser sign-in when prompted. Then give Claude the page URL and the question you need it to answer, for example:

text
Use TinyFish fetch_content to read https://code.claude.com/docs/en/model-config in Markdown. Explain how to set the auto-compact window for a single launch, and include the exact command and source URL.


The fetch result enters the conversation as extracted content. Markdown can still be long, so for broad research, run the fetch inside a subagent and ask it to return only the findings with their source URLs.

7. Disable MCP servers the project doesn't need

An MCP server can stay installed even when the current project has no use for it. Disabling that server stops Claude Code from connecting to it while preserving the configuration for when you need it again.

"My tool list should reflect the project I'm working on, so I don't want an integration kept active just because it might be useful somewhere else. I usually disable MCP servers that I don't need to avoid cluttering context.
This may not have a huge impact if you have just a few servers connected in the first place. But developers who usually work with 20-50 of these will notice the different immediately after disabling them."

Open the server list in Claude Code:

text
/mcp

Select an unused server and toggle it off. Claude Code saves that choice for the project, and the server remains visible in the panel as disabled.

For the servers you need to keep, leave tool search enabled where possible. It already defers full tool definitions by default, so disabling a server doesn't necessarily recover a large block of tokens. It removes an unneeded connection and its available tools; the ones you retain load their definitions as Claude needs them.

8. Use /btw for side questions

Sometimes you need your agent to answer some questions while it's already working on another task. The /btw is perfect for such situations. The question and answer stay outside the main conversation history, so a side discussion doesn't add to the context of later coding turns.

"If I need a quick summary of what actions were taken or add another task to the agent's todo list I simply use /btw. I can get the answer without making it part of the history Claude carries into the next task unless explicitly asked for."

For example, after discussing retry behavior, ask:

text
/btw Why did we decide to keep the retry logic in the client?


Claude answers using the conversation it already has. Dismiss the answer to return to your work; you can ask /btw questions even while the main turn is running.

The side question has no tools, so it can't open a file or check something new. If its answer changes what you want Claude to implement, put that decision into the main conversation so the coding session receives it.

9. Branch before exploring another approach

There's also the /branch command which copies the current conversation and switches you into that copy. Think of this like the git branches where you can save new code without changing main.

You can explore an alternative there, then return to the original conversation without bringing the branch's discussion with you.

"Before I choose an approach, I want to be able to question it. That can turn into a long discussion. I don't want the main conversation I return to for implementation to inherit that whole debate. Branches are quite handy for such situations."

Give the current conversation a name, then create a branch:

text
/rename client-retry-main


text
/branch client-retry-alternative


In the branch, ask Claude to evaluate the alternative:

text
Would keeping retry logic on the server change how this client handles failed requests? Compare it with the current plan and explain which approach fits the requirements. Keep this to analysis; do not edit files.


When you're ready to return, run:

text
/resume client-retry-main


The original conversation remains available, and you can add the conclusion you want it to use. Branching copies the existing context, so its benefit is keeping subsequent exploration separate. It also shares the working files: returning to the original conversation doesn't undo edits made from the branch.

10. Use a language server to find definitions and references

The default way for Claude Code to locate a function definition is by triaging the codebase. The alternative is using a language server that lets Claude jump directly to the requested function or reference.

"When I'm looking for a function, I want Claude to get to the definition and the callers that matter. Reading a collection of files just to locate them feels wasteful to me and ofcourse, the context window as well. I'd rather have the language server answer that part, then spend the context on understanding the code."

For TypeScript, install the server and its TypeScript dependency from your terminal using the upstream installation command:

bash
npm install -g typescript-language-server typescript@6


Then install the Claude Code plugin from inside your local session:

text
/plugin install typescript-lsp@claude-plugins-official


Follow the activation instructions in the install summary. If the plugin reports that it can't find the executable, check that typescript-language-server is on the PATH used to launch Claude Code (or just restart the Claude Code session)

Once active, the code intelligence plugin gives Claude symbol navigation and reports diagnostics after edits. Claude can follow a reference to the relevant code directly rather than going through hundreds of lines of code.

Note: This works with local setup right now, I couldn't find a way to enable this with Claude Code cloud yet.

11. Load skills only when you ask for them

"There are certain skills I call manually since they are workflow-specific. There's no reason to have the descriptions added to the Claude Code context. You can just disable automatic skill invocation to achieve this result."

Moving a workflow into a skill keeps its full instructions out of startup context, but the skill's description still loads by default. For a skill you choose to invoke manually, you can keep even the descriptions out of the Claude Code context window.

Add this field to the skill's existing YAML frontmatter at the top of SKILL.md:

yaml
disable-model-invocation: true

After this Claude won’t load the skill automatically, but you can run it yourself by typing / followed by the skill’s name.

text
/database-migrations-skill

The skill invocation setting keeps its description out of Claude's context and stops automatic invocation. When you run the command, the full skill body enters the conversation and stays available across later turns.

To make the same choice without editing the skill file, open /skills and cycle its state to user-only. That visibility override keeps it in your command menu while hiding it from Claude; plugin skills are managed through /plugin instead.

A prompt to audit your Claude Code context usage

Use this prompt in the session you want to audit. Claude inspects the project and the session information available through its built-in tools, then recommends changes. If detailed usage counters aren't accessible, it completes the audit using the evidence it can gather and marks those measurements unavailable.

text
Audit this Claude Code session and project for unnecessary context usage. Gather the information yourself; do not ask me to run commands, paste output, or provide files.

Keep the audit read-only. Do not edit settings or files, install tools, disable servers, or clear, compact, or branch this conversation.

Use the current conversation, session metadata exposed to your tools, and targeted local file reads. Inspect applicable CLAUDE.md files and their imports, skill frontmatter, project manifests, and installed-plugin metadata. Distinguish files found on disk from instructions confirmed loaded in this session.

Extract only relevant non-secret configuration fields: model and compaction settings, skill visibility, MCP server names, transport types, enablement flags, and tool-search settings. Filter locally before returning tool output. Never dump raw configurations or the environment. Return only the named non-secret fields; never include authentication headers, tokens, or passwords.

Use current-session usage counters if your tools expose them. Do not run /context or other interactive commands through Bash, invoke them as skills, or launch another Claude session to measure this one. If counters or history are inaccessible, mark them unavailable and continue with a qualitative audit. Missing data does not mean zero usage.

Check these areas:

1. Context and cost: report available capacity, current occupancy, and cache statistics with their sources. Keep cumulative token usage separate from current window occupancy. Do not reconstruct startup usage or per-component token counts from guesses.

2. Startup instructions: count lines in relevant CLAUDE.md files and trace imports. Treat Anthropic's 200-line recommendation as guidance, not a hard limit. Identify specific workflow instructions to move into skills or path-scoped rules. Check skill descriptions and invocation settings; propose disable-model-invocation: true only for skills suited to manual use.

3. MCP: identify servers relevant to this project and candidates to disable. Check evidence of deferred tool definitions and any explicit overrides. Do not assume every installed server is connected or that deferred tools occupy no context.

4. Session continuity: inspect the available auto-compact configuration and flag unknown overrides. Recommend a task breakpoint and draft focus instructions naming details worth preserving. Suggest /clear only when the old discussion no longer helps; list what a reviewed handoff should retain for unfinished work. Do not invent a universal percentage threshold.

5. Research and side discussions: identify work suited to subagents returning focused summaries, questions suited to /btw without tools, and alternatives suited to /branch. Explain that subagents still consume tokens, /btw stays outside the main history, and branches inherit context and share working files.

6. Code navigation: identify the project's languages and check for matching installed LSP plugins and server binaries. Recommend missing pieces for direct definition and reference lookup without installing them.

7. Web reads: inspect available tool results for raw HTML versus extracted text. Distinguish unfiltered curl or scraper output from built-in WebFetch processing and TinyFish Markdown results. Recommend clean text or a subagent summary where appropriate.

Return a concise table with observed evidence, its source, the recommended change, and the expected effect. Use qualitative effects unless savings were actually measured. Finish with three priorities and any unavailable measurements that limit the conclusions. Provide proposed commands or edits for review, without executing them.

Get started with TinyFish and Mako in Claude Code

The TinyFish MCP server returns the text of a page and the hits from a search without the markup. Its search tool returns structured results with a position, site name, title, snippet, and URL per hit, and fetch_content intelligently returns the content, skipping all other text on the page.

Both run within free limits of 30 searches a minute and 150 URLs a minute at no charge.

Add TinyFish MCP server to Claude Code from your terminal:

bash
claude mcp add --transport http tinyfish https://agent.tinyfish.ai/mcp

If you also use the Claude web or desktop app, install the TinyFish plugin from the Claude directory.

It bundles the same tools with curated skills and OAuth sign-in, so there's no key to paste.

When the task is mostly web work, such as pulling quotes from portals or filling forms behind a login, there’s a better option than feeding pages to Claude at all.

You can use the run_web_automation tool to hand the task to Mako, TinyFish's web-native AI model. Mako reads pages as semantics rather than HTML, holds page state across long multi-page runs, and returns a structured result.

With this setup, the only thing that enters your Claude Code context window is the result of your query.

Try TinyFish for free today.

FAQ

How big is the Claude Code context window?

The Claude Code context window size is one million tokens on the current Opus, Sonnet, and Fable models, and that is the API default with no beta header. Haiku 4.5 is the exception at 200K. If you need the smaller window everywhere, set the CLAUDE_CODE_DISABLE_1M_CONTEXT environment variable to 1 to hold any model to 200K.

How to compact the context in Claude Code?

Run the /compact command, with an optional focus string after it such as "Focus on the API changes" to say what the summary must keep. It also does this on its own when the conversation reaches the auto-compact window. Move that point with the /autocompact command followed by a value such as 600k, or with the CLAUDE_CODE_AUTO_COMPACT_WINDOW variable. Afterwards the system prompt is untouched, CLAUDE.md and memory reload from disk, and up to five recently modified files are re-read.

How to check context usage in Claude Code?

Run /context for a grid of token usage per category and the headroom left before compaction. Add the word all, as in /context all, for per-file, per-skill, and per-tool detail. For the money side, the /usage command shows the session's input, output, cache read, and cache write totals.

How to save context in Claude Code?

Keep the window small, because every request resends it. At startup that means holding CLAUDE.md under 200 lines and leaving MCP tool search on so schemas stay deferred. During the session, send file-heavy research to subagents that return a summary, and route web reads through a fetch that returns clean text. Compact at a fixed breakpoint or clear between tasks so stale content stops riding along.

How to clear context in Claude Code?

Run /clear to start a new conversation with empty context. Pass a name after it, such as payments-refactor, to label the old one in the /resume picker. Before that, ask Claude to write a handoff note to disk, then mention that file with an @ mention in the new session. A clean session with a better prompt almost always outperforms a long session with accumulated corrections.

What does /context do in Claude Code?

It draws the current window as a grid. The grid lists estimated token usage for the system prompt, system tools, memory, skills, messages, and MCP tools, plus the remaining space and the autocompact buffer. It also shows optimisation suggestions for context-heavy tools and memory bloat, and warns when the conversation exceeds the window.

How do I add TinyFish to Claude, and which route should I use?

To add TinyFish in Claude Code, run claude mcp add --transport http tinyfish https://agent.tinyfish.ai/mcp to get search, fetch_content, and run_web_automation as tools. In the Claude app, install the TinyFish plugin from the Claude directory, which bundles the same tools with curated skills and OAuth sign-in. Both use the same account, so search and fetch stay free on either route.

AI disclosure

Content on this website may be created or refined with the assistance of AI tools and is subject to human editorial review.

Get started

Start building.

No credit card. No setup. Run your first operation in under a minute.

Get $8 in Wallet fundsRead the docs