Headroom

/compact vs /clear: which saves more of your limit?

/clear costs nothing and starts fresh. /compact summarizes a long chat but reads all of it first. Here is Anthropic's rule of thumb and when each one is right.

ยท 5 min read

/clear saves more of your limit, because it costs nothing: it drops the conversation from context and starts empty. /compact keeps continuity by summarizing the conversation, but to write that summary Claude Code has to read the whole thing, so compacting a large context is itself a large request. Anthropic's rule of thumb is to use /clear when starting a new task and /compact when continuing a long one.

Why this matters for your limit

Anthropic's cost documentation explains that a long session gets more expensive over time because the long context is resent with every request. Its advice for the first habit is to clear between tasks: "Stale context wastes tokens on every subsequent message."

Anthropic does not publish how many tokens or messages a limit equals, so we cannot give you a figure for how much you save. What the docs make clear is the direction: a smaller context means each request uses less of your limit.

What /clear does

/clear starts a new conversation with empty context. Per the docs, "When you want a fresh start instead of continuity, /clear costs nothing." Your CLAUDE.md and project files stay available; only the chat history goes.

Anthropic's Help Center guidance on usage in Claude Code gives a simple test for when to clear: "if your next prompt would make perfect sense in a brand-new session, clear before sending it". It also says /clear cannot be undone, so treat it as final for the conversation you are in.

The Claude Code docs add a useful detail: the old conversation is still on your machine. The commands reference says you can return to it with /resume. To make it easy to find, the cost guide suggests running /rename before clearing, and /clear itself takes a name that labels the previous conversation in the /resume picker:

/clear login bug

What /compact does

/compact replaces the conversation with a summary so you can keep working on the same task. The docs say it "reads the conversation it summarizes, so compacting a large context is itself a large request."

This is easy to miss. Compacting right at the edge of your limit does not free room first; it spends a big request to produce a smaller context. If you are close to a limit, a large compact can be the request that tips you over.

Compacting is still the right tool when you need the thread of the work. A refactor that depends on decisions made forty messages ago is a good example: a fresh session would have to rediscover them.

You do not always choose the moment. Claude Code also compacts automatically when the conversation approaches the context limit, and the cost guide lists compaction among the reasons usage climbs in a long session. Clearing between tasks keeps you away from that point.

Steer the summary

You can tell /compact what to keep. Anthropic's example is:

/compact Focus on code samples and API usage

You can also add a "# Compact instructions" section to your CLAUDE.md so the guidance applies every time.

How to choose

Situation Use
Starting a different task /clear
The next prompt would make sense with no history /clear
Continuing a long task that depends on earlier decisions /compact
You want to keep the old conversation findable /clear with a name (or /rename first), later /resume
You are almost out of limit /clear, or finish the step and wait, because a compact is a large request

The last row follows from the docs: since a compact reads the whole conversation, it is the wrong thing to run when you have little limit left and the conversation is big.

Habits that reduce the need for either

The cost guide lists several other habits. A few that connect to context size:

  • Keep CLAUDE.md lean. Anthropic suggests under roughly 200 lines, and moving specialised instructions into skills.
  • Point at files by path instead of pasting them. The Help Center notes that the @ prefix injects the whole file, so a bare path is lighter.
  • Turn off MCP servers you do not use. Run /context to see what is taking space and /mcp to disable servers.

For the wider picture, see how to make Claude Code limits last longer and why Claude Code usage drains fast.

A worked example

Say you spent an hour fixing a bug and the conversation is long. The bug is fixed and you now want to start a feature in a different part of the code. Nothing from the bug hunt matters, so run /clear login bug and begin the feature with a clean context; the bug conversation stays in /resume under that name. Every request after that carries far less history.

Now say you are halfway through a large migration and the conversation is long, but the next step depends on choices made earlier. Here /compact with instructions naming what to keep fits better than starting over, as long as you run it with room to spare.

Context is not the only thing that costs you

Switching models also matters here. Each model keeps its own prompt cache, so after a switch Anthropic says the next request re-reads the whole conversation with no cache hits. If you plan to change models, doing it right after a /clear avoids paying that re-read on a large context. The details are in how to switch models in Claude Code.

Watching the effect

After you clear or compact, /usage is the place to see where you stand. Its breakdown rows can also tell you whether a big instruction file or a plugin is behind your usage, which is a better target than guessing. For a quick glance at where an account stands across the day, Headroom, a free independent menu bar app that is not made or endorsed by Anthropic, shows the session and weekly percentages for every Claude Code account signed in on your Mac. Download Headroom.

Short version

  • New task: /clear. It is free and keeps limits for work that matters.
  • Same task, long history: /compact, ideally with instructions, and not when you are nearly out.
  • Unsure: clear with a name, such as /clear old task, so you can /resume it later.