portable/compound-engineering/skills/compound-refresh/SKILL.md
Refresh stale or drifting learnings and pattern docs in docs/solutions/ against the current codebase
npx skillsauth add the-rabak/compound-engineering-plugin compound-refreshInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Maintain the quality of docs/solutions/ over time. Review existing learnings against the current codebase, then refresh any derived pattern docs that depend on them.
Check if $ARGUMENTS contains mode:autonomous. If present, strip it from arguments and run in autonomous mode.
| Mode | When | Behavior |
|------|------|----------|
| Interactive (default) | User is present and can answer questions | Ask for decisions on ambiguous cases and confirm disruptive actions |
| Autonomous | mode:autonomous in arguments | No user interaction. Apply unambiguous actions, mark ambiguous cases stale, and generate a full report |
status: stale, stale_reason, and stale_date.Before editing anything under docs/solutions/, read the local guidance files in this order:
AGENTS.mdCLAUDE.md (if present)README.mdUse them to preserve the repository's docs conventions, OpenViking guidance, and workflow naming.
These principles apply to interactive mode only. In autonomous mode, skip all user questions and apply the autonomous rules above.
Follow the same interaction style as /workflows:brainstorm:
The goal is to help the user make a good maintenance decision with minimal friction.
Refresh in this order:
Why this order:
If the user starts by naming a pattern doc, you may begin there to understand the concern, but inspect the supporting learning docs before changing the pattern.
For each candidate artifact, classify it into one of four outcomes:
| Outcome | Meaning | Default action |
|---------|---------|----------------|
| Keep | Still accurate and still useful | No file edit by default; report that it remains trustworthy |
| Update | Core solution is still correct, but references drifted | Apply evidence-backed in-place edits |
| Replace | The old artifact is now misleading, but there is a known better replacement | Create a trustworthy successor, then archive or supersede the old artifact |
| Archive | No longer useful or applicable | Move the obsolete artifact to docs/solutions/_archived/ with archive metadata |
Start by discovering learnings and pattern docs under docs/solutions/.
Exclude:
README.mddocs/solutions/_archived/Find all .md files under docs/solutions/, excluding README.md files and anything under _archived/.
If $ARGUMENTS is provided, use it to narrow scope in this order:
docs/solutions/module, component, or tagsIf no matches are found, report that and ask the user to clarify. In autonomous mode, report the miss and stop.
If no candidate docs are found, report:
No candidate docs found in docs/solutions/.
Run `/workflows:compound` after solving problems to start building your knowledge base.
Before asking the user to classify anything:
| Scope | When to use it | Interaction style | |-------|----------------|-------------------| | Focused | 1-2 likely files or a specific named doc | Investigate directly, then present a recommendation | | Batch | Up to about 8 mostly independent docs | Investigate first, then present grouped recommendations | | Broad | 9+ docs, ambiguous, or repo-wide stale-doc sweep | Triage first, then investigate in batches |
When scope is broad:
Do not ask action-selection questions yet. First gather evidence.
For each learning in scope, read it, cross-reference its claims against the current codebase, and form a recommendation.
A learning can go stale in several dimensions:
AGENTS.md, CLAUDE.md, and README.md?Match investigation depth to the learning's specificity. A learning with exact file paths and code snippets needs more verification than one describing a general principle.
The critical distinction is whether the drift is cosmetic or substantive:
The boundary: if you find yourself rewriting the solution section or changing what the learning recommends, stop. That is Replace, not Update.
Three guidelines that are easy to get wrong:
After reviewing the underlying learning docs, investigate any relevant pattern docs under docs/solutions/patterns/.
Pattern docs are high-leverage. A stale pattern is more dangerous than a stale individual learning because future work may treat it as broadly applicable guidance.
A pattern doc with no clear supporting learnings is itself a stale signal.
Use subagents for context isolation when investigating multiple artifacts. Choose the lightest approach that fits:
| Approach | When to use | |----------|-------------| | Main thread only | Small scope, short docs | | Sequential subagents | 1-2 artifacts with many supporting files | | Parallel subagents | 3+ truly independent artifacts with low overlap | | Batched subagents | Broad sweeps; narrow scope first, then investigate in batches |
When spawning any subagent, include this instruction in its task prompt:
Use dedicated file search and read tools for all investigation. Do not use shell commands for file operations. Report: file path, evidence, recommended action, confidence, and open questions.
There are two subagent roles:
The orchestrator merges investigation results, detects contradictions, coordinates replacement subagents, and performs archival or metadata edits centrally.
After gathering evidence, assign one recommended action.
The learning is still accurate and useful. Do not edit the file. Report that it remains trustworthy.
The core solution is still valid but references have drifted. Apply the fixes directly.
Choose Replace when the learning's core guidance is now misleading.
Assess whether evidence is sufficient to write a trustworthy replacement:
status: stalestale_reasonstale_date: YYYY-MM-DDChoose Archive when:
Action:
docs/solutions/_archived/archived_date: YYYY-MM-DDarchive_reasonIf the referenced implementation is gone but the broader problem domain is still active, that is usually Replace, not Archive.
Auto-archive only when both the implementation and the problem domain are gone, or when the doc is fully superseded by a clearly better successor.
Apply the same four outcomes to pattern docs, but evaluate them as derived guidance:
Skip this entire phase. Do not ask any questions. Proceed directly to Phase 4:
Most Updates should be applied directly without asking. Ask only when:
Do not ask whether code changes were intentional or whether the user wants to fix the code. Stay focused on doc accuracy.
Always ask one question at a time. Prefer multiple choice. Lead with the recommended option and explain the rationale briefly.
For a single artifact, present:
Then ask:
This [learning/pattern] looks like a [Update/Keep/Replace/Archive].
Why: [one-sentence rationale based on the evidence]
What would you like to do?
1. [Recommended action]
2. [Second plausible action]
3. Skip for now
For several learnings:
If the user asked for a sweeping refresh:
No file edit by default. Summarize why the learning remains trustworthy.
Apply in-place edits only when the solution is still substantively correct.
Valid in-place updates include:
Do not use Update for:
Process Replace candidates one at a time.
When evidence is sufficient:
/workflows:compound or compound-docs document structure: frontmatter, problem, root cause, current solution, code examples, and prevention tipssuperseded_by to the old learningdocs/solutions/_archived/When evidence is insufficient:
/workflows:compound after the next real encounter with that areaArchive only when a learning is clearly obsolete or redundant. Do not archive a document just because it is old.
The full report must be printed as markdown output. The report is the deliverable.
After processing the selected scope, output:
Compound Refresh Summary
========================
Scanned: N learnings
Kept: X
Updated: Y
Replaced: Z
Archived: W
Skipped: V
Marked stale: S
Then for every file processed, list:
For Keep outcomes, list them under a reviewed-without-edits section so the result is visible without creating git churn.
In autonomous mode, the report is the sole deliverable. Print every section in full.
Split actions into two sections:
Applied (writes that succeeded):
Recommended (actions that could not be written):
If all writes succeed, the Recommended section is empty.
Skip this phase if no files were modified.
Before offering options, check:
Stage only the files that compound-refresh modified.
Use sensible defaults:
If on the default branch, offer:
If on a feature branch with a clean working tree, offer:
If on a feature branch with other dirty changes, offer:
Write a descriptive commit message that:
/workflows:compound/workflows:compound captures a newly solved, verified problem/workflows:compound-refresh maintains older learnings as the codebase evolvesUse Replace only when the refresh process has enough real evidence to write a trustworthy successor. When evidence is insufficient, mark as stale and recommend /workflows:compound for when the user next encounters that problem area.
tools
Package one plan execution packet into a compact ticket-local execution packet with parent refs, scope fences, feature-home ownership, and evidence commands. Use when converting plans into local tickets or when execution needs one ticket-sized context pack without the full plan.
tools
Package one plan execution packet into a compact ticket-local execution packet with parent refs, scope fences, feature-home ownership, and evidence commands. Use when converting plans into local tickets or when execution needs one ticket-sized context pack without the full plan.
testing
Run a deep adversarial review of plans and architecture before implementation. Use when validating strategy docs, contracts, roadmaps, and competitive positioning with scored findings and prioritized recommendations.
testing
Run a deep adversarial review of plans and architecture before implementation. Use when validating strategy docs, contracts, roadmaps, and competitive positioning with scored findings and prioritized recommendations.