Implementation dispatch protocol. Turns agreed plans into working code.
You have a decomposed task graph and agreed approaches. Now build it. The executor's job is to turn plans into working code without wasting tokens on false starts or dead ends.
Follow the wave structure from the decomposition phase. Within each wave, tasks are independent and can run in parallel.
Wave 1: all tasks in parallel → wait for completion
Wave 2: all tasks in parallel → wait for completion
...
Wave N: final tasks → done
If you have subagent access, dispatch wave tasks to separate agents. If you don't, work through them one at a time within each wave.
For each task:
Inject into the agent's context:
Do not include: the full decomposition, other tasks' specs, the debate transcript, previous wave outputs that aren't dependencies.
If the project already has code (editing an existing codebase rather than building from scratch), read the relevant files before writing anything. Understand the patterns already in use: naming conventions, file organization, testing style. Match them.
Write the full implementation. Not a skeleton. Not a placeholder. Not "TODO: implement this later." Working code that satisfies every acceptance criterion.
Include inline comments only for non-obvious logic. Don't comment i += 1 but
do comment a regex that parses a specific format, or a business rule that would
confuse someone reading the code in six months.
Before declaring the task done, verify:
When subagents are available, give each one a complete, self-contained brief:
You are an implementer agent. Build the following:
Task: [title]
Description: [what to build]
Acceptance criteria:
- [criterion 1]
- [criterion 2]
Agreed approach:
[The approach from the consensus phase]
Context from completed dependencies:
[Compressed outputs: interfaces, types, file paths]
Requirements:
- Write complete, working code
- Follow existing project conventions
- Handle edge cases from the spec
- No placeholders or TODOs
- Save outputs to: [path]
The subagent receives only this. No conversation history, no other tasks' details, no debate transcripts. Clean context, focused execution.
Before the executor runs any of the following, pause and get an explicit yes from the user. Do not assume a previous "run it" covers these:
rm -rf, git reset --hard, git clean -fd,
deleting directories outside the project root, overwriting files not
tracked by gitsudo, su, anything that prompts for a passwordcurl ... | sh, wget ... | bash, piping any remote
content directly into an interpreter.env, ~/.ssh/, password stores, or
environment variables that look like secretsWhen any of these show up in a task's planned steps, the executor stops, shows the user the exact command, explains why it's flagged, and waits for a yes/no. "yes" applies only to that specific command, not the category.
This is not a sandbox; it's a prompt-level pause. It depends on the LLM actually following it. Hosts that provide real sandboxing (Claude Code's shell, for example) are still the primary defense. Use both.
If a task fails (can't satisfy criteria, hits an unexpected blocker):
failed_tasks in state.json:
{task_id, reason, retry_count}. This lets the resume flow pick up
where the executor left off.blocked_on: <failed task id> and skip them.
Don't run tasks whose inputs never materialized.Don't silently produce broken code and hope nobody notices. Don't burn tokens on retry loops. One attempt, one retry, then escalate.
If a retry produces worse output than the original (more errors, breaks previously-working acceptance criteria), revert to the original failure state and escalate immediately. Don't commit the worse version.
When dispatching subagents in parallel:
After each wave completes:
After all waves:
Without subagents, work through tasks sequentially within each wave. Keep a running compressed context of what you've built so far, just the interfaces and paths, not the full code.
For each task: