--- name: code-review description: Review git changes for quality and conventions via parallel reviewer subagents synthesized in the main agent (fixes everything it verifies in or out of the diff, records the decisions it made, fills red-green test-coverage holes, commits that pass locally, and ends Ready or Blocked from a script, sending what it could not finish back as numbered steps, never as new tasks) allowed-tools: Read, Glob, Grep, Edit, Write, Bash(git:*), Bash(npm:*), Bash(npx:*), Bash(node:*), Agent argument-hint: "[base-ref] [review-only]" --- # Code Review Review the changes that make up this branch's work - commits on the branch **plus** staged, unstaged, and new untracked files in the working tree (the diff from the base branch through the working tree) - for quality, correctness, and project conventions, then fix every verified finding and end Ready or Blocked. ## Modes - **Default** (`/code-review`) - review, then fix every verified finding (Lows included), apply the recommended option on every decision and record it, re-run the checks, commit this pass's own work locally (never pushed), and end with the verdict block `scripts/review-verdict.mjs` prints: **Ready** (for Testing) or **Blocked**. There is no third verdict and no "skipped" status. Blocked sends the card back to Executing, unless a step only a person can do adds a `Needs owner:` line below the verdict, which stops the card where it is. - **Review-only** (`/code-review review-only`) - findings table + Verdict footer only, no edits applied. The skill reads `$ARGUMENTS`, which may carry up to two independent tokens in any order: - `review-only` - skip the Apply Phase, Re-typecheck, and commit steps (it writes nothing at all) and emit the legacy Verdict footer instead of the default report. - a **base ref** (any token that is not `review-only`, e.g. `origin/main`, `develop`, or a commit SHA) - overrides the auto-detected base branch the diff is scoped against (see Step 3). Mirrors `claude ultrareview origin/main`. A base ref is diff-*scoping* metadata, not author intent - it never tells the reviewer what the change was "supposed" to do (see "Reviewer independence"). **User-provided arguments (if any):** $ARGUMENTS **One uniform path.** This skill runs as a thin **driver** in the main loop. Every run - regardless of diff size - does the same thing: mechanical pre-flight, gather the diff, **fan out independent reviewer subagents in parallel** (via the `Agent` tool), then **synthesize and verify their findings in the main agent**, and (default mode) fix every verified finding. There is no size gate and no separate "heavy" path. The fan-out scales naturally with the change: the universal dimension finders always run, and the domain auditors are gated by changed-file type, so a one-file change fires few finders and a broad refactor fires many. This mirrors the recommended orchestrator-worker pattern (a lead agent fans out parallel review subagents and synthesizes their results). ### Reviewer independence `/code-review` always runs in a **fresh, isolated session** with no prior conversation or generation history (the board spawns the review session `isolated` + `always_spawn_new`; see `.claude/rules/board-config-parity.md`). The reviewing agent therefore did not write the code under review and has no memory of intending anything by it, so it is an independent reviewer **by construction**. Judge the diff strictly on its own merits - correctness, conventions, and the criteria below - and do **not** assume the author's intent was correct; that a change exists is not evidence it is right. The parallel finder subagents each receive only the change itself - the review pack's change-marked sections, never any generation reasoning - and re-derive expected behavior independently. The main agent then **verifies each finding against the actual code**: it reads the cited lines, confirms the issue is real, treats "the author clearly meant X" as inadmissible, and when uncertain **refutes** (drops) the finding rather than waving it through on assumed intent. ### Not the same as `/code-review ultra` `ultra` is a Claude Code **built-in** that launches a multi-agent review in the **cloud** - user-initiated, billed, and not self-launchable by this skill. This project skill (`/code-review`) is an **in-session, local** reviewer: it fans out parallel read-only subagents via the `Agent` tool and synthesizes their findings in the main loop. Use `ultra` for a deep cloud audit on demand; this skill for the automatic, auto-fixing local pass. They are complementary, not unified - there is no attempt to share code between them. ## Instructions (driver) The skill is a thin driver that runs in the main loop. All commands below run from the **current working directory** - never use `cd && git ...` (triggers an unbypasable security prompt); use `git -C ` if you must target another directory. If the CWD is a worktree, git operates on it automatically. **``, where this pass keeps its files.** `` is the `code-review` folder inside the session scratchpad directory your environment block names (for example `/code-review`). It is a fixed name so that a driver whose context was compacted can find its files again. Every file this pass writes goes there: the pack, the dirty list, the finder queue, the findings JSON, and the commit message. Do not keep them in `.kangentic/`: stopping an ephemeral worktree preview moves everything in the worktree's `.kangentic/` to a trash folder (`scripts/dev.js`), and a pass that loses its dirty list mid-run can no longer tell which files it may commit. Only when your session names no scratchpad is `` the worktree's `.kangentic/`, with `--out-dir` left off the pack command. In a Bash command, write `` and every path under it with forward slashes (`C:/Users/dev/...`), including a path you copy from a script's summary. On Windows the Bash tool is Git Bash, which drops the backslashes of an unquoted `C:\Users\dev\x` and passes `C:Usersdevx`. Node resolves that as a drive-relative path inside the worktree, so the pack and the dirty list would land as untracked files that Step 8 then commits. `Read`, `Write` and `Edit` accept either form. 1. **Pre-flight typecheck.** Run `npm run typecheck` to check for type errors. Any type errors are **highest-priority findings** - they represent potential runtime crashes. Include them in the review output even if they are in files not touched by the current diff. 2. **Pre-flight HMR vitest.** Run `npx vitest run tests/unit/hmr-resync.test.ts` (fast, ~150ms). This enforces the three mechanical HMR-parity invariants: every IPC-backed store has its `load*` / `sync*` registered in `App.tsx`'s `vite:afterUpdate` handler; every top-level mutable module state under `src/renderer/stores/` or `src/renderer/utils/` either preserves itself via `import.meta.hot.dispose(` or carries a `// hmr-safe:` directive; every `` has `key={...HmrGeneration}`. A failure here is a **Critical** finding (dev-mode regression that production users won't see but dogfooders will mistake for a real bug). 3. **Resolve the base branch.** Agents in this workflow sometimes commit during the working session, sometimes leave changes in the working tree, sometimes both - so the review scope is the full delta from the base branch through the working tree, the same surface `claude ultrareview` reviews. Resolve the base ref in this order, each its own Bash call, first hit wins: 1. An explicit ref in `$ARGUMENTS` (the token that is not `review-only`), e.g. `origin/main` or a branch/SHA. Authoritative - use it verbatim. 2. The repo default branch: `git symbolic-ref --short refs/remotes/origin/HEAD` (yields e.g. `origin/main`). 3. Fallback locals: `git rev-parse --verify --quiet refs/heads/main`, then (if that fails) `git rev-parse --verify --quiet refs/heads/master`. If none resolve (no remote, no `main`/`master`), set base to empty and review the working tree only - note "base branch undetermined; reviewed working-tree changes only" in the Summary. 4. **Gather the diff (each command its own Bash call).** Capture all three layers for the driver's own use: the signature delta, the empty-diff check, the `--stat` summary, and `preexistingDirty` below. Finders never see this output; the pack script gathers the same layers itself. - **Committed-vs-base:** `git diff ...HEAD` and `git diff ...HEAD --stat` (three-dot = changes since the branch diverged from base). Skip when base is empty; an empty result otherwise just means no committed divergence, not an error. - **Uncommitted (staged + unstaged):** `git diff HEAD` and `git diff HEAD --stat` (`git diff HEAD` captures index + working tree in one command). - **Untracked new files:** `git ls-files --others --exclude-standard`. No diff shows these, but they are part of the change: `Read` each listed file so the signature delta below covers its exports. The pack script packs them itself, as sections in which every line is marked added. If the committed diff, the uncommitted diff, **and** the untracked list are all empty (the pack script prints `NO CHANGES:` on the same condition), run `node scripts/review-verdict.mjs --no-changes ` (omit `` when it is empty), paste its output verbatim as the pass's whole final message, and stop. It ends `Verdict: Blocked`, one step above it: on the board an empty diff is a task whose Executing step committed nothing, and a bare "No changes to review." matched neither Code Review row, so the workflow moved task 916 on to Testing unreviewed. In review-only mode emit "No changes to review." and stop. Compute the compact **signature delta** from these diffs and the untracked files (the integration finder consumes it; see "## Finders"). `changedFiles` comes from the build script's `paths:` line once it has run (below) - never from `--stat` output, which truncates long paths. **Record `preexistingDirty`** = the union of `git diff HEAD --name-only` and the untracked list: everything already dirty before this pass touched anything. Step 8 subtracts it to decide what it may commit. This is deliberately **narrower than `changedFiles`**, which also includes the committed-vs-base paths - conflating the two makes Step 8's set difference empty, so nothing would ever commit. **Use `--name-only`, never the `--stat` paths, for this set.** `--stat` abbreviates a long path to fit its column budget (`src/renderer/components/sidebar/project-sidebar/SidebarCommandTerminalIndicator.tsx`, already in this repo at 83 chars, renders as `.../sidebar/project-sidebar/SidebarCommandTerminalIndicator.tsx`). Step 8 compares against `git diff HEAD --name-only`, which never truncates, so a `--stat`-derived entry would fail to string-match its own full path, drop out of the subtraction, and get committed - the precise outcome this design exists to prevent. Keep the `--stat` capture for the human-readable summary only. This rule now guards the Step 8 dirty set alone: `changedFiles` no longer passes through `--stat` at all, since it comes from the script's `paths:` line. **Persist it immediately, do not just remember it.** `scripts/build-review-pack.mjs` (next paragraph) writes the list to `/REVIEW_PREEXISTING_DIRTY.tmp` from the same gather; confirm the file exists, and only write it yourself (one path per line, `Write` tool) if the script was unavailable. Step 8 is many steps, a fan-out of dozens of subagents, and a whole Apply Phase later, so this value has to survive a context compaction in between. If it does not survive, the set difference silently UNDER-counts and Step 8 commits the task agent's unfinished work - the exact outcome this design exists to prevent. `` is outside the repo (or the gitignored `.kangentic/`), so the file never stages itself and needs no cleanup. The since-review pack below gets its OWN out-dir, so it can never overwrite this list. **Build the shared review pack (gather once, read N times).** Run `node scripts/build-review-pack.mjs --out-dir --shard-lines 1500` (one Bash call; omit `` when the base is empty). Besides the `paths:` line below, the summary prints `shards: header 1-; -, -, ...`: the pack split into ranges of about 1500 lines that start on a section heading and never split a section. Step 5 gives one correctness finder per range. The script writes two files into `` and prints only a short summary that names both paths; verify both exist. `REVIEW_PACK.tmp.md` is the pack: a `Total lines: ` header, a one-line format legend, a table of contents with an exact start line for every changed file, then one section per changed file, largest churn first. Every body line is `` with `+` added, ` ` unchanged, and `-` removed (blank number, shown in place before the line that follows it), so each changed line appears exactly once and every citation is a working-tree line number. A file whose full body fits under the 200KB body cap is `## Full file:` or, windowed at 20 lines of context, `## Partial file:`; every other readable file is `## Changed hunks:`, the same windows at 3 lines of context. A file too large to read (over 1MB) that still has parsed hunks gets that same heading at 0 lines of context, and says so in the heading. A hunk section that alone exceeds the 100KB per-file cap becomes a one-line `## Changed hunks omitted:` stub and is listed under `## Not included (read on demand)`, as is any binary file and any oversized file the parse found no hunks for; a hunk-tier file is never listed there, because it already carries every changed line. Deleted, renamed-only, mode-only, and reverted files get a one-line section. There is no separate diff. `REVIEW_PREEXISTING_DIRTY.tmp` is the dirty list from the same gather. Which files get a body is decided on plain full-body cost, so neither windowing nor the marker format ever displaces a file the pack would otherwise carry. If the script is missing (older checkout), write the dirty list by hand per the rules below and give the finders the changed-file list with no pack path; never hand-build a pack, which is the `Write`-tool cost the next rule forbids. This exists because the 2026-08-29 audit (`docs/audits/code-review-fanout-audit.md`) measured each finder independently re-gathering the diff (50-78k tokens each) and re-reading the same changed files (38% of all Read bytes duplicated): the pack pays that cost once. Two rules protect the savings: the pack is delivered as a FILE PATH, never embedded in finder prompts and never written through the `Write` tool (both re-bill the pack as driver output tokens - ~100k tokens at Opus rates for a 200KB pack - which is why the script does the writing); and `` is outside the repo, so neither tmp file ever stages or needs cleanup. **Take `changedFiles` from the script's `paths:` line.** The summary block prints two distinct lines, and only the second carries paths: ``` changed files: 6 (committed 0, uncommitted 4, untracked 2) paths: src/main/db/migrations.ts, src/renderer/App.tsx, ... ``` `changedFiles` = that comma-separated list, verbatim. It is the script's own `changedFiles` array - the deduped union of all three layers, in full untruncated form - so it needs no reconstruction and cannot disagree with what the pack was built from. Read the `paths:` line, never the `changed files:` count line above it (counts, not paths), and never the pack's `## Contents` TOC. The TOC now lists every changed file too, but it is a navigation aid for finders, not a contract: reading it means opening the pack in the driver (billing the whole pack as driver input) and parsing paths back out of markdown labels, and every path dropped from `changedFiles` silently un-gates a domain auditor whose glob it matched (a missing `src/main/db/migrations.ts` skips `migration-safety`; a missing `src/main/pty/**` skips `platform-guard`) while the review still reports success. The `paths:` line is the one output the script promises for this purpose, which is exactly why it is the source. **Known limit of the format:** the paths are joined with `, `, so a changed file whose own path contains a comma-space would split into two phantom entries - one matching no auditor glob, the other under-gating. Git permits commas in paths, this repo has none, and the format is shared with the sibling repos, so do not redesign it here; if a path ever looks wrong in `changedFiles`, cross-check it against `git diff HEAD --name-only` before trusting the split. **Read the review ledger.** Earlier passes on this branch left a record of what they refuted and what they decided, in the bodies of their `*(review)` commits. When the base is non-empty, run `git log --grep="(review)" --format=%B ..HEAD` (one Bash call; keep the quotes, since unquoted parentheses are a shell syntax error) and keep every line that starts with `Refuted:` or `Decisions:`. Each line is keyed ` : `, never by line number, because line numbers drift between passes. Empty output means this is the first pass. Step 6 uses these lines; a pass without them re-raises what earlier passes settled (task 736 re-raised 43 items over 9 passes, and refuted 12 of them a second time). **Build the since-review pack (a later pass only).** When the ledger read found an earlier pass, find where that pass began, so its own fixes are reviewed too: no finder ever read them, and every Phase 0 delta case (`docs/audits/code-review-fanout-audit.md` section 15) is a review fix a later pass had to fix again. Run `git log --format="%H %s" ..HEAD` (one Bash call; newest first). Walk down to the newest commit whose subject starts `(review):`, then keep walking while each older subject also starts that way; a pass's commits are contiguous, because the card stays in Code Review while they land. Match the subject prefix, never `--grep`, so a task commit that only mentions "(review)" cannot move the base. The base is the parent of the oldest commit in that run: run `node scripts/build-review-pack.mjs ^ --out-dir /since-review` (one Bash call). That pack holds the earlier pass's fixes, the task agent's work since, and anything new. Its `paths:` line is `sinceReviewFiles`. Step 5 gives it to every pack-reading finder except the correctness shards; the integration finder still gets only the signature delta. If it prints `NO CHANGES:`, nothing changed since that pass began: Step 5 runs the correctness shards alone and gates no auditor. 5. **Fan out reviewer subagents (the `Agent` tool, at most 20 running at once; see the cap below).** Every finder is a **read-only** subagent in its own fresh context window; only the driver (main loop) mutates the working tree, in the Apply Phase. Give each finder the changed-file list and the absolute path to `/REVIEW_PACK.tmp.md`, with this instruction: load the pack FIRST and in FULL, in sequential `Read` calls of at most 1000 lines with explicit `offset`/`limit` (its first line states the total line count, so a pack of N lines takes ceil(N/1000) calls - do not re-read overlapping ranges; a 2000-line call can pass the `Read` tool's 25k-token cap and fail, which Phase 0 finders hit on dense packs); treat the pack's sections as the authoritative record of WHAT changed (the working tree stays the record of what the code is); do NOT run the git gather yourself; do NOT re-`Read` any file whose full body is in the pack; and STAY ON YOUR CRITERIA - the pack is the review surface, so do not spend calls re-verifying repo state outside your checklist (the A/B validation measured a finder giving back the entire saving by wandering into out-of-scope verification). Reading beyond the pack is for your criteria only: callers, rule files, tests, the `## Not included` files. Tell the finder what the section kinds guarantee, or it will re-read the file and give the saving back: every line carries a marker (`+` added, ` ` unchanged, `-` removed in place with a blank number) and its exact working-tree line number, so a citation from any section is correct, and a removed line is cited by the numbered line after it; `## Partial file:` carries EVERY changed hunk with 20 lines of context and `## Changed hunks:` the same with 3, with the unchanged runs between windows replaced by a marked, line-numbered gap (`..... 954 unchanged lines omitted (72-1025) .....`), so being windowed is not by itself a reason to re-`Read` a file - only a criterion that genuinely needs code inside a gap is. Every finder prompt also carries: a 3-6 line NEUTRAL summary of what the change does (mechanism only - phrase it as "context, not a licence to assume the author was right", per Reviewer independence) so the finder does not burn reads orienting itself; the instruction to end its final message with `Reads beyond the pack:` and one line per file it Read outside the pack (path and the criterion that needed it), or `none`; and the single-command Bash tool rule verbatim for any Bash-capable finder. Never hand a finder a raw diff inline and never hand it the Step 4 gather commands: the 2026-08-29 audit measured both variants costing each finder tens of thousands of tokens that the pack now pays once. The one exception is the integration finder, which gets ONLY the signature delta (below), not the pack. See "## Finders" for the exact set, the gates, the per-finder criteria, and the required return shape. The universal dimension finders always run; the domain auditors run only when their changed-file glob matches. **The correctness lane is sharded.** Spawn one correctness finder per range on the Step 4 `shards:` line. Each one's read plan replaces "load the pack in FULL" with: load pack lines 1-`` (the header and table of contents), then its own range, in `Read` calls of at most 1000 lines with explicit `offset`/`limit`, and no other part of the pack. Each correctness finder covers the files in its own range and may read beyond the pack for the code those files call or test. A range that holds only tests is checked against the production code it exercises, which lives in another range. Every other finder reads the pack in full, as above. Sharding is the shape Phase 0 measured (`docs/audits/code-review-fanout-audit.md` section 15): it costs about what one finder over the whole pack costs, and a long pack no longer sits in one context. **Run at most 20 agents at once, and never merge ranges.** The harness runs at most 20 subagents at a time. That caps how many run at once, not how many a pass starts, so keep the script's ranges exactly as printed. Merging them to fit one message left ranges unread: the task 732 fifth and seventh passes merged the 1500-line ranges into shards of about 6k lines, and shards skipped whole files. The sixth and eighth passes kept the script's ranges, started 54 and 56 finders in rolling batches, and every shard read its whole range (`docs/audits/code-review-fanout-audit.md` section 14.5). Count the finders: one per shard, the other universal finders, and every gated auditor whose glob matched. When the count is 20 or fewer, launch everything in ONE message. When it passes 20: - **Write the queue first.** `Write` `/REVIEW_QUEUE.tmp` with one line per finder, every non-shard finder first as ` pending`, then one line per `shards:` range in pack order as `shard - pending`. It is the record of which finders are still to start and which have returned. Like the dirty list, it has to survive a context compaction, and a fan-out of 50 or more finders is the likeliest place to hit one. This `Write` replaces any queue an earlier pass in the session left, and a pass of 20 or fewer finders never reads one. After it, change the file only with `Edit`, one line per change, never by writing it again. - **First wave, in ONE message.** Launch the first 20 lines and mark each `started`. The whole-pack finders and the gated auditors sit first because they read the most, and started late they would be the last to return. Give each finder its line's name as the description (`shard /` for a shard) so its completion notification names its line. - **One back, one out.** Each time a finder returns, in that same response, mark its line `done`, launch the first `pending` line, and mark that line `started`. A finder that errored or came back empty has returned too. Keep 20 finders running while any line reads `pending`. - **After a compaction.** `Read` the file before launching anything. Never relaunch a `started` line, because its result is still coming. Step 6 verifies against each finder's `file:line` citations, and a summary rarely keeps them. So a `done` line goes back to `pending` when the compacted context no longer holds that finder's findings with their citations. Then launch `pending` lines until 20 read `started`, because no return may be left to trigger a launch. This can rerun most of the pass. The skill accepts that cost over writing every finder's findings to disk as they arrive, which would bill them all again as driver output on every pass, compaction or not. **A later pass gives the since-review pack to every finder but correctness.** When Step 4 built a since-review pack, the correctness shards still read the full pack, and their criteria gain the Best Practices security line (injection risks, unsanitized input). Every other pack-reading universal finder and every gated auditor gets `/since-review/REVIEW_PACK.tmp.md` instead (the integration finder still gets only the signature delta, never a pack), and the gated auditors gate on `sinceReviewFiles`, not `changedFiles`. When that pack came back `NO CHANGES:`, only the correctness shards run. Code an earlier pass reviewed is still read for defects. Its maintainability, performance and conventions calls were already made and are in the ledger. Re-raising them on every pass is the loop this skill exists to stop. 6. **Synthesize + verify (main agent).** Begin once every finder has returned; with a finder queue, that is when every line of `REVIEW_QUEUE.tmp` reads `done`. Collect every finder's findings. For each, **verify it against the actual code** - read the cited `file:line` (for a removed line, the pack section that shows it, since the working tree no longer does), confirm the issue is real, and refute (drop) anything the code does not substantiate or that cannot be stated falsifiably (judge the code, not assumed intent). Dedup findings the same issue surfaced from multiple dimensions (e.g. an `any` flagged by both correctness and conventions), keeping the highest severity and clearest recommendation. Then check each surviving finding against the Step 4 ledger: a finding with the same file, symbol and mechanism as a `Refuted:` or `Decisions:` line is refuted with the reason `ledger: `, unless it cites evidence the earlier reason did not cover (an input it never considered, code that changed since, a test that now fails). A finding that does cite such evidence is verified like any other and recorded with `reRaise: { of: , newEvidence }`. Never overturn an earlier decision without that evidence: two passes flipping the same call is the loop this rule exists to stop. Fold in the pre-flight signals: Step 1 type errors as Critical rows; a Step 2 vitest failure as a Critical row with the assertion message verbatim. Sort by severity. If a finder returned nothing usable (it errored or came back empty), note the dropped dimension in the Summary. Tally every finder's `Reads beyond the pack:` lines and the script's `pack:` summary line (size, hunk sections, stubbed) for the Summary's Pack line: that is the per-review record of whether the pack's context width and per-file cap are right. 7. **Apply Phase + checks** (skip both in `review-only` mode). Resolve every verified finding as "## Apply Phase" describes: fix it (Lows included, in the diff or out of it), apply the recommended option on a decision, or, only after trying, mark it blocked with the step the task agent must take. Each fix is its own atomic unit. Then re-run `npm run typecheck` and `npx vitest run tests/unit/hmr-resync.test.ts`, the scoped run of every test this pass added, and the scoped run of each existing unit test file that imports a source file a fix touched (find them with `Grep` for the module's path under `tests/unit/`). A fix can break a test it never mentions: in the Phase 0 replay, a review fix that moved a guard above its `try` failed an existing test, and no finder caught it (`docs/audits/code-review-fanout-audit.md` section 15). Keep this scoped: when more than five files import a touched module (a shared module such as `src/shared/types.ts`), run only the ones named after it and leave the rest to CI. When an existing file fails, revert that fix's edit and run the file again. A file that still fails was broken before this pass, and it does not fail `scopedTests`. Restore the fix, then fix that file in this pass when you can. When you cannot, record it as a non-quick `blocked` finding whose `step` is to fix that file in this task. A file that passes without the fix means the fix is wrong, which the type-error rule below covers: try once more, then `blocked`. If a fix introduces a new type error, revert that specific edit and try once more with a different fix; if the second attempt also fails, the finding is `blocked` with a `step` that names the error and the file. Do not roll back unrelated fixes. The Apply Phase also **fills coverage holes** through `test-builder`, every tier included (see "Auto-adding missing tests"). Finally, write `/findings.json` with the `Write` tool, in the shape the header of `scripts/review-verdict.mjs` documents: every finding with its final `status` (`fixed`, `refuted` or `blocked`) and the three check results. There is no `skipped` status and no `followUps` or `followUpTask` key, and the script refuses all three. 8. **Commit the pass** (skip in `review-only` mode, which writes nothing). Commit this pass's own work so the worktree returns to clean and the next agent inherits an attributed commit instead of a mystery. The commit body carries the ledger, so a later pass knows what this one refuted and decided. See "## Committing the pass" for the set rule, the exact commands, the ledger-only commit, and the mixed-authorship case. 9. **Report.** In `review-only` mode, emit the Review-only-mode footer below and run no script. That mode writes no `findings.json`, and a file an earlier pass left in `` would give a verdict for findings this review never raised. In default mode, run `node scripts/review-verdict.mjs /findings.json` and emit the **Output Format** below, ending with that command's output pasted verbatim. Its closing block (`Verdict: Ready`, or the numbered steps followed by `Verdict: Blocked`, and a `Needs owner:` line when a step needs a person) is the LAST thing in your final message: no closing prose after it, and no offer of another pass. The block's last line is the message's final line, and the board's Code Review rows route on exactly that line in code (a Text match), so anything after it, even a blank-looking sign-off, sends no task anywhere. A person reading the board and an agent reading the transcript both act on those lines, so never relabel the verdict or soften it in your own words. ## Finders The driver spawns all finders as **read-only** `Agent` subagents **in parallel**, in the orchestrator-worker fan-out (Step 5 caps how many run at once and says how the rest start). The universal dimension finders always run; the domain auditors are **gated by changed-file globs** and each is its own registered auditor agent, spawned via `subagent_type` - it loads its own domain skill and runs its checklist, so do not duplicate that checklist in the prompt. Findings come back as **text** (the `Agent` tool returns the subagent's final message, so there is no enforced schema): each finder MUST return a structured list, one block per finding with `severity`, `category`, `location` (`file:line`), `finding`, and `recommendation`, plus the falsifiable triple (`triggeringInput`, `codePath`, `testGap`) for every Correctness/Critical finding. | Finder | `subagent_type` | Run | Gate (changed-file glob / hunk) | |---|---|---|---| | Correctness / Performance / Maintainability / Best-Practices+Conventions | `review-finder` (seed with the matching Review Criteria slice, incl. the "no agent-specific code outside `adapters/`" rule, `any`, shorthand, external-parser fixture) | ALWAYS (one finder per dimension; correctness gets one per `shards:` range, see Step 5) | - | | Cross-file integration (signatures only) | `review-finder` (special prompt below) | ALWAYS when `changedFiles > 1` | - | | Test coverage (red-green) | `review-finder` (seed with the red-green coverage criteria below) | ALWAYS when the diff changes behavioral source under `src/`, `scripts/`, or `packages/` (self-skips docs-only / test-only / pure-styling diffs) | - | | IPC consistency | `ipc-auditor` | GATED | `ipc-channels.ts`, `types.ts`, `preload.ts`, `src/main/ipc/handlers/**`, `tests/ui/mock-electron-api.js`, `src/renderer/stores/*-store.ts` | | HMR parity | `hmr-parity` | GATED | `src/renderer/stores/**`, `src/renderer/utils/**`, `src/renderer/App.tsx`, or any hunk with ` Is there a test that would **fail if this change were reverted**? If not, it reports a **coverage hole**: the `location`, the specific behavior left unverified, why the existing tests miss it (commonly: the line is executed but its effect is never asserted - the exact gap that let an activity-engine seed ship untested), and a **suggested tier** (unit / UI / E2E) as a hint only. Its read slice is the narrowest of any finder: the pack (which already carries the changed implementation AND changed tests) plus additional TEST files only - its question is answered by tests, so it never reads unchanged implementation bodies beyond the pack. It does NOT re-derive the tier rules or write anything: the authoritative tier classification and the authoring belong to `test-builder` in the Apply Phase, so there is one source of truth for tiering. Scope holes to behavior the diff **introduced or changed** - pre-existing untested code is a separate `/test write` task. Pure refactors with no behavior change, styling, and docs produce no holes. If a finder errors or returns nothing usable, the review proceeds on the surviving dimensions; note any dropped dimension in the Summary. ## Review Criteria ### Correctness - Logic errors, off-by-one mistakes, null/undefined risks - Missing error handling or unhandled promise rejections - Race conditions or incorrect async/await usage ### Performance - Unnecessary allocations, re-renders, or repeated work - Missing memoization where expensive computation occurs - Inefficient data structures or algorithms ### Maintainability - Readability: unclear naming, overly complex expressions - Duplication that should be extracted - Premature abstractions or over-engineering ### Best Practices - TypeScript strict mode compliance - **no `any` in new code**. Use proper types from `src/shared/types.ts`, `unknown` with type guards, or generic constraints. Flag any new `any` or `as any` cast as a finding. - **External-input parsers need a real-shape fixture test.** When code parses input from outside the TypeScript boundary (`JSON.parse` of file contents, IPC payloads from external CLIs, network responses, child-process stdout) and dispatches on string-literal field comparisons, flag it as a finding unless there is a regression test that replays a real (sanitized) sample of the external format. Type-safety stops at the parse boundary. TypeScript will happily narrow `unknown` to a union you declared, even when the runtime shape has drifted. Runtime fixtures are the type system on the other side. See `tests/fixtures/codex-rollout-event-msg.jsonl` + `tests/unit/codex-session-history-parser.test.ts` for the canonical pattern. The Apply Phase has one answer for where the sample comes from, in this order. Capture it from an installed CLI. When the CLI cannot run here (not installed, no login, or auto mode refuses it), the pass itself writes the fixture from the CLI's published examples, its docs or its own test data, and resolves the finding `fixed` with a `decision` whose alternative is a live capture. That `decision` is what keeps the next pass from raising it again. Only when no published shape exists is it a `blocked` finding, with `needsOwner: true`. - **No shorthand variable names** in new or changed code. Use full, descriptive names: `session` not `sess`, `currentIndex` not `curIdx`, `previousValue` not `prev`. Applies to variables, parameters, callback args, refs. - Security: injection risks, unsanitized input - Proper error handling at system boundaries ### Project Conventions (source of truth: `.claude/rules/`) These are summarized for review convenience; the authoritative, enforced versions live in `.claude/rules/*.md` (each names its test and/or auditor agent). - Single-command bash calls only (no `&&`, `||`, `|`, `;` chaining) - see `.claude/rules/bash-single-command.md` - An MCP tool answers from the layer its fact belongs to. Flag a new or changed tool that returns a path, pid, port or URL without `location: 'host' | 'local'`, reads `task.worktree_path`, `sessions.cwd` or `project.path` straight into a response (a remote project's value is the empty stand-in on this computer, not the host path the agent needs), tests a path on this disk for a project that may be remote, or reads an agent-supplied path from this disk - see `.claude/rules/mcp-tool-host-values.md` - House writing style in every piece of authored prose the change adds or rewrites: comments, docs, README, UI copy, and the PR body this pass writes. No em-dashes, en-dashes, `--` as a separator, or curly quotes; no model vocabulary or puffery; sentence-case headings; active voice; say what it does, not how it feels - see `.claude/rules/writing-style.md`. Judge only what the change touches; pre-existing prose is out of scope by that rule's own terms. This line is the docs backstop for the judgment half of the rule. `platform-guard` (see "## Finders") flags dashes and its gate does fire on an em-dash in any hunk, but it checks characters only, so a docs-only or markdown-only change reaches no other reviewer for vocabulary, sentence construction, and voice. - Lucide React icons only (no inline SVGs) - Every JSX element rendered from `.map()` (or any array) carries a stable `key`. This check is review-only, since `react/jsx-key` left with `eslint-plugin-react` and no ESLint 10 plugin has replaced it - see `.claude/rules/ui-conventions.md` - `data-testid` and `data-swimlane-name` attributes for test selectors - Zustand stores with IPC bridge pattern - IPC channels defined in `src/shared/ipc-channels.ts` - Dialogs dismiss via `BaseDialog`'s structural Escape (registered display-only as `dialog.dismiss` in the `KEYBINDINGS` registry); flag a new ad-hoc `addEventListener('keydown')` shortcut outside the registry - see `.claude/rules/keybindings-registry.md` - `IntentKeyboardSensor` is the only dnd-kit keyboard sensor: it arms only on Tab-placed focus and cancels on a pointer press or a focus move, because the stock `KeyboardSensor` lifts a mouse-focused card on Space/Enter into a ghost that no click or terminal keystroke can end. Flag a `useSensor` site that registers `KeyboardSensor` (or a keyboard sensor of its own, or none while its sortables spread `attributes`), `attributes` and `listeners` spread on two different elements, a key added to the tracker's arming set without the default-action-moves-focus justification, a cancel path that dispatches a synthetic Escape / `visibilitychange` / `resize` instead of the sensor's own `onCancel`, and a transform on the board `DragOverlay`'s first child (dnd-kit measures it) - see `.claude/rules/keyboard-drag-intent.md` - Shared UI primitives: use `Select` (no raw `