strategic-compact
Skill19 starsChanged 10 months agoMITView on GitHub
Suggest context compaction at optimal logical boundaries — between phases, after a research burst, after a debugging session ends — rather than waiting for the automatic compaction threshold to hit mid-task. Use when the user asks whether to compact, mentions context is getting long, wants to checkpoint before a big task, or when you notice the session is approaching a natural transition where compacting would preserve the next phase's context. Complements (doesn't replace) Claude Code's built-in auto-compaction. Triggers on "/strategic-compact", "should I compact", "when should I clear context", "getting long", or proactively at phase boundaries and session transitions.
40 other projects use a version of this.
Adopted by
Most recently taken up by
- NTPhat0322/claude-skillstheir own version, first seen Sep 28, 2026
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- arfar-x/agent-skillstheir own version, first seen Sep 7, 2026
- best-radar/bradar-everything-claude-codetheir own version, first seen Sep 6, 2026
- tarrragon/claude-skillstheir own version, first seen Sep 1, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
Used with
Projects with it also use kotlin-testing, ralphinho-rfc-pipeline and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
tpavanipradeepSkillkotlin-testing
Kotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practices.
Also in 6 projects that use this
InfopibeSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 10 projects that use this
mryeastcodeSkillnuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Also in 5 projects that use this
saxon-ySkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 12 projects that use this
InfopibeSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 11 projects that use this
mryeastcodeSkillsanta-method
Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.
Also in 6 projects that use this
- +3 more from Infopibe
Other versions40 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 40
- WorldFlowAI/everything-claude-code★ 4ksame name
- xu-xiang/everything-claude-code-zh★ 2ksame name
- sangrokjung/claude-forge★ 847same name
- loulanyue/awesome-claude-notes★ 272same name
- cloudnative-co/claude-code-starter-kit★ 151same name
- tpavanipradeep/everything-claude-code★ 134same name
- templetongroup/radiant★ 113same name
- hellangleZ/burn-in-cceverywhere-ralph★ 112same name
- cohen-liel/hivemind★ 110same name
- Jamkris/everything-gemini-code★ 87same name
30 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository39 other files it gives its agents.
- adrSkill
- adversarial-reviewerSkill
- agent-creatorSkill
- brainstormSkill
- codebase-auditSkill
- codebase-researchSkill
- code-quality-auditSkill
- code-reviewSkill
- context-saverSkill
- continuous-learningSkill
- create-planSkill
- deep-brainstormSkill
- design-languageSkill
- e2e-testingSkill
- eval-harnessSkill
- grumpy-reviewerSkill
- implement-phaseSkill
- implement-planSkill
- iterate-planSkill
- prompt-generatorSkill
- security-reviewSkill
- ship-issueSkill
- skill-visualizerSkill
- team-brainstormSkill
- team-create-planSkill
- team-implement-plan-fullSkill
- team-implement-planSkill
- tt-brainstormSkill
- tt-create-build-loopSkill
- tt-create-planSkill
- tt-implement-phaseSkill
- tt-implement-planSkill
- tt-workflow-auditSkill
- tt-workflow-buildSkill
- tt-workflow-runSkill
- user-storySkill
- verification-loopSkill
- video-explainerSkill
- workflow-guideSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 36 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 75
Default: 50 weighted tool calls between logical boundaries.
- Distinctive: line 80
Read — 0.5 (inspection, lower cognitive load)
- Very specific: line 90
When a suggestion is accepted, auto-invoke context-saver before compaction (via integrate_context_saver: true in hook config — default).
- Distinctive: line 102
Keep suggestions informative but non-intrusive:
- Distinctive: line 129
Always show why now — the specific boundary and conditions that triggered the suggestion.
“Common” is measured: kept by at least 6 in 10 of the 36 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Strategic Compact
Suggest context compaction at logical boundaries — not arbitrary token thresholds. Auto-compaction is a safety net; strategic compaction is a workflow optimization that makes compaction feel like a natural pause instead of an interruption.
Why strategic > automatic
Auto-compaction fires on simple thresholds (token count, time). That creates real problems:
- Mid-task disruption — auto-compact might fire while you're debugging, losing the mental model built up over many interactions.
- Context fragmentation — arbitrary cutoffs create artificial boundaries in session history.
- Lost continuity — "why" decisions get compacted away at random points rather than preserved at meaningful boundaries.
- Incomplete state — mid-implementation compaction can lose partially completed work.
Strategic compaction instead:
- Monitors for logical boundaries (task completion, phase transitions, successful commits).
- Considers semantic state (actively debugging vs. between tasks).
- Provides suggestions — never forces compaction.
- Integrates with
context-saverto preserve critical state first. - Respects workflow rhythm rather than imposing arbitrary limits.
Goal: compaction that feels like a natural pause, not an interruption.
When to use
Passive monitoring — via PreToolUse hook that attaches to every tool call, tracks counters, and evaluates boundaries. Hook setup → references/hook-setup.md.
Direct invocation:
/strategic-compact— check current session state and get a recommendation./strategic-compact status— view tool counts and threshold proximity./strategic-compact now— force a suggestion (auto-invokes context-saver first).
Trigger phrases: "should I compact", "when should I clear context", "getting long", "checkpoint", "context is getting big".
The core heuristic
Two questions:
- Has enough work happened that compaction is worthwhile? (weighted tool-call count vs. threshold)
- Is this moment a good place to compact? (logical boundary vs. mid-task)
Both must be yes before suggesting. The full rule set is in references/boundary-rules.md. Summary:
Suggest when…
| Signal strength | Trigger |
| Strong | Task completion (TaskUpdate → completed), + ≥60% threshold, + >10min since last suggestion |
| Strong | Successful git commit, + ≥70% threshold, + no pending tasks in this feature |
| Medium | New feature starting (TaskUpdate → in_progress after completing previous), + ≥50% threshold |
| Warning (high priority) | Estimated context usage >80% + ≥90% threshold — prevent forced auto-compaction mid-task |
Don't suggest when…
- Active debugging — recent errors, investigation-pattern tool sequence, or task name contains "debug/fix/investigate".
- Active implementation — uncommitted changes, recent edits, unresolved test failures.
- User recently deferred — respect the last "not now".
- Critical operation in progress — rollback, migration, destructive commands.
- Last suggestion was <10 min ago — avoid nagging.
Threshold
Default: 50 weighted tool calls between logical boundaries.
"Significant" means the weighted count — raw tool calls multiplied by the weight table below. A tool call with weight 1.0 contributes 1 significant call; a Read with weight 0.5 contributes 0.5. Weights:
- Edit / Write / Bash / NotebookEdit / TaskUpdate — weight 1.0 (state-modifying or complex)
- Read — 0.5 (inspection, lower cognitive load)
- Glob / Grep — 0.3 (searches, low cost)
- WebFetch / WebSearch — 0.5 (external lookups)
Scenario-tuned thresholds (standard dev 50, debugging 75, quick fixes 30, large refactor 40, docs 60). Full config + dynamic adjustment rules → references/hook-setup.md.
Preserve before compact
When a suggestion is accepted, auto-invoke context-saver before compaction (via integrate_context_saver: true in hook config — default). This produces a handoff doc capturing:
- What was being worked on
- Files mid-edit with line numbers
- Decisions made
- Next steps
The compacted session can be resumed from that file. See context-saver/SKILL.md for the doc format.
Suggestion format
Keep suggestions informative but non-intrusive:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Context Compaction Suggested
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Session Metrics:
Tool calls: 72 significant (threshold: 50)
Session time: 45 minutes
Last boundary: Task completed 3 min ago
Boundary Detected:
Task "Add user authentication" marked complete
Git commit: "feat: implement JWT auth flow"
No pending changes or active debugging
Recommendation: GOOD TIME TO COMPACT
Options:
[1] Compact now (will invoke context-saver first)
[2] Defer for 15 minutes
[3] Defer until next boundary
[4] Dismiss (don't suggest again this session)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Always show why now — the specific boundary and conditions that triggered the suggestion. Users trust the heuristic faster when they can see its reasoning.
Minimal mode (for experienced users):
[Compact? 72/50 calls | Task done | Clean state] Y/n/deferIntegration with other skills
context-saver— auto-invoked before compact. Captures in-flight state as a handoff doc.implement-phase— emitsphase_completeboundary events.create-plan— plan creation emits a boundary.code-review— review completion emits a boundary.
Full integration specs → references/hook-setup.md.
Core principles (keep these in mind)
- Suggest, don't force — respect the user's workflow.
- Boundary-aware — align with natural pause points, not token counts.
- Context-preserving — always integrate with context-saver before compact.
- Configurable — adapt thresholds per project and scenario.
- Non-intrusive — clear but minimal suggestions; include the "why."
References (loaded on demand)
references/hook-setup.md— PreToolUse hook config, state tracking, tool weights, dynamic thresholds, per-project configuration, integration specs, troubleshootingreferences/boundary-rules.md— Full suggest-when / suppress-when rule specifications with YAML patterns, plus accept/defer heuristics for users
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

