Auto-compact fails at context limit and forces a new session, while manual /compact succeeds

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 4, 2026

Summary

In a very large, long-lived session, auto-compact triggered near the context limit, failed during summarization, and the CLI told me to start a new session. Running /compact manually in the same session worked fine and immediately dropped context usage.

Steps to reproduce

  1. Run a long-lived session with many large file reads/writes (session transcript grew to ~171 MB / ~20,900 events)
  2. Let context usage climb to ~97-100%
  3. Auto-compact triggers → summarization fails → prompted to start a new session
  4. In the same session, run /compact manually → succeeds, usage drops immediately

Expected behavior

Auto-compact should trigger with enough headroom to actually produce the summary, and should fall back (retry / partial summarization) instead of dead-ending the session.

Actual behavior

Auto-compact fails at the limit. Manual /compact at the same point works, which suggests summarization was still possible — the automatic trigger just fired too late, after the headroom was already consumed.

Additional observation

Context usage stayed pinned at ~97% across turns and would not come down. A scratch directory containing ~90 files was being re-injected as file-change notifications every turn, steadily consuming context. Removing those files stopped the re-injection.

Deduplicating or capping repeated file-content injection would help sessions like this stay usable.

Environment

  • Claude Code, desktop app
  • Model: Opus 5
  • OS: Windows 11

View original on GitHub ↗