---
title: "Spell — Review Batch"
type: reference
kind: reference
documentedFor: "1.24.1"
updated: "2026-11-19"
canonical: "https://arcaneai.net/docs/reference/spell-review-batch"
---

# Spell — Review Batch

## At a glance

| Field | Value |
| --- | --- |
| Invoke as | `/spell-review-batch` |
| Argument | --prs <n,n,…> \| --pr <n> \| --file <path> \| --query <q> [--repos <r,…>] [--html] [--title <t>] |
| Agent | agent |
| When to use | Use PROACTIVELY when multiple open PRs need an adversarial review pass and a consolidated go/no-go verdict. |

## Executive Summary

- This spell runs the `spell-review` engine across a batch of pull requests and rolls the results into one report.
- It produces a per-PR verdict (approve / request-changes) plus an overall **go / no-go** gate for the batch — useful for a release-readiness or UAT gate.
- It is provider-agnostic: GitHub (`gh`) and Azure DevOps (`az repos`), detected from the git remote.
- This is the reviewer-side, many-PR counterpart to `spell-review` (single diff). The author-side spell is `spell-address-review`; PRs are typically opened with `spell-create-pull-request`.

---

Review a batch of pull requests and produce a consolidated readiness report.

Context to consult:

- `.arcane/governance/git-conventions.md` — review severity and merge policy.
- The `spell-review` spell — the single-PR review engine this spell reuses per PR (dimension-coverage lenses, severity, stable finding IDs `R1`, `R2`…).

## Arguments

- `--pr <n>` — a single PR.
- `--prs <n,n,…>` — comma-separated PR numbers.
- `--file <path>` — a file to extract PR numbers from (match `\b\d{2,}\b`).
- `--query <q>` — a provider query to discover matching PRs.
- `--repos <r,…>` — optional repo scoping for multi-repo orgs.
- `--html` — also emit a self-contained HTML version of the consolidated report for easy sharing.
- `--title <t>` — optional title for the consolidated report (e.g. "Sprint 42 UAT Gate").

If no input mode is given, ask the user how they want to specify the PRs.

## Step 1 — Resolve inputs

1. Detect the provider first from `git remote get-url origin` (GitHub vs Azure DevOps). If the remote is ambiguous or unrecognized, stop and ask. Confirm the CLI is authenticated (`gh auth status` / `az account show`) before proceeding; on an auth failure, report the exact remediation command and stop — do not partially run.
2. Parse the input mode and collect the PR list. For `--query`, discover PRs via the provider:
   - **GitHub:** `gh pr list --search "<q>" --json number,title,headRefName`
   - **Azure DevOps:** `az repos pr list --status active --query "<filter>"`
   - If `--query` returns zero PRs, report "no PRs matched" and stop — there is nothing to gate.
3. Deduplicate and validate every PR number (positive integers). Drop and note any malformed token rather than aborting. If the resulting list is empty, stop and ask for valid input.
4. Resolve scope per PR. `--repos` scopes discovery and disambiguates PR numbers across a multi-repo org; carry the owning repo with each PR number so mixed-repo batches fetch from the right repo (`gh pr view <n> --repo <r>` / `az repos pr show --id <n>`). A bare number with no repo defaults to the origin repo.
5. **Batch size.** Process PRs sequentially (each review is independent). If the batch exceeds **20 PRs**, warn the user, confirm intent, and proceed in order — do not silently truncate.

## Step 2 — Review each PR

For each PR in the batch, independently:

1. Fetch the PR diff and metadata (`gh pr diff <n>` / `az repos pr show --id <n>` + diff). If a PR can't be fetched (deleted, no access, network error), **skip it, record it as `SKIPPED` with the reason, and continue** — never abort the whole batch for one bad PR.
2. Run the `spell-review` workflow against that diff — the full dimension-coverage sweep (correctness, security, performance, tests, naming/clarity, architecture), severity-ranked findings (`HIGH` / `MEDIUM` / `LOW`, matching the `spell-review` ladder) with stable IDs, and the PASS/WARN/FAIL coverage table.
3. Record a per-PR result: verdict (**approve** / **request-changes**), finding counts by severity, and the coverage table.
4. **Post the formal round state per PR** — apply `spell-review`'s step 10 ([ARC-035](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-035--auto-merge-requires-a-clear-review-round) decision 3 — cited as plain text, not linked; see `agent-output.instructions.md` → Doc-ID Link Format) to *this* PR's number, not just this workflow's own single-run PR: a **request-changes** verdict posts `gh pr review <n> --request-changes` (or `az repos pr set-vote --id <n> --vote reject`); a re-review that clears a round this batch previously blocked dismisses/supersedes that prior review. An **approve** verdict posts nothing. Never let a posting failure (unauthenticated CLI, PR closed mid-batch) skip or abort the remaining PRs in the batch — record the result already computed and continue.

Reviews are adversarial — actively look for problems, do not just confirm quality. Apply the same no-fabrication coverage mandate as `spell-review`: a clean lens is reported as "no issues," never padded.

## Step 3 — Consolidate

Build one report:

```markdown
# Batch Review — {title or "PR Readiness"}  ({date})

## Gate: {GO / NO-GO}

> GO only if every PR was reviewed and no PR carries an unresolved HIGH finding.

| PR | Repo | Title | Verdict | High | Med | Low |
| -- | ---- | ----- | ------- | ---- | --- | --- |
| [#n]({url}) | repo | …     | approve / request-changes | 0 | 1 | 2 |
| [#n]({url}) | repo | …     | SKIPPED — {reason}        | —  | —  | —  |

## Per-PR detail
### [PR #n]({url}) — {title}
- Verdict: …
- Coverage: {PASS/WARN/FAIL per lens}
- Findings: {R1 …}
```

The overall gate is **NO-GO** if any reviewed PR has an unresolved HIGH finding, **or** if any requested PR was skipped (an un-reviewed PR can't be cleared) — otherwise **GO**. `HIGH` is the top severity in the `spell-review` ladder; do not invent a "Critical" tier the engine never emits.

**Gate flowchart** — per the generated state diagrams convention (rule 8, [ARC-036](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-036--generated-state-diagrams-deterministic-mermaid-for-computed-spell-state)), built only from
the verdict already computed per PR above; skip entirely (the applicability guard) for a batch of one
PR — there is nothing to aggregate:

```mermaid
flowchart LR
   PR1["PR #n<br/>approve"] --> Gate{Gate}
   PR2["PR #n<br/>request-changes"] --> Gate
   Gate --> Verdict[GO]
```

One node per PR in the batch, labeled with its number and verdict exactly as computed in the table
above (including `SKIPPED`); the gate node's outcome is the same GO/NO-GO already derived. Never use
the bare lowercase word `end` as a node label — Mermaid's flowchart parser reserves it and will fail
to render (verified against Mermaid's own flowchart syntax docs; none of this batch's real labels
collide, but a PR title inserted verbatim as a label could).

## Step 4 — Output

1. Write the consolidated markdown report to a sensible path (e.g. `reviews/batch-review-{date}.md`).
2. If `--html` was passed, also emit a self-contained HTML file (inline CSS, no external assets) at the same base path so it can be shared by email/chat.
3. Print a summary to the user: total reviewed / skipped, verdict counts, total findings by severity, the GO/NO-GO gate, and the output path(s).

   **Action required — what only the operator can do.** When this run leaves an action that only the operator can take, report it in one block at the very top of the final report, before every other section and before any optional next step. The block exists because these are the operator's decisions to make, not because the agent is stuck: write it as a hand-off of authority, never as a plea for help. Frame it with a horizontal rule above and below, so it stands apart in a terminal as well as on a rendered page:

   ```markdown
   ---

   ## 🚧 Action required

   **Now**

   - <exactly what to do: the command, the link, or the question> — <why only the operator can do it>

   **When you're at your desk**

   - <exactly what to do> — <why only the operator can do it>

   ---
   ```

   - **What belongs in it:** an action only the operator can take — approving or merging a pull request, accepting a decision record, answering a question the work is waiting on, confirming a `guarded` push, running an interactive command such as `spell unblock-push`, or a step on an external platform the agent cannot reach. An optional suggestion, a next spell to run, or anything the agent could do itself is not a required action and stays out of the block.
   - **Two tiers, one block.** **Now** holds what the work is not correct or complete without. **When you're at your desk** holds what only the operator can do but that can wait: a permission rule, a leftover remote branch, a credential to set up. Leave out a tier that has nothing in it; never split the tiers into two blocks.
   - **One line per action.** Say exactly what to do, then, after the dash, why only the operator can do it. Write the command, link or question out in full; never point elsewhere with "see above".
   - **Never only among optional steps.** An action required for correctness is never listed only under next steps, suggestions, `Carry Forward` or `What's Next?`. It may be repeated there, but it always appears in this block.
   - **Done items stay, struck through.** Within one session, once an item has been listed, keep it in every later report of the block; when the operator has done it, strike it through (`~~<the line>~~`) rather than dropping it, so progress shows and nothing disappears silently. The session's close carries only the open items forward.
   - **Omit it when empty.** When nothing is left for the operator and nothing was struck through this session, leave the block out entirely: no heading, no rules and no "None" line.
   - **Every final report.** The block belongs in whatever report ends the run, including a report written when the spell stops early.
   - **Report the Now tier to the presence channel.** When the **Now** tier has open items, also run `spell presence report --status waiting --required-action "<line 1>" --required-action "<line 2>"`, one flag per open line of that tier; the other tier is not blocking and is not reported. With no presence channel configured on this machine the command prints nothing and exits 0, so the block itself and the rest of the run are unchanged.
   - Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — no check reads a spell's actual output for this block; it holds by these instructions alone.

## Rules

- Reuse the `spell-review` engine per PR — do not invent a parallel, weaker rubric.
- Reviews are adversarial but honest — no fabricated findings to inflate counts.
- The HTML report must be fully self-contained (inline styles) so it works offline.
- Do not commit or post anything to external systems — the report is a local file the user shares deliberately.
- Never include secrets or tokens in the report.
