For each task, spawn teammate + reviewers (if task has reviewers):
Use teammate_name from task frontmatter as the agent name. If not set — pick a descriptive name based on the task.
Teammate — subagent_type: "general-purpose", model: "opus", team_name: "{team}"
Prompt template:
You are "{name}" executing task {N}.
Read task: {feature_dir}/tasks/{N}.md
Load skills listed in task frontmatter. If skills listed — follow the loaded skill workflow.
If no skills listed — follow the task instructions directly (the task file contains detailed steps).
If the task requires user actions — send the instruction to team lead via SendMessage.
Team lead will forward to user and return confirmation.
{reviewers_block}
After task complete:
- Write entry to {feature_dir}/decisions.md (follow template at ~/.claude/shared/work-templates/decisions.md.template).
Summary: 1-3 sentences describing what was done and key decisions. Link JSON reports for review details.
- Message team lead: "Task {N} complete. decisions.md updated."
Feature dir: {feature_dir}
{reviewers_block} — include only when task has reviewers (not reviewers: none):
Your reviewers: {reviewer_names} (list of teammate names).
Review process — after task is complete, follow this review process (overrides review steps from loaded skills):
1. Run `git diff -- <your files>` and collect the list of changed files + full diff output.
2. Send each reviewer via SendMessage: list of changed files + full diff output.
3. Reviewers will perform review, write JSON report to `{feature_dir}/logs/working/task-{N}/{reviewer_name}-round{round}.json`, and send report path back to you.
4. Read reports, fix findings. After fixes: send updated diff to reviewers for next round.
5. Max 3 review rounds. Reason: diminishing returns — if 3 rounds cannot resolve findings, the issue requires human judgment. If unresolved after 3 → message team lead to escalate.
Commit flow:
1. After implementation complete (tests pass): git commit `feat|fix: task {N} — {brief description}`
2. Send diff to reviewers for review.
3. After each round of fixes (tests pass): git commit `fix: address review round {M} for task {N}`
4. After all reviews pass (or max 3 rounds): git commit review reports with message `chore: review reports for task {N}`
If task has reviewers: none — skip reviewer spawning. The teammate works independently, commits code with message feat|fix: task {N} — {brief description} (tests pass), and reports completion directly to team lead.
Every task gets a spawned teammate — even tasks with no skills and no reviewers (operational tasks, MCP interactions, benchmarks, manual steps). The lead never executes task work directly.
Each reviewer (when present) — subagent_type: "general-purpose", model: "sonnet", team_name: "{team}"
Reviewer skill mapping (reviewer name → skill to load):
code-reviewer → code-reviewing
security-auditor → security-auditor
test-reviewer → test-master
prompt-reviewer → prompt-master
deploy-reviewer → deploy-pipeline
infrastructure-reviewer → infrastructure-setup
skill-checker → skill-master
documentation-reviewer → documentation-writing
Prompt template:
You are reviewer "{name}" for task {N}.
Load your review methodology: Skill(skill="{reviewer_skill}")
Read specs: {feature_dir}/user-spec.md, {feature_dir}/tech-spec.md
Read task: {feature_dir}/tasks/{N}.md
Wait for a message from teammate "{teammate_name}" with git diff of changes.
When you receive it:
1. Review changes following the loaded skill methodology
2. Write JSON report to: {feature_dir}/logs/working/task-{N}/{reviewer_name}-round{round}.json
3. Send report path to teammate "{teammate_name}" via SendMessage
The teammate may send updated diffs for subsequent rounds (max 3).
Review each round the same way. After the final round, shut down.