Plan a feature before implementation (Two-Phase Pattern - Phase 1):
Arguments: $ARGUMENTS
Core Principle
Separate planning from implementation for better outcomes.
This is Phase 1: Planning. Phase 2 is /implement.
Phase 1: Load Context
- Parse feature ID from arguments
- Read feature from .claude-harness/features/active.json (or .claude-harness/feature-list.json for v2.x compat)
- Read compiled context from .claude-harness/memory/working/context.json
- Read semantic memory for project architecture
Phase 2: Analyze Requirements
- Break down feature into sub-tasks
- Identify files to create/modify
- Identify dependencies on other features/modules
Phase 3: Impact Analysis
- Read .claude-harness/impact/dependency-graph.json
- For each file to modify:
- Identify dependent files (importedBy)
- Identify related tests
- Calculate impact score
- Warn if high-impact changes detected
Phase 4: Check Past Approaches
- Read .claude-harness/memory/procedural/failures.json
- Check if planned approach matches any past failures
- If match found:
- Warn about similar past failure
- Show root cause and prevention tips
- Suggest alternative approach from successes.json
Phase 5: Generate Tests (if not done)
- If feature.tests.generated = false:
- Automatically run test generation
- Or prompt to run /generate-tests first
Phase 6: Create Implementation Plan
- Write implementation plan to feature:
{
"plan": {
"steps": [
{"step": 1, "description": "...", "files": [...]},
...
],
"estimatedFiles": ["file1.ts", "file2.ts"],
"impactScore": "low|medium|high",
"risks": ["..."],
"mitigations": ["..."]
}
}
Phase 7: Update Feature
- Update feature in active.json:
- Set phase to "planned"
- Store implementation plan
Phase 8: Report
- Report:
- Implementation steps
- Files to modify
- Impact analysis
- Risks and mitigations
- Past failures to avoid
- Next: Run
/claude-harness:implement feature-XXX to start coding