Feature: Selective context compaction — allow discarding context before a checkpoint
Problem
When running a context-heavy task (e.g., a large PR review) mid-session after a long conversation, the compactor treats all prior context equally. It may summarize away the new, important context (like a PR diff being analyzed) just as readily as the older, irrelevant discussion that preceded it.
The only workaround today is to start a fresh session, which breaks workflow continuity.
Proposed Solution
Allow users (or tools) to set a context checkpoint — a marker that tells the compactor: "everything before this point can be aggressively dropped or heavily summarized; prioritize retaining everything after it."
Possible interfaces:
- Slash command:
/checkpoint— marks the current point in conversation. When compaction triggers, context before the checkpoint is discarded first. - Tool API: A mechanism for tools to signal "this is a fresh unit of work — prior context is low priority" when they start.
- Auto-checkpoint on skill invocation: Automatically treat skill boundaries as soft checkpoints.
Use Case
- User has a long session — debugging, exploring code, chatting.
- User invokes a context-heavy task that needs significant window for diffs, file reads, and analysis.
- Today: compaction fires and may lose the task context. User has to start a new session.
- With this feature: the invocation acts as a checkpoint, and the compactor preferentially drops pre-checkpoint conversation.
Additional Context
This would benefit any workflow where users switch tasks mid-session. The ability to say "I’m done with that topic, prioritize the new one" would make long sessions much more usable.
Related but distinct from existing compaction issues (#50888, #51207) which focus on when compaction fires — this is about what gets compacted.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗