Skip to content
Back to skills

Review

ASecurity

Unified Review

  • 7 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added December 4, 2026
ai-agentsrustgojavashellvuenodegitapisecurity

Works with

  • claude code
  • cli
  • api

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add mayankmankhand/llm-peer-review --skill review --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Review?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Review
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mayankmankhand-review/badge)](https://www.skillsdirectory.com/skills/mayankmankhand-review)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: review
description: "Unified Review"
---

# Unified Review

Run the right reviews automatically, combine findings into one report.

**Use this when:** You want a single command to review your changes. It detects what changed and dispatches the right specialists.
**Don't use this when:** You want a pre-release gate (use `/review-full`). Or you know exactly which review you need (use `/review-code`, `/review-ux`, etc. directly).

**The difference:** `/review` checks what you just changed. `/review-full` checks if the whole thing is ready to ship.

## Critical Rules

<rules>

1. **Reviewers never edit** - Specialists and the report phase never modify files; findings are their product
2. **Audit, then continue into the auto loop** - Findings are deduped and audited (M2: receipts, skeptical pass, three-vote for Blocks) BEFORE the report, so the report shows survivors only. After the report, do not wait for a human "fix it": auto-fix survivors (guards: M7, M9), re-verify (M3, M5, M6), and exit each finding as page (M1), digest, or log. Operating rules live in `.agents/tk/skills/shared/hitl-loop.md`, loaded by name at Phase 2 (the `loop-rules` skill). Saying "report only" keeps this run report-first (M10)
3. **Explain simply** - Use plain English, avoid jargon. A rule or finding code (M3, C-21, R5) in anything written for me says in plain words what it is and what it means for me on its first mention, looked up in its own file rather than recalled; that sentence carries no file name, hash or code term, which belong in the receipt row or the step's file list
4. **Respect the concurrency cap** - Max 4 parallel subagents per run

</rules>

## Focus Mode

<reference>

This command supports optional focus arguments:

- `/review` - auto-detect what to review based on changes
- `/review code` - just code quality
- `/review code,ux` - specific combination
- `/review full` - invokes the review-full skill (same as `/review-full`), passing on any `mode:` word
- `/review <base>..<end>` - a commit range plus any uncommitted work, e.g. `/review a1b2c3d..HEAD`; it combines with focus names (`/review code a1b2c3d..HEAD`). `/execute` passes one when it chains here (M14)
- `/review mode:cheap` - this run's model mode: `best`, `fit` or `cheap` ("Model modes" in `.agents/tk/skills/shared/model-routing.md`). It combines with focus names and a range; without one, the newest unfinished plan's Models line decides, else fit

If focus arguments are provided, skip the detection phase and dispatch only the specified specialists. The arguments map to skill names: `code` = review-code, `security` = review-security, `ux` = review-ux, `plan` = review-plan, `commands` = review-commands, `browser` = review-browser, `deps` = review-deps, `copy` = review-copy, `full` = review-full. An argument containing `..` is the range, and one starting `mode:` is the model mode; neither is ever a focus name. Nor are the phrases "report only" and "no chaining": they are the two per-run opt-outs (M10 and M14 in `.agents/tk/skills/shared/hitl-stages.md`), so set them aside before reading the rest of the arguments as focus names.

A focus name that matches none of those may be one of this project's own review kinds. Compare it against the rows under **Project review kinds** in Phase 1: that table is in this prompt on every run, because the harness expands the inline read when the command loads, so skipping Phase 1 skips detection, not the text; read the rows there and run nothing. A row's kind is the short name in parentheses in its Specialist cell when it has one (`Design Fidelity (fidelity)` matches `fidelity`), else the whole Specialist cell, compared ignoring case and surrounding spaces (`Design Fidelity` matches `design fidelity`). When a row matches, print exactly one line, "`<kind>` is a project review kind and runs on auto-detect only; run `/review` with no focus name to include it", and continue with the remaining focus names; when it was the only one, stop with "Nothing to run." A name that matches no toolkit name and no row: print one line, "`<name>` is not a review kind here; the names are code, security, ux, plan, commands, browser, deps, copy, full", drop it, and continue the same way.

</reference>

## How It Works

<procedure>

### Phase 0: Resolve the scope (every run)

`/execute` commits every green step, so uncommitted work alone can be empty when there is plenty to review. Decide what this run covers before anything else, with one call from the project root, run as literal words (never inside `$(...)`):

- with a range argument: `node .agents/tk/scripts/session-init.js --scope <base>..<end>`, passing the range exactly as it was typed
- without one: `node .agents/tk/scripts/session-init.js --scope`
- either way, with a `mode:<m>` word in the arguments: add `--mode <m>` to the call

It prints one JSON object (the full shape is in the script's header comment). Read:

- **`range.end` is the pinned end.** The review covers `range.base..range.end` plus the uncommitted work, and nothing after it. This run's own fix commits land after the report, so what comes after the review's starting point is the diff of the fixes M3 verifies and where M5's follow-up generation looks. M3 names that starting point: `uncommitted.baseline` from this same JSON when it is set (the tree as the review found it, so uncommitted work that predates the run is not read as a fix), else the pinned end. Keep `uncommitted.baseline`, `uncommitted.baselineError` and `uncommitted.untracked.files` from this call; step 3 of After the Report needs them. Fix the run stamp (`YYYY-MM-DD-HHMMSS`, the stamp the report and its receipts folder share) before that call and save its JSON as `reports/receipts/<run-stamp>/scope.json` by adding `--out reports/receipts/<run-stamp>/scope.json` to the one call (M16; a `>` redirect would stop default permission mode for approval). The script makes the folder, writes the whole object to the file, and prints it without its file and commit lists, plus `savedTo`, so `scopeLine`, `source`, `totals`, `plan`, `uncommitted.baseline` and the range's ends are all in what it prints however large the range; read the file lists from the saved file with the Read tool when a step needs them. An `outError` in the printed object means nothing was saved: correct the path and make the call once more: the snapshot id is a commit nothing points at, so once a compaction loses it it cannot be looked up again, and a second scope call made after the fixes returns a snapshot that already holds them. Read the three values back from that file at step 3 rather than from memory.
- **`source`** says where the range came from: `argument` (the range you were given), `plan` (no argument: the newest plan's `**Start commit:**` up to HEAD, used while at least one commit after it is unpushed; `plan.name`, `plan.commits` and `plan.unpushed` carry the file and the counts), `unpushed` (no argument and no plan applies: the newest unpushed commits, counted from the merge-base with the upstream, else with the remote's default branch; when a plan was passed over, `plan.reason` says why: `plan-no-start`, `plan-shipped`, `plan-start-missing`, `plan-start-not-ancestor` or `plan-no-commits`), or `none` (no range; `message` says why in one plain sentence).
- **`range.commitCount`** is the whole count; **`range.commits`** lists up to 20 of them, newest first. Only the unpushed source is ever capped: `range.capped` is true when older unpushed commits were left out, `range.omitted` counts them, and `range.fullBase` is where they start. The plan source is never capped, whatever its size.
- **The changed files** are `range.files` plus the `files` lists under `uncommitted.staged`, `uncommitted.unstaged` and `uncommitted.untracked`; `totals.lines` sums their added and deleted lines. From here on, "the diff" and "the changed files" mean this scope.

**The scope line.** Write nothing before the scope call. When it returns, print its `scopeLine` exactly as your first words, on a line of its own, before any other tool call, and open the report with the same line. The script builds it, Models part included ("Models: <mode>" and where the mode came from, plus any models warning), so the line reads the same on every run. Then act on what it reported:

- **A range argument that `source` reports as `none`:** the line says why the range cannot be reviewed. Stop, and ask for a range whose base is an ancestor of its end.
- **No commits in range and nothing uncommitted** (the line starts "Nothing to review"): on the auto-detect path, stop, adding "Pass a range: `/review <base>..HEAD`." unless the line already names a range to pass (a shipped plan's). A focus call does not stop here: it runs the specialists it names.

**Fallback:** if the script is missing or its output carries an `error` field, review the uncommitted work only (`git diff --name-only`, `git diff --name-only --cached`, and `git status --short` for untracked files; `git diff --numstat` for the size gate). An `error` output still carries a `scopeLine` saying no commit range was checked; with no script at all, print "Reviewing uncommitted work only; no commit range was checked. Models: fit (the default)." An output with no `scopeLine` (building the line failed) gets "Reviewing <range.commitCount> commits (`<range.base>..<range.end>`, short shas) and any uncommitted work. Models: <models.mode>." in its place.

### Phase 1: Detect (skip if focus arguments provided)

The changed files come from the scope (Phase 0). List their distinct extensions from the saved file rather than by eye, `grep -oE '"path": *"[^"]+"' reports/receipts/<run-stamp>/scope.json | grep -oE '\.[A-Za-z0-9]+"$' | sort -u`, and settle the dev-script question with `grep -cE '"(dev|start)":' package.json` (a count above 0; M16).

Categorize the changes and pick relevant specialists:

| What changed | Specialist | Finder agent |
|---|---|---|
| `.ts`, `.js`, `.py`, `.go`, `.rs`, `.java`, `.sh` files | Code Quality | the helper `review-code-finder` |
| The same code files (any code change) | Security | the helper `review-security-finder` |
| `.tsx`, `.jsx`, `.vue`, `.svelte`, `.css`, `.scss`, `.html` files | UX Quality | the helper `review-ux-finder` |
| Active `PLAN-*.md` exists in `plans/` | Plan Compliance | the helper `review-plan-finder` |
| `.claude/commands/`, `.claude/skills/`, `.claude/agents/` or `.claude/rules/` files changed, or a `.claude/toolkit/*.md` file other than `README.md` and `adoption.md` (the project's seam files, which stages paste in as prompt text) | Command Quality | the helper `review-commands-finder` |
| `package.json` or lockfile changed | Dependency Security | the helper `review-deps-finder` |
| Visual/UI changes AND (a dev server answers OR `package.json` has a `dev` or `start` script the finder can start) | Browser QA | the helper `review-browser-finder` |
| `README.md`, `index.html`, or files in `docs/`, `pages/`, `content/`, `posts/` (exclude `CHANGELOG.md`, ADRs, API refs, generated docs) | Copy Clarity | the helper `review-copy-finder` |

**Project review kinds.** Rows this project adds to the table above, in the same three columns, read from `.claude/toolkit/review-kinds.md`. Treat each one exactly like a row of the table: its Finder column names the project's own agent, dispatched by that name with the same per-run prompt and through the same audit. A note that the command printed nothing means this project adds none.

If `.claude/toolkit/review-kinds.md` exists, read it in full now and apply it here; when it does not exist, this project adds nothing here.

**Rules:**
- A file can trigger multiple specialists (e.g., a `.tsx` file triggers both Code and UX)
- **Security runs on every code change, alongside Code Quality.** The same files that select Code Quality also select Security (review-security). Code Quality asks "is this written well?"; Security asks "what can a malicious user make this do?" - different lenses, both run. Security has its own danger-spot gate, so it stays quiet on changes that touch no security-sensitive sink.
- When copy and UX both run on the same artifact, copy focuses on meaning/orientation while UX focuses on usability/accessibility. Deduplicate overlapping findings in synthesis.
- An empty scope never reaches this table: Phase 0 already stopped the run, or it is a focus call, which skips detection
- A project review kind is selected by its own What changed cell, on this auto-detect path only: a focus argument names toolkit kinds, and one that names a project kind says so (Focus Mode)
- For browser-qa, probe the common ports with `for p in 3000 3001 5173 8080 8888; do curl -s -o /dev/null -m 1 http://localhost:$p && echo up=$p; done` (each `up=` line is an answering port, no line means none; or let `browse.js`'s own `detectServer` probe run; M16) and pass the port as the dev server URL in the Run notes; with none answering, dispatch anyway when `package.json` has a `dev` or `start` script (the finder starts it in the background, per its criteria); with neither a server nor a script, skip Browser QA and say so under What I could not check
- A `[behaviour]` line in the plan's `## Must-check for review` section (M14) selects Browser QA the same way a visual change does, because a design loop's still images could not see behaviour. A surface the finder could not reach comes back on its `NOT CHECKED:` line and lands under "What I could not check"

### Phase 1.5: Size gate (skip the fan-out for tiny diffs)

This gate applies only to the auto-detect path. (Explicit focus calls like `/review code` and `/review full` skip detection entirely, so they never reach this gate - the specialist you named always runs, regardless of size.)

Count the changed lines: `totals.lines` from the scope, which sums added and deleted lines across the range, staged, unstaged and untracked work, so committed lines count as well as uncommitted ones. **If the total is under 50 changed lines AND none of the selected specialists is a never-gate one, skip Phase 2's dispatch and review the diff inline** in a single pass. Run Phase 2's load first, because every later phase cites those rules: `.agents/skills/loop-rules/SKILL.md`, then `.agents/skills/report-rules/SKILL.md`. Then read `.agents/tk/skills/shared/severity-anchors.md`, `.agents/tk/skills/shared/finding-id-system.md` and the `.agents/tk/skills/shared/criteria-<kind>.md` of each flagged domain, because on this path no finder brings them, and follow each as a dispatched finder would: one pass, the plan the Plan Compliance row selects, no question to the user. Leave out Browser QA's, since this path drives no browser, and name it under "What I could not check". You (the orchestrator) then read the changed files and produce the report yourself, using the same severity anchors, finding IDs, and output format the specialists would use, covering whichever domains the file-type table flagged. Set each inline finding's `specialist` to the review kind it belongs to, by its focus name (`copy`, `commands`, `plan`, `ux`), so its receipt file, its report tag and the page's `lenses` all carry that one word. Author a `receipt` for each inline finding and run the Phase 4 audit before writing the report - tier 1 inline, tiers 2 and 3 via fresh subagents per the inline-path note in Phase 4.

**Never-gate specialists:** Dependency Security (selected when a `package.json`/lockfile changed) and Security (selected whenever code changes). Either one's presence disables the size gate for the whole run - diff size is not a proxy for risk. A one-line change can introduce a severe vulnerability or pull in a bad dependency, so neither security pass is ever skipped for being small. (Trade-off: because Security is selected on any code change, code reviews fan out to subagents rather than taking the fast inline path - the deliberate cost of never size-gating security.) A project review kind is never-gate as well: the inline path applies the toolkit's own criteria, and a project kind's criteria live in its agent, so the orchestrator has nothing to review it with. A `[behaviour]` must-check line (Phase 1) makes Browser QA never-gate as well: the inline path only reads the changed files and drives no browser, so a small diff would otherwise drop the one check that line exists to force.

The inline path continues into the same auto loop after the report (see "After the Report" below) and still obeys the HTML gate; it simply has no specialist subagents to dispatch - the Phase 4 audit still dispatches its skeptics per the inline-path note.

### Phase 2: Dispatch

**Load the loop rules and the report rules now**, through the Skill tool: `.agents/skills/loop-rules/SKILL.md`, then `.agents/skills/report-rules/SKILL.md`. Everything from here on cites them, so do not go on without both in context. The first specialist to return has receipts to run under them.

Each specialist is a typed finder agent that already carries its expertise. The agent's `skills:` frontmatter preloads its `review-<kind>-criteria` skill (the How to Review criteria, reading budget, severity anchors, finding ids, and the finding contract) and the `dispatch-contract` skill (single pass, JSONL out, never audits its own findings), and its expert role is the first line of its body. Nothing from a SKILL.md is read here or pasted into a prompt: the prompt carries only what differs per run.

1. Gather project context with the `project-context` skill: invoke it through the Skill tool (`.agents/skills/project-context/SKILL.md`; it is agent-only, never a slash command) and follow its instructions. Its summary goes into every finder prompt.
2. Read the changed files once, here, so each finder receives the relevant excerpts instead of re-opening every file (paste-don't-read). A change committed in the range shows in `git diff <range.base> <range.end> -- <path>`, and uncommitted work in `git diff HEAD -- <path>` (an untracked file is new in full); single-quote a path that holds a space.
3. Spawn one subagent per selected specialist with the Agent tool, using the exact `subagent_type=` value in the Finder column of the Phase 1 table (one typed finder per kind; the table holds the dispatchable name, so copy it rather than composing one), with `model` set to its `models.perRole` value, where `session`, or a model above your own, means your own model family's alias; a project kind's own agent has no entry there and takes no model. Its effort and tool set (no file-editing tools) come from its frontmatter per the roster in `.agents/tk/skills/shared/model-routing.md`. Fallback per that rule: when the type is not found, dispatch `general-purpose` carrying the same `model` plus what the agent's two skills would have preloaded, pasted as the fragments those skills include rather than the SKILL.md files, whose include lines do not expand when pasted: every file named on an include line of `.agents/skills/review-<kind>-criteria/SKILL.md`, in its order (for most kinds `criteria-<kind>.md`, `reading-budget.md`, `severity-anchors.md`, `finding-id-system.md`, and `finding-contract.md` from `.agents/tk/skills/shared/`; security adds `do-not-report.md` and browser adds `browse-api.md`), then the contract paragraph of `.agents/skills/dispatch-contract/SKILL.md` followed by `.agents/tk/skills/shared/dispatch-format.md`. A project review kind has no such fallback, because its criteria live only in its agent: when that type is not found, skip the kind and say so in the digest, naming the row (the plugin's upgrade command in Claude Code reports a row whose agent is missing, C-12).

**Concurrency:** Dispatch up to 4 subagents in parallel. If more than 4 specialists are relevant, run the first 4 in parallel, wait for results, then run the remainder - in practice most runs select 1 to 4 specialists, so the second wave is the exception, not the norm. Browser QA is always sequential (it drives a browser), so it runs last if included. As each specialist returns, write its findings' receipts to a checks file and run them through `run-checks.js` right away (the save form under "Where the report is written" in the report rules loaded at the start of this phase) instead of waiting for the whole wave - M2's Concurrency note (in the loop rules loaded at the start of this phase) is authoritative for this tier-1 overlap.

**Subagent prompt template:**
```
Project context:
[PASTE PROJECT CONTEXT SUMMARY HERE]

Scope:
[THE PHASE 0 SCOPE LINE, as the script printed it, e.g. "Reviewing 6 commits (`a1b2c3d..e4f5a6b`), your unpushed commits; no plan names a start commit, plus uncommitted work. Models: fit (the default)."]

Files to review (excerpts already read for you):
[PASTE THE RELEVANT EXCERPTS OF EACH CHANGED FILE IN THE SCOPE, committed in the range or uncommitted. For a file over ~400 lines, paste the changed sections plus ~50 surrounding lines and point at the path for the rest.]

Run notes:
[ONLY WHAT THIS RUN NEEDS, OR OMIT THE SECTION: the focus arguments; the plan file path for the plan finder; the dev server URL for the browser finder; for the browser finder, each `[behaviour]` must-check line verbatim, with "exercise the stateful controls on this surface that the design loop's pass did not cover"; which other specialists run alongside, so copy and UX split meaning from usability.]
```

The role, the criteria, the review lens and the single-pass contract live in the agent and the two skills it preloads, so a dispatch does not carry them. What the finder returns is fixed by the `dispatch-contract` skill; the orchestrator parses that format, so it is pasted here from the one file both share:

Read `.agents/tk/skills/shared/dispatch-format.md` in full now and follow it as part of this file.

**If a subagent fails** (error, timeout, empty response, or output that will not parse as JSONL; a `NOT CHECKED:` line beside the JSONL or `NO FINDINGS` is part of the format, not a parse failure), re-dispatch that one finder once with the same prompt - and when it ran on a cheaper model than yours, dispatch the retry on your own model per guardrail 2 in `.agents/tk/skills/shared/model-routing.md`. Malformed output counts as a failure precisely because it is silent: a specialist that returns prose instead of JSONL has produced nothing the run can use. Whether a return parses is the merge helper's call, not a reading: write it as `reports/receipts/<run-stamp>/work/<finder>/findings.jsonl` with the Write tool and run `node .agents/tk/scripts/merge-findings.js` on that folder; exit 1 with `{"error":"bad_line"}` on stderr is the parse failure, while `NO FINDINGS` and `NOT CHECKED:` lines are skipped and exit 0 (M16). Text a specialist wrote beside its findings is not a parse failure either: the helper sets aside each line that cannot be a finding, exits 0, and prints it on stderr as `set aside`; Phase 3 says which of those lines to list. Still failing after the one retry: a hard stop, handled per "When a finder fails" in M2 (`.agents/tk/skills/shared/hitl-loop.md`, in the loop rules loaded at Phase 2): page with retry, continue anyway, or stop, and hold the chain until the answer. Do not improvise a variant, and never let it pass as a note.

### Phase 3: Synthesize

**Seed the must-check items**. List the `## Must-check for review` section (M14) of the plan the Plan Compliance row selects with `node .agents/tk/scripts/session-init.js --must-check plans/<plan>.md` (M16): it prints the section's `lines` verbatim, `found` false means the plan has no section and seeds nothing, and an `error` field means the plan could not be read, which goes under "What I could not check". Each `[plan]`, `[design]`, `[interaction]` and `[check]` line becomes one finding, added before dedup so a finder that raised the same gap corroborates it rather than duplicating it:

- `severity`: `warn`. The item already survived a fresh judge's read, and a Block needs a user harm the orchestrator cannot assert on that judge's behalf.
- `specialist`: `plan-critic`, `design-critic`, `interaction-pass`, or `check-first` for a `[check]` line.
- `file`: for a design or interaction line, the surface's source file as the Surface row of the plan's UI/UX Design section names it; for a plan line, the file it names; otherwise omitted.
- `what`, `context`, `fix`: written from the line to the finding contract.
- `fields`: a `Source` row carrying the line verbatim, the one attachment every seeded finding has; a design line adds its `Screenshot`.
- `key`: per the dispatch format pasted in Phase 2.
- `receipt`: written by the orchestrator against the work as delivered (the code, the tests, and the evidence the plan's Outcomes cite), never against the plan text the gap was raised on, with a machine `expect` so the checks script decides it: `{"exit": 0}` for a test run or a `test -f`, `{"match": "<pattern>"}` for a grep or file read. A design line's re-capture of the surface runs `browse.js` directly when a server is reachable (the script runs read-only commands only): one screenshot per surface, not the failing-action re-run M2 rules out before the report; the orchestrator copies that capture into `reports/receipts/<run-stamp>/` with its own file tool first (browse.js saves to /tmp, which the runner refuses to read) and the receipt's check reads the copy (`test -f reports/receipts/<run-stamp>/<name>.png` with `{"exit": 0}`). An interaction line re-runs its session the same way, its receipt a `grep` over the saved session output with `{"match": ...}` on the result the line names. With no server, either one falls back to what the design loop saved (the screenshot, or the session's failing output) and the finding says it was not re-checked. A plan line's check is a grep, file read, or test run whose output shows the gap still holds. A `[check]` line's check reads the record the line names: a grep over that `results.json` with `{"match": ...}` on the flagged row (its `"flaky":true`, its `"slow":true`, or a guard's failing verdict), and for a flake a grep over the kept `first-run/<id>.txt` and the passing `<id>.txt` beside it.

**Seed the plan's tally.** When the selected plan carries check lines (`grep -cE '^ *- Check( +(target|guard)\b| *:)' plans/<plan>.md`, the start the runner reads as a check line, prints more than 0; M16), run `node .agents/tk/scripts/run-checks.js --plan plans/<plan>.md --tally` (M16): its one JSON object gives each step a status (M17). Each step whose status is `unproved`, `missing` or `problem` becomes one finding in the same shape, `specialist` `check-first`, its `what` the step and the tally's reasons; so does each entry in the tally's top-level `problems` list, and each id in a step's `flaky`, `slow` or `brokenBefore` list that no `[check]` line already names (its receipt a grep over that step's `results.json` for the flagged row). A `proved` step is done and a `noTarget` step opted out; a step's `notes` (a record that names no command) go to the digest, not a finding. The tally cannot be a receipt, because the checks script runs only read-only commands and refuses itself, so the receipt reads the evidence the status rests on: `test -f reports/checks/<plan>/step-<N>/<phase>/results.json` with `{"exit": 1}` for a missing record, a grep over that `results.json` with `{"match": ...}` on a failing or changed row, and for a missing or broken check line a grep over the plan with `{"match": ...}` on the line, or `{"lines": {"max": 0}}` on the step's check lines when it has none. A finding seeded from a step's status or from a top-level problem is report-only: a step either showed its stated failure before its work and passed after it, or it did not, and running a phase now cannot change that, so the digest lists it as needing the user, who decides whether to redo the step or accept it. A flagged check (`flaky`, `slow`, `brokenBefore`) is fixed like any finding.

A gap that no longer holds fails its receipt and is logged `RECEIPT FAILED`: dismissed with proof, which is the point of carrying it. A gap whose check passes only when its search finds nothing, and found something, goes to the double-check first, like any finding (M2, tier 1). The `[behaviour]` line is not a finding; Phase 1 and the Run notes route it to the browser finder. The inline path (Phase 1.5) seeds the same way.

Collect the JSONL findings from all subagents (a specialist that emitted `NO FINDINGS` contributes none), together with the seeded ones. Set each `NOT CHECKED:` line aside with its specialist's name for "What I could not check" in Phase 5: it is a disclosure, never a finding, so it gets no ID, no receipt and no audit. Treat each `set aside` line the merge helper printed for a specialist's reply the same way when it names something that specialist could not check, as `[<specialist>] <its text>`, and drop a code fence, a sign-off or a summary of its own findings. Then:

1. **Merge, sort and number** - Write every finding line this run collected, the workers' lines and any the runner authored itself, into `reports/receipts/<run-stamp>/work/findings.jsonl` with the Write tool (the run's own records folder, under the stamp this run's report carries: a restart clears the temp folder, and the run still needs this file), then run `node .agents/tk/scripts/merge-findings.js` on that file, typed as literal words: its stdout is the deduplicated, sorted, numbered set (R1 onward, no gaps) and its stderr line carries the raw and merged counts. That line also carries the `B block / W warn / S suggest` split; take those numbers from it, never from a recount, since the Block count is what sizes tier 3 (M16). Two findings that describe one defect under different keys are the one judgment this pass leaves to you: before running the helper, give the later one the earlier one's `key` and record the merge in the report's dedup notes. A merged finding keeps every source receipt (tier 1 runs each of them, and the finding stands if at least one check passes, so a corroborated finding never dies on a single badly-written check), the browser evidence fields beside the code ones, and the highest severity of its sources: severity is what routes the audit in Phase 4, so a Block merged down to a Warn would face one skeptic where M2 requires three voters, and two specialists independently flagging the same spot is corroboration, which never lowers confidence.
2. **Tag each ID** with its merged specialist string: `**R1** [code] 🚫`, `**R3** [ux, plan] ⚠️`. The audit runs next, so some IDs will exit to the Audited out log rather than the report; the sequence stays gap-free across report plus log, and audit verdict lines reference these IDs.

### Phase 4: Audit (M2)

The three-tier audit runs here, between dedup and the report: the orchestrator is M2's *runner*. M2 in `.agents/tk/skills/shared/hitl-loop.md` (in the loop rules loaded at Phase 2) holds every mechanic - the tiers and what each covers, the skeptic instruction, the verdict formats, dispatch hygiene, the concurrency note, and the redispatch-on-failure rule. Do not restate them here and do not improvise a variant.

What is specific to this path:

- **The bytes are JSONL.** A finding's `receipt.check` is its tier 1 command and `receipt.expect` is what its saved output must satisfy: a machine form the checks script decides. A merged finding carries every source receipt and stands if at least one check passes (Phase 3). What tiers 2 and 3 receive is the original JSONL lines plus each receipt's actual output.
- **The shards come from the script.** Write them, dispatch them and read the returns exactly as M2's "Shards and verdicts by script" paragraph says, with the merge folder Phase 3 made; never retype a finding or a receipt into a skeptic's prompt.
- **The inline path is not exempt.** When Phase 1.5 reviewed the diff inline, the orchestrator authors receipts for its own findings and runs tier 1 the same way, but tiers 2 and 3 still dispatch fresh `audit-skeptic` agents. M2's never-judge-your-own-findings rule applies here exactly as it does to dispatched specialists.
- **Seeded items are audited like any finding.** The orchestrator wrote their receipts in Phase 3, as it does on the inline path, and tiers 2 and 3 judge them exactly as they judge a finder's. In the receipts folder their `<lens>` is the seeded specialist (`plan-critic`, `design-critic`, `interaction-pass`, `check-first`).
- **The skeptics are typed.** Tier 2 shards and tier 3 voters are the helper `audit-skeptic` dispatches (no edit tools, `effort: high`, session model, per the roster in `.agents/tk/skills/shared/model-routing.md`); the whole prompt is M2's one line naming the tier and the shard file `--shards` wrote, which carries the verbatim bytes. Fallback per that file: when the agent type is not found, `general-purpose` with no model parameter and M2's instruction for that tier pasted in.
- **Save each check's output as it runs**, with the form under "Where the report is written" in the report rules loaded at Phase 2 (the folder, the `<run-stamp>`, the `<lens>-<n>` id and file name, the checks file and the `run-checks.js` call). It lives in the template so a directly typed skill follows the same form; do not restate it here. On this path `<lens>` is the finding line's `specialist`: the specialist that authored it, or on the Phase 1.5 path the review kind the orchestrator wrote there.
- **Split notes become findings once.** After the verdicts, the runner turns each split note into one seeded Warn per M2: one per refuted finding, a line appended to the run's `findings.jsonl` with `"followup": true` so it takes the next free number and no ID moves, with the refuted finding's first `specialist`, its own `key`, the note word for word in a Source row, and a fresh receipt written against the work and run through tier 1 as `<lens>-<n>` in the run's receipts folder. Then one tier-2 pass, all before the report: `--shards` with `--drop` naming every earlier ID and `--out` a fresh `followup/` folder there, then `--verdicts` on its returns. A survivor is fixed and re-verified with `--verify` like any Warn, in the run's one ledger, and this counts as M5's one follow-up generation, so a split note on a seeded Warn stays a digest note.

Killed findings exit to the Audited out log (never fixed); survivors proceed to Phase 5 with receipts attached.

### Phase 5: Report

1. **Derive the markdown report** from the surviving findings using the format below, opening with the Phase 0 scope line: each finding's `what` becomes the dash summary line, each `fields[]` row becomes a labeled sub-bullet in order, and each finding's `receipt` plus the output tier 1 captured for it fills the template's final **Receipt:** row. Killed findings render in the template's Audited out section.
2. **Write that markdown to disk** per the "Where the report is written" section of the report rules loaded at Phase 2. Use `orchestrator` as the `<who>` segment. The section holds the path shape, the stderr rule, and why the on-disk copy is the canonical one; do not restate them here.
3. **Derive the HTML** (when the gate fires) from the SAME findings structure, at the END of the run - see HTML Companion below. On an auto run that is after the loop below has settled, so the page shows what was fixed and what is still open; on a "report only" run it is right after this report, since nothing gets fixed. The findings are authored once (by the specialists) and formatted twice (markdown + HTML); they are never re-written. The HTML is a reader's view and may carry less than the markdown; the markdown never carries less than the HTML.

</procedure>

## Output Format

<output_format>

### Specialists Dispatched
```
[code] ✅ | [ux] ✅ | [plan] ⏭️ skipped (no plan file) | [deps] ✅ | [security] ❌ failed (continued without it)
```

A `❌ failed` chip is the specialist that still failed after its retry and was continued past on the human's answer (M2); it is also listed under "What I could not check" in the markdown report (`report-format.md`), so the archive names the gap and not only the page.

When Phase 3 seeded must-check items or tally findings, the line ends with one more chip, `[must-check] N seeded from <plan file>`, N counting both, so the report shows the plan's open gaps and unproved steps were entered and not dropped.

### Base Structure

The orchestrator report uses the two-sentence finding contract from the report rules loaded at Phase 2. This is the single source of truth - do not duplicate it elsewhere.

The orchestrator fills this structure from the surviving JSON findings (Phases 3-4): each finding's `what` becomes the dash summary line, `context` becomes the unlabeled sub-bullet under it when present, `fix` becomes the **Fix:** row, and any `fields[]` attachments become labeled sub-bullets in order. It does not re-author the prose - it formats what the specialists already wrote.

The template and the contract are in the report rules loaded at Phase 2.

### Orchestrator Supplement

The orchestrator adds a `[specialist]` tag right after each finding ID, indicating which specialist flagged it. A finding Phase 3 merged lists every source: `[code, ux]`.

The Top Issues line also carries the tag: `🚫 X Blocks: R1 [code] (file:line - one-line What)`.

**Suppress the template's Summary block.** The report template (in the report rules loaded at Phase 2) includes its own `### Summary` block. Do NOT render it. Use only the orchestrator-specific Summary below (which adds Specialists run and Deduplicated findings). Otherwise the report ends with two Summary blocks and the reader cannot tell which is authoritative.

**Merging code+browser findings.** When both the code and browser specialists flag the same issue, the helper keeps every field from both: the browser evidence fields (Expected, Actual, Screenshot, Evidence) pair with the code root cause to form a unified evidence-plus-fix report, in the template's field order, unchanged.

The tag is the only thing this section adds to a finding. Every row - the three prose keys (`what`, `context`, `fix`), the browser evidence fields, and the audit-time **Receipt** row - is defined by the report template loaded at Phase 2 and rendered from there:

- **R1** [code] 🚫 `file:line` - [What]
  - [field rows per the template, **Receipt** last]

- **R3** [code, browser] ⚠️ `file:line` - [Issue flagged by both code and browser specialists]
  - [browser field rows per the template, **Receipt** last]

### The first screen (orchestrator, HTML only)

The HTML companion opens on a **bottom line**, not on a counter strip. Write two or three sentences, 25 words or fewer each so the bottom line fits the page's first screen, in fixed slots: is it safe to ship (including "I could not tell, because..." when that is the honest answer), the one other thing that matters, and what happens next. Then one **disposition** sentence carrying counts only: how many were fixed, deferred, and left unchecked. It must not restate a bottom-line sentence. The bottom line says what happens next in words; the disposition says how many, in figures.

Also fill **What I already fixed** and **What I could not check**; each `NOT CHECKED:` line a specialist returned, and each `set aside` line Phase 3 kept, goes under the latter as `[<specialist>] <its sentence>`, on the page and in the markdown report. These are the base-rate disclosure: a short list of open findings reads as a review that did not look hard unless it sits beside the count of what was handled and the named limits of the pass. Never omit the limits when limits exist.

Derive all four from the run you just did. None of them is a new judgement: the bottom line follows the same mechanical rule as the Overall Verdict below, the disposition is a count, and the two lists are records of what the loop already did.

### Overall Verdict, readability, and the security nudge (orchestrator)

The report template loaded at Phase 2 defines the **Overall Verdict** line, the **readability backstop**, and the receipt rule. Apply each across the merged run rather than per specialist. Two things are specific to this path:

- **Compute the Verdict from the audit survivors**, not from everything the specialists reported. A Block the Phase 4 audit killed does not make the run `changes-requested`; the same goes for the readability backstop's count.
- **Security escalation nudge:** if the changed files touch a genuine trust boundary - a new route/endpoint, file upload, or webhook; authentication logic; crypto; or secret handling - append one line after the report: _"Consider `/security-audit`: this change touches [X], which deserves a deeper whole-repo pass."_ Only when a trigger is genuinely present; the Security specialist also emits this when called directly.

### Audited out

Rendered exactly as the template's "Audited out" section defines it - placement, verdict labels, the `Audited out: none` line, the empty-run rule, and the never-omit rule. The orchestrator's only addition is the `[specialist]` tag on each ID, as everywhere else: `- **R7** [code] \`RECEIPT FAILED\` - [What] (check output did not show the claim)`.

### Summary (orchestrator-specific)
- Scope: `<base>..<end>` (N commits, <why>) plus uncommitted work, as Phase 0 named it
- Specialists run: X of Y
- Files reviewed: X (`totals.fileCount`, read back from `reports/receipts/<run-stamp>/scope.json`; M16)
- Blocks: X | Warns: X | Suggests: X (audit survivors)
- Deduplicated findings: X (Y raw findings from specialists; both from the helper's `merge-findings:` stderr line, never recounted; M16); audited out: Z

End the report with one line so the user knows what happens next. On a "report only" run: _"Report only, as you asked: nothing was fixed on this run. The next run goes back to fixing automatically."_ On any other run: _"The loop now auto-fixes and re-verifies the surviving findings (auto loop in `.agents/tk/skills/shared/hitl-loop.md`); saying 'report only' at the start would have kept this run report-first."_

</output_format>

## HTML Companion (when gate fires)

After writing the markdown report, evaluate whether to also generate an HTML view.

**The gate:** render the review page whenever this run has any surviving finding, or this branch's standing page already exists (`node .agents/tk/scripts/render-html.js --standing --name review` prints `"exists":true`; M16), so the run can carry it forward or take it to empty. Skip only when there are no findings and no page yet.

**When the gate fires, load the page rules now**, through the Skill tool: `.agents/skills/review-page/SKILL.md`, and render per them: the shell, the payload, the `--no-abs` decision and how the page reaches the user all live there.

For orchestrator output specifically:
- Pass `--name review --stable` to the helper: the HTML is one standing page per branch (the renderer names it), not one per run. Set `lenses` to the specialists this run dispatched, less any the page rules leave out, so the renderer replaces only their findings and carries the other lenses' open findings forward (the page rules say how), and `reviewedFiles` to every `path` in the scope's file lists (`range.files` when there is a range, plus `uncommitted.staged.files`, `uncommitted.unstaged.files` and `uncommitted.untracked.files`), read back from `reports/receipts/<run-stamp>/scope.json` (`grep -oE '"path": *"[^"]+"' reports/receipts/<run-stamp>/scope.json | cut -d'"' -f4 | sort -u` lists them; M16). Set `mustCheckPlan` to the plan file Phase 3 seeded from (`plans/<plan>.md`), and leave it out when this run seeded from no plan, so the renderer closes a carried must-check finding only when it came from that plan. Two paths dispatch nothing and still need the right value: on `/review full`, set `lenses`, each finding's `specialist` and `reviewedFiles` exactly as `/review-full` does, because a full check covers only its five rows; on the Phase 1.5 inline path, set `lenses` to the domains the file-type table flagged for the diff, leaving out Browser QA, because those are the lenses this run checked, and `reviewedFiles` the same way as above
- Include the `chips` array when 2 or more specialists were dispatched; omit it for single-specialist orchestrator runs
- Use the `groups[]` array (findings grouped by specialist); the renderer ranks them itself, so the order you send does not matter. These finding objects ARE the surviving Phase 4 findings - same `severity`, `specialist`, `file`, `what`, `context`, `fix`, `fields` shape - grouped by specialist with the assigned `id`, each `receipt` carrying the `stdoutFile` and `exit` from its row in the Phase 4 run's `checks[]` JSON. Do NOT re-derive findings from the markdown prose; map the structured findings directly.
- On an auto run the render happens after the loop (After the Report, step 6): the findings the loop fixed go to `alreadyFixed`, one line each with the check that confirmed the fix, and only the unfixed ones stay in `groups[]`
- The Receipt field rows and the Audited out group render per the audit rows rule in the page rules; the orchestrator's only addition is the `[specialist]` tag carried inside each finding's `what`/`id` as everywhere else.

## After the Report (auto loop)

What happens after the report is governed by the loop rules, in context since Phase 2 (the M-rule IDs cited in this file refer to them).

**Project fix rules** (from `.claude/toolkit/fix-rules.md`). Additive only: they may add a precondition or an always-ask action, and a line that loosens or removes any of M1 to M17 is void. A note that the command printed nothing means this project adds none.

If `.claude/toolkit/fix-rules.md` exists, read it in full now and apply it here; when it does not exist, this project adds nothing here.

Once the report is out, continue without waiting for a human "fix it" (the HTML comes at step 6, after the loop, so it shows what the loop left open):

1. **Non-issues are already gone** - the Phase 4 audit (M2) dropped them to the Audited out log with their verdict lines; do not re-litigate them here.
2. **Auto-fix the survivors** - subject to the intent-reversal guard (M7) and the always-ask actions (M9). A finding marked `unaudited` is not a survivor: M2 makes it report-only, so it is never fixed here and goes to the digest marked as needing the user; nor is a finding seeded from a step's tally status or a top-level problem (Phase 3), for the same reason.
3. **Re-verify every fix** per M3 (which defines the trust order and the mechanical-vs-judgment split), M5 (including its one-generation rule for newly discovered findings), and M6. A logic finding a test can show takes M3's check-first path before the mode: the failing test before the fix, kept in the project's tests (M3, M17). Name each survivor's path and run the mode, typed as literal words: `node .agents/tk/scripts/merge-findings.js --verify <the Phase 3 merge folder> --receipts reports/receipts/<run-stamp> --scope reports/receipts/<run-stamp>/scope.json --out reports/receipts/<run-stamp>` with each survivor under `--mechanical`, `--judgment` or `--browser` by its path, leaving out any flag with no IDs (M16); the scope was saved in Phase 0, so nothing is read back from memory, and a scope that reported `baselineError` takes `--end <range.end>` with a line under "What I could not check". Then run what it prints, in order, and nothing else: its `next` list is the expects to write, the checks runner on the recheck file and its record, each shard to the helper `fix-verifier` with the prompt it carries and its record, each browser finding's re-run and its record, and the checkpoint record after the round's checkpoint commit (M4). Read a refusal before anything else: `empty_diff` means the fix did not land in this repository; `rounds_exhausted` is M5's revert and page; `line_addressed` means a receipt reads lines by their number, which no recheck can follow when the text moves, so run the `retry` it prints, the same call with those findings under `--judgment`. A second round names its IDs to the mode again.
4. **Route each finding to its exit** - page only per M1; everything else lands in the digest or the log.
5. **Close the run in chat** - summarize the digest with receipts (M8): what was fixed, what the audit and the loop dropped, and any page that needs the user, each finding named in plain words before its verdict (the words of its `what`, with file names, hashes and code terms left to the receipt), so the reader never has to decode an R-number.
6. **Write the digest to disk and render the standing page** - append a `## Digest` section to the markdown report Phase 5 wrote: one line per finding with its verdict, its plain words and its receipt (`- R3: FIXED - <the finding's what, with file names, hashes and code terms removed> - <check>`, `- R5: NOT FIXED - <what it is, what happens if it ships as is, what you are asked> - <what was tried>`, `- R7: PAGED - <the same three parts> - <what needs the human>`; a `(round 2)` qualifier, or `(round 3, the owner's choice)` after an approved extra try (M5), may sit between the verdict and the first ` - `), plus any finding the loop discovered on the way. The plain-words part starts from the finding's `what` and holds no file name, hash, flag, function name or backticked term and no ` - ` of its own, because the chain gate (M14) reads the text between the verdict's ` - ` and the next ` - ` as the words and refuses a line without them or with such a term in them. On a run with no findings, the Digest is the one line `- No findings.`, since the hand-off check refuses an empty Digest. A finding the loop never fixed keeps the verdict its exit gave it (REFUTED, RECEIPT FAILED, UNAUDITED and the other settled words the check lists); any other capitals word stops the hand-off. Chat scrollback is not a file, and the fixes were the one part of the run that had none. Then render the HTML per the HTML Companion section when its gate fires, which with a standing page in place (`node .agents/tk/scripts/render-html.js --standing --name review` prints `"exists":true`; M16) is every run, a clean one included, so the page can go empty: fixed findings in `alreadyFixed`, unfixed ones open, `lenses` set to the specialists that ran and `reviewedFiles` to the scope's files (the HTML Companion section says which), `disposition` recounted; publish and record it per the page rules. This is the run's one render.
7. **Chain into `/document`** (M14) - once the loop has settled, run `node .agents/tk/scripts/session-init.js --chain review --report <the Phase 5 report's path> --ledger reports/receipts/<run-stamp>/ledger.json` (M16; leave `--ledger` out when the run never called the mode). M14 is authoritative for the conditions; the script decides the countable ones from the Digest and the ledger. On `pass`, announce the handoff in one line ("Review complete - chaining into `/document` per M14. Say \"no chaining\" to stop here.") and invoke `/document` through the Skill tool; on a fail, say the condition it printed. **Two stops the script cannot see still block:** a specialist that failed its retry and whose page is unanswered, and an M11 tripwire hit; name them yourself. An M9 approval already granted does **not** block, so a cycle that edited prompt files still chains once the approvals are in. A cycle summary written over a reverted state is exactly the bookkeeping drift M8 exists to prevent. The debate stages are never chained into. To run one between review and document, drive the two stages yourself: say "no chaining" when you approve the plan (`/execute` then runs and stops), type `/review <start>..HEAD no chaining` with the plan's `**Start commit:**` sha (the review runs and stops), run the debate, then type `/document`.

Two separate per-run opt-outs: saying "report only" on the invocation keeps the entire run report-first (M10), and saying "no chaining" runs the review and stops without invoking `/document` (M14).

## HTML Output Rules

When to render and the temporary-folder steps are in the report rules loaded at Phase 2; how a page reaches the user is in the page rules loaded at the gate. Nothing is pasted here.

<rules>
## REMEMBER: Specialists report; the loop fixes. After the report, continue per the auto loop above and chain into `/document` (M14); "report only" keeps a run report-first (M10), "no chaining" stops after this stage.
</rules>

**Next:** `document`. When this stage's handoff check prints `pass`, open that skill and follow it, as the rules block says. When it does not, or the user said "no chaining", stop here and tell the user to type `$document` in Codex, or `/document` in Antigravity and Gemini CLI.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.