Anthropic recently announced that its 1M-context models like Opus 5.5 will now compact automatically near 400K tokens by default. The reason behind the change is to reduce usage on longer sessions.

I wanted to understand the implications on my own workload and whether the 400K context limit makes sense for me as a default. On my sessions, it saves about 8%. That's smaller than I expected, because idle compaction was already saving 17%.

How compaction works

Claude Code is a loop. Every turn, it sends the whole conversation back to Claude: the system prompt, your tools, every message and every tool result. More turns == larger the conversation → more tokens being used.

Prompt caching keeps each additional turn cheap. Text that Claude has already seen is cached for up to an hour. And reading it back costs $0.20 per million tokens on Opus 5.5. Any new text has to be written to the cache first at $8 per million. Writing costs 40 times as much as reading.

Every turn reads the whole conversation again, so cheap reads still add up. At 200K tokens, each turn costs about $0.04 just to read it back. At 800K, it's $0.16, even if you only asked Claude to fix a typo.

Compaction shortens the conversation. Here is how compaction works step by step:

1. The conversation hits the limit: your context window hits the 400k token limit.

2. Claude summarizes it. Claude Code sends the whole conversation to Claude and asks for a summary in nine fixed sections (these sections come from Claude Code's own instructions for compaction):

1. Primary Request and Intent
2. Key Technical Concepts
3. Files and Code Sections
4. Errors and fixes
5. Problem Solving
6. All user messages
7. Pending Tasks
8. Current Work
9. Optional Next Step

Based on my experiments, the summary is roughly around 3000 tokens.

3. Claude Code rebuilds the prompt. It keeps the summary and your most recent messages, reloads your CLAUDE.md, memory and skills from disk, and re-reads up to five files Claude was working on (docs). This is the order of the prompt:

tools            ← cached
system prompt    ← cached
summary          ← new
CLAUDE.md        ← written again
skills, files…   ← written again
your next message

The cache can reuse the tools and system prompt. Everything after that has to be written to the cache again.

4. The next turn rewrites the cache. The new prompt has around ~110-150k tokens. Most of it has to be written to the cache. Writing to the cache is significantly more expensive than reading from the cache (~40 times more)

Why not compact all the time?

Every compaction costs around ~100-150k new tokens that have to written to the cache.

However, the savings are not fixed. Each turn after compacting saves the difference between the old size and the new one. Compact at 455K context window size and every subsequent turn reads about 350K fewer tokens.

Compact at 200K and every turn reads only about 90K fewer tokens.

So the same compaction takes a different number of turns to pay back:

Compact at

Turns to pay back

200K

~37

300K

~18

367K (auto)

~14

455K

~10

Compact too early and you keep paying for cache writes. Compact too late and every turn reads a huge conversation. The cheapest point is somewhere in between (which is probably why Claude Code auto compacts around 400k tokens).

The two triggers

Claude Code compacts on its own in two cases.

When the conversation gets too big

This is the setting that changed. Per the docs:

  • auto, the new default, compacts at about 367K tokens on Opus 5.5, Sonnet 5 and the Fable models.

  • /autocompact 1M goes back to about 967K.

  • /autocompact 300k (or any size from 100K up) sets your own.

Anthropic hasn't said how it picked 400K. Compaction fires about 33K before the window fills: 367K for 400K, 967K for 1M.

Idle compaction

Per the docs, idle compaction runs when:

  • the conversation is over 200K tokens

  • an hour has passed since the last message.

Your cache expires after an hour since the last message was sent. After that, the next message would have to write the whole conversation again to the cache.

Compacting just before the cache expires means only the compacted version gets written to cache.

Compacting by hand

You can also run /compact yourself. Add a focus, like /compact focus on the auth bug fix, and the summary keeps what you chose instead of what the automatic pass guesses is important (docs). This helps before a long new task in the same session.

Finding 1: idle compaction was already doing most of the work

To see what idle compaction was worth, I rebuilt my older sessions without it:

Cost (list prices)

No compaction at all (1M, idle off)

$804

What actually happened (1M, idle on)

$667

Idle compaction saved 17%.

Finding 2: the 400K auto compact saves an additional 8%

Then I replayed the sessions with the compaction size trigger at different points, leaving idle compaction on.

Compact at

Cost

vs before

Extra compactions

1M (old default)

$667

600K

$664

−0.5%

2

500K

$648

−2.8%

6

367K (auto)

$616

−7.7%

15

300K

$606

−9.2%

31

250K

$609

−8.8%

56

200K

$648

−2.9%

127

300K was the best but not a significant difference from Anthropic’s default (about 1 to 2% cheaper than auto).

As we saw above, compacting too frequently ended up doing worse than fewer compactions.

What I'm doing

Keeping auto and idle compaction enabled. Together they cut my usage by about 23% compared with no compaction.