The commit review

Part of the Workflow Modes reference.

The reflection pause

Every commit is reviewed once, before it lands, by a cold reader: a model call that sees the change and nothing of the session. Its findings come back as the block reason; you (or the agent) address them, or answer them in the commit message, and the same commit is re-run. It informs rather than gates — a cold reader over-flags by construction, so a hard block on its opinion would be a denial loop driven by missing context.

What the reviewer reads

  • git diff --cached, its --stat, and the commit message — framed as a claim to check, not a description to trust;

  • unchanged files the author declares in a Review-Context: trailer (below);

  • whatever else in the commit’s snapshot it chooses to read, bounded and disclosed (below).

The diff is read whole, or the commit is refused (#878). A staged diff of up to 1,500,000 characters is sent to the reviewer entire. A longer one is refused before any reviewer is called, as commit guard (deterministic policy, not a model judgement), with its length and the advice to commit it in parts; nothing is spent and nothing is committed. A diff longer than the 64 MiB the guard reads, or one git takes more than 10 s to produce, is refused the same way, naming which (#917): until then it read as unknown, and after two blocked tries it landed on the author’s self-review. A read that fails for another reason (git’s error, a lost link) keeps the unreadable path. Before #878 a diff was cut at 180,000 characters and the part sent could still be answered CLEAN. Measured on diffs of 430,000 to 1,500,000 characters with defects planted past the cut, a cut review missed 15 of 18 of each defect that showed only as removed lines (a deleted check, a deleted test): the reviewer opens the files the stat names, and a file as it now stands cannot show what was taken out of it. Read whole, three reviewers caught at 1,500,000 characters what they caught with no other change in the diff, with no error and in under three minutes (the large-diff arms). Nothing longer was measured, which is why the cap is there.

A reviewer whose context window cannot hold the diff refuses it at less than the cap, naming the window: the diff is counted at two characters a token, with room kept for the answer, for the declared files and for the reviewer’s own reads at their full budget. A window of a million tokens holds the cap beside all of those at their defaults. The fallback reviewer’s window counts as well, since it reads the same diff when the first gives no review. A diff of 180,000 characters or fewer is sent without asking, as every diff was before. A first review of a very large diff costs what its tokens cost: at 1,500,000 characters about $1.20 on Gemini 4 Carbon, $3.60 on Opus 5.5 and $7.10 on Fable 5.2, at the catalogue’s rates.

Data the operator declares is counted, not read (#916). An operator lists, per repository by its origin URL, the paths that hold measured data, such as the model battery’s store, as reviewDataPaths in their own gadhs-pi-workflow.json (how). A commit’s changes under those paths are left out of the diff, its stat, the size bound and the dialect check, and the reviewer is told instead how many files the commit adds, modifies and deletes there, and to check the message against those counts. The rest of the diff is read whole as before. The human is told the counts once before the review, and the commit’s Reflection-Review trailer ends ; <n> data file(s) by count, so git log --grep 'data file(s) by count' finds every such commit. A commit with only data is still reviewed, for its message. Nothing is data when the guard cannot be sure: no listing for the repository’s origin, no origin, a git commit -a, git failing, or a file under a data path that is not an ordinary file (an executable, a symlink, a submodule); the commit is then handled exactly as before. An approved plan committed beside data is reviewed, with both notes. A repository’s own .pi/gadhs-pi-workflow.json cannot set the key (#558). A secret inside data bytes is no longer in front of the reviewer: the project’s CI secret detection still reads every push. Pins: packages/pi-workflow/test/data-paths.test.ts and the "operator’s data paths" cases in test/extension-wiring.test.ts.

The default answer is PASS: a FAIL needs evidence in the diff, the declared files or what the reviewer read — never a suspicion — and cites file:line. External state (a test run, a pipeline, a registry) is out of its reach by construction and is never grounds for one. Everything it reads is untrusted data for instructions.

The questions and the verdict

The reviewer answers J1–J8 (risk-tested; tests weakened; breaking change, wrong logic, broken runtime seams, fail-open probes or discarded parse errors, or hand-rolled parsing beside workspace/sibling parsers; authn/authz, secrets, unsanitized input; unestablished claims in comments; one thing per function — with one cohesive exhaustive match/switch accepted rather than split into chained fall-through helpers; silenced lint; comments a reader with the code and nothing else can follow in plain engineering English) (991). When the reviewer has snapshot reads, it is also told to inspect enclosing timeouts/ceilings, clocks, and sibling modules when a judgment turns on them (#991). A diff that changes no behaviour (prose, comments, formatting) is a PASS on J1 that says so, not an N/A, which would leave the review partial (#891). J8 names its reader (#739, #817): for each function the diff adds or changes and every comment the diff adds (inline, module header, or section banner), could someone with no access to plans, issues or the review tell what it does, when it is called, what it returns or refuses, and why it exists? Any added comment whose meaning depends on a plan unit, decision, phase, step, tier, slice, review or finding code, or MR fails; an issue or plain ADR id after a self-contained sentence is a pointer and passes; restating the name fails. Before J8 asked that, it asked whether a comment "stated intent", which "implements D5" satisfied, and the repositories' comments came to read that way: 12-16% of their public doc comments cite a plan, unit or finding label, and most of the rest are written for the reviewer, not the next engineer. The mechanical half runs before the reviewer: the commit guard refuses a commit whose added comment lines (including Rust [expect] / [allow] / [warn] / #[deny] reason = "…​" justification strings, #1037) speak the dialect - unit and decision labels (U3, D5, Unit 2, Decision 6), plan letters (Plan G), finding numbers and codes (finding 23, F-028, F12), review/MR/task/milestone codes (R3, MR5, T2-7, T7, M9), ADR sub-labels (ADR-043 A2, ADR-033 tier 2), slices (Slice 3), parenthetical or issue/ADR/plan-anchored phase/step/tier numbers ((Step 7), (#523, Phase 1)), "this MR" / "this PR" / "this commit", and "per the plan" (#817) - quoting the matched text by file and line (#940), and noting when the label was already present on the edited line’s removed counterpart (#956). Hyphenated technical identifiers (SHA-256, P-256, rsa-2048, CMS-416, UTF-8, ES512, PEM-R3), plain ADR pointers (ADR-060), and standalone algorithm headings (Step 1: validate input, Phase 1 — acquire lease) do not fire. Prose files (plans, pages, notes, the changelog) are not read; in CI and git-hook files (.gitlab-ci.yml, .github/workflows/, .githooks/), "this commit" is allowed because it names the runtime commit the pipeline or hook acts on ("this MR" and "this PR" still refuse). plan-ref-ok: <reason> waives a line where the label is data. The answer’s form is fixed: the VERDICT: line first, then one line per question. The questions and the reviewer’s tools travel as the transcript’s leading system message, as pi’s own runtime sends a prompt (pi-ai’s normalizeContext).

  • A verdict is CLEAN, FLAGS (n), or a bare FLAGS (counted as at least one finding) — nothing else. A word the form does not know (APPROVE, LGTM) is no verdict. The flag count is the verdict’s own, read the way the gate reads the verdict (the last line that is only a verdict, else the last mention), so a J-line quoting VERDICT: FLAGS (1) does not flag a CLEAN review (#422).

  • A reviewer that stops without a verdict is asked once more, in the same conversation, to conclude in the form; still none, and the review is unreviewed (below). One that hits the model’s own output cap is reported at once.

A review ends one of five ways, said the same in the notice, the block text and the log:

Outcome Meaning

clean

CLEAN, every question settled.

partial

CLEAN, but a question answered N/A — named in the notice ("CLEAN (J5 not settled)") and in a head line on the block text, so a CLEAN on what the reviewer could read is not mistaken for a CLEAN on everything.

flags

FLAGS, with the failed questions named.

unreviewed

No review: the reviewer could not be reached, or gave no verdict (below).

interrupted

You pressed escape; nothing was reviewed or counted.

The plan review’s approval pane keeps its own words (CLEAN / FLAGS / UNREVIEWED); a partial plan review shows CLEAN there.

Who reviews

A commit is reviewed by Gemini 4 Neon at medium (#1035), whoever wrote it: commitReviewer in gadhs-pi-workflow.json (Configuration Cookbook). Neon is another family than the Claude authors, so a self-review’s shared blind spots are not the reviewer’s.

Neon took Gemini 4 Carbon’s place (#811, after Gemini 4 Argon #432) based on the model battery (Model battery: every shipped model, per role, as permutations): on the standard commit corpus Neon at medium caught 169 of 177 planted defects (95 %, 100 % cross-file, 97 % buried, no false flags) in 41 s at $0.10/case against Carbon at low (173/177, 100 % cross-file, 93 % buried, no false flags, 78 s, ~$0.12 at current standard rates), and on the hard reviewer-heisenbug corpus Neon reached 98 % effectiveness (32/33 caught, 33/33 twins clean, no false flags, 3 % call-cap hits) in 68 s at $0.16/case against Carbon’s 83 % (29/33 caught, 26/33 twins clean, 9 false flags, 56 % call-cap hits) in 147 s at $0.27/case. To use Carbon instead, set "commitReviewer" to vertex-gemini/gemini-4-carbon. The cost is time and capacity:

  • About 41 s a review on typical diffs (68 s on hard multi-file changes), against 20 s for Opus 5.5 reviewing at its high floor (#434).

  • Google’s shared Standard PayGo capacity, which can refuse with a rate limit.

When Neon’s review does not happen (a rate limit, a server error, a timeout, a model not configured, no verdict), the author’s own model, by the rule below, reviews in the same attempt. The block opens by saying so: "The commit reviewer … gave no review (…), so … reviewed instead". An outage costs one more review, not the commit’s unreviewed attempts. Two cases try no other model:

  • An unreadable staged diff, which would fail the same way.

  • A review you interrupted with escape.

A Neon author is reviewed by Neon alone. "commitReviewer": "author" restores the rule below for commits.

The commit reviewer, the floor and the plan’s second reviewer are model roles (Model roles, #715). Each is resolved through whichever source you have, its configured value first: Neon through google when Vertex is not set up, Sonnet through anthropic. With no Gemini reachable at all, the commit reviewer and round two fall back to Claude Sonnet, a substitute. Round two then still runs, and its line says so: "Reflection pause — second opinion by … (round two, on the edited draft; same vendor: no second vendor reachable)". It is a weaker check than a second vendor, so you see that it is. The words author and none are rules, not models, and are not resolved.

A plan gets two reads: round one by the rule below, round two by Gemini 4 Neon at high (#1010) on the agent’s next call, reading the edited draft (exit_plan_mode, "The cold read before you see it"). A commit under "author", or after a fallback, is reviewed by the rule chooseReviewer applies. It picks by the author’s rank on the model battery’s reviewer role (TIERS in reflection-review.ts): Fable 5.1, Fable 5.2 (in 5.1’s place by the operator’s choice, unmeasured), Gemini 4 Argon and Gemini 4 Carbon (in Argon’s place, unmeasured) → 4, Opus 5, Opus 5.5, Grok 4.7 and Gemini 4 Neon → 3, Sonnet 5.5 (the floor), Sonnet 5, Sonnet 4.6 and Gemini 4 Hydrogen → 2, every other ranked model → 1.

  • An author at or above the floor is reviewed by its own model, in a fresh call. Cold means the reviewer never saw the session — the conversation, the reasoning, the dead ends — not that the weights differ: the failure the protocol guards against is “a context-fatigued primary self answers from memory and misses drift”.

  • An author below the floor is reviewed by the floor. A weaker reviewer cannot catch what a stronger writer got subtly wrong, and fails the worst way — PASS with confident citations.

  • An author the battery has not ranked is reviewed by its own model rather than assumed weak. That is for a model from outside the packaged catalog: every model the catalog ships is ranked, and a test fails when a new entry is not (#355). Haiku 5.5, unmeasured as a reviewer, ranks 1 and gets the floor.

The ranks rest on the battery’s measurements. On the 2026-09 corpus: Fable 1.00, Opus 5 0.96, Opus 5.5 0.95, Sonnet 5.5 0.94, Sonnet 4.6 0.90, Sonnet 5 0.88, Haiku 0.43 (Model battery: every shipped model, per role, as permutations). #429 added a harder tier, with defects only a read outside the diff shows, decoys and three runs. It measured the two models held at rank 1 as unmeasured, and they moved up (#433):

  • Argon read 0.98 (173/177, every cross-file defect) against Fable’s 0.92, and ranks level with Fable by the operator’s choice.

  • Grok 4.7 read 0.88, with 0.83 cross-file and no false flags. That is level with Opus 5.5 (0.92, 0.83, three false flags), so it reviews its own work. It is a Google Preview on a fixed shared quota, so a busy project can rate-limit its review.

Above the floor, a rank decides nothing today. It would only matter if the floor were raised. The floor is Sonnet 5.5 by the operator’s choice (#252), one catch under Opus 5.5 on the reviewer task (54/58, with two false flags on the no-defect control), so it keeps the floor’s tier; Sonnet 5 and Sonnet 4.6 rank with it; Opus 4.8, one catch over the floor on one measure and below Sonnet 4.6 on another, is not established above it. The author is identified by the session’s provider and id, so a Gemini author on vertex-gemini or a Claude on the direct anthropic provider is looked up where it lives, and the review runs wherever the chosen model is registered.

How hard it thinks

The level asked for is reviewThinking in gadhs-pi-workflow.json when set. Otherwise a reviewer model with a level of its own is asked for that, whatever the session writes at (#858). Any other reviewer is asked for the session’s thinking level (medium without one), raised to its floor for the subject when the floor is higher (#434):

Reviewer Commit Plan Kind

Gemini 4 Carbon

low

medium

its own level: the session’s is not followed

Fable 5.2

high

high

its own level (#865)

Opus 5.5

high

–

floor: the session’s level, never below this

Sonnet 5.5

high

high

floor

Gemini 4 Argon

–

high

floor

Gemini 4 Neon

medium

high

its own level: commit (#1035), plan (#1010)

Gemini 4 Hydrogen

medium

medium

floor (#867)

Carbon’s and Neon’s levels are their own because a thinking level is a vendor’s scale: the session’s level says how hard a Claude author thinks and carries nothing over to a Gemini reviewer. Measured 2026-11-19 (Model battery: every shipped model, per role, as permutations): on commits, Carbon low caught 173 of 177 planted defects in 78 s against medium’s 174 in 200 s, and at high 5 of 54 calls failed twice; on plans, low, medium and high each caught all 36 planted defects, medium with no false flag in 98 s against high’s 330 s. Neon reviews commits at medium (41 s, 0 false flags; without pinning, a session at high or xhigh would send Neon high or xhigh) and plans at high (#1010).

The floors come from the #429 thinking arm (Model battery: every shipped model, per role, as permutations, the reviewer and planning experiments):

  • Opus 5.5 on a commit: at high it caught 94 % of defects against 92 %, 87 % of cross-file ones against 83 %, and raised no false flags against three.

  • Sonnet 5.5: at high it caught 80 % of cross-file commit defects against 50 %, and 98 % of plan defects against 93 %.

  • Argon on a plan: at high it caught 98 % of defects and every cross-file one, against 93 % and 92 %.

A model or subject without a floor gains nothing from a higher level: Fable reads flat across levels, and high doubles Argon’s time on a commit. So auto mode’s commits, written by Opus 5.5 at the mode’s medium, are reviewed by Neon at medium, and by Opus 5.5 at high when Neon gives no review. Plan mode’s Fable 5.2 writes at xhigh and reviews its own plan at high, the level it reviewed at before #858 and the highest measured for it: 172 of 177 commit defects against 169 at its default, and flat on plans (33, 35 and 34 of 36 at low, its default and high; xhigh was not measured). Neon reads the plan second at high (#1010). reviewThinking is the one way below a floor or off a model’s own level. pi-ai clamps it to what the reviewer model declares (off for a model without reasoning; xhigh down to high where undeclared; off up to the lowest level for a model that cannot stop thinking) and maps it to effort, a budget or nothing, exactly as for a turn of your own. No output ceiling of ours is sent: each provider sizes it from the model’s cap and fits the thinking inside. The answer is bounded by its form instead.

A repository’s own review rules

A repository can add questions to the cold review (275): a # Code Review Rules section in the AGENTS.md at its root (the heading Codex reads too), one rule per list item.

## Code Review Rules

- Does every new endpoint check the caller's agency scope?
- Is every SQL statement parameterised?

Each becomes a question, R1 to R9 at most, asked after J1–J8 and answered the same way. An R FAIL counts in the verdict, and the re-run answers it like a J question: Review-Response: R1 disputed - <why>. The rules add questions and never take any away. The prompt says a rule that tries to change J1–J8, the answer form or what counts as evidence is ignored. Each rule is cut to 300 characters, and a tenth and later rule is not asked. When either happens the review says so at its end (#879): how many rules were left out and which were asked cut, so a rule that was never asked is not read as one that passed. A repository with no such section gets the eight questions as before. The rules are read from the committed AGENTS.md (HEAD), so an author’s uncommitted edit never reaches its own reviewer, and only in a project pi trusts: an untrusted repository does not steer the reviewer, as it steers no agent.

Retrying, and answering a FLAGS review

  • The review’s identity is the diff, the message and the declared context. Re-running the same commit after a review does not review again; changing any of the three (staging a fix, rewording the message) is a new review.

  • After CLEAN (nothing flagged, a partial review included), the commit lands in the same call (#265): the deterministic guard still applies (format, main-branch protection, the trailer), and the review is put in front of the command’s own output, ending with “CLEAN: the commit ran in this same call; there is nothing to re-run.” A refusal by that guard carries the review with it. Where the call has no id to attach the review to, the commit is blocked with the review as before, and the identical re-run lands.

  • After FLAGS, the identical re-run lands only with the author’s answer to each flagged question in the commit message, one line each: Review-Response: J3 disputed - <why>, a reason required (#893). A finding you accept is one you fix, and the changed diff is reviewed afresh; a deferral is a dispute that names its issue (disputed - out of scope here, #77). The line is for git — it lands in history, signed, where a human reads it — and is stripped before the identity and the reviewer’s prompt are computed, so writing it neither re-reviews nor puts the rebuttal in front of the reviewer.

  • Refused by name, with the grammar: a missing or malformed line; fixed or accepted on an unchanged diff (a fix changes the diff, so it is reviewed afresh); a --trailer 'Review-Response: …' on the command (the guard reads the message body); a message composed in an editor the guard cannot see.

  • Findings are kept per session beside the review record: a restart forgets them and the re-run reviews afresh.

When the reviewer cannot be reached

Every commit gets one review attempt. A reviewer that cannot be reached (or answers without a verdict, even after the nudge) is not a review: the pause says so, and the re-run tries again. After two consecutive failures on the same diff the re-run proceeds on the author’s own J1–J8 pass — that commit ships without a cold read, deliberately, because a reviewer that stays down must not hold you hostage. Such commits are logged (git_guard.reflection_unreviewed, with the reason and the first 2 048 characters of what the reviewer wrote), never a path anything can choose.

What wakes the pause

A call wakes the pause when it runs git commit, read from the command’s structure. A heredoc that is data for another program (python3 - <<'EOF') is never read as a commit, whatever its text says (#55). One shape keeps a text floor, because no parser here opens it: code handed to a shell it never reads. That covers a -c string, an eval command, or a shell fed its program on stdin. When such a hand-off is on the line and the text mentions git and commit, the pause runs.

Since #356, on a line the structure reads whole (every word known), eval counts only as a whole word of a command, whether first or after a prefix like builtin or command. A path like eval/corpus.json, or text inside a heredoc, is not an eval. Before, such a path beside heredoc text that mentioned a commit woke the pause on a call that committed nothing, and the reviewer read an empty index. Where the structure cannot vouch for the line (a command substitution, a word it cannot read such as $'eval', a line that will not parse), the word still counts.

Commits that name their own subject

A commit that names what it commits — a pathspec (bare, after --, or --pathspec-from-file), -o/--only, -i/--include, --interactive, -p/--patch — is refused before any review, by name: what it would commit is neither the index nor the worktree the reviewer reads. The check runs the same flag walk inside every carrier (a -c string, eval’s argument, a quoted program piped to a shell), with quoted heredoc bodies treated as data; only text that will not parse at all falls to a coarser match. A git command’s own arguments are never opened as a program: a commit message that mentions `git commit is data (#317). A flag’s value that looks like a redirect is the flag’s: in git commit -m ">" a.ts, a.ts is a pathspec (#420). Stage exactly what you mean as its own command, then commit the index.

Declared context: Review-Context:

A Review-Context: trailer names unchanged files for the reviewer to see. It goes in the message body (-m or -F), one line per file. A --trailer 'Review-Context: …' on the command is refused by name (#440): the guard reads the body, so the reviewer would get none of the files while git still recorded the trailer. Before the review runs, the guard checks each is under the workspace root, not credential-shaped (the list under the reviewer’s own reads; #423), a regular file, tracked by git and within the caps — 80 KB per file, 200 KB in total, 32 files by default, configurable in the operator’s gadhs-pi-workflow.json (the cookbook) — and refuses the commit by name, quoting the cap, otherwise. A file over the per-file cap is refused with the way past it (#476): drop the line, since the reviewer still sees the file’s changes in the diff and can open the file with its own tools. A path inside the workspace that is not there is refused with the tracked file it most likely meant (#469). That is a file of the same name elsewhere (a move), or a path at most three edits away (a typo). With nothing close, the refusal says a file on another branch, such as an unmerged plan, is not part of this commit’s tree. A path git still tracks but that is deleted in the working tree is said to be deleted: restore it, or stage the deletion and drop the line (#680). A line holds paths only, separated by spaces or commas. One that reads as prose (three or more words, two of them plain lowercase words, as in a path followed by a sentence) is refused once, quoting the line and stating the format, before any word is tried as a path (#665). Before #665 each word was refused as a missing path, a dozen lines for one mistake. Files are read as the commit will contain them: from the index for an ordinary commit (HEAD’s content for a file the commit does not touch), from the worktree only for -a, never from an edit the commit leaves behind. They are inlined beside the diff under their own untrusted-data markers. A plan’s reviewPaths are read from the tree on disk, tracked or not, with the same root and credential checks. A plan that names a file and does not supply it is not failed on P2 for that alone: the reviewer opens the file itself, and fails P2 only where the file contradicts the plan (#730).

A plan on a large repository (#465). The files a plan changes are often over the per-file cap, and dropping them failed P2 every round. So, for a plan only:

  • An excerpt. path:START-END hands the reviewer those lines, labelled “path (lines 120-180 of 7,400)” and counted by their own size. An END past the file’s end is its last line. An empty, backwards or out-of-file range is refused by name.

  • The size limits hold back, not refuse. A file over the file-count, per-file or total limit is listed to the reviewer under NOT SUPPLIED, with why. It is no P2 failure: the reviewer opens it with its own reads. If it cannot, it says which claims it could not check. Every other problem (outside the root, credential-shaped, missing) still refuses the call.

  • `exit_plan_mode’s description and the enter-plan-mode text state the limits and the excerpt form, after telling the agent to list every file the plan names, even past the limits (#722). Stated after "Necessary and no more", the file count read as a cap on the list: a plan naming 20 files passed 12, and each of the 8 it left out failed P2.

A commit’s Review-Context takes the same path:START-END (#672): those lines of the file as the commit holds it, from the index for an ordinary commit and from the worktree for -a, counted against the per-file cap by their own size. A file over the cap can then hand the reviewer the part that carries the claim. Unlike a plan’s, a commit’s context holds nothing back: a whole file over the cap, or an excerpt over it, is refused with the way past it, which now names the range.

The reviewer’s own reads

Beyond the declared files, the reviewer has three read-only tools — read_file, grep, list_files — over the same subject: the index for an ordinary commit, the tracked worktree for -a, the tree on disk for a plan. A caller whose contract the diff changed, a test the message says exists, a claim about the repository: the reviewer reads rather than answering N/A, which is left for state outside the repository or a read the budget refused.

Bound Default Key in gadhs-pi-workflow.json

Calls per commit review

24

reviewSnapshotMaxCalls

Bytes per commit review

400 KB

reviewSnapshotMaxBytes

Calls per plan review

96

planReviewSnapshotMaxCalls

Bytes per plan review

800 KB

planReviewSnapshotMaxBytes

Bytes per result

80 KB

the declared-context per-file cap

Past the budget every call answers “budget exhausted … answer from what you have”, and a model that keeps asking is stopped two rounds later and reported unreviewed. The pause text ends with the files read and the searches made, so a FAIL never rests on evidence the author cannot name. When any call was refused for call-limit or byte-limit exhaustion, the review also appends a non-blocking warning naming the exhausted cap and refused call count, upgrades the completion notification from info to warning (— snapshot budget exhausted), sets budgetExhausted: true on the plan-approval bridge record, and logs snapshotBudgetExhausted and snapshotBudgetRefused on git_guard.reflection_done / plan_review.done (#1000) so an exhausted CLEAN verdict is never mistaken for an exhaustive audit.

  • The tools run git plumbing with argument arrays, never a shell.

  • A path is resolved through symlinks and refused outside the root.

  • A credential-shaped file (.env*, key and certificate extensions, SSH key names, credential, secret, .netrc and kin) is refused to a read or a scoped search, and its lines are withheld — with a count — from a wide one.

  • A plan’s on-disk search honours .gitignore.

  • Each call is logged (review.snapshot.call: tool, target, bytes, never content).

An approved plan is not reviewed twice

When you approve at exit_plan_mode, pi-modes records the draft file’s sha256 and its text beside it (<draft>.approved.json). A file in a commit that is that plan had its cold read at the plan pause and your yes after it, so it leaves the reviewer’s remit:

  • alone in a plain commit (one the guard read whole — no --amend, not inside an opaque shell), the commit proceeds with no pause and says why;

  • beside anything else (code, a deletion, another page), the reviewer sees only the rest and is told the plan is approved and excluded;

  • a difference in design is a plan you did not approve, reviewed like anything else.

"Is that plan" is read up to what approval itself changes (#733): the same bytes, or the same text once issue, epic and MR numbers and their placeholders (filed at approval, TBD, &N) read as one token - a run of them, #3001, #3002, as one too - the Status value is dropped, and whitespace is normalised. Byte-exact matched 0 of 18 plan commits in canopy’s week, because the approval step fills the issue numbers in and moves the Status, and each approved plan paid a second cold read, two of them flagged. A nav.adoc whose whole staged change is one added xref: to an approved plan is the plan’s own entry, approved with it; any other nav change is reviewed. A record an older pi-modes wrote, without the text, compares bytes alone.

The record is one approval — the last — so it covers one plan per commit; several plans, and a record that outlives the next approval, are #191.

Plans at exit_plan_mode

Every plan leaving plan mode gets two reads against P1–P6 (see exit_plan_mode): round one on the first exit, round two by planSecondReviewer (Gemini 4 Neon at high by default, #1010) on the next, and the call after that goes to the human, edited or not. With planSecondReviewer set to none, or naming round one’s own model, the second exit goes to the human.

What it logs

git_guard.reflection_done and plan_review.done carry the outcome, the flagged and unsettled questions, the thinking level wanted and its source, the level sent, the usage the provider reported (uncached input; output, with reasoning where broken out; cached input apart as cacheRead and cacheWrite, since a cached prompt’s input alone reads as a handful of tokens), snapshotCalls/snapshotBytes, and the wall-clock phase breakdown (snapshotMs, thinkingMs, outputMs, waitMs, #740) across snapshot tool execution, reasoning blocks, text/tool-call output generation, and pre-token wait. On pi 1.8.0+ each review’s summed usage and cost are also recorded via pi.appendUsage() (kind: "commit_review" or "plan_review", #1033), so cold-review spend enters pi’s footer cost, /session breakdown, spendCapUsd, and remote session stats. An unreviewed outcome carries the reason and the first 2 048 characters of the reviewer’s text (git_guard.reflection_unreviewed for a commit; reason and partial on plan_review.done for a plan) — the only places the log holds the reviewer’s prose.

Pins

Test Pins

reflection-review.test.ts

chooseReviewer; the verdict-first prompt; `verdictOf’s grammar

reflection-review-run.test.ts

the retry, the nudge, usage

review-thinking-wiring.test.ts

the level’s three sources, the clamp by model class, no ceiling, the log — through the real handler

review-snapshot.test.ts

the reads' subject, containment, credential refusal, budget

review-snapshot-loop.test.ts

the tool loop and its bounds; the system message on every ask; the disclosure

review-disposition.test.ts

each disposition refusal by its words; CLEAN needs nothing

review-context.test.ts, review-files.test.ts

the declared-context resolver; the prompt’s shape

review-context-pause.test.ts

the sequence through the real handlers; refuse-before-review ordering

approved-plan.test.ts

the approved-plan exclusion (with pi-modes' plan-mode.test.ts)

plan-review-run.test.ts, plan-review-pause.test.ts

the plan review’s key, bound, prompt and cadence

Edit this page · latest