From a31f730f62a0d3050cd160ba250abebb646a6d33 Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Fri, 16 Jan 2026 18:48:43 -0600 Subject: [PATCH] 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 --- agents/gsd-phase-researcher.md | 10 +- agents/gsd-planner.md | 8 +- commands/gsd/plan-phase.md | 5 +- .../templates/research-subagent-prompt.md | 92 ------------------- get-shit-done/workflows/discuss-phase.md | 29 ++++-- get-shit-done/workflows/execute-phase.md | 4 +- get-shit-done/workflows/resume-project.md | 6 +- get-shit-done/workflows/verify-phase.md | 5 +- get-shit-done/workflows/verify-work.md | 5 +- 9 files changed, 47 insertions(+), 117 deletions(-) delete mode 100644 get-shit-done/templates/research-subagent-prompt.md diff --git a/agents/gsd-phase-researcher.md b/agents/gsd-phase-researcher.md index 8dd097190..069608f70 100644 --- a/agents/gsd-phase-researcher.md +++ b/agents/gsd-phase-researcher.md @@ -444,7 +444,9 @@ Orchestrator provides: **Load phase context (MANDATORY):** ```bash -PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1) +# Match both zero-padded (05-*) and unpadded (5-*) folders +PADDED_PHASE=$(printf "%02d" ${PHASE} 2>/dev/null || echo "${PHASE}") +PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE}-* 2>/dev/null | head -1) # Read CONTEXT.md if exists (from /gsd:discuss-phase) cat "${PHASE_DIR}"/*-CONTEXT.md 2>/dev/null @@ -518,14 +520,14 @@ Run through verification protocol checklist: Use the output format template. Populate all sections with verified findings. -Write to: `${PHASE_DIR}/${PHASE}-RESEARCH.md` +Write to: `${PHASE_DIR}/${PADDED_PHASE}-RESEARCH.md` Where `PHASE_DIR` is the full path (e.g., `.planning/phases/01-foundation`) ## Step 6: Commit Research ```bash -git add "${PHASE_DIR}/${PHASE}-RESEARCH.md" +git add "${PHASE_DIR}/${PADDED_PHASE}-RESEARCH.md" git commit -m "docs(${PHASE}): research phase domain Phase ${PHASE}: ${PHASE_NAME} @@ -558,7 +560,7 @@ When research finishes successfully: ### File Created -`${PHASE_DIR}/${PHASE}-RESEARCH.md` +`${PHASE_DIR}/${PADDED_PHASE}-RESEARCH.md` ### Confidence Assessment diff --git a/agents/gsd-planner.md b/agents/gsd-planner.md index b3b65a57d..09425e3e6 100644 --- a/agents/gsd-planner.md +++ b/agents/gsd-planner.md @@ -808,7 +808,9 @@ Triggered by `--gaps` flag. Creates plans to address verification or UAT failure **1. Find gap sources:** ```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) # Check for VERIFICATION.md (code verification gaps) ls "$PHASE_DIR"/*-VERIFICATION.md 2>/dev/null @@ -1076,7 +1078,9 @@ Understand: **Load phase-specific context files (MANDATORY):** ```bash -PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1) +# Match both zero-padded (05-*) and unpadded (5-*) folders +PADDED_PHASE=$(printf "%02d" ${PHASE} 2>/dev/null || echo "${PHASE}") +PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE}-* 2>/dev/null | head -1) # Read CONTEXT.md if exists (from /gsd:discuss-phase) cat "${PHASE_DIR}"/*-CONTEXT.md 2>/dev/null diff --git a/commands/gsd/plan-phase.md b/commands/gsd/plan-phase.md index 13f645e26..1e5e21a68 100644 --- a/commands/gsd/plan-phase.md +++ b/commands/gsd/plan-phase.md @@ -79,11 +79,12 @@ grep -A5 "Phase ${PHASE}:" .planning/ROADMAP.md 2>/dev/null ## 4. Ensure Phase Directory Exists ```bash -PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1) +# Match both zero-padded (05-*) and unpadded (5-*) folders +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 phase directory from roadmap name with zero-padded phase number PHASE_NAME=$(grep "Phase ${PHASE}:" .planning/ROADMAP.md | sed 's/.*Phase [0-9]*: //' | tr '[:upper:]' '[:lower:]' | tr ' ' '-') - PADDED_PHASE=$(printf "%02d" ${PHASE}) mkdir -p ".planning/phases/${PADDED_PHASE}-${PHASE_NAME}" PHASE_DIR=".planning/phases/${PADDED_PHASE}-${PHASE_NAME}" fi diff --git a/get-shit-done/templates/research-subagent-prompt.md b/get-shit-done/templates/research-subagent-prompt.md deleted file mode 100644 index ffe7fdbb0..000000000 --- a/get-shit-done/templates/research-subagent-prompt.md +++ /dev/null @@ -1,92 +0,0 @@ -# Research Subagent Prompt Template - -Template for spawning gsd-researcher agent. The agent contains all research expertise - this template provides research context only. - ---- - -## Template - -```markdown - -Research: {research_question} - -Mode: {research_mode} - - - -**Phase:** {phase_number} - {phase_name} -**Description:** {phase_description} - -**Requirements:** -{phase_requirements} - -**Constraints:** -{constraints_from_state} - -**Phase context (if available):** -{context_md_content} - - - -Write research findings to: {output_path} -Use RESEARCH.md template structure for phase research. - -``` - ---- - -## Placeholders - -| Placeholder | Source | Example | -|-------------|--------|---------| -| `{research_question}` | Phase description | `How to implement 3D visualization` | -| `{research_mode}` | Orchestrator sets | `ecosystem` | -| `{phase_number}` | From roadmap | `5` | -| `{phase_name}` | From roadmap | `3d-visualization` | -| `{phase_description}` | From roadmap | `Add interactive 3D model viewer` | -| `{phase_requirements}` | From REQUIREMENTS.md | `VIZ-01: Support GLB format` | -| `{constraints_from_state}` | From STATE.md decisions | `Using React, not Vue` | -| `{context_md_content}` | From CONTEXT.md | User's vision notes | -| `{output_path}` | Generated | `.planning/phases/5-viz/5-RESEARCH.md` | - ---- - -## Usage - -**From /gsd:research-phase:** -```python -Task( - prompt=filled_template, - subagent_type="gsd-researcher", - description="Research Phase {phase}" -) -``` - ---- - -## Continuation - -For checkpoints, spawn fresh agent with: - -```markdown - -Continue research for Phase {phase_number}: {phase_name} - - - -Research file: @{output_path} - - - -**Type:** {checkpoint_type} -**Response:** {user_response} - - - -Continue: {research_mode} - -``` - ---- - -**Note:** Research methodology, tool strategy (Context7 > Official > WebSearch), and verification protocols are baked into the gsd-researcher agent. This template only passes context. diff --git a/get-shit-done/workflows/discuss-phase.md b/get-shit-done/workflows/discuss-phase.md index b9fd94eca..23eb60210 100644 --- a/get-shit-done/workflows/discuss-phase.md +++ b/get-shit-done/workflows/discuss-phase.md @@ -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. 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" diff --git a/get-shit-done/workflows/execute-phase.md b/get-shit-done/workflows/execute-phase.md index 298941161..a4eb804bb 100644 --- a/get-shit-done/workflows/execute-phase.md +++ b/get-shit-done/workflows/execute-phase.md @@ -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 diff --git a/get-shit-done/workflows/resume-project.md b/get-shit-done/workflows/resume-project.md index 57acd090e..30d17d1ca 100644 --- a/get-shit-done/workflows/resume-project.md +++ b/get-shit-done/workflows/resume-project.md @@ -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 diff --git a/get-shit-done/workflows/verify-phase.md b/get-shit-done/workflows/verify-phase.md index 4ac36cad1..2333fe612 100644 --- a/get-shit-done/workflows/verify-phase.md +++ b/get-shit-done/workflows/verify-phase.md @@ -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 diff --git a/get-shit-done/workflows/verify-work.md b/get-shit-done/workflows/verify-work.md index f26c1fba3..d92a7411c 100644 --- a/get-shit-done/workflows/verify-work.md +++ b/get-shit-done/workflows/verify-work.md @@ -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