Compresses verbose responses by removing filler and framing to save 200-400 tokens
Coding
compression-strategy
Try itRecommends context compression strategies for bloated or quota-heavy sessions
What it does
Recommends context compression strategies for bloated or quota-heavy sessions
The skill document
Night Market Skill — ported from claude-night-market/conserve. For the full experience with agents, hooks, and commands, install the Claude Code plugin.
Compression Strategy
Analyze current context usage and recommend optimal compression strategies.
When To Use
- Context feels bloated or sluggish
- Before major task phase transitions (plan complete, starting implementation)
- Token quota burning faster than expected
- After large tool output accumulations
When NOT To Use
- Context-optimization skill already handling the scenario
- Simple queries with minimal context
- Freshly cleared context
Required TodoWrite Items
compression-strategy:analyze-contextcompression-strategy:recommend-strategycompression-strategy:estimate-savings
Step 1 – Analyze Context (analyze-context)
Run /context to check current usage. Then estimate:
- Tool output accumulation: How much context is from tool results vs. conversation?
- Stale content age: How many turns since critical decisions were made?
- Active files: Which files are still relevant vs. historical?
Step 2 – Recommend Strategy (recommend-strategy)
Based on analysis, recommend one of:
Option A: /clear and /catchup
Best when:
- Task phase complete (planning done, implementation starting)
- Context > 60% full
- Most content is stale
Process:
- Save critical state to
.claude/session-state.md - Run
/clear - Run
/catchupto reload active files
Option B: Spawn Continuation Agent
Best when:
- Context > 80% full
- Work in progress, can't stop
- Delegatable tasks remain
Process:
- Run
Skill(conserve:clear-context)to spawn continuation agent - Agent receives fresh context with saved state
Option C: Archive and Summarize
Best when:
- Context 40-60% full
- Some stale content mixed with active
- Not ready for full clear
Process:
- Archive old decisions/errors to
.claude/context-archive/ - Summarize completed work in memory
- Continue with leaner context
Option D: Delegate to Subagent
Best when:
- Parallel work possible
- Independent subtasks exist
- Context pressure moderate
Process:
- Identify delegatable tasks
- Spawn specialized agents via
Tasktool - Main context stays lean
Step 3 – Estimate Savings (estimate-savings)
For the recommended strategy, estimate:
| Strategy | Typical Savings | Risk |
|---|---|---|
| /clear and /catchup | 70-90% | Low if state saved |
| Continuation agent | 80-95% | Low, state preserved |
| Archive and summarize | 20-40% | Very low |
| Delegate to subagent | 30-50% | Low, parallel work |
Context Archive Location
Preserved context is saved to:
.claude/context-archive/pre-compact-YYYYMMDD-HHMMSS-SESSIONID.md
This is automatically created by the pre_compact_preserve hook before
any /compact operation.
Integration Points
- PreCompact hook: Automatically preserves context before compression
- Tool output summarizer: Warns when tool outputs accumulate
- Context warning hook: Three-tier alerts at 40%/50%/80%
Specialized Modules
Load modules/log-debugging-hygiene.md when the bloat source is
pasted log output (debug traces, CI failures, hook logs, JSONL).
That module documents a three-tier filter-first workflow with
benchmarked snippets and an honest framing of when compression
is and is not warranted. On the committed intake_queue.jsonl
fixture, tail -n 100 beats lossless compression by 25
percentage points; the module formalizes that asymmetry.
Example Usage
/compression-strategy
Output:
Context Analysis:
- Current usage: 52%
- Tool output: ~15KB (3 tool results)
- Stale content: ~40% (decisions from 8+ turns ago)
Recommendation: Option C - Archive + Summarize
- Archive old decisions to context-archive
- Keep active files and recent decisions
- Estimated savings: 25-35%
Commands:
1. Read .claude/context-archive/ to see what's preserved
2. Summarize completed work
3. Continue with leaner context
Related skills
Enforces token quota management at session start with conservation and compression checks. Use at the start of every session or before large context loads
Manages context overflow by handing off to a fresh subagent at 80% usage
Generates a compressed project context map to avoid expensive Read/Grep calls. Use at session start or before implementing features in an unfamiliar codebase
Optimizes context window via MECW principles and memory tiering
Tracks per-agent token usage and flags waste in parallel dispatch