[FEATURE] Prompt user for approval before auto-compaction proceeds
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Related Issues
- #50015 — Auto-compaction fires without pre-compaction warning (regression)
- #63003 — Add context window usage indicator and warning before auto-compaction
Those issues address notification. This request is specifically about user control — the ability to approve or cancel compaction before it occurs.
Problem Statement
When auto-compaction fires, it is irreversible. The user has no opportunity to decide whether compaction is appropriate at that moment. This is particularly disruptive in long multi-step sessions where compaction has been observed to:
- Cause the model to misinterpret historical state as pending work (see #50015)
- Silently discard context that is not faithfully reconstructed in the summary (#57636, #62925)
- Delete the JSONL session log before the summary is verified (#63187)
A warning alone (as requested in #63003) does not solve the problem — a user who sees "compaction imminent" still cannot prevent it from happening.
Proposed Solution
Before auto-compaction proceeds, pause and present the user with an explicit approve/deny prompt:
Context window near limit. Auto-compaction is about to run.
[C]ompact now | [W]ait / cancel
Expected behavior:
- If the user approves, compaction runs immediately as it does today
- If the user cancels, compaction is deferred and the user can choose to
/compactmanually, save notes, or end the session - The prompt should respect a configurable timeout with a safe default (e.g., auto-proceed after 30 seconds if no input, to preserve headless/non-interactive behavior)
Configuration option:
A settings.json flag such as "autoCompact": "prompt" (alongside existing true/false) would allow users to opt into this behavior without affecting the default.
Workaround (current)
A PreCompact hook with matcher: "auto" can block automatic compaction entirely (exit 2), forcing the user to run /compact manually. This is functional but blunt — it disables auto-compaction completely rather than giving the user a per-session decision.
Why not just comment on #63003?
#63003 requests a visual indicator and warning. This request is for interactive control — the ability to stop compaction, not just observe it is coming. The two features are complementary but distinct.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗