/agentloop:pr-sweepfrom agentloop
Batch-reviews all open PRs to a terminal state: runs pr-review per PR, dedup-closes same-issue twins, auto-merges reviewed non-breaking PRs whose package tests pass. Flags: --merge, --dry-run. Built for scheduled runs.
Ships in agentloop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Read .claude/repo-profile.md first (repo_slug, default_branch, plugin_root,
agent_identity_script, comment_language, pr_sweep_freeze_ttl_days,
pr_sweep_stale_escalation_days). A batch driver over pr-review;
the PR-world twin of issue-sweep. Humans decide only security,
breaking changes and direction.
/agentloop:pr-sweep # review + comment + dedup-close (no merge)
/agentloop:pr-sweep --merge # … + merge PRs that pass Step 5
/agentloop:pr-sweep --dry-run # report WOULD-DO only (README "Dry-run contract")
/agentloop:pr-sweep <pr#…> # only these PRs
Plain commands, one at a time (no shell loops / $(…): the sandbox guard refuses them). Never
git checkout <default_branch> (a worktree may hold it).
git fetch origin <default_branch>
git reset --hard origin/<default_branch> && git clean -fd
gh pr list --state open --limit 100 \
--json number,title,author,headRefName,headRefOid,mergeable,files,labels,body,updatedAt,isDraft
In this order, from this one call:
epic-managed PRs (epic-conductor owns them).awaiting-* PR whose updatedAt is older than pr_sweep_freeze_ttl_days (14) gets
no API call; older than pr_sweep_stale_escalation_days (30) is named in the run summary only.agent:hold never merges, closes or loses the label; new human input is still answered.A PR needs review when: no pr-review comment yet; its head sha differs from the HEAD <sha>
of the last <!-- pr-review-verdict --> comment; a human commented (conversation, inline, or review) after the last
agent comment; a bot left new inline findings; it went Draft → Ready; a writer's non-bot comment
(agent too) is at or after the latest canonical MERGE of any relied-on lens at the head (per
lens). An agent comment has
a Bot author or the identity header of skill:pr-review / skill:pr-sweep. Nothing new → zero
actions. Nothing actionable at all → exit early.
Disposition labels (controlled set): pr-sweep:needs-fix (the sweep fixes it; after 3 of its own
fix pushes still red → awaiting-direction with a per-round summary) · pr-sweep:awaiting-glance
(verified, a human confirms) · pr-sweep:awaiting-direction (an R2 call; a technical A/B goes to the review jury) ·
pr-sweep:awaiting-judgment (a concrete uncertain risk) · pr-sweep:awaiting-caution (security /
breaking / irreversible) · pr-sweep:blocked-deps. A human change request is not an approval:
implement it, post evidence, set awaiting-glance, wait for explicit approval words.
Same issue: issue number from the branch (…-<N>-…, issue-<N>) or Fixes|Part of #N in the
body; ≥2 open PRs on one <N> = a duplicate cluster. Same file: a file → PRs map; release-bot
PRs (every package.json + CHANGELOG.md) are their own cluster, not conflicts. Hand each PR its
peers.
Each actionable PR goes to pr-review in a clean context with its peer
list (--post unless --dry-run). pr-review runs the changed package's tests on the PR head. One
pr-review comment per head, always new, never edited; never re-post an unchanged conclusion, except
a stale MERGE: review the newer comment; if it still holds, re-post the MERGE of each stale lens.
For a same-issue cluster: pick the keeper (more complete > more correct against the authoritative
source > tested > newer base > first). A second, independent fresh-context agent picks too and
returns {keep, reason}; they disagree → close nothing, the review jury picks. Contradicting
claims → check the authoritative source first. Close each twin with an identity-headed comment
naming the keeper (gh pr close <twin> --comment "superseded by #<keeper>") and note the closed
twins on the keeper before the keeper's verdict (else re-post it). Any PR with agent:hold takes no part. Unsure → keep both, COMMENT.
--merge only)All of these, re-checked right before each merge:
MERGE or a non-blocking COMMENT, its test run
of the changed package passed, and no P0–P2 finding (review, bot or human) is open;CHANGES_REQUESTED that their own APPROVED has not superseded;needs-human-confirm with an R2: line.
merge-verified-pr.sh runs the factory merge check (refuses an unapproved or path-noncompliant
factory PR). The sweep never passes --not-factory, so on a runner with no factory daemon every
merge refuses there: the sweep reports
"needs a runner with the factory" in its run summary (no PR comment) and leaves the PR unmerged;agent:hold, no epic-managed, mergeable == MERGEABLE (rebase only on CONFLICTING), no
unresolved same-issue or same-file conflict;awaiting-caution / awaiting-direction with pr-review's
human-confirm block, the source issue's author and assignees requested as reviewers. Before
choosing 🔴 ask whether a safe default exists; if so, take it.bash "<plugin_root>/scripts/merge-verified-pr.sh" <n> --method squash
Small fixes are made on the PR branch by the sweep itself (then its tests again), never handed to a human. A red is root-caused, never re-run until green.
~10–14 reviews a round; GitHub content creation ≤500/h, ≤80/min; on a secondary rate limit back
off (≤3 tries), then mark RATE-LIMITED and leave it to the next run. Labels plus the verdict rules
make a rerun safe. Duplicate PRs are prevented at the source by issue-sweep's deterministic
branch claude/issue-<N> and its claim check; a cluster from another branch name is
noted in the summary.
Per PR: verdict, disposition, merged / closed / escalated, test command + counts. Then the frozen and stale-escalation lists.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
pr-review, batch-review, auto-merge, pr-management, github-actions
npx claudepluginhub arcblock/agent-skills --plugin agentloopOther plugins' skills for the same job
24 skills in this plugin
/build-phasesExecute a phased implementation plan (tasks.md) autonomously, one phase at a time: implement, then verify (static + dynamic + adversarial) before advancing. Use for a multi-phase build of one issue, attended or unattended./codex-review-backlogScan merged (optionally open) PRs for unhandled Codex / bot review comments, re-validate each against main, fix the easy ones, track the hard ones. Use for "codex backlog", "scan Codex reviews", late bot findings after a merge wave, or a daily routine./design-reviewIterative clean-context review of a design / plan document or issue: independent reviewers per round, scored and synthesized without prior-round bias. Use to review an implementation plan, architecture doc or design proposal before building.