fix: auto-advance chain broken — Skills don't resolve inside Task subagents (#669)

The `--auto` flag on discuss-phase and plan-phase chains stages automatically:
discuss → plan → execute, each in a fresh context window. Currently the chain
is broken because auto-advance spawns `Task(prompt="Run /gsd:plan-phase --auto")`
which requires the Skill tool — but Skills don't resolve inside Task subagents.

Result: plan-phase never runs from discuss's auto-advance, execute-phase never
runs from plan's auto-advance, and gsd-executor subagents are never spawned.

Fix: Replace `Task(prompt="Run /gsd:XXX")` with Task calls that tell the
subagent to read the workflow .md file directly via @file references — the same
pattern that already works for gsd-executor spawning in execute-phase.

Changes:
- execute-phase.md: Add --no-transition flag handling so execute-phase can
  return status to parent instead of running transition.md when spawned by
  plan-phase's auto-advance
- plan-phase.md: Replace Skill-based Task call with direct @file reference
  to execute-phase.md, passing --no-transition to prevent transition chaining
- discuss-phase.md: Replace Skill-based Task call with direct @file reference
  to plan-phase.md, with richer return status handling (PHASE COMPLETE,
  PLANNING COMPLETE, PLANNING INCONCLUSIVE, GAPS FOUND)

Nesting depth: discuss → Task(plan) → Task(execute) → Task(executor) = 3 levels
max. Each level gets clean 200k context.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
min-k-khant
2026-02-20 12:41:22 -08:00
committed by GitHub
parent 7542d364b4
commit 131f24b5cd
3 changed files with 100 additions and 9 deletions

View File

@@ -460,23 +460,65 @@ Display banner:
Context captured. Spawning plan-phase...
```
Spawn plan-phase as Task:
Spawn plan-phase as Task with direct workflow file reference (do NOT use Skill tool — Skills don't resolve inside Task subagents):
```
Task(
prompt="Run /gsd:plan-phase ${PHASE} --auto",
prompt="
<objective>
You are the plan-phase orchestrator. Create executable plans for Phase ${PHASE}: ${PHASE_NAME}, then auto-advance to execution.
</objective>
<execution_context>
@~/.claude/get-shit-done/workflows/plan-phase.md
@~/.claude/get-shit-done/references/ui-brand.md
@~/.claude/get-shit-done/references/model-profile-resolution.md
</execution_context>
<arguments>
PHASE=${PHASE}
ARGUMENTS='${PHASE} --auto'
</arguments>
<instructions>
1. Read plan-phase.md from execution_context for your complete workflow
2. Follow ALL steps: initialize, validate, load context, research, plan, verify, auto-advance
3. When spawning agents (gsd-phase-researcher, gsd-planner, gsd-plan-checker), use Task with specified subagent_type and model
4. For step 14 (auto-advance to execute): spawn execute-phase as a Task with DIRECT file reference — tell it to read execute-phase.md. Include @file refs to execute-phase.md, checkpoints.md, tdd.md, model-profile-resolution.md. Pass --no-transition flag so execute-phase returns results instead of chaining further.
5. Do NOT use the Skill tool or /gsd: commands. Read workflow .md files directly.
6. Return: PHASE COMPLETE (full pipeline success), PLANNING COMPLETE (planning done but execute failed/skipped), PLANNING INCONCLUSIVE, or GAPS FOUND
</instructions>
",
subagent_type="general-purpose",
description="Plan Phase ${PHASE}"
)
```
**Handle plan-phase return:**
- **PLANNING COMPLETE** → Plan-phase handles chaining to execute-phase (via its own auto_advance step)
- **PLANNING INCONCLUSIVE / CHECKPOINT** → Display result, stop chain:
- **PHASE COMPLETE** → Full chain succeeded. Display:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GSD ► PHASE ${PHASE} COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Auto-advance pipeline finished: discuss → plan → execute
Next: /gsd:discuss-phase ${NEXT_PHASE} --auto
<sub>/clear first → fresh context window</sub>
```
- **PLANNING COMPLETE** → Planning done, execution didn't complete:
```
Auto-advance partial: Planning complete, execution did not finish.
Continue: /gsd:execute-phase ${PHASE}
```
- **PLANNING INCONCLUSIVE / CHECKPOINT** → Stop chain:
```
Auto-advance stopped: Planning needs input.
Review the output above and continue manually:
/gsd:plan-phase ${PHASE}
Continue: /gsd:plan-phase ${PHASE}
```
- **GAPS FOUND** → Stop chain:
```
Auto-advance stopped: Gaps found during execution.
Continue: /gsd:plan-phase ${PHASE} --gaps
```
**If neither `--auto` nor config enabled:**

View File

@@ -383,6 +383,29 @@ node ~/.claude/get-shit-done/bin/gsd-tools.cjs commit "docs(phase-{X}): complete
**Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/gsd:plan-phase {X} --gaps`). No additional routing needed — skip auto-advance.
**No-transition check (spawned by auto-advance chain):**
Parse `--no-transition` flag from $ARGUMENTS.
**If `--no-transition` flag present:**
Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
After verification passes and roadmap is updated, return completion status to parent:
```
## PHASE COMPLETE
Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
Plans: ${completed_count}/${total_count}
Verification: {Passed | Gaps Found}
[Include aggregate_results output]
```
STOP. Do not proceed to auto-advance or transition.
**If `--no-transition` flag is NOT present:**
**Auto-advance detection:**
1. Parse `--auto` flag from $ARGUMENTS

View File

@@ -366,10 +366,36 @@ Display banner:
Plans ready. Spawning execute-phase...
```
Spawn execute-phase as Task:
Spawn execute-phase as Task with direct workflow file reference (do NOT use Skill tool — Skills don't resolve inside Task subagents):
```
Task(
prompt="Run /gsd:execute-phase ${PHASE} --auto",
prompt="
<objective>
You are the execute-phase orchestrator. Execute all plans for Phase ${PHASE}: ${PHASE_NAME}.
</objective>
<execution_context>
@~/.claude/get-shit-done/workflows/execute-phase.md
@~/.claude/get-shit-done/references/checkpoints.md
@~/.claude/get-shit-done/references/tdd.md
@~/.claude/get-shit-done/references/model-profile-resolution.md
</execution_context>
<arguments>
PHASE=${PHASE}
ARGUMENTS='${PHASE} --auto --no-transition'
</arguments>
<instructions>
1. Read execute-phase.md from execution_context for your complete workflow
2. Follow ALL steps: initialize, handle_branching, validate_phase, discover_and_group_plans, execute_waves, aggregate_results, close_parent_artifacts, verify_phase_goal, update_roadmap
3. The --no-transition flag means: after verification + roadmap update, STOP and return status. Do NOT run transition.md.
4. When spawning executor agents, use subagent_type='gsd-executor' with the existing @file pattern from the workflow
5. When spawning verifier agents, use subagent_type='gsd-verifier'
6. Preserve the classifyHandoffIfNeeded workaround (spot-check on that specific error)
7. Do NOT use the Skill tool or /gsd: commands
</instructions>
",
subagent_type="general-purpose",
description="Execute Phase ${PHASE}"
)