Skip to content
Development
Skill

/strategic-compact

Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.

From plugin
claude-forge
87733 skills16 agents35 commands22 hooks
+1

Claude Code

$ npx -y skills add sangrokjung/claude-forge --skill strategic-compact --agent claude-code

SKILL.md

strategic-compact.SKILL.md
name: strategic-compact
description: Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.

Strategic Compact Skill

Suggests manual `/compact` at strategic points in your workflow 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 context, keep implementation plan
  • **After completing a milestone** - Fresh start for next phase
  • **Before major context shifts** - Clear exploration context before different task

How It Works

The `suggest-compact.sh` script runs on PreToolUse (Edit/Write) and:

1. **Tracks tool calls** - Counts tool invocations in session 2. **Threshold detection** - Suggests at configurable threshold (default: 50 calls) 3. **Periodic reminders** - Reminds every 25 calls after threshold

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

1. **Compact after planning** - Once plan is finalized, compact to start fresh 2. **Compact after debugging** - Clear error-resolution context before continuing 3. **Don't compact mid-implementation** - Preserve context for related changes 4. **Read the suggestion** - The hook tells you *when*, you decide *if*

Related

  • [The Longform Guide](https://x.com/affaanmustafa/status/2014040193557471352) - Token optimization section
  • Memory persistence hooks - For state that survives compaction
Read more
@sangrokjung
Ships withclaude-forge

oh-my-zsh for Claude Code — 16 agents, 35 commands, 32 skills, 21 safety hooks in one install. v4.0 adds an adversarial review loop: a second agent that never sees the first one's reasoning. MIT.

87733 skills16 agents4 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
877
Star history of sangrokjung/claude-forge on GitHub, a chart by star-history.com

Other skills on claude-forge.

blind-spot-pass

blind-spot-pass

Use *before* starting work in a domain you don't know well, to surface the "unknown unknowns" — the things you don't even know to…

build-system

build-system

Use when detecting and running project build systems automatically. Supports npm/yarn/pnpm/pip/poetry/gradle/maven/cargo/go/make.…

cc-dev-agent

cc-dev-agent

Use when starting Claude Code projects, writing CLAUDE.md/spec.md, dispatching subagents, or requesting Agent Teams parallel…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about strategic-compact.

Which coding agents can use strategic-compact?
strategic-compact installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.