dispatching-parallel-agents
Use when facing two or more independent pieces of work that can run without shared state — when to dispatch at all, how to choose the agent, write a self-contained prompt, isolate writers, count what came back, and verify before integrating
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- dispatching-parallel-agents
- description
- Use when facing two or more independent pieces of work that can run without shared state — when to dispatch at all, how to choose the agent, write a self-contained prompt, isolate writers, count what came back, and verify before integrating
- argument-hint
- [description of the independent pieces]
03 SKILL.md 正文
Dispatching Parallel Agents
One agent per independent problem, all sent in one message, each with everything it needs in its prompt. /run-spec applies this to spec tasks with its own templates (/run-spec-dispatch); this page is the general method.
Input
$ARGUMENTS: optionally, a description of the pieces of work. Usually the skill is applied to the work in hand.
Invocation contexts
- Slash command: applies the checklist below to the described work and dispatches.
- Model-invoked: the same.
- Non-interactive: the same; a dispatched agent may nest-dispatch only what a skill it is running prescribes.
When to dispatch
Dispatch has a floor as well as a ceiling.
- Do it yourself when a handful of tool calls finishes the work. A dispatch costs a fresh context, a prompt you must write and a result you must read and verify.
- One agent when one agent can do it: splitting a coherent task multiplies the merge surface without shortening the critical path.
- Parallel agents for two or more pieces with different root causes or subsystems, each understandable without the others, touching different files.
- Never to verify your own work: read the diff and the gate output yourself. A different reviewing agent (
code-reviewer) is a separate, legitimate pattern. - Not yet while you do not know what is wrong: investigate first (one
Exploreagent or your own reads), dispatch fixers second. - Sequentially when the pieces share files, or one defines an interface the others consume: land the interface first.
Steps
-
Split by independence. Group the work by package, test file or subsystem. Two failures in the same state machine are probably one bug: one agent.
-
Choose each agent by what it will do (
knowledge/agent-routing.md):Work subagent_typeRead-only search or investigation ExploreImplementation in a domain the domain's agent ( knowledge/domains.md):go-implementer,tui-implementer,release-engineer,agent-config-editorReview of a finished change code-reviewer, orarchitectacross domainsMechanical bookkeeping completion-clerk,harness-clerk(never pass themeffort)Always name
subagent_type: an omitted one,general-purposeorforkruns on your own model and skips the agent's pins. Never passmodel. -
Isolate every writer. Two agents writing one working tree race on its index and files, and one agent's
git stash,git add -Aorgit checkout .destroys the other's work. Give each writing agentisolation: "worktree", have it cut its branch fromorigin/mainexplicitly (git fetch origin main && git switch -c <branch> origin/main), and have it commit and push before it reports: work left uncommitted in a worktree is not a result. Read-only agents need no worktree. -
Write self-contained prompts. The agent sees nothing of your conversation. Each prompt names: the goal as checks ("these tests pass", not "fix it"); the files it owns and the files it must not touch; the context it needs (error output, file paths, the relevant spec section); the constraints (no background commands: a subagent is never notified when one finishes; commit named paths only; stop and report when a hook blocks); and the exact shape of what to return.
-
Dispatch all of them in one message. With
run_in_background: trueeach result arrives as its own notification. -
Count before reading. Print
dispatched=N returned=M failed=K, withNthe number of Agent calls you sent, never the number of results you can see; name the missing ones whenM + K < N. A dead agent returns nothing, and "found nothing" must never be confused with "never ran" (.claude/rules/agent-behavioral-posture.md§5). -
Verify, then integrate. For each result: read its summary against its diff; check it touched only its files; re-run its tests yourself; look for weakened assertions, broad mocks or test-only setup that hides a bug. Then run the combined gates (
scripts/harness/gate.sh allin the tree you integrate into): parts that pass alone can fail together. -
Correct or re-dispatch. An agent on the right track gets a correction through
SendMessageto the same agent id, which keeps its context. One that misread the problem is replaced by a fresh agent with a sharper prompt. When two agents edited the same file despite the split, keep the better change and re-dispatch the other with that change as context.
Output
The accounting line, then one line per agent: what it changed, the evidence you re-checked, and whether it was integrated.
04 同仓库更多 Skills
mythhelm-deliver-backlog
Coordinate a MYTHHELM backlog run with the shared stage checks and maintainer checkpoints.
mythhelm-bootstrap
Orient a Grok Build session in the MYTHHELM repository before task or spec work.
vendor-consult
Run one advisory stage consult (premise-ground, spec-validate, task-review, change-review, stuck-oracle, dossier) with an optional external vendor, then adjudicate the answer at its anchors
update-docs
Bring README, docs/, knowledge/, WORKFLOW.md and CLAUDE.md in line with what a shipped spec or a merged change actually did — find every statement the change made stale, fix it where readers look, and add only the new facts they need
triage
Score an idea or a GitHub issue against the master spec's stages, gates and commitments, check it for duplicates, and recommend whether it becomes a backlog card; read-only
test-driven-development
Red-green-refactor for Go — use when implementing any feature, bug fix or behaviour change, before writing implementation code