Opt-in: compact the conversation at the end of a goal while the session is still cached
Status Open
Maintainer reply None cached
Activity 1 comment · opened Sep 3, 2026
Feature request
An opt-in setting that has Claude Code compact the conversation proactively at the end of a goal or task, while the session's prompt cache is still warm, instead of lazily on the next user turn.
Problem
Compaction currently triggers when the context fills up on a later turn. For long autonomous or unattended sessions, that turn often comes hours after the work finished, when I return to check on it. By then the prompt cache has expired, so the compaction request re-processes the full uncached transcript, and I sit waiting on it before I can interact with the session at all.
Proposed behavior
- A setting (off by default) such as
compactAtGoalEndor similar. - When enabled, and the session reaches a natural end-of-work boundary (task complete, agent stops and hands back to the user) with the context near the compaction threshold, Claude compacts immediately while the transcript is still cached.
- The next user message then lands on an already-compacted, ready session.
Why it matters
- Compacting against a warm cache is cheaper than re-reading the whole transcript cold hours later.
- Removes the wait when resuming an unattended session.
- Opt-in, so users who prefer to see the full transcript before it is summarized are unaffected.
Repro of the current behavior
- Run a long autonomous task that ends near the context limit.
- Leave the session idle for several hours.
- Send the next message. Compaction triggers then, against a cold cache, and the user waits for it.
Also submitted via /feedback, receipt d993c092-daad-4d41-90cd-e88e464bc21e.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗