Harness Intelligence Wiki
HarnessEntry Points

Review

One scripted Full Code Review Pass by one fresh Reviewer, ending in one Pass Report and a returned route

$review-phase runs one Full Code Review Pass over a committed Git change. The script scripts/review.mjs does the mechanics. One fresh Reviewer subagent finds and verifies its own findings. retain writes and commits one Pass Report and returns one route. Delivery owns every repair, debugging, debt, documentation, and closeout transition. Terms follow the Review Phase Token Rebuild Glossary.

  • Use this when: a delivery reaches review_due, or an operator wants a standalone review of a commit or commit range.
  • It gives you: at most five verified P0–P2 findings with stable IDs, one committed Pass Report, and one route.
  • It ends with: a returned route, or a one-sentence blocker that the agent relays unchanged.
  • Wrapped skills: none. The reviewer brief references/reviewer.md holds the whole lens.

review-phase is explicit-only (disable-model-invocation: true). Delivery reaches the skill by path; an operator names it for a standalone review. External GitHub and Codex pull-request reviewer integration is out of scope.

Invocation Boundary

Every delivery goes through review, whatever its size. No delivery reaches docs ingest or closeout without a valid Pass Report.

  • Full delivery: delivery-phase persists review_due and starts $review-phase without an operator stop.
  • Other delivery modes: delivery persists review_due and the invocation context, names $review-phase with that context as the next phase in its stop report, and stops. The operator invokes $review-phase with that context and later resumes delivery explicitly.
  • Standalone: the operator commits the plan, spec, docs, or code first, then passes a commit or <base>..<head> range. The run reads and writes no delivery counter.

The phase-handoff reference maps the invocation context to the prepare options --goal, --base, --spec, --accepted-risk, and --human-direction.

Pass Flow

The root agent makes three script calls and starts one subagent. Each review.mjs call prints one JSON line.

  1. Status. review.mjs status --goal <delivery-dir> returns next, run_dir, and pass_count. Delivery enters here and continues at the step next names (prepare, review, retain, or done). Standalone review starts at step 2.
  2. Prepare. review.mjs prepare --goal <delivery-dir> --base <sha>, or prepare --standalone <commit-or-range>. It freezes the target, checks the pass budget, and writes packet.json with base, head, changed_paths, and context: the AGENTS.md chain, the matched Codebase Rules (rows whose path trigger matches a changed path, plus rows with no path glob but a task trigger; a Markdown-link File cell names the file by its target), and the spec folder's SPEC.md, ARCHITECTURE.md, and PLAN.md.
  3. Review. The agent starts one fresh general-purpose subagent in the foreground: a new agent, never a fork or an earlier agent. Its whole prompt is the path of references/reviewer.md and the run_dir; it gets no summary or view of the change. The step completes when the Reviewer's one-line result and token total are in context.
  4. Retain. review.mjs retain --run-dir <run_dir> --subagent-tokens <n>, with <n> the Reviewer's token total, validates findings.json, derives the route, and writes and commits the Pass Report. If retain refuses findings.json, the same Reviewer rewrites the file and the agent retains again. The line carries pass_report, run_id, commit, route, and findings.
  5. Return. The agent returns pass_report, review_run_id (the run_id), route.primary, route.secondary_debt, and the findings list (id, priority, kind, location, return_route). The retain line is the presentation source; the Pass Report stays the review authority.

The reviewed change stays readonly. The Pass Report commit is the only write of a pass.

Prepare Blockers

prepare returns a blocker before the Reviewer starts when:

  • the target has no reviewable Git change outside Pass Reports;
  • the standalone locator is not a commit or a <base>..<head> range;
  • the pass budget is spent (see Pass Budget);
  • the change touches several spec folders and no --spec names one;
  • a delivery, or a run with --spec, has no spec source: the spec folder holds no SPEC.md, ARCHITECTURE.md, or PLAN.md at the reviewed head.

The agent relays each blocker unchanged to the caller and stops.

Reviewer

The Reviewer reads the diff and each context file at head, hunts the changed code inside the lens, and verifies each candidate itself. Its only write is <run_dir>/findings.json.

kindDefect
securityA risk the change introduces: injection, secret exposure, a missing authorization check, unsafe input handling
performanceA cost that grows with input or load: an N+1 query, an unbounded read, repeated work on a hot path
contractDrift: a changed producer (schema, contract, client, env, config, callback) leaves consumers that did not move
unrequestedBehavior that no SPEC.md, ARCHITECTURE.md, or PLAN.md line asks for
smellA Fowler smell whose cost already shows in the changed code; a documented standard in context that endorses the pattern drops it

Out of the lens: style, naming-only, nitpick and "consider X" remarks, architecture placement, skill-guidance adherence, test evidence, and anything a linter, type checker, test, or verifier owns.

  • Verify: a candidate becomes a finding only with a traced failure_scenario: concrete inputs or state that reach the changed line and produce a wrong result. Zero findings is the expected result of a clean change.
  • Rank: P0 data loss, a security breach, or an outage on a main path; P1 a wrong result or broken contract on a reachable path; P2 a real defect with narrow reach. A smell qualifies only at P2. The Reviewer keeps the first five by priority, smells last.
  • Finding keys: id, priority, kind, location (path:line at head), failure_scenario, action, and one return_route. A finding gets human_steering_required when its repair exceeds accepted bounds, changes a requirement, weakens a gate, or substantially redesigns the implementation.

Why One Reviewer

Verification owns correctness evidence, so review hunts only what tests cannot catch. The two retained passes of the earlier two-axis design showed the cost of a wider lens: 15 of 19 rejected candidates were false positives from the mechanical acceptance-criterion check, no P3 smell was ever accepted, the only finding tests could not catch was a security issue, and the second engine and its fallback never ran. The fresh-reviewer rework (skills commit ecf11426c095) removed the axes, the vendored engine, the background step, the separate verifying subagent, and the mechanical candidates. implement-spec finalize owns acceptance-criterion and skill-evidence records.

Pass Report

A delivery Pass Report lives at .devpunks/delivery/<goal>/reviews/pass-<n>.json. A standalone Pass Report lives at .devpunks/delivery/standalone/reviews/<base12>-<head12>-<run_id>.json.

  • Schema: pass-report-v2 with run_id, ordinal (null for standalone), mode, base, head, reviewer.subagent_tokens, findings, and the derived route.
  • Write: retain validates the report, creates the file exclusively, and commits only that path. A second writer for the same ordinal fails and never overwrites. A HEAD change since prepare invalidates the run.
  • Pass count: the completed pass count of a delivery is the number of valid Pass Reports in its reviews/ folder; legacy pass-report-v1 reports still count. No handoff field stores it.
  • Scope: Pass Reports stay out of the wiki and out of every review target. Legacy wiki review reports under Project Review Reports count no pass.

The run directory $TMPDIR/hi-review/<run-id>/ holds packet.json and findings.json. retain removes it after the commit.

Routing

retain derives route.primary from the findings' return_route values, in the order human_steering_required > debugging > implementation > debt_follow_up > docs_ingest. No findings give closeout. route.secondary_debt is true when a debt finding sits beside a primary debugging or implementation.

  • human_steering_required: standalone review returns the blocking findings, their evidence, and the exact decision needed to the operator. Inside AFK delivery-phase, delivery takes one out-of-bounds Autonomous Decision per blocking finding and posts it to the thread at once. A decision that needs a code change follows the implementation route; any other follows the debt_follow_up route.
  • debugging: delivery opens scoped Debugging.
  • implementation: delivery opens the implementation repair.
  • debt_follow_up: delivery captures each debt finding once, keyed by Pass Report path and finding id. With secondary_debt, capture runs first and then the recorded repair.
  • docs_ingest: delivery opens Docs Update.

Delivery opens a repair in one handoff write of the state, the route, pass_report, and review_run_id. A later write for the same review_run_id resumes that transition. Standalone review returns the route to the operator.

Pass Budget

prepare enforces the budget from the recovered pass count:

  • Default: one pass. An ordinary accepted repair gets Focused Repair Validation. It reruns only the Verification scenarios the repair invalidated and opens no new pass.
  • Second pass: risk trigger only. The repair must change architecture, security or authorization, a public contract, runtime or deployment topology, or accepted scope. Delivery passes --accepted-risk <kind>:<evidence>.
  • Further pass: human direction only. After two passes, prepare needs --human-direction <evidence>. That evidence quotes only words the human already wrote in the goal or thread, so delivery asks for none. Without it, delivery takes an out-of-bounds Autonomous Decision on review_budget_exhausted: it captures the open findings as debt, keeps the Pass Reports, and continues to docs ingest or closeout.
  • No consumption: an incomplete, interrupted, or invalidated run writes no Pass Report and counts no pass.

Resume, rebase, retry, and handoff keep the count. Only an explicitly new delivery goal with new accepted bounds starts a new reviews/ folder and count. Standalone review has no budget.

Resume

status names the next step from the latest run directory of the goal: review without findings.json, retain with it, and prepare when HEAD moved since prepare or the run directory comes from an older review-phase. Without a run directory, status returns done when the latest Pass Report covers HEAD, otherwise prepare. A new delivery prepare removes older run directories of the same goal.

Review And Verification

Verification proves behavior by driving the real product through verify-behavior. Review inspects the committed change.

  • Verification runs during implement-spec, before review. implement-spec finalize owns the acceptance-criterion status rows and their Verification records.
  • review-phase never runs the Project Verifier, never checks test evidence, and never owns evidence freshness.

See Project Verification Flow and Project Verifier.

Adjacent Entrypoints

review-phase does not load these skills. Use them as separate, explicit runs:

  • improve-codebase-architecture: module deepening and seam redesign, which sit outside the review lens.
  • make-tsuite: audit or reorganize a test portfolio without production changes, for example when test evidence looks weak.
  • security-best-practices: a full language- and framework-specific security report, on explicit request. The Reviewer covers only concrete security risks in the change.
  • audit-cicd-security: a readonly CI/CD pipeline security audit. It applies fixes only after explicit approval.
  • architect-pipeline: design or change CI/CD pipelines.
  • Tech Debt: resolve one captured debt item later through $resolve-debt-phase.

On this page