/autopilot:quality-pipelinefrom autopilot
Runs pre-commit/pre-merge quality gates: tests, completeness scan, and code review. Dispatches to sub-step references for test policy, anti-stub checks, test integrity, and code review.
Ships in autopilot. 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.
Routing overlap? If this intent better matches a sibling skill, redirect per references/routing-tiebreaks.md (prefer pre-merge gate failures over manual debugging).
Pipeline is a dispatcher. Each step follows its reference doc. It is the qc-gate node of the dev-flow stage graph, entered via node scripts/stage-advance.js --to qc-gate.
!cat .claude/quality-gate-config.md 2>/dev/null || true
!cat .claude/dispatch-config.md 2>/dev/null || true
Each script encodes a step the pipeline previously asked the LLM to do by hand. Use them; the JSON output is stable across rounds and cheap to consume.
| Script | Replaces LLM-judgment for | When invoked |
|---|---|---|
scripts/replay-stop-guard.js | Classifies final replies with the owner Stop guard | Replaying transcript regressions; contract |
scripts/reply-precheck.js | Same owner-question rules as the Stop hook, on a draft | Before sending a reply; shared module hooks/lib/owner-question-rules.js |
scripts/check-backlog-entries.js | Per-entry schema/caps/pointer/reporter-field gate; --range is the pre-push peer-report guard | After writing a backlog row; pre-merge checklist |
scripts/affected-suites.js | "Which suites can this diff break?" — static reference graph; mode: full when the diff cannot be judged. The gate's test step (BL-0001) | Tests step, M/L/XL and urgent: before running any test; with --run --record when the outcome stage is on |
scripts/check-test-outcome.js | Opt-in pre-push outcome check that re-derives "tests ran green for this SHA" | Only when qc-gate outcome is warn or block; pointer: test-policy.md selector section |
scripts/gate-verify.js | Data-only rule list (forbid/require paths and text, base-sha registered checks) re-derived from the working tree for the per-turn gate | Run by the per-turn-gate hook for worker-bound gate files; contract in project/plans/2026-10-26-depth0-per-turn-gate.md 3.2 |
scripts/completeness-scan.sh | Anti-stub regex pass + new-vs-pre-existing classification | Completeness Gate step |
scripts/error-path-scan.sh | L0 attention-slip scan for error paths (swallowed errors, broadened catches, untested error paths) | Completeness Gate step (advisory to review) |
scripts/secret-scan-diff.js | L0 attention-slip scan for leaked secrets | Completeness Gate step (blocking) |
scripts/leak-guard.js | Blocks personal paths, hosts, private IPs, credentials and .env files in added lines; fix with scripts/redact-personal.js | pre-commit and CI (see references/leak-guard.md) |
scripts/scrub-tracked.js | Rewrites rewritable personal-data categories across every tracked working-tree file; dry-run unless --apply | one-shot repo scrub (see references/leak-guard.md) |
scripts/layout-lint.js | Tracked files vs the repo layout registry (scripts/lib/repo-layout.js): top-level and root-file allowlists, per-file exceptions, and the placement rules of the current relayout stage; exit 1 = violations, 2 = registry fault | CI (checks.yml) and before a relayout stage merges |
scripts/adjudicate-findings.js | "Is this finding real / repair-eligible?" — probe-backed statuses; gate --ids = claim-real; dispose + repair-gate --ids = relevance (must-fix-now); completeness = all-blocking Critical/Major dispositions over the full registry | Review step: verify → classify → completeness before fix dispatch and before acceptance |
scripts/review-mvp-portfolio.js | Bounded multi-reviewer candidate union → verified MUST-FIX/prerequisite admission + deterministic fixed-budget maximum-score MVP, cut list, and evidence-backed backlog candidates | After a panel returns a complete scored candidate matrix; canonical contract: references/reviewer-mvp-portfolio.md |
scripts/check-repair-scope.js | Cumulative repair stop-loss — sealed contract (seal --out + check --seal), full base_sha..HEAD churn/path/new-file accounting; TRIP ends automatic repair | Before fixer, after every repair mutation, and before acceptance |
scripts/check-redispatch-prompt.sh | Round 2+ leaky-phrase detection (per references/blind-dispatch.md) | Before every re-review dispatch |
scripts/check-dispatch-suppression.sh | Severity-coaching or "don't flag this" in any dispatch prompt (round 1 included) | Before a methodology-agent dispatch; exit 1 coaching, 0 clean |
scripts/diff-file-list.sh | Reviewer's "list every file I read" enumeration in Verified Clean | Reviewer prompt assembly |
scripts/diff-scope-report.sh | v2 scope-creep filter: whitespace-only files, files not in message, comment-only hunks, quote-style swaps | Code Review step (Scope Creep Scan) |
scripts/resolve-dispatch.sh | Per-dispatch model/mode lookup against model-routing-config.md | Any subagent dispatch |
scripts/check-holdout-coverage.sh | Holdout gate: high-risk diffs (classify-diff-risk.sh adversarial_review) require a SHA-bound passing mutation/strength probe receipt; absent/malformed/stale/failed fail closed | After impl, before merge, when the risk classifier reports high — check --range <base..head> --evidence-dir <dir> (receipts via run) |
scripts/check-tip-verify-default.sh | Whether each repo has a default tip-verify command under ## Test Command; --update-grace drops OK repos from the grace list and never adds | When a grace-list repo gained a default test command; see references/test-policy.md |
scripts/check-test-integrity.sh | "Did the implementer game the tests?" — deleted / skipped / soloed / weakened existing tests, escaped fixtures/config (see references/test-integrity-gate.md) | After impl, before merge — esp. delegated / /l5 hetero dispatch |
scripts/scan-fixture-literals.js | "Did hands write fixture data into production code?" — scans added lines of base..head in non-test files for fixture comparisons (p7, test*), FIXTURE_*, fake shas/paths (evidence-discipline §23). Advisory | Before integrating a hands cut (also printed by dispatch-hetero.sh) |
scripts/verify-preexisting.sh | Stash + checkout-base + run-test classification | Test Failure Investigation step |
scripts/verify-red-green.sh | Red-green validation: a change's tests must be GREEN at head and RED at base+tests (else they don't exercise the change) — isolated detached worktrees, verdict from real exit codes | When judging whether new tests actually test the change (see references/test-policy.md) |
scripts/reap-dispatch-worktrees.sh | Exact schema-2 worktree state classification and preserve-first dead/clean reclamation | Before closing a managed root run; check blocks while exact owned worktrees remain |
scripts/reap-scratch-checkouts.js | Dry-run list / --apply removal of clean, merged scratch-dir worktrees; others reported only (scratch-closeout.sh is the apply wrapper) | After a merge is pushed or a full-suite run ends; .githooks/post-merge prints the reapable count |
scripts/lifecycle-residue-receipt.js | Issue or freshness-check exact worktree/branch residue evidence | Before handing lifecycle truth to LSM; a valid receipt does not itself compute can_close |
scripts/risk-counter.js | Cross-round WTF-Likelihood Cap state tracking | Self-Regulation section |
scripts/diff-since-last-round.sh | Round-N checkpoint + delta-since-checkpoint (dispatcher-only) | Re-review Loop short-circuit decision |
scripts/review-ledger-archive.js | Opt-in hetero-review ledger archive (review_ledger_archive.dir; unset means off) | When that dir is set, finalize archives automatically; import --ledger <dir> loads an old or hand-made ledger; status shows size and whether rotation is due; rotate and prune are manual housekeeping and prune is a dry run unless --execute |
scripts/calibration.sh | Panel verdict sample store + agreement report | Dormant with the shadow QC panel (ADR-0002); do not run |
scripts/resolve-qc-gate.sh | Per-project anti-skip gate strength (block/warn/off) for the .githooks/pre-push enforcer | On PASS, stamp the landing/merge commit with QC-Verdict: PASS (reviewer <id>, <date>) so the pre-push gate is satisfied |
scripts/dispatch-consult.sh | Excluded from ever being called on a seat already in the resolved qc_panel roster (resolver enforces exclusion) | Consult hook |
All scripts: <script> --help for usage; deterministic exit codes; JSON output where applicable. If a user project ships its own script with the same contract, prefer the project version.
Dormant. Do not run scripts/qc-panel.js. See docs/dev/adr/0002-task-tree-and-qc-panel-dormant.md.
| Size | Route | Steps |
|---|---|---|
| XS / S | scan → completeness → review | completeness (if not skip) + review |
| M / L / XL | test → scan → completeness → review | all steps |
urgent (!) | test → review | skip scan/completeness for speed |
Contract — the pseudocode blocks below are the executable dispatch contract that quality-pipeline reads at runtime: which step runs, which script to invoke, which reference doc owns the rest. They are intentionally minimal. Each step's full spec — rationale, examples, exceptions, prohibitions — lives in the linked reference doc, which is the canonical source of truth. Edits to the canonical spec MUST be mirrored here if (and only if) they change the dispatch shape (script name, branching outcome, ordering). Edits to examples/rationale stay in the reference — never duplicate them here.
Follow references/test-policy.md
→ failure? → classify via `scripts/verify-preexisting.sh '<test-cmd>'`
→ PRE_EXISTING / INTRODUCED / NO_FAILURE / INCONCLUSIVE
→ INTRODUCED + (≥3 failures OR flaky/intermittent OR root cause not
obvious from the diff) → invoke `autopilot:test-strategy` for the
failure-investigation funnel (baseline / regression scoping / flaky
systemic handling) BEFORE patching blindly
→ otherwise: fix per test-policy → re-run tests
→ pass? → continue
→ after impl, before merge: `scripts/check-test-integrity.sh` (warn mode: it warns, it does not block)
→ high risk (`classify-diff-risk.sh` adversarial_review): `scripts/check-holdout-coverage.sh`
→ new tests must exercise the change: `scripts/verify-red-green.sh`
Why route to test-strategy (added v2.25.10): the classifier tells you whose failure it is, not why it fails or whether it's flaky-systemic. A cluster of INTRODUCED failures or an intermittent one is exactly where test-strategy's funnel (test-pyramid placement, baseline 守則, regression scoping) prevents whack-a-mole patching. A single obvious INTRODUCED failure with a clear diff cause does NOT need it — fix directly. This is the cross-cutting routing edge that was missing (2026-06-26 methodology inventory).
Long-running / CI-backed test commands (Claude Code only, capability-gated): when the test command is a remote CI run or a multi-minute build, prefer the
Monitortool over re-runninggh run watchin a busy-loop — Monitor runs the watch script in the background and streams each output line back, re-invoking the session on change instead of polling. This is optional leverage; on agents without Monitor, fall back to manualgh run watch/ re-checking by hand. See references/multi-agent-portability.md §7.
Follow references/completeness-gate.md
→ run `scripts/completeness-scan.sh` (exit 1 ⇒ has new findings)
→ TODO/stub/placeholder found? → complete or remove them
→ clean? → continue
Model routing: resolve via scripts/resolve-dispatch.sh --role reviewer — reads .claude/model-routing-config.md if present, else defaults from references/model-routing.md. Do not hardcode defaults in this file.
Follow references/code-review.md (dispatches per .claude/dispatch-config.md '## Code Review' chain; defaults to autopilot:reviewer when chain unset or no chain entry is dispatchable)
Agent dispatch: read JSON from `resolve-dispatch.sh --role reviewer`
Before any round 2+ dispatch: `scripts/check-redispatch-prompt.sh <prompt>` (exit 1 ⇒ leaky, strip and retry)
Optional short-circuit: `scripts/diff-since-last-round.sh stat` (dispatcher-only — doc_only=true ⇒ skip re-review)
→ Critical/Major claims?
→ verify (adjudicate-findings gate / probe|trace)
→ classify relevance (dispose: must-fix-now | follow-up | reject-out-of-scope)
→ completeness: `adjudicate-findings.js completeness --store <store>` (all-blocking; not --ids subset)
→ scope check: `scripts/check-repair-scope.js check --contract <contract> --seal <seal.json>`
→ repair-gate --ids <must-fix-now> → fix only those
→ scope check after every repair mutation (full base_sha..HEAD) → re-review
→ completeness + scope check before acceptance / commit
(severity orthogonal; union-on-verified Critical/Major intact inside must-fix-now)
→ Suggestion/Minor? → dispatch via Decision Tree below
→ LGTM? → completeness + scope check before acceptance → pass
Follow references/test-policy.md "Pre-existing Error Cleanup" section
→ Project hand-written code? → analyze + fix
→ Auto-generated code? → record root cause, don't edit generated file
→ Third-party dependency? → document only
After code review, each Suggestion/Minor finding must be dispatched — never ignored:
Finding (Suggestion or Minor severity)
├── (a) XS/S-size fix (< 5 min, self-contained) → fix now, treat as Major
├── (b) False positive / by-design → close with written rationale
├── (c) Independent task needing separate analysis → create task with context
└── (d) Deferred → one backlog row per [`references/backlog-entry.md`](../../references/backlog-entry.md); then `node scripts/check-backlog-entries.js --backlog <resolved backlog>` (warn)
Rules:
references/backlog-entry.md).During fix loops, track cumulative risk via scripts/risk-counter.js (persisted per repo+branch — no LLM cross-round memory required):
| Event | Risk delta | Increment command |
|---|---|---|
| Fix reverted (didn't work) | +15 | scripts/risk-counter.js increment --event reverted |
| Fix touches 3+ files | +5 | scripts/risk-counter.js increment --event multi-file |
| After 10th fix in same pipeline run | +1 per add'l fix | scripts/risk-counter.js increment --event late-fix |
| Fix touches files unrelated to original change | +20 | scripts/risk-counter.js increment --event unrelated-files |
| Any other fix (just counts toward fixes total) | 0 | scripts/risk-counter.js increment --event fix |
Thresholds (orthogonal to retries-per-step below):
scripts/risk-counter.js threshold-hit; exit 1 ⇒ stop). Report: "Fix loop risk elevated. N fixes attempted, M reverted."scripts/risk-counter.js reset only after closing the pipeline runAny step fails → stop → fix → resume from that step. Never skip.
Step N fails
1. Fix the problem
2. Re-run from Step N (not Step 1)
3. Pass → continue to Step N+1
Max retries per step: 3 (counts step failures, not fix attempts — orthogonal to the 30-fix pipeline cap and the 20-risk threshold above). After 3 step failures, escalate via references/anti-rationalization.md (7-point checklist + structured failure report) before declaring inability to solve.
autopilot:dev-flow — sets session rules and advances the stage graph to qc-gate_base/prohibited-behaviors.md (opens in a new tab)references/anti-rationalization.md (opens in a new tab)references/code-review.md (opens in a new tab)references/completeness-gate.md (opens in a new tab)references/model-routing.md (opens in a new tab)references/test-integrity-gate.md (opens in a new tab)references/test-policy.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
quality-gate, pre-commit, pre-merge, code-review, test-policy
npx claudepluginhub cookys/autopilot --plugin autopilot32 skills in this plugin
/agent-callContact an already-running persistent coding-agent session via fleet v2 (fallback: Claude SendMessage + outbox). Use when: "通知 <host>", "跟 <host> 說", naming a fleet member/pane. Not for: opinions (→ consult), hetero review (→ hetero-review), new workers (→ /l4–/l6).
/auditCompare two existing implementations for feature parity and missing items. Use when: "compare X with Y", "verify X matches Y", "比對 X 和 Y". Not for: future plan review, single-bug debug, writing tests.
/brainstormPre-code Socratic design exploration that surfaces 2-3 approaches and gates coding until approved. Use when: "help me think through X", "還沒想清楚", "我不確定要怎麼做". Not for: existing options (→ think-tank), external research (→ survey), chosen approach/quick fix (→ dev-flow).
Other plugins' skills for the same job