pr-sweep · git:20261024.50c112d · 2026-10-24 · sha256 32c515a6400065c2
pr-sweep git:20261024.50c112dA
Immutable. This exact content never changes and is served at /api/v1/blob/32c515a6400065c2.
No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_5f56ou73uyjonc6q/32c515a6400065c2b22e17c359f8e5fd559d8e0037d9cbe06f2027f874fa8c90.json
Then /plugin install pr-sweep@markdownregistry-5f56ou73uyjonc6q in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.
--- name: pr-sweep description: Review every open PR with the code-reviewer agent and an adversarial review, apply the findings, and merge each one once CI is green. Use when asked to ship, sweep, or merge open PRs. argument-hint: "[PR-number ...] [--no-merge]" disable-model-invocation: false --- # PR sweep Review and finish the requested PRs, or all eligible open PRs when none are specified. A user request to sweep or merge authorizes merging within that scope. With `--no-merge`, apply fixes and stop at reviewable green PRs. For a review-only request, report findings without changing or merging the branch unless the user also asked for fixes. ## List and isolate Confirm the repository and current user. List open PRs with number, title, author, draft state, head branch and SHA, and base branch. Paginate until complete. For a sweep, skip drafts and PRs by other authors and report them. An explicitly requested review of one of those PRs may proceed; do not mark a contributor draft ready or merge it. Fetch the base and PR heads. Stop if local `main` has unpublished commits. Preserve a dirty starting checkout and perform each PR's work in a dedicated worktree. Record its absolute path and branch; reuse an existing task worktree only after checking its head and local changes. Do not discard unpublished work or force a branch held by another worktree. Stop the affected PR if its task worktree is unsafe and continue independent PRs. Run Git commands in the task worktree; a tool wrapper problem does not justify switching the starting checkout. ## Review Read the PR description, comments, review threads, and whole diff against its declared base. Run two independent passes on the current PR diff: - Use the available `code-reviewer` role for Go changes, or a reviewer against project rules for other changes. Respect the role's configured model; concrete model choices belong in agent metadata. - Use the available adversarial review role or command to challenge the design, assumptions, and real usage failures. If either role is unavailable, use an available reviewer with the corresponding brief. If delegation is unavailable, perform two separate passes with those briefs. Read both results before editing. For an authorized fix, repeat the adversarial pass on changed code until remaining findings are resolved or explicitly rejected with evidence. Reuse a pass only when its reviewed inputs are unchanged. If a pass cannot settle a finding without a new design decision or unavailable evidence, report the blocker. ## Verify and apply A finding is a claim. Reopen its cited file on the current PR head, reproduce behavior claims with a failing test or current binary, and verify vendor claims against current vendor documentation. Record unsupported claims and why they were rejected; report unresolved claims as blockers. For review-only work, post actionable findings as PR review comments, following the project's attribution rule, then report their links and stop. Otherwise fix confirmed findings within scope. Use a test that fails before the fix for behavior changes; use existing focused checks for prose or data. Findings needing another design or changes to unrelated targets get a follow-up issue assigned to Chemaclass with the appropriate label. Answer rejected findings with their evidence. After fixes, post one PR comment with applied commit IDs, follow-up issues, and rejection reasons. Follow the project's comment attribution rule. ## Gate Before pushing, select and pass checks from repository-root `docs/internal/contributing.md`, section "Choose checks for your change". That policy owns generation, validation selection, serial execution, evidence, and reuse after fixes or merges. Check each command's own exit code. Commit with signed Conventional Commits and push without rewriting published history. Before merging, confirm required CI and applicable remote OS checks passed on the actual current head SHA. Missing, pending, stale, or skipped required checks are not green. ## Merge and clean up Process oldest first, prioritizing shared-file changes when that reduces conflicts. 1. Refresh the PR head, checks, review requirements, and merge state. Confirm the reviewed and tested SHA is still current. 2. Update from the PR's freshly fetched base branch only when the branch is actually behind a required current base or has merge conflicts. Merge the base into the task branch without rewriting published history, preserve both sides of shared docs, inspect the resulting diff, rerun affected validation, push, and review the new head as needed. A non-clean status alone does not require a base merge: `BLOCKED` can mean pending checks or reviews, and unknown/calculating states need a refresh. 3. Within merge authority, use `gh pr merge <N> --squash --admin --delete-branch --match-head-commit <SHA>`. If administrative merging is rejected, use the same SHA guard with `--auto --squash --delete-branch` and report that merging is queued. A queued request is not a verified merge. 4. Confirm the PR is merged and its merge commit is on the fetched base branch. For a merge to `main`, verify the `CI` workflow for the resulting main head passed. Resolve a red main before continuing merges. 5. Fast-forward local `main` only if its checkout is clean and it has no unpublished commits. Otherwise preserve it and report why it was not advanced. Remove the task worktree and local branch only after verifying the merge and confirming they contain no uncommitted or unpublished work and have no open PR. Delete the remote branch if merge cleanup did not. Run `git fetch --prune` and `git worktree prune`; after removing worktrees, run `~/.agnostic-ai/scripts/reap-stale-agents.sh` if it exists. ## Report blockers and outcomes Report one table with PR, merge commit or current state, applied findings, follow-up issues, and rejected findings. Include retained task paths and next steps for blocked PRs. Stop work on a PR when a finding remains unverifiable, CI stays red after one fix, or merging remains blocked even with auto-merge. Continue independent PRs when safe.