--- description: Resume or start track implementation following TDD protocol agent: tier2-tech-lead --- # /conductor-implement Resume or start implementation of the active track following TDD protocol. ## Prerequisites - Run `/conductor-setup` first to load context - Ensure a track is active (has `[~]` tasks) ## Implementation Protocol 1. **Identify Current Task:** - Read active track's `plan.md` - Find the first `[~]` (in-progress) or `[ ]` (pending) task - If phase has no pending tasks, move to next phase 2. **Research Phase (MANDATORY):** Before implementing, use tools to understand context: - `py_get_code_outline` on target files - `py_get_skeleton` on dependencies - `grep` for related patterns - `get_git_diff` for recent changes - Audit `__init__` methods for existing state 3. **TDD Cycle:** ### Red Phase (Write Failing Tests) - Stage current progress: `git add .` - Delegate test creation to @tier3-worker: ``` @tier3-worker Write tests for: [task description] WHERE: tests/test_file.py:line-range WHAT: Test [specific functionality] HOW: Use pytest, assert [expected behavior] SAFETY: [thread-safety constraints] Use 1-space indentation. ``` - Run tests: `uv run pytest tests/test_file.py -v` - **CONFIRM TESTS FAIL** - this is the Red phase ### Green Phase (Implement to Pass) - Stage current progress: `git add .` - Delegate implementation to @tier3-worker: ``` @tier3-worker Implement: [task description] WHERE: src/file.py:line-range WHAT: [specific change] HOW: [API calls, patterns to use] SAFETY: [thread-safety constraints] Use 1-space indentation. ``` - Run tests: `uv run pytest tests/test_file.py -v` - **CONFIRM TESTS PASS** - this is the Green phase ### Refactor Phase (Optional) - With passing tests, refactor for clarity - Re-run tests to verify 4. **Commit Protocol (ATOMIC PER-TASK):** ```powershell git add . git commit -m "feat(scope): description" $hash = git log -1 --format="%H" git notes add -m "Task: [summary]" $hash ``` - Update `plan.md`: Change `[~]` to `[x]` with commit SHA - Commit plan update: `git add plan.md && git commit -m "conductor(plan): Mark task complete"` 5. **Repeat for Next Task** ## Error Handling If tests fail after Green phase: - Delegate analysis to @tier4-qa: ``` @tier4-qa Analyze this test failure: [test output] DO NOT fix - provide analysis only. ``` - Maximum 2 fix attempts before escalating to user ## Phase Completion When all tasks in a phase are `[x]`: - Run `/conductor-verify` for checkpoint