Claude Code 2.1.299 compacts idle chats before cache expiry

Claude Code now summarizes a large conversation you have walked away from, a few minutes before the prompt cache that keeps continuing it cheap runs out. Anthropic describes the behavior in the v2.1.299 release notes on GitHub, published October 14. Here is the rule: if a terminal conversation of 200K tokens or more sits idle for about 54 minutes, it is compacted before its one-hour cache expires.
The rest of the release is long. A few entries change rules people have already written: MCP permission matching, the order in which prompt hooks fire, and what plugin hooks do when they break. Others close sandbox and credential gaps for teams on third-party gateways.
How idle compaction works
Compaction is itself a request. Claude Code sends the whole history along with an instruction to summarize it. While the cache is warm, that history is read from the cache at a fraction of the input price. After a longer break, the summarization request reprocesses the full history as uncached input, and your next message pays for that. Idle compaction moves the summary to the last moment the history is still cheap to read, minute 54 of a 60-minute cache.
Several conditions have to hold for it to fire. The session has to be an interactive terminal session on the one-hour cache, with access to Anthropic’s feature flags. The context has to be over the threshold (200,000 tokens by default), and the computer has to be awake at roughly the 54-minute mark. When it runs, you come back to the notice “Compacted while idle, before the prompt cache expired”. Lydia Hallie, announcing the feature, said it “saves you some usage.”
The trade-off is the usual one for compaction. A summary keeps the gist of the conversation, not every line, so you may need to restate an exact error message or an instruction from two hours ago after the break.
Who actually gets it?
Unless you set a TTL yourself, Claude Code asks for the one-hour cache only on a Claude subscription that is within its plan’s included usage. With an API key or a cloud provider, the main conversation defaults to a five-minute cache. A subscriber who goes over plan usage and starts drawing on usage credits drops to five minutes too. On a five-minute cache, a 54-minute timer has nothing to save.
The threshold narrows it again. The settings reference says that at the default, a conversation on a 200K context window auto-compacts before it reaches 200,000 tokens. So at the default threshold, the sessions that qualify are mostly those on a one-million-token window. Out of the box, the feature reaches only subscribers inside their plan who run very long sessions.
Two settings control it. CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS moves the 200K minimum (values below 100000 are raised to 100000), and "idleCompaction": false in settings.json turns it off. Both need v2.1.290 or later. The behavior itself appeared earlier, in 2.1.286, with no opt-out. The setting and the variable followed in 2.1.290, and the 2.1.299 changelog now describes the feature. On versions before 2.1.290, turning off autoCompactEnabled stops it.
Rules you may need to rewrite
MCP allow rules now reach only the server they name. Until now, mcp__a also allowed a server named a__b or a_. From this release, you write mcp__<server>__* with the server’s whole normalized name. The tools: list in an agent definition follows the same rule, so a server whose name contains a double underscore goes in as mcp__<whole name>__*. A related fix makes deny and ask rules apply to servers whose normalized name contains a double underscore.
UserPromptSubmit hooks now run before a skill or custom slash command expands. So a hook that blocks the prompt also stops the shell commands embedded in that skill or command. A skill’s own front-matter UserPromptSubmit hook, on the other hand, first runs on the prompt after the one that invokes the skill.
Plugin hooks get stricter about failure. Any action a plugin hook can block is now refused, not let through, when the hook cannot be handed the action or cannot hand back its answer. If the tool already ran, its result is withheld. In 2.1.295, failing closed was an opt-in for command and HTTP hooks. For plugin hooks it is now the default behavior. Values that plugin hooks and workflow scripts hand back are refused if they nest deeper than 28,000 levels, and the error names the limit. Workflow scripts used to allow 100,000.
Mod authors have a few more adjustments to make. The turn.start hook now also hears subagents’ and teammates’ turns, not just the main loop’s. You tell them apart by e.agentId, which is absent on the main loop. In claude plugin test, each mod’s Box or Text root in a ui.render tree now carries part: { plugin }, so exact-tree assertions must include it. A served $ method that has not answered within ten seconds now fails, as it does in a session.
One new variable changes what Claude sees for @ mentions. With CLAUDE_CODE_DISABLE_FILE_MENTIONS set, Claude gets the paths of @-mentioned files and reads them with its file tools, instead of getting their contents. Separately, @-mentioned PDFs no longer keep their bytes in the session transcript. The resume command printed at exit now names the session by its ID instead of its name, so that nothing in a session name can run when the line is pasted.
Gateway keys and sandbox holes
Teams that route Claude Code through a third-party gateway with ANTHROPIC_BASE_URL get several fixes at once. Feature flag, startup, fast mode, profile and feedback requests to Anthropic were carrying the API key configured for the gateway. The server-managed settings request did the same when a managed settings file set the base URL. Anthropic API keys are still sent. Streams through a custom base URL used to be aborted after 180 seconds with no data and now wait 300. Sessions on a gateway-specific model name could end with “Prompt is too long · automatic compaction failed” near 200K tokens instead of sending the request.
On Windows, PreToolUse and PermissionRequest hooks that set no shell failed open when Git for Windows was not installed. Now a guard that fails blocks the call. On macOS, sandboxed commands could read or write a denied path by its real location when the path passed through a symlink. Plan mode could run a write from an MCP tool, a file or a shell command if a PreToolUse hook or a mod’s tool.check hook allowed it.
The release also closes a path out of the sandbox. A sandboxed shell command could write into a --plugin-dir folder, and Claude Code reloads that folder’s code and runs it outside the sandbox.
Up next
Liquid AI’s 2B-active model beats Qwen on LiveClaw
Just 2B of 24B parameters work per token in Liquid AI’s LFM2.5-24B-A2B, and it still beat Qwen3.6-35B-A3B on LiveClaw, 48.09 to 38.19. Would you run an agent locally on your own machine or keep it on a cloud API?
Related stories
Comments
No comments yet. Be the first.
Join the conversation
Sign in to leave a comment. It appears after moderation.

