Comprehensive TDD Planning v2.0.0
Architecture
| Phase |
Verbosity |
Purpose |
Planning (plan.md) |
Verbose |
Figure things out, iterate, full specs |
Execution (*.agent.md) |
Minimal |
Distilled context for agent, ~200-400 lines |
Directory Structure
NNNN-descriptive-name/
├── README.md # Index, dependency graph, status matrix
├── plan.md # Full verbose feature specs (planning reference)
├── interfaces.md # Contract source of truth
├── gotchas.md # Discovered issues (append-only)
└── agents/
└── NNN_agent_[name].agent.md # Minimal execution context per agent (zero-padded)
Agent Files: Design Principles
Agent files are distilled execution context, not documentation.
IN Agent Files
- Feature IDs + one-line TL;DRs
- Interface contracts (your exports + what you receive)
- Files to create/modify
- Test IDs
- Concise TDD cycles (one line per cycle)
- Relevant gotchas (brief)
- Done checklist
OUT of Agent Files
- Verbose Gherkin (TL;DR sufficient)
- Methodology explanations (agent knows TDD)
- Git workflow (in CLAUDE.md)
- Other agents' details
- Historical context
Target Size
~200-400 lines for 2-4 features. Larger = split agent.
Searching is Failure
If agent files are well-constructed, searching plan.md is rare—only for unexpected edge cases. Frequent searching means agent files need improvement.
Workflow
Create Plan
- Gather context → verbose
plan.md
- Map interfaces →
interfaces.md
- Draw dependencies →
README.md
- Distill agent files →
agents/*.agent.md
Assign Work
Copy agents/columns.agent.md → paste to agent → done
During Execution
- Agent works from their
.agent.md
- Updates status when complete
- Appends to
gotchas.md if issues found
- Searches only for unexpected edge cases
Status Values
| Status |
Meaning |
Action |
GAP |
Not started |
Begin work |
WIP |
In progress |
Continue |
PASS |
Complete |
Done |
BLOCKED |
Waiting on dep |
Work elsewhere |
Commands
| Command |
Purpose |
When |
create-feature-plan |
Create new plan + agent files |
Starting new work |
update-feature-plan |
Modify plan, regenerate agents |
Mid-flight changes, interface evolution |
close-feature-agent |
Verify completion, sync status |
Agent finishes work |
migrate-feature-plan |
Convert v1.x plan to v2.0.0 |
Existing plans need migration |
list-feature-plans |
List available plans |
Finding plans |
work |
Smart orchestration (auto-detect plan, assess, suggest) |
After PR merged, starting new session |
heal |
Auto-heal plan (cleanup, pattern detection) |
Cleanup completed agents, detect issues |
run <plan> |
Select and run next best agent task |
Ready to start work on plan |
next-task <plan> |
Select next task (no run) |
Preview next task selection |
assess-agents <plan> |
Assess agent completion status |
Check status, find cleanup needs |
update-feature-plan
Handles mid-flight changes:
- Apply feedback to verbose planning docs
- Identify cascade - interface changes affect downstream agents
- Regenerate affected agent files (distill, don't patch)
- Verify consistency across all files
Key insight: Interface changes cascade. If #2's export changes, all agents that receive from #2 need regenerated files.
migrate-feature-plan
Converts v1.x plans (with parallelization.md, speed_prompts.md, YAML front matter) to v2.0.0:
- Extract interfaces from YAML →
interfaces.md
- Extract gotchas →
gotchas.md
- Distill agent files from plan + parallelization →
agents/*.agent.md
- Archive old files (
parallelization.md, speed_prompts.md)
Lifecycle
create-feature-plan
↓
[plan.md + agents/*.agent.md created]
↓
[copy agent file to Claude]
↓
[agent implements]
↓
[PR merged]
↓
just work (auto-detect plan, assess status, suggest next task)
↓
[if cleanup needed] → just heal (auto-fix completed agents)
↓
close-feature-agent ←─────────────────┐
↓ │
[status synced, unblocked identified]
↓ │
[if interfaces changed] → update-feature-plan
↓ │
[next agent file ready] │
↓ │
[repeat] ──────────────────────────┘
Smart Orchestration
After a PR is merged, use just work to:
- Auto-detect plan from last merged PR (title, branch, description, files)
- Assess status of all agents (completed, active, needs cleanup)
- Identify cleanup (completed agents not moved to
completed/)
- Determine next task using scoring algorithm (dependencies, workload, priority)
- Provide recommendations with clickable links to plan files
Use just heal to:
- Auto-move completed agents to
completed/ directory
- Detect stuck agents (WIP for 7+ days)
- Identify dependency bottlenecks
- Learn from patterns and suggest improvements
All commands support --auto flag to auto-detect plan from last PR:
just next-task --auto
just assess-agents --auto
just run-agent --auto
close-feature-agent
Lightweight checkpoint:
- Verify - Files exist, exports match, tests pass
- Sync - Update README.md status matrix
- Report - Show newly-unblocked features
- Capture - Sync gotchas to gotchas.md
Does NOT regenerate agent files (use update-feature-plan for that).
Workflow Entry Points
See workflow.md for complete workflow documentation including:
- System overview (plan, agent, feature, status concepts)
- Workflow states and transitions
- Command decision tree
- When to use each command
- Common patterns and anti-patterns
- Troubleshooting guide
Quick Reference: When to Use Which Command
Primary Entry Point:
/work - After PR merge, starting work session, need status overview
Focused Entry Points:
/run-agent <plan> or /run-agent --auto - Ready to start working, auto-selects next best agent
/plan-list-agents <plan> - Want to see all agents and choose which one to run
/plan-cleanup or /heal - Cleanup needed, want to auto-fix
/plan-check-status or /assess-agents <plan> - Need detailed status, troubleshooting
/list-feature-plans - Need to find a plan
After Work:
/close-feature-agent <agent-path> - Verify completion, sync status
Plan Management:
/create-feature-plan - Create new plan
/update-feature-plan <plan> - Modify existing plan
/list-feature-plans - List all plans
Key Principles
- Planning is cheap - Be verbose, iterate
- Execution context is precious - Minimal, dense
- Distill, don't copy - Agent files are refined extracts
- Interfaces are boundaries - Clear contracts enable parallelism
- One agent, one file - Coherent context, no mental merging
- Close the loop - Verify completion before moving on
1---2name: comprehensive-tdd-planning3description: TDD planning with agent-per-file execution. Planning is verbose. Agent files are minimal execution context.4---56# Comprehensive TDD Planning v2.0.078## Architecture910| Phase | Verbosity | Purpose |11| ---------------------------- | --------- | ------------------------------------------- |12| **Planning** (`plan.md`) | Verbose | Figure things out, iterate, full specs |13| **Execution** (`*.agent.md`) | Minimal | Distilled context for agent, ~200-400 lines |1415## Directory Structure1617```18NNNN-descriptive-name/19├── README.md # Index, dependency graph, status matrix20├── plan.md # Full verbose feature specs (planning reference)21├── interfaces.md # Contract source of truth22├── gotchas.md # Discovered issues (append-only)23└── agents/24 └── NNN_agent_[name].agent.md # Minimal execution context per agent (zero-padded)25```2627## Agent Files: Design Principles2829Agent files are **distilled execution context**, not documentation.3031### IN Agent Files3233- Feature IDs + one-line TL;DRs34- Interface contracts (your exports + what you receive)35- Files to create/modify36- Test IDs37- Concise TDD cycles (one line per cycle)38- Relevant gotchas (brief)39- Done checklist4041### OUT of Agent Files4243- Verbose Gherkin (TL;DR sufficient)44- Methodology explanations (agent knows TDD)45- Git workflow (in CLAUDE.md)46- Other agents' details47- Historical context4849### Target Size5051~200-400 lines for 2-4 features. Larger = split agent.5253### Searching is Failure5455If agent files are well-constructed, searching `plan.md` is rare—only for unexpected edge cases. Frequent searching means agent files need improvement.5657## Workflow5859### Create Plan60611. Gather context → verbose `plan.md`622. Map interfaces → `interfaces.md`633. Draw dependencies → `README.md`644. **Distill** agent files → `agents/*.agent.md`6566### Assign Work6768```69Copy agents/columns.agent.md → paste to agent → done70```7172### During Execution7374- Agent works from their `.agent.md`75- Updates status when complete76- Appends to `gotchas.md` if issues found77- Searches only for unexpected edge cases7879## Status Values8081| Status | Meaning | Action |82| --------- | -------------- | -------------- |83| `GAP` | Not started | Begin work |84| `WIP` | In progress | Continue |85| `PASS` | Complete | Done |86| `BLOCKED` | Waiting on dep | Work elsewhere |8788## Commands8990| Command | Purpose | When |91| ---------------------- | ------------------------------------------------------- | --------------------------------------- |92| `create-feature-plan` | Create new plan + agent files | Starting new work |93| `update-feature-plan` | Modify plan, regenerate agents | Mid-flight changes, interface evolution |94| `close-feature-agent` | Verify completion, sync status | Agent finishes work |95| `migrate-feature-plan` | Convert v1.x plan to v2.0.0 | Existing plans need migration |96| `list-feature-plans` | List available plans | Finding plans |97| `work` | Smart orchestration (auto-detect plan, assess, suggest) | After PR merged, starting new session |98| `heal` | Auto-heal plan (cleanup, pattern detection) | Cleanup completed agents, detect issues |99| `run <plan>` | Select and run next best agent task | Ready to start work on plan |100| `next-task <plan>` | Select next task (no run) | Preview next task selection |101| `assess-agents <plan>` | Assess agent completion status | Check status, find cleanup needs |102103### update-feature-plan104105Handles mid-flight changes:1061071. **Apply feedback** to verbose planning docs1082. **Identify cascade** - interface changes affect downstream agents1093. **Regenerate** affected agent files (distill, don't patch)1104. **Verify** consistency across all files111112Key insight: Interface changes cascade. If #2's export changes, all agents that receive from #2 need regenerated files.113114### migrate-feature-plan115116Converts v1.x plans (with `parallelization.md`, `speed_prompts.md`, YAML front matter) to v2.0.0:1171181. **Extract** interfaces from YAML → `interfaces.md`1192. **Extract** gotchas → `gotchas.md`1203. **Distill** agent files from plan + parallelization → `agents/*.agent.md`1214. **Archive** old files (`parallelization.md`, `speed_prompts.md`)122123### Lifecycle124125```126create-feature-plan127 ↓128 [plan.md + agents/*.agent.md created]129 ↓130 [copy agent file to Claude]131 ↓132 [agent implements]133 ↓134 [PR merged]135 ↓136 just work (auto-detect plan, assess status, suggest next task)137 ↓138 [if cleanup needed] → just heal (auto-fix completed agents)139 ↓140close-feature-agent ←─────────────────┐141 ↓ │142 [status synced, unblocked identified]143 ↓ │144 [if interfaces changed] → update-feature-plan145 ↓ │146 [next agent file ready] │147 ↓ │148 [repeat] ──────────────────────────┘149```150151### Smart Orchestration152153After a PR is merged, use `just work` to:1541551. **Auto-detect plan** from last merged PR (title, branch, description, files)1562. **Assess status** of all agents (completed, active, needs cleanup)1573. **Identify cleanup** (completed agents not moved to `completed/`)1584. **Determine next task** using scoring algorithm (dependencies, workload, priority)1595. **Provide recommendations** with clickable links to plan files160161Use `just heal` to:162163- Auto-move completed agents to `completed/` directory164- Detect stuck agents (WIP for 7+ days)165- Identify dependency bottlenecks166- Learn from patterns and suggest improvements167168All commands support `--auto` flag to auto-detect plan from last PR:169170- `just next-task --auto`171- `just assess-agents --auto`172- `just run-agent --auto`173174### close-feature-agent175176Lightweight checkpoint:1771781. **Verify** - Files exist, exports match, tests pass1792. **Sync** - Update README.md status matrix1803. **Report** - Show newly-unblocked features1814. **Capture** - Sync gotchas to gotchas.md182183Does NOT regenerate agent files (use `update-feature-plan` for that).184185## Workflow Entry Points186187See `workflow.md` for complete workflow documentation including:188189- System overview (plan, agent, feature, status concepts)190- Workflow states and transitions191- Command decision tree192- When to use each command193- Common patterns and anti-patterns194- Troubleshooting guide195196### Quick Reference: When to Use Which Command197198**Primary Entry Point**:199200- `/work` - After PR merge, starting work session, need status overview201202**Focused Entry Points**:203204- `/run-agent <plan>` or `/run-agent --auto` - Ready to start working, auto-selects next best agent205- `/plan-list-agents <plan>` - Want to see all agents and choose which one to run206- `/plan-cleanup` or `/heal` - Cleanup needed, want to auto-fix207- `/plan-check-status` or `/assess-agents <plan>` - Need detailed status, troubleshooting208- `/list-feature-plans` - Need to find a plan209210**After Work**:211212- `/close-feature-agent <agent-path>` - Verify completion, sync status213214**Plan Management**:215216- `/create-feature-plan` - Create new plan217- `/update-feature-plan <plan>` - Modify existing plan218- `/list-feature-plans` - List all plans219220## Key Principles2212221. **Planning is cheap** - Be verbose, iterate2232. **Execution context is precious** - Minimal, dense2243. **Distill, don't copy** - Agent files are refined extracts2254. **Interfaces are boundaries** - Clear contracts enable parallelism2265. **One agent, one file** - Coherent context, no mental merging2276. **Close the loop** - Verify completion before moving on