Strategic compact: manual context compaction for Claude Code
Hook-based reminder to run manual /compact at logical task boundaries instead of arbitrary auto-compaction
- What
- Hook-based reminder to run manual /compact at logical task boundaries instead of arbitrary auto-compaction
- Cost
- Free
- Needs
- Claude Code (the hook registers in ~/.claude/settings.json) and Node.js (the hook is a Node script). No account, no API key, no payment.
- Install
- Copy the installer prompt below into your Muse — your agent does the rest.
Curated by Skill Harbor — @affaan-m's compaction-timing skill for long Claude Code sessions: a PreToolUse hook script that watches two signals — context size (reads the session transcript's usage records and sums input+cache tokens, suggesting `/compact` at window-scaled thresholds: 160k on a 200k window, 250k on a 1M window, re-reminding every 60k more) and tool-call count (default 50, then every 25) — so compaction happens at logical boundaries (research→planning, milestone completed, before a context shift) instead of arbitrary mid-task auto-compaction. Includes a phase-transition decision table (compact after debugging and failed approaches; never mid-implementation), best practices (write the plan to a file first — the task list may not survive, since newer models removed TodoWrite by default), hook setup for `~/.claude/settings.json`, and environment configuration (COMPACT_THRESHOLD, COMPACT_CONTEXT_THRESHOLD, ECC_CONTEXT_WINDOW_TOKENS, CLAUDE_CODE_ENABLE_TODO_TOOLS). Honest caveats: the hook suggests, you decide — it never compacts by itself; files on disk survive compaction, intermediate reasoning does not; listed here with credit to its creator; MIT-licensed. Skill Harbor never reviews the code, review it yourself before use. Discovered via skills.sh.
Version:
Quick answer
Strategic compact: manual context compaction for Claude Code is a free Muse skill that uses a hook-based reminder to run manual /compact at logical task boundaries instead of arbitrary auto-compaction, so context is trimmed when a task actually ends, preserving the thread of work that still matters for what comes next.
Install
Copy the install package below, then paste it into Muse🧪 Install ran in our test sandbox · Nov 11, 2026📌 Pinned version: commit 4eb71d9Step 0 — before installing anything: read this install prompt, summarize in a few lines what this build does and what installing it involves, then ask me to confirm before you proceed. Prerequisites: Claude Code (the hook registers in ~/.claude/settings.json) and Node.js (the hook is a Node script). No account, no API key, no payment. Install "Strategic compact: manual context compaction for Claude Code" for me. The skill suggests a manual /compact at logical task boundaries instead of relying on arbitrary auto-compaction, and it is driven by a small hook script, suggest-compact.js, that watches the session's context size and tool-call count. Installing it means installing the skill file and the hook, with the libraries the hook loads. Repository: https://raw.githubusercontent.com/affaan-m/ECC/4eb71d92a39cab44ad40ac9d8a6a5ccb4029d6c2/skills/strategic-compact/SKILL.md Pinned version: install the code at commit 4eb71d92a39cab44ad40ac9d8a6a5ccb4029d6c2 exactly (Skill Harbor tested this version). Do not substitute a newer version. If this commit is unreachable, stop and tell me. 1. Fetch these files from the repository into a temporary folder and look inside: the skill file skills/strategic-compact/SKILL.md; the hook scripts/hooks/suggest-compact.js; and the four library files it loads, scripts/lib/utils.js, scripts/lib/transcript-context.js, scripts/lib/agent-data-home.js, and scripts/lib/path-safety.js. The hook loads the libraries relative to its own location, so all of them are part of the install. 2. Integrity check: Skill Harbor reviewed this listing on 2026-10-10 and recorded the fingerprints below. I want you to compute the SHA-256 of each downloaded file and compare: - skills/strategic-compact/SKILL.md: SHA-256 44a71c6dcc3fdde8061b8a78296c5d37233e4accc8cf3c794e29ac5b9f2eee28 - scripts/hooks/suggest-compact.js: SHA-256 e031a96b7d05b689a457eb4c2c02dd8e1171cd5e68633f30b60a3f0f6ce4471a - scripts/lib/utils.js: SHA-256 c9a84bd7993cb65e532a16b1872ce468b869ec40aac2d743aa03bcbf6a6dd5a8 - scripts/lib/transcript-context.js: SHA-256 38f399260f79904bc8a97448d1dff965aaf0f04596143ce344fdbf64747bf0a2 - scripts/lib/agent-data-home.js: SHA-256 53c2110f46e3d635a82f620ca6db9dc9d218c05f888d9ae07241215ae3984dbb - scripts/lib/path-safety.js: SHA-256 542126cf47247161dd26713a1f33d34af2881db46435ac8ecef76a8be31c062c If a fingerprint does not match, I want you to stop before installing and tell me the files changed since Skill Harbor's review, so the new version is unverified. Show me your safety findings and give me three choices: (a) wait for Skill Harbor to re-review the listing (recommended), (b) analyze the new files in detail first and then decide, (c) install anyway knowing the risk. Then wait for my answer before doing anything else. 3. Safety check: I want to see your findings explicitly, in short separate items: - every network address the code contacts (expected: none) - every shell command it runs (expected: none from the hook itself; it reads the hook input and the session transcript, and keeps a small per-session state file in the temp directory) - every place credentials, API keys or personal data are read, stored or sent (expected: it reads the session transcript file named in its input, locally, to count tokens and tool calls; nothing is sent anywhere) - any obfuscated or encoded code (expected: none — plain JavaScript and Markdown) If anything looks suspicious, stop and explain it to me before continuing. 4. Confirmation: before installing, give me a short summary of what the skill does plus your safety findings, and wait for my explicit "yes, install". 5. Install it: copy SKILL.md into the agent's skills directory, in a folder named "strategic-compact". Then install the hook the way the SKILL.md's manual setup describes: copy suggest-compact.js to ~/.claude/scripts/hooks/suggest-compact.js, copy the four library files to ~/.claude/scripts/lib/ (keeping that layout, because the hook loads ../lib/ relative to itself), and add the two PreToolUse entries from the SKILL.md (matchers Edit and Write, command: node ~/.claude/scripts/hooks/suggest-compact.js) to ~/.claude/settings.json, preserving what is already in that file. 6. Verify with no network calls: frontmatter valid, all files in place, the two hook entries present in settings.json, and the hook and its libraries pass a Node syntax check (node --check). 7. Report what was installed, where, and what I still need to do myself (for example: nothing to start; the thresholds can be tuned later with environment variables such as COMPACT_THRESHOLD. One warning from the SKILL.md: if ECC is installed as a plugin, its hooks already register this hook, and the manual settings entries must not be added, or it would run twice). GitHub is optional: if I have a GitHub account or the gh CLI, you may use it; otherwise public access is fine. Never require it unless it's in the prerequisites above. Rules: don't touch anything outside the temp folder and the install target. If anything looks off, stop and ask me.
Saved to your recent installs. Find it anytime on /connect.
🔒 Security, provenance and what this touches
- It can create or modify files.
What the scan found — excerpts from the install prompt
- writes files — Prerequisites: Claude Code (the hook registers in ~/.claude/settings.json) and Node.js (the hook is a Node scr · 5. Install it: copy SKILL.md into the agent's skills directory, in a folder named "strategic-compact". Then in · 6. Verify with no network calls: frontmatter valid, all files in place, the two hook entries present in settin
The install prompt below already includes the vetting steps: your agent follows the community checklist before installing anything with executable code. Want more?
Verification certificate
Dated facts about what was checked for this listing, and how. This is not a safety certification.
- Pinned version
- 4eb71d9 · 2026-10-13
- Sandbox install test
- Install ran in our test sandbox · Nov 11, 2026
- Creator identity
- Not verified
- Fingerprint watch
- Last checked · Nov 19, 2026 : no change detected in the files linked by this install prompt
- Install prompt analysis
- 2026-10-13 : writes files
Skill Harbor never reviews the code of a listed skill. These are dated facts about the install prompt and our install test, not a safety certification. Review a skill yourself before you install it. How we verify
Questions
How do I install a skill?
Every product page includes a copy-paste install prompt. Paste it into your Muse and it sets the skill up for you — no manual configuration.
Where does my money go?
Straight to the seller. Skill Harbor never processes payments: checkout happens on the seller’s own page, usually Stripe.
What does the ✓ next to a creator’s name mean?
It means we confirmed the identity of the person behind the listing. It says nothing about the code itself — always check a skill before installing it.