Coding

Claude Code idle compaction: why a long session no longer has to be restarted after a break

Claude Code can now summarise a long conversation you have left idle, so your next message does not resend the whole history. Here is when it applies, how to tune it and where subagents fit in.

Oliver · FoxAI World4 min read
18
Oliver the owl sits at a Claude Code laptop among robots, books and a cloud symbol.Idle compaction, simply

Conceptual cover created with AI.

You work with Claude Code for a morning, the conversation grows past a few hundred thousand tokens, and then you go to lunch. When you come back and type one more message, the expensive part is not your question. It is the history behind it. Anthropic’s documentation describes a feature built for exactly this moment: idle compaction.

What idle compaction does

Two terms first. A prompt cache stores the already processed start of a conversation so the next request can reuse it instead of paying to process it again. Compaction replaces a long conversation with a summary so it takes less room in the context window, the model’s working memory.

Claude Code keeps the main conversation on a one-hour cache for subscribers who are within their plan usage. Cached parts expire after a period of inactivity. Without help, resuming after the cache has lapsed means Claude Code sends the whole conversation again, and the old part no longer comes cheaply from the cache. Idle compaction steps in before that: if a long conversation has been idle for about an hour, Claude Code compacts it, and your next message sends a summary instead of the full history. According to the settings reference, it applies once the context has reached a threshold that defaults to 200,000 tokens.

Oliver the owl sits thoughtfully at a Claude Code laptop beside a clock, paper stacks and small robots.
AI-generated conceptual illustration.

When it applies and when it does not

The condition that matters most is the one-hour cache. Anthropic’s caching page lists one hour only for the main conversation of a Claude subscription within plan usage. With usage credits, an API key or a cloud provider, the default is five minutes, and once a subscriber goes over plan usage and draws on usage credits, Claude Code drops the main conversation to the five-minute lifetime. Subagents, compaction requests and similar helper calls default to five minutes as well.

The changelog shows the feature spreading step by step. Version 2.1.302 on 16 October added an Idle compaction row to /config. Version 2.1.314 on 30 October brought idle compaction to VS Code and the Code tab of Claude Desktop, and extended it to subscribers with telemetry turned off and to Bedrock, Vertex, Foundry and LLM gateways once the one-hour cache is enabled. Version 2.1.318 on 4 November fixed a case in which idle compaction replaced a conversation with a reply that was not a summary.

A five-minute window for cloud sessions is sometimes cited. The official pages we read do not document idle compaction for web or cloud sessions; they split cache lifetimes by plan and billing, not by app.

How to tune or switch it off

  • Set idleCompaction to false in settings to turn it off; this needs Claude Code v2.1.290 or later. The /config row does the same.
  • CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS changes the token threshold. Values below 100,000 are raised to 100,000.
  • DISABLE_AUTO_COMPACT=1 turns off automatic compaction near the context limit together with idle compaction, while the manual /compact command keeps working. DISABLE_COMPACT=1 disables all compaction, manual included.

How it differs from auto-compact and /compact

There are now three triggers. Auto-compact runs when a conversation approaches the context limit. /compact runs when you ask for it. Idle compaction runs on time, for large conversations about to lose their cache while you are away. The trade-off is the same for all three: after compaction, Claude works from a summary. Small detail, big difference: anything the summary does not carry, such as an exact error message or a rejected approach, is no longer in front of the model. If such a detail matters, it is safer to write it into a project file or repeat it after the break than to assume it survived.

One main session, several helpers

A related practice is to keep connected work in one main conversation and let it delegate. Anthropic’s subagent documentation supports the mechanics: subagents run in their own context window within one session, and by default use the same model as the conversation that starts them. A model field in the subagent definition, or the CLAUDE_CODE_SUBAGENT_MODEL variable, can put them on a smaller model such as Sonnet or Haiku. Two limits are worth knowing: subagent requests count toward the same usage limits, and subagents get the five-minute cache by default even on a subscription.

My reading is that idle compaction mainly changes the habit of opening a fresh chat after every break. For subscribers working in long sessions, staying in one conversation becomes cheaper, but only if you accept that the conversation continues from a summary. For short sessions below the threshold, or for API and credit users on the five-minute cache, nothing changes, so a handover note in a project file remains the more reliable way to carry precise state across a long pause.

Ask AI about this article

Opens in a new tab with the question filled in.

Sources and research

Written by FoxAI World. The cover and illustrations are AI-generated conceptual artwork.

Your favourites

This list stays in this browser on your device. No account is needed, and other visitors cannot see it.

Use a story’s bookmark button to add your first favourite.