Skip to content
← Back to release · 2.1.299
New features / v2.1.299

Idle compaction in the terminal

CHANGELOG · original

Added idle compaction in the terminal: a 200K+ token conversation left idle for about 54 minutes is compacted before its one-hour prompt cache expires, so your next message doesn't reprocess it all
Open official changelog ↗

Documentation

Documentation excerpt

Compacting the conversation

Compaction replaces your message history with a summary. By design, this invalidates the conversation layer: the next request has a new, shorter history that doesn't share a prefix with the old one.

  • System prompt: when the conversation's prompt is current, the next request reads this layer from the cache. If that prompt is out of date, such as after you resume the conversation, Claude Code switches to the current prompt and the next request rebuilds this layer's cache once.
  • Project context: Claude Code reloads this layer from disk. It's cached together with the conversation, so after /compact or automatic compaction its cache is rebuilt even if its files are unchanged.

To produce the summary, Claude Code sends a separate request. The request repeats your conversation's system prompt, tools, and the history being summarized. It ends with a summarization instruction. While the cache is warm, that request reads your prefix from the cache. A mid-session /compact then costs a fraction of what the context size suggests and spends most of its time generating the summary.

After a break longer than the cache lifetime, there is no cache left to read, so the summarization request reprocesses that history as uncached input. This is why /compact costs the most when you resume an old session. In both the warm and cold cases, the turn after compaction rebuilds the conversation cache for only the much shorter history, so that turn isn't the slow part.

[!TIP]

Compaction works in your favor when the context you discard is content you no longer need. To choose when its overhead happens, run /compact at a natural break in your work, such as between tasks, instead of waiting for auto-compaction to trigger mid-task. If you've gone down a path you want to abandon entirely, /rewind to an earlier turn instead. Rewinding truncates back to a prefix that is already cached, rather than building a new one as compaction does.

If you leave a long conversation idle while it is on the one-hour TTL, Claude Code can compact it. To turn idle compaction off, set idleCompaction to false, which requires Claude Code v2.1.290 or later.

Documentation snapshot · 2026-11-20

Change details