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:

  • /model opens a picker. Enter switches and saves your choice as the default for new sessions; s switches for this session only. Typing /model sonnet switches directly (and saves it).
  • claude --model sonnet starts one session on that model.
  • "model": "sonnet" in a settings file sets the starting model (The .claude Folders and Settings Files).
  • /status shows 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
  • /effort opens a slider; /effort high sets a level directly; /effort auto clears the level you saved.
  • In the /model picker, the left and right arrow keys adjust effort.
  • claude --effort high sets 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 /loop tasks. Press d or w to 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

  • /clear between 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 as gh when 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 Esc as 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

  • opusplan uses Opus while you are in plan mode and Sonnet once Claude starts implementing: strong planning, cheaper execution.
  • best picks Fable where it is available to you, otherwise Opus.
  • Option+P (Mac) or Alt+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.)
  • /autocompact changes 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.

It is Claude’s working memory for one session, measured in tokens. It holds (any three): Claude Code’s own instructions, your CLAUDE.md files, auto memory, skill descriptions, MCP tool names, your messages, Claude’s replies, the contents of every file Claude reads, and the output of every command it runs.

Question 2 · Multiple choice

Which command shows a breakdown of what is using your context window?

  1. /usage
  2. /context
  3. /compact
  4. /model

b. /context shows a colored grid of what fills the window, with suggestions. /usage (a) shows tokens, cost estimates, and plan limits, not the contents of the window. /compact (c) summarizes the conversation, and /model (d) changes the 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

1 → C, 2 → A, 3 → D, 4 → B, 5 → E.

Question 4 · True or false

Fast mode switches you to a smaller, faster model that is a bit less capable.

False. Fast mode is not a different model: it runs Claude Opus with a high-speed configuration. Quality is the same; responses come up to 2.5 times faster, at a higher price per token.

Question 5 · Multiple choice

Which of these is not an effort level in Claude Code?

  1. low
  2. xhigh
  3. turbo
  4. max

c. The levels are low, medium, high, xhigh, and max. There is no turbo level (for speed, there is fast mode, which is a separate setting).

Question 6 · Short answer

What is a model alias such as sonnet, and why is it handy?

An alias is a short nickname for a model, such as opus, sonnet, haiku, or fable. It points to the currently recommended version of that model family and is updated over time, so you don’t have to remember exact version numbers. (A full ID such as claude-opus-5-5 pins one specific version instead.)

Question 7 · Multiple choice

What is context rot?

  1. Old sessions that /resume can no longer open
  2. The model getting worse at using its context as the context window fills up
  3. The prompt cache expiring after an hour
  4. A CLAUDE.md file that is out of date

b. As the window fills, the model may forget earlier instructions and make more mistakes, and it tends to miss things in the middle of a long context more than at its start or end. Keeping the used part of the window small (/clear, /compact, /rewind) helps.

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.

claude --model sonnet

The --model flag applies only to the session it starts. (Inside a session, opening the /model picker and pressing s on the Sonnet row also switches for that session only.)

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?

/clear. The bug-fixing conversation (files read, failed attempts, test output) has nothing to do with the README task. Keeping it would crowd the context window, can distract Claude, and makes every message cost more. /clear starts fresh for free, and CLAUDE.md still loads. If she might return to the bug session, she can /rename it first and later /resume it.

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.

/compact focus on the database migration: which files changed and what is left to do

Any /compact followed by focus instructions about the migration is correct.

Question 11 · Predict

A long session is automatically compacted. Which of these will Claude still “know” afterward?

  1. Rules in the project’s top-level CLAUDE.md
  2. “Please always use single quotes in JavaScript”, typed in the chat two hours earlier
  3. Auto memory notes

1 and 3 for sure: the project’s CLAUDE.md and auto memory are reloaded from disk after compaction. Item 2 might survive in the summary, but it can be lost, because it was only given in the conversation. To make it last, add it to CLAUDE.md.

Question 12 · Short answer

What does including the word ultrathink in a prompt do? Does “think hard” do the same?

ultrathink asks for deeper reasoning on that one turn, without changing your session’s effort setting. “Think hard” is not a special keyword: Claude Code passes it along as ordinary text.

Question 13 · Multiple choice

Sam has a Pro subscription and turns on fast mode. How is his fast-mode work paid for?

  1. From his plan’s included usage, like everything else
  2. Only from usage credits (extra pay-as-you-go money)
  3. It is free during the research preview
  4. Per token, through a separate Claude Console API account

b. On subscription plans, fast mode is available only through usage credits and is not included in the plan’s usage, even if Sam has plan usage left. It is not part of included usage (a) and not free (c). Console (API) organizations pay for fast mode per token (d), but Sam is signed in with his Pro subscription.

Question 14 · Short answer

Why does switching models in the middle of a long conversation make the next reply slower and more expensive?

Each message re-sends the whole conversation, and the prompt cache lets the server reuse what it already processed. Each model has its own cache, so after a switch the new model must process the entire conversation from scratch: one slow, full-price turn. That is why it’s best to pick the model at the start of a task.

Question 15 · Scenario

For each task, suggest a model alias and an effort level, and explain briefly:

  1. Renaming a variable in three files.
  2. Tracking down a tricky bug that only happens after a user’s session times out.
  1. sonnet or haiku at low effort: a small, clear change you will review yourself; deep reasoning would waste time and tokens.
  2. opus at high (or xhigh) effort: a bug fix where edge cases matter benefits from more reasoning and verification.

Other sensible combinations are fine if the reasoning matches the task’s difficulty.

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?

/rewind removes the failed detour completely, so it no longer takes up the context window (less context rot) or costs tokens on every later message, and the conversation goes back to a point the prompt cache already holds, so the next reply is cheap. /compact keeps a summary of the detour and builds a new, shorter conversation that has to be processed again.

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.

Every message sends the whole conversation again, so a huge context makes even a one-line question expensive. A context full of unrelated material also lowers quality: Claude can confuse or forget instructions from earlier tasks (the “kitchen sink” session).

Fixes (any three):

  • /clear between unrelated tasks (/rename first if he may want to resume).
  • /compact with focus instructions at natural breaks.
  • Ask Claude to use subagents for research that reads many files.
  • Check /context and /usage to see what is using space and usage.
  • Put lasting rules in CLAUDE.md instead of repeating them in chat.

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.

  • Fast mode: same Opus quality, up to 2.5 times faster, but a higher price per token, and on a subscription it is paid only from usage credits.
  • Lower effort: less thinking, so faster and cheaper; fine for simple edits, but quality can drop on hard tasks. Costs no extra money.
  • Haiku: the fastest and cheapest model, good for simple tasks, but less capable, with a smaller (200,000-token) context window and no effort setting.

For many small, simple edits on a student budget, lower effort (or Sonnet at low effort) is usually the best first choice; fast mode only if speed is worth extra money.

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.

No. The session cost is an estimate that Claude Code computes from token counts at API list prices; it matters for API (pay-per-token) users. Her Pro usage is included in the subscription and counts against her plan limits, shown in the usage bars. She would pay extra only for things billed to usage credits (such as fast mode, or usage beyond her limits if she turned usage credits on).

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.

A model answer:

  1. Start a fresh session (/clear) and choose the model and effort at the start, for example the opusplan alias (Opus for planning, Sonnet for implementing) or Sonnet at medium.
  2. Use plan mode to explore and agree on a plan before any code is written, so there is less expensive rework.
  3. Write specific prompts that name the files and the expected result.
  4. Ask Claude to use a subagent for wide research or for running long test suites, so the bulky output stays out of the main context.
  5. Press Esc early if Claude goes the wrong way.
  6. At a natural break, /compact with focus instructions; check /context and /usage now and then.
  7. When the feature is done, /clear before starting anything unrelated.

A good answer explains why each step saves tokens (smaller context, fewer re-reads, less rework, no cache-breaking switches mid-task). opusplan switches models only once, when you leave plan mode, so it costs one cache rebuild at a natural break, unlike switching back and forth while Claude works.

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?

  • Trim CLAUDE.md to the essentials (aim for under about 200 lines); move occasional instructions into skills or path-scoped rules. All of CLAUDE.md is loaded into every session.
  • Disable the unused MCP servers with /mcp (and prefer CLI tools such as gh where possible). Their tool names and instructions take space in every session.

It matters because this start-up material is sent with every request: it costs usage on every message, leaves less room for real work, and a crowded context makes Claude follow instructions less reliably.

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.

False. Claude Code reads CLAUDE.md when the session starts. The edit takes effect after /clear, /compact, or a restart. (The edit also doesn’t break the prompt cache, for the same reason: the running session isn’t using it yet.)

Challenge

Question 23 · Hands-on

In a practice project:

  1. Start Claude Code and run /context before typing anything. Note how much is already used and by what.
  2. Ask Claude to read and explain three files, then run /context again.
  3. Run /compact and check /context a third time.
  4. Run /usage (and press d and w if you are on a subscription).

Write three sentences on what you learned about what fills the context window.

Your numbers will differ. Typically you will see that some space is used before you type anything (Claude Code’s instructions, tools, CLAUDE.md), that file reads grow the context quickly, and that /compact shrinks the conversation part while the start-up material remains. A good write-up connects this to habits: specific prompts, /clear between tasks, and subagents for heavy reading.

© 2025-2026 Y. Rosenthal. All rights reserved.