
Claude Code now compacts idle chats before the cache expires
v2.1.299: compaction while you're away
- 200K+ token chat
- About 54 min idle
- Auto compact
- Before 1h cache expiry
In the terminal, a conversation over 200K tokens left idle for about 54 minutes is compacted before its one-hour prompt cache expires, so your next message doesn't reprocess the whole thing. CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS changes the 200K minimum, and "idleCompaction": false in settings.json turns it off. Both need v2.1.290 or later. Whether it also runs outside the terminal (VS Code, desktop app) is not disclosed.
Source: Claude Code GitHub release, Oct 14 ↗
My takeLong conversations getting compacted is natural. What matters is whether it happens when you want it to. I always compact manually. The right moments are when one task is done, when one category of a long task is done, or before I step away for a long time. A cache miss with a nearly full context is a waste.
Compared with when I compact by hand
Manual compact Idle compaction One task done Covered Not covered One category of a long task done Covered Not covered Stepping away for long Covered Covered CoveredNot covered
Idle compaction looks at two things: conversation size (200K tokens or more) and idle time (about 54 minutes). Whether a task or category is finished is not part of it. So of the three moments, only stepping away is handled automatically. Whether you can choose what the summary keeps is not disclosed.
v2.1.300: more tracing, resume fixes
- More OTel tracing
- Cache writes split 5m / 1h
- Resume history fix
- The OpenTelemetry api_request event adds cache_creation_5m_tokens and cache_creation_1h_tokens, splitting cache writes by lifetime.
- Trace spans get OpenTelemetry GenAI semantic-convention attributes such as gen_ai.provider.name, gen_ai.conversation.id, gen_ai.tool.name and error.type.
- Fixed resuming a headless or Agent SDK session losing the recent messages a compaction kept, when the compaction followed a reply cut at the output token limit. Applies to compactions from this version on.
- Fixed resuming losing the compaction summary or bringing back pre-compaction history, when the compaction followed a retried or unfinished reply in the same turn.
- Fixed the first transcript entry written after resuming being lost when a crash had cut the transcript's last line short.