Compact or clear, and what it costs
Compacting replaces your history with a summary. Clearing throws it away. Both are one-time costs that buy a cheaper rate on every turn after, because each turn re-reads the whole prefix from cache. This page projects all three paths forward from where your session is now, so you can see where each one crosses below the others.
Compaction pays for itself after 6 turns
Compacting costs $1.05 up front, on a warm cache
Clearing costs $0.40 up front, and loses everything you don’t re-read
Clearing pays for itself after 3 turns.
Start from your own session
Drop a Claude Code transcript and the scenario fills in with your real turn sizes, your cache’s state, and how much your compactions actually shrink the context.
Loading the session reader…
Your scenario
Dollars per million input and output tokens.
How long a cache write lasts. A longer one costs more to write.
Cold means more than the cache lifetime has passed since your last turn.
Tokens in the prefix every turn re-reads.
A percentage of your context, or a token count over 100.
Files and notes you’d open again after clearing.
New tokens each turn adds, such as tool results and your messages.
Tokens the model writes each turn.
How far to project. The slider stops at 120, the box at 500.
Size the re-read
Loading the file reader…
Keep going for a few turns, then compact. Is waiting actually free?
Advanced
System prompt, tools, and project context. All three strategies carry it.
Turns characters into tokens for the file estimate. It’s an estimate, and code often runs closer to 3.
Cumulative spend
Dollars spent from now, turn by turn. Turn 0 is only the one-time cost. A dot marks where compacting or clearing first costs no more than keeping going.
- Keep going
- Compact now
- Clear now
Hover or use the arrow keys to read a turn. Click a turn, or press Enter, to pin it and mark its row in the table.
Loading the export buttons…
Where the compaction dollars go
- Reading history to summarize it
- $0.20
- Generating the summary
- $0.50
- Rebuilding the cache
- $0.35
Generating the summary is the largest slice, 48% of the up-front cost.
Projected spend
The chart’s numbers as a table. Pin a turn on the chart and it’s marked here.
| Turn | Keep going | Compact now | Clear now | Best |
|---|---|---|---|---|
| 1 | $0.32 | $1.19 | $0.54 | Keep going |
| 5 | $1.64 | $1.77 | $1.14 | Clear now |
| 10 | $3.36 | $2.58 | $1.96 | Clear now |
| 20 | $7.07 | $4.47 | $3.86 | Clear now |
| 30 | $11.12 | $6.70 | $6.12 | Clear now |
What would change this answer
Loading the sensitivity table…
Prices
Loading the price table…
How this is calculated
Loading the explanation…