fix: phase directory matching and orphaned references

- Support both zero-padded (05-*) and unpadded (5-*) phase folders
- Delete orphaned research-subagent-prompt.md template
- Update resume-project.md to use Task tool resume parameter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-01-16 18:48:43 -06:00
parent ed533f307f
commit a31f730f62
9 changed files with 47 additions and 117 deletions

View File

@@ -109,8 +109,9 @@ Exit workflow.
Check if CONTEXT.md already exists:
```bash
ls .planning/phases/${PHASE}-*/CONTEXT.md 2>/dev/null
ls .planning/phases/${PHASE}-*/${PHASE}-CONTEXT.md 2>/dev/null
# Match both zero-padded (05-*) and unpadded (5-*) folders
PADDED_PHASE=$(printf "%02d" ${PHASE})
ls .planning/phases/${PADDED_PHASE}-*/CONTEXT.md .planning/phases/${PADDED_PHASE}-*/${PADDED_PHASE}-CONTEXT.md .planning/phases/${PHASE}-*/CONTEXT.md .planning/phases/${PHASE}-*/${PHASE}-CONTEXT.md 2>/dev/null
```
**If exists:**
@@ -229,11 +230,21 @@ Track deferred ideas internally.
<step name="write_context">
Create CONTEXT.md capturing decisions made.
**File location:** `.planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md`
**Find or create phase directory:**
Zero-pad the phase number: `PADDED_PHASE=$(printf "%02d" ${PHASE})`
```bash
# Match existing directory (padded or unpadded)
PADDED_PHASE=$(printf "%02d" ${PHASE})
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE}-* 2>/dev/null | head -1)
if [ -z "$PHASE_DIR" ]; then
# Create from roadmap name (lowercase, hyphens)
PHASE_NAME=$(grep "Phase ${PHASE}:" .planning/ROADMAP.md | sed 's/.*Phase [0-9]*: //' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
mkdir -p ".planning/phases/${PADDED_PHASE}-${PHASE_NAME}"
PHASE_DIR=".planning/phases/${PADDED_PHASE}-${PHASE_NAME}"
fi
```
Create phase directory if it doesn't exist. Use roadmap phase name for slug (lowercase, hyphens).
**File location:** `${PHASE_DIR}/${PADDED_PHASE}-CONTEXT.md`
**Structure the content by what was discussed:**
@@ -334,18 +345,18 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
Commit phase context:
```bash
git add .planning/phases/${PHASE}-${SLUG}/${PHASE}-CONTEXT.md
git add "${PHASE_DIR}/${PADDED_PHASE}-CONTEXT.md"
git commit -m "$(cat <<'EOF'
docs(${PHASE}): capture phase context
docs(${PADDED_PHASE}): capture phase context
Phase ${PHASE}: ${PHASE_NAME}
Phase ${PADDED_PHASE}: ${PHASE_NAME}
- Implementation decisions documented
- Phase boundary established
EOF
)"
```
Confirm: "Committed: docs(${PHASE}): capture phase context"
Confirm: "Committed: docs(${PADDED_PHASE}): capture phase context"
</step>
</process>

View File

@@ -39,7 +39,9 @@ Options:
Confirm phase exists and has plans:
```bash
PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
# Match both zero-padded (05-*) and unpadded (5-*) folders
PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
if [ -z "$PHASE_DIR" ]; then
echo "ERROR: No phase directory matching '${PHASE_ARG}'"
exit 1

View File

@@ -121,7 +121,7 @@ Present complete project status to user:
Task: [task description from agent-history.json]
Interrupted: [timestamp]
Resume with: /gsd:resume-task
Resume with: Task tool (resume parameter with agent ID)
[If pending todos exist:]
📋 [N] pending todos — /gsd:check-todos to review
@@ -141,7 +141,7 @@ Present complete project status to user:
Based on project state, determine the most logical next action:
**If interrupted agent exists:**
→ Primary: Resume interrupted agent (/gsd:resume-task)
→ Primary: Resume interrupted agent (Task tool with resume parameter)
→ Option: Start fresh (abandon agent work)
**If .continue-here file exists:**
@@ -178,7 +178,7 @@ Present contextual options based on project state:
What would you like to do?
[Primary action based on state - e.g.:]
1. Resume interrupted agent (/gsd:resume-task) [if interrupted agent found]
1. Resume interrupted agent [if interrupted agent found]
OR
1. Execute phase (/gsd:execute-phase {phase})
OR

View File

@@ -29,8 +29,9 @@ Then verify each level against the actual codebase.
**Gather all verification context:**
```bash
# Phase directory
PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
# Phase directory (match both zero-padded and unpadded)
PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
# Phase goal from ROADMAP
grep -A 5 "Phase ${PHASE_NUM}" .planning/ROADMAP.md

View File

@@ -73,8 +73,9 @@ Continue to `create_uat_file`.
Parse $ARGUMENTS as phase number (e.g., "4") or plan number (e.g., "04-02").
```bash
# Find phase directory
PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
# Find phase directory (match both zero-padded and unpadded)
PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
# Find SUMMARY files
ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null