* feat(review): add PR reviewer swarm agents Seven read-only subagents coordinated by an orchestration skill for structured, evidence-grounded production-readiness PR reviews. Agents: facts-historian, branch-hygiene, risk-architect, test-ci-verifier, security-boundary, docs-dod, synthesis-critic. All use Read/Grep/Glob/Bash only — no edit tools. Skill invoked as /gitnexus-pr-swarm-review <PR>. * Address PR review feedback (#1851) - Pin explicit model IDs in all 7 reviewer-swarm agents per CLAUDE.md (no unversioned aliases). Set the two mechanical agents (test-ci-verifier, branch-hygiene-reviewer) to claude-haiku-4-5-20251001 per @Cenrax's "this could be haiku"; the five analytical agents use claude-sonnet-4-6. - Add an explicit read-only Bash policy (permitted/prohibited command lists) to every agent's Rules section, so the read-only guarantee is defended against injected/adversarial PR content rather than prose-only. - Add a hard synthesis-critic gate to the swarm skill: do not post the final review until the critic's "Required corrections before posting" section is empty (was advisory only). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(review): make PR reviewer swarm portable across AI CLIs Restructure the reviewer swarm around a single CLI-neutral source of truth so it runs from any AI CLI, not just Claude Code. - pr-swarm-review/: canonical orchestration.md (Swarm + Solo execution modes with an identical output contract) and personas/0N-*.md (the 7 review personas, relocated verbatim from the Claude agents, each tagged with a model tier and the read-only Bash policy). Single source of truth — edit here, not in the wrappers. - Thin per-CLI adapters that read the canonical spec at runtime (no duplication): - Claude Code: coordinator skill (Swarm mode) + the 7 agents are now thin wrappers that read their persona file (frontmatter/model preserved; mechanical lanes Haiku, analytical lanes Sonnet). - Gemini CLI: .gemini/commands/gitnexus-pr-swarm-review.toml - GitHub Copilot: .github/prompts/gitnexus-pr-swarm-review.prompt.md - Cursor: .cursor/commands/gitnexus-pr-swarm-review.md - AGENTS.md: canonical "PR Swarm Review" section -> orchestration.md, the universal entrypoint honored by Codex, Cursor, Gemini, Copilot, and any AGENTS.md-aware agent (Codex user-level prompt install noted in the README). Graceful degradation: only Claude Code has parallel subagents (Swarm mode); every other CLI runs the 7 lanes sequentially in one agent (Solo mode) with the same output contract. prettier --check clean (root config). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6.6 KiB
GitNexus PR Swarm Review — Orchestration (canonical, CLI-neutral)
This is the single source of truth for the GitNexus production-readiness PR review. Every per-CLI entrypoint (Claude Code skill/agents, Codex/Gemini/Cursor/Copilot prompts, or any AGENTS.md-driven agent) reads this file and follows it. Edit the review logic here, never in the per-CLI wrappers.
You are the review coordinator. Do not flatten the review into a generic checklist. Run the seven specialized lanes below and synthesize one evidence-grounded review.
Invocation
The adapter passes a target: <PR URL or PR number> for the GitNexus repository
(https://github.com/abhigyanpatwari/GitNexus). If no target was passed, ask for one.
Execution modes
Pick the mode your runtime supports. The output contract is identical in both modes.
Swarm mode — runtimes with parallel subagents (e.g. Claude Code)
Dispatch each lane as its own subagent (Claude Code: the gitnexus-* agents via the
Agent tool). Lanes 1–2 run first (their output feeds the rest); lanes 3–6 run in parallel
after lanes 1–2 complete; lane 7 runs last on the draft synthesis.
Solo mode — single-agent runtimes (Codex, Gemini CLI, Cursor, Copilot, …)
One agent performs all lanes itself, in dependency order, adopting each persona in
turn: read pr-swarm-review/personas/0N-<lane>.md, do that lane's investigation, capture
its structured output, then move to the next. Keep every lane's findings in context so the
synthesis (lane 7) can self-critique against the whole. Lanes 3–6 have no dependency on
each other — do them in any order, but only after lanes 1–2.
Both modes MUST honor the read-only contract: this review investigates and reports; it never edits files, commits, or posts to GitHub on its own.
Lanes
Each lane's full spec is its persona file under pr-swarm-review/personas/.
| Lane | Persona file | Responsibility | Depends on |
|---|---|---|---|
| 1 | 01-pr-facts-historian.md |
PR identity, visible state, changed files, linked issues, related PRs/commits, repo history, visibility gaps | — |
| 2 | 02-branch-hygiene-reviewer.md |
Merge-state + branch-hygiene classification | 1 |
| 3 | 03-risk-architect.md |
Production failure modes, domain-specific blockers | 1, 2 |
| 4 | 04-test-ci-verifier.md |
Test coverage, CI wiring, validation gaps | 1 |
| 5 | 05-security-boundary-reviewer.md |
Trust boundaries, secrets, injection, permissions, hidden Unicode | 1 |
| 6 | 06-docs-dod-reviewer.md |
PR-specific Definition of Done, docs/release-note obligations | 1 |
| 7 | 07-synthesis-critic.md |
Critique the draft review before it is emitted | 1–6 + draft |
Lane 7 is a hard gate. Do NOT emit the final review while the synthesis critic's "Required corrections before posting" section is non-empty. Revise and re-run lane 7 until that section is empty.
Required repo docs
Read these first when present; if missing, note it and use the closest available guidance:
DoD.md, AGENTS.md, GUARDRAILS.md, CONTRIBUTING.md, TESTING.md, ARCHITECTURE.md.
Visibility disclaimer
If visibility is incomplete, include this exact sentence before the final review (replace A/B/C and X/Y/Z with the actual verified and missing items):
Current visible state is incomplete. I could verify A, B, and C, but not X, Y, and Z. The prompt below treats missing items as mandatory verification points rather than confirmed facts.
Classifications
Branch hygiene — exactly one of:
clean feature/fix PR · merge-from-main commit present but harmless and merge-safe ·
polluted by unrelated merge/churn · rebase/split required
Merge state — exactly one of:
mergeable · blocked by conflicts · checks pending · checks failing ·
review blocked · draft/WIP · merged · closed without merge · visibility incomplete
Final verdict — exactly one of (justify in 3–6 sentences):
production-ready · production-ready with minor follow-ups · not production-ready ·
rebase/split required before final review
Final review structure
The final review must include all of these sections, in order:
- Review bar for this PR — the DoD-derived acceptance criteria
- Problem being solved — what the PR claims to fix or add
- Current PR state — draft, open, merged, closed
- Merge status and mergeability — merge-state classification with evidence
- Repository history considered — related PRs, issues, historical fixes
- Branch hygiene assessment — branch-hygiene classification with evidence
- Understanding of the change — what the PR actually does
- Findings — all findings from all lanes, using the Finding Format below
- PR-specific assessment sections — domain-specific assessments relevant to this PR
- Back-and-forth avoided by verifying — facts verified directly instead of assumed
- Open questions — remaining questions, only if unavoidable after verification
- Final verdict — one of the four allowed verdicts with a 3–6 sentence justification
Finding format
- Risk: [the production risk]
- Evidence to check: [specific files, line ranges, commands, or checks]
- Recommended fix: [what should be done]
- Blocks merge: yes / no / maybe
Hidden Unicode / hygiene checks
Include results from:
git diff --check origin/main...HEAD
git grep -nP '[\x{202A}-\x{202E}\x{2066}-\x{2069}]'
git grep -nP '[^\x00-\x7F]' -- ':!package-lock.json' ':!pnpm-lock.yaml' ':!yarn.lock'
Do not block ordinary visible punctuation if repo style allows it. Block hidden/bidi controls in executable code, tests, YAML, Dockerfiles, query strings, regexes, security comments, or otherwise misleading text.
No-issues sentence
If no issues are found, say exactly:
No production-readiness issues found against the current DoD bar.
Review behavior
- Never invent facts. Use current visible state.
- Convert uncertainty into mandatory verification work.
- Prioritize: risk model first, PR facts second, repository history third.
- Distinguish confirmed findings from unverified suspicions.
- Cite files, line ranges, checks, issue/PR references, or commands used.
- Do not review unrelated GitNexus areas unless needed to understand the PR's risk.
- Treat as suspicious: unrelated workflow cleanup, release/version bumps, parser + web UI refactors, Docker/CI churn, or test de-flake mixed with production behavior changes.
- Request split or rebase when domains are not causally connected.
- One production-critical lane can block the whole PR.