Skip to content

Strategic Compact

Suggests when to manually compact a long AI coding session so key context is kept

Repository
affaan-m/ECC
Stars
295,127
Licence
MIT
Files
1 file

What it does

This skill teaches an AI coding agent to plan when to shrink its own working memory. Long sessions fill up the model's context window, and automatic compaction can cut off mid-task and lose details. With this skill, the agent suggests running a manual compact at natural breaks, such as after research and before implementation, and reminds you to save the plan to a file first. It also includes a small hook script that counts tool calls and prompts a suggestion after a threshold.

Great for

  • Developers running long Claude Code sessions that span research, planning, coding and testing
  • People who notice responses slowing or losing coherence in very long conversations
  • Teams wanting a consistent habit of writing plans to files before clearing context

Skip it if

  • Short tasks that never approach context limits, where the hook's suggestions would just be noise
  • Non-developers or chat-only use, since the skill assumes a coding agent with files, hooks and /compact
  • Relying on it to preserve the task list or nuanced verbal preferences; the skill itself warns these may not survive compaction

Try asking

  • “Research this codebase's auth flow, then make a plan. Suggest when I should compact before implementing.”
  • “We've finished the debugging session; should I compact before starting the next feature?”
  • “Set up the strategic compact hook so I get suggestions after 50 tool calls.”
Step-by-step guide: how to use Strategic CompactInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    strategic-compact.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip strategic-compact.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip strategic-compact.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Write the plan to a file before running /compact, because the task list may not exist on newer Claude Code versions.
  • Use /compact with a short focus message so the agent knows what to pick up next.
  • On plugin installs the hook is already registered; don't add it to settings.json too, or it will run twice.

What's inside

  • SKILL.md

Redistributed unmodified from affaan-m/ECC under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.