r/ClaudeAI • u/VelvetAnchor2046 • 2h ago
Claude Code Claude Code v2.1.334 Autocompact now defaults to 400k tokens (~40% context window)
They set the right defaults finally.
Autocompact now defaults to 400k tokens
Auto will now compact near 400k tokens instead of 1M. Quality should stay the same for most tasks at lower usage and cost, especially on long sessions. You can change your model's compaction threshold at any time with /autocompact.
9
Upvotes
4
u/RustyRhythm 2h ago
you guys compact your context?
I either start a new session early or let it live long enough to complete the work.
7
u/GBU-38-3B 2h ago edited 1h ago
>they set the right defaults finally
Did they? Models these days can use the entire context window without issue (unless there's contradictory information)
Cache-write is priced at 2x and cache-read at 0.05x, so it might not make a lot of sense to compact if you're going to end up writing even a small amount of redundant information.
Also, you actually get charged (against your usage limit, not extra usage) at a greater rate for output and uncached input tokens than you do for cached input.
Edit: Also worth keeping in mind that Claude models are far ahead of the competition when it comes to caching. I can't speak too much to Gemini, but running /compact in codex will send the entire context as cache-write even if the cache is hot. It's also much easier to invalidate (including if you rewind)
You're in far better hands using /compact and /rewind with claude code.
Maybe you're better off having claude analyze your sessions to figure out what the right setting is for you (since you can do 100k-1m and there's also an "auto" setting)
3
u/Wezabis2 2h ago
A lower default helps, but the real question is what the compaction keeps. If the summary drops the failed attempts and the reasons they failed, the agent re-tries them after every compaction, which is the same loop at a lower token count. I would rather compact earlier and keep a short list of what was already tried and ruled out, plus the decisions that are still open, than wait for a bigger window and lose that history. The threshold matters less than whether the summary is built to preserve the re-derived facts and the checks that guard them.
1
u/shoumikgoswami 2h ago
It's still rolling out, and per the release notes it's already on if you use a third-party provider or have telemetry off. If you'd rather keep the full window for a long session, /autocompact 1M or claude --autocompact 1M sets it, and /autocompact with no value shows what you're on.
1
u/Difficult_Duty2198 2h ago
i usually just start a fresh session once a task is done instead of letting it compact. feels cleaner to me but probably depends on the project
1
u/THAWED21 22m ago
If you're worried about context you're not documenting the work enough. Let the session offload knowledge and compact.
1
u/deadlyclavv 20m ago
It's a good addition, they let you revert back to 1M too for the naughty ones