agentsclimarketplace

Review

Skill saitoco/wholework/skills/review

PR review (`/review 88`). Automatically runs acceptance criteria verification, multi-perspective code review, issue resolution, and summary posting. Use after `/code` creates a PR and before `/merge` (`--light`/`--full` to adjust depth).From its SKILL.md

Install
npx -y skills add saitoco/wholework --skill review

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

68.5 KB, as published. Nobody here has run it

PR Review

Accepts a PR number as ARGUMENTS. If an Issue number is provided, searches for the related PR.

If ARGUMENTS contains --help, read ${CLAUDE_PLUGIN_ROOT}/modules/skill-help.md and output help following the "Processing Steps" section. Do not execute further steps.

Autonomous Mode (--auto)

If ARGUMENTS contains --auto:

Note: This mode only works when invoked via /auto (direct run-review.sh call). Running /review 88 --auto from an interactive session spawns a fork sub-agent via context: fork, causing no visible output. In interactive sessions, use /review 88 without --auto.

Note: --auto mode only accepts a PR number. If an Issue number is provided, do not use --auto; instead, search for the related PR in normal mode before running /review.

  1. Extract the PR number from ARGUMENTS
  2. Check for --review-only, --light, --full flags and include them as arguments
  3. Run ${CLAUDE_PLUGIN_ROOT}/scripts/run-review.sh $NUMBER [--review-only] [--light | --full] via Bash
  4. After the script completes, stop (do not execute further steps)

If --auto is absent, run the normal steps below.

Non-Interactive Mode Behavior

If ARGUMENTS contains --non-interactive (set automatically by run-review.sh), operate in non-interactive mode. In this mode, AskUserQuestion cannot be used.

Read ${CLAUDE_PLUGIN_ROOT}/modules/ambiguity-detector.md and follow the "Non-Interactive Mode Handling" section for the three-tier policy (auto-resolve / skip / hard-error). The specific branching at each step is noted inline below.

Key per-step behavior in non-interactive mode:

  • Any AskUserQuestion during review comment resolution (Steps 7.2, 7.4, 7.6): auto-resolve using model judgment (apply the fix that best matches the review comment intent); record the decision in the Auto-Resolve Log as an issue comment
  • External review timeout waiting: auto-resolve by proceeding without waiting (the review results may be incomplete; note this in the review summary)
  • Unclear review comment intent: auto-resolve by adopting the most conservative interpretation (e.g., add a comment rather than delete code)
  • Foreground (前景) execution for test/build commands (including commands run by Step 10's review sub-agents): always run these in the foreground — do not set run_in_background: true and end the turn waiting for a completion notification. This applies to every execution surface without a re-invocation guarantee (headless claude -p, a fork-executed Skill, the Workflow tool path — see ${CLAUDE_PLUGIN_ROOT}/modules/execution-context.md § "Re-invocation Guarantee and Notification-Dependent Waiting" for the exhaustive list and rationale). Additionally, pass an explicit Bash timeout that covers the measured duration of the command — the tool's 120s default is too short for a full bats suite. Interactive-mode behavior (background execution + await notification) is unaffected.
    • The timeout must fit inside the tool's 600000 ms ceiling. A command that runs past it is moved to the background automatically, which reproduces the failure this rule exists to prevent — an explicit timeout alone does not keep the command in the foreground. For a whole bats suite, run it in parallel so it finishes inside the ceiling; the serial form does not (Issue #1213). Resolve the job count as a separate, literal step first — a $(...) command substitution inside the bats invocation itself is refused by this project's worktree isolation guard, active whenever /review is running inside a worktree session: run nproc 2>/dev/null || sysctl -n hw.logicalcpu on its own, then substitute the printed value literally into bats --jobs <N> tests/. If --jobs fails naming parallel (missing GNU parallel), follow ${CLAUDE_PLUGIN_ROOT}/modules/test-runner.md § "Fallback when --jobs is unavailable" rather than re-running one serial whole-suite command. If the tool moves the command to the background anyway, report it as a failure rather than waiting on its completion notification.

Review-only Mode (--review-only)

If ARGUMENTS contains --review-only (and --auto is absent), set REVIEW_ONLY=true for reference in subsequent processing.

  • With --review-only: skip Steps 7.2 (Copilot issue resolution), 7.4 (Claude Code Review issue resolution), 7.6 (CodeRabbit issue resolution), 12, 13, 14, and retrospective
  • Status label transitions are not made after Step 11 completes (maintain phase/review)
  • When combining --auto and --review-only, the --auto section passes --review-only to run-review.sh as an argument, which passes it through to ARGUMENTS for branching control in SKILL.md

Steps

Execute immediately without confirmation. Do not use compound commands (&&, |).

Step 1: Fetch PR Information

gh pr view "$NUMBER" --json number,title,body,headRefName,baseRefName
  • If PR not found: treat as Issue, search for related PR in gh issue view "$NUMBER" --json body (look for #XX links, etc.). If no PR found, display error message and exit.

Extract the linked Issue number and base branch using gh-extract-issue-from-pr.sh:

EXTRACT_RESULT=$(${CLAUDE_PLUGIN_ROOT}/scripts/gh-extract-issue-from-pr.sh "$NUMBER")
ISSUE_NUMBER=$(echo "$EXTRACT_RESULT" | python3 -c "import json,sys; print(json.load(sys.stdin).get('issue_number',''))")
BASE_REF=$(echo "$EXTRACT_RESULT" | python3 -c "import json,sys; print(json.load(sys.stdin).get('base_ref','main'))")
  • If Issue number cannot be extracted: skip Step 8 and run only Step 10.

Fetch Type (only when Issue number is extracted):

Run ${CLAUDE_PLUGIN_ROOT}/scripts/get-issue-type.sh $ISSUE_NUMBER and store the result in $TYPE:

  • Value (Bug/Feature/Task) stored as-is
  • Empty string: TYPE= (empty; the "unset" row in each agent applies, maintaining current behavior)

If Issue number cannot be extracted, set TYPE= (empty string).

Read ${CLAUDE_PLUGIN_ROOT}/modules/phase-banner.md and display the start banner with ENTITY_TYPE="pr", ENTITY_NUMBER=$NUMBER, SKILL_NAME="review".

Step 2: Worktree Entry

Read ${CLAUDE_PLUGIN_ROOT}/modules/worktree-lifecycle.md and follow the "Entry" section.

Worktree name convention: review/pr-$NUMBER

Record ENTERED_WORKTREE. After entry, switch to the PR branch:

git fetch origin "$headRefName"
git checkout "$headRefName"

(headRefName is the PR's headRefName from Step 1)

Comment consumption (unconditional, before Step 3's Size branching): If ISSUE_NUMBER was extracted in Step 1, read ${CLAUDE_PLUGIN_ROOT}/modules/l0-surfaces.md and follow the "Comment Consumption Procedure" section with parameters: ISSUE_NUMBER=$ISSUE_NUMBER, COMMENT_SCOPE=issue+pr (a PR necessarily exists by this point in /review, matching the same condition /code's resume path already uses to promote issue to issue+pr), PHASE_NAME=review. Run this before Step 3's Size branching (including the XS/S early-exit path) — /verify's Worktree Entry already runs its own Comment Consumption Procedure call unconditionally regardless of Size, and this follows the same precedent. If ISSUE_NUMBER could not be extracted in Step 1, skip this call — there is no Issue to consume comments for.

Then run the deterministic fallback (still only when ISSUE_NUMBER was extracted):

bash ${CLAUDE_PLUGIN_ROOT}/scripts/append-consumed-comments-section.sh "$ISSUE_NUMBER" review

No --no-push here (unlike /spec//code//verify's convention): Step 3's Size XS/S early-exit branch can end the skill before reaching the unconditional ## Retrospective push, so relying on a later push to carry this commit risks leaving it stranded, uncommitted-to-remote, on the worktree branch. At this point in /review, the PR's mergeability has not yet been decided (no /merge-Step-1-equivalent gate has run), so pushing immediately carries no risk beyond re-triggering CI.

Step 3: Review Mode Detection

Determine the review mode using ARGUMENTS and the linked Issue's Size, and store as REVIEW_DEPTH.

Exclusivity check: if both --light and --full are specified, display error and exit.

Load ALWAYS_PR (before Size branching): read ${CLAUDE_PLUGIN_ROOT}/modules/detect-config-markers.md and follow the "Processing Steps" section. Retain ALWAYS_PR, HAS_PR_PREVIEW_CAPABILITY, and PREVIEW_URL_COMMAND for use below.

Detection priority:

  1. --light in ARGUMENTS → REVIEW_DEPTH=light
  2. --full in ARGUMENTS → REVIEW_DEPTH=full
  3. Get Size from linked Issue → map as follows:
SizeREVIEW_DEPTHBehavior
XSskipEarly exit (patch route)
SskipEarly exit (patch route)
MlightRun Step 10 as lightweight integrated review (1 agent)
LfullRun all steps
XLfullRun all steps

ALWAYS_PR override: when ALWAYS_PR=true (.wholework.yml always-pr: true), Size XS/S no longer routes to /code's patch route — /code promotes it to pr route (see modules/size-workflow-table.md § "ALWAYS_PR Override"), so a PR necessarily exists here and the skip row above does not apply. In this case, set REVIEW_DEPTH=light instead of skip for XS/S — the same safe fallback skills/auto/SKILL.md's REVIEW_DEPTH derivation table already uses for a size that isn't M/L/XL under --pr, since XS/S remains the minimal-scope end of the Size scale even when promoted to pr route. M/L/XL rows are unaffected.

  1. Size unset (or Issue number not extractable) → REVIEW_DEPTH=full (safe fallback)

XS/S (patch route) early exit:

If REVIEW_DEPTH=skip, skip Steps 7/8/9/10/11/12/13/14 and output this message:

Patch route — review is not needed. Proceed with `/merge $PR_NUMBER`.
If you need to run a review explicitly (e.g., main branch protection required PR route), run `/review $PR_NUMBER --light`.

Then read ${CLAUDE_PLUGIN_ROOT}/modules/next-action-guide.md and follow the "Processing Steps" section with SKILL_NAME=review, PR_NUMBER=$NUMBER, ISSUE_NUMBER=$ISSUE_NUMBER, RESULT=success.

Get Size (Project field first, label fallback):

${CLAUDE_PLUGIN_ROOT}/scripts/get-issue-size.sh "$ISSUE_NUMBER" 2>/dev/null

Project-local Domain files (if present):

Read ${CLAUDE_PLUGIN_ROOT}/modules/domain-loader.md and follow the "Processing Steps" section with SKILL_NAME=review. Domain file content provides additional review perspectives and domain-specific checks.

Step 4: Label Transition (review start)

If Issue number was extracted:

${CLAUDE_PLUGIN_ROOT}/scripts/gh-label-transition.sh "$ISSUE_NUMBER" review

Step 5: Fetch Issue Information

gh issue view "$ISSUE_NUMBER" --json body

Parse acceptance criteria checkboxes.

  • Prioritize "Pre-merge (auto-verified)" section if present
  • If no sections, target all conditions
  • If no checkboxes: skip Step 8

Step 6: Fetch PR Diff

gh pr diff "$NUMBER"

If large (over 500 lines), fetch the file list and prioritize files with large changes:

gh pr view "$NUMBER" --json files

Step 7: External Review Integration

Detect external review tool settings and handle waiting/issue resolution for enabled tools. Also detect the review-bug independent control marker.

7.0. External Review Tool Detection

Read skills/review/external-review-phase.md and follow the "Step 7 Prerequisites" section (which internally reads modules/detect-config-markers.md to detect .wholework.yml settings).

review-bug is also included in detect-config-markers.md detection targets.

Store detection results:

HAS_COPILOT_REVIEW: true if copilot-review: true is set (default: false)
HAS_CLAUDE_CODE_REVIEW: true if claude-code-review: true is set (default: false)
HAS_CODERABBIT_REVIEW: true if coderabbit-review: true is set (default: false)
SKIP_REVIEW_BUG: true if review-bug: false is set (default: false)
SPEC_PATH: path from spec-path (default: "docs/spec")
STEERING_DOCS_PATH: path from steering-docs-path (default: "docs")
HAS_WORKFLOW_CAPABILITY: true if capabilities.workflow: true is set (default: false)

Phase Handoff read (after SPEC_PATH is determined):

Read ${CLAUDE_PLUGIN_ROOT}/modules/phase-handoff.md and follow the "Read Procedure" section. Parameters: SPEC_PATH, ISSUE_NUMBER=$ISSUE_NUMBER, PHASE_NAME=review.

After detection, follow external-review-phase.md's Step 7 procedure for external review waiting/issue resolution. For each enabled reviewer type, execute the "wait → resolve" flow in sequence:

  • Copilot (HAS_COPILOT_REVIEW=true): Steps 7.1–7.2 (wait-external-review.sh "$NUMBER" copilot)

  • Claude Code Review (HAS_CLAUDE_CODE_REVIEW=true): Steps 7.3–7.4 (wait-external-review.sh "$NUMBER" claude-code-review)

  • CodeRabbit (HAS_CODERABBIT_REVIEW=true): Steps 7.5–7.6 (wait-external-review.sh "$NUMBER" coderabbit)

  • If all three (HAS_COPILOT_REVIEW, HAS_CLAUDE_CODE_REVIEW, HAS_CODERABBIT_REVIEW) are false: skip all of Step 7 and proceed to Step 8

  • With --review-only mode: skip issue resolution (Steps 7.2, 7.4, 7.6)


Step 8: Static Acceptance Criteria Verification

8.0. Preview URL Resolution (if verify commands contain {{base_url}})

If any verify command contains {{base_url}}, resolve the Preview URL before passing to verify-executor:

Fast path — PREVIEW_URL env variable already set:

If the PREVIEW_URL environment variable is already exported (set by CI or a project-side script before invoking /review), use its value directly as the preview base URL and skip the GitHub Deployments API lookup (steps 1–4 below). Replace {{base_url}} with $PREVIEW_URL and proceed to step 5. ac-tier: preview ACs guarded with --when="test -n \"$PREVIEW_URL\"" are executed via this path. If PREVIEW_URL is not set, fall through to the Deployments API path below.

preview-url-command resolution — PREVIEW_URL unset but declared via config:

If PREVIEW_URL is not exported, HAS_PR_PREVIEW_CAPABILITY is true, and .wholework.yml declares preview-url-command, resolve it in a single Bash tool call. Append 2>/dev/null as shown — the script writes an informational/warning message to stderr on both its success and failure paths, and without discarding it here, the Bash tool's merged stdout+stderr result could make that message indistinguishable from the resolved value itself:

${CLAUDE_PLUGIN_ROOT}/scripts/resolve-preview-env.sh url "$NUMBER" 2>/dev/null

If the command produces non-empty stdout, treat it as the resolved preview URL: replace {{base_url}} with this literal value (not a $PREVIEW_URL shell reference — Bash tool calls do not persist exported env vars across invocations) and proceed to step 5, skipping the Deployments API lookup below — mirroring how the Deployments API path itself substitutes its resolved environment_url literally. If stdout is empty, fall through to the Deployments API path below unchanged.

  1. Get the PR branch name:

    gh pr view "$NUMBER" --json headRefName -q '.headRefName'
    
  2. Get the latest deployment ID for the branch via GitHub Deployments API:

    gh api "repos/:owner/:repo/deployments?ref=<branch-name>&per_page=10" -q '.[0].id'
    

    If output is empty or null, treat {{base_url}}-containing browser checks as UNCERTAIN (note "Deployment not found via Deployments API").

  3. Get state and environment_url from the latest deployment status:

    gh api "repos/:owner/:repo/deployments/<deployment-id>/statuses?per_page=1" -q '.[0] | {state: .state, environment_url: .environment_url}'
    
  4. Based on the result:

    • state is success and environment_url is obtained → replace {{base_url}} with PREVIEW_URL; run static checks first, then browser checks last
    • state is pending/in_progress etc. → treat {{base_url}} checks as UNCERTAIN (note "Preview deployment not complete")
    • Empty statuses → treat as UNCERTAIN (note "Cannot retrieve deployment status")
  5. When Preview URL is obtained, run static checks (file existence, etc.) first, then run {{base_url}}-containing browser checks last. Since the Preview URL comes from GitHub Deployments API (trusted source), run browser_check/browser_screenshot in full mode when browser tools are available (still applying security checks from ${CLAUDE_PLUGIN_ROOT}/modules/browser-verify-security.md).

Skip this step if no {{base_url}}-containing checks exist.

Read ${CLAUDE_PLUGIN_ROOT}/modules/verify-executor.md and follow the "Processing Steps" translation table. Mode: safe, PR number: $NUMBER, PR_BRANCH: $headRefName. For command hints, do not run directly — attempt CI reference fallback (gh pr view "$NUMBER" --json statusCheckRollup to check related job status). If CI cannot determine the result, treat as UNCERTAIN (note reason such as "corresponding CI job not identified").

Verify each condition:

  1. With verify command (<!-- verify: ... -->):

    • Valid syntax: run the specified command's corresponding processing
    • Invalid syntax (unknown command name, missing args, etc.) → treat as UNCERTAIN, fall back to AI judgment. Note error details.
  2. No verify command, tagged <!-- ac-tier: preview --> <!-- verify-type: manual -->: this AC can only be confirmed by a human looking at or operating the PR preview — do not attempt AI judgment. Classify directly as UNCERTAIN and record in Notes that "human-check against the preview URL is required."

  3. No hint (and not the manual preview-tier case above): attempt AI judgment (check if diff adds a file, if text is present, etc.)

  4. Classify each condition:

    • PASS — condition met
    • FAIL — condition not met
    • UNCERTAIN — cannot auto-determine
    • POST-MERGE — condition to verify after merge

Preview-tier unverified marker (defense in depth): After classification, collect the 1-based indices (counted across the full Issue body AC enumeration, same convention as gh-issue-edit.sh --checkbox — fenced code block lines excluded, see modules/l0-surfaces.md § AC Enumeration Convention) of every Pre-merge condition tagged <!-- ac-tier: preview --> that was classified UNCERTAIN in this step. When the Pre-merge section contains one or more ac-tier: preview conditions, post this marker on every run of this step, regardless of whether the collected set is empty — only skip the comment entirely when the Pre-merge section has zero ac-tier: preview conditions to begin with. Posting on every run (rather than only when the set is non-empty) matters because Issue comments are append-only: a later run that finds zero UNCERTAIN conditions cannot retract an earlier run's marker, so /verify's latest-wins lookup would otherwise keep resolving a stale, superseded marker after a fix cycle re-verifies a previously UNCERTAIN condition (see modules/l0-surfaces.md § "Machine-Readable Event Marker"). Write a comment body to .tmp/preview-ac-unverified-$ISSUE_NUMBER.md with the Write tool — first line <!-- wholework-event: type=preview-ac-unverified phase=review issue=$ISSUE_NUMBER ac=<comma-separated indices, or the literal none when the set is empty> -->, followed by a short human-readable note listing which preview-tier ACs could not be verified and why, or noting that all preview-tier ACs were verified when the set is empty — then post it:

mkdir -p .tmp
${CLAUDE_PLUGIN_ROOT}/scripts/gh-issue-comment.sh "$ISSUE_NUMBER" .tmp/preview-ac-unverified-$ISSUE_NUMBER.md
rm -f .tmp/preview-ac-unverified-$ISSUE_NUMBER.md

This records the current-run verification state so /verify's pre-merge-preview AC skip rule (Step 5) does not silently treat conditions as verified once the PR merges and the preview environment disappears, and so a fix cycle's re-verification is never masked by an earlier, now-superseded marker.

file_contains exact match check:

For file_contains verify commands, verify that the pattern is an exact substring of the implementation code in the PR diff. Shell quoting causes false negatives: get-config-value.sh autonomy L1 will not match "$SCRIPT_DIR/get-config-value.sh" autonomy L1. When a FAIL result stems from a quoting or path-prefix discrepancy rather than a genuine implementation gap, report it as a spec quality issue requiring a verify command update.

FAIL Blocking Behavior

Any condition classified FAIL in this step is MUST-equivalent, not a passive table row: Step 10 (10.0/10.2) MUST add a "severity": "MUST", "path": null entry for it (see Step 10's injection instructions). This reuses the existing MUST issue → REQUEST_CHANGES gate in gh-pr-review.sh (HAS_MUST scan over .tmp/review-comments-$NUMBER.json) rather than introducing a separate blocking mechanism — a genuinely FAILing condition (any command type; Step 8 only returns FAIL when the result is deterministic, never for ambiguous cases, which instead return UNCERTAIN) forces the review to post as REQUEST_CHANGES and must be fixed in Step 12 before /merge. UNCERTAIN, SKIPPED, PENDING, and POST-MERGE classifications do not block review.

UNCERTAIN does not block review, but a Pre-merge condition left UNCERTAIN stays unchecked (- [ ]) per the Checkbox Updates rule below, and skills/merge/SKILL.md Step 1's pre-merge AC gate blocks merge on any unchecked Pre-merge condition. Resolving that UNCERTAIN state — not /verify — is the responsibility of re-running /review.

Checkbox Updates

For "Pre-merge (auto-verified)" conditions that PASS in Step 7 verification, update Issue checkboxes:

Write to .tmp/issue-body-$ISSUE_NUMBER.md using the Write tool, then run:

mkdir -p .tmp
${CLAUDE_PLUGIN_ROOT}/scripts/gh-issue-edit.sh "$ISSUE_NUMBER" .tmp/issue-body-$ISSUE_NUMBER.md
  • PASS → update to - [x]
  • FAIL/UNCERTAIN → leave as - [ ]
  • POST-MERGE → leave as - [ ]

Step 9: CI Status Check

After Step 7, wait for all CI checks to reach terminal state, then check the PR's overall CI status:

${CLAUDE_PLUGIN_ROOT}/scripts/wait-ci-checks.sh "$NUMBER"
gh pr view "$NUMBER" --json statusCheckRollup
  • All jobs SUCCESS (or SKIPPED): note CI is successful and proceed
  • PENDING/IN_PROGRESS jobs (after wait timeout): note CI wait timed out; list pending checks and proceed with caution
  • FAILURE jobs: list failed job names and statuses; suggest fixes where possible. If scripts/validate-skill-syntax.py exists, also read skills/review/skill-dev-recheck.md and follow the "Step 8: Additional Suggestions on CI Failure" section.

Blocking by default: CI FAILURE joins the same MUST-equivalent gate as Step 8's FAIL Blocking Behavior — Step 10 (10.0/10.2) MUST add one "severity": "MUST", "path": null entry summarizing the failed job(s) so review cannot complete as COMMENT while CI is FAILURE. No built-in known-flaky allowlist exists; every FAILURE job blocks unconditionally except for the single exception below.

Pre-existing failure exception (baseline attribution)

A check that scans the entire repository unconditionally (e.g. Forbidden Expressions check) fails for every PR whenever main itself contains a violation, even when the PR's own diff never touches the offending file. Fixing the violation inline pollutes the PR's diff scope with an unrelated Issue's remediation, and blocking every unrelated PR until a follow-up Issue lands compounds the problem (see #1136 / PR #1138 for the incident this exception generalizes from).

Applicable scope (exhaustive): Forbidden Expressions check only — the sole entry (forbidden-expressions) currently registered in scripts/pre-merge-check.sh's check dispatch table. Every other FAILURE job keeps the unconditional blocking behavior above. Because push and pull_request triggers can each produce a same-named rollup entry for this job, treat either one being FAILURE as sufficient to run the classifier below (run it once, not once per trigger).

When Forbidden Expressions check is FAILURE, run the baseline classifier in the foreground before deciding whether to inject a MUST entry:

${CLAUDE_PLUGIN_ROOT}/scripts/pre-merge-check.sh "$NUMBER" forbidden-expressions

Branch on the exit code (exhaustive):

Exit codeOutput prefixClassificationBehavior
2NEW_FAILURE:this PR introduced the violationBlocking — inject the MUST entry as before
0PRE_EXISTING:violation predates this PR, inherited from baseNon-blocking
0FIXED: or CLEAN:no violation attributable to this PRNon-blocking
1(env error: missing args, ref resolution, fetch, or worktree-add failure)classifier could not runBlocking — the MUST entry body must state that baseline attribution could not be determined

Exit 1 is fail-closed rather than mirroring run-merge.sh's fail-open handling of the same exit code: both directions follow the same underlying principle — when the classifier cannot produce a verdict, fall back to the behavior that existed before the classifier was introduced. In run-merge.sh the classifier only adds a gate, so falling back means letting the merge proceed; here the classifier only relaxes an existing gate, so falling back means keeping the block.

Non-blocking outcome handling: record the classification name (PRE_EXISTING / FIXED / CLEAN) in the CI Status table's Notes column for this job, then add one "severity": "CONSIDER", "path": null entry — Step 10 (10.0/10.2) MUST include this entry alongside its MUST-entry injection, using the wording below matched to the classification:

  • PRE_EXISTING: note that the violation was inherited from the base branch and is out of scope for this PR. Search for an existing open follow-up Issue with gh issue list --state open --search "check-forbidden-expressions in:title,body" --limit 10 and cite it by number if found. Do not create a new follow-up Issue from this step.
  • FIXED / CLEAN: note that the CI rollup FAILURE is not attributable to this PR's refs (fixed on head, or passing on both base and head) and is out of scope for this PR.

In both cases, do not fix the violation inline in this PR.


Step 10: Multi-perspective Code Review (parallel execution)

Foreground dispatch reminder (orchestrator's own Task(...)/Agent calls, distinct from the sub-agents' internal commands): this step's fan-out (Task(...) calls in 10.0/10.1–10.3, and the Workflow path in skills/review/workflow-guidance.md) is the orchestrator dispatching sub-agents and then consuming their results before continuing — not a command the review sub-agents run internally. The ## Non-Interactive Mode Behavior section above ("Foreground (前景) execution for test/build commands, including commands run by Step 10's review sub-agents") covers only the latter. In every execution surface without a re-invocation guarantee (--non-interactive, a fork-executed Skill, the Workflow tool path — see ${CLAUDE_PLUGIN_ROOT}/modules/execution-context.md § "Re-invocation Guarantee and Notification-Dependent Waiting"), this dispatch must also be handled synchronously within the same turn: launch the fan-out and consume every sub-agent's result before ending the turn — do not end the turn as if waiting for a background completion notification for this dispatch itself.

Base Branch Conflict Pre-check

Run this section first, before evaluating either branch-decision paragraph below (Workflow path / light mode) — this applies to every review path (light, full, and Workflow) equally. CI runs on the branch alone and stays green even when the branch and the base have edited the same line in conflicting ways; git merge-tree is the only step in /review that inspects the base branch's own concurrent changes, so it must run first regardless of which review path follows.

  1. Update the base ref and compute the merge base:
    git fetch origin "$BASE_REF"
    MERGE_BASE_SHA=$(git merge-base HEAD "origin/$BASE_REF")
    
  2. Run the merge-tree conflict scan. Use this exact deprecated 3-argument --trivial-merge form — do not replace it with the current --write-tree 2-argument form. The 3-argument form emits a changed in both header for same-line conflicts; the 2-argument form reports the same case as CONFLICT (content): Merge conflict in <path> and never emits the string changed in both, which the parsing step below depends on:
    git merge-tree "$MERGE_BASE_SHA" HEAD "origin/$BASE_REF"
    
  3. Parse the output block by block. For each changed in both block, extract the file path from its their line.
  4. For each extracted path, fetch the base side's change:
    git diff "$MERGE_BASE_SHA" "origin/$BASE_REF" -- "<path>"
    
    Flag the path [SSoT] if it matches modules/*.md or docs/*.md — these are documents referenced by multiple Skills, so a base-side change lost during conflict resolution has wider blast radius than an ordinary file.
  5. If one or more paths were found, write path / [SSoT] flag / base-side diff for each to .tmp/base-conflict-context-$NUMBER.md. If zero paths were found, do not write the file — no additional context is passed to the review agents below.
  6. Add .tmp/base-conflict-context-$NUMBER.md to the rm -f cleanup list in 14.2.

Parser/Validator Edge Case Pre-check

Run this section after the Base Branch Conflict Pre-check above, before evaluating either branch-decision paragraph below (Workflow path / light mode) — this applies to every review path (light, full, and Workflow) equally.

Firing conditions (fires when any diff + line matches one of the following; exhaustive):

  • (a) Addition or modification of a regular expression used to match, validate, or extract an input string
  • (b) Addition or modification of a case/if chain that branches on the shape of an input value (aimed at format detection, not a fixed enum check)
  • (c) Addition or modification of a function/script that takes a string supplied from outside the process (config file content, CLI argument, environment variable, user input, etc.) as an argument and interprets/validates/normalizes it

Minimum input axes to cover (same 5 axes as the Issue body; exhaustive): empty input / unexpected nesting or hierarchy depth / input containing metacharacters / incidental syntax such as comments / structure shallower or deeper than expected

Trust gating (execution safety): This procedure executes PR-diff-introduced code with the reviewer's own credentials and permissions (the same worktree /review itself runs in — git push, gh api, etc. are reachable from that environment). Before running steps 1-4 below, resolve the PR author's trust tier the same way as modules/l0-surfaces.md § Trust Boundary: gh pr view "$NUMBER" --json authorAssociation --jq .authorAssociation. OWNER/MEMBER/COLLABORATOR are first-class; CONTRIBUTOR/NONE are external. Only first-class PRs proceed to actual code execution (steps 1-4). For an external-authored PR, skip step 3's execution entirely and instead write a single line to .tmp/edge-case-context-$NUMBER.md noting that edge case execution was skipped for this PR due to the external-contributor trust boundary — so downstream review agents and the human reviewer both know real-input execution did not happen and static review remains the only coverage.

  1. If zero files match the firing conditions above, skip the rest of this subsection (do not write a context file).
  2. If more than 2 files match, process only the top 2 by diff hunk size, and record the excluded files in the context file's header (cap rationale: this measurement sub-agent carries out heavier work than the 10.3 verification sub-agent, so it uses a more conservative cap). This cap-triggered case always produces a context file (see step 4) — the excluded-file record must not silently disappear because the top-2 processed files happened to report zero findings.
  3. For each matching file (first-class PRs only — see Trust gating above), launch a subagent_type="general-purpose" Task sub-agent in parallel. Pass the target file path, diff hunk, and Spec path in the prompt, and instruct it to: (1) identify the changed function/script, (2) construct fixture inputs covering the 5 axes above, (3) using the sub-agent's own Bash/Write permissions, actually execute the target code from the repository root (the worktree, equivalent to the PR HEAD) — execution is required, not simulation, writing any fixture files only under .tmp/edge-case-fixtures-$NUMBER/ and deleting that directory before returning, (4) compare the measured behavior against the expected behavior, (5) if it finds a path where "no error occurs and a wrong value or default is silently returned," check whether the Spec documents it as an intentional fail-open, and report it as a finding if undocumented, (6) output findings in the same **[Edge Case Execution] path:line** format as review-bug.
  4. Write .tmp/edge-case-context-$NUMBER.md when either condition holds: (a) one or more sub-agents report 1+ findings, or (b) the cap in step 2 triggered (so the excluded-file header is preserved even if the processed files report zero findings). Do not write the file when neither condition holds (zero matches, or matches processed with zero findings and no cap triggered). Add this file, and .tmp/edge-case-fixtures-$NUMBER/ as a defensive backstop in case a sub-agent's own cleanup (step 3) did not run, to the rm -f/rm -rf cleanup list in 14.2.

Review depth and rationale: fires under --light, --full, and the Workflow path alike (independent of REVIEW_DEPTH). Rationale: the originating defect (#1055 / PR #1120) was found under --light — limiting this to --full only would reopen the detection gap this Issue is closing. Cost is bounded by the firing-condition gating (most PRs that never touch a parser/validator/normalizer see zero matches) and the 2-file cap.

Workflow path (opt-in): After the Base Branch Conflict Pre-check above, when HAS_WORKFLOW_CAPABILITY=true and REVIEW_DEPTH=full, first run the "Pre-flight: agentType Availability Check" in skills/review/workflow-guidance.md (loaded in Step 3), then follow that file's Processing Steps to run a finder → adversarial verify pipeline using the Workflow tool. When HAS_WORKFLOW_CAPABILITY=false or unset (the default), run the static Task fan-out below (Steps 10.0–10.3) unchanged.

In light mode: after the Base Branch Conflict Pre-check above, if REVIEW_DEPTH=light and Issue number was extracted (Step 7 ran), run 1-agent lightweight integrated review instead of 2-agent parallel (see 10.0). If Issue number was not extracted and Step 7 was skipped, run full mode (10.1–10.3) regardless of REVIEW_DEPTH.

10.0. Lightweight Integrated Review (REVIEW_DEPTH=light only)

Run only when REVIEW_DEPTH=light and Issue number is extractable.

If SKIP_REVIEW_BUG=true, specify in the prompt to run only review-light's spec divergence (aspect 1) and documentation consistency (aspect 4). If SKIP_REVIEW_BUG=false, run all 4 aspects.

  1. Save PR diff to file:

    • mkdir -p .tmp
    • Write gh pr diff "$NUMBER" result to .tmp/pr-diff-$NUMBER.txt
    • Write gh pr view "$NUMBER" --json files result to .tmp/pr-files-$NUMBER.json
  2. Get Spec path:

    • Glob for $SPEC_PATH/issue-$ISSUE_NUMBER-*.md
    • Record path if found; empty string if not
  3. Get steering doc paths:

    • Glob for $STEERING_DOCS_PATH/product.md, $STEERING_DOCS_PATH/tech.md, $STEERING_DOCS_PATH/structure.md
    • Record existing paths comma-separated as STEERING_DOCS_FILES
  4. Launch 1 review-light agent:

    If .tmp/base-conflict-context-$NUMBER.md exists (written by the Base Branch Conflict Pre-check above), append its content to the prompt below, followed by: "For the files listed above, if the PR's current resolution loses either side's change, report it as MUST. Files flagged [SSoT] are referenced by multiple Skills — check them with priority."

    If .tmp/edge-case-context-$NUMBER.md exists (written by the Parser/Validator Edge Case Pre-check above), append its content to the same prompt, followed by: "The above is a pre-measured edge case execution result for this diff's parser/validator/normalizer changes. Do not re-derive it — reflect it directly in Perspective 2 (Edge Cases and Robustness)."

    Task(
      subagent_type="review-light",
      description="Lightweight integrated review (all 4 aspects)",
      prompt="Run review: PR=$NUMBER, Issue=$ISSUE_NUMBER, Type=$TYPE, Spec=$DESIGN_FILE_PATH, Steering Documents=$STEERING_DOCS_FILES, PR diff=.tmp/pr-diff-$NUMBER.txt, changed files=.tmp/pr-files-$NUMBER.json[, base branch conflict context: <contents of .tmp/base-conflict-context-$NUMBER.md, if present>][, edge case context: <contents of .tmp/edge-case-context-$NUMBER.md, if present>]"
    )
    
  5. Pass results to Step 10:

    • Extract path, line, body, severity from review-light output
    • Issues where path is not null → add to line comments array (with side: "RIGHT")
    • Issues where path is null → merge into "General Comments" section of Review body (MUST issues MUST be included in General Comments — even with path: null, MUST is the basis for event=REQUEST_CHANGES, so not including in Review body leaves it unclear what the problem is)
    • Inject Step 8/Step 9 blocking entries: for each Step 8 condition classified FAIL, and the Step 9 CI FAILURE summary (if any), add one severity: "MUST", path: null entry per the FAIL Blocking Behavior / Blocking by default rules. When Step 9's Pre-existing failure exception classified the Forbidden Expressions check FAILURE as non-blocking (PRE_EXISTING/FIXED/CLEAN), add the severity: "CONSIDER", path: null entry described in that section's Non-blocking outcome handling instead of a MUST entry.
    • mkdir -p .tmp
    • Write line comments array to .tmp/review-comments-$NUMBER.json (JSON array format)
    • Write Review body (acceptance criteria table + CI status + General Comments + issue count summary) to .tmp/review-body-$NUMBER.md
  6. Proceed to Step 10 (skip 10.1–10.3)

Split into 2 groups and run in parallel using Task tool (REVIEW_DEPTH=full or fallback).

10.1. Group Definitions

GroupAspectsModelAgent file
Spec: spec/documentationSpec divergence, documentation consistency, steering document alignmentopusagents/review-spec.md
Bug: bug/logic error detectionHIGH SIGNAL bugs, logic errors, security issuesopusagents/review-bug.md (×2 parallel)

10.2. Parallel Execution Steps

  1. Save PR diff to file:

    • mkdir -p .tmp
    • Write gh pr diff "$NUMBER" result to .tmp/pr-diff-$NUMBER.txt
    • Write gh pr view "$NUMBER" --json files result to .tmp/pr-files-$NUMBER.json
  2. Get Spec path:

    • If Issue number extracted: Glob for $SPEC_PATH/issue-$ISSUE_NUMBER-*.md
    • Record path if found; empty string if not

2.5. Get steering doc paths:

  • Glob for $STEERING_DOCS_PATH/product.md, $STEERING_DOCS_PATH/tech.md, $STEERING_DOCS_PATH/structure.md
  • Record comma-separated as STEERING_DOCS_FILES (empty string if none exist)

2.6. Transcription divergence check (skill-dev repositories only): If scripts/validate-skill-syntax.py exists, read ${CLAUDE_PLUGIN_ROOT}/skills/review/skill-dev-recheck.md and follow the "Transcription Divergence Check" section. Record any findings for inclusion in the review results.

  1. Launch agents in parallel:

    • SKIP_REVIEW_BUG=true: launch review-spec only (skip review-bug)
    • SKIP_REVIEW_BUG=false: launch review-spec + review-bug×2 in parallel
      • review-bug agent 1 (diff bug scan): focus on diff and detect clear bugs
      • review-bug agent 2 (security scan): detect security issues and invalid logic in changed code

    Launch these subagents in a single message to ensure parallel fan-out (single-message fan-out prevents serialization regardless of model generation):

    If .tmp/base-conflict-context-$NUMBER.md exists (written by the Base Branch Conflict Pre-check above), append its content to each of the 3 prompts below, followed by: "For the files listed above, if the PR's current resolution loses either side's change, report it as MUST. Files flagged [SSoT] are referenced by multiple Skills — check them with priority."

    If .tmp/edge-case-context-$NUMBER.md exists (written by the Parser/Validator Edge Case Pre-check above), append its content to each of the 3 prompts below, followed by: "The above is a pre-measured edge case execution result for this diff's parser/validator/normalizer changes. Do not re-derive it — reflect it directly in Detected Issues (review-bug)."

    Task(
      subagent_type="wholework:review-spec",
      description="Spec review",
      prompt="Run review: PR=$NUMBER, Issue=$ISSUE_NUMBER, Type=$TYPE, Spec=$DESIGN_FILE_PATH, Steering Documents=$STEERING_DOCS_FILES, PR diff=.tmp/pr-diff-$NUMBER.txt, changed files=.tmp/pr-files-$NUMBER.json[, base branch conflict context: <contents of .tmp/base-conflict-context-$NUMBER.md, if present>][, edge case context: <contents of .tmp/edge-case-context-$NUMBER.md, if present>]"
    )
    
    Task(
      subagent_type="wholework:review-bug",
      description="Bug review (diff bug scan)",
      prompt="Run review: PR=$NUMBER, Type=$TYPE, PR diff=.tmp/pr-diff-$NUMBER.txt, changed files=.tmp/pr-files-$NUMBER.json. Focus on + lines in the diff; detect clear bugs and logic errors using HIGH SIGNAL principles.[ base branch conflict context: <contents of .tmp/base-conflict-context-$NUMBER.md, if present>][, edge case context: <contents of .tmp/edge-case-context-$NUMBER.md, if present>]"
    )
    
    Task(
      subagent_type="wholework:review-bug",
      description="Bug review (security scan)",
      prompt="Run review: PR=$NUMBER, Type=$TYPE, PR diff=.tmp/pr-diff-$NUMBER.txt, changed files=.tmp/pr-files-$NUMBER.json. Detect security issues and invalid logic in changed code using HIGH SIGNAL principles.[ base branch conflict context: <contents of .tmp/base-conflict-context-$NUMBER.md, if present>][, edge case context: <contents of .tmp/edge-case-context-$NUMBER.md, if present>]"
    )
    
  2. Integrate 2 groups' results and generate line comments JSON and Review body:

    • Collect outputs from each group (successful groups only)
    • Record failed groups as "review unavailable"
    • Extract path, line, body, severity from each issue:
      • Detect issue start with **[aspect name] filename:line-approx** line
      • Read values from subsequent - path: ... / - line: ... lines (raw values without backticks)
      • Determine severity from Issue. Severity: MUST / SHOULD / CONSIDER
      • Issues where path is not null → add to line comments array (with side: "RIGHT")
      • Issues where path is null → merge into "General Comments" section of Review body (MUST issues MUST be included in General Comments — even with path: null, MUST is the basis for event=REQUEST_CHANGES, so not including in Review body leaves it unclear what the problem is)
    • Inject Step 8/Step 9 blocking entries: for each Step 8 condition classified FAIL, and the Step 9 CI FAILURE summary (if any), add one severity: "MUST", path: null entry per the FAIL Blocking Behavior / Blocking by default rules. When Step 9's Pre-existing failure exception classified the Forbidden Expressions check FAILURE as non-blocking (PRE_EXISTING/FIXED/CLEAN), add the severity: "CONSIDER", path: null entry described in that section's Non-blocking outcome handling instead of a MUST entry.
    • mkdir -p .tmp
    • Write line comments array to .tmp/review-comments-$NUMBER.json (JSON array format)
    • Write Review body (acceptance criteria table + CI status + General Comments + issue count summary) to .tmp/review-body-$NUMBER.md
  3. Pass integrated results to Step 10.3:

    • Run 2-stage verification on issues collected from review-bug×2 via verification sub-agents (see 10.3)
    • review-spec results are passed directly to Step 10 (no verification needed)

10.3. Verification Sub-agents (2-stage Bug Issue Verification)

Run only when SKIP_REVIEW_BUG=false (skip if review-bug was skipped).

Launch verification sub-agents (Opus) in parallel for each issue collected from review-bug×2 to filter false positives. Issue limit: 10; excess issues are passed to Step 10 without verification.

Pre-measured edge case findings bypass verification: an issue whose title matches the **[Edge Case Execution] path:line** format (see Parser/Validator Edge Case Pre-check, step 3(6)) was already confirmed by actually executing the target code with real fixture inputs — it is not a speculative diff-reading finding. Do not send it through the verification sub-agent below; treat it as VERDICT: PASS directly and include it in Step 10's integrated results unchanged.

  1. Collect issues: list review-bug issues from 10.2 results, excluding any **[Edge Case Execution] ...** issues per the bypass rule above

  2. Launch verification sub-agents in parallel (one inline prompt per issue):

    Task(
      subagent_type="general-purpose",
      description="Bug issue verification #{n}",
      prompt="""Verify the following bug issue.
    

PR title: {PR_TITLE} PR body (author's intent): {PR_BODY} Issue: {full issue text including path/line/severity}

Verification criteria:

  • Is the problem actually confirmed in the diff's + lines?
  • Is it HIGH SIGNAL (compile error, clear logic error, quoted CLAUDE.md violation, security issue)?
  • Is it a misunderstanding of the author's intent?

Output your conclusion as "PASS (problem confirmed)" or "REJECT (false positive)" and explain in 1-2 sentences. Format: VERDICT: PASS|REJECT Reason: {explanation}""" )


3. **Process verification results**:
- `VERDICT: PASS` → include issue in Step 10 integrated results
- `VERDICT: REJECT` → filter out issue and record in rejection log; remove from `.tmp/review-comments-$NUMBER.json`

4. **Append rejection log to Review body** (if any issues were rejected):

```markdown
### Issues Rejected by Verification (false positive filtering results)

- Rejected: {issue summary} → Reason: {REJECT reason}
  1. Pass integrated results to Step 11: use .tmp/review-body-$NUMBER.md and .tmp/review-comments-$NUMBER.json in Step 11

Step 11: Post Review Results

Integrate Steps 7 (acceptance criteria verification), 8 (CI status), and 10 (parallel review) and post as a GitHub Pull Request Review.

Before posting, emit a progress line so the watchdog resets its silence counter:

echo "progress: Posting review results for PR #$NUMBER..."
  1. mkdir -p .tmp
  2. When Step 9 was run (both full and light mode): .tmp/review-body-$NUMBER.md already generated in Step 9 (no Write needed). When Step 9 was entirely skipped (only when Issue number was not extractable and Step 7 was also skipped): write Review body (acceptance criteria table + CI status) to .tmp/review-body-$NUMBER.md
  3. Post review to PR via script:

When Step 9 was run (with line comments):

${CLAUDE_PLUGIN_ROOT}/scripts/gh-pr-review.sh "$NUMBER" ".tmp/review-body-$NUMBER.md" ".tmp/review-comments-$NUMBER.json"

When Step 9 was skipped (no line comments):

${CLAUDE_PLUGIN_ROOT}/scripts/gh-pr-review.sh "$NUMBER" ".tmp/review-body-$NUMBER.md"
  • Script automatically posts with REQUEST_CHANGES event if MUST issues exist
  • Script automatically posts with COMMENT event if no MUST issues
rm -f .tmp/review-body-$NUMBER.md .tmp/review-comments-$NUMBER.json

If gh-pr-review.sh fails: output review content to terminal (fallback).

Review body output format:

## Acceptance Criteria Verification Results

| Condition | Result | Notes |
|-----------|--------|-------|
| Condition summary | PASS | — |
| Condition summary | FAIL | Missing content |
| Condition summary | UNCERTAIN | Why auto-determination failed |
| Condition summary | UNCERTAIN | Human-check against the preview URL is required (manual preview-tier AC) |
| Condition summary | POST-MERGE | Verify after merge |

## CI Status

| Job name | Status | Notes |
|---------|--------|-------|
| job-name | SUCCESS | — |
| job-name | FAILURE | Fix suggestion: {specific fix} |
| job-name | PENDING | CI running |

## Code Review

### General Comments (issues where path/line cannot be identified)

Issues at design or architecture level that cannot be attributed to a specific file/line.

**[aspect name] description**
Issue content. Severity: MUST / SHOULD / CONSIDER

Recommended fix:
(specific fix suggestion)

### Issue Count Summary

- Posted as line comments: {N} (MUST: {M}, SHOULD: {S}, CONSIDER: {C})
- General Comments (in body): {N}

---
Next: run `/merge $NUMBER`.

(When Step 9 was entirely skipped, replace Code Review section with:)

## Code Review

Step 9 skipped (Issue number not extractable, Step 7 also skipped).

(When MUST issues exist, change the footer to:)

---
MUST issues found. After fixing in Step 11 and posting response summary in Step 13, run `/merge $NUMBER`.

review-only mode: Branch after Step 10 completes

If REVIEW_ONLY=true, skip Steps 11/12/13/retrospective and output the following completion report. No status label transition (maintain phase/review).

## Review Complete (review-only mode)

- Acceptance criteria verification: {PASS} PASS / {FAIL} FAIL / {UNCERTAIN} UNCERTAIN / {SKIPPED} SKIPPED
- Code review issues: {MUST} MUST / {SHOULD} SHOULD / {CONSIDER} CONSIDER

Issue resolution was not performed.
Fixes should be handled by the user or Copilot.

Step 12: Issue Resolution and Fixes

With --review-only mode: skip Step 11 and output review-only completion report.

After posting Step 10 review results, if Claude review issues exist:

12.1. Issue Priority Assessment

Classify each issue:

  • MUST: must fix (spec divergence, security, bugs, unverified uncertainty, etc.)
  • SHOULD: strongly recommended fix (maintainability, consistency, robustness, etc.)
  • CONSIDER: items to consider (style, optimization, future extensibility, etc.)

12.2. Fix Work

Fix all MUST issues. Claude decides whether to fix SHOULD/CONSIDER issues. An entry whose body explicitly states it is out of scope for this PR (see Step 9's Pre-existing failure exception) is never fixed here — record it in 12.4's Skipped Issues instead, regardless of its severity.

  1. Task management with TaskCreate/TaskUpdate: create a task per issue to fix
  2. Edit files using Edit tool
  3. Stage with git add
  4. Record origin as PR inline comment: If the review finding that prompted this fix was not already posted as a PR inline comment by gh-pr-review.sh in Step 11 (e.g., an AI-judgment fix, verbal direction, or a finding not captured in Step 11 output), post the original finding now and record the URL:
    PR_COMMENT_URL=$(gh pr comment "$NUMBER" --body "Review: {summary of the original finding}" --json url -q .url)
    
    If Step 11 already posted this finding as an inline comment via gh-pr-review.sh, retrieve that comment's URL and use it as PR_COMMENT_URL (skip re-posting to avoid duplicates).
  5. Commit with Refs: link:
    git commit -s -m "Address review feedback: {fix summary}
    

Refs: $PR_COMMENT_URL

Co-Authored-By: Claude Sonnet 5 [email protected]"

6. **Push with git push**

### 12.3. Lightweight Re-check

If `scripts/validate-skill-syntax.py` exists, read `skills/review/skill-dev-recheck.md` and follow "Step 12.3: Re-run validate-skill-syntax".

After fixes, run a lightweight re-check focused on changed areas:
- Light re-check (not full Step 7+9 re-run) focused on changed areas
- Check for new issues
- Re-run tests/validation — if this re-check selects a full-suite run, the `## Non-Interactive Mode Behavior` section's foreground execution constraint applies here too (no `run_in_background: true`, explicit `timeout` inside the 600000 ms ceiling, and the parallel `bats --jobs ...` form for a whole bats suite); see `${CLAUDE_PLUGIN_ROOT}/modules/execution-context.md` § "Re-invocation Guarantee and Notification-Dependent Waiting"
- If new MUST issues found in re-check, return to Step 12.2
- **Retry limit**: 3 times total (initial review + 2 re-checks)

### 12.4. Record Fix Results

```markdown
## Claude Review Response

### Fixed Issues
- [aspect name] filename:line — issue summary → fix content

### Skipped Issues
- [aspect name] filename:line — issue summary (skip reason)

If no issues: skip Step 11 and proceed to Step 13.


Step 13: Acceptance Criteria Consistency Check

With --review-only mode: skip Step 12 and output review-only completion report.

After Step 11 issue resolution (including when Step 11 was skipped), check consistency between changes and acceptance criteria.

13.1. Policy Change Detection

Analyze the following implementation changes for policy changes:

  • All implementation changes made in Step 7 (Copilot review; including 7.2)
  • All implementation changes made in Step 12

Policy change detection patterns:

Detection patternExample
Design approach change due to security issue"run in safe mode" → "return UNCERTAIN"
Implementation approach change due to Copilot issueDirect API call → via wrapper
Scope reduction/expansionSplit part of feature into another Issue
Behavioral spec changeDefault value change, error handling policy change

Assess whether any changes contradict the acceptance criteria (verify command text or condition descriptions).

If no policy changes (or no implementation changes in Step 7/12): skip this step and proceed to Step 13.

13.2. Update Issue Body (only on policy change detection)

  1. gh issue view "$ISSUE_NUMBER" --json body -q .body to get current Issue body
  2. Identify acceptance conditions invalidated by policy changes
  3. Update condition text and <!-- verify: ... --> hints to reflect post-change content
  4. Write to .tmp/issue-body-$ISSUE_NUMBER.md
  5. ${CLAUDE_PLUGIN_ROOT}/scripts/gh-issue-edit.sh "$ISSUE_NUMBER" .tmp/issue-body-$ISSUE_NUMBER.md

13.3. Post Change Tracking Comment (only on policy change detection)

Format:

## Change Tracking (by /review)

### Change Reason
- Review issue ({Copilot/Claude}) led to {change summary}

### Updated Conditions
| Condition | Before | After |
|-----------|--------|-------|
| Condition summary | old text | new text |

### Updated Verify Commands
| Hint | Before | After |
|------|--------|-------|
| command name | old syntax | new syntax |

Post comment:

${CLAUDE_PLUGIN_ROOT}/scripts/gh-issue-comment.sh "$ISSUE_NUMBER" .tmp/issue-acceptance-update-$ISSUE_NUMBER.md
rm -f .tmp/issue-acceptance-update-$ISSUE_NUMBER.md

Step 14: Post Response Summary

With --review-only mode: skip Step 14 and output review-only completion report.

Compile Steps 7 (Copilot response) and 12 (Claude response) and post as a second PR comment.

14.1. Generate Summary Body

Refer to skills/review/external-review-phase.md's "Step 14: External Review Response Results Section" and include external review response results in the summary.

Template:

<!-- review-summary -->
## Review Response Summary

### Claude Review Response

| Aspect | Filename | Line | Issue | Response | Fix/Skip reason |
|--------|---------|------|-------|----------|----------------|
| Spec divergence | config.json | 10 | Out-of-scope config added | Resolved | Removed unnecessary config |
| Bug detection | utils.py | 88 | Missing boundary check | Resolved | Added range check |

### Lightweight Re-check Results

- Tests/validation: PASS (`validate-skill-syntax.py` included if the file exists per skill-dev-recheck.md)
- Fix diff check: PASS
- New issues: none

### Acceptance Criteria Updates (only if policy changes occurred)

(If Step 13 updated acceptance criteria, append:)
- Change reason: {review issue summary}
- Updated condition: {before} → {after}
- Issue comment: posted

The <!-- review-summary --> marker line must be included verbatim even when the heading is localized, and must be placed as the first line of the comment body (before the heading). reconcile-phase-state.sh detects review completion via this language-independent marker.

If no Claude response (Step 11 skipped): omit Claude section.

If Step 10 was entirely skipped: replace Claude review section with "Step 10 skipped (Issue number not extractable)". In light mode (REVIEW_DEPTH=light): include review-light agent results in the Claude review section showing all 4 aspects.

If no acceptance criteria updates (Step 12 skipped): omit that section.

14.2. Post PR Comment

MUST: Use gh pr comment to post the summary. Do NOT use gh api repos/.../pulls/.../reviews or gh pr review — the PR Review channel is a fallback-only scan path in reconcile-phase-state.sh; the primary detection relies on issue comments, and PR Review body scanning may fail silently if the API call fails.

mkdir -p .tmp
gh pr comment "$NUMBER" --body-file .tmp/review-summary-$NUMBER.md
rm -f .tmp/review-summary-$NUMBER.md .tmp/pr-diff-$NUMBER.txt .tmp/pr-files-$NUMBER.json .tmp/issue-body-$ISSUE_NUMBER.md .tmp/base-conflict-context-$NUMBER.md .tmp/edge-case-context-$NUMBER.md
rm -rf .tmp/edge-case-fixtures-$NUMBER/

On failure: output summary to terminal (fallback).


Retrospective

With --review-only mode: skip retrospective and output review-only completion report.

Reflect on the review phase; record improvement proposals in the Spec only. Issue proposals are aggregated in /verify.

Retrospective scope: this step (review) Sources: PR diff, Issue acceptance criteria, Spec

Retrospective aspects (examples):

AspectCheck
Spec vs. implementation divergence patternsAre there structural divergences between Spec and PR diff?
Recurring issuesAre there multiple issues of the same kind (room for workflow improvement)?
Acceptance criteria verification difficultyAre there many UNCERTAINs, missing or inaccurate verify commands?

Steps:

  1. Identify improvements from Steps 8 and 10 results
  2. Write review retrospective to Spec:
    • Append ## review retrospective section to the end of $SPEC_PATH/issue-$ISSUE_NUMBER-*.md using Edit tool (use CWD-relative path in worktree sessions — see modules/worktree-lifecycle.md § Notes for Edit/Write conventions)
    • Create subsections for each of the 3 aspects; write "Nothing to note" for aspects with nothing to record
  3. If scripts/check-forbidden-expressions.sh exists, Read ${CLAUDE_PLUGIN_ROOT}/skills/review/skill-dev-recheck.md and follow the "Retrospective Guard" section.
  4. Phase Handoff write (before commit): Read ${CLAUDE_PLUGIN_ROOT}/modules/phase-handoff.md and follow the "Write Procedure" section. Parameters: SPEC_PATH, ISSUE_NUMBER=$ISSUE_NUMBER, PHASE_NAME=review. Include the handoff write in the same git add and commit as the retrospective.
  5. Phase Handoff dedupe fallback (deterministic rotation safety net, see modules/phase-handoff.md § "Deterministic rotation fallback"): run
    bash ${CLAUDE_PLUGIN_ROOT}/scripts/dedupe-phase-handoff-section.sh $ISSUE_NUMBER
    
    Any rewrite this makes is unstaged at this point and gets picked up by the git add in the next item's commit.
  6. Commit and push:
    git add $SPEC_PATH/issue-$ISSUE_NUMBER-*.md
    git commit -s -m "Add review retrospective for issue #$ISSUE_NUMBER
    

Co-Authored-By: Claude Sonnet 5 [email protected]" bash git log -1 --format='%B' | grep -q "^Signed-off-by:" || { echo "ERROR: missing sign-off"; exit 1; } bash git push origin HEAD ``` 7. If improvement proposals exist: record in review retrospective only (do not create issues; proposals are aggregated in /verify)

Worktree Exit (push-and-remove)

Read ${CLAUDE_PLUGIN_ROOT}/modules/worktree-lifecycle.md and follow the "Exit: push-and-remove" section.

Since the retrospective push (git push origin HEAD) is complete, call ExitWorktree("remove", discard_changes: true) to delete the worktree and return to the original directory.

Opportunistic Verification

Precondition (run first, before anything below in this section):

This section — including the Event-based observation scan below, which runs regardless of the opportunistic-verify setting — dispatches nested Skill(skill="wholework:verify", ...) calls in the same session and CWD. That dispatch is only safe once the preceding ## Worktree Exit (push-and-remove) section has completed (Issue #930 / #1000); otherwise /verify inherits this session's still-active worktree.

${CLAUDE_PLUGIN_ROOT}/scripts/detect-foreign-worktree.sh "review/pr-$NUMBER"

($NUMBER here is /review's PR number, matching the review/pr-$NUMBER convention from Step 2.)

Worktree context branches (exhaustive):

  • none: Worktree Exit already completed (or ENTERED_WORKTREE=false — no worktree was ever created). Continue with this section.
  • own: the ## Worktree Exit (push-and-remove) section above has not run, or did not complete, and this session is still inside review/pr-$NUMBER. Go back and complete that section, then re-run this assertion. Do not dispatch nested /verify until this reports none.
  • foreign <path>: CWD is inside a different skill's worktree. Call ExitWorktree(action: "keep"), then cd <path> to return to the main repository root, then re-run this assertion. If it still does not report none, skip this entire section (both opportunistic verification and the Event-based observation scan) and output Warning: skipping Opportunistic Verification — could not return to the main repository root from <path>.

If opportunistic-verify: true is set in .wholework.yml, read ${CLAUDE_PLUGIN_ROOT}/modules/opportunistic-verify.md and follow "Processing Steps". Skill name: /review. Skip if not set.

Event-based observation scan (runs regardless of opportunistic-verify setting):

After the opportunistic verification above (or in its place if opportunistic-verify is not set), fire the observation trigger:

  • Resolve the Spec file path: if $ISSUE_NUMBER is non-empty, Glob for $SPEC_PATH/issue-$ISSUE_NUMBER-*.md and record the matched path as DESIGN_FILE_PATH (empty string if no match, or if $ISSUE_NUMBER is empty). Same pattern as Step 10.0/10.2.
  • Resolve EXECUTION_CONTEXT: per ${CLAUDE_PLUGIN_ROOT}/modules/execution-context.md § Context Detection, if ARGUMENTS contains --non-interactive set EXECUTION_CONTEXT=fork; otherwise set EXECUTION_CONTEXT=main.
  • If REVIEW_DEPTH=full: run ${CLAUDE_PLUGIN_ROOT}/scripts/observation-trigger.sh --event pr-review-full --context-file "$DESIGN_FILE_PATH" --execution-context "$EXECUTION_CONTEXT"
  • If REVIEW_DEPTH=light: run ${CLAUDE_PLUGIN_ROOT}/scripts/observation-trigger.sh --event pr-review-light --context-file "$DESIGN_FILE_PATH" --execution-context "$EXECUTION_CONTEXT"

Capture the command's stdout as OBSERVATION_MATCHES (newline-separated Issue numbers; may be empty). If non-empty, read ${CLAUDE_PLUGIN_ROOT}/modules/detect-config-markers.md and follow the "Processing Steps" section to load AUTONOMY_TIER, then apply tier-aware dispatch:

  • L1: skip dispatch (advisory-only — the comment already posted by observation-trigger.sh is the only action)
  • L2 / L3: for each number in OBSERVATION_MATCHES other than $ISSUE_NUMBER (the Issue this review just processed), dispatch Skill(skill="wholework:verify", args="$N") sequentially

Completion Report

Completion report (always use this format):

After posting the Step 14 summary, output a review response summary to the terminal in the following format (do not abbreviate or modify):

## Review Complete

- Copilot review response: {response count} resolved, {skip count} skipped
- Claude review response: {response count} resolved, {skip count} skipped
- Lightweight re-check: {result}

If Copilot/Claude response was skipped (including Step 7 skip due to settings): omit the corresponding line.

When Step 10 was entirely skipped: replace "Claude review response" line with "Step 10: skipped (Issue number not extractable)".

In light mode (REVIEW_DEPTH=light): replace "Claude review response" line with "Step 10 (lightweight integrated review): review-light agent ran all 4 aspects".

Then read ${CLAUDE_PLUGIN_ROOT}/modules/next-action-guide.md and follow the "Processing Steps" section with:

  • SKILL_NAME=review
  • PR_NUMBER=$NUMBER
  • ISSUE_NUMBER=$ISSUE_NUMBER
  • RESULT=success

Then read ${CLAUDE_PLUGIN_ROOT}/modules/steering-hint.md and follow the "Processing Steps" section.


Review Aspects

Documentation consistency check (review-spec aspect 2, review-light aspect 4) verifies:

  • No missing updates in README/CLAUDE.md/workflow.md etc.
  • Paths and command examples match implementation
  • When adding/modifying documentation, body descriptions and tables/lists are consistent
  • When top-level docs/*.md files are changed, if docs/translation-workflow.md exists, read it and follow the sync procedure

For Python script changes, additionally verify:

  • Newly added/moved function calls are inside try-except blocks (leaking outside try-except means exceptions propagate without being silenced, but can represent unintended exception boundary changes)
  • When existing try-except boundaries are changed, verify the caught exceptions haven't changed

Enum exhaustiveness check (review-spec Perspective 1, Step 2.5): When the Spec defines an enum — a discrete named value set (e.g., auto-stop-at: spec|code|review|merge|verify, option lists in table cells, or "one of X/Y/Z" descriptions) — verify that every enum value has a corresponding implementation in the PR diff (case branch, if-elif chain, dictionary entry, mapping table entry, etc.). Missing enum value coverage is reported as a MUST finding. This check catches implementation gaps that are otherwise invisible to AC verification (the AC only tests the values that exist, not the values that are absent).


Notes

  • /review posts review results (Step 11), then resolves issues (Step 12), then posts response summary (Step 14)
  • Copilot review (Step 7) and Claude review (Step 10) are complementary: Copilot handles local code quality checks (auto-fix level), Claude handles project context and acceptance criteria alignment (design review level)
  • Always wrap variables ($NUMBER, $ISSUE_NUMBER, etc.) in double quotes
  • Always use the Write tool for temp files. Shell redirects trigger confirmation prompts
  • MUST issues must always be fixed in Step 12. After fixing, proceed with /merge (do not re-run /review)
  • All review-based fixes — MUST/SHOULD/CONSIDER, AI-judgment, manual, or human-directed — must record the original review finding as a PR inline comment before committing. The fix commit must include Refs: <PR inline comment URL> in its message to ensure traceability from Code Retrospective. This rule applies both to fixes made inside Step 12 and to any additional fix commits added after /review completes.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.