skills/steward/SKILL.md
Code quality audit and fix orchestration. Three modes — session review of branch diff (default), full deep audit with PCD pipeline + parallel fixes, iterative fix-audit loop bounded by max-passes. Invoked by /prove:steward, /prove:steward-review, /prove:auto-steward, steward, auto-steward, steward review, code audit, code quality, clean up the code, fix code quality, refactor for clarity.
npx skillsauth add mjmorales/claude-prove stewardInstall 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.
Audit source files for clarity, extensibility, and agent-workflow debt. Clean breaks: rename, restructure, delete. Tests excluded from audit scope -- source first, tests adapt after.
All modes share: .claude/.prove.json validators (never guess commands), artifacts in .prove/steward/, reports in .prove/reports/steward/, task context from active run's plan.json (scripts/prove-run show plan) or .prove/plans/. Link findings to scrum task IDs when plan.json contains task_id.
Parse $ARGUMENTS left-to-right:
--review -> Review mode (default if no mode flag)--full -> Full mode--auto -> Auto mode--max-passes N -> auto-mode iteration cap (default 3)Unknown flags: halt and ask the user to restate intent (which mode, which scope). No mode flag: default to Review mode.
CLAUDE.md for conventions..claude/.prove.json for validators/scopes.plan.json for task context and task_id.$ARGUMENTS.Session-scoped audit of current branch diff. Read-only by default; fix only on approval.
$ARGUMENTS scope token if supplied, else main. Verify with git rev-parse --verify <base>. Fall back to master, then halt.git diff <base>...HEAD --name-only and --stat.test_*, *_test.*, *.spec.*, *.test.*, tests/, __tests__/, fixtures.git diff --name-only and git diff --cached --name-only. Same filter.code-steward directly:
Audit ONLY these source files: [list]. Read-only -- produce findings, do NOT fix. Check cross-file integration, consistency, duplication.
.prove/steward/session-review.md.Write .prove/steward/session-review.md:
# Session Review
**Date**: [today] | **Branch**: [branch] | **Base**: [base]
**Source files reviewed**: [N] | **Test files skipped**: [N]
**Task**: [plan task_id or branch context]
## Must Fix
[numbered, file:line -- address before merging]
## Should Fix
[numbered -- quality worth addressing before merging]
## Nits
[numbered -- minor polish]
## Fix Plan
[1-3 packages; note parallelism]
Summarize counts and packages. AskUserQuestion header "Review":
code-steward agent directly.code-steward agents with explicit file lists.Run .claude/.prove.json validators (lint, then tests). On test failure, append to session-review.md:
## Test Remediation Required
| Test file | Failure | Source change that caused it |
|---|---|---|
git diff --stat, then one-paragraph summary. Flag broader findings for --full.
Constraint: modify only in-scope files. Read unchanged files for patterns only. Exception: renames requiring reference updates.
Deep audit of full scope with PCD pipeline, parallel fix orchestration, separate test remediation phase.
Use $ARGUMENTS scope token if provided; else full codebase.
Run PCD Pipeline. Synthesizer outputs: .prove/steward/findings.md + .prove/steward/fix-plan.md.
Create .prove/steward/findings.md:
# Code Steward Audit Findings
**Date**: [today] | **Scope**: [scope] | **Files**: [N]
## Critical Issues
## Structural Refactors
## Naming & Readability
## Code Hygiene
## Performance
## Systemic Recommendations
Each section: numbered, file:line refs, before/after for refactors.
Create .prove/steward/fix-plan.md grouping findings into parallelizable work packages (name, files, finding numbers, changes).
Present counts per category and fix plan with dependency annotations. AskUserQuestion header "Approval":
Spawn code-steward agents per approved package. Prompt includes only what agent cannot infer:
Launch independent packages simultaneously. Serialize only overlapping-file packages. Update fix-plan.md as agents complete.
.prove/reports/steward/report.md: changes summary, remediation table, remaining recommendations.Constraints: refactors preserve behavior. If a behavior-changing fix is required, do not bundle it — surface it as a separate finding and call it out explicitly in the report.
Iterative audit -> fix -> re-audit, human-approved on pass 1 only, bounded by --max-passes N.
Parse --full (full codebase on pass 1; default = git diff main...HEAD --name-only), --max-passes N (default 3), scope.
Initialize .prove/steward/auto-report.md:
# Auto Steward Report
**Date**: [today] | **Scope**: [full | diff | dir] | **Max passes**: [N]
## Pass Log
--full/dir if supplied, else git diff main...HEAD --name-only minus tests. None remaining -> inform and stop.findings.md + fix-plan.md. Fallback per F3 if PCD fails.AskUserQuestion header "Approval": Approve all / Cherry-pick / Abort. Abort -> update report, stop.code-steward subagents per approved package (serialize overlapping files).### Pass [N]
- **Files audited**: [N]
- **Issues found**: [N] (Critical: X, Major: X, Minor: X)
- **Issues fixed**: [N]
- **Files modified**: [list]
- **Validator status**: lint [pass/fail], tests [pass/fail]
Track modified files for next pass scope.
No approval. Loop until clean or capped:
code-steward directly:
Re-audit ONLY these files modified last pass: [list]. Check: (1) refactor-introduced issues, (2) quality issues the prior pass masked, (3) caller/dep integration. Produce findings. Do not fix yet.
.prove/steward/findings-pass-N.md, auto-approve, launch fix subagents, validate, append Pass N block.max-passes with remaining findings, record "Cap reached" and goto A3.Loop invariant: iterate on audit findings, not validator failures. Test/lint failures are logged, never trigger extra passes.
Append to auto-report.md:
## Summary
- **Total passes**: [N]
- **Outcome**: [Converged clean | Cap reached with N remaining]
- **Total found/fixed**: [sums]
- **Files modified**: [dedup list]
## Test Remediation Required
| Test file | Failure | Source change that caused it |
|---|---|---|
## Remaining Issues (if capped)
[unfixed findings from final pass]
Present: convergence status, per-pass breakdown, test remediation, remaining issues. If capped, suggest rerun or manual fixes.
Progressive Context Distillation -- multi-round pipeline producing structured findings with risk-targeted depth. Shared by Review (>= 5 files), Full (always), Auto (pass 1 always; pass N >= 5 files).
claude-prove pcd map --project-root "$PROJECT_ROOT" [--scope <scope>]
Produces .prove/steward/pcd/structural-map.json (file metadata, dependency edges, clusters).
Skip if < 20 files. Launch pcd-annotator:
Annotate
.prove/steward/pcd/structural-map.jsonwith semantic labels and module-purpose per cluster. Write back.
Per cluster, launch pcd-triager (run_in_background: true):
Triage files: [list]. Context: [cluster metadata, dependency edges]. Write triage cards to
.prove/steward/pcd/triage-batch-{cluster_id}.json.
Merge into .prove/steward/pcd/triage-manifest.json:
{
"version": 1,
"stats": { "files_reviewed": N, "high_risk": N, "medium_risk": N, "low_risk": N, "total_questions": N },
"cards": [...],
"question_index": [...]
}
claude-prove pcd collapse --project-root "$PROJECT_ROOT"
Compresses low-risk cards -> .prove/steward/pcd/collapsed-manifest.json.
claude-prove pcd batch --project-root "$PROJECT_ROOT"
Per batch in batch-definitions.json, launch pcd-reviewer (run_in_background: true):
Review batch {batch_id}. Files: [list]. Triage: [cards]. Routed questions: [present each before referenced file]. Cluster context: [metadata]. Write findings to
.prove/steward/pcd/findings-batch-{batch_id}.json.
Launch pcd-synthesizer:
Synthesize artifacts in
.prove/steward/pcd/: structural-map.json, collapsed-manifest.json, findings-batch-*.json. Do not read source directly. Produce target findings file (see mode) and.prove/steward/fix-plan.md(parallelizable work packages).
Synthesizer findings target by mode: Review -> session-review.md; Full -> findings.md; Auto pass 1 -> findings.md, pass N -> findings-pass-N.md.
Any critical PCD round fails -> single-pass code-steward in document-only mode. Log in .prove/steward/pcd/pipeline-status.json.
tools
Clean and compact prove's durable memory layers — team Lore, the Codex (scrum decisions), annotations, and contributor artifacts — keeping the tribal knowledge that grows team accuracy and folding away the rot. Triggers on "janitor", "clean the lore", "compact the lore", "compact the codex", "memory cleanup", "clean up team memory", "prune stale decisions", "tidy tribal knowledge", "lore cleanup". You are the driver: the CLI emits inventories and executes writes; the `memory-janitor` agent judges each entry; a per-team batch gate approves; nothing is ever deleted — consolidation, promotion, and supersession only.
testing
Anchor session context into prove primitives before compaction and rehydrate from them after. Built-in compaction summarizes by recency and drops the claude-prove state an agent needs to reorient; this skill externalizes volatile context into durable anchors (scrum tasks, decisions, run-state, a compact-anchors pointer file) pre-compact, then runs a deterministic reorientation sequence post-compact. Use before a manual /compact, when context is about to auto-compact, or immediately after a compaction. Triggers on "smart compact", "prepare for compaction", "anchor before compact", "context is getting long", "rehydrate", "reorient after compact".
tools
Apply model-driven CONTENT reshaping to stored run artifacts that sit behind the current schema, on explicit operator invocation only. Triggers on "migrate runs", "migrate run artifacts", "run content migration", "reshape run artifacts", "bring runs to current schema". You are the driver: the `run-state migrate-runs` CLI mechanically detects which artifacts are behind and emits a plan naming each one plus its migration-instruction file; you read the instructions and reshape the prose/findings, gated by the operator. The deterministic `schema migrate` handles structural column moves; this skill covers only the content reshaping beyond them. Never run as a background or resident loop — only when the operator asks.
tools
Synthesize the 7-section risk-forward Review Brief from a run's reasoning log. Triggers on "reasoning brief", "review brief", "synthesize the brief", "generate the brief", "brief the run", "brief for review", "story brief". You are the driver: the `acb brief` CLI renders a mechanical preservation-safe backbone and proves preservation; you synthesize the narrative prose (summary + changes), single-pass or multipass over episode chunks, then gate it through Stage-1 (mechanical, blocking) and Stage-2 (prose judge, advisory).