If you step away from a long Claude Code session for lunch, the conversation you come back to may be a shorter version of the one you left. Claude Code 2.1.299 adds idle compaction in the terminal. A conversation of 200,000 tokens or more that sits idle for about 54 minutes is compacted automatically.

Compaction replaces a long conversation with a condensed version so the agent can keep working within its context limit. A token is a small chunk of text, roughly a short word or part of one.

Why 54 minutes

The changelog ties the timing to the prompt cache, which expires after one hour. The cache lets Claude Code reuse a conversation it has already processed instead of reading it again. Once it expires, your next message would make the model reprocess the whole thing. Compacting just before expiry means that next message starts from the shorter version.

What you give up

The trade is detail. A compacted conversation keeps the gist, not every line. If you were mid-task and rely on exact error messages or earlier instructions, tell the agent again after a long break, or point it to a file in your project that holds the plan.

Changing the behavior

Two settings control it, and both need Claude Code v2.1.290 or later:

  • "idleCompaction": false in settings.json turns it off.
  • The CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS environment variable changes the 200,000-token minimum. An environment variable is a setting you define in your shell before starting a program.

The same release adds CLAUDE_CODE_DISABLE_FILE_MENTIONS. With it set, an @ file mention gives Claude the file’s path to read with its own tools, rather than pasting the file’s contents into the prompt.


End of article