█

AI/TLDR

Anthropic · 2026-10-14 · major

Claude Code 2.1.299 — idle compaction saves long sessions before the cache expires

Claude Code 2.1.299 compacts a 200K+ token conversation left idle for about 54 minutes, before its one-hour prompt cache expires. It also adds CLAUDE_CODE_DISABLE_FILE_MENTIONS and closes several sandbox and MCP permission gaps.

Claude Code repository card on GitHub

Claude Code now compacts idle long sessions before the prompt cache runs out, so your next message is cheaper.

Quick facts

Versionv2.1.299
MakerAnthropic
Released2026-10-14
Idle compaction200K+ tokens, idle ~54 min; "idleCompaction": false turns it off
File mentionsCLAUDE_CODE_DISABLE_FILE_MENTIONS sends paths, not contents
Self-hosted runner--shutdown-drain-sec for the orchestrator

What is it?

Idle compaction is the headline of Claude Code 2.1.299: a terminal conversation over 200K tokens that sits idle for about 54 minutes is compacted before its one-hour prompt cache expires. The release also adds CLAUDE_CODE_DISABLE_FILE_MENTIONS, which hands Claude the paths of @-mentioned files to read with its tools instead of pasting their contents.

How does it work?

The 200K-token floor is set with CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS, and both settings need v2.1.290 or later. Mods installed by managed settings can now read attached images and documents through $.prompt.media and see how a session is signed in via $.session.identity(). MCP allow rules now match only the server they name, so mcp__a no longer also allows a server called a__b.

Why does it matter?

Teams that leave big sessions open over lunch stop paying to reprocess the whole context on return. Security admins get many fixes: a sandboxed command can no longer write into a --plugin-dir folder that runs outside the sandbox, macOS sandbox deny rules now hold through symlinks, and plan mode no longer runs writes that a hook allowed.

Who is it for?

Claude Code users with long sessions, mod and plugin authors, admins running managed settings or self-hosted runners

Frequently asked questions

How do I turn off idle compaction in Claude Code?
Claude Code 2.1.299 turns idle compaction on in the terminal for conversations over 200K tokens. To switch it off, set "idleCompaction": false in settings.json. To change the 200K-token minimum instead, set the CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS environment variable. Both settings need Claude Code v2.1.290 or later.
Why does Claude Code compact after 54 minutes of idle time?
The prompt cache for a Claude Code session lasts one hour. Claude Code 2.1.299 compacts a large idle conversation at about 54 minutes, just before that cache expires, so the next message you send does not have to reprocess the whole long context at full price.
What security fixes are in Claude Code 2.1.299?
Claude Code 2.1.299 stops sandboxed shell commands from writing into a --plugin-dir folder whose code runs outside the sandbox, and makes macOS sandbox deny rules hold when a path passes through a symlink. Plan mode no longer runs a write that a PreToolUse hook allowed, and MCP allow rules now match only the exact server they name.
Can Claude Code stop reading @-mentioned files into the prompt?
Claude Code 2.1.299 adds the CLAUDE_CODE_DISABLE_FILE_MENTIONS environment variable. With it set, an @ file mention gives Claude only the file's path, and Claude reads the file with its own file tools when it needs to. This keeps large files out of the prompt until they are actually used.

Try it

npm i -g @anthropic-ai/claude-code@2.1.299

Sources

Tags

  • claude-code
  • anthropic
  • coding-agent
  • cli
  • compaction
  • prompt-caching
  • sandbox
  • mcp
  • mods
  • developer-tools
  • release

← All releases · Learn AI