Claude Code context window: /compact, effort and modes
How context fills up
Context is the working memory of a single conversation and holds everything Claude can see at that moment, meaning the rules from CLAUDE.md, auto memory, tool and skill descriptions, your messages, its replies and every file it reads. With each new message, the whole conversation is sent again.
Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2 all have a one-million-token window out of the box, no switching needed. Writing opus[1m] in your settings therefore changes nothing on Opus 5.5, it just says the same thing explicitly. When the window is nearly full, Claude Code compacts the conversation on its own. On models with a one-million window, by default that happens at about 967k tokens.
The /context command shows how much room you’re using by drawing a coloured grid and breaking down what takes up how much. In the desktop app, which is where I work, you’ll find the fill as a percentage on the Context card in the session details panel.
Two more numbers are worth knowing. On a subscription, Claude Code keeps the conversation cache for about an hour, and while it’s warm, resending the history costs less. And if you leave a session above roughly 200k tokens idle, Claude Code compacts it shortly before the cache expires, so after lunch you carry on from a summary.
/compact and auto-compaction
Compaction replaces the conversation so far with a structured summary and frees up room. You start it with the /compact command, after which you can write what the summary should focus on, because otherwise Claude guesses what matters and small details you care about can get lost.
/context
/compact keep the design decisions, the list of changed files and what's left to do
/autocompact 400k
/autocompact auto
The first line shows how much room you’re using, the second compacts with a clear brief on what to keep, and the third makes auto-compaction kick in already at 400k tokens. That value is saved for the current model and applies in later sessions too, until the last line returns it to the default. The /autocompact command needs version 2.1.221 or later and takes values from 100k up.
The CLAUDE.md at the project root and auto memory survive compaction, because they are reloaded from disk afterwards, and so does the plan from plan mode. Claude re-reads at most five files it worked on most recently, and skills it used in the conversation come back, but each capped at 5,000 tokens and 25,000 in total. Everything else gets summarised, which is why rules that must not get lost belong in CLAUDE.md, not just in the chat.
Compaction is useful in the middle of long work you want to finish in the same thread, or before a bigger next step on the same topic, while for a move to a completely different topic /clear is better. Watch the cost too, because on a long conversation /compact itself is a big request that has to read the whole history, and it costs even more once the cache has gone cold.
You can also compact just part of the conversation. Type /rewind, pick a message and choose Summarize from here or Summarize up to here.
When to compact and when to start over
What Anthropic says. The Claude Code docs don’t give a fixed token limit but recommend typing /clear between unrelated tasks, which costs nothing and means the next task doesn’t pay for the previous one’s history. When you’re correcting Claude for the third time about the same thing, they advise not writing a third correction but using /clear and one new brief that includes what you’ve learned. And before a long new task on the same topic, /compact with a brief on what to keep helps.
What I do. I rotate the thread once it goes past roughly 300k tokens, and I consider 300k to 400k a sensible range, which is my own practice, not an official recommendation. The window could hold much more, but in long threads Claude more often reached for old, no longer valid parts of the history, and every message cost more of my limit.
Before I close a thread, I have it write a handoff. The new thread then reads it and picks up from there:
Before we start a new thread, sum up where we are in five points:
what's done, what's in progress, what's waiting on me,
which files changed and exactly what the next step is.
Save it to a HANDOFF.md file in the project.
If you don’t want to watch the number yourself, you can set the limit with /autocompact 400k, and Claude Code then compacts on its own once the conversation goes past it. Compaction isn’t the same as a new thread, though, because the summary carries part of the old history along, whereas a handoff file holds only what you want.
You can go back to an old conversation at any time. /clear doesn’t delete it, you’ll find it with /resume. If you give it a name when you clear, such as /clear header-redesign, it’s easy to find in the list.
Context fill in view
In the terminal version of Claude Code you can set up a status line. It’s the line under the prompt box and shows whatever you want. The simplest way is to describe it in words:
/statusline show the model, the effort, what percentage of the context is full
and what percentage of the weekly limit is gone
Claude Code then builds the script itself. If you’d like to know what’s in it, here’s a simplified version in Python. Claude Code sends it session data on every change and it prints a single line:
# ~/.claude/statusline.py
import json, sys
d = json.load(sys.stdin)
model = d["model"]["display_name"]
effort = (d.get("effort") or {}).get("level", "-")
context = (d.get("context_window") or {}).get("used_percentage") or 0
week = ((d.get("rate_limits") or {}).get("seven_day") or {}).get("used_percentage")
line = f"{model} | {effort} | context {context:.0f}%"
if week is not None:
line += f" | week {week:.0f}%"
print(line)
And ~/.claude/settings.json gets a pointer to the script. On Windows, write paths with forward slashes, not backslashes:
"statusLine": {
"type": "command",
"command": "python ~/.claude/statusline.py"
}
Watch out for one trap, because the fill percentage is calculated from the model’s whole window, so on Opus 5.5 with a one-million window, 30% means roughly 300k tokens. If you’ve lowered the limit with /autocompact, the percentage won’t tell you when compaction will come. The status line itself runs on your computer and costs no tokens.
Don’t look for a status line in the desktop app, because there the fill is shown on the Context card in the session details panel, which you can expand to see what takes up how much.
Effort and ultrathink
Effort sets how long Claude thinks and how much it checks before answering. Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2 have five levels: low, medium, high, xhigh and max. The default for all four is medium. According to Anthropic, Opus 5.5 on medium gives results as good as or better than the previous Opus 5 on high.
/effort high
/effort medium
/effort max
/effort auto
Find the cause of this bug. ultrathink
How it works. /effort high sets the level and saves it as the default for the model you’re on. If you type /effort with no level, a slider opens in which the s key sets the level for this session only, and max always applies to the current session only. /effort auto clears the saved level and the model goes back to its default.
When to use what. Medium is enough for everyday work with a clear brief, such as a new feature, while high or xhigh belongs where something is easy to miss, for example a bug in code you didn’t write, a test that passes one time and fails the next, or a change after which Claude has to find every place it affects. Low suits quick back-and-forth on ideas, when you check every result straight away anyway, and max is for a hard problem Claude should solve on its own, because on ordinary tasks it tends to overthink and you pay more for an answer that isn’t necessarily better. I keep the main conversation on high and subagents on medium.
Ultrathink for one message. When you need more thinking for just one question, put the word ultrathink in the message and the setting doesn’t change. In the terminal, the word turns rainbow-coloured and that one reply runs at xhigh; in the terminal this works from version 2.1.311, and in a local session in the desktop app’s Code tab from 2.1.316. Other phrases such as “think hard” aren’t treated as a keyword by Claude Code.
Watch out for older settings
Effort is now saved separately for each model. A standalone effortLevel key in your personal settings.json doesn’t apply to Opus 5.5. If that’s the only way you set effort, Opus 5.5 runs on medium. Typing /effort high once is enough.
Fast mode (/fast)
Fast mode runs the same model with a different configuration that puts speed ahead of cost, and quality doesn’t change. According to Anthropic, replies are up to 2.5 times faster, and it works on Opus 5.5 and Fable 5.2, not on Sonnet or Haiku.
/fast
/fast on
/fast off
You turn it on with the /fast command and confirm with Enter. A small ↯ icon appears next to the prompt box. If you’re on a model that doesn’t support fast mode, Claude Code switches you to Opus. On Fable 5.2 you need version 2.1.321 or later.
What it costs. This is the most important part, because on a subscription (Pro, Max, Ultra) fast mode doesn’t count towards your plan limits and is paid only from paid usage credits. On Opus 5.5, a million input tokens cost $8 and a million output tokens $40, while standard speed costs 4 and $20, so fast mode is twice as expensive.
Second trap: when you turn fast mode on mid-conversation, the first time you pay full price for the entire context so far, with no cache discount. On a thread with 300k tokens, by the price list that’s about $2.40 for the first message alone. Anthropic therefore recommends turning it on at the start of a session.
Fast mode pays off in live debugging or quick rounds of edits and checks, when you’re waiting on replies and your time is worth more than the credits. It doesn’t suit long autonomous tasks you aren’t sitting in front of anyway, or anything where you don’t want to pay beyond your subscription. The docs describe the toggle for the terminal, the VS Code extension, cloud sessions and claude.ai/code.
Goals with /goal
/goal sets a condition for when the work is done, and Claude keeps working until it’s met, with a second small and fast model checking it after every turn. If the condition doesn’t hold yet, Claude carries on with another turn and takes the reason as guidance. The goal ends when the checking model judges it met or impossible, or when a turn hits an error you have to fix yourself.
/goal npm run build finishes with no errors and no warnings in the output, or stop after 15 turns
/goal
/goal clear
The first line sets the goal and starts working straight away, the second shows the status, meaning the condition, how long it’s been running, the number of turns, token use and the evaluator’s latest reason, and the third cancels the goal, for which stop, off or cancel also work instead of clear. One goal can be active per session, the condition can be up to 4,000 characters, and it works in the desktop app too.
How to write the condition. The evaluator doesn’t run anything or read files and only judges what’s visible in the conversation, so the condition has to be something Claude shows on its own, such as a build result, test output or a file count. Add how it’s verified, what mustn’t change along the way, and a cap, such as “or stop after 15 turns”.
A goal suits work with a clear, verifiable end, such as until all tests pass or until every link is fixed, but not creative work with no measurable end, like “make the website nicer”. A goal also doesn’t change the permission mode, and since Claude keeps asking you in Manual mode, running unattended only makes sense in auto mode. Bear in mind that the check after every turn costs extra requests too.
Ultracode, ultraplan and ultrareview
/effort ultracode
/effort ultracode off
/code-review ultra
/code-review ultra 1234
Ultracode is a toggle in the /effort command, not another effort level. When you turn it on, Claude plans a so-called dynamic workflow for every substantial task. That’s a script that splits the work across many subagents, for example one to understand the code, another to make the change and a third to verify it. It applies to the whole session, and you turn it off with /effort ultracode off. If you start Claude Code with the --effort ultracode flag, the effort is set to xhigh at the same time. Ultracode itself doesn’t change the effort level. It needs dynamic workflows turned on; on the Pro plan you turn them on in /config, in the Dynamic workflows row.
Ultracode pays off for a large migration, a review of a whole project, or research where sources should be checked against each other, but not for everyday work, because every task then uses more tokens and takes longer, so on a subscription you hit your limit sooner. The Large workflow warning, which otherwise appears for a run with more than 25 agents or a projected 1.5 million tokens, isn’t shown with ultracode on.
Ultraplan no longer exists. Anthropic removed it in version 2.1.222 on 4 August 2026. For planning, use plan mode, that is /plan.
Ultrareview is a deep code review in the cloud. You start it with the /code-review ultra command; the /ultrareview shortcut works too. A whole fleet of reviewer agents goes through your branch with its changes and independently verifies every bug it finds. It runs in the background, usually for 5 to 15 minutes. After the command you can add the number of a GitHub pull request.
You need to be signed in with a claude.ai account and have a git repository. On Pro, Max and Ultra you get three free runs, once per account lifetime, after which each review is paid from credits, usually 5 to $25 depending on the size of the change, and a dialog shows the estimated price before it starts. It’s still a research preview that pays off before merging a bigger change that matters a lot, while for small things ordinary /code-review is enough.
Dictation (/voice)
You can speak your brief to Claude. The text is transcribed live into the prompt box, and you can mix speaking with typing.
/voice
/voice tap
/voice off
/voice turns dictation on, and in the default mode you hold the space bar, speak, and the text is inserted when you let go. /voice tap switches to tapping, where you tap once to start and again to send, and the setting carries over to later sessions.
Czech. Dictation understands Czech, but without a language setting it assumes English. The language is set by the language key in ~/.claude/settings.json. Careful, the same key also changes the language of Claude’s replies:
{
"language": "czech",
"voice": { "enabled": true, "mode": "tap" }
}
Transcription costs no tokens and doesn’t count towards your limits, but you need to be signed in with a claude.ai account and have a microphone on your own machine, because dictation doesn’t work in cloud sessions or over SSH. The audio is sent to Anthropic’s servers for transcription, and the docs describe it for the terminal and the VS Code extension. Dictation helps with a long brief that’s easier to say than to type, while a brief full of file paths and exact names is better typed.
Code Mode
Code Mode is the newest feature and still experimental, arriving on 12 November 2026 in version 2.1.323. Normally Claude calls tools one at a time, reading a file, looking at the result and editing the next one, whereas in Code Mode it writes a short piece of JavaScript that makes several calls at once. It can run independent commands in parallel, pass the result of one step to the next, and hand back to Claude only the part of the output it needs.
When it helps. It helps on tasks with many related steps, such as the same change across dozens of files, a search whose results need filtering before they’re read, or several independent commands that can run at the same time. Anthropic doesn’t publish specific figures on the savings.
Where it works. Only in an interactive claude session in the terminal, not in the desktop app, the VS Code panel or cloud sessions, and in Code Mode you also can’t use Remote Control, Claude in Chrome or computer use. In the desktop app, which is where I work, I can’t use it yet.
How to turn it on. You need Claude Code 2.1.323 or later as the native install, Git for Windows on Windows, and the Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2 model. In PowerShell you turn it on like this:
$env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = "1"
claude
To keep it on, the CLAUDE_CODE_EXPERIMENTAL_CODE_MODE variable with the value 1 goes in the env block of your personal ~/.claude/settings.json. Claude Code ignores it in project settings, so a repository you clone can’t turn it on for you. A value of 0 anywhere turns it off. Before the first session, Claude Code asks whether you really want Code Mode. A brief like this one works well for a first try:
Go through every Markdown file in the project and list the links
to local files that don't exist.
In the conversation you see the individual tool calls, not the code itself, which you can show with Ctrl+O. Keep in mind that a Code Mode session can only be resumed with Code Mode on, that code which isn’t running in the background stops after ten minutes, and that auto mode judges the whole piece of code, not each individual call. The feature may change or disappear at any time.
Verified
I checked everything on this page on 25 November 2026 against the Claude Code docs and changelog, where the current version is 2.1.332. Claude Code changes almost daily, so if something doesn’t match, ask Claude to compare it with the current docs. You’ll find more commands on the Commands page and small tricks in Tips & tricks, and if something is missing here, write to me at team@euphronic.com.