An agent writes a patch. I ask it to review the patch. It tells me the code does what it was designed to do. Fine, but it was the one that designed it.
I want a reviewer to start with the changes and the requirements, not the conversation that produced them. In Pi, my coding agent, I use two reviewers that start fresh:
- llm-reviewer: one large language model (LLM) reads the change and writes the whole review.
- decision-reviewer: an LLM still reads the whole change, but a decision model answers a fixed set of review questions. The LLM can disagree, but it has to report the model’s answer.
A subagent is a fresh agent with a job description
A subagent is a second agent that my main agent can hand a task to. I didn’t write that part. Pi ships an example subagent extension, and I linked it into my setup unchanged. It adds a subagent tool, which starts a separate Pi process for each delegated task.
The new process gets the task, but not the chat that led up to it. It can still work in the same folder: it reads the code, runs git diff to see what changed, and sends its report back to my main agent.
Each agent is a Markdown file in ~/.pi/agent/agents/. A short header picks the model, how hard it thinks (:high) and the tools. The rest of the file holds the agent’s standing instructions. Here’s a shortened excerpt from llm-reviewer.md:
---
name: llm-reviewer
description: Independent, read-only code review in a fresh context.
tools: read, grep, find, ls, bash
model: openai-codex/gpt-6.2-astra:high
---
Judge the code by what it does, not by what its author says it does.
Follow the ponytail-review skill for the review method and checks.
Use ~/.pi/agent/agents/review-report-format.md for the report layout.
There’s no edit or write tool in the list, but bash can still write files. “Read-only” is a rule in the instructions, not a lock. And the task itself can still carry my reasoning, so I tell the reviewer what to check, not why I think the patch is fine.
Reviewer one: one model does everything
llm-reviewer builds on ponytail-review, a skill by Dietrich Gebert. A skill is a reusable set of instructions an agent loads when a task calls for it. This one reviews like the person who gets the call when the code breaks. It reads the code around the diff, not just the changed lines. It follows the callers, reads the tests and thinks about the load the code will actually see.
One rule sets the tone: no case, no finding.
- Not a finding: This might mishandle dates.
- A finding: Just after midnight in a UTC+2 time zone, this calendar job looks up yesterday’s appointments instead of today’s because it uses the UTC date.
Every finding names a file and line, says what goes wrong, and proposes the smallest fix. Findings land in Must fix, Should fix and Nice to have, and the reviewer never changes the code itself.
My agent file adds its own checks on top. Did the change do what I asked? Did it add anything I didn’t ask for? Do the new tests catch a real problem? I also ask it to flag added or edited comments unless they’re legal notices, public API docs or instructions a tool reads. Sometimes a better name can do the work of a comment; sometimes a test can enforce what the comment only describes. And when a pull request (PR) description says “tested”, that’s a claim to check, not a fact.
These rules are all instructions to the same model. It writes a finding and then judges whether it made a good case. If a finding never appears, I can’t tell whether the model checked the rule and found nothing or skipped the check.
Some people would say a rule belongs in a linter (a tool that checks code automatically), not in a prompt. Lauren Tan makes that case in her talk All Code Is Slop (Except Mine): when an agent keeps making the same mistake, turn the correction into a lint rule, a type check or a test. When a rule can be checked mechanically, I’d rather use a linter: it checks the rule the same way every time. On my own projects, I can set that up. On a shared codebase, I’m not ready to ask everyone to adopt my review rules. The next best thing was a reviewer I could use myself without changing the project’s tooling.
Reviewer two: the LLM investigates, a decision model rules
“Is this function really unused?” can send a reviewer all over a repository looking for code that calls it. “Does this finding name a file, a line and a concrete case?” is a much smaller question. It takes judgment, but you can write down what counts as a yes.
With decision-reviewer, the LLM still investigates. It picks a rule and gathers the evidence. A decision model answers the question I wrote.
What a decision model is
A decision model doesn’t chat. You give it some data and a question with fixed answers, such as yes or no, or one of a few labels. It gives back a probability for each answer. It can’t write a paragraph or run a command. The answers you defined are all it can say. Pi calls this kind of model a classifier.
The decision model can run anywhere Pi can reach; Pi supports hosted ones too. I run d3:4b on my laptop in Ollama, an app for running models locally, and a short extension tells Pi how to reach it.
How a rule check works
decision-reviewer has its own instructions. Here’s a shortened excerpt from decision-reviewer.md:
---
name: decision-reviewer
description: Independent code review with binding decision-model verdicts.
model: anthropic/claude-opus-5-5:high
tools: read, grep, find, ls, bash, rule_check
---
Use ~/.pi/agent/agents/review-report-format.md for the report layout.
Use rule_check for every applicable rule in decision-reviewer.rules.yaml.
If rule_check is missing or fails, stop and report why the review didn't run.
Both reviewers read review-report-format.md. It tells them how to present a finding, not how to decide whether something is a finding or how serious it is. Neither reviewer reads the other’s instructions. The format file sits next to the two agent files, but it doesn’t have a metadata header, so Pi’s subagent extension doesn’t load it as an agent.
rule_check is off by default, so my main session and llm-reviewer can’t call it. decision-reviewer turns it on by naming it in its tool list. The questions and the choice of decision model live in decision-reviewer.rules.yaml. Here’s the rule for comments, shortened:
comment.allowed:
type: bool
instructions: Is this comment one of the allowed kinds?
criteria:
true: Legal or license header, public API doc, or a directive a tool reads
false: Any other comment
violation: false
The decision model sees the question and the possible answers. The last line is for my code: it says a “no” is the answer that means trouble.
Say the change adds a TODO comment. The LLM sends the rule name, the file and line number, and the comment with the code next to it. It also says what language the file uses and whether the comment documents a public API. rule_check looks up the question in the YAML file. The LLM gets to choose what to check, not how to ask.
The probability of a violation is the score rule_check uses. Plain code, not the LLM, turns that score into a verdict. My threshold is 0.8:
- Violation score of 0.8 or higher: violation.
- Violation score of 0.2 or lower: clean.
- Anywhere in between: uncertain.
For a rule that only picks a label, like how serious a finding is, the tool uses the model’s label if its score reaches 0.8, and calls it uncertain otherwise. These are cutoffs for when to act on the model’s answer, not a measure of how often it’s right.
If the TODO comes back as a violation, a second rule asks what to do with its content. For example, a note about why a workaround exists might belong in the commit message. The rule doesn’t tell me whether the workaround actually works. The LLM still has to read the code for that.
What “binding” means
The tool computes the verdict. The instructions say what the LLM has to do with it:
- Violations stay in the report. If the LLM disagrees, it can’t drop the verdict. It lists it under Disputed with its reason, and I decide who’s right.
- Uncertain stays uncertain. The reviewer retries once if it has more evidence. If the model still can’t decide, the item goes under Uncertain, and the LLM doesn’t fill in its own answer.
- The LLM’s own findings get checked. Every draft finding, including bugs the LLM found by itself, goes through the concrete-case and severity rules. A finding with no concrete case gets reworked, or rejected under Disputed.
- The input gets checked first. A PR description can contain text aimed at the reviewer rather than a person. That’s prompt injection: instructions tucked into the data a model reads. This check looks for it in the diff, commit messages and PR text. The reviewer is told not to follow those instructions, even if the check finds nothing.
- No model, no review. If
rule_checkis missing or fails, the reviewer reportsReview not run: <reason>and stops. A review that quietly fell back to the LLM’s own judgment would look exactly like a real one, and that’s worse than no review. - The report ends with a tally. It counts checks, violations, uncertain results and disputes. The reviewer shouldn’t give a plain Ship verdict if an unresolved check could change the outcome.
“Binding” is a rule for the report, not a check that blocks merging. Nothing verifies that the LLM sent the right evidence or ran every rule that applied. And the decision model can still be wrong.
What the first test run taught me
An early version of decision-reviewer read llm-reviewer’s instructions as well as the rule file. I tried it on a toy repository with one staged file, greet.py:
# TODO: replace this greeting eventually
print("hello")
The requirement was “When run, greet.py prints hello followed by a newline.”
The decision model flagged the TODO, but couldn’t decide how serious it was. My first prompt didn’t say what to do when the violation was clear but the severity wasn’t. The LLM put it under Should fix anyway, borrowing a rule from llm-reviewer. It explained why, but the point of the tool was that the LLM wouldn’t make that call itself.
I changed the instructions and tried the same file again. This time the finding went under Uncertain, with the violation confirmed and its severity still open. The decision model also couldn’t decide whether to delete the comment or move its content to the commit message. The report didn’t pretend it knew. “Is this a problem?” and “How serious is it?” are separate questions. I hadn’t said what to do when only one had an answer. I later split out the shared layout so the second reviewer wouldn’t inherit the first one’s severity rules at all.
The files in my setup
We created six files. Four are Markdown and YAML files in Pi’s agents folder, and two are small extensions. The paths in these tables are relative to ~/.pi/agent/.
| File | What it does |
|---|---|
agents/llm-reviewer.md |
Defines the LLM-only reviewer. |
agents/decision-reviewer.md |
Defines the reviewer that uses rule_check. |
agents/review-report-format.md |
Gives both reviewers the same report layout. |
agents/decision-reviewer.rules.yaml |
Lists the fixed questions, decision model and cutoff score. |
extensions/decision-rules.ts |
Registers rule_check and turns model scores into verdicts. |
extensions/ollama-model-registration.ts |
Tells Pi how to reach my local decision models. |
If you use a hosted decision model that’s already available in Pi, you can skip the Ollama extension.
The rest of my setup is reused as-is. Pi doesn’t load its subagent example by default; the example’s README shows how to link its two files into the extensions folder. The ponytail-review/SKILL.md file comes from the installed ponytail package under ~/.pi/agent/npm/.
| File | Where it comes from |
|---|---|
extensions/subagent/index.ts |
Pi example (symlink) |
extensions/subagent/agents.ts |
Pi example (symlink) |
Running them side by side
I start both from my main session with a message like Run code review with both reviewer subagents. The main agent calls the subagent tool once with both tasks, and I can watch the two reviewers run in parallel.
I ran both reviewers on this post and on another one about switching models mid-task in Pi. In that draft, I’d made it sound like one timed-out call to the decision model would stop the router from asking again. llm-reviewer read the code and saw that the router can ask again. decision-reviewer found a different mistake: the post used one name for the coding model, but the two versions of my setup used different models. The LLM spotted that by reading the files, not by calling the decision model. The reviewers use different LLMs, too. I can’t tell from these runs how much of the difference came from the rule checks.
On this post, llm-reviewer caught wording that made it sound like Pi installs the model into Ollama. decision-reviewer pointed out jargon, but its decision model also mistook a paragraph that describes reviewer instructions for prompt injection. It also called my comparison of the two designs out of scope. The LLM disputed both calls in the report. I sided with the LLM and kept the comparison.
So which one?
I keep both. llm-reviewer is the one to reach for when I just want a fresh read. decision-reviewer takes more setup because it needs a decision model. In my setup that means keeping Ollama running and sometimes splitting up evidence to fit the model’s input limit. Running both in parallel gives me two reads of the same change. The second report also shows me where a fixed rule was hard to apply. On this post, the extra model didn’t settle the argument. It let me see there was one.