What problem does it solve?
Long-running conversations lose coherence over time because the model context becomes cluttered, so the agent needs a reliable way to compact history without losing the ongoing logical session.
Core Features & Use Cases
- Manual session compaction via /compact: Adds a
/compact command that triggers the Claude Agent SDK’s built-in compaction (no synthetic reset prompts).
- Session continuity with new session ID forwarding: Preserves the same logical session while forwarding the SDK-issued new session ID to the orchestrator as
newSessionId.
- Security-guarded access: Allows compaction only from the main (trusted) group or from admin/device-owner senders, denying untrusted users to reduce the risk of destructive memory impact.
- Transcript archived before compaction: Ensures conversation transcripts are saved before the SDK compacts to avoid losing auditability.
Quick Start
Ask the assistant to perform compaction by sending /compact from the main trusted group to keep the session running with summarized context.