← Back to list
⚡

Strategic Compact

Manual compaction at logical task boundaries instead of arbitrary auto-compaction mid-phase.
⚡ Productivity skills By myths-labs Version v3.7.1 Added 2026-09-26 Updated 2026-10-23 Source ↗ Part of Muse & Memory →
7.9Overall rating
0Views
10Downloads
35Stars

Installation

🤖 Install via AI

Copy the prompt below and send it to your AI assistant (e.g. Claude Code) — it will follow the instructions and install automatically.

Install the "Strategic Compact" skill by following the instructions at https://skill123.me/install/strategic-compact.
⌨️ Command line install

Run in your terminal — downloads and installs to ~/.claude/skills/.

curl -fsSL https://skill123.me/install/strategic-compact.sh | bash
📦 Download ZIP

Download the zip and extract it into your skills directory (e.g. ~/.claude/skills/), then restart your session.

⬇ Download v3.7.1 · 2 KB
📊 Static rating
7.9/10
Trigger
7.5
Structure
8.0
Workflow
7.5
Content
7.5
Engineering
6.5
Security
9.5

Six-dimension rubric with reviewer rationale.

View scorecard ↓
🛡 Dynamic test
—

Not live-tested yet — this skill is rated on static analysis only.

About this skill

Solves a real Claude Code pain: auto-compaction firing mid-task. Triggers /compact at logical boundaries and injects a summary after, so you keep the thread.

Strategic Compact Skill

Suggests manual /compact at strategic points rather than relying on arbitrary auto-compaction.

Documentation

Solves a real Claude Code pain: auto-compaction firing mid-task. Triggers /compact at logical boundaries and injects a summary after, so you keep the thread.

Strategic Compact Skill

Suggests manual /compact at strategic points rather than relying on arbitrary auto-compaction.

Why Strategic Compaction?

Auto-compaction triggers at arbitrary points:

  • Often mid-task, losing important context
  • No awareness of logical task boundaries
  • Can interrupt complex multi-step operations

Strategic compaction at logical boundaries:

  • **After exploration, before execution** — Compact research, keep plan
  • **After completing a milestone** — Fresh start for next phase
  • **Before major context shifts** — Clear old context before different task

Focus-Aware Compaction (inspired by OpenClaw)

Blind compaction = blind discards. Focus-directed compaction = preserving key information.

**Usage**: Specify what to preserve when manually compacting.


Scenario: Completed 3 hours of debugging, now starting a new feature
✅ /compact preserve root cause analysis and fix approach, discard trial-and-error debugging
❌ /compact (blind compaction may discard root cause analysis)

**Common focus templates**:

| Scenario | Focus Directive |

|----------|----------------|

| After debugging | Preserve root cause and fix approach, discard trial-and-error |

| After planning | Preserve final plan and key decisions, discard alternative discussions |

| After code review | Preserve items to change, discard confirmed-OK sections |

| After strategy discussion | Preserve strategic decisions and metrics, discard brainstorming process |

| After multi-file edits | Preserve which files changed and why, discard file content details |

When to Trigger Compaction

| Signal | Action |

|--------|--------|

| Completed a full milestone | ✅ Good time to compact |

| Switching from exploration to execution | ✅ Good time to compact |

| Debugging complete, starting new feature | ✅ Good time to compact |

| In the middle of multi-step implementation | ❌ Do NOT compact |

| Still analyzing a problem | ❌ Do NOT compact |

| /ctx shows 60-70% consumed | 🟡 Consider compacting |

| /ctx observes ≥80% pressure | Save the current Lane, compact if supported, verify and continue |

Hook Setup

Add to your ~/.claude/settings.json:


{
  "hooks": {
    "PreToolUse": [{
      "matcher": "tool == \"Edit\" || tool == \"Write\"",
      "hooks": [{
        "type": "command",
        "command": "~/.claude/skills/strategic-compact/suggest-compact.sh"
      }]
    }]
  }
}

Configuration

Environment variables:

  • COMPACT_THRESHOLD - Tool calls before first suggestion (default: 50)

Best Practices

View full documentation

1. **Compact with focus** — Always specify what to preserve, never compact blindly

2. **Write memory before compacting** — Save key information to memory/YYYY-MM-DD.md first

3. **Never compact mid-task** — Maintain complete context during multi-step implementations

4. **Pair with /ctx** — Use actual observations; ≥80% means save and reassess after compaction, not forced exit. Unknown occupancy remains unknown.

Pre-Compaction Protocol (MUSE — derived from LCM compact:before)

**MUST** execute in order before compaction:

1. **Persist**: Write current task progress to memory/YYYY-MM-DD.md

2. **Preserve recent instructions**: Save recent decisions, corrections and constraints; do not claim the client supports a protected/non-compactable zone unless its actual interface does.

3. **Extract key decisions**: Scan content about to be compacted, extract key decisions/data to memory

4. **Notify user**: Inform about upcoming compaction, list what will be preserved

> **Principle: Persist first, then compact. Never discard information without a backup.**

Post-Compaction Injection (MUSE — derived from OpenClaw postCompactionSections)

**MUST** re-internalize the following after compaction:

1. First 4 lines of CLAUDE.md (7 iron laws + priority chain)

2. Currently [/] in-progress tasks from task.md

3. Today's memory/ snapshot (just written)

4. Any focus-aware specified preservation items

> Compaction may omit information. Reconcile the selected role/Lane checkpoint and required evidence after it; do not reload all history or claim memory is lossless.

Score breakdown

Trigger
7.5
Trigger 7.5/10 — The description names the what and broad when but omits when-not boundaries, while the body provides useful trigger tables and a concrete MUSE pre/post-compaction protocol with notify-before-compact. Structure is clear but somewhat redundant across Best Practices and Pre-Compaction Protocol; engineering is weakened by the hook script path suggest-compact.sh being referenced without evidence it exists.
Structure
8.0
Structure 8/10
Workflow
7.5
Workflow 7.5/10
Content
7.5
Content 7.5/10
Engineering
6.5
Engineering 6.5/10
Security
9.5
Security 9.5/10