Coder Add-Feature
Add a new feature to an EXISTING codebase using eri-coder workflow. Designed for brownfield development - modifying projects that already have code.
Dynamic Context
CLI analysis:
!python3 -m erirpg.commands.add_feature $ARGUMENTS --json 2>/dev/null || echo '{"error": "CLI failed"}'
Codebase mapping status:
!ls .planning/codebase/*.md 2>/dev/null | head -5 || echo "NOT_MAPPED"
Existing features:
!ls -d .planning/features/*/ 2>/dev/null | head -5 || echo "none"
Two Modes
Standard Mode
Add new features to a codebase:
python3 -m erirpg.commands.add_feature "<feature-description>" --json
Reference Mode (Feature Porting)
Port a feature from another program using behavior specs:
python3 -m erirpg.commands.add_feature <target> <feature> "<desc>" --reference <source>/<section> --json
Example:
python3 -m erirpg.commands.add_feature eritrainer sana "Sana model" --reference onetrainer/models/sana --json
Prerequisites
- •Must be in a project root (package.json, Cargo.toml, pyproject.toml, go.mod)
- •Codebase should be mapped (auto-runs
/coder:map-codebaseif not)
Output Structure
.planning/features/{feature-name}/
├── SPEC.md # Feature specification
├── CONTEXT.md # Discussion decisions (optional)
├── RESEARCH.md # Technical research (if needed)
├── PLAN-*.md # Implementation plans
└── SUMMARY.md # Completion summary
Workflow Steps
Step 1: Validate Environment
Check project root and codebase mapping status. See reference.md.
Step 2: Load Codebase Context
Read STACK.md, ARCHITECTURE.md, CONVENTIONS.md from .planning/codebase/.
See reference.md.
Step 3: Feature Discussion
Ask clarifying questions with AskUserQuestion. See reference.md.
Step 4: Write Feature Spec
Create SPEC.md with problem, user stories, acceptance criteria. See reference.md.
Step 5: Context Discussion (Optional)
Discuss UI, API, or complex decisions if needed. See reference.md.
Step 6: Research Phase (If Needed)
Spawn eri-phase-researcher for non-trivial features.
See reference.md.
Step 7: Create Implementation Plan
Spawn eri-planner with full context.
See reference.md.
Step 8: Plan Verification
Spawn eri-plan-checker to verify coverage.
See reference.md.
Step 9: Execute
Show summary, confirm with user, spawn eri-executor agents.
See reference.md.
Step 10: Verification
Verify criteria met, create SUMMARY.md, commit. See reference.md.
Reference Mode Details
For porting features from another program, see reference.md.
Key insight: Behavior specs are portable, implementation details are not.
Agent Strategy
| Task | Agent | Model |
|---|---|---|
| Codebase mapping | eri-codebase-mapper | sonnet |
| Research | eri-phase-researcher | sonnet |
| Planning | eri-planner | sonnet/opus |
| Execution | eri-executor | sonnet |
| Verification | eri-verifier | sonnet/haiku |
Key Principles
- •ALWAYS respect existing codebase patterns
- •NEVER create new patterns when existing ones work
- •Read CONVENTIONS.md before writing ANY code
- •Integrate at the RIGHT place (check ARCHITECTURE.md)
- •Update existing tests if modifying tested code
Completion
Use templates/completion-box.md format.