add-compact

Compact long-running agent conversations via /compact while preserving session continuity.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/spyqs/nanoclaw-email-imap --skill add-compact-spyqs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-compact
Source: https://github.com/spyqs/nanoclaw-email-imap/tree/main/.claude/skills/add-compact
Command: npx skills add https://github.com/spyqs/nanoclaw-email-imap --skill add-compact-spyqs

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about add-compact

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compact chat history to prevent context rot in long-running LLM agent sessions?

To prevent context rot in long-running LLM agent sessions, use the /compact command to trigger Claude Agent SDK built-in compaction. This summarizes conversation history while preserving session continuity by forwarding the SDK-issued new session ID to the orchestrator.

Why does my LLM agent lose coherence over time during long conversations?

LLM agents lose coherence during long conversations because the model context becomes cluttered, causing context rot. Manual session compaction clears this clutter by summarizing previous history while keeping the ongoing logical session intact.

How do I archive transcripts before compacting an agent session?

To archive transcripts before compacting an agent session, trigger the /compact command. The system automatically saves conversation transcripts before the Claude Agent SDK compacts the context, ensuring you avoid losing auditability.

Can untrusted users trigger context compaction in an operational chat session?

Untrusted users cannot trigger context compaction in operational chat sessions. Strict access controls enforce that only main trusted group members or admin and device-owner senders can execute the /compact command to reduce destructive memory impact.

Does session compaction use synthetic reset prompts to clear context?

Session compaction does not use synthetic reset prompts to clear context. It triggers the Claude Agent SDK built-in compaction mechanism directly, summarizing the conversation history while forwarding a new session ID to preserve continuity.

When should I manually compact chat history in Claude Agent SDK workflows?

You should manually compact chat history in Claude Agent SDK workflows when long-running conversations lose coherence from context clutter. Execute /compact from the main trusted group to summarize history while maintaining the ongoing logical session.