Claude Code idle compaction: what changed and how to disable it
Short answer: Set "idleCompaction": false in settings.json to turn it off, or raise the 200K-token minimum with CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS. Both need Claude Code v2.1.290 or later.
What changed
- Changelog: “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.” Claude Code CHANGELOG (2.1.299) ↗
- Changelog: “Added
CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENSto change idle compaction's 200K-token minimum;"idleCompaction": falsein settings.json turns it off. Both need v2.1.290 or later.” Claude Code CHANGELOG (2.1.299) ↗
Who is affected
Terminal users with long sessions (200K+ tokens) who step away for about an hour and want the full, uncompacted history when they come back.
Exact fix
~/.claude/settings.json (or a project .claude/settings.json)
{
"idleCompaction": false
}Or keep it on but only for bigger conversations
export CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS=400000Other agents
Codex CLI, Cursor and Gemini CLI: we did not find an equivalent idle-compaction setting in their official docs. Unknown. See the compatibility table.
FAQ
How do I disable Claude Code idle compaction?
When does idle compaction trigger?
Every claim above links to an official source (vendor docs, changelog or source code), except where a user report is labelled as such. Last verified 2026-10-14. All config changes · RSS