
Strategic Compact
Nudges you to run /compact at good task breaks instead of letting auto-compaction cut in mid-task
- Repository
- affaan-m/ECC
- Stars
- 295,127
- Licence
- MIT
- Files
- 2 files
What it does
Long AI coding sessions eventually fill the assistant's memory (its context window), and the tool then summarizes or drops old content automatically, often in the middle of a task. This skill adds a small hook script that watches the session and suggests a manual /compact at natural breakpoints, such as after planning or debugging, while advising against compacting mid-implementation. It also tells the assistant to save the plan to a file first so nothing important is lost.
Great for
- Developers running long Claude Code sessions that span research, planning, implementation and testing
- People who notice responses getting slower or less coherent in very long sessions
- Users switching between unrelated tasks in one session who want a clean context for each
Skip it if
- Short sessions that never approach context limits, where the hook adds noise and no benefit
- Users on tools without hook support, since the automatic suggestions depend on Claude Code's PreToolUse hooks; the guidance alone is only a manual checklist
- Anyone expecting compaction to preserve in-progress state automatically: the skill notes that todo lists may be missing and intermediate reasoning is lost, so unsaved work can disappear
Try asking
- “Set up the strategic compact hook so I get a suggestion before editing files in a long session”
- “Before I compact, help me write the current plan to a file so it survives”
- “Which phase transitions in this task are good places to run /compact?”
- “Tune the context threshold for my 400k-window model using ECC_CONTEXT_WINDOW_TOKENS”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 2 original files, the MIT licence and an attribution note.
strategic-compact.zip - 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
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 or key decisions to a file before compacting, because the todo tools may not exist on newer Claude Code versions and cannot be relied on to persist
- Set ECC_CONTEXT_WINDOW_TOKENS for large-window models whose model id lacks a [1m] marker, so the suggestion fires at the right point
- Treat the hook as advice only: it suggests timing, and you decide whether to compact
What's inside
- agents/openai.yaml
- 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.