AI News Daily한국어
← AI tool tips
Claude Code✓ Confirmed in official docsAdded Oct 27

How to turn off Claude Code compaction entirely, /compact included, with an environment variable

Claude Code summarizes the earlier part of a conversation when it nears the context limit. Two environment variables turn this compaction off, and they cover different ground.

  • DISABLE_AUTO_COMPACT=1 turns off automatic compaction and idle compaction only. You can still run /compact by hand.
  • DISABLE_COMPACT=1 turns off both automatic compaction and /compact.

To turn it off for one session, launch like this.

DISABLE_COMPACT=1 claude

To keep it off, add it to the env block of settings.json.

{
  "env": {
    "DISABLE_COMPACT": "1"
  }
}

Since v2.1.311, DISABLE_COMPACT in a settings file can only turn compaction off, not back on. The same version fixed two bugs: agent team teammates compacting their history while the variable was set, and the rewind menu offering 'Summarize from here' and 'Summarize up to here'.

Get notified when a new tip lands

Tip alerts only go out in the app. Install it and turn notifications on.

Get the app

All tips →