@tduyng/pi-review
Review a change like a senior engineer: the git delta, the task, the code, and a markdown report with severity, locations, and suggested diffs.
Package details
Install @tduyng/pi-review from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@tduyng/pi-review- Package
@tduyng/pi-review- Version
0.0.6- Published
- Nov 16, 2026
- Downloads
- 1,252/mo · 210/wk
- Author
- tienduy-nguyen
- License
- Apache-2.0
- Types
- extension
- Size
- 80 KB
- Dependencies
- 1 dependency · 2 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@tduyng/pi-review
/review reads a change the way a colleague would: the diff, the task, and the code around it. The report lands in .pi/reviews/ with the verdict, then one numbered problem per line, and the chat gets the verdict and the findings.
The review runs in the session you typed it in. Every read and every command shows up as it happens, and once it is done you can ask about a finding and the model answers from what it read. Start a new session for a review, so the model reads the change cold instead of remembering why it wrote it.
How it works
A bare /review asks git what changed since the last checkpoint. With nothing there it takes what is uncommitted, and with nothing there either, this branch against its merge base.
The command writes its snapshot through a throwaway GIT_INDEX_FILE. That produces a dangling tree with no ref and no commit, so repository history stays untouched. The checkpoint is that same tree, and a review moves it.
The command posts the review request as one message, collapsed to a single line you can expand, and the model answers it with every tool, skill, and subagent the session has. It hands the review in through review_submit, a tool that is only active while a review is open. That call writes the report, the ledger, and the checkpoint, and returns the summary.
Until review_submit returns, edit and write are blocked, so a review never changes the code it reads. A model that stops without submitting is reminded once. Escape ends the review and lifts the block.
A diff over 40,000 characters is cut, and the request names the git diff command for the files past the cut, so the model reads them itself or hands them to a subagent.
What a review covers
- the task: the request, the commit messages, the acceptance criteria
- what this change breaks: callers, signatures, schemas, generated clients, migrations
- paths that fail: partial failure, retries, ordering, shared state, empty and maximum inputs
- tests that pass without proving the thing the change exists for
- the layer and the seam, when it will cost the next person real time
- the house rules:
AGENTS.md,CLAUDE.md,CONTRIBUTING.mdand the lint configs, read before judging, and cited when broken - decision records: a tradeoff an ADR or
DESIGN.mdsettles is not a finding, and code that contradicts one is - errors swallowed, casts and type guards that claim more than the code proves, input from outside, queries in loops, a helper the codebase already has
A finding needs a line of this change and a consequence, and the reviewer re-checks each one before reporting it. A doubt goes in the questions instead.
Before the model reads anything, the command scans the added lines for leftovers: FIXME, TODO, a comment ending in ?, commented-out code, debug output, a focused or skipped test, a disabled lint or type check. The prompt lists each hit. One the review does not report is added as a finding anyway, so it cannot slip through on a weak model. A focused test is P1, a skipped one P2, the rest P3.
Commands
/review what moved since the last review, else uncommitted, else the branch base
/review 84aeb507b8 the bug the sha, path or range and the task, as you would say them
/review dismiss "title" why rule out an open finding, so later reviews skip it
Apart from dismiss, nothing after the command is parsed. The reviewer reads the text, finds the
path or the range with git, and treats the rest as the task. There are no flags. The report is
.pi/reviews/<stamp>-<branch>.md at the repository root, created when the directory is missing.
The report
One finding is a line and the change it needs. When the change is clean, the report says so and nothing else.
# Review: feat/lock
`feat/lock` · `b9e12ac4f1` · 2026-11-12 · 3 files changed, 40 insertions(+), 6 deletions(-)
Fix before merge. 1 blocking
1. issue, blocking · `src/lock.ts:41` The lock is released before the write
Two workers can overwrite each other.
before `await release(key)`
after `await write(key, value)`
# Review: main
`main` · `b1d2376f4b` · 2026-11-13 · 2 files changed
All good.
- The verdict line:
All good.,Fix before merge., orTalk it through first., with the count by kind - One numbered finding:
issue, blocking,suggestion, ornitpick, then the location, the problem in six words, one sentence, and thebeforeandafterlines. A finding the reviewer cannot write anafterfor is not a finding: it lands underQuestionsinstead Questions: only what the code cannot settle and could change the verdictUnread: files the reviewer did not open that could change the verdictFixed since the last review: findings on files in this diff that are gone
Each finding is numbered and keeps its number between reviews where the title and file are unchanged, so "fix #2" means something in the next conversation. Nothing is written when the reviewer never submits.
The chat gets the verdict, the count, one line per finding, and the report path. Your model then answers in two lines at most: the verdict and the first thing to fix.
The ledger
Open findings are saved in .pi/reviews/ledger.json. The next review is told about them and asked to report one again only when it is still there, keeping the title, so a fixed issue stops appearing and a surviving one is marked (still open) instead of being rediscovered from scratch. Only entries on files this diff touches are sent to the reviewer or can be closed. The rest stay open in the ledger for the review that covers them.
The ledger also keeps what was ruled out, so a false positive is argued once. A reviewer that checks a suspicion and finds it is not a problem records it under dropped with the reason, and the report lists it under "What I checked and dropped". You can rule out an open finding yourself with /review dismiss "<part of its title>" <why it is fine>. The next review of that file gets the list with the reasons and raises one again only when the change undoes the reason. A dropped item the reviewer reports as a finding again leaves the list. It keeps the newest 200.
The ledger is per repository, not per session, so it survives /new.
Install
pi install npm:@tduyng/pi-review
It needs git on PATH and a git repository. Outside one, the command says so and stops.
Limits
- The review is one pass, not a debate. A second opinion means running
/reviewagain. - The report is the whole change, up to 40,000 characters of diff in the prompt. Past that, the reviewer reads the rest from the files with git.
- The checkpoint lives as a session entry, so a new session starts from the last one in the same repository. A fresh clone starts from nothing.
- Snapshot trees are unreferenced by design, so git's pruning collects them after about two weeks. A checkpoint older than that resolves to a full review.
/reviewin print mode (pi -p '/review') has no turn to run in, and print mode drops notifications, so the command writes one line to stderr and returns. Interactive use and--mode rpcare the supported paths.