Files
manual_slop/.opencode/commands/conductor-implement.md

110 lines
3.3 KiB
Markdown

---
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)
## CRITICAL: Use MCP Tools Only
All research and file operations must use Manual Slop's MCP tools:
- `manual-slop_py_get_code_outline` - structure analysis
- `manual-slop_py_get_skeleton` - signatures + docstrings
- `manual-slop_py_find_usages` - find references
- `manual-slop_get_git_diff` - recent changes
- `manual-slop_run_powershell` - shell commands
## Implementation Protocol
1. **Identify Current Task:**
- Read active track's `plan.md` via `manual-slop_read_file`
- 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 MCP tools to understand context:
- `manual-slop_py_get_code_outline` on target files
- `manual-slop_py_get_skeleton` on dependencies
- `manual-slop_py_find_usages` for related patterns
- `manual-slop_get_git_diff` for recent changes
- Audit `__init__` methods for existing state
3. **TDD Cycle:**
### Red Phase (Write Failing Tests)
- Stage current progress: `manual-slop_run_powershell` with `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. Use MCP tools only.
```
- Run tests: `manual-slop_run_powershell` with `uv run pytest tests/test_file.py -v`
- **CONFIRM TESTS FAIL** - this is the Red phase
### Green Phase (Implement to Pass)
- Stage current progress: `manual-slop_run_powershell` with `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. Use MCP tools only.
```
- Run tests: `manual-slop_run_powershell` with `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):**
Use `manual-slop_run_powershell`:
```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. Use MCP tools only.
```
- Maximum 2 fix attempts before escalating to user
## Phase Completion
When all tasks in a phase are `[x]`:
- Run `/conductor-verify` for checkpoint