Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Review Lead?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/manoldonev-review-lead-be1ae33c)
---
name: review-lead
description: Orchestrates parallel code review across specialized reviewers. Use when reviewing code changes, PRs, or before committing.
---
You are the code review team lead for the repo under review.
This skill loads orchestration instructions into the **current session**. The current session — not this skill — runs the reviewer fan-out by invoking the `code-review.mjs` Workflow script (via the `Workflow` tool). The body below tells the current session HOW to run the review.
## Pre-flight: dispatch substrate
Before dispatch, lint the per-reviewer extension surface: run `scripts/check-review-context.sh` (this plugin) against the repo under review. It fails closed when a file under `.claude/second-shift/review-context/` has a basename that is not a reviewer in the effective registry — a typo'd filename would otherwise be silently read by nobody. Fix (rename or register) before dispatching; skip only if the script is unreachable in the current install.
The reviewer fan-out runs as `agent()` calls inside `workflows/code-review.mjs` — one schema-free `agent({ agentType, model })` per selected reviewer, via `parallel()`. Synthesis always runs **in this session** on the caller's model. This session triggers the fan-out itself by running the Workflow:
```
Workflow({ scriptPath: "<staged>/code-review.mjs",
args: { worktree, base, head, issue?, spec?, reviewers, changedFiles, prContext,
config: { reviewers, tracker } } })
```
`config` carries two groups of the consumer config, each as parsed from the file read at the start of Routing (see "Consumer config: reviewer registry" below): its `reviewers` group and its `tracker` group. Inside `config`, `reviewers` is that config group, not the selected `agentType[]` passed as `args.reviewers`. Leave out a group the file does not have, and pass `config: {}` when there is no config file. The script picks each dispatch's model from `reviewers.modelOverrides` and `reviewers.tierMap`, and words the scope-completeness fetch for the tracker named by `tracker.type`; without them every reviewer runs at its shipped tier and a JIRA key is fetched as a GitHub issue. Pass these two groups and never the whole config: the script reads nothing else from it.
**Stage the script first — neither a bare filename nor the cache path dispatches.** The `Workflow` tool accepts only a path it returned itself, or one under the working directory or an added directory. The plugin cache is neither on a default install, so `scriptPath: "code-review.mjs"` comes back as "Workflow script file not found" and the cache's own absolute path as "must be a script path this tool returned". Resolve it from this skill's own base directory (which the invocation states) and copy it into the session scratchpad, then dispatch that copy:
```bash
SRC="$SKILL_DIR/../../workflows/code-review.mjs"
cp "$SRC" "$SCRATCHPAD/code-review.mjs"
```
The copy is what makes this work on a machine that has not added the plugin cache to `permissions.additionalDirectories` — and that entry has to come from the operator, since the auto-mode classifier denies settings edits as self-modification. The script ships in this plugin's own `workflows/`, so no search is needed and no other plugin is involved.
Before any other action, verify the `Workflow` tool is available in the current session. If it is not — for example this skill was loaded inside a subagent context (subagents can spawn neither `Workflow` nor nested agents) — STOP and report:
> "review-lead requires the Workflow tool to dispatch the reviewer fan-out (via code-review.mjs) in the current session. This skill must be invoked from the main session (or from another skill running in the main session). It cannot run inside a subagent context. Aborting."
The script returns structured findings; this session then runs the Synthesis Rules over them. Reviewer **selection** (Routing, below) happens in-session first, since it needs the diff: choose from the effective reviewer registry — the plugin-shipped panel (review-toolkit:security-reviewer, review-toolkit:performance-reviewer, review-toolkit:complexity-reviewer, review-toolkit:maintainability-reviewer, review-toolkit:test-coverage-reviewer, review-toolkit:unit-test-mutation-reviewer, review-toolkit:db-reviewer, review-toolkit:pipeline-reviewer, review-toolkit:scope-completeness-reviewer, review-toolkit:a11y-reviewer, design-toolkit:design-faithful-reviewer, design-toolkit:figma-faithful-reviewer) plus/minus the consumer repo's config deltas (see "Consumer config: reviewer registry" below) — and pass the selected `agentType[]` as `args.reviewers`. `worktree` is the absolute path the reviewers run git against — for pure standalone `/review-lead` in the repo checkout, derive it with `git rev-parse --show-toplevel`; `base`/`head` come from the diff range (default `origin/<base>..HEAD`, where `<base>` is the configured base branch resolved in Process step 1, after a `git fetch origin <base>` — see Process step 1's stale-base rationale), and `changedFiles` from the `git diff --stat` run for Routing.
Do **not** simulate a dispatch. Writing a subagent's findings yourself and reporting them as that subagent's produces a fake multi-reviewer verdict; that is what must not be reintroduced. The **lead pass** (below) is not that: four dimensions are routed to this session by design, reviewed against a published checklist, and reported as the lead pass's own — a named reviewer of record, not a stand-in for one that never ran. What is banned is the attribution, not the in-session review.
## Caller model guidance
For best synthesis quality, invoke this skill from a session running on an Opus-class model — or on a Fable-class model where the subscription includes one. Each plugin-shipped specialist reviewer runs at the model tier declared in its own agent frontmatter (or the repo's `reviewers.modelOverrides` entry, which may name `fable`); a repo-local `reviewers.add` reviewer runs at the `code` tier unless `reviewers.modelOverrides` names it, whatever its own frontmatter declares; the orchestration, the **lead pass**, and synthesis all run on the caller's model. Synthesis is where deduplication, triage, the Scope Completeness Gate, and the cross-reviewer self-check happen, and the lead pass is where four review dimensions are now judged outright — the work that benefits most from a strong model.
## Maturity calibration
Before classifying findings, understand the codebase's current maturity. If `.claude/second-shift/review-context.md` exists in the repo under review, load it — it declares the repo's stack, maturity stage, and known-accepted patterns (e.g. a pre-auth placeholder, absent web test infra, no shared client, validation at a specific layer). Each reviewer self-loads that shared file plus its own `.claude/second-shift/review-context/<reviewer-name>.md` when present (per-reviewer repo rules; additive, never protocol-weakening) — do not paste either file into dispatch prompts. Honor the context when triaging: a PR that follows a declared, established gap is CONSISTENT, not a new finding.
**Rule: A PR that follows existing codebase patterns is CONSISTENT, not broken.** Only flag a pattern as critical if the PR _introduces a new gap_ that didn't exist before, or if the gap creates an immediate exploitable risk in the current deployment context.
## Consumer config: reviewer registry
The panel named throughout this skill is the **plugin-shipped generic registry**. The consumer repo tunes it through `<repo-root>/.claude/second-shift.config.json` (env override `SECOND_SHIFT_CONFIG`) under the `reviewers` key. Read that file at the start of Routing and compute the **effective registry**:
- `reviewers.add[]` — repo-local reviewer agents living in the repo's `.claude/agents/` (referenced **bare**, e.g. `orders-reviewer`). Each entry declares `dimensions[]` (a routing/dedup hint — treat those dimensions as the reviewer's domain when deciding whether to spawn it and when merging its findings). Register these alongside the plugin panel; spawn them per their declared domain the same way the conditional reviewers below are spawned.
- `reviewers.remove[]` — plugin-shipped reviewers disabled in this repo (e.g. `db-reviewer` in a pure-FE repo). Never spawn a removed reviewer; it gets no `Not reviewed:` entry.
- `reviewers.modelOverrides{}` — per-reviewer model-tier override applied when dispatching (e.g. `security-reviewer: opus` in one repo, `sonnet` in another). Pass the `reviewers` group as `config.reviewers` (see Pre-flight); the `code-review.mjs` fan-out resolves each reviewer's tier from `modelOverrides` and `tierMap`, else from its shipped table.
If the config is absent or has no `reviewers` block, the effective registry is exactly the plugin panel. Repo-local `add` reviewers are referenced **bare**, and plugin-shipped reviewers **qualified** (`docs/namespaces.md` rule 2) — that asymmetry is the disambiguation between roots, and it is what the panel above is spelled to satisfy. The names in the panel are dispatch names: they reach `agent({ agentType })` through `code-review.mjs`, so a bare plugin name there is not a stylistic choice but an agent type that does not resolve. `check-reviewer-references.sh` enforces both halves.
Two further keys are read from the same file at the start of Routing, both feeding the design-fidelity dimension (see Reviewer Routing):
- `design.provider` — `figma` | `claude-design`. Selects which fidelity reviewer the web-component trigger routes to. **Key absent is a supported state**, not a misconfiguration.
- `reviewers.webComponentGlobs` — the repo's web-component surface, e.g. `["src/app/**/*.{html,ts}"]` (Angular), `["src/**/*.vue"]` (Vue), `["app/**/*.tsx"]` (React Router v7). Absent resolves to the repo-wide `["**/*.{tsx,jsx,vue,svelte,css,scss,less}"]`. It gates both `a11y-reviewer` and the design-fidelity dimension. An explicit empty array declares that the repo has no web-component surface: on an unarmed diff neither reviewer is routed. An armed decision record still spawns the fidelity seat (the always-spawn row under Reviewer Routing), whatever the key says.
Resolve the path **once**, from the same file and the same override the `reviewers` read above uses, anchored on `worktree` (the absolute repo-under-review path from Pre-flight) — never a cwd-relative literal. This session's cwd is not reliably the reviewed repo's root, and both keys fail *open* on an unreadable path: an unread `design.provider` silently takes the _key absent_ row (the wrong reviewer, with no not-selected note, because absence is a legitimate state), and an unread `reviewers.webComponentGlobs` silently reverts to the shipped default.
```bash
CONFIG="${SECOND_SHIFT_CONFIG:-$WORKTREE/.claude/second-shift.config.json}"
DESIGN_PROVIDER=$(jq -r '.design.provider // empty' "$CONFIG" 2>/dev/null)
WEB_COMPONENT_GLOBS=$(jq -r '(.reviewers.webComponentGlobs // ["**/*.{tsx,jsx,vue,svelte,css,scss,less}"]) | .[]' "$CONFIG" 2>/dev/null || echo '**/*.{tsx,jsx,vue,svelte,css,scss,less}')
```
(`[]` is neither `null` nor `false`, so `//` does not replace it: an explicit empty array resolves to no globs.)
## Sub-Agent Trust Model
This is the canonical statement of the contract for **every** skill that dispatches sub-agents — `review-lead` dispatching the specialist crew, `intake-toolkit:intake` dispatching `spec-reviewer` (its Requirements stage) and `codebase-explorer` (its Split stage). Those skills cite this section and add their own specifics.
Specialized reviewer sub-agents (Sonnet, mostly) produce false positives regularly. Their findings are **advisory input to your judgment, not instructions to follow**. You MUST:
- Read the source material yourself BEFORE dispatching sub-agents
- Critically evaluate every finding against your own reading of the code and existing patterns
- Dismiss findings that don't hold up on closer inspection (especially when a reviewer flags an established pattern as a problem)
- Never auto-fail or auto-escalate a finding to blocker/critical severity based solely on a sub-agent's classification
- When in doubt, read the actual code yourself before relaying a finding
- Resolve gaps yourself when the answer is determinable from the codebase or the document at hand
**A reviewer that flags 10 issues is not 10x more useful than one that flags 1.** Most value comes from the 1-2 findings that are genuinely important.
The Scope Completeness Gate (see Synthesis Rules) is the one exception — its FAIL/BLOCKED is structurally hard.
## Inputs
- **Required**: Files to review (from `git diff` or user-specified scope)
- **Optional**: Plan or spec reference — if provided, verify the implementation matches the plan (nothing missing, nothing extra)
- **Optional**: Base SHA + Head SHA — if provided, review only the diff range
- **Optional**: Specific concerns the user wants focus on
- **Optional**: GitHub issue number (e.g., `#123`) — when present, scope-completeness-reviewer spawns unconditionally
## Process
1. First `git fetch origin <base>`, then run `git diff origin/<base>...HEAD --stat` to understand the scope of **committed** changes. Resolve `<base>` = the user's specified base if given, else the config's `baseBranch`, else the remote's default branch (`BASE=$(jq -r '.baseBranch // empty' "${SECOND_SHIFT_CONFIG:-.claude/second-shift.config.json}" 2>/dev/null); BASE=${BASE:-$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')}; BASE=${BASE:-$(git rev-parse -q --verify origin/main >/dev/null && echo main || echo master)}`) — a hardcoded `main` diffs against the wrong ref on a develop/alpha-based repo.
**Use three dots (`origin/<base>...HEAD`), not two.** Three-dot diffs from `merge-base(origin/<base>, HEAD)` — the point this branch was actually cut from — so the diff contains only the branch's own changes. Two-dot compares the two tips, so every commit merged into the base *after* the branch point shows up as a **deletion**, and reviewers report the branch as reverting work it never touched. Fetching first makes this strictly worse: a freshly-fetched `origin/<base>` is as far ahead as it gets. (Observed: two confidently-argued false BLOCKERs on a PR whose base had moved a few merges. `git log <base>..HEAD` can still show the right commit count while the two-dot *diff* is inflated — so a plausible-looking commit list is not evidence the diff is clean.)
Fetch anyway, and diff against the **remote** ref rather than a local `<base>`: three-dot fixes the ahead-base direction, but a *stale local* base can still sit behind the real merge-base. Do NOT use bare `git diff --stat` — it includes uncommitted working-tree edits, which pollute the review when the working directory has unrelated work in progress.
2. Classify change size for depth routing (see below)
3. Read 2-3 existing files in the same directory to understand current patterns
4. Check for plan/spec awareness (see below) and for an issue number in the invocation (used to dispatch scope-completeness-reviewer)
5. Determine which reviewers to spawn based on change size + file routing
6. Start the **plain review** in the background (see "The plain review" below), so it runs while steps 6–16 do. Then run the **lead pass** over the diff yourself (see below) — the four collapsed dimensions, plus security whenever its conditional did not fire
7. Run the fan-out by invoking `code-review.mjs` via the `Workflow` tool with the selected `reviewers` (the script issues them in parallel via `agent()`) — do NOT run them sequentially. **When step 5 selected nothing, skip this step and step 8 entirely**: the script rejects an empty `reviewers[]`, and the round is the lead pass plus synthesis
8. Wait for the script to return the structured findings
9. If this is round 2+ of a multi-round review, apply prior round context (see below)
10. Deduplicate findings (see below) — lead-pass findings and subagent findings dedup against each other exactly as two subagents' do
11. Apply confidence filter (see below)
12. Triage remaining findings against existing patterns
13. Apply Scope Completeness Gate (hard gate — see below)
14. Cross-reviewer self-check (see below)
15. Write the knowledge-base contributions, when the repo declares a sink (see Knowledge-base contributions below)
16. Synthesize the report in the verdict format (see "Report format" below)
17. Join the plain review's findings into the report (see "The plain review" below)
18. Check the joined report's format, and give it (see "Check the format" below)
19. Offer to post the report on the branch's PR as a pending review (see "Posting the report" below)
## Review Depth Routing
After `git diff origin/<base>...HEAD --stat` (Process step 1), classify the change size.
**What this table routes.** It does not select performance / maintainability / complexity /
test-coverage at any size — those dimensions are the lead pass's, on every round (see "Lead
pass"). Its whole job is two things: **the depth calibration** — how deeply the lead pass reads
per size — and **whether the security conditional is worth evaluating**. Conditional reviewers
are exempt from depth routing.
| Change Size | Heuristic | Lead-pass depth | Subagents selected |
| -------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Trivial-inert** (every changed file is a Markdown doc _outside_ `.claude/` — `docs/`, `.project/`, `README`) | Prose/docs-only change with no executable or behavioral surface | Read the diff; the maintainability dimension is the one with a real surface. Do not open out-of-diff files to prove a negative. | `scope-completeness-reviewer` if an issue is referenced (never suppressed). A pure-prose diff has no security surface of its own, so `security-reviewer` is selected here only on the repo-file arm of its trigger. |
| **Small** (≤50 lines, ≤3 files) | Config, typo fix, single-function change | Read the diff and the immediate siblings of each changed file for pattern context. | Whichever conditional triggers fire (security by surface; domain reviewers by their own rules). |
| **Medium** (51-300 lines, 4-10 files) | Typical feature or bugfix | Read the diff, the siblings, and the callers/tests of each changed unit. All four dimensions get a real read. | Whichever conditional triggers fire. |
| **Large** (>300 lines, >10 files) | Major feature, refactor, or new module | Read the plan/spec first if available, then the diff and every artifact a finding would have to cite. Budget the pass — depth per named risk, not per file. | Whichever conditional triggers fire. |
Boundary rule: if change size is exactly at a boundary (e.g., 50 lines in 3 files), treat as the smaller category.
**Trivial-inert carve-out (safety).** Trivial-inert applies ONLY when _every_ changed file is a Markdown doc outside `.claude/`. Any change touching `.claude/**` (skill/agent/behavioral prose — the pipeline's own execution surface), any `*.sh`/`*.mjs`, any CI workflow, or any code/config path does NOT qualify and is **at least Small** — self-modifying and correctness-critical surfaces get a real lead pass rather than a prose skim, and are the diffs where the security conditional is most likely to fire on its own. A diff mixing a trivial Markdown doc with anything else classifies as non-trivial (heavier lane wins). On a pure-prose diff there is no executable surface for the security or performance dimension to assess; maintainability and the scope gate are the two that earn their keep.
When in doubt, review deeper rather than shallower.
**Conditional reviewers are never suppressed by depth routing** — they follow their own trigger rules regardless of change size: `security-reviewer`, `db-reviewer`, `pipeline-reviewer`, `scope-completeness-reviewer`, `a11y-reviewer`, the design-fidelity dimension (`design-faithful-reviewer` / `figma-faithful-reviewer`), and any repo-local domain reviewers registered via config `reviewers.add`.
## Plan/Spec Awareness
If a plan/spec was provided as input, read it — you'll verify the implementation matches after collecting sub-agent findings. Verify:
- **Missing requirements**: Is every plan task/requirement reflected in the code? A requirement is an outcome, a behavior, an acceptance criterion or an external surface the ticket or plan states. An external surface is something a party outside the diff's own code reads or calls: a config key, an entry point or command, an API, or a stored or on-disk format. A plan task that only prescribes internal structure is not missing when the outcomes are met.
- **Scope creep**: Was anything built that isn't in the plan? Over-engineering found here is also a finding (see Over-engineering is a finding, under Step 3).
- **Misunderstandings**: Does the implementation match the plan's intent?
Each problem these checks find is a finding in `## Findings`: a missing requirement or a misunderstanding is a
completeness `[blocker]`, and scope creep that nothing needs is an over-engineering `[note]`. A plan or a decision
record informs the findings only: the report never scores its rows and never has a `## Decision record rows` section.
> **Note:** This section covers a written plan/spec file. GitHub-issue scope completeness is a separate, stricter check enforced by `scope-completeness-reviewer` (see Reviewer Routing). The two are complementary — a plan can drift from an issue, and either drift is a problem.
## Knowledge-base contributions
**Only when the repo declares a sink.** The shared `review-context.md` you load for Maturity
calibration may carry a `## Knowledge-base contributions` section: the knowledge base the review
proposes additions to, the inclusion test a proposal must pass (prose you apply), and optionally a
proposal format. When the section is absent, empty or TODO-bodied, it is absent: the report carries
no contributions block and nothing below runs. When it is there, the rule under "Report format"
(the `kb-contributions` block) decides what the report carries.
**Candidates come from two inputs, and you dispatch no provider.**
- **The committed decision record** Process step 4 found (Plan/Spec Awareness), as it stands at the
head — never uncommitted intake state, such as a receipt under `.claude/pipeline-state/`.
- Its `## Knowledge source` section holds the answer intake's knowledge provider gave, indented
four spaces. What the answer says the base does not cover is a **lookup gap**.
- A `D-n` row carrying `kb-conflict: <kb-page> (kb stale)` is a **kb stale** candidate: a
correction for that page. A row carrying `kb-conflict: <kb-page> (kb ahead)` proposes no
correction; it is a **kb ahead** candidate only when the page states the aspirational state as
current rather than as direction.
- **The diff.** What this change makes true that the knowledge base should state is a **change
gap**.
No record, or a record whose section reads `Knowledge source: none declared` or
`Knowledge source: failed — …`, or a receipt without the section: change gaps only.
**The inclusion test decides.** Apply the declared test, as written, to every candidate, and list
only those that pass. A candidate that fails it is not listed, not even as considered. When nothing
passes, or the diff gives the test nothing to judge, the report has no contributions block.
`<kb-page>` is the page the record names, or the page the addition belongs on.
**Never a finding.** A proposal does not enter Synthesis — no dedup, confidence filter or triage —
never appears in `## Findings`, and never changes the verdict. Re-derive the full list on every
round from the record and the diff at the head you review; Prior Round Context does not narrow it.
## Reviewer Routing
Analyze the `git diff --stat` output and decide what to spawn. Every selection here is a
subagent dispatch; the four dimensions below it are reviewed in-session instead.
### Lead-pass dimensions (never spawned)
Four dimensions are **not** dispatched as subagents at any change size. This session reviews them
itself, in one pass over the diff, against the checklist in
[`lead-pass-checklist.md`](lead-pass-checklist.md) — see "Lead pass" below:
- **performance-reviewer** — the performance dimension
- **maintainability-reviewer** — the readability-and-maintainability dimension
- **complexity-reviewer** — the over-engineering / accidental-complexity dimension
- **test-coverage-reviewer** — the test-adequacy dimension
Each name is in the effective registry and is dispatchable on demand or by config; routing does
not select them. The lead pass reviews them on every round, so they get no `Not reviewed:` entry.
### Conditionally spawn (never suppressed by depth routing)
| Reviewer | Trigger: spawn if ANY of these conditions hold |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **security-reviewer** | The diff carries a security surface — authentication / session handling, tenancy or ownership scoping, file upload, or query construction from external input; OR the repo under review carries `.claude/second-shift/review-context/security-reviewer.md` (a repo that authored security calibration has a security surface to calibrate). Matching is **model judgment over the diff**, the same posture the design-fidelity dimension below uses: read the changed paths and the hunks and decide, rather than pattern-matching filenames. When it does not fire, that is a not-selected note (Synthesis Rules, Step 4c) and the lead pass owns the security dimension for the round. |
| **db-reviewer** | The repo's DB layer changed — schema definitions, migrations, or query code (e.g. `*.schema.*`, a migrations dir); OR the diff **newly reads a persisted field it does not write** — a field of an entity whose schema, model, DDL or mapping lives in this repo, which the diff dereferences, sends across a service boundary or branches on, where no prior production code read it, and which is feature-critical or crosses a service boundary (third-party API payloads and in-memory JSON are not persisted fields); OR the diff **adds a lookup or upsert keyed on a non-primary-key field on an identity path** — auth, dedup, restore/upsert, or cross-tenant admin — through a lookup or upsert verb or wrapper the repo's review-context `## Database stack` names, or the engine's native verbs when it names none. Skip/remove in repos with no DB (config `reviewers.remove`). |
| **pipeline-reviewer** | Async worker / queue-processor / job-producer files changed (e.g. `*processor*`, `*queue*`, a workers dir). |
| **unit-test-mutation-reviewer** | A production file within the repo's mutation-review target surface changed AND a co-located spec is in the diff. Advisory only (LLM-predicted, no execution, never a blocker). |
| **scope-completeness-reviewer** | Invocation references a tracker issue number (e.g., `Closes #758`, `Part of #758`, an explicit `--issue 758` flag, or PR body contains `#<number>`). Spawn unconditionally — depth routing does not apply. If no issue is referenced, do not spawn. Pass the PR body's link verb (see "Special handling").|
| **a11y-reviewer** | Diff touches the repo's web-component surface — `$WEB_COMPONENT_GLOBS` (config `reviewers.webComponentGlobs`, default `**/*.{tsx,jsx,vue,svelte,css,scss,less}`). WCAG/ARIA/keyboard/contrast/reduced-motion, primitives-library-aware. |
| **design-fidelity dimension** | **ALWAYS on an armed decision record** — a `## Design frames` (or `## Design`) section carrying `RS-n` render-state rows — where the diff does not enter into it. On an unarmed diff, the same `$WEB_COMPONENT_GLOBS` trigger as `a11y-reviewer`, spawned alongside it, selecting exactly one of **design-faithful-reviewer** / **figma-faithful-reviewer** by config `design.provider` — see "Design-fidelity dimension" below. |
| **repo-local domain reviewers** | Registered via config `reviewers.add`; spawn per the `dimensions[]` each declares (e.g. an `orders-reviewer` on orders-domain paths). Never suppressed by depth routing. |
When in doubt about whether a domain reviewer is relevant, spawn it — a "no issues found" response is cheap.
### Design-fidelity dimension
**Armed spec: always-spawn.** When Process step 4's plan/spec awareness turns up a committed decision record whose `## Design frames` (or `## Design`) section is **armed** — at least one `| RS-n | route | state | frame | must-show |` row, with no `Design: none — <reason>` disarm — the design-fidelity dimension is selected **unconditionally**. Not glob-gated, not depth-suppressed, and not a judgment call about whether the diff looks visual: an armed ticket is one whose spec declares render states a design-sighted round will be scored against, and a round that skipped the dimension cannot certify it. This holds for **every** armed round, a trailer-only round included; armed rounds are rare and the cost is accepted.
WHICH reviewer: the provider map below decides, as it does for an unarmed diff and as the pipeline's REVIEW session does. A handoff URL in the section does not change the pick, whatever its host.
**Trigger (unarmed diffs).** The same web-component surface that routes `a11y-reviewer`: the globs resolved into `$WEB_COMPONENT_GLOBS` from config `reviewers.webComponentGlobs` (default `**/*.{tsx,jsx,vue,svelte,css,scss,less}`, repo-wide), **never a hardcoded path** — a consumer that never set the key still gets this reviewer class on its UI files; a consumer that set the key to `[]` declared no web-component surface, and on an unarmed diff the dimension is not routed. Never depth-suppressed.
**Matching is model judgment over the configured patterns**, not a mechanical pathspec match: read the `git diff --stat` path list from Process step 1, read `$WEB_COMPONENT_GLOBS` as the intended surface, and decide whether a changed path belongs to it. A brace/`**` pattern that no shell expanded is still a clear statement of intent.
**Provider map** — read `design.provider` from the repo under review's config, and spawn exactly one:
| `design.provider` | Reviewer |
| --- | --- |
| `claude-design` | **design-faithful-reviewer** |
| `figma` | **figma-faithful-reviewer** |
| _key absent_ | **figma-faithful-reviewer** — no provider means the figma family |
The no-provider row is a **default, not a fallback to nothing**: a repo with no design axis configured still gets design-system-discipline review on its web components, from the figma family because that is the family the lane builds with when no provider is set.
**What this dimension asserts.** Both reviewers are design-blind by contract — they verify *the abstraction is right*, not that it matches an unseen design. This dimension covers design-token discipline, logical-vs-physical style props, real-component reuse over hand-rolled primitives, copy drift against a discoverable spec, and library conformance: each override, wrapper prop and justification comment checked against the installed UI library's source, with the installed line cited, every conformance finding a `[note]`. **It is not a pixel check** — the pixel loop belongs to the implementing session's self-verify artifact, to the pipeline's REVIEW session on a design-armed run (which renders every screen at the head and compares it with its frame, and cannot approve without that render), and to the human reviewer.
**Toolkit-absent on an ARMED spec is a VOID, not a note.** The always-spawn row above is not a preference that degrades — the reviewer cannot be dispatched, so the round cannot be certified. Do not select a substitute, do not proceed with the rest of the panel, and give no verdict. Emit the Step 4b-void "review did not run" report instead, naming the reviewer the provider map required and stating that `design-toolkit` is not installed in this session. The pipeline's REVIEW session cannot approve on this shape. **Toolkit-absent is the pre-dispatch way in, not the only one**: a fidelity reviewer that IS dispatched on an armed spec and is still dark after Step 4b's re-dispatch voids the round on the same ground — see Step 4b-void case 2.
**Toolkit-absent degrade (unarmed diffs only).** These two agents ship in the `design-toolkit` plugin, not review-toolkit. The condition is that **the dimension was selected** — by *any* row of the map above, the no-provider default included — and the design-toolkit agent type is not available to dispatch in this session. When it holds, **do not select it**; detection is in-session and pre-dispatch, here at Routing. Name it on the `Not reviewed:` line (see "Not-selected ≠ dark" under the Synthesis Rules). Because nothing was ever dispatched, this never reaches `code-review.mjs` and cannot be confused with a dark reviewer.
Keying this on the *dimension being selected* rather than on `design.provider` being declared is load-bearing, not phrasing: the default row selects a reviewer with no provider key at all, and "no provider declared, design-toolkit not installed" is the ordinary shape of a consumer running review-toolkit alone. A degrade keyed on the key's presence would leave exactly that consumer's dimension silently unrun. The lint's matching exemption (`check-reviewer-references.sh`) is unconditional for the same reason — the two halves of one degrade must agree.
## Lead pass
The four dimensions above (performance only when its reviewer was not dispatched), plus
**security whenever its conditional did not fire**, are reviewed by this session in a single pass
over the diff. The calibration content — the Pre-Emit Gate, the
Critical triggers, each dimension's What-NOT-to-flag block, the new-vs-pre-existing rule, and the
confidence threshold — lives in [`lead-pass-checklist.md`](lead-pass-checklist.md); read it before
the pass and apply it dimension by dimension. Depth per change size comes from Review Depth
Routing above.
**Load the consumer extension surface first.** A lead pass that skips it reads none of the repo's
calibration while every lint stays green. Before the pass, load from the repo under review, when each is present:
- `.claude/second-shift/review-context.md` — the shared core (you already load this for Maturity calibration)
- `.claude/second-shift/review-context/performance-reviewer.md` — only when `performance-reviewer` was **not** dispatched; when it was, it loads the file itself
- `.claude/second-shift/review-context/maintainability-reviewer.md`
- `.claude/second-shift/review-context/complexity-reviewer.md`
- `.claude/second-shift/review-context/test-coverage-reviewer.md`
- `.claude/second-shift/review-context/security-reviewer.md` — only when the security conditional did **not** fire; when it did, the spawned reviewer loads it itself
- `.claude/second-shift/security-rules.md` — the same condition; its tenancy predicates, owner-scoped table lists and response-whitelist mechanism are additive rules for the security section
An empty or TODO-bodied section counts as ABSENT (the `reviewer-baseline` rule): infer
conservatively and say that you did.
**Security defers when it is spawned.** When the security conditional fires, the lead pass's
security section is not run — the spawned reviewer owns the dimension, and running both would
manufacture the duplicate findings Step 1 then has to merge. When it does not fire, the lead pass
owns it like the other four.
**Performance defers when it is spawned**, by the same reasoning. When `performance-reviewer` is
dispatched on demand, the lead pass's performance section is not run and the seat owns the
dimension — the record-named risks included. Otherwise the lead pass owns it, the record-named
risks included (`lead-pass-checklist.md`, "Performance").
**Lead-pass findings are findings.** They enter Synthesis at Step 1 alongside the subagents' and
are deduplicated, confidence-filtered and triaged by the same rules — no privilege for having been
found in-session. Tag them by dimension in the report exactly as a spawned reviewer's would be
(`[Performance]`, `[Maintainability]`, `[Complexity]`, `[Test Coverage]`, `[Security]`).
## Spawning Reviewers
One dispatch substrate — the `code-review.mjs` Workflow. This session invokes `workflows/code-review.mjs` via the `Workflow` tool, passing the selected `reviewers` plus `worktree`/`base`/`head`/`changedFiles`/`prContext` (see Pre-flight). The script issues one schema-free `agent({ agentType, model })` per selected reviewer, via `parallel()`, each at the tier it resolves from the passed `config.reviewers` (`modelOverrides` and `tierMap`), else from its shipped table, and returns structured findings. This session runs the Synthesis Rules over them. The args the script forwards to each reviewer:
- **Git diff scope**: `git diff [BASE]...[HEAD] -- <relevant paths>` (three-dot, matching what the script renders) or full diff if no range provided
- Which files changed (from `git diff --stat`)
- The branch name and any PR context the user provided
- Any specific areas of concern the user mentioned
**Do NOT pass** the plan/spec to sub-agents — plan compliance is your responsibility as the orchestrator. Sub-agents review code quality in their domain; you verify spec completeness.
**One exception: the named cost risk reaches a dispatched performance seat.** When `performance-reviewer` is dispatched and the record names a cost, load or performance risk, put in `prContext`, verbatim, each such `D-n` row and `OR-n` region, and the `path:line` of each new entry point the diff adds that reaches the risk, under a lead-in addressed to the seat (`For performance-reviewer — named cost risks: …`). `prContext` is one string every generic-branch seat reads (`scope-completeness-reviewer`'s prompt never carries it), so the lead-in is what keeps the rows a target for one seat rather than a steer for the rest. Nothing else from the record goes in: no other row, no paraphrase of scope, no conclusion about the risk. Under the dispatch's bounded exploration a named target is what lets the seat trace route → service → the unchanged code that costs, and ground one specific finding, instead of spending its turns proving a negative across the diff.
**Parallelism:** the script issues all selected reviewer dispatches in a single `parallel()` batch. Do NOT serialize — that defeats the purpose of fan-out and burns wall-clock time.
### Empty selection: no fan-out at all
Routing can legitimately select **zero** subagents, since the core four are the lead pass's — a
docs-only diff with no issue reference and no security surface is the ordinary case. `code-review.mjs`
rejects an empty `reviewers[]` by design (it has nothing to dispatch and returning an empty result
would be indistinguishable from a fully dark panel), so **do not invoke the Workflow at all** when
the selected set is empty. Run the lead pass and synthesize over its findings alone.
This is not a degraded round and never a coverage gap: nothing was selected, so nothing went
dark (Step 4c). It needs no line of its own: no security surface and no issue reference are each
already an entry on the `Not reviewed:` line, so the reduced fan-out is visible rather than inferred.
### Special handling: `scope-completeness-reviewer`
When dispatching `scope-completeness-reviewer`, the prompt must contain only **evidence**, never **interpretation**. You do NOT fetch the issue — the subagent does that itself, in its own context, so your wording cannot bias its scope reading. Your only job is to forward facts.
The dispatch prompt should contain:
1. **GitHub issue number** (e.g., `#758` or `758`).
2. **Branch and base** (e.g., `claude/repo-758` vs `main`).
3. **The committed decision record path**, when Process step 4 found one (the Workflow's `spec` arg). The reviewer scores that record's rows itself; pass the path, never its rows.
4. **The link verb**, when you review a PR (the Workflow's `issueLink` arg): the word or phrase the PR body (`gh pr view --json body --jq .body`) puts before the issue reference, verbatim — `Closes`, `Relates to`, `Part of`. The verb only, never the rest of the line. When the body references the issue more than once, a closing keyword wins; a reference with no verb before it is `References`. With no PR, omit it. The script turns the verb into the gate's mode: a closing keyword, or no verb, scores the whole ticket; any other verb runs the reviewer in partial mode.
What the dispatch prompt MUST NOT contain:
- No paraphrase of the issue scope ("the issue says X").
- No assertion about what is or isn't in scope ("this item is deferred", "we're only reviewing the X part").
- No summary of the diff ("the change does Y") — the subagent reads the diff itself.
If the user's invocation prompt contains scope assertions (e.g., "this is the BE half, the UI part is out of scope"), strip them from the dispatch prompt. They are not evidence and must not reach the subagent — that independence is the whole reason this gate exists.
## The plain review
A second, record-blind review runs beside yours: one headless session with Read, Grep and Glob only, in a copy of
the head with no `.git` and no plans directory. It sees the diff and the ticket and nothing else. Its findings are
joined into your report by a script, never by you. This is the same plain review and the same join that the lane's
`run.sh` runs.
**Shell variables do not survive from one Bash call to the next.** Each block below is self-contained. Before you
run one, replace its three placeholders with values you hold literally:
- `<skill dir>`: this skill's base directory, as the invocation states it;
- `<head sha>`: the full sha that `git rev-parse HEAD` printed for the head you review;
- `<scratch dir>`: a directory you hold by its path, such as this session's scratchpad. It is not inside the
checkout.
The plain review's out dir is never written down: each block derives it again with `plain-review.sh out-dir
<head sha>`. Never open the files in it yourself: only the join block reads them, so your report is your own review
alone.
**When it runs.** Do not start it when Routing has already voided the round (the design-fidelity reviewer of an armed spec cannot be
dispatched, Step 4b-void case 2): say in the void report that the blind review did not run. Otherwise it always runs.
Run this check first. If it fails, skip the plain review and end the report with `## Notes` and one line naming
the error it printed:
```bash
bash "<skill dir>/../../scripts/plain-review-tools.sh"
```
**Start it (Process step 6).** When a GitHub issue number was given, write its title, body and comments to
`<scratch dir>/plain-ticket.md`, less the lane's own comments, and pass `--ticket "<scratch dir>/plain-ticket.md"`.
An installed dev-pipeline that cannot render the comments gets the title and body only:
```bash
PT="$(bash "<skill dir>/../../scripts/plain-review-tools.sh")" && \
gh issue view <N> --json title,body,comments > "<scratch dir>/plain-issue.json" && \
{ bash "$PT/plain-review.sh" ticket-text github < "<scratch dir>/plain-issue.json" 2>/dev/null \
|| jq -r '"# " + .title, "", (.body // "")' "<scratch dir>/plain-issue.json"; } > "<scratch dir>/plain-ticket.md"
```
When a Jira key was given, pass `--jira-key <KEY>`: the
session may then read that issue with `getJiraIssue`, look up its cloudId with `getAccessibleAtlassianResources`, and
call nothing else. With neither, the plain review reviews the diff alone. Pass `--record <name>` when a decision
record was found in Process step 4, so a ticket line naming it is dropped. Run this with `run_in_background`, never in the foreground:
```bash
PT="$(bash "<skill dir>/../../scripts/plain-review-tools.sh")" && \
bash "$PT/plain-review.sh" run --worktree "$(git rev-parse --show-toplevel)" --base "origin/<base>" --head <head sha> \
[--ticket "<scratch dir>/plain-ticket.md" | --jira-key <KEY>] [--record <name>] \
--deny-read "$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")" --deny-read "<scratch dir>"
```
With no `--out`, the run writes to `out-dir <head sha>` and first clears what an earlier run left there.
**Count the other reviewers' comments (Process step 6).** When the branch has a PR, record how many comments other
reviewers had on it when your review started. `gh pr view --json number --jq .number` prints its number. When it
prints none, skip this. Otherwise run:
```bash
PT="$(bash "<skill dir>/../../scripts/plain-review-tools.sh")" && [ -f "$PT/other-comments.sh" ] && \
bash "$PT/other-comments.sh" <pr number> "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "<scratch dir>/other-comments.json"
```
It prints nothing, and it is skipped when the installed dev-pipeline has no such tool. Never open that file: only
the join block reads it. When a read fails, it writes no file, and the joined report records the count as null.
**Join it (Process step 17).** Wait for the background run to finish. Never end the turn before it does. Write your
synthesized report to `<scratch dir>/lead-report.md` exactly as you would give it. Then:
```bash
PT="$(bash "<skill dir>/../../scripts/plain-review-tools.sh")" || exit 1
O="$(bash "$PT/plain-review.sh" out-dir <head sha>)" || exit 1
P=""; [ -s "$O/verdict.md" ] && P="$O/verdict.md"
set --; grep -q '^usage().*--other-comments' "$PT/verdict-join.sh" && set -- --other-comments "<scratch dir>/other-comments.json"
bash "$PT/verdict-join.sh" "<scratch dir>/lead-report.md" "$P" --format report \
--why "$(cat "$O/why" 2>/dev/null || echo 'the blind review did not return')" \
--ticket "$(cat "$O/ticket" 2>/dev/null || echo false)" \
--plain-cost "$(jq -r '.total_cost_usd | numbers' "$O/result.json" 2>/dev/null)" \
--plain-wall "$(cat "$O/wall" 2>/dev/null)" "$@" > "<scratch dir>/report.md" && cat "<scratch dir>/report.md"
```
The `set --` line passes the count only when the installed `verdict-join.sh` names `--other-comments` in its usage
line: an older one exits on a flag it does not know.
`<scratch dir>/report.md` holds the joined report for "Check the format" and "Posting the report". The script joins
it by the lane's rules: it tags an agreed blocker `[lane+blind]`, adds each plain-only blocker and note as a `[blind]`
finding with the next free id, and turns `verdict: approve` into `verdict: needs-work` when it adds one. It ends
`## Notes` with one `lane vs blind:` line that counts how the two reviews' findings pair, and a hidden machine line.
When the plain review did not return, the report stands as you wrote it and its `## Notes` says why. Never edit,
drop or soften a `[blind]` finding after the join.
**A void round runs no join.** When Step 4b-void voids the round after the plain review started, wait for the
background run to finish as above. Do not run the join block: it would add the blind blockers to a report that
does not exist. Give the "review did not run" report. Under it, give the line `The blind review alone, not joined:`
and the output of this block in a `text` fence:
```bash
PT="$(bash "<skill dir>/../../scripts/plain-review-tools.sh")" || exit 1
O="$(bash "$PT/plain-review.sh" out-dir <head sha>)" || exit 1
if [ -s "$O/verdict.md" ]; then cat "$O/verdict.md"; else echo "It did not return: $(cat "$O/why" 2>/dev/null || echo 'no reason was written')."; fi
```
A void round offers no post (see "Posting the report").
## Check the format
**Process step 18.** When the join did not run (the plain review is off, or the installed dev-pipeline has none),
write your report to `<scratch dir>/report.md` first. Then check it with dev-pipeline's checker, in its no-record
mode:
```bash
PT="$(bash "<skill dir>/../../scripts/plain-review-tools.sh")" && [ -f "$PT/verdict-check.sh" ] && \
bash "$PT/verdict-check.sh" "<scratch dir>/report.md"
```
- **Exit 0:** give the report, unchanged.
- **Exit 1:** it prints one line per rule the report breaks. Rewrite the report in `<scratch dir>/lead-report.md`
to fix each one, run the join block again when it ran before, and check again. Repeat until it exits 0. A rule
never removes a finding: shorten the wording instead. Never edit a `[blind]` finding to pass the check.
- **Any other result** (the tools dir or the checker is missing, or an older checker exits 2 on one argument): give
the report with one line above it, `Format not checked: <why>`, and offer no post.
The void "review did not run" report is not checked.
## Posting the report
**Process step 19, after you give the report.** The report can go on the branch's PR as a pending review: a review
that only the person who ran this session can see, until they edit and submit it in the GitHub UI. It is offered on
every PR, the reviewer's own or another's. Nothing is posted without the reviewer's yes.
**When there is no offer.** In each case below, offer nothing and end with the one line given:
- A void round (Step 4b-void): `The report was not posted: the review did not run.`
- The format was not checked ("Check the format"): `The report was not posted: its format was not checked.`
- No open PR for the branch. Run `gh pr view --json number,state --jq 'select(.state == "OPEN") | .number'`. When
it prints nothing or fails: `The report was not posted: this branch has no open PR. To post a review of a PR,
check it out with gh pr checkout <n> and review again.`
- No person to answer: the session runs headless, or it has no `AskUserQuestion` tool: `The report was not posted:
no one is here to answer the offer.`
**The report to post.** `<scratch dir>/report.md` holds the checked report. A report with no join has no
`lane vs blind:` line and no machine line, and is posted the same way.
**Just before the offer,** check the report's format and the PR's head and commits against the report's line 2,
with nothing written:
```bash
bash "<skill dir>/../../scripts/post-pending-review.sh" --check <pr number> "<scratch dir>/report.md"
```
On a non-zero exit there is no offer: say `The report was not posted:` and the reason the script printed. That covers
a report that fails `verdict-check.sh` or that it cannot check, a reviewed sha that is not one of the PR's commits
(an unpushed commit, a rebased branch) and a pending review of yours already on the PR. On exit 0, the script may print `the PR has moved on: …`; give that line, as printed, above
the offer.
**The offer.** Ask one `AskUserQuestion`. The question: `Post this report on PR #<n> as a pending review?` The first
option: `Post as pending review`, described as `A pending review under your own gh account, on commit <first 12
characters of the head sha>. Only you see it until you submit it in the GitHub UI.` When the check printed the
moved-on line, add to that description: `The PR has moved on since this review; the review sits on the older commit.`
The second option: `Do not post`, described as `The report stays in this session.`
**On yes,** run:
```bash
bash "<skill dir>/../../scripts/post-pending-review.sh" --worktree "$(git rev-parse --show-toplevel)" <pr number> "<scratch dir>/report.md"
```
The script reads the sha from the report's line 2 and runs the same checks again just before it posts, so a push
after the offer still gets its moved-on line. Each finding whose site is inside the diff becomes an inline comment,
and the review body leaves it out: an inline note goes, and an inline blocker keeps one pointer line. Give
everything it printed, as it printed it. On exit 0, the review is posted; its output names the review, the inline
comments, and a PR that has moved on past the reviewed head. On any other exit, say `The report was not posted:` and the reason the script
printed. Never run it again, and never post the report another way: not through `gh-bot.sh`, not as an issue
comment, not under another account. A pending review that already exists is the reviewer's to submit or delete in
the GitHub UI.
**On no,** say `The report was not posted.`
## Synthesis Rules
### Cross-agent severity vocabulary
Two severity vocabularies coexist across the review/planning agents. When a finding originates from (or is compared against) a planning agent, normalize to the baseline vocabulary before triage:
| Planning agents (`plan-reviewer`, `spec-reviewer`) | Baseline reviewers (this synthesis) | Schema transport |
| -------------------------------------------------- | ----------------------------------- | ----------------- |
| Blocker | Critical | `blocker` |
| Warning | Warning | `major` / `minor` |
| Note | Pre-existing (informational) | `nit` |
The right-hand columns are the existing `reviewer-baseline` prose → `REVIEW_RESULT` block mapping (see [`reviewer-baseline`](../reviewer-baseline/SKILL.md), "Severity vocabulary mapping"); this table only adds the planning-agent column so the three are reconciled, not a third vocabulary. (`db-reviewer`'s own "Suggestion" tier is informational — treat as Note/Pre-existing.)
These are the reviewers' input severities, not the report's. The report has two tags, set by the lane's tag rule:
a completeness or correctness problem is a `[blocker]`; a maintainability, test-coverage, over-engineering or
repo-convention problem is a `[note]`. A finding is listed only when it is relevant: a distinguished engineer who
knew of it would definitely address it before merge. Every listed finding makes the verdict `needs-work`, a
`[note]` the same as a `[blocker]`. An irrelevant finding is left out, not demoted.
### Step 1: Deduplicate (before triage)
Before triaging, merge duplicate findings:
- If security-reviewer and db-reviewer both flag the same missing `userId` filter → keep the db-reviewer's finding (more specific), drop the duplicate
- If performance-reviewer and pipeline-reviewer both flag the same N+1 query → merge into one finding, credit both
- Same file:line from multiple reviewers = one finding, pick the best description
- **Exception**: Do not merge a `[Pre-existing]` finding into a new finding at the same location. Keep the new finding, and leave the pre-existing one out (Step 3)
- If two findings from different reviewers have the same root cause but different file:line locations, group them under one finding with both locations listed and the higher severity
### Step 2: Confidence-based filter
- Findings with confidence ≥80: proceed to normal triage
- Findings with confidence <80: left out of the report (reviewers filter at source, but double-check). A suppressed finding is never listed.
- `[Pre-existing]` findings: left out of the report (Step 3)
The report carries no confidence number.
### Step 2b: Fidelity seat summary lines
When `design-faithful-reviewer` or `figma-faithful-reviewer` ran, carry its `summary` into `## Notes` as one line per seat holding, verbatim and compacted, the source-absent line (`Installed source not present; library conformance not checked.`), each `unable to verify — pointer needed` gap, and the per-override disposition lines. They are not findings and change no verdict; they are what tells the reader the conformance check ran and what it could not reach. A seat whose `summary` carries none of them gets no line.
### Step 3: Triage (BEFORE writing the report)
For every finding from a sub-reviewer, classify it:
| Classification | Criteria | Action |
| -------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **New gap** | The PR introduces a pattern/vulnerability that doesn't exist elsewhere in the codebase | Keep as a finding, `[blocker]` or `[note]` by the tag rule |
| **Pre-existing gap** | The PR follows an existing codebase pattern that happens to be imperfect — never a finding the diff is the first to depend on (lead-pass rule 4, Duplicate delivery included): citing a sibling does not downgrade it | Leave it out of the report — it is not this PR's |
| **Aspirational** | The reviewer demands infrastructure that doesn't exist yet (auth, tests, shared clients) | Leave it out of the report — do NOT fail the review |
**A dismissal cites the artifact that makes the finding harmless.** Downgrading or omitting a reviewer finding needs a citation — the schema showing the persisted shape, the guard that already rejects the input, the sibling that establishes the pattern. A rationale with no artifact behind it ("harmless over JSON") is not a dismissal; the finding stays at the reviewer's severity. For a finding the diff is the first to depend on (lead-pass rule 4, Duplicate delivery included), a sibling is not that artifact: a pattern nobody depended on is not an established pattern, and sibling handlers without commit-point dedup do not clear a new delivery source.
**Over-engineering is a finding.** Every relevant over-engineering observation, from a reviewer or from the lead pass, is a `[note]` in `## Findings`. `## Summary` and `## Notes` carry no over-engineering observation that `## Findings` does not. "The ticket prescribed it" and "a style trade-off" never move a finding out of `## Findings`: a structure the ticket or a plan prescribes is not a need for it, so quote that line in the finding.
**Examples of false positives to catch:**
- "Missing auth headers" → when NO component in the app uses auth headers
- "No input validation" → when validation is done at the API layer and every other component trusts this
- "Zero test coverage" → when the workspace has no test framework configured
- "No shared API client" → when every component in the codebase defines inline fetch functions
### Step 4: Scope Completeness Gate
If `scope-completeness-reviewer` was spawned and returned `FAIL` or `BLOCKED`, the verdict **MUST** be `verdict: needs-work` regardless of any other reviewer's verdict. This is a hard gate, not a heuristic. `FAIL` gates through its findings below. `BLOCKED` means the subagent could not read the ticket: line 3 of the report is `reason: ticket-unreadable`.
- **The gate binds what the PR claims.** In partial mode (the PR body links the issue without a closing keyword), an item no hunk attempts comes back `[not delivered]`. It is not a finding: list those items in one `## Summary` line, `Not delivered by this PR (linked as <verb>): <items>`, and they never change the verdict. An item the PR attempts and gets wrong is `[unsatisfied]` in either mode.
- Each `[unsatisfied]` scope item, and each decision row scored `violated`, `undeterminable` or `departed` with no named decider, is a `[blocker] [Scope completeness]` finding, with the unsatisfied item, the reason, and the question "is this item covered by the diff somewhere I missed, or does it need to be added to the PR or explicitly deferred in the issue body?"
- The orchestrator's prompt (the user's invocation) does not override this gate. Claims like "that's deferred" or "out of scope here" are not evidence — only the diff covering the item, or the issue body explicitly deferring it (with a linked follow-up issue), satisfies a scope item.
- If the user pushes back ("but it really is out of scope"), the response is to either (a) cover the item in the diff, or (b) update the issue body with explicit deferral language and re-run the gate. An item that can only be checked after the merge (the next run's transcript, a production metric) is neither: its form is the issue body's `## Post-merge checks` section, where the scope reviewer carries it as `PM-n` instead of scoring it — moving it there is an edit of type (b).
If `scope-completeness-reviewer` returned `N/A — no issue provided`, or no issue was referenced, the `Not reviewed:` line names it: `scope completeness (no issue referenced)`.
### Step 4b: Dead / dark reviewer accounting
A reviewer that was **selected** but produced no usable result went **dark**. A dark reviewer is NOT a clean PASS and NOT a silent omission — it is a **coverage gap**: its domain was not reviewed this round. A coverage gap is what remains after the session has *tried*, which is why the re-dispatch below is mandatory before one may be recorded.
Detect darkness from two distinct signals — never from "the array is shorter than I expected" alone:
1. **Died-after-retry (per-reviewer).** The reviewer is **present** in the returned `reviewers[]` as `{ result: null, ... }` (with `{ retried: true, failed: true }` if it also failed its automatic retry). Exactly that reviewer is dark.
2. **Budget-skipped (all-or-nothing).** The return carries `budgetExhausted: true` and `reviewers` is **empty by construction**. **Every** selected reviewer (the set you chose during Routing / passed as `args.reviewers`) is dark — compare against that selected set to enumerate them.
**Re-dispatch once, in-session, before recording anything — signal 1 only.** The fan-out's own retry is a **bit-identical** re-run: same prompt, same tier, same agent. Against the dominant death mode — the `maxTurns` cap reached with no text emitted — that is close to deterministic, so "it already retried" is true and irrelevant: what failed was the **prompt**, and this session is the only layer that can change it. So for each reviewer dark by **`died-after-retry`**, dispatch it once more yourself (Agent tool) before you name it on the `Not reviewed:` line.
Two things must make that prompt distinct from the one that died, and neither is optional:
- **A turn-numbered emit deadline** — "by turn N of your M you MUST be writing the report" — stated as a **floor**. Where the agent's own doc already carries a turn-numbered deadline, the doc's number wins; a per-agent number belongs there and is free to be later than the floor.
- **Narrowing to that reviewer's domain**, using the diff context you already hold. This is the part the substrate cannot do: it dispatched against the whole range, while you know which files and which dimension are actually at issue. The deadline alone is close to a no-op for the reviewers whose dispatch nudge already carries one, so the narrowing is the session's real edge.
**The tier is not a variable.** Re-dispatch the same agent type at the same declared tier the panel selected (including any `reviewers.modelOverrides` tier). Promoting the model produces a *different* review than the panel selected, which is not the same as recovering the one that died.
**Signal 2 is out of scope for the mandate.** Under `budgetExhausted` nothing was dispatched, so there is no failed prompt to change and nothing to re-dispatch *differently*; that case keeps the coverage-gap accounting below, plus Step 4b-void.
**When the re-dispatch succeeds**, the reviewer is **not** a coverage gap: score its findings like any other reviewer's. Record the recovery in one `## Notes` line naming the reviewer, that it went dark, and that an in-session re-dispatch recovered it.
For each reviewer **still dark after** the re-dispatch (and for every reviewer dark by signal 2), name it on the
`Not reviewed:` line with its unreviewed domain and the reason (`died-after-retry` or `budget-exhausted`) — and, for
signal 1, that the in-session re-dispatch also came back dark. Never omit it, and never count it as clean.
**What a still-dark reviewer costs depends on which one it is.** A domain that survived two prompt-distinct attempts is genuinely unreviewed, but the consequence is not uniform — for most reviewers the lead pass or a sibling still covered something, and for a few it did not. The set is fixed here, not consumer-configurable:
| Still dark after the re-dispatch | Consequence |
| --- | --- |
| `scope-completeness-reviewer` | **`verdict: needs-work`, line 3 `reason: seat-unavailable`** — Step 4's gate, never converted into a void. |
| `security-reviewer` | **`verdict: needs-work`, line 3 `reason: seat-unavailable`**. This one is not a judgment call: "Security defers when it is spawned" means the lead pass **did not run** its own security section precisely because this reviewer was spawned. Its death therefore leaves the dimension covered by nobody, which is not the shape the visibility calibration was written for. |
| `performance-reviewer`, when it was dispatched on demand | **`verdict: needs-work`, line 3 `reason: seat-unavailable`**, on the same ground: "Performance defers when it is spawned", so its death leaves the dimension — and any record-named cost risk it was sent to trace — covered by nobody. |
| the design-fidelity reviewer on an **armed** spec | **Void the round** — see Step 4b-void case 2. |
| `db-reviewer`, `pipeline-reviewer`, `a11y-reviewer`, `unit-test-mutation-reviewer`, any repo-local `reviewers.add` reviewer | **Visibility**: the `Not reviewed:` entry, no forced verdict. |
Outside those first three rows a dark reviewer does not by itself force `needs-work` — it forces **visibility**: the human deciding to merge must be told which domains went unreviewed. That calibration is for a *partial* panel, and Step 4b-void below is where it stops applying.
### Step 4b-void: an all-dark selected set voids the round only when nothing else reviewed it
The rule above is calibrated for one reviewer dying. When every **selected subagent** dies it reads exactly the same, and that is the case where the report can be worthless: a complete-looking review, a `Not reviewed:` entry, and a verdict resting on coverage that was never produced. An unattended run then merges on a review that reviewed nothing.
**Void applies to the selected subagents, and only voids what it can void.** A completed lead pass means the round reviewed something — the four collapsed dimensions, plus security when its conditional did not fire — so an all-dark selected set on top of a completed lead pass is **not** a void. It is a partial-coverage round: keep Step 4b's behavior (a `Not reviewed:` entry per dark reviewer, and its consequence table) and give the verdict from what the lead pass and any surviving results actually cover.
**When the round IS void — the two cases:**
1. **Nothing reviewed the range at all**: the lead pass did not complete AND no selected subagent produced a usable result.
2. **The design-fidelity dimension produced nothing on an armed spec** — however well the rest of the round went. Two ways in, and the void does not distinguish them, because the armed ticket's own dimension is missing either way:
- **pre-dispatch**, the case its own section states: the reviewer cannot be dispatched at all (`design-toolkit` absent), detected at Routing;
- **post-dispatch**: it was dispatched, went dark by `died-after-retry`, and was **still dark after** the Step 4b re-dispatch. A panel of five green reviewers beside it certifies every dimension except the one the ticket was armed for, which is the same hole the pre-dispatch case names. Do the re-dispatch first — a recovered fidelity reviewer is not a void, it is coverage.
**The scope gate is a hard `needs-work`, not a void.** A dark `scope-completeness-reviewer` is unchanged by any of this: Step 4 keeps its full force — a `FAIL`, a `BLOCKED` (`reason: ticket-unreadable`), or a dark return (`reason: seat-unavailable`) all make the verdict `needs-work`. It is a real verdict on a round that really happened, so it is never converted into a void, and never into a silent pass because the lead pass covered its other dimensions. The lead pass cannot substitute for it: reading the issue's scope in the same context that wrote the diff is the bias the gate exists to isolate.
Darkness is still counted across **both** of Step 4b's signals: a reviewer present in `reviewers[]` as `{ result: null, … }` (died-after-retry), or `budgetExhausted: true` with `reviewers: []` (every selected reviewer dark by construction). An **empty selection** is neither — nothing was selected, so nothing is dark, and a round with no fan-out is never void on that ground (see "Empty selection: no fan-out at all").
**What a void emits.** Do **not** write the report format below. Emit instead a short **"review did not run"** report that names the full dark set, its reason (`died-after-retry` / `budget-exhausted`), and the range that went unreviewed — and **give no verdict line** at all. It is not checked and never posted.
This deliberately overrides the "Always give a clear verdict" rule under Rules, for this one case and no other. Answering `needs-work` would be the tempting shape, and it is wrong in a way that is worse than silence: "No" asserts that a review found problems, which is false in the other direction, and it sends the author hunting for findings that do not exist. There is no verdict to give, because there was no review. Say that.
### Step 4c: Not-selected ≠ dark
A reviewer that was **never selected** is a different case from a dark reviewer: nothing failed, the trigger simply did not fire, so it is **not** a coverage gap. Any other reviewer that was not selected gets no `Not reviewed:` entry. Three not-selected cases still must not be invisible, because in each one a whole dimension is silently absent while the round looks green. Each is one entry on the `Not reviewed:` line:
- **Unmatched web-component surface.** No changed path matched `$WEB_COMPONENT_GLOBS`, so neither `a11y-reviewer` nor the design-fidelity dimension was routed. The entry **includes the resolved globs** so a mis-scoped config is diagnosable from the line itself — e.g. "a11y + design-fidelity (no changed path matched `reviewers.webComponentGlobs` `**/*.{tsx,jsx,vue,svelte,css,scss,less}`)". When the key is an explicit `[]`, the entry reads "a11y + design-fidelity (`reviewers.webComponentGlobs` is `[]`: no web-component surface)" instead of printing an empty list. A genuinely non-FE diff is the overwhelmingly common case; escalating it would make every backend PR noisy.
- **Security conditional did not fire.** No auth / tenancy / session / upload / query-construction surface in the diff and no `review-context/security-reviewer.md` in the repo, so `security-reviewer` was not selected. The entry names what carried the dimension instead — e.g. "security-reviewer (no security surface; the lead pass covered it)". Never silent: the reader has to be able to tell "no security surface" from "nobody looked".
- **Design-toolkit not installed.** A changed path *did* match and the provider map selected a fidelity reviewer — by any row, **the no-provider default included** — but the design-toolkit agent type is not available to dispatch (Routing detected this pre-dispatch). The entry: "design-fidelity (design-toolkit not installed)". `a11y-reviewer` is unaffected and still spawns. The trigger is selection, not a declared `design.provider`: on the default row no provider is declared and the dimension is still selected, so a provider-keyed condition would make this entry unreachable for the commonest consumer.
All three are **visible, never a finding, and never silent** — and none changes the verdict.
### Step 5: Cross-Reviewer Self-Check
After triage but before writing the report, scan the full diff for cross-cutting concerns that no individual reviewer would catch alone. Each reviewer has a narrow scope — gaps between scopes are real.
Check for combinations like:
- New endpoint with no auth guard AND no tests AND no error handling (each reviewer might pass individually)
- New service method that modifies data but has no corresponding event emission (if events are the pattern)
- Schema change with no corresponding DTO update or vice versa
- Public-facing change with no input validation AND no test coverage
**Scope limit:** Max 2 cross-cutting findings per review. These must be concrete and evidence-based — not speculative. Tag them `[Cross-cutting]` in `## Findings`, a `[blocker]` or a `[note]` by the tag rule.
### Step 6: Plan/Spec Compliance (if plan provided)
Apply **Plan/Spec Awareness** above — the three checks (missing requirements, scope creep, misunderstandings), each problem a finding.
### Report format
The report is the lane's verdict format without the record rows. The terminal shows it whole, and the posted
review is the same text without the findings posted inline ("Posting the report"). There is no second report.
`verdict-check.sh` in its no-record mode checks it ("Check the format").
The report has these parts, in this order and nothing else:
- Line 1 is exactly `verdict: approve` or `verdict: needs-work`. Line 2 is exactly `reviewed: <head sha>`: the full
sha the plain review uses as `<head sha>`, what `git rev-parse HEAD` printed for the head you review. An optional
line 3 is exactly `reason: seat-unavailable` (a gate reviewer still dark, Step 4b) or `reason: ticket-unreadable`
(the scope reviewer could not read the ticket, Step 4). The next line is
`reviewed-by: second-shift review-lead (v<release>)`. `<release>` is the content of
`<skill dir>/../../.claude-plugin/release`; when that file is absent, the line is
`reviewed-by: second-shift review-lead`. Write these as plain lines: the join passes every line above the first
`## ` through unchanged.
- `## Summary`. Its first line is exactly `Mergeable as it is.` on an approve, or `Not mergeable yet.` on a
needs-work. Then, when the gate ran in partial mode, the one `Not delivered by this PR (linked as <verb>): <items>`
line (Step 4). Then the one `Not reviewed: <entries>` line, separated by `; `: each reviewer still dark (Step 4b),
each of the three not-selected cases (Step 4c), and a missing issue reference (Step 4). Leave the line out when
everything ran. Then each action the human must take, one per line, or `Nothing to do.` Write no table. Use at
most eight lines.
- `## Findings`. Each finding starts with `- [blocker] B<n> ` or `- [note] N<n> `, and its continuation lines are
indented two or more spaces. After its id, a finding names its reviewer in brackets, its file:line and its defect:
`- [blocker] B1 [Security] path:line — <defect>`. Its first continuation line is
`Scenario: <input or state> → <wrong outcome>`. A finding with no file:line names its reviewer and its defect.
Dismissed, suppressed, pre-existing and aspirational findings are not listed. Each finding id appears once. A
section with no findings holds the single line `None.`.
- `## Notes` (optional): the one-line items the rules above require (a recovered reviewer, a fidelity seat's
summary), what changed a finding, and the knowledge-base block last. The join adds its lines after them.
`Ready to merge?` is never written anywhere in the report. There is no Strengths, Suggestions, Plan Compliance,
Data provenance, Pre-existing gaps, Suppressed or Verdicts section, and no `## Decision record rows`.
`verdict: approve` means mergeable as it is: there is no finding and no `reason:` line. `verdict: needs-work`
carries at least one finding, `[blocker]` or `[note]`, or a `reason:` line; under that line the findings may be
`None.`. A missing plan or ticket requirement and an unverified stored field on the critical path
(`lead-pass-checklist.md`, "Data provenance") are findings.
The rows-table lines of the style block below do not apply to this report: it has no rows table. The two blocks are
the lane's own, kept word for word. In a `Fix:` line, "the requester" means the PR author.
<!-- LOCKSTEP-BEGIN verdict-style -->
Write the verdict for the human who decides the merge.
Use short sentences. An instruction has at most 20 words. A statement has at most 25 words.
Write one instruction per sentence. Use the active voice.
Do not use idioms, hedges or semicolon chains.
Use the same word for the same thing every time.
State each fact once. Do not repeat a fact from one section in another.
In the rows table:
- Keep each Evidence cell to one or two sentences.
- Start the Evidence cell with the file:line or the test id. Then say what it shows.
- Start the Evidence cell of a departed row with `Decided by <who> (<provenance>).` Then give the commit of the edit and the new resolution.
- If the edit of a departed row names no decider, start its Evidence cell with `No decider named.`
- Start the Evidence cell of a row that the build added with `Added by the build, <provenance>.`
- Start the Evidence cell of a row that the build deleted with `Deleted by the build.` Then name who decided.
- Put longer detail in `## Notes`.
In `## Findings`:
- Put blockers first and notes after them.
- Give the defect in the first sentence of each finding.
- Put the evidence on continuation lines. Indent them two spaces.
- End each finding, a note too, with the continuation line `Fix: <one instruction>`. It states the outcome to restore and never prescribes a new unit of mechanism.
- A unit of mechanism is a refactor, new abstraction, layer, generalization or extension point, or a cache, timeout, lock, retry, flag or option, config key, stored or request field, renderer, a second writer of an existing artifact, or a user-facing control.
- When only new mechanism restores the outcome, the line reads `Fix: accept the gap, or add <unit> — the requester chooses.` A unit that the ticket or a record row requires is not new mechanism: the line names it and cites that requirement.
- Write a note in at most four lines, its Fix line included.
In `## Notes`:
- Use one `###` sub-heading for each topic. Write at most six sentences under it, not counting the resolved lines and the two lines of their fold.
- Write an inventory, such as the mutation run, as a list.
- Put the knowledge-base block last.
- Do not write a sub-heading that has nothing under it.
- Leave out a topic that changed no score or finding.
- Keep `## Notes` under 150 words, not counting the knowledge-base block, the later-round notes, the resolved lines and the two lines of their fold.
A limit never removes a row, a finding or a knowledge-base proposal. If they do not fit, shorten the wording.
<!-- LOCKSTEP-END verdict-style -->
<!-- LOCKSTEP-BEGIN kb-contributions -->
Knowledge-base contributions: when the repo's review-context.md has a `## Knowledge-base contributions` section, write a contributions block last in the verdict's `## Notes`. The candidates are what the record's `## Knowledge source` answer says the knowledge base does not cover (lookup gap), the page a `D-n` row names in `kb-conflict: <kb-page> (kb stale)` or `(kb ahead)`, and what this diff makes true that the knowledge base should state (change gap). Apply the inclusion test that the section declares, as written, to every candidate, and list only the candidates that pass. Write the lead line `Knowledge-base contributions:` with one proposal per line under it, in the format the section declares or as `- <kb-page> — <what to add or correct> (<gap kind>)`. When no candidate passes, write no contributions block. Carry the whole list on every verdict, never only what changed since an earlier one: the earlier verdicts are collapsed once one binds. When review-context.md has no such section, the verdict carries no contributions line. A proposal is a draft the operator files in the knowledge base: never a finding, and it never makes a verdict `needs-work`.
<!-- LOCKSTEP-END kb-contributions -->
**Reserved wording.** In `## Summary` and `## Notes`, "end-to-end", "verified" and "works" describe only what a
test the report cites actually executed. Anything established by reading code is "statically traced". Where a
read-only probe would settle what the trace cannot (a model round-trip in a throwaway script, one read-only query of
a recent real record), `## Notes` may name one for the human to run; the lead never runs it.
When the user notes that this PR covers only part of a plan, limit the plan checks to the sections the PR claims to
address.
The verdict line has exactly one unreachable state: a round voided under Step 4b-void emits no report in this format
at all, so no verdict is given.
## Prior Round Context
When invoked for round 2+ of a multi-round review:
The user should provide context like: "Round 2 of 3. Prior findings: [list]. Focus on: verifying prior fixes + new issues only."
When prior round context is provided:
1. **Skip re-flagging resolved findings** — if a prior finding was fixed, don't report it again
2. **Verify fixes** — confirm prior findings were actually addressed, not just suppressed
3. **Focus on new issues** — findings introduced by the fix commits since last round
4. **Reduce reviewer lineup** — only spawn reviewers whose prior findings had blockers/majors, plus any reviewer whose scope is touched by the fix commits. The lead pass still runs every round; scope it to the fix commits the same way
This reduces token waste and prevents redundant findings across review iterations.
## Rules
- If reviewers disagree, decide, and write the finding you stand behind
- Always give a clear verdict. If no finding survives, write `verdict: approve`, `Mergeable as it is.` and `Nothing to do.` — don't pad the report
- Never invent findings that no reviewer reported (cross-cutting self-check is the one exception — tag these clearly)
- Repo-local domain reviewer findings about domain correctness take precedence over complexity reviewer suggestions to simplify domain logic
- Pipeline reviewer findings about contract integrity take precedence over performance suggestions to change worker data flow
- **Confidence is king** — a finding at confidence 95 from one reviewer outweighs three findings at confidence 80 from others. Prioritize by confidence × severity, not by count