- Self-improvement pass. Scan recent feedback memories + this session for rules that belong in a skill. Promote, shrink the source, mark MEMORY.md.
- Compaction recommendation. Suggest
/compactat a logical phase boundary with a paste-ready summary.
The skill is disable-model-invocation: true — zero context cost until the user types /strategic-compact.
Skills on disk:
!ls -1 ~/.claude/skills/ 2>/dev/null
Subagents on disk:
!ls -1 ~/.claude/agents/ 2>/dev/null
Commands on disk:
!ls -1 ~/.claude/commands/ 2>/dev/null
Rules on disk:
!ls -1 ~/.claude/rules/ 2>/dev/null
Hook scripts on disk:
!ls -1 ~/.claude/hooks/ 2>/dev/null
Hooks + MCP + plugins configured in settings.json:
!bash ~/.claude/skills/strategic-compact/scripts/settings-features.sh
Today:
!date -u +%Y-%m-%dT%H:%M:%SZ
- SCAN phase is a heavy file-read sweep across ALL Claude-extension types (skills, subagents, hooks, commands, rules, MCP, plugins — see
features-overviewdoc). Perreferences/claude-code-best-practices.md, the audit must cover the full extension surface, not just skills. Delegate to a subagent so the main loop's context stays small. - APPLY phase needs per-candidate
AskUserQuestionprompts. Forked subagents CANNOT callAskUserQuestion. APPLY runs in the main loop.
This skill does NOT use context: fork in frontmatter (that would forbid AskUserQuestion across the whole run). Instead the body spawns a subagent for SCAN only, then continues in main-loop context for APPLY.
SCAN — Spawn a
general-purposesubagent with this prompt:Read
~/.claude/skills/strategic-compact/workflows/self-improvement-pass.mdand execute it end-to-end. Your final output must be the candidate-list Markdown described in the "Output contract" section. ALSO write the same content to~/.claude/tmp/strategic-compact-candidates-<UTC-timestamp>.md(create the dir if missing). Return only the candidate list — no prose preamble.Wait for the agent return. Save the file path it created.
APPLY — Read
~/.claude/skills/strategic-compact/workflows/apply-edits.mdand execute it against the candidate list (prefer the subagent return; fall back to the file if truncated). UseAskUserQuestionfor each candidate.DECIDE — Read
~/.claude/skills/strategic-compact/workflows/compaction-decision.mdand emit a compaction recommendation with a paste-ready/compact <summary>line.
If the SCAN phase returns an empty candidate list AND the self-healing sweep found nothing, skip directly to DECIDE.
The SCAN agent runs these EVERY invocation. Each replaces a multi-step inline bash block in the workflow doc — one tool call instead of six. Both emit === SECTION === prefixes for cheap parsing.
| Script | Replaces | Run during |
|---|---|---|
scripts/scan-inventory.sh |
Steps 1, 1d, 1e, 1f, 1g, 1h, 1i (extension-universe dump) | Step 1 of SCAN |
scripts/self-healing-sweep.sh |
Checks 1, 2, 4, 7 from references/self-healing-checks.md (mechanical-only) |
Step 1c of SCAN |
scan-inventory.sh is also redundant when the SKILL.md <universe> block's dynamic context injection already ran — skip it in that case. Useful for fresh-fork invocations.
self-healing-sweep.sh honors SCAN_STRICT_XREF=1 to disable the known-optional-path filter (debugging only). Honors MEMORY_DIR=<path> to override project-memory auto-detection.