Compact when the session is carrying a lot of history on top of where it started. A fixed number such as "200K" is the wrong test, because some sessions start close to that before any work is done.
What compact and auto-compact do
/compact replaces the conversation so far with a summary, so the session carries less on every turn
after it. Auto-compact is Claude Code doing the same thing by itself when the context window is
nearly full. Auto-compact protects you from running out of room. It does not protect you from cost: by the time it
fires, you have already paid for many turns at close to the full window.
Why a fixed number misleads
It is tempting to say "compact past 200,000 tokens". On the author's Mac, ordinary sessions started at about 126,000 tokens because of the tools and plugins loaded into them. A 200,000 line flagged nearly every session within minutes, including ones with very little history worth removing.
Compacting can only shrink the history. It cannot remove what is loaded fresh at the start of every session. So the useful question is how much history there is.
A better rule
History = size per turn now, minus size at the first turn. When that passes roughly 150,000 tokens, compacting pays off. Two examples from the same afternoon:
| Session | Started at | Now | History | Verdict |
|---|---|---|---|---|
| A | 127K | 300K | 173K | Compact: each turn costs about 2.4x a fresh one |
| B | 126K | 229K | 103K | Leave it for now |
The figures on this page come from real session logs on the author's Mac, read with Cost Doctor. Your numbers will differ; the pattern usually does not.
Compact, or start fresh?
- Compact (
/compact) when you are in the middle of a task and need the thread of what has been decided. - Start a new session when you are moving to a different task. A fresh session carries no history at all, which is cheaper than the best summary.
If the session started large
If the first turn was already big, compacting will not get you back below that. The fix is to load less into the session in the first place. See how much connectors and plugins add to every turn.
Cost Doctor applies this rule for you. It shows each session's start, its size now, and says "compact now" only when the history passes the limit. You can change that limit in its settings.
See it on your own sessions
Cost Doctor is a Mac menu bar app that reads the logs Claude Code and Codex already write. It names the session that is using your tokens, says why, and turns your screen red when a check fails while an agent sits waiting. Nothing leaves your Mac.
Download the free trialHow it works14 days free, no account. Then $19 once, plus tax where it applies. For Apple silicon and Intel Macs on macOS 13 or later.