Back to Explore
NewsVibeFix 编辑部Updated Oct 19, 2026

Claude Code Now Compacts Your Idle Sessions for You: What 54 Minutes Saves

Claude Code 2.1.299+ auto-compacts 200K+ token conversations left idle ~54 minutes — right before the 1-hour prompt cache expires. A cost-engineering move, but lossy: here's what it discards and when to turn it off.

Claude Code idle compaction timeline: a 200K+ token session auto-compacts after ~54 minutes idle, before the 1-hour prompt cache expires

Anyone who codes with Claude Code has lived through this: you hand it a big refactor, the context climbs past 200K tokens, and then you step away — a meeting, lunch, two emails. When you come back, the conversation is still there. The model is still there. And somewhere in the back of your mind, you suspect half the money was already spent.

This week's Claude Code update goes straight at that invisible bill.

Across four consecutive releases, 2.1.299 through 2.1.302, Anthropic shipped a feature called idle compaction. The rule is simple: a conversation above 200K tokens, left idle for about 54 minutes, gets automatically compacted into a summary before your next message arrives. This isn't a cute little convenience — it's a rewrite of context economics.

Why 54 minutes?

The number is chosen with care. Claude Code's prompt cache lives for one hour: reusing the same context prefix within the hour is billed at cache-read prices; after it expires, everything gets reprocessed at full price. Step away for a 50-minute meeting and the cache is still warm when you return. Step away for 90 minutes and the cache is gone — the model has to re-read 200K+ tokens of full context, and at Opus 5.5 pricing, that's tens of dollars evaporating into thin air.

Idle compaction sits exactly at the 54-minute mark: summarize before the cache expires, so your first message back carries a summary instead of 200K tokens of raw transcript. The saving logic is blunt: a summary is far cheaper than the full text, and the summary's cache timer restarts.

Timeline diagram of Claude Code idle compaction: a conversation over 200K tokens idle for about 54 minutes is auto-compacted, avoiding a full-price re-read after the 1-hour prompt cache expires

What does auto-compaction actually throw away?

This is the question worth being rigorous about. Compaction is not a free lunch — it replaces the conversation layer with a summary. Per the release notes and documentation:

  • CLAUDE.md itself is unaffected and re-read from disk after compaction;
  • file contents Claude read because CLAUDE.md told it to are folded into the summary, but no longer exist verbatim;
  • files it wandered off and read on its own may survive only as a passing mention in the summary.

In other words, after compaction, your session is downgraded from a "god's-eye view" to a "heard-the-briefing view." Everyday follow-ups are fine. But if your work depends on precise context — chasing a race condition line by line, reviewing regressions against three diffs — its "memory" of some details is now a paraphrase you can't verify.

Anthropic provides a full opt-out: "idleCompaction": false in settings turns it off, /config now has a visible toggle row (added in 2.1.302), and the notice shown after a compaction tells you directly how to disable it. The threshold is tunable too: CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS changes the 200K trigger line (available since 2.1.290). It's on by default, but the choice is yours.

Two more "context screws" shipped in the same batch

Idle compaction wasn't the only change. Also worth noting is CLAUDE_CODE_DISABLE_FILE_MENTIONS: with it on, @-mentioning a large file passes only the path to the model instead of its contents, letting it read via its own file tools on demand. That fixes a long-standing annoyance — @-ing a 5,000-line file used to stuff the whole thing into context; now it's "here's the table of contents, flip through it yourself." The other is CLAUDE_CODE_AUTO_MODE_MODEL, which picks the model the client-side auto-mode classifier uses without changing server-side behavior.

Taken together, the direction is unmistakable: in the second half of 2026, the coding-agent race has shifted from "whose context window is bigger" to "whose context spend is smarter." Vendors no longer compete on 1M or 2M window numbers — they compete on managing your bill: auto-compaction, on-demand reads, cache alignment. Every move answers the same question: how do we make 200K tokens cost only what they should?

First, do the math: how expensive is an expired cache?

To see why this matters, you need the prompt-caching price ladder. Anthropic's cache has three tiers: cache write (first write), cache read (cache hit), and full-price reprocessing after expiry. For a 200K-token session, a cache read is typically a small fraction of full price — which is why "keep the cache warm" is basic craft for every heavy user: keep the session continuous, avoid long interruptions, /compact manually when needed.

But people have to leave their desks. The old playbook had two moves: come back and manually /compact before continuing (but the cache may already be expired, and compaction itself costs one full-price read), or /clear and start over (losing all context and re-explaining the task). Idle compaction automates the first move and — crucially — moves its timing ahead of cache expiry. It doesn't solve compaction; it solves the timing of compaction. Compacting six minutes early versus six minutes late can be the difference of one 200K-token full-price bill.

That's also why the threshold is 200K tokens and not lower: compacting small sessions saves pennies while adding summary information loss; auto-compaction only pays off when the context is genuinely expensive enough to be worth the head start. The 200K default is itself a cost-benefit tradeoff — Anthropic worked out the break-even point for you.

Three practical suggestions

First, leave it on by default. Unless you have a specific reason, idle compaction is saving you money — turning it off is choosing to pay more.

Second, ask "what do you remember" when you return to a long task. Compaction summaries are usually good, but for detail-sensitive work ("what was the third parameter of that function"), having it restate first is more reliable than assuming it remembers.

Third, turn it off manually for critical debugging sessions. If you're chasing a bug that needs a full stack trace and multi-file cross-referencing, disable idleCompaction before you start, or control the timing yourself with /compact — deciding when to "settle the bill" beats letting it decide while you're in a meeting.

The tools are starting to manage the books for you. That's good news. But the owner of the ledger should still be you.

A bigger signal: the age of "cost engineering" for agent tools

Zoom out, and idle compaction looks like a microcosm of where the 2026 coding-agent race is heading. In the first half of the year, everyone competed on bigger context windows and more supported models; in the second half, the battlefield quietly became cost engineering: auto-compaction, on-demand reads, cache alignment, idle-session management — every item answering "how do we make tokens cost only what they should?"

Behind it sits a harsh reality: the better agents get, the more context users dare to pile on; the longer the context, the scarier the bill; the scarier the bill, the less users dare to keep it running. If vendors don't proactively manage the bill for users, growth runs into its own pricing ceiling. So Claude Code does idle compaction, Codex does Daybreak and sandbox cost optimization, Copilot does budget expiry management — everyone is building the same moat: making users feel safe leaving the agent on.

For indie developers, this means the evaluation criteria need an update. We used to ask "how smart is this agent"; now we should also ask "how thrifty is it with my money." A tool that silently cuts your 200K-token bill while you're in a meeting versus one that just piles up context — over months of use, the cost difference can be an order of magnitude. Next time you evaluate a coding agent, consider adding "context cost management" as its own scoring line. It may be the most underrated selection dimension of 2026.

Worth watching: the "right to know" design in compaction notices

One easily missed detail: 2.1.302 deliberately makes the post-compaction notice tell you how to turn it off. That's an interesting UX choice — Anthropic clearly wants you to keep it on to save money, yet puts the off-switch in the most visible place. It suggests they understand that automatically performing a "lossy" operation on a user's behalf demands full informed consent. Compaction is lossy; no summary is the original. The tool may save you money by default, but it can't quietly decide what to discard for you.

Two things to watch next: first, whether Anthropic brings idle compaction to cloud sessions and the API side — if cloud agents start managing costs automatically too, the whole industry's pricing model could shift; second, whether rivals follow with their own "idle cost management" for Codex cloud tasks or Copilot agent sessions. Whoever first makes users feel safe leaving the agent on wins the key retention chip of the next round.

Views 0Comments 0

Comments (0)

ME
0/1000
Loading comments...

Sources

Browse projectsPublish your project

Related articles

Pele logo: a volcano-goddess silhouette with the word Pele on black
News
Pele: A Zero-Dependency Mermaid-to-SVG Renderer Up to 500x Faster, Themed With CSS Variables

Pele, an open-source Mermaid-to-SVG renderer built for Obsidian, hit Hacker News with 460 points: zero dependencies, a 230 kB gzipped bundle, and self-reported render times of 0.05–0.3 ms. Its elegant trick is CSS-variable theming — recolor without re-rendering. All performance figures are self-reported and unverified; this piece explains the trade-offs behind them.

Product NewsOpen-source Projects