Cc Strategic Compaction — Development skill for Claude Code
Claude Code mod to allow the Agent to auto compact himself based on instructions, programatic conditions or external triggers, like hooks on other plugins.
How to install Cc Strategic Compaction
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open sergiopalacio/cc-strategic-compaction and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Cc Strategic Compaction does
Claude Code mod to allow the Agent to auto compact himself based on instructions, programatic conditions or external triggers, like hooks on other plugins.
Alternatives in Development
- Contributing To Auto-claude-code-research-in-sleep (aris) — English 中文版 Thank you for your interest in contributing to ARIS 3.1k ★
- Claude Peers MCP — Allow all your Claude Codes to message each other ad-hoc 1.9k ★
- 3D Portfolio — Let's build a cool 3D website together 1.3k ★
README
Claude Strategic Compaction Mod
Claude decides when to compact, and compacts. Every other plugin for this only suggests and leaves you to type `/compact`.
claude plugin marketplace add sergiopalacio/cc-strategic-compaction
claude plugin install cc-strategic-compaction@cc-strategic-compaction --config askFromPercent=40
`/compaction` opens the pane. Set `askFromPercent` before anything else: at its default of 0 the judge runs every turn from the first, spending a model call to answer a question whose answer is obviously no.
When it fires
Not when the task is finished, and not when the window is full. Claude already watches the window.
The question is whether anything in the conversation exists **only** here. A measurement taken and never written down is lost on compaction. A file on disk is not, because it can be read again.
Two things can ask, and each has its own switch in the pane:
- Judge — at the end of a turn, from the rules in
hooks/rules.tsplus your own. - MCP Tool —
mcp__cc-strategic-compaction__compact, which the model calls on itself after writing something down.
Nothing else can: no noun on `$`, no file to touch. A shell hook reaches this by reminding the model to call the tool. Turn the judge off and the agent's own instructions are the only thing deciding; turn the tool off and only the rules are.
A subagent still running blocks both. There is a 15 minute floor between compactions.
Settings
| key | default | what it does |
|---|---|---|
judgeEnabled |
true |
ask the judge at the end of each turn |
toolEnabled |
true |
register the tool the agent calls on itself |
askFromPercent |
0 |
percent of the window below which nothing is judged |
compactWhen |
"" |
your rules, in your own words |
rulesMode |
append |
append adds yours to the packaged rules, override replaces them |
toolThreshold |
0 |
compact after N tool calls of any kind. Unrelated to `toolEn |
Related Skills
Fire Cost
Track context usage, estimate session costs, and trigger strategic compaction
Post Compact Reminder
Claude Code hook that detects context compaction and injects a reminder to re-read AGENTS.md, preventing post-
Compact Middleware
Claude Code's compaction engine, as a drop-in DeepAgents middleware
Context Compact
Prepare context for compaction: $ARGUMENTS
Compact
Prepare session state for context compaction — capture learnings, save state, then compact
Do Not Compact
Claude Code plugin: reload CLAUDE.md files after context compaction
Related Agents
Context Engine
Context window management — tracks tool call count, auto-detects when context fills up, triggers state save +
Android Mod
Use PROACTIVELY and automatically — do not wait to be asked — for Android rooting, debloat, flashing, and flee
Mod Builder
Creates and changes Claude Code mods — plugins of function hooks behind a pane, band, status line, slash comma