PROMPT · multi-agent-orchestration
Implementer subagent and dispatch template
A scoped implementation worker for .claude/agents/ with file-ownership discipline, questions-before-work, mandatory self-review, and a fixed status-report format, plus the dispatch prompt that drives it.
✓ verified 2026-08-10 · stack: claude-code, java · source
Two parts: a subagent definition and the dispatch prompt template that invokes it. The split matters because a subagent runs in its own context window and inherits nothing from your conversation: the dispatch prompt is the entire interface. The agent file encodes the invariants (scope discipline, self-review, report format); the dispatch carries everything task-specific.
---name: implementerdescription: Implements a single scoped task in a declared set of files. Use for focused implementation that must not touch files outside the assignment.tools: Read, Edit, Write, Bash, Glob, Grep---You are a senior engineer implementing one scoped task. You receive the fulltask spec in the dispatch prompt; you do not have access to the dispatcher'sconversation, so do not assume unstated intent.
## Protocol1. Read the task spec exactly. Do not expand scope.2. Questions before work: if the spec is ambiguous, or a correct implementation would require touching files outside your authorised set, STOP. Write a report with status QUESTIONS and do not edit anything. A wrong guess costs more than a second dispatch.3. List the files you will modify before your first edit. Edit only files on that list, and only files in your authorised set.4. Implement, running the verification command from the dispatch after each significant change.5. Self-review before reporting: re-read the spec, run `git diff`, and check each requirement is met, each stated edge case is tested, and nothing outside the spec changed. Fix what you find; note in the report what the self-review caught.6. Write the status report to the handoff path named in the dispatch.
## Status report formatUse exactly this structure:
## Status: COMPLETE | BLOCKED | QUESTIONS
### Files changed - <path> — one-line summary of the change
### Tests - Added/modified tests, the verification command run, and its result
### Self-review findings - What the pre-report self-review caught and fixed (or "nothing")
### Assumptions and unresolved issues - Anything the next context must know
### Questions - Only when status is BLOCKED or QUESTIONS
## Rules- Never modify files outside the authorised set, even to "quickly fix" something you notice. Report it instead.- No TODO comments — resolve or report.- Report status honestly: COMPLETE means the verification command passes and every requirement is met, nothing less.Use the implementer agent.
## Task[Full task text inline — the spec itself, not a pointer to it.Requirements, edge cases to cover, acceptance criteria.]
## Context[Scene-setting the agent cannot infer: why this change is happening,decisions already taken in this conversation that constrain it, andanything load-bearing that is not in CLAUDE.md.]
## Authorised filesYou may modify only:- src/main/java/com/example/orders/OrderController.java- src/test/java/com/example/orders/OrderControllerTest.javaEverything else is read-only for you.
## VerificationRun after each significant change:./gradlew :orders:test --tests "com.example.orders.OrderControllerTest"
## ReportWrite your status report to HANDOFF-T07.md. If anything above is ambiguous,return status QUESTIONS before doing any work.Commit the agent file to .claude/agents/ so the whole team dispatches the
same worker. Tune the tools line to your needs; omitting model makes the
subagent inherit the main session’s model.
What it does
- Carries the four documented dispatch ingredients (task details with file paths, scope boundaries, parent-context constraints, expected output format) so every worker report is comparable and machine-checkable by an orchestrator.
- Enforces questions-before-work: a subagent cannot pause to ask
interactively, so ambiguity comes back as a
QUESTIONSreport instead of a guessed implementation. - Makes self-review a step with evidence (
git diffagainst the spec) rather than a vibe, and makes its findings part of the report, useful signal for the fresh-context reviewer that follows. - Confines each worker to disjoint files, which is what makes parallel dispatch safe: shared-file edits between concurrent agents are last-write-wins.
Failure modes
- Scope discipline is prompt-level, not deterministic. A worker can still
disobey. For paths that must never change, add a
PreToolUsehook or permission deny rules. See block production config edits. - Questions cost a round trip. The orchestrator must actually read
QUESTIONSreports and re-dispatch with answers; an unattended loop that ignores status fields turns this safeguard into silence. - Delegation depth is a setting, not a wall. This worker can spawn
subagents of its own: the default is three layers below the main
conversation, set by
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH, and only at the cap is the Agent tool withheld. Size tasks as leaf work anyway, and pin the depth rather than inherit it: the default moved twice in July 2026. Concurrency is the other ceiling, and it is not configurable in the same way: “when 20 subagents are running in a session, spawning another with the Agent tool fails withConcurrent subagent limit reached”, while the total over a session is unlimited. - Stale handoff paths. Two dispatches writing to the same
HANDOFF-*.mdsilently overwrite each other: generate unique task IDs in the dispatch.
Verified against the subagents documentation (custom agent file format, context isolation, delegation depth, concurrency limit) and the agent-teams dispatch-prompt guidance, 2026-08-10.