claude code v2.1.299: idle compaction squeezes a 200K+ session before its one-hour cache expires
The Claude Code v2.1.299 release note (October 14, 2026) announced idle compaction: a 200K-plus token terminal conversation left idle for about 54 minutes is compacted before its one-hour prompt cache expires, so the next message does not reprocess it all. That one-hour cache is not everyone's default. v2.1.302 (October 16) added a /config row for the feature and turned fork subagents on by default in claude -p, the Agent SDK, the desktop app and VS Code. v2.1.314 (October 30) took idle compaction to VS Code and Claude Desktop's Code tab.
Claude Code's docs describe the problem plainly: after a long enough gap, the next request recomputes the full input, which is why the first turn back after stepping away can be noticeably slower. The release note for Claude Code v2.1.299, dated October 14, 2026, announced idle compaction to deal with that on long sessions. v2.1.302 two days later added a /config row for turning it off or back on, and changed a subagent default that affects claude -p, the Agent SDK, the desktop app and VS Code.
what idle compaction does
The release note is one sentence: a 200K-plus token conversation left idle in the terminal for about 54 minutes is compacted before its one-hour prompt cache expires, so your next message does not reprocess it all.
That one-hour cache is not universal. The prompt cache holds a conversation prefix for a set time to live, and as of November 6, 2026 the Claude Code docs give two values. The main conversation gets one hour on a Claude subscription within the plan's included usage. On usage credits, an API key or a cloud provider the default is five minutes, and setting promptCacheTtl to 1h gives the main conversation the hour. ENABLE_PROMPT_CACHING_1H=1 also requests it, but for the main conversation and for requests outside it, such as subagents, forks and compaction. One-hour cache writes bill at a higher rate. The settings reference lists being on the one-hour TTL as a condition for idle compaction, so a session on the five-minute default does not get it.
The docs also explain what the timing changes. Compaction sends a separate summarization request. While the cache is warm, that request reads the prefix from the cache; after a break longer than the cache lifetime, it reprocesses the history as uncached input. Either way, the turn after compaction rebuilds the conversation cache for only the much shorter summary.
The v2.1.299 note announced it for the terminal only. v2.1.314, released October 30, 2026, added it to VS Code and Claude Desktop's Code tab, with a different sequence: a 200K-plus token conversation left idle is summarized, and the summary is used on your next message if the prompt cache has expired. The same release made it also run for subscribers with telemetry turned off, and on Bedrock, Vertex, Foundry and LLM gateways once the one-hour prompt cache is on.
As of November 6, 2026, the settings reference lists these conditions: an interactive terminal session, the VS Code chat panel, or the desktop app's Code tab when the session runs on your machine or over SSH; autoCompactEnabled on; the one-hour TTL; a context at the token threshold, 200,000 by default; and about an hour since the last request, with your computer awake until then. The same page notes that at the default a conversation on a 200K context window auto-compacts before it reaches 200,000 tokens, so those conversations need a lower threshold to qualify.
turning it off, or changing the threshold
The v2.1.299 note also announced two knobs. CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS changes the 200K minimum, and the docs say values below 100,000 are raised to 100,000. "idleCompaction": false in settings.json disables the feature. The note gives v2.1.290 or later as the floor for both, and the docs give the same floor. On an earlier version, which ignores that key, the settings reference says to turn off autoCompactEnabled to stop idle compaction. v2.1.302 then added an Idle compaction row to /config, and the notices shown after an idle compaction began saying how to turn it off.
Compaction replaces your message history with a summary, and the docs say it works in your favor when the context you discard is content you no longer need. v2.1.318, released November 4, 2026, also fixed idle compaction replacing a conversation with a reply that was not a summary.
fork subagents on by default beyond the terminal
v2.1.302 also changed a default: fork subagents (subagent_type: "fork") went on by default in claude -p, the Agent SDK, the desktop app and VS Code, matching the terminal. The note says CLAUDE_CODE_FORK_SUBAGENT=0 turns them off and claude mcp serve never offers them. As of November 6, 2026, the docs describe that variable as turning fork mode off, which stops Claude starting forks on its own; you can still start one yourself, with /subtask when agent view is on or /fork when it is off.
A fork inherits the parent conversation rather than starting fresh, and its first request reuses the parent's prompt cache. The subagents docs say that because of that reuse, a fork costs less than a fresh subagent for tasks that need the same context. The same release also changed the desktop app and VS Code to always run the main conversation's subagents in the background, as the terminal does, instead of letting Claude choose. As of November 6, 2026, the subagents docs tie that to fork mode: while it is on, Claude can't wait for a subagent in interactive terminal, VS Code or desktop sessions on your machine. CLAUDE_CODE_FORK_SUBAGENT=0 lets you ask Claude to wait. Setting CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 instead makes Claude wait for subagents, with background commands off too.
also in v2.1.293 to v2.1.302
- Auto mode — v2.1.302 added
CLAUDE_CODE_AUTO_MODE_MODELto choose the model the client-side auto mode classifier uses; it does not change the model for server-side auto mode. As of November 6, 2026, the permission modes docs list more exceptions: if you set Claude Opus 5, Sonnet 5.5, Opus 5.5 or a model your organization's policy excludes, the default classifier model reviews instead, and if your provider can't serve the model, classifier checks fail and Claude Code denies each action it checks. Separately, v2.1.302 changed auto mode with the server-side classifier: a conversation too long for the safety check is compacted, instead of every checked tool call being denied. - Gateway fix — v2.1.299 fixed a failure where sessions on a gateway-specific model name behind a custom
ANTHROPIC_BASE_URLended with "Prompt is too long · automatic compaction failed" near 200K tokens. - Haiku 5.5 — v2.1.293 (October 7, 2026) added Claude Haiku 5.5 as the default Haiku model on the Anthropic API, with 1M context.
As of November 6, 2026, the npm registry's tags for @anthropic-ai/claude-code read latest 2.1.318, next 2.1.319 and stable 2.1.311, so the stable tag sits before the v2.1.314 and v2.1.318 changes above. In the terminal, the settings reference says the notice to look for starts with Compacted while idle, before the prompt cache expired.
// sources
- claude code v2.1.293 release — github.com/anthropics/claude-code/releases (primary) ↗
- claude code v2.1.299 release — github.com/anthropics/claude-code/releases (primary) ↗
- claude code v2.1.302 release — github.com/anthropics/claude-code/releases (primary) ↗
- claude code v2.1.314 release — github.com/anthropics/claude-code/releases (primary) ↗
- claude code v2.1.318 release — github.com/anthropics/claude-code/releases (primary) ↗
- idleCompaction, settings reference — code.claude.com/docs (primary) ↗
- environment variables — code.claude.com/docs (primary) ↗
- how claude code uses prompt caching — code.claude.com/docs (primary) ↗
- subagents — code.claude.com/docs (primary) ↗
- permission modes — code.claude.com/docs (primary) ↗
- @anthropic-ai/claude-code dist-tags — registry.npmjs.org (primary) ↗