@diegopetrucci/pi-code-reviewer0.1.15
A standalone pi extension that adds a read-only code_reviewer subagent tool for isolated code reviews.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
code-reviewer
Adds a code_reviewer subagent tool that adapts The Last Harness code-reviewer prompt into a standalone pi extension.
Use it when you want an isolated second-pass review of a proposed change against the local checkout. The subagent uses read-only built-in tools plus any configured MCP tools, checks ticket fit and scope first, then looks for diff mismatches, correctness bugs, security/safety issues, unnecessary complexity, and missing validation.
Install
Standalone npm package
pi install npm:@diegopetrucci/pi-code-reviewer
Collection package
pi install npm:@diegopetrucci/pi-extensions
GitHub package
pi install git:github.com/diegopetrucci/pi-extensions
Then reload pi:
/reload
code_reviewer tool behavior
The tool accepts:
task— required review target and success criteriadiff— optional diff, patch, or change summarycontext— optional extra constraints or known risks
When called, it launches an isolated in-memory child agent with:
- no inherited extensions, skills, prompt templates, themes, context files, or agents files;
- an auto-selected review model that prefers contrarian-style opposite-provider and opposite-family candidates before same-provider fallbacks;
- automatic model candidates constrained to the current Pi session's model scope when that scope is non-empty;
- requested thinking taken from the active session when available, otherwise defaulting to
highfor reasoning models andofffor non-reasoning models, then clamped to the selected model's supported level; - read-only built-in tools:
read,grep,find,ls, and guardedbash; - configured MCP tools (run without confirmation in the subagent; may have side effects; use for evidence gathering only; requires host Pi >=1.0.4; older hosts degrade to no MCP, no error); the global
mcp.jsonalways applies; a project.pi/mcp.jsonis loaded only when the host session has already trusted the project; - a local-checkout path guard for file inspection;
- a bash guard that allows only direct read-only
git,gh, orpwdinvocations.
The review prompt prioritizes:
- ticket fit and scope
- diff accuracy
- correctness and regressions
- security and safety
- simplicity and maintainability
- tests and validation gaps
The model report is concise and includes a verdict, findings, validation notes, and a scope check. The tool appends a run-details suffix with the final selected model, effective thinking level, turn count, tool calls, duration, working directory, and tools used.
Read-only guarantees
- The subagent is explicitly instructed not to implement changes.
- Runtime guards block write/edit tools, shell control operators, pipelines, redirection, path traversal outside the checkout, mutating
git/ghcommands,npm/publish commands, and other filesystem mutation. - Runtime guards apply to built-in tools only; configured MCP tools pass the guard, run without confirmation, and are limited only by prompt guidance.
- Built-in file-inspection tools are preferred over shell commands for local files.
Example
Use code_reviewer on this task before merging:
{
"task": "Review ticket pe-7lpt implementation for scope fit and correctness.",
"context": "Focus on whether the new extension stays runtime-only and keeps tools read-only."
}
Limitations
- The subagent has an 8-turn and 8-minute budget.
- The review quality depends on the local checkout matching the change being reviewed.
gh-based inspection is available only when GitHub CLI is installed and authenticated, but the tool can still review local changes without it.