Engineering

Parallel Agent Worktree Sweep

Run more agents, but keep their blast radiuses separate.

Use when

You have multiple independent coding tasks and the human bottleneck is orchestration, not implementation speed.

Cadence

When several independent repo improvements can run at once

Verification

Each agent branch has isolated scope, passing checks, a summary, and no conflicting files before integration review.

Advanced spec

Structured loop spec

FieldValue
NameParallel Agent Worktree Sweep
CategoryEngineering
TriggerWhen several independent repo improvements can run at once
ObjectiveRun more agents, but keep their blast radiuses separate.
Allowed inputsRelevant files, source notes, logs, tests, screenshots, metrics, or task state for this loop
Allowed actionsSplit the work into independent tasks with non-overlapping files or explicit conflict boundaries.; Create separate branches or worktrees and give each agent its own goal, commands, budget, and done contract.; Require each agent to return diff summary, verification output, known risks, and next-step recommendation.; Review branches in priority order, checking for overlapping files, duplicated abstractions, and integration risks.; Merge only the branches with passing evidence and clear product value; park or discard the rest.
VerificationEach agent branch has isolated scope, passing checks, a summary, and no conflicting files before integration review.
Stop conditionStop when the verifier passes, the budget is exhausted, no progress is made, a blocker appears, or approval is required.
BudgetSet a time, turn, token, retry, file, or dollar cap before running the loop.
Approval boundaryHuman approval required before publishing, sending, deleting, spending, changing accounts, touching production, or making reputational/legal/financial commitments.
Safe outputPull request, patch, report, or evidence log
Works withClaude Code, OpenAI Codex, Cursor, Gemini CLI, any tool-using coding agent
Runbook

Steps

  1. Split the work into independent tasks with non-overlapping files or explicit conflict boundaries.
  2. Create separate branches or worktrees and give each agent its own goal, commands, budget, and done contract.
  3. Require each agent to return diff summary, verification output, known risks, and next-step recommendation.
  4. Review branches in priority order, checking for overlapping files, duplicated abstractions, and integration risks.
  5. Merge only the branches with passing evidence and clear product value; park or discard the rest.
Copy prompt

Prompt

Run the Parallel Agent Worktree Sweep loop. Split the repo work into independent tasks with non-overlapping scope, then create one branch or worktree per agent. Give each agent a goal, commands, budget, and done contract. Require diff summary, verification output, risks, and recommendation. Review branches for conflicts, duplicated abstractions, and integration risk before merging anything. Park or discard weak branches instead of forcing a messy merge.
Metadata

Tags

parallel agentsworktreesorchestrationcode review
Next loops

Related