[Bug] Auto-compaction triggers early at 24-45% of 1M context window with no user config

Status Open
Reported on v2.1.296
Maintainer reply None cached
Activity 0 comments · opened Oct 12, 2026

Bug Description
For some reason Claude is doing a compaction or clear on its own. I didn't realize at first and though it was reaching a limit - but it wasn't. It was strange and when asked about it and it wrote the following:
You're right, and it was more than twice. The session transcripts show three automatic compactions in the last day, and I triggered none of them:

┌─────────────────┬─────────────┬────────────────────────────┐
│ session │ when (UTC) │ context used when it fired │
├─────────────────┼─────────────┼────────────────────────────┤
│ earlier session │ 10-11 09:49 │ 447k tokens │
├─────────────────┼─────────────┼────────────────────────────┤
│ earlier session │ 10-11 21:38 │ 311k tokens │
├─────────────────┼─────────────┼────────────────────────────┤
│ this session │ 10-12 03:52 │ 238k tokens │
└─────────────────┴─────────────┴────────────────────────────┘

Every one is marked trigger: auto. The window is 1M tokens, and the three fired at 45%, 31% and 24% of it. So they aren't happening near the limit, and each one fired earlier than the last.

I checked for something on this machine that would cause it, and found nothing. There's no compaction setting in your ~/.claude/settings.json or the project settings, and no environment variable overriding it. ~/.claude.json does have some compaction-related feature flags, but those are set by Anthropic, not by you. As far as I can see, Claude Code itself is deciding to compact early. I can't tell from here whether that's intended or a bug.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.296
  • Feedback ID: 608f8003-ab16-4d3d-a695-a2c9c4bb36bb

View original on GitHub ↗