Spell — Review

Adversarial review before merge

Documented for v1.24.1 · Checked

Edit on GitHubView at v1.24.1

At a glance

Field Value
Invoke as /spell-review
Argument PR number, branch name, or file paths to review
Agent agent
When to use Use PROACTIVELY before merging any nontrivial change, even if the user doesn't explicitly ask for review.

Executive Summary

  • This prompt performs an adversarial code review — "looks good" is not acceptable.
  • The reviewer must explicitly cover every lens — correctness, security, performance, tests, naming/clarity, architecture — and state "no issues" for any lens that is clean. There is no finding quota: zero findings is a valid outcome on a clean or small diff.
  • Checks architecture compliance, test coverage, security, and coding standards.
  • See Development Methodology for the adversarial review pattern.

Perform an adversarial review of the specified code changes.

Use these files for context:

Workflow:

  1. Gather the diff — get the full set of changes being reviewed:

    • git diff main...HEAD for branch reviews.
    • Specific file paths if provided.
    • PR diff if a PR number is given.
  2. Architecture compliance — for each changed file:

    • Does it follow the architecture decisions in architecture.md?
    • Does it respect existing ADRs?
    • Are there unauthorized framework or pattern deviations?
  3. Code quality — check for:

    • Naming conventions (per project standards).
    • Error handling (appropriate, not excessive).
    • Code duplication (DRY violations).
    • Complexity (functions too long, too many parameters).
    • Dead code, commented-out code, debug statements.
  4. Test coverage — validate:

    • New code has corresponding tests.
    • Coverage meets thresholds per testing-standards.md.
    • Edge cases are tested (nulls, empty collections, boundaries).
    • No test stubs or skipped tests without justification.
  5. Security review — check for OWASP Top 10 issues:

    • Injection vulnerabilities (SQL, XSS, command injection).
    • Authentication/authorization gaps.
    • Sensitive data exposure.
    • Insecure dependencies.
  6. Generate review report:

    ## Code Review — [Feature/Branch Name]
    
    **Reviewer:** [Agent name]
    **Date:** [timestamp]
    
    ### Coverage Summary
    
    One row per coverage lens. Verdict is `PASS` for a clean lens (note "no issues"),
    `WARN` for non-blocking findings, `FAIL` for a blocker. Reference the relevant
    finding IDs (`R1`, `R2`, …) in the Notes column.
    
    | Lens            | Verdict (PASS/WARN/FAIL) | Notes                                |
    | --------------- | ------------------------ | ------------------------------------ |
    | Correctness     | [PASS/WARN/FAIL]         | [no issues / refs to R#]             |
    | Security        | [PASS/WARN/FAIL]         | [no issues / refs to R#]             |
    | Performance     | [PASS/WARN/FAIL]         | [no issues / refs to R#]             |
    | Tests           | [PASS/WARN/FAIL]         | [no issues / refs to R#]             |
    | Naming/Clarity  | [PASS/WARN/FAIL]         | [no issues / refs to R#]             |
    | Architecture    | [PASS/WARN/FAIL]         | [no issues / refs to R#]             |
    
    ### Findings
    
    Give each finding a stable ID (`R1`, `R2`, …) so it can be referenced in follow-ups and in `spell-address-review`.
    
    #### HIGH Severity
    - **R1** — [Finding with file:line reference]
    
    #### MEDIUM Severity
    - **R2** — [Finding with file:line reference]
    
    #### LOW Severity
    - **R3** — [Finding with file:line reference]
    
    ### Architecture Compliance
    - [Compliant / Minor deviation / Major violation]
    
    ### Test Coverage Assessment
    - [Coverage % and gap analysis]
    
    ### Security Assessment
    - [OWASP checklist results]
    
    ### Verdict
    - [ ] APPROVE — no critical issues
    - [ ] REQUEST CHANGES — critical issues found (list blockers)
    - [ ] DEFER — needs human decision on [topic]
    
    ### Backlog Items
    - [Findings outside scope of this change — track separately]
    
  7. Save report to disk — write the review report to the feature folder's assessments/ directory:

    FEATURE_FOLDER="features/$(git symbolic-ref --short HEAD | sed 's|.*/feat/||')"
    REPORT_PATH="$FEATURE_FOLDER/assessments/review-$(date +%Y-%m-%d).md"
    mkdir -p "$FEATURE_FOLDER/assessments"
    # Write the full review report to $REPORT_PATH
    

    If the branch doesn't follow feat/{id}-{slug}, ask the operator for the feature folder path. Confirm the saved path to the user.

  8. Present findings — show the review to the user with a clear recommendation.

    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:

    ---
    
    ## 🚧 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) — no check reads a spell's actual output for this block; it holds by these instructions alone.
  9. Write back to the pull request — when a PR exists for these changes, sync a short verdict plus a findings summary (verdict + finding counts/IDs + a pointer to the saved report) into the PR body/description. Use provider-agnostic phrasing that works for either GitHub or Azure DevOps. Mark it clearly as a snapshot at review time, and fall back to a top-level PR comment if the description can't be updated.

  10. Post the formal round state (ARC-035 decision 3 — Arcane's own framework decision, cited as plain text, not linked, since this file ships; see agent-output.instructions.md → Doc-ID Link Format) — step 9's write-back is a human-readable summary; this is the separate, machine-readable signal the Review round clear required check actually reads. Only a confirmed blocker posts a formal review — an APPROVE or DEFER verdict posts nothing here, preserving the zero-friction path for PRs nobody formally blocks:

    • REQUEST CHANGES verdict:
      • GitHub: gh pr review <n> --request-changes --body "<one-line blocker summary + pointer to the saved report>".
      • Azure DevOps: az repos pr set-vote --id <n> --vote reject — the same primitive spell-commit-work.md's author-side self-approval step already uses (az repos pr set-vote --vote approve), applied to the reviewer side.
    • Closing a round you previously blocked (a later pass confirms the blocker is fixed) — do this explicitly; dismiss_stale_reviews_on_push is false on this repository's ruleset, so a later push never clears it automatically:
      • GitHub: find the blocking review's ID (gh api repos/{owner}/{repo}/pulls/<n>/reviews --jq '.[] | select(.state=="CHANGES_REQUESTED") | .id'), then dismiss it — gh api -X PUT repos/{owner}/{repo}/pulls/<n>/reviews/<review_id>/dismissals -f event=DISMISS -f message="<why this is now resolved, referencing the fix commit>".
      • Azure DevOps: az repos pr set-vote --id <n> --vote approve (or reset to no-vote per team convention).
    • Degrade silently if the CLI is unauthenticated or the PR can't be resolved (e.g. no PR exists yet for a local-only review) — never let this step abort a review that otherwise completed; the findings, report, and step 9 write-back still stand on their own.
    • GitHub refuses a REQUEST CHANGES verdict from the PR's own author (GraphQL: Review Can not request changes on your own pull request, verified live 2026-08-31 — the same restriction as self-approval, just previously untested). When you are reviewing your own authored PR under the same GitHub identity, this call will fail with exactly that error: treat it as expected, not a bug, and fall back to the step 9 write-back as the only signal available — a formal blocking review needs a genuinely distinct reviewer identity (a second collaborator, or a separate bot/service account). Because this happens after step 8, finish by telling the operator in a short ## 🚧 Action required block (per step 8): have a distinct reviewer identity post the blocking review — this identity cannot block its own pull request.

Rules:

  • Cover every dimension, not a finding count. You MUST explicitly address each lens — correctness, security, performance, tests, naming/clarity, architecture — and state "no issues" for any lens that is clean. There is no minimum number of findings: zero findings is a valid outcome on a clean or small diff. The mandate is coverage of effort, not a count of findings — never fabricate issues to hit a quota.
  • Never rubber-stamp. Every review must include substantive analysis across all dimensions.
  • Classify severity honestly. Don't inflate LOW findings to pad the report.
  • Escalate architecture-level flaws. If the review surfaces deep design or architecture problems (not line-level fixes), recommend routing them to spell-architect rather than trying to patch them inline.
  • Separate concerns. Don't block a PR for issues unrelated to the current change — add them to backlog.
  • Check for bias. If you wrote the code being reviewed, flag the conflict and recommend a different agent review.

Was this page helpful?

Your answer

Please don't include personal information.