Schedule compaction instructions for next compaction only (`/compact-next`)
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)
Problem Statement
The /compact <instructions> slash command executes immediately, which forces an interruption of the current task context. When context is running low mid-task, there's no way to prepare task-specific compaction instructions in advance. You either interrupt the workflow now or risk running out of context without guidance on what to preserve or discard.
Proposed Solution
Introduce a /compact-next <instructions> command (or similar) that schedules compaction instructions to be applied only to the next automatic compaction. Once that compaction completes, the scheduled instructions are consumed and discarded.
This would allow us to queue up context-shaping instructions while Claude continues working on the current task uninterrupted. If context runs out naturally, the scheduled instructions guide what gets preserved or dropped.
Alternative Solutions
A CLAUDE.md section for compaction instructions. The problem with that is that it applies to every compaction, not only the next one. There's no mechanism to provide one-time, situational instructions that target only the next compaction, without executing it immediately. The two approaches complement each other: CLAUDE.md for persistent defaults, /compact-next for ad-hoc overrides.
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
During a task, the model gets side-tracked into a lengthy tangential discussion, debugging a red herring, exploring an abandoned approach, or a back-and-forth clarification that's no longer relevant. This exchange consumes significant context but holds no value going forward.
With /compact-next "Discard the entire side discussion about X. Focus retention on the current problem domain", we can tag that noise for removal without breaking flow. When compaction eventually triggers, the irrelevant dialogue is dropped and context is reclaimed for what matters.
I had good results doing this manually when at <5% conext left, but I'd prefer to squeeze the last % out in the hope that the current task will be finished before compacting.
Additional Context
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗