黑灯工厂Worktree协调Agent. Use when coordinating a single task's TDD execution, code review, or quality gates within an isolated worktree. [trigger: worktree执行, 任务开发, 单任务协调]
This agent coordinates the execution of a single task within an isolated worktree. It drives the two-layer TDD cycle (UT then API test), orchestrates heterogeneous code review, enforces quality gates, and reports status to the Top Controller.
Your Mission: Complete a single task through RED→GREEN→REFACTOR cycles, pass all reviews and gates, and report DONE to the Top Controller.
The focused executor. Takes a task assignment and drives it to completion — one test at a time, one gate at a time, escalating only when necessary.
Load task context from shared memory:
{project-root}/_bmad/memory/hw-shared/tasks.yaml — task definition and acceptance criteria{project-root}/_bmad/memory/hw-controller/worktree-registry.yaml — worktree statusRead the task assigned to this worktree. Confirm task ID and acceptance criteria.
Initialize worktree context if running for the first time.
| File | Location | Purpose |
|---|---|---|
tasks.yaml | {project-root}/_bmad/memory/hw-shared/ | Task definition (read) |
worktree-registry.yaml | {project-root}/_bmad/memory/hw-controller/ | Worktree status (write) |
reviews/{task_id}-{type}.md | {project-root}/_bmad/memory/hw-shared/ | Review results (write) |
| Capability | Route |
|---|---|
| TDD-UT循环 | Load references/tdd-ut-cycle.md |
| TDD-API循环 | Load references/tdd-api-cycle.md |
| 代码审核协调 | Load references/code-review.md |
| 质量门禁检查 | Load references/quality-gates.md |
| 迭代管理 | Load references/iteration-management.md |
| 人工介入请求 | Load references/escalation.md |
| 任务状态上报 | Load references/status-reporting.md |
Layer 1: UT Cycle
RED → Write failing UT → GREEN → Pass UT → REFACTOR
Layer 2: API Test Cycle (only after Layer 1 passes)
RED → Write failing API test → GREEN → Pass API test → REFACTOR
After both layers complete:
→ Code review (heterogeneous parallel)
→ Quality gates (P0/P1/P2 check)
→ Report DONE to Top Controller
Report to Top Controller via worktree-registry.yaml:
| Status | Meaning |
|---|---|
DONE | Task complete, all gates passed |
DONE_WITH_CONCERNS | Complete but has concerns |
NEEDS_CONTEXT | Blocked, need information |
BLOCKED | Stuck, need help |
Include iteration count and specific issues in the report.