/compact -n <lines>: partial compaction retaining recent conversation
Resolved 💬 3 comments Opened May 13, 2026 by kimura-s Closed Jun 14, 2026
Problem
When context approaches limits mid-session, the only option is full compaction which summarizes ALL prior messages. This loses:
- Recent system state (tool outputs, file changes, running processes)
- Active debugging context that was just established
- Multi-step workflow progress that hasn't been committed yet
Users often notice context pressure while actively working, but can't compact without losing the last few exchanges that contain critical state.
Proposed Solution
/compact -n 5000 — compact messages BEFORE the last N lines, retain the last N lines verbatim.
Behavior:
- Lines 1 to (total - N): summarized into compaction summary
- Lines (total - N + 1) to end: kept as-is
- Result: summary + recent conversation, within context budget
Use Cases
- Long debugging session: keep recent errors/fixes, compact old exploration
- Multi-agent orchestration: keep recent agent results, compact earlier rounds
- Extended pair programming: keep current task context, compact yesterday's work
Prior Art
The existing /compact already produces a summary and truncates. This extends it with a retention window, similar to how log rotation keeps recent entries while archiving old ones.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗