/devflow:strategic-compactfrom DevFlow Skills Collection
Suggests context compaction at logical boundaries (between phases, after research/debugging) rather than waiting for automatic token-threshold compaction. Complements built-in auto-compaction.
Ships in DevFlow Skills Collection. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Reference files (open one when a step points to it):
references/boundary-rules.md: Boundary rules — when to suggest, when not toreferences/hook-setup.md: Hook setup and configurationSuggest 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.
Auto-compaction fires on simple thresholds (token count, time). That creates real problems:
Strategic compaction instead:
context-saver to preserve critical state first.Goal: compaction that feels like a natural pause, not an interruption.
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".
Two questions:
Both must be yes before suggesting. The full rule set is in references/boundary-rules.md. Summary:
| 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 |
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:
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.
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:
The compacted session can be resumed from that file. See context-saver/SKILL.md for the doc 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/defer
context-saver — auto-invoked before compact. Captures in-flight state as a handoff doc.implement-phase — emits phase_complete boundary events.create-plan — plan creation emits a boundary.code-review — review completion emits a boundary.Full integration specs → references/hook-setup.md.
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 usersWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mhylle/claude-skills-collection --plugin devflow35 skills in this plugin
/adrDocument architectural decisions in standardized ADR format. This skill should be used when making significant technical decisions, choosing between approaches, establishing patterns, or when other skills (create-plan, implement-plan, brainstorm) identify decisions that need documentation. Triggers on "document decision", "create ADR", "architectural decision", or automatically when invoked by other skills during planning and implementation./adversarial-reviewerAdversarial code review by three independent subagent personas (Saboteur, New Hire, Security Auditor) running in parallel, isolated contexts that know nothing of the author's intent or Claude's earlier conclusions. Reviews a diff by default (staged/unstaged, a ref or a file); --codebase reviews a whole repo or subtree for tech debt, attack surface and knowledge silos. Use before merging a PR; when the user asks for a hostile, harsh, critical, skeptical or second-opinion review; when a /devflow:code-review came back suspiciously clean; when the user is tired after a long session or has a gut feeling something is off; or for a quick audit of an inherited repo ("what am I inheriting"). Differs from /devflow:code-review (routine per-phase review, no isolation) and /devflow:security-review (single-lens OWASP depth).Other plugins' skills for the same job