Auto-compaction fires without pre-compaction warning (regression from earlier versions)
Earlier versions of Claude Code displayed a warning when context usage entered the final ~10% before auto-compaction. This gave users the opportunity to /compact on their own terms or save critical context before the lossy compression occurred.
Current behavior (observed on v2.1.111 and v2.1.112): auto-compaction fires silently with no advance warning. The session continues from a compressed summary, but the model can misinterpret compressed context — treating historical state as pending actions, losing temporal orientation, or conflating completed work with work still to do.
Concrete example from today:
A long-running session auto-compacted. The continuation summary included a reference to a previously-invoked /coffee overnight skill. The model interpreted this as a pending action rather than historical context, and re-executed the skill with wrong parameters (scheduling an overnight warmer at 11:34 AM local time). The user had to manually intervene.
This isn't a model quality issue — it's an information loss issue. The pre-compaction warning existed specifically to let users manage this transition. Its removal is a regression.
Proposed behavior
- Restore the pre-compaction warning when context usage crosses ~90%, giving users the option to compact at a natural breakpoint.
- Pre-compaction persistence hook: Before auto-compaction executes, notify the context agent so it can persist critical state — update memory files, flush pending task lists, write session notes — before the lossy compression discards the full context. The compaction summary is inherently lossy; anything the model needs to correctly resume should be written to durable storage before the summary is generated.
This turns auto-compaction from a disruptive context loss event into a graceful transition.
Environment
- Claude Code v2.1.112
- Opus 4.6 (1M context)
- Max 5x plan
- Linux (Ubuntu)
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗