|
| 1 | +--- |
| 2 | +name: review-pr |
| 3 | +description: > |
| 4 | + Full multi-agent code review for a Pluto PR. Spawns parallel agents covering |
| 5 | + functional correctness, security, Rust style, and code quality, then posts |
| 6 | + all findings as isolated GitHub review comments and submits a final |
| 7 | + approve/request-changes verdict. Invoke as `/review-pr <PR-number>` or |
| 8 | + `/review-pr <GitHub-PR-URL>`. |
| 9 | +--- |
| 10 | + |
| 11 | +# Review PR |
| 12 | + |
| 13 | +You are orchestrating a thorough code review for a Pluto pull request. |
| 14 | + |
| 15 | +## Input |
| 16 | + |
| 17 | +The argument is either a PR number (e.g. `311`) or a full GitHub PR URL. The |
| 18 | +repository is always `NethermindEth/pluto`. |
| 19 | + |
| 20 | +Resolve the PR number if a URL was given: |
| 21 | +```bash |
| 22 | +# From URL like https://github.com/NethermindEth/pluto/pull/311 |
| 23 | +PR=311 |
| 24 | +``` |
| 25 | + |
| 26 | +## Step 1 — Gather context |
| 27 | + |
| 28 | +Run these in parallel: |
| 29 | +```bash |
| 30 | +gh pr view $PR --repo NethermindEth/pluto \ |
| 31 | + --json title,body,files,additions,deletions,headRefName,commits |
| 32 | +gh pr diff $PR --repo NethermindEth/pluto |
| 33 | +``` |
| 34 | + |
| 35 | +Read every changed file from disk (the branch may already be checked out). |
| 36 | +If a file is not available locally, use the raw diff. |
| 37 | + |
| 38 | +Also note the head commit SHA — you will need it for the review API call. |
| 39 | + |
| 40 | +## Step 2 — Parallel agent review |
| 41 | + |
| 42 | +Spawn **four agents in a single message** so they run concurrently. Give each |
| 43 | +agent the full diff and relevant file contents in its prompt. |
| 44 | + |
| 45 | +| Agent | Skill | Focus | |
| 46 | +|---|---|---| |
| 47 | +| **pluto-review** | `/pluto-review` | Functional equivalence with Charon Go; parity matrix; test coverage gaps | |
| 48 | +| **security-review** | — | Auth bypass, resource exhaustion, key-material handling, DoS vectors | |
| 49 | +| **rust-style** | `/rust-style` | Idiomatic Rust; memory orderings; error handling patterns; naming | |
| 50 | +| **code-quality** | — | Concurrency correctness; state-machine completeness; resource lifecycle | |
| 51 | + |
| 52 | +Each agent must return findings as JSON objects: |
| 53 | +```json |
| 54 | +{ |
| 55 | + "file": "crates/foo/src/bar.rs", |
| 56 | + "line": 42, |
| 57 | + "severity": "bug|major|minor|nit", |
| 58 | + "title": "short title", |
| 59 | + "body": "detailed explanation with code snippets if helpful" |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +## Step 3 — Deduplicate and assess |
| 64 | + |
| 65 | +Merge the four finding lists. For each finding: |
| 66 | + |
| 67 | +- If the same issue is raised by multiple agents, merge into one finding |
| 68 | + (use the most detailed body). |
| 69 | +- Assign a final severity: `bug` → `major` → `minor` → `nit`. |
| 70 | +- Prefix the comment body with **`nit:`** if severity is `nit`. |
| 71 | +- Verify every `file` path and `line` number against the actual diff before |
| 72 | + posting — do not guess. |
| 73 | + |
| 74 | +## Step 4 — Post inline comments via GitHub review API |
| 75 | + |
| 76 | +Build a single JSON payload and post it in **one** API call: |
| 77 | + |
| 78 | +```bash |
| 79 | +gh api repos/NethermindEth/pluto/pulls/$PR/reviews \ |
| 80 | + --method POST \ |
| 81 | + --input /tmp/review_payload.json \ |
| 82 | + --jq '{id:.id, state:.state, url:.html_url}' |
| 83 | +``` |
| 84 | + |
| 85 | +Payload shape: |
| 86 | +```json |
| 87 | +{ |
| 88 | + "commit_id": "<head-sha>", |
| 89 | + "body": "<overall-assessment — see Step 5>", |
| 90 | + "event": "APPROVE | REQUEST_CHANGES | COMMENT", |
| 91 | + "comments": [ |
| 92 | + { |
| 93 | + "path": "crates/foo/src/bar.rs", |
| 94 | + "line": 42, |
| 95 | + "side": "RIGHT", |
| 96 | + "body": "comment text" |
| 97 | + } |
| 98 | + ] |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +Rules for comments: |
| 103 | +- One comment per finding. Do not batch multiple issues into one comment. |
| 104 | +- Use `line` + `side: "RIGHT"` for new/modified lines (additions). |
| 105 | +- Use `side: "LEFT"` only for deleted lines. |
| 106 | +- If `line` is unavailable or ambiguous, omit it — the comment lands at the |
| 107 | + file level, which is still useful. |
| 108 | +- nit-level findings must start with **`nit:`** in the comment body. |
| 109 | + |
| 110 | +## Step 5 — Overall assessment |
| 111 | + |
| 112 | +Write a 3–5 sentence overall body for the review covering: |
| 113 | +1. What the PR does and overall quality signal. |
| 114 | +2. A numbered list of **bugs** (must-fix before merge). |
| 115 | +3. Summary of major/minor findings. |
| 116 | +4. Verdict rationale. |
| 117 | + |
| 118 | +**Verdict rules:** |
| 119 | + |
| 120 | +| Condition | Event | |
| 121 | +|---|---| |
| 122 | +| Any `bug` severity finding | `REQUEST_CHANGES` | |
| 123 | +| Any `major` severity finding | `REQUEST_CHANGES` | |
| 124 | +| Only `minor` / `nit` findings | `COMMENT` (leave open for author discretion) | |
| 125 | +| No findings or only `nit` | `APPROVE` | |
| 126 | + |
| 127 | +## Output |
| 128 | + |
| 129 | +After the API call succeeds, print: |
| 130 | +``` |
| 131 | +Review posted: <html_url> |
| 132 | +Verdict: <APPROVE|REQUEST_CHANGES|COMMENT> |
| 133 | +Findings: <N bugs, M major, P minor, Q nits> |
| 134 | +``` |
0 commit comments