Skip to main content

Pr Sweep

@maphew/pr-sweepv2026.11.23.2· MIT· 8d agoBEHAVIORSACCEPTED WARNINGS
01README

Sweep open pull requests a fork contributes to an upstream GitHub repo. Composable steps — list, review (one agent per batch), sync, verdicts, summary — so an orchestrator (Ceph, a foreman agent, a workflow, or you) plans the work and delegates it, while sweep remains as the one-call convenience. Queryable per-PR and run-summary resources; the sweeper prompt ships as a bundled asset.

02Release Notes

review: detach PR checkouts so concurrent worktree sweeps cannot collide; clean up a worktree left by a failed mint

03Behaviors1
@maphew/pr-sweepv2026.11.08.1src/pr_sweep.ts
fn list(workdir?: string, upstreamRepo?: string, forkRepo?: string, agent?: enum, model?: string, mainBranch?: string, swampRepoDir?: string, sweeperPrompt?: string, updateStrategy?: enum, batchSize?: number)
List open PRs the fork contributes to the upstream repo, write them as the sweep queue (`open-prs-current` plus one `pr` record each), and report how they group into review batches. The first step an orchestrator runs.
ArgumentTypeDescription
workdir?stringLocal checkout directory for the upstream repo. Omit to resolve it from pr-sweep-config's registered pairs.
upstreamRepo?stringUpstream GitHub repo as owner/name. Omit to use the newest open-prs-current.
forkRepo?stringFork GitHub repo as owner/name. Omit to use the newest open-prs-current.
agent?enumHeadless agent for review batches
model?stringModel for the agent in provider/model form; empty uses the agent's default or the registered repo pair's model
mainBranch?stringBase branch to rebase and merge into
swampRepoDir?stringPath to the swamp repo that owns this workflow; only for the legacy prompt override.
sweeperPrompt?stringAbsolute path to a custom sweeper prompt file.
updateStrategy?enumHow to update a behind branch: merge the base in (no force-push) or rebase onto it (force-push)
batchSize?numberlist only: group PRs into review batches of at most this many (0 = one batch, the whole list) and report the grouping for the orchestrator
fn review(workdir?: string, upstreamRepo?: string, forkRepo?: string, agent?: enum, model?: string, mainBranch?: string, swampRepoDir?: string, sweeperPrompt?: string, updateStrategy?: enum, batchSize?: number)
Run one headless agent over a batch of PRs from the queue with the bundled sweeper prompt, then record each PR's verdict, post-run state, and branch-sync outcome on its `pr` record. Small batches only — the orchestrator decides grouping; pass `numbers` for one batch.
ArgumentTypeDescription
workdir?stringLocal checkout directory for the upstream repo. Omit to resolve it from pr-sweep-config's registered pairs.
upstreamRepo?stringUpstream GitHub repo as owner/name. Omit to use the newest open-prs-current.
forkRepo?stringFork GitHub repo as owner/name. Omit to use the newest open-prs-current.
agent?enumHeadless agent for review batches
model?stringModel for the agent in provider/model form; empty uses the agent's default or the registered repo pair's model
mainBranch?stringBase branch to rebase and merge into
swampRepoDir?stringPath to the swamp repo that owns this workflow; only for the legacy prompt override.
sweeperPrompt?stringAbsolute path to a custom sweeper prompt file.
updateStrategy?enumHow to update a behind branch: merge the base in (no force-push) or rebase onto it (force-push)
batchSize?numberlist only: group PRs into review batches of at most this many (0 = one batch, the whole list) and report the grouping for the orchestrator
fn sync(workdir?: string, upstreamRepo?: string, forkRepo?: string, agent?: enum, model?: string, mainBranch?: string, swampRepoDir?: string, sweeperPrompt?: string, updateStrategy?: enum, batchSize?: number)
Deterministic branch-sync pass with bounded verify/top-up for the queue (or `numbers`): re-fetch the base and bring behind PR branches up to date. No agent runs.
ArgumentTypeDescription
workdir?stringLocal checkout directory for the upstream repo. Omit to resolve it from pr-sweep-config's registered pairs.
upstreamRepo?stringUpstream GitHub repo as owner/name. Omit to use the newest open-prs-current.
forkRepo?stringFork GitHub repo as owner/name. Omit to use the newest open-prs-current.
agent?enumHeadless agent for review batches
model?stringModel for the agent in provider/model form; empty uses the agent's default or the registered repo pair's model
mainBranch?stringBase branch to rebase and merge into
swampRepoDir?stringPath to the swamp repo that owns this workflow; only for the legacy prompt override.
sweeperPrompt?stringAbsolute path to a custom sweeper prompt file.
updateStrategy?enumHow to update a behind branch: merge the base in (no force-push) or rebase onto it (force-push)
batchSize?numberlist only: group PRs into review batches of at most this many (0 = one batch, the whole list) and report the grouping for the orchestrator
fn verdicts(workdir?: string, upstreamRepo?: string, forkRepo?: string, agent?: enum, model?: string, mainBranch?: string, swampRepoDir?: string, sweeperPrompt?: string, updateStrategy?: enum, batchSize?: number)
Read back the recorded per-PR results for the current queue as data (logs the payload so a harness can see it). Read-only.
ArgumentTypeDescription
workdir?stringLocal checkout directory for the upstream repo. Omit to resolve it from pr-sweep-config's registered pairs.
upstreamRepo?stringUpstream GitHub repo as owner/name. Omit to use the newest open-prs-current.
forkRepo?stringFork GitHub repo as owner/name. Omit to use the newest open-prs-current.
agent?enumHeadless agent for review batches
model?stringModel for the agent in provider/model form; empty uses the agent's default or the registered repo pair's model
mainBranch?stringBase branch to rebase and merge into
swampRepoDir?stringPath to the swamp repo that owns this workflow; only for the legacy prompt override.
sweeperPrompt?stringAbsolute path to a custom sweeper prompt file.
updateStrategy?enumHow to update a behind branch: merge the base in (no force-push) or rebase onto it (force-push)
batchSize?numberlist only: group PRs into review batches of at most this many (0 = one batch, the whole list) and report the grouping for the orchestrator
fn summary(workdir?: string, upstreamRepo?: string, forkRepo?: string, agent?: enum, model?: string, mainBranch?: string, swampRepoDir?: string, sweeperPrompt?: string, updateStrategy?: enum, batchSize?: number)
Tally the recorded per-PR results (`merged`/`skipped`/`failed`/`pending`) into the `sweep` summary resource and a markdown report.
ArgumentTypeDescription
workdir?stringLocal checkout directory for the upstream repo. Omit to resolve it from pr-sweep-config's registered pairs.
upstreamRepo?stringUpstream GitHub repo as owner/name. Omit to use the newest open-prs-current.
forkRepo?stringFork GitHub repo as owner/name. Omit to use the newest open-prs-current.
agent?enumHeadless agent for review batches
model?stringModel for the agent in provider/model form; empty uses the agent's default or the registered repo pair's model
mainBranch?stringBase branch to rebase and merge into
swampRepoDir?stringPath to the swamp repo that owns this workflow; only for the legacy prompt override.
sweeperPrompt?stringAbsolute path to a custom sweeper prompt file.
updateStrategy?enumHow to update a behind branch: merge the base in (no force-push) or rebase onto it (force-push)
batchSize?numberlist only: group PRs into review batches of at most this many (0 = one batch, the whole list) and report the grouping for the orchestrator
fn sweep(upstreamRepo: string, forkRepo: string, workdir: string, agent?: enum, model?: string, mainBranch?: string, swampRepoDir?: string, sweeperPrompt?: string, resyncBehind?: boolean, updateStrategy?: enum)
Monolithic convenience: list, one review batch over every open PR, and summary in a single call. Prefer the composable steps when orchestrating.
ArgumentTypeDescription
upstreamRepostringUpstream GitHub repo as owner/name (e.g. Kilo-Org/kilocode)
forkRepostringFork GitHub repo as owner/name (e.g. maphew/kilocode)
workdirstringLocal checkout directory for the upstream repo
agent?enumHeadless agent to run the sweep
model?stringModel for the agent in provider/model form; empty uses the agent's default
mainBranch?stringBase branch to rebase and merge into
swampRepoDir?stringPath to the swamp repo that owns this workflow. Optional: only used to find a legacy `<swampRepoDir>/.kilo/agents/pr-sweeper.md` prompt override; the bundled prompt is used otherwise.
sweeperPrompt?stringAbsolute path to a custom sweeper prompt file. Overrides both the bundled prompt and the legacy `<swampRepoDir>/.kilo/agents/pr-sweeper.md` lookup.
resyncBehind?booleanAfter the agent run, re-fetch the base branch and bring any behind PR branch up to date
updateStrategy?enumHow to update a behind branch: merge the base in (no force-push) or rebase onto it (force-push)

Resources

open-prs(30d)— The queue of open fork PRs one `list` step produced (instance `open-prs-current`)
sweep(30d)— PR sweep run summary
pr(30d)— Per-PR sweep result
04Previous Versions6
2026.11.23.1MIT

review: run each batch in a throwaway worktree so PR sweeps run in parallel

2026.10.23.1MIT

Preflight git/gh/agent binaries before list, review, and sync so a missing tool fails fast with its name; accept a per-pair model (falling back to pr-sweep-config) and pass it to every review/sweep invocation.

2026.10.18.1MIT

Modified 1 behaviors. updated dependencies

2026.10.15.2MIT(was AGPL-3.0-only)

Relicense from AGPL-3.0-only to MIT.

2026.10.15.1AGPL-3.0-only(was none)

Declare license: AGPL-3.0-only in the manifest; no model, workflow, or schema changes.

2026.10.14.1

Initial publish from maphew/swamp-extensions. Bundles the sweeper prompt (prompts/pr-sweeper.md) so the model is self-contained: swampRepoDir is now optional and a custom prompt can be supplied with sweeperPrompt. agent now selects claude/codex/opencode/kilo instead of always running kilo. Records mergeStateStatus on per-PR results and a truncated flag on summaries, and adds an upgrade entry for the source move.

05Stats
A
93 / 100
Downloads
36
Archive size
36.0 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented0/1missing
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned

07Platforms
08Labels