CCLearn

Reading the budget and spending it — /context, /compact, /clear, /btw

verified against Claude Code 2.1.261 · 2026-09-0916 min

By the end you can

  • Run /context and act on what it reports rather than guessing at usage
  • Choose between /clear, /compact and /compact with instructions on purpose
  • State what reloads itself after compaction and what is summarised away
  • Use /btw for a question that should not join the conversation
  • Know that compacting a large window is itself a large request and clearing is free

Lesson 3.1 argued that the window is a budget. This one is the instrument panel and the three levers, and the order matters: read first, then choose.

Read it: /context

The documented description is exact about what you get:

Visualize current context usage as a colored grid. Shows optimization suggestions for context-heavy tools, memory bloat, and capacity warnings. — Commands

It takes an optional [all] argument. It reports the session you are actually in — which CLAUDE.md files loaded, which auto memory, what each tool listing costs — rather than the representative figures from the last lesson.

Two documented uses beyond curiosity. First, /context is how you confirm your CLAUDE.md actually loaded — the best-practices guide recommends it for exactly that. Second, it is how you find MCP servers you are paying for and not using; the costs guide points you at /context to see what is consuming space, and at /mcp to disable servers you are not actively using.

The three levers, and what each one costs

LeverWhat it doesWhat it costs
/clear [name]Starts a new conversation with empty contextNothing
/compact [instructions]Replaces history with a summaryA request over the whole history
/btw <question>Answers a side question outside the conversationThe answer never enters history

That cost column is the part people get backwards. Compaction is not a cheap tidy-up:

/compact reads the conversation it summarizes, so compacting a large context is itself a large request. When you want a fresh start instead of continuity, /clear costs nothing. — Manage costs effectively

So the choice between them is not "which frees more space". It is whether you need continuity at all. If the next task has nothing to do with the last one, compacting is paying a large request to carry forward a summary you are about to ignore. Clear instead.

/compact, and why the bare form wastes the lever

/compact takes optional focus instructions, and the documentation is direct about what that buys:

The summary keeps what you choose instead of what the automatic pass guesses is important. — Context window

text
/compact focus on the auth bug fix

The useful habit is to compact before a long new task inside the same workstream, with instructions naming what the next stretch will need — not after you have already noticed things going wrong.

You can also set this once per project rather than per compaction, by putting a section in your CLAUDE.md:

text
# Compact instructions

When you are using compact, please focus on test output and code changes

What survives compaction

Compaction does not simply delete the old conversation; different kinds of content are handled differently (Context window):

MechanismAfter compaction
System prompt and output styleUnchanged; never part of message history
Project-root CLAUDE.md and unscoped rulesRe-injected from disk
Auto memoryRe-injected from disk
The plan Claude wrote in plan modeRe-injected from disk
Rules with paths: frontmatterReloaded as Claude reads files they match
Nested CLAUDE.md in subdirectoriesReloaded as Claude reads files in that subdirectory
Files Claude read or editedRe-read, up to five, most recently modified first
Invoked skill bodiesRe-injected, capped per skill and in total; oldest dropped first
Context a hook added earlierSummarised with the rest of the conversation

Read the two halves. Anything that lives on disk comes back, because Claude Code can simply read it again. Anything that existed only in the conversation — your explanations, the reasoning, a correction you made, output a hook injected — is summarised, which is to say compressed with loss.

Three consequences worth carrying:

  • A constraint you stated in chat is fragile; a constraint in CLAUDE.md is not. If it must survive, write it down somewhere on disk.
  • A rule with paths: frontmatter is summarised away and only returns when a matching file is read again. The docs say plainly: if a rule must persist across compaction, drop the paths: frontmatter or move it to the project-root CLAUDE.md.
  • Only five files come back, most recently modified first — and a file over 5,000 tokens returns as a path reference rather than its contents.

/btw, the lever nobody uses

Ask a side question about the current session without adding to the conversation. — Commands

The answer never enters conversation history, so you can check a detail without growing context. This is the right tool for "wait, what was that file called?" or "what version are we pinned to?" — questions whose answers you need once and which would otherwise sit in the window for the rest of the session, being re-sent with every subsequent message.

Put the question on the same line. Running /btw bare reopens your most recent side answer, and Left steps back through earlier ones; if you have not asked anything yet, it prints a usage line. Before v2.1.212 that usage line was all the bare form ever did, because /btw required a question.

Choosing, as a decision rather than a habit

SituationReach for
Next task is unrelated to this one/clear
Same workstream, long stretch ahead, history is getting heavy/compact <what the next stretch needs>
You need one fact and do not want it in the window/btw
You want the window smaller before the automatic pass decides for you/compact with instructions
You have corrected the same mistake twice/clear, and a better opening prompt

That last row is Lesson 3.3 and 3.4, and it is the one that changes how sessions actually feel.

Checkpoint

  1. You are 90 minutes into a refactor and about to start a long, related implementation stretch. /clear or /compact, and why?

    Show answer

    /compact, with instructions. The choice between the two levers is not "which frees more space" — it is whether you need continuity at all, and here the next stretch is the same workstream, so the last 90 minutes are worth carrying forward.

    Do not run it bare. Name what the next stretch will need, as in /compact focus on the auth bug fix, so the summary keeps what you choose instead of what the automatic pass guesses is important. And run it now, before the long task — the useful habit is compacting ahead of a long stretch, not after you have already noticed things going wrong. /clear would be the right lever only if the next task had nothing to do with this one.

  2. You wrote "never touch the generated files" in chat an hour ago, and the session has since compacted. Is that instruction still reliably in context? Where should it have lived?

    Show answer

    No. Anything that existed only in the conversation — your explanations, the reasoning, a correction you made — is summarised, which is to say compressed with loss. Only what lives on disk is re-injected after compaction: the project-root CLAUDE.md, unscoped rules, auto memory, and the plan Claude wrote in plan mode.

    It should have lived in the project-root CLAUDE.md. A constraint stated in chat is fragile; a constraint on disk is not. Watch the near-miss version as well: a rule with paths: frontmatter is summarised away too and only returns when a matching file is read again, so the docs say to drop the paths: frontmatter or move the rule to the project-root CLAUDE.md if it must survive compaction.

  3. Which of the three levers costs a request proportional to the size of the conversation, and which costs nothing at all?

    Show answer

    /compact costs the request; /clear costs nothing. /compact reads the conversation it summarizes, so compacting a large context is itself a large request, while /clear simply starts a new conversation with empty context.

    That is the pair people get backwards — compaction reads like the cheap tidy-up and clearing like the drastic step, and it is the other way round. The third lever, /btw, sits outside the comparison: its answer never enters conversation history, so it does not grow the window at all.

Sources