refactor: move requirements status update to commands (orchestrator)

Subagents can't determine if phase is complete. The orchestrator
(execute-plan and execute-phase commands) runs in main context,
can count plans vs summaries, and updates REQUIREMENTS.md when
phase completes.

- execute-plan: Step 2.5 updates requirements when summaries = plans
- execute-phase: Step 6 updates requirements (phase always complete)
- Removed duplicate from workflow (subagent can't run it anyway)
This commit is contained in:
Lex Christopherson
2026-01-15 00:20:00 -06:00
parent e1b6655d57
commit 365c04163c
3 changed files with 28 additions and 49 deletions

View File

@@ -64,7 +64,16 @@ Phase: $ARGUMENTS
- Report phase completion status
- Update ROADMAP.md
6. **Offer next steps**
6. **Update requirements**
Phase is complete, so mark its requirements as Complete:
- Read ROADMAP.md, find this phase's `Requirements:` line (e.g., "AUTH-01, AUTH-02")
- Read REQUIREMENTS.md traceability table
- For each REQ-ID in this phase: change Status from "Pending" to "Complete"
- Write updated REQUIREMENTS.md
- Stage for commit: `git add .planning/REQUIREMENTS.md`
- Skip if: REQUIREMENTS.md doesn't exist, or phase has no Requirements line
7. **Offer next steps**
- Route to next action (see `<offer_next>`)
</process>
@@ -207,5 +216,6 @@ After all tasks complete:
- [ ] Each plan has SUMMARY.md
- [ ] STATE.md reflects phase completion
- [ ] ROADMAP.md updated
- [ ] REQUIREMENTS.md updated (phase requirements marked Complete)
- [ ] User informed of next steps
</success_criteria>

View File

@@ -108,7 +108,20 @@ ls -1 .planning/phases/[phase-dir]/*-SUMMARY.md 2>/dev/null | wc -l
| Condition | Action |
|-----------|--------|
| summaries < plans | More plans remain → Route A |
| summaries = plans | Phase complete → Check milestone (Step 3) |
| summaries = plans | Phase complete → Update requirements, then Step 3 |
**Step 2.5: Update requirements (only when phase complete)**
When summaries = plans, update REQUIREMENTS.md before presenting completion:
1. Get phase number from completed plan path
2. Read ROADMAP.md, find the phase's `Requirements:` line (e.g., "AUTH-01, AUTH-02")
3. Read REQUIREMENTS.md traceability table
4. For each REQ-ID in this phase: change Status from "Pending" to "Complete"
5. Write updated REQUIREMENTS.md
6. Stage for commit: `git add .planning/REQUIREMENTS.md`
**Skip if:** REQUIREMENTS.md doesn't exist, or phase has no Requirements line in ROADMAP.md.
---
@@ -322,5 +335,6 @@ Templates for checkpoint handling:
<success_criteria>
- [ ] Plan executed (SUMMARY.md created)
- [ ] All checkpoints handled
- [ ] If phase complete: REQUIREMENTS.md updated (phase requirements marked Complete)
- [ ] User informed of completion and next steps
</success_criteria>

View File

@@ -1493,49 +1493,6 @@ ROADMAP_FILE=".planning/ROADMAP.md"
- Add completion date
</step>
<step name="update_requirements_status">
**Only run when phase is complete (all plans have SUMMARYs).**
When a phase completes, mark its requirements as Complete in REQUIREMENTS.md.
**1. Get phase number from completed plan:**
```bash
# Extract phase number from plan path (e.g., 03-auth/03-02-PLAN.md → 03)
PHASE_NUM=$(echo "$PLAN_PATH" | grep -oE '[0-9]+' | head -1)
```
**2. Find requirements for this phase in ROADMAP.md:**
```bash
# Look for Requirements: line in phase section
grep -A5 "Phase ${PHASE_NUM}:" .planning/ROADMAP.md | grep "Requirements:"
```
Extract the REQ-IDs (e.g., "AUTH-01, AUTH-02, AUTH-03").
**3. Update REQUIREMENTS.md traceability table:**
For each REQ-ID covered by this phase:
- Find the row in the Traceability table
- Change Status from "Pending" to "Complete"
Example before:
```markdown
| AUTH-01 | Phase 1 | Pending |
| AUTH-02 | Phase 1 | Pending |
```
Example after:
```markdown
| AUTH-01 | Phase 1 | Complete |
| AUTH-02 | Phase 1 | Complete |
```
**4. Skip if:**
- REQUIREMENTS.md doesn't exist (older projects without requirements tracking)
- Phase has no Requirements: line in ROADMAP.md
- More plans remain in phase (not yet complete)
</step>
<step name="git_commit_metadata">
Commit execution metadata (SUMMARY + STATE + ROADMAP):
@@ -1549,19 +1506,17 @@ git add .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md
git add .planning/STATE.md
```
**2. Stage roadmap and requirements (if updated):**
**2. Stage roadmap:**
```bash
git add .planning/ROADMAP.md
# Only if phase completed and requirements were updated:
[ -f .planning/REQUIREMENTS.md ] && git add .planning/REQUIREMENTS.md
```
**3. Verify staging:**
```bash
git status
# Should show only execution artifacts (SUMMARY, STATE, ROADMAP, REQUIREMENTS), no code files
# Should show only execution artifacts (SUMMARY, STATE, ROADMAP), no code files
```
**4. Commit metadata:**