Bigger context windows don't mean what people think
Was learning a little about agent context windows and how they work. Based on interrogating Claude Chat, the following information was verified against the official documentation on context.
-
Context window ≠ cache. Jumping to a 1M-token window just gives you a bigger buffer. It doesn't mean earlier content gets cached automatically — prompt caching is a separate, opt-in feature.
-
The 1M window isn't only for the newest models.Compaction works the same way at the larger limit.
-
Performance tracks absolute tokens, not percentage. This is my own rule of thumb, not something the docs state: a model tends to feel the weight of a long context by raw token count, not by how full the window is. So a nearly-full 200K session can behave worse than a 250K session inside a 1M window — raw tokens are what dilute attention. The docs only go as far as "compact when context starts affecting performance," so treat the specific numbers as judgement, not fact.
-
Set auto-compact by token count — there's no percentage knob. Claude Code takes an absolute threshold directly. For example
- /autocompact 750k — persisted to your settings
- claude --autocompact 750k — for one launch
CLAUDE_CODE_AUTO_COMPACT_WINDOW=750000— for scripts and CI (plain numbers only)
-
The accepted range is 100K–1M. Sonnet 5 on the Anthropic API defaults to compacting at about 967K. There's no
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEor any percentage override — if you were reaching for one, set the token count instead. -
Find your own threshold. Watch for the failure signals — re-asking known info, forgetting earlier constraints, hallucinated paths or functions — note the token count when they show up, and set your compact window from that. Reasoning-heavy tasks will likely want a lower threshold than simple retrieval or Q&A.