原始内容
pi-code-review
High-signal multi-agent pull request reviews for Pi.
The package launches isolated Pi subprocesses to review task completion, scope, introduced bugs, regressions, permission and security risks, maintenance risks, and applicable AGENTS.md rules. Every candidate issue is independently validated; only findings with confidence of at least 80 are reported.
Requirements
- Pi on Node.js 22.19 or newer
- Git repository hosted on GitHub
- GitHub CLI installed and authenticated
- An active model in the current Pi session
- The local checkout at the PR head commit with no tracked worktree changes
Pi packages execute with the current user's full system permissions. Review package source before installation. Child review agents disable discovered extensions, skills, prompt templates, themes, and context files, and receive only Pi's read, grep, find, and ls tools.
Install
pi install npm:@sirfetch-d/pi-code-review
Remove it with:
pi remove npm:@sirfetch-d/pi-code-review
Usage
Review the PR associated with the current branch:
/code-review
Review a PR by number or URL:
/code-review 123
/code-review https://github.com/owner/repo/pull/123
Reviews are terminal-only by default. Publishing requires the explicit flag:
/code-review 123 --comment
All child agents inherit the current Pi model and thinking level. Override both for one invocation:
/code-review 123 --model anthropic/claude-opus-4-6 --thinking high
Supported thinking levels are off, minimal, low, medium, high, xhigh, and max.
Review pipeline
- Resolve the PR and skip closed, draft, duplicate-head, automated, or clearly trivial reviews.
- Read only
AGENTS.mdfiles in the ancestor path of each changed file. - Summarize the intended task.
- Run two instruction reviewers, two bug/risk reviewers, and one task objective/scope reviewer concurrently.
- Independently validate every candidate issue with validation concurrency capped at four.
- Filter invalid, low-confidence, duplicate, and out-of-diff findings.
- Render the terminal report or submit one atomic GitHub
COMMENTreview.
While the review runs, Pi shows an animated stage indicator with elapsed time and reviewer or validator completion counts. The conversation retains concise milestones for PR resolution, triage, task summary, independent review, validation, and the final result. It never displays child-agent reasoning or raw subprocess output.
Final terminal and GitHub review templates automatically use Chinese when the root or applicable scoped AGENTS.md content is predominantly Chinese. This localization does not change model prompts, intermediate results, or review decisions; generated finding content is preserved verbatim.
A reviewer receives the exact dynamic changed-file list and must return a matching coverage receipt. A mismatched reviewer retries once with missing and unexpected paths identified; a second mismatch makes the review incomplete. Invalid output from a required stage after one isolated repair attempt, model failure, or cancellation also makes the review incomplete. If triage alone returns invalid output twice, the command reports the fallback and continues reviewing because ambiguity defaults to review. Incomplete reviews are never published.
GitHub comments
--comment publishes one pull request review. Mappable findings become inline comments; task omissions without a safe diff location remain in the review summary. Terminal and GitHub summaries include an explicit advisory merge recommendation. The package never submits a formal GitHub approval or requests changes.
Published reviews include an AI-generated disclaimer and a hidden package-version/head-SHA marker. A second --comment run on the same head SHA is skipped; a new head SHA can be reviewed again.
Troubleshooting
- Pi opens without its normal startup information: set
"quietStartup": falsein~/.pi/agent/settings.json. Usepi --verbosefor a one-time override. This package does not change Pi's startup setting. No active Pi model is selected: select a model in Pi before running the command.gh ... exited: rungh auth statusand confirm the current checkout matches the PR URL repository.- No PR for the current branch: pass a PR number or URL.
- PR head mismatch: check out the target PR head and remove or commit tracked worktree changes before reviewing.
- Review incomplete: inspect the reported failed stage and rerun. The package does not convert partial coverage into a clean result.
- Large PR incomplete: use a model with sufficient context or split the pull request. Diff content is never silently truncated.
Development
npm install --ignore-scripts
npm run check
npm run test
npm run pack:check
The implementation follows the approved design. Release history is recorded in the changelog.
License
MIT