Skip to content

Guide · Agent skill

How to use the Strategic Compact agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The strategic-compact skill teaches an AI coding agent to suggest running a manual /compact at logical break points in a task, such as after research and before implementation, instead of letting automatic compaction cut in mid-task. It is written for developers using Claude Code or another SKILL.md-compatible agent. After this guide you will know how to install the skill, how to ask for it in plain language, and what it needs to run.

Strategic Compactaffaan-m/ECC · MIT

Quick start

  1. 1Download and unzip. Download the strategic-compact ZIP from this page and unzip it to get the SKILL.md file.
  2. 2Place the skill folder. Move the strategic-compact folder into ~/.claude/skills/ for all projects, or into a project's .claude/skills/ folder for one project.
  3. 3Or upload in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the skill.
  4. 4Set up the hook if needed. If you installed the ECC plugin, skip this step. If you installed manually with ./install.sh, add the suggest-compact.js hook block to ~/.claude/settings.json.
  5. 5Make sure Node.js is available. The hook runs suggest-compact.js with Node.js, so install Node.js if the hook is set up.
  6. 6Work through a multi-phase task. Research, then write the plan to a file, and let the agent suggest when to compact before implementation.
  7. 7Compact with a focus message. Run /compact with a short summary of the next step so the agent starts the new phase with clear direction.

What does the strategic-compact skill make the agent do?

Long coding sessions fill the model's context window. Automatic compaction can trigger at arbitrary points, often in the middle of a multi-step change, and lose important details. This skill changes that by having the agent suggest a manual /compact at natural boundaries, such as moving from research to planning, after finishing a milestone, or after abandoning a failed approach.

The skill also tells the agent to write the plan to a file before compacting, because files on disk persist through compaction while intermediate reasoning does not.

  • Suggests compaction after exploration and before execution
  • Suggests compaction after a milestone or after debugging
  • Advises against compacting mid-implementation, where variable names, file paths and partial state are easy to lose
  • Reminds you to save important context to files or memory first

Install the strategic-compact skill

Download the ZIP from this page and unzip it. To make the skill available to all your projects, place the strategic-compact folder in ~/.claude/skills/. To limit it to one project, place it in that project's .claude/skills/ folder.

In the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.

  • Personal install: ~/.claude/skills/
  • Project install: .claude/skills/ inside your project
  • Claude apps: Settings → Capabilities → Skills

The skill includes a hook script, suggest-compact.js, that counts tool calls and prompts a suggestion once a threshold is reached. How you set it up depends on how you installed the source package. If it was installed as an ECC plugin, no setup is needed, because the plugin already registers the hook. Do not copy the settings block below into ~/.claude/settings.json in that case, since a duplicate registration causes the hook to run twice.

If the hook was installed manually with ./install.sh, add the following to ~/.claude/settings.json.

{ "hooks": { "PreToolUse": [ { "matcher": "Edit", "hooks": [{ "type": "command", "command": "node ~/.claude/scripts/hooks/suggest-compact.js" }] }, { "matcher": "Write", "hooks": [{ "type": "command", "command": "node ~/.claude/scripts/hooks/suggest-compact.js" }] } ] } }

How do I trigger the skill with natural requests?

The skill activates during long, multi-phase work. You do not need a special command. Describe the situation in plain terms and the agent will apply the compaction guidance. Useful triggers include telling the agent you are moving from research into planning, that a milestone is done, or that you are switching to an unrelated task.

Before you compact, ask the agent to write the plan to a file. Then, when you run /compact, you can add a focus message, for example: /compact Focus on implementing auth middleware next.

  • "We've finished researching. Write the plan to PLAN.md, then suggest whether we should compact before coding."
  • "This debugging took a long detour. Is it a good point to compact before starting the next feature?"
  • "Before we compact, save the key decisions to a file so nothing important is lost."

What survives compaction and what does not?

Knowing what persists helps you compact with confidence. CLAUDE.md instructions, files on disk, memory files in ~/.claude/memory/, and git state (commits and branches) persist. Intermediate reasoning, file contents you previously read, multi-step conversation context, and nuanced preferences you stated verbally do not reliably persist.

The task list is not dependable. Claude Code 2.1.233 removed the todo and task tools by default on some newer models, and bringing them back depends on a per-machine environment setting that does not travel with this skill. Treat the task list as a convenience and keep your durable record in files.

  • Persists: CLAUDE.md, files on disk, ~/.claude/memory/, git state
  • Lost: intermediate reasoning, previously read file contents, verbal preferences
  • Unreliable: the task list, which may not exist on your setup

Tips for using the skill well

The hook tells you when, but you decide whether. Treat each suggestion as a prompt to check the state of the work, not an instruction to compact right away. For short tasks, the suggestions may be noise, so you can ignore them.

The skill also covers context optimization. Keep CLAUDE.md lean, since it is always loaded, and watch for the same rules appearing in both ~/.claude/rules/ and a project's .claude/rules/ folder. The COMPACT_THRESHOLD environment variable sets how many tool calls pass before the first suggestion; the default is 50.

  • Compact after planning once the plan is written to a file
  • Compact after debugging to clear error-resolution context
  • Do not compact in the middle of an implementation
  • Set COMPACT_THRESHOLD to change the first-suggestion point (default 50)

What people use it for

  • Running a long Claude Code session that moves from research to planning to coding and testing
  • Compacting after a debugging detour so error traces do not crowd out the next feature
  • Keeping a team consistent by writing plans to files before clearing context
  • Noticing and acting on slowing or less coherent responses in a very long conversation

Frequently asked questions

How do I install the strategic-compact skill?

Download the ZIP from this page and unzip it. Put the strategic-compact folder in ~/.claude/skills/ for all projects or in a project's .claude/skills/ folder for one project. In the Claude apps, you can upload it under Settings → Capabilities → Skills.

What does the strategic-compact skill require?

It needs Claude Code or another SKILL.md-compatible agent. The hook script suggest-compact.js needs Node.js, and the hook is set up either through the ECC plugin or manually with ./install.sh.

Is strategic-compact free to use?

The source is licensed under the MIT licence. Check the licence file in the source package for the full terms.

Does the skill run scripts or use the network?

It runs one script, the suggest-compact.js hook, which counts tool calls and prompts suggestions. The source states that the skill does not use the network. Review the script before installing if you want to confirm this yourself.

Will my task list survive compaction?

Not reliably. Newer Claude Code versions removed the todo and task tools by default, so the list may not exist. Write the plan to a file before compacting, since files persist.

Is this skill useful for short tasks or chat-only use?

Usually not. It assumes a coding agent with files, hooks and /compact, and for short tasks that never approach context limits, the hook's suggestions would mostly be noise.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

This skill is a good fit for developers who run long Claude Code sessions across research, planning, coding and testing, and who want a consistent habit of saving plans to files before clearing context. It is not worth installing for short tasks, chat-only use, or non-developers. If you need guaranteed preservation of task lists or verbal preferences, this skill does not provide that, so rely on written files instead.

Download the skill