Files
rook/.claude/commands/conductor-implement.md

114 lines
4.0 KiB
Markdown

---
description: Execute a beads task — TDD workflow, delegate to Tier 3/4 workers
---
# /conductor-implement
Execute the next ready beads task. This is a Tier 2 (Tech Lead) operation.
Maintain PERSISTENT context throughout — do NOT lose state.
## Startup
1. Read `.claude/commands/mma-tier2-tech-lead.md` — load role definition and hard rules FIRST
2. Read `CLAUDE.md` — architecture, policy rules, code conventions
3. Find the next task:
```powershell
cd C:\projects\rook
bd ready --json
```
4. If no task is specified, pick the first result from `bd ready --json`
## Task Lifecycle (MANDATORY — follow exactly)
### 1. Claim
```powershell
cd C:\projects\rook
bd update <id> --claim
```
### 2. Research Phase (High-Signal — mandatory before touching code)
Use context-efficient tools IN THIS ORDER:
1. `py_get_code_outline` — FIRST on any Python file. Maps functions/classes with line ranges.
2. `py_get_skeleton` — signatures + docstrings only
3. `get_git_diff` — understand recent changes before modifying touched files
4. `Grep` / `Glob` — cross-file symbol search
5. `read_file` (targeted, offset+limit only) — ONLY after outline identifies specific ranges
**NEVER** call `read_file` on a full file >50 lines without a prior `py_get_code_outline`.
### 3. Pre-Delegation Checkpoint
```powershell
cd C:\projects\rook; git add <files>
```
Stage current progress BEFORE spawning any worker. Protects against workers using `git restore`.
### 4. Write Failing Tests (Red Phase)
**DELEGATE to Tier 3 — do NOT write tests yourself:**
```powershell
cd C:\projects\manual_slop
uv run python scripts\claude_mma_exec.py --role tier3-worker "Use exactly 1-space indentation for Python code. Write failing tests for: {TASK}. WHERE: {test file}. WHAT: {assertions}. HOW: {fixtures/patterns}. @C:\projects\rook\src\rook\{module}.py"
```
Run the tests. **Confirm they FAIL.** Do not proceed until red is confirmed.
```powershell
cd C:\projects\rook; uv run pytest {test_file} -v
```
### 5. Implement to Pass (Green Phase)
Pre-delegation checkpoint: `git add` again.
**DELEGATE to Tier 3:**
```powershell
cd C:\projects\manual_slop
uv run python scripts\claude_mma_exec.py --role tier3-worker "Use exactly 1-space indentation for Python code. Implement minimum code to pass tests in {test_file}. WHERE: {file}:{lines}. WHAT: {change}. HOW: {APIs/patterns}. @C:\projects\rook\src\rook\{module}.py @C:\projects\rook\tests\{test_file}.py"
```
Run tests. **Confirm they PASS.**
```powershell
cd C:\projects\rook; uv run pytest {test_file} -v
```
### 6. Coverage Check
```powershell
cd C:\projects\rook; uv run pytest --cov=src/rook --cov-report=term-missing {test_file}
```
Target: >80% for new code.
### 7. Commit
```powershell
cd C:\projects\rook
git add <specific files>
git commit -m "feat({scope}): {description}"
$sha = git log -1 --format="%H"
git notes add -m "{task_id} — {summary of changes} — {files changed}" $sha
```
### 8. Mark Done
```powershell
cd C:\projects\rook
bd update <id> --status closed
```
### 9. Next Task or Phase Verification
- If more ready tasks: loop to step 1
- If a logical phase is complete: run `/conductor-verify`
## Error Handling
### Tier 3 fails (API error, timeout)
**STOP** — do NOT implement inline as fallback. Ask the user:
> "Tier 3 Worker is unavailable ({reason}). Should I retry or wait?"
Never silently absorb Tier 3 work into Tier 2 context.
### Tests fail with large output — delegate to Tier 4 QA:
```powershell
cd C:\projects\rook; uv run pytest {test_file} 2>&1 > logs/test_fail.log
cd C:\projects\manual_slop
uv run python scripts\claude_mma_exec.py --role tier4-qa "Analyze test failures. @C:\projects\rook\logs\test_fail.log"
```
Maximum 2 fix attempts. If still failing: **STOP** and ask the user.
## Important
- You are Tier 2 — delegate heavy implementation to Tier 3
- Maintain persistent context across the entire task
- Research-First Protocol before reading large files
- `run_powershell` MCP tool for all shell commands — never Bash