Skip to content

Folding Away a 54-Minute Break Before the Cache Expires──How Claude Code v2.1.299 Preemptively Cut the Cost of the "Comeback Hit" in Long Sessions

Claude Code v2.1.299's new "idle compaction" automatically compresses conversations over 200K tokens after about 54 minutes of inactivity—before the one-hour prompt cache expires—preemptively avoiding a full re-read on return. MCP permissions were also tightened at the same time.

Folding Away a 54-Minute Break Before the Cache Expires──How Claude Code v2.1.299 Preemptively Cut the Cost of the "Comeback Hit" in Long Sessions

You Stepped Away, and Behind the Scenes Your Context Had Been Folded Up

Claude Code v2.1.299 (released October 14, 2026) introduces a mechanism called idle compaction. When a conversation exceeding 200K tokens sits untouched for about 54 minutes, the terminal automatically summarizes and compacts that conversation. The goal is singular: to re-fold the context before the prompt cache—which expires after one hour—lapses.

It may look like a minor behavioral tweak, but it pays off in a usage pattern everyone unconsciously falls into: leaving a long task open, stepping away, and coming back a while later.

Why That "Comeback Hit" Was Costing So Much

Every time you interact, Claude Code re-sends the entire conversation to the model. The earlier portion, identical to the previous turn, is read from the prompt cache—and that part costs less than full price. But this cache has a lifespan (TTL), and Claude Code uses one hour. Let it sit for more than an hour and the cache expires, so the first thing you say after returning means re-reading the full conversation as fresh, full-price input. The longer the session—especially past 200K tokens—the more heavily this re-read weighs on you.

ScenarioBeforev2.1.299
Leaving a long session open while awayCache expires after one hourAuto-compaction fires at about 54 minutes
First words after returningFull conversation re-read at full priceRe-folded, smaller context read back at a discount
ImpactLatency and cost spikeSpikes preemptively contained

In short, it's a two-stage move: insert a summary just before the cache lapses, reset the TTL, and shrink the context itself.

You Can Move the Trigger Line Yourself

It works out of the box, but you can tune the behavior through settings.

  • Change the trigger threshold: The environment variable CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS lets you raise or lower the default "200K tokens or more" condition.
  • Turn it off entirely: Setting "idleCompaction": false in settings.json disables it.

Alongside this, /usage was enhanced to warn you when you're running in "cost-prone" states—maximum effort, workflows, always-on context, large tool outputs, and the like. It's part of a broader move to put gauges on the paths where cost quietly piles up during unattended operation or long-running loops.

Tightened on the Side: the "Pass to the Tools"

The same release also quietly narrowed the permission rules for when an agent calls external tools. MCP allow-rules now apply only to the server you name by name, ending the behavior where an allowance for mcp__a would also let through a__b or a_. An agent's tools: specification likewise now picks up only the tools of the named server. Furthermore, communication via claude.ai connectors or to Anthropic-hosted MCP servers no longer follows HTTP redirects. All of these are adjustments that close off the room for an agent's "outward-facing mouth" to open wider than intended in unattended or organizational operation.

The Flip Side of Folding Automatically

Convenient as it is, idle compaction is still a summary, so the fine details and nuances of a long context may be lost. There's a legitimate concern that, after returning, you might feel that "a premise we were sharing just a moment ago has faded." For important long-form work, it's safest to compensate through operational habits: raise the threshold, disable the feature, or check the context yourself at key junctures. And the very fact that this MCP permission behavior was closed off is itself the flip side of how broad allowances had, until now, been letting things through to unintended scopes—agent permission design remains worth auditing.

It's not a flashy new feature, but the more that running agents long and unattended becomes the norm, the more this kind of groundwork—preemptively trimming both latency and cost—starts to pay off.

References: Claude Code v2.1.299 Release (GitHub) / Claude Code Changelog (official) / Claude Code v2.1.297–v2.1.299 Updates (classmethod) / Control MCP server access (official docs)