Why Claude Code started compacting your idle chats
The short version
Long Claude Code chats can tidy themselves up. Leave a 200K+ token terminal session idle ~54 minutes and it can compact before the one-hour prompt cache dies — so your next message doesn’t re-chew the whole transcript. Tune with CLAUDE_ or disable with "idle.
On this plate
What shipped
Since Oct 14, 2026, Claude Code compacts long terminal chats you walk away from: after roughly 54 minutes idle on chats above ~200K tokens, the session can compact before the hour-long prompt cache expires (Claude Code v2.1.299 release notes).
Independent weeklies picked it up the same day (e.g. DevAgentRadar brief (Oct 15, 2026)).
The same week brought related context hygiene: CLAUDE_ (paths without dumping file guts) (Claude Code v2.1.299 release notes) and OTel splitting cache writes into cache_ / cache_ (Claude Code v2.1.300 release notes).
Idle compaction is the headline; the metrics and mention controls are the side dishes teams will actually wire into dashboards.
Why the one-hour cache matters
Prompt caching discounts repeated prefixes. If the cache expires, the next turn re-processes the transcript — latency and bill go up. Compacting before expiry trades some history fidelity for a warm cache.
Anthropic’s platform docs cover context windows and caching behavior at a product level (context windows); the Claude Code release notes are the authority for the terminal-specific idle timer.
For agentic coding, marathon sessions are normal: a refactor that spans lunch, a debug loop that waits on CI, a long tool-using plan. Without idle compaction, walking away near the cache boundary is how you come back to a cold prefix and a slow first message.
With it, the runtime babysits the boundary for you — on purpose, with knobs.
This week was less “smarter model,” more “you can actually walk away.” Idle compaction is babysitting for marathon sessions.
We are not claiming measured dollar savings on your account. Read the release notes and your own usage dashboard. Cache economics depend on model, plan, and how often you actually cross the TTL.
Mechanics and thresholds
From the release notes (Claude Code v2.1.299 release notes):
- Idle window: roughly 54 minutes of idle time before compaction can fire.
- Size gate: sessions around 200K+ tokens are in scope for the default behavior.
- Goal: compact before the one-hour prompt-cache TTL elapses, so the next user message can reuse a warm prefix instead of re-ingesting the full transcript.
Downstream effect: compacted history is not a bit-perfect transcript. If your workflow depends on scrolling back through every tool call for audit or demo, treat compaction as a fidelity trade. If your workflow depends on snappy resumes after coffee, treat it as a latency/cost trade that usually wins.
Observability: the same train splits cache-write metrics into 5m vs 1h buckets in OTel. That is how you tell whether idle compaction is doing real work versus whether you are still paying cold-prefix taxes (Claude Code v2.1.300 release notes).
Wire those series before you argue about savings in a sprint review.
Blast radius for teams
| Surface | Why it matters | What to check |
|---|---|---|
| Solo power users | Overnight terminals stop waking up cold | Personal default: leave compaction on |
| Pairing / demos | Full transcript may be part of the show | Disable for demo profiles |
| CI / unattended loops | Compaction timing vs long jobs | Confirm idle thresholds before overnight runs |
| Observability | Cache write buckets change meaning | Update dashboards for 5m / 1h split |
| Compliance / retention | Compaction changes what remains in-session | Document expectations with security |
Idle compaction is a client/runtime behavior for Claude Code terminals, not a silent change to Anthropic’s cloud retention policies. Do not conflate "session compacted locally" with "logs deleted in the vendor console." Your logging stack remains your logging stack.
Migration notes and ops checklist
Rollout tips grounded in the release notes and adjacent tooling the same week:
- Inventory long-lived terminals. Who leaves 200K+ sessions open overnight? Those users feel this first (Claude Code v2.1.299 release notes).
- Pick a default per profile. Personal marathon coding: on. Customer demos / training recordings: off via
"idle.Compaction": false - Tune before you disable. Raise
CLAUDE_if you want fewer compactions without giving up the babysitter entirely.CODE_ IDLE_ COMPACT_ MIN_ TOKENS - Update runbooks. If on-call pastebacks assume a full scrollback, say so. Compaction is not a bug; it is a documented trade.
- Align hooks and deny/ask policy. Unattended loops that used to freeze waiting for a human should fail closed — same class of failure as idle sessions waiting on someone who walked away.
- Dashboard the new OTel fields. Confirm
cache_/creation_ 5m_ tokens cache_land in your collector before you declare victory on cost (Claude Code v2.1.300 release notes).creation_ 1h_ tokens - File mentions. If
@paths are bloating context, tryCLAUDE_so mentions stay paths, not file bodies (Claude Code v2.1.299 release notes).CODE_ DISABLE_ FILE_ MENTIONS
Controls and escape hatches
From the release notes and weeklies citing them:
CLAUDE_— raise the threshold so smaller sessions never compactCODE_ IDLE_ COMPACT_ MIN_ TOKENS "idle— turn it off for a profile or machineCompaction": false CLAUDE_—CODE_ DISABLE_ FILE_ MENTIONS @paths without dumping file bytes into context
Related releases in the same window
- Claude Code release notes: idle compaction (Claude Code v2.1.299 release notes) and split cache-write metrics (Claude Code v2.1.300 release notes)
- Anthropic’s context-window and prompt-caching primer (context windows)
- Agent Skills overview (progressive disclosure vs always-on rules) (overview)
Chef’s pick: keep idle compaction on for personal marathon sessions; disable it in demos where you need the full transcript on screen. Tune the token threshold before you kill the feature — most teams want the babysitter, not a colder cache.