Merge pull request #1549 from Tibsfox/fix/debug-diagnose-only-1396-v2

feat(debug): add --diagnose flag for diagnosis-only mode
This commit is contained in:
Tom Boucher
2026-04-02 17:54:54 -04:00
committed by GitHub

View File

@@ -1,7 +1,7 @@
--- ---
name: gsd:debug name: gsd:debug
description: Systematic debugging with persistent state across context resets description: Systematic debugging with persistent state across context resets
argument-hint: [issue description] argument-hint: [--diagnose] [issue description]
allowed-tools: allowed-tools:
- Read - Read
- Bash - Bash
@@ -15,6 +15,9 @@ Debug issues using scientific method with subagent isolation.
**Orchestrator role:** Gather symptoms, spawn gsd-debugger agent, handle checkpoints, spawn continuations. **Orchestrator role:** Gather symptoms, spawn gsd-debugger agent, handle checkpoints, spawn continuations.
**Why subagent:** Investigation burns context fast (reading files, forming hypotheses, testing). Fresh 200k context per investigation. Main context stays lean for user interaction. **Why subagent:** Investigation burns context fast (reading files, forming hypotheses, testing). Fresh 200k context per investigation. Main context stays lean for user interaction.
**Flags:**
- `--diagnose` — Diagnose only. Find root cause without applying a fix. Returns a structured Root Cause Report. Use when you want to validate the diagnosis before committing to a fix.
</objective> </objective>
<available_agent_types> <available_agent_types>
@@ -25,6 +28,10 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo
<context> <context>
User's issue: $ARGUMENTS User's issue: $ARGUMENTS
Parse flags from $ARGUMENTS:
- If `--diagnose` is present, set `diagnose_only=true` and remove the flag from the issue description.
- Otherwise, `diagnose_only=false`.
Check for active sessions: Check for active sessions:
```bash ```bash
ls .planning/debug/*.md 2>/dev/null | grep -v resolved | head -5 ls .planning/debug/*.md 2>/dev/null | grep -v resolved | head -5
@@ -87,7 +94,7 @@ timeline: {timeline}
<mode> <mode>
symptoms_prefilled: true symptoms_prefilled: true
goal: find_and_fix goal: {if diagnose_only: "find_root_cause_only", else: "find_and_fix"}
</mode> </mode>
<debug_file> <debug_file>
@@ -106,12 +113,18 @@ Task(
## 4. Handle Agent Return ## 4. Handle Agent Return
**If `## ROOT CAUSE FOUND`:** **If `## ROOT CAUSE FOUND` (diagnose-only mode):**
- Display root cause and evidence summary - Display root cause, confidence level, files involved, and suggested fix strategies
- Offer options: - Offer options:
- "Fix now" - spawn fix subagent - "Fix now" — spawn a continuation agent with `goal: find_and_fix` to apply the fix (see step 5)
- "Plan fix" - suggest /gsd:plan-phase --gaps - "Plan fix" — suggest `/gsd:plan-phase --gaps`
- "Manual fix" - done - "Manual fix" — done
**If `## DEBUG COMPLETE` (find_and_fix mode):**
- Display root cause and fix summary
- Offer options:
- "Plan fix" — suggest `/gsd:plan-phase --gaps` if further work needed
- "Done" — mark resolved
**If `## CHECKPOINT REACHED`:** **If `## CHECKPOINT REACHED`:**
- Present checkpoint details to user - Present checkpoint details to user
@@ -128,9 +141,9 @@ Task(
- "Manual investigation" - done - "Manual investigation" - done
- "Add more context" - gather more symptoms, spawn again - "Add more context" - gather more symptoms, spawn again
## 5. Spawn Continuation Agent (After Checkpoint) ## 5. Spawn Continuation Agent (After Checkpoint or "Fix now")
When user responds to checkpoint, spawn fresh agent: When user responds to checkpoint OR selects "Fix now" from diagnose-only results, spawn fresh agent:
```markdown ```markdown
<objective> <objective>