52 52. Context, Models, Effort, and Usage in Claude Code
Four dials decide how well, how fast, and how expensively Claude Code works for you: the context Claude can see, the model doing the work, the effort it puts into thinking, and the usage it draws from your plan or budget. This page shows how to read and adjust each one.
52.1 The context window in practice
As of Oct 6, 2026 · Official docs: Explore the context window · Best practices for Claude Code
The context window is Claude’s working memory for one session. It is measured in tokens, small chunks of text (see How Large Language Models Work); on current Claude models, a million tokens is roughly 555,000 words. It holds far more than your chat:
Context window (one session)
+------------------------------------------------------------+
| Loaded before you type: Claude Code's instructions, |
| CLAUDE.md, auto memory, skill descriptions, MCP tool names |
+------------------------------------------------------------+
| Your messages and Claude's replies |
+------------------------------------------------------------+
| Every file Claude reads and every command's output |
| (often the biggest part, though you see only one line |
| such as "Read auth.ts") |
+------------------------------------------------------------+
| ... free space ... |
+------------------------------------------------------------+
Current models have large windows (1 million tokens for Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.1), but how full yours is still matters:
- Quality drops as it fills (“context rot”). The fuller the window, the worse the model gets at using what is in it: Claude may “forget” earlier instructions or make more mistakes. Research has also found that models tend to miss information in the middle of a long context more often than at its beginning or end (Liu et al., “Lost in the Middle”). So keep the used part of the window small:
/clear,/compact, and/rewind(below) are the main ways. - Every message sends the whole conversation again. A one-line question at the end of an all-day session still counts the entire history against your usage.
Run /context at any time to see a colored grid of what is using space, with suggestions for freeing some.
52.2 Freeing up context: /compact, /clear, and friends
As of Oct 6, 2026 · Official docs: Explore the context window · Commands
When the window gets close to full, Claude Code compacts automatically: it clears old tool output and then replaces the conversation with a summary. Your project’s CLAUDE.md and auto memory are reloaded from disk afterward, but details you only mentioned in the chat can be lost. That is why lasting rules belong in CLAUDE.md (CLAUDE.md and Memory).
You can also act yourself:
| Command | What it does | Use it when |
|---|---|---|
/context |
Shows what fills the window | Claude seems confused, or usage is high |
/compact |
Summarizes the conversation so far to free space | At a natural break in a long task |
/compact focus on the login bug |
Same, but tells the summary what to keep | You know what matters for the next step |
/clear |
Starts a new conversation with an empty context (CLAUDE.md still loads) | You switch to an unrelated task |
/btw <question> |
Answers a side question that never enters the conversation | Quick lookups, e.g. /btw what does git stash do? |
/rewind (or Esc twice on an empty prompt) |
Goes back to an earlier point; can also summarize from there | A path went wrong; dropping the detour also avoids context rot and saves tokens on every later message |
/clear costs nothing and is often the best move: old conversation crowds out what Claude needs next and costs tokens on every message. Run /rename first if you may want to come back to it later with /resume. For research that reads many files, ask Claude to “use a subagent”: the reading happens in a separate context window and only a summary comes back (Subagents).
52.3 Choosing a model
As of Oct 16, 2026 · Official docs: Model configuration · Models overview
You usually pick a model with an alias, a short nickname that points to the currently recommended version of that model:
| Alias | Model (Oct 2026) | Good for |
|---|---|---|
opus |
Claude Opus 5.5 | Complex coding and reasoning; the default on Pro, Max, Team, Enterprise, and API accounts |
sonnet |
Claude Sonnet 5.5 | Everyday coding; fast, and cheaper than Opus |
haiku |
Claude Haiku 5.5 | Simple, quick tasks; the fastest and cheapest |
fable |
Claude Fable 5.1 | The hardest, longest tasks; most capable but slower (on some plans it is billed to extra usage credits) |
default |
Your account’s default | Undoing your choice |
haiku has pointed to Haiku 5.5 since Claude Code v2.1.293; older versions of Claude Code still use Haiku 4.5. Check yours with claude --version.
A full model ID such as claude-opus-5-5 pins one exact version instead. For plans and prices, see Claude Models, Plans, and Usage Limits.
How to switch:
/modelopens a picker.Enterswitches and saves your choice as the default for new sessions;sswitches for this session only. Typing/model sonnetswitches directly (and saves it).claude --model sonnetstarts one session on that model."model": "sonnet"in a settings file sets the starting model (The .claude Folders and Settings Files)./statusshows which model you are using.
Pick your model at the start of a task. Switching mid-conversation works, but the next reply has to re-read the whole conversation without the usual speed-up from the prompt cache (see the deeper dive below), so that one reply is slower and uses more.
52.4 Effort: how hard Claude thinks
As of Oct 16, 2026 · Official docs: Model configuration
Current models think (reason step by step) before they answer, and decide for themselves how much. Effort sets how much thinking they lean toward. Higher effort means deeper reasoning, but slower answers and more tokens (thinking tokens are billed like output).
| Level | When to use it |
|---|---|
low |
Quick back-and-forth, renames, first sketches you will review |
medium |
Everyday work with a clear scope; the default on Opus 5.5, Sonnet 5.5, and Haiku 5.5 |
high |
Bug fixing and work where edge cases matter; the default on most other models, including Fable 5.1 |
xhigh |
Deeper reasoning, at higher cost |
max |
Very hard problems; may overthink, and lasts for the current session only |
/effortopens a slider;/effort highsets a level directly;/effort autoclears the level you saved.- In the
/modelpicker, the left and right arrow keys adjust effort. claude --effort highsets it for one session.- Write ultrathink anywhere in a prompt to ask for deeper reasoning on that one turn only. (Phrases like “think hard” are just ordinary words.)
On Opus 5.5, Sonnet 5.5, Haiku 5.5, and the Fable models, thinking can’t be turned off; effort is the control. Some older models, such as Haiku 4.5, don’t support effort levels.
52.5 Fast mode
As of Oct 6, 2026 · Official docs: Speed up responses with fast mode
Fast mode (/fast) runs Claude Opus with a special high-speed setting: up to 2.5 times faster, same quality, but a higher price per token (for Opus 5.5, twice the normal API price). It is not a different model. It is a research preview, and on subscription plans it is paid only from usage credits (extra, pay-as-you-go money), never from your plan’s included usage. If you are on another model, turning fast mode on switches you to Opus.
For most students: leave it off. If you use it, turn it on at the start of a session, because the first fast turn re-processes the whole conversation at the fast price. A ↯ icon next to the prompt shows it is on; run /fast again to turn it off.
| Option | Effect |
|---|---|
| Fast mode | Same quality, shorter wait, higher cost |
| Lower effort | Less thinking: faster and cheaper, but possibly lower quality on hard tasks |
52.6 Checking your usage
As of Oct 6, 2026 · Official docs: Manage costs effectively
There are two ways to pay for Claude Code (details on Claude Models, Plans, and Usage Limits):
- Subscription (Pro, Max, Team, Enterprise): a fixed monthly price with usage limits that reset over time. When you hit one, Claude Code tells you when it resets.
- API key (Claude Console): you pay for every token.
Run /usage (also available as /cost and /stats) to see:
- Session: tokens used in this session and an estimated cost. The dollar figure matters for API users; subscribers already have usage included.
- Plan usage bars (subscribers): how much of your limits you have used: the current 5-hour session, the week, and a model’s own limit where your plan has one (on Max, for example, Fable may use at most half of the weekly limit; see Claude Models, Plans, and Usage Limits). If you turned on usage credits, a row also shows this month’s spend.
- A breakdown (subscribers) of what used your limits recently, such as skills, subagents, MCP servers, and
/looptasks. Pressdorwto switch between the last 24 hours and the last 7 days.
/insights writes a report about how you work (where things go wrong, features to try), not just how many tokens you used.
52.7 Using fewer tokens
As of Oct 6, 2026 · Official docs: Manage costs effectively · Best practices for Claude Code
/clearbetween unrelated tasks.- Be specific. “Add input validation to the login function in
auth.ts” reads far fewer files than “improve this codebase”. - Match the model to the job. Sonnet for routine work; Opus or Fable for hard problems.
- Lower the effort for simple tasks.
- Keep CLAUDE.md short (under about 200 lines); move rarely needed instructions into skills (Skills).
- Turn off MCP servers you aren’t using (
/mcp), and prefer command-line tools such asghwhen one exists. - Send verbose work to a subagent, such as running a test suite or reading long logs.
- Plan complex changes first (plan mode) and press
Escas soon as Claude heads the wrong way: rework is the most expensive kind of token. - Pick your model and effort at the start of a session.
As of Oct 6, 2026 · Official docs: How Claude Code uses prompt caching
Every message you send makes Claude Code send the entire conversation to the model again. Prompt caching lets the server reuse the part it has already processed (the unchanged beginning of the request). Re-reading cached text is faster and billed at a much lower rate. Claude Code handles this for you.
Some actions break the cache, so the next reply re-reads the whole conversation at the full price. The main ones are switching models and turning on fast mode for the first time in a conversation. Changing effort mid-session breaks it on most models too, but not on Opus 5.5, Sonnet 5.5, or Fable 5.1 when you use a Claude subscription or an API key. That is why the official advice is to choose your model and effort at the start, and to save /compact for natural breaks between tasks.
The cache also expires while you are away: after an hour on a subscription (five minutes once you are drawing on usage credits), and after five minutes by default with an API key. Your first message after a long break is slower and uses more.
Editing CLAUDE.md doesn’t break the cache, but the edit doesn’t reach the running session either. It loads after /clear, /compact, or a restart.
Two commands are cache-friendly. /rewind goes back to a point the cache already holds, so the next reply reads it from the cache (/compact, by contrast, builds a new summary that must be processed again). And /clear drops the conversation but not the start of each request: Claude Code’s instructions and tool definitions, and your CLAUDE.md if it hasn’t changed, can still be read from the cache when you start the new conversation within the cache lifetime.
As of Oct 6, 2026 · Official docs: Model configuration · Interactive mode
opusplanuses Opus while you are in plan mode and Sonnet once Claude starts implementing: strong planning, cheaper execution.bestpicks Fable where it is available to you, otherwise Opus.Option+P(Mac) orAlt+P(Windows) switches models without clearing what you have typed. (On a Mac, this needs your terminal’s “Use Option as Meta Key” setting turned on.)/autocompactchanges how full the window gets before automatic compaction, for example/autocompact 500k. By default, models with a 1 million token window compact at about 967,000 tokens.
Practice Questions
Easy
Question 1 · Short answer
What is Claude Code’s context window? Name three kinds of things that fill it.
Question 2 · Multiple choice
Which command shows a breakdown of what is using your context window?
/usage/context/compact/model
Question 3 · Matching
Match each command with what it does.
| Command | What it does | |
|---|---|---|
1. /clear |
A. Summarizes the conversation to free space, keeping its gist | |
2. /compact |
B. Shows session tokens, estimated cost, and plan usage | |
3. /btw |
C. Starts a new conversation with an empty context | |
4. /usage |
D. Asks a side question that doesn’t enter the conversation | |
5. /effort |
E. Sets how much Claude thinks |
Question 4 · True or false
Fast mode switches you to a smaller, faster model that is a bit less capable.
Question 5 · Multiple choice
Which of these is not an effort level in Claude Code?
lowxhighturbomax
Question 6 · Short answer
What is a model alias such as sonnet, and why is it handy?
Question 7 · Multiple choice
What is context rot?
- Old sessions that
/resumecan no longer open - The model getting worse at using its context as the context window fills up
- The prompt cache expiring after an hour
- A CLAUDE.md file that is out of date
Medium
Question 8 · Write the command
Write the command that starts a Claude Code session on Sonnet for that session only, without changing your saved default.
Question 9 · Scenario
Maria just finished fixing a bug in the login page. Next she wants Claude to write a README section about a completely different feature. What should she run first, and why?
Question 10 · Write the command
Your session is long, and the next step is to finish the database migration. Write a command that frees up context while making sure the summary keeps the details of the migration.
Question 11 · Predict
A long session is automatically compacted. Which of these will Claude still “know” afterward?
- Rules in the project’s top-level CLAUDE.md
- “Please always use single quotes in JavaScript”, typed in the chat two hours earlier
- Auto memory notes
Question 12 · Short answer
What does including the word ultrathink in a prompt do? Does “think hard” do the same?
Question 13 · Multiple choice
Sam has a Pro subscription and turns on fast mode. How is his fast-mode work paid for?
- From his plan’s included usage, like everything else
- Only from usage credits (extra pay-as-you-go money)
- It is free during the research preview
- Per token, through a separate Claude Console API account
Question 14 · Short answer
Why does switching models in the middle of a long conversation make the next reply slower and more expensive?
Question 15 · Scenario
For each task, suggest a model alias and an effort level, and explain briefly:
- Renaming a variable in three files.
- Tracking down a tricky bug that only happens after a user’s session times out.
Question 16 · Explain why
You spent twenty minutes on an approach that didn’t work. Why is /rewind back to the point before it often better than /compact?
Hard
Question 17 · Scenario
Sam keeps one Claude Code session open all day. He has used it for five different tasks, and Claude has read dozens of files. Now even short questions use a surprising share of his plan, and Claude seems to mix up details from earlier tasks. Explain both problems and give him three fixes.
Question 18 · Compare
Maria wants faster answers while she makes many small edits. Compare three options: turning on fast mode, lowering effort to low, and switching to Haiku.
Question 19 · Scenario
Maria is on a Pro plan. /usage shows “Total cost: $4.20” for her session. Does she owe Anthropic $4.20? Explain.
Question 20 · Long answer
Describe a cost-conscious way to build a medium-sized feature with Claude Code, from planning to finishing. Mention at least four techniques from this page.
Question 21 · Scenario
/context for Sam’s session shows that before he typed anything, a large part of the window was already used: his CLAUDE.md is 900 lines long and six MCP servers he never uses are connected. What should he change, and why does it matter?
Question 22 · True or false
If you edit your project’s CLAUDE.md in the middle of a session, Claude uses the new version from your very next message.
Challenge
Question 23 · Hands-on
In a practice project:
- Start Claude Code and run
/contextbefore typing anything. Note how much is already used and by what. - Ask Claude to read and explain three files, then run
/contextagain. - Run
/compactand check/contexta third time. - Run
/usage(and pressdandwif you are on a subscription).
Write three sentences on what you learned about what fills the context window.