Extension Git @piex-dev/review

review — First-Class Code Review for Agents

TL;DR

/review turns "paste a diff for AI to look at" into a repeatable capability: clear scope, noise-controlled, one shared engine for human and model.

Overview

"Have AI look at this code" stumbles on: where the diff comes from, too much noise, unstable prompts, split human/model entry points. @piex-dev/review consolidates it: humans use /review, the model uses the review tool, the core is one git-diff collection + noise filter + structured prompt. A lightweight omp review: keeps the diff engine and modes, drops multi-agent parallel review and TUI overlay.

How it works

Review = pick scope + clean noise + feed structured context. Core insight: review quality depends on whether the diff fed to the model is clean — half the tokens being package-lock.json is waste. 5 modes map to real dev actions: uncommitted / staged / vs base branch (with fetch) / commit / custom.

flow
pick mode → git diff/show → parse unified diff
→ drop noise (lock/min/build/vendor) → build Markdown prompt
→ hand to current session model for findings

Human and model share the engine: /review uses a UI menu, the review tool uses params; both end up in parseDiff + buildReviewPrompt.

Usage

Install

bash
pi install npm:@piex-dev/review

Source: extensions/review

Prerequisites

The current directory is a git repo; git is on the machine.

Usage

Human: /review lists the mode menu. Model: call the review tool with action (diff/staged/commit/branch). After selection a prompt is generated and sent back via pi.sendUserMessage(..., { deliverAs: "followUp" }) for the current model to act as reviewer.

Verify

bash
pi -e ./extensions/review/src/review.ts -p "what is 1+1" --no-session

Implementation

~350 lines, single file. Noise filter (EXCLUDED_PATTERNS) auto-excludes lock/build/vendor/generated/media-binary; excluded files still appear in an "Excluded" section (path + reason + line count) so the model knows things were filtered without ingesting them. Diff parsing chunks by diff --git counting +/-. Prompt generation: skips embedding full diff when too large (>50k chars or >20 files, suggests read); unified instructions grade findings critical/warning/info with file+line.

omppiex review
multi-agent parallel reviewcurrent agent reviews directly
TUI overlaytext output
Diff + noise filter
Multiple modes✅ (light set)
Structured prompt✅ streamlined

Design notes

ProjectMechanismpiex choice
oh-my-pi reviewcommand + tool; multi-agent parallel + TUI overlay; diff engine + noise filter + structured promptAdopted: diff engine, noise filter, multi-mode, shared prompt. Not adopted: multi-agent parallel (needs subagent), TUI overlay
OpenCode /reviewbuilt-in command, review uncommitted or specified commit/branchBorrowed: interactive menu, unified prompt template, multi-source review

Core trade-off: keep the diff engine and noise filter intact (feed the model clean context), drop parallelism and visual overlay.

Changelog

Roadmap

DirectionPlan
Single model, single threadnear-term optional multi-pass (critical then style); long-term migrate to omp multi-agent when subagent is ready
Weak findings↔code bindingoutput findings JSON; link diagnostics, route runtime suspects to dap
Naive base-branch & noise rulesproject-level .reviewignore/pathspec; configurable remote & default branch
Result is chat textattach a machine-readable block beyond Markdown; serve local workflow first, then gating
Extreme diffsparser covers real PR edge cases (rename/binary/submodule)

Version history

VersionDateChanges
0.1.12026-07-19Initial release: diff engine (parseDiff) + noise filter (EXCLUDED_PATTERNS); 5 modes; buildReviewPrompt structured prompt (oversized diff not inlined); shared engine for human/model; omp lightweight (no multi-agent parallel or TUI overlay)