| name | do |
| description | Dispatch the implementation supervisor for a bead task. Resolves the correct supervisor from the assignee field, checks branch state, and dispatches with full context. |
| user_invocable | true |
Do
Dispatch the implementation supervisor for a bead task. Handles supervisor resolution, branch management, and dispatch with full investigation context.
If the user provides $ARGUMENTS, check if it contains a bead ID (e.g., `bd-a3f`, `bd-001.2`).
If bead ID provided: use it directly.
If no bead ID provided:
- Run
bd ready --json to get unblocked tasks
- Present the list showing: ID, title, priority, and labels
- Pick by order and priority; if unclear, ask the user
1. **Bead must exist.** Validate with `bd show {BEAD_ID} --json`.
2. **Investigation should exist.** Read bead comments: `bd comments {BEAD_ID}`. Search for `INVESTIGATION:`.
Bead does not exist. Inform the user and stop.
No investigation found for this bead. Warn:
"No investigation found. The supervisor will implement without codebase analysis. This can lead to missed edge cases."
Ask: "Do you want to run /investigate {BEAD_ID} first, or proceed without investigation?"
- If user wants investigation → stop and recommend
/investigate
- If user proceeds → continue to dispatch
Step 1: Read Full Bead Context
- Parse bead JSON. Extract:
description, acceptance, design, notes, status, parent, labels
- If bead is an epic child (BEAD_ID contains a dot):
- Extract EPIC_ID, read the epic, extract design doc path
- Read the design doc content — this is the implementation contract
- Store all context for the dispatch prompt
Step 2: Resolve Supervisor
- Read the
assignee field from the bead JSON — this contains the supervisor name (e.g., rust-supervisor)
- If
assignee is set and non-empty:
- Verify the agent file exists:
.claude/agents/{assignee}.md
- If found → supervisor resolved
- If NOT found → warn user, fall through to manual selection
- If
assignee is empty or unset:
- List available supervisors: find all
*-supervisor.md in .claude/agents/
- Present the list
- Inform: "If the supervisor you need is not listed, create one with
/add-supervisor {technology}."
- Ask: "Which supervisor should handle this task?"
- If user wants to create → stop and suggest
/add-supervisor, then re-run /do
Step 3: Check Branch State
git branch -a | grep {BEAD_ID}
If branch exists:
- Inform user: "A branch already exists:
{branch-name}. This may be from a previous implementation attempt."
- Ask: "Continue on the existing branch, or create a fresh branch?"
- Include context in dispatch prompt
If no branch exists:
- Ask: "Which branch should I base from? (default:
main)"
- Store as
{BASE_BRANCH}
Step 4: Dispatch Implementation Supervisor
-
Announce before dispatching:
Dispatching {resolved-supervisor} for {BEAD_ID}: "{bead title}"
-
Dispatch using exactly these parameters — no more, no less:
Agent(
subagent_type="{resolved-supervisor}",
prompt="Implement BEAD {BEAD_ID}. [Include EPIC_ID if epic child]. Base branch: {BASE_BRANCH} — run `git checkout {BASE_BRANCH}` before creating your feature branch. Read the bead (bd show {BEAD_ID}) and comments (bd comments {BEAD_ID}) for full context — description, acceptance criteria, design notes, and investigation findings."
)
Do NOT add extra parameters unless the user explicitly requests it.
-
The PreToolUse hook automatically injects the discipline reminder because the agent name ends in -supervisor.
Present the result following the **Presenting to the User** guidelines:
- Headline: "{bead title} — implementation complete" in plain language
- What was done: 1-2 sentences summarizing what the supervisor built — translate the COMPLETED bead comment into natural language, don't paste raw
- Branch and PR: show branch name and PR URL (look for
PR: in the completion report or bead comments)
- Decisions/Deviations: if the supervisor logged DECISION or DEVIATION comments, explain each in plain language — what choice was made, why, and what the alternative was
- Next step: recommend
/review {BEAD_ID}
- Technical details: raw COMPLETED comment and file list in a
<details> block
After the supervisor completes, recommend `/review {BEAD_ID}` for code review.