Skip to content
affaan-m avatar

Strategic Compact

Strategic manual compaction at task phase boundaries, guided by context size and tool-call pressure.

CCM score
68 of 100
skills.sh installs
14K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers when to run /compact across research, planning, implementation, testing, and debugging phases, with a decision table
  • Includes suggest-compact.js, a PreToolUse hook on Edit and Write that combines context-token size with tool-call count
  • Enforces reminders at a window-scaled threshold, 160k on a 200k window or 250k on a 1M window, repeating every 60k tokens
  • Designed for long sessions that approach context limits, where mid-task auto-compaction would lose important state

Install

$ npx -y skills add affaan-m/ecc --skill strategic-compact -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Strategic Compact Skill

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

When to Activate

  • Running long sessions that approach context limits (200K+ tokens)
  • Working on multi-phase tasks (research → plan → implement → test)
  • Switching between unrelated tasks within the same session
  • After completing a major milestone and starting new work
  • When responses slow down or become less coherent (context pressure)

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.js script runs on PreToolUse (Edit/Write) and combines two signals:

Details

Repository
github.com/affaan-m/ecc
Categories
Memory & Context, Agent Workflow & Planning
First seen
Jul 14, 2026

Questions

What does the strategic-compact skill do?

The strategic-compact skill suggests manual /compact at logical task boundaries, such as after planning or debugging, instead of letting auto-compaction trigger mid-task. It combines a context-size signal with a tool-call count to decide when to suggest compacting.

How do I install the strategic-compact skill?

Run npx -y skills add affaan-m/ecc --skill strategic-compact -y in your project. Once installed, the agent gets a hook that reads context size and suggests compaction at the right phase transitions.

Where does strategic-compact rank in its category?

It is in the Memory & Context category and ranks in the top 25 there. Other skills in the category include handoff, caveman-compress and caveman-stats, while strategic-compact focuses on timing manual compaction around task phases.

Does strategic-compact need any setup or accounts?

If installed as a plugin, no setup is needed because the hook is already registered. For manual installs, you must add the PreToolUse hook for Edit and Write to your settings.json, and you should write the plan to a file before compacting.

More from affaan-m/ecc

All 257

Similar to Strategic Compact

More Memory & Context