Episode 15: /compact vs /clear Commands

⏱ Est. reading time: 4 min Updated on 5/7/2026

Key Takeaway: Context almost full? Compact preserves a summary, clear starts from scratch β€” choosing wrong is costly.


15.1 The Difference Between the Two Commands

flowchart TD
    A["Context almost full"] --> B{Which command?}
    B -->|Want to keep key info| C["/compact
Smart compression
Keeps summary"] B -->|Want complete reset| D["/clear
Clear everything
Start from zero"] C --> E["Context drops to ~40-50%
Key info preserved
Cache may partially invalidate"] D --> F["Context returns to ~5%
All history lost
Cache fully invalidated"]
/compact /clear
Action Smart-compresses conversation history Completely clears conversation
Method LLM generates summary to replace early turns Discards all history
Context effect From ~90% to ~40-50% From ~90% to ~5%
Cache effect May partially invalidate Fully invalidated
Memory Unaffected Unaffected

15.2 /compact Details

sequenceDiagram
    participant U as User
    participant CC as Claude Code
    participant API as API

    U->>CC: /compact
    CC->>API: Summarize current conversation
    API-->>CC: Compressed summary
    CC->>CC: Replace early turns with summary
    Note over CC: Context drops from 90% to 40-50%

Before and after: 60K tokens of full conversation β†’ compressed to ~500 token summary.


15.3 /clear Details

Before /clear: Context β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 90% (180K/200K)
After /clear:  Context β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 5% (10K/200K)
  ↑ Only fixed section remains (System Prompt + CLAUDE.md + Hooks + Memory)

15.4 Auto Compression (95% Trigger)

Claude Code auto-triggers compression at 95% (hardcoded, not configurable).

Recommendation: Proactively /compact or /clear at 85% (red) β€” don't wait for the 95% forced trigger.


15.5 When to Use Which

Scenario Recommended Reason
Mid-session, context almost full /compact Preserves key context
Debugging 3-4 rounds with no progress /clear Too many accumulated tool_results
Direction changed, new task /clear Previous context is irrelevant
Want to save tokens /compact More efficient than full reset

Next Episode: Episode 16 enters Q&A territory β€” answering foundational questions about Sessions, context, and tokens.