Why /gsd:debug Exists
Debugging in chat sessions burns context fast - you read files, form hypotheses, test theories, and accumulate investigation artifacts. By the time you find the root cause, your context is polluted. GSD isolates debugging in fresh subagent contexts with persistent state across investigations.How It Works
Gather symptoms
The orchestrator asks structured questions about the issue:
- Expected behavior
- Actual behavior
- Error messages
- Timeline (when did it start?)
- Reproduction steps
Spawn debugger agent
A fresh
gsd-debugger agent gets:- Full symptom context
- 200K clean context window
- Instructions to write findings to
.planning/debug/{slug}.md
Investigation
The debugger uses scientific method:
- Form hypothesis
- Design test
- Execute test
- Record evidence
- Confirm or refute
- Repeat until root cause found
Checkpoints
When human input is needed, the debugger writes a checkpoint and returns. You respond, and a continuation agent spawns with the debug file as context.
Basic Usage
Start new debug session
Resume active session
- Current hypothesis
- Evidence gathered
- Next action
Debug File Structure
Each debug session creates a persistent file:Checkpoint Types
The debugger may return checkpoints for human input:| Checkpoint Type | When Used | Example |
|---|---|---|
human-verify | Need you to test something | ”Can you try logging in now?” |
clarification | Need more context | ”What’s the exact error message?” |
permission | Need approval to proceed | ”This requires database access. Proceed?” |
decision | Multiple paths forward | ”Fix now or plan properly?” |
Handling Debugger Returns
- Root Cause Found
- Checkpoint Reached
- Investigation Inconclusive
Continuation Flow
When you respond to a checkpoint:- Reads
.planning/debug/users-cant-login.md - Sees the checkpoint
- Processes your response
- Decides whether to finalize/resolve or continue investigating
Modes
The debugger has two modes:find_and_fix (default)
Investigates and fixes if the fix is simple and safe:
- Single-file changes
- Config adjustments
- Clear, low-risk fixes
investigate_only
Investigates but never touches code. Use when:
- You want diagnosis only
- The fix requires careful planning
- Multiple services are involved
Examples
Best Practices
Do:
- Be specific when describing symptoms
- Include error messages verbatim
- Note timeline (when did it start?)
- Provide reproduction steps if known
- Let debugger finish before trying fixes
Don’t:
- Start debugging in main chat (wastes context)
- Assume root cause (let debugger investigate)
- Fix without understanding (may mask deeper issues)
- Ignore checkpoints (debugger needs feedback)
When to Use /gsd:debug vs /gsd:quick
- Use /gsd:debug When...
- Use /gsd:quick When...
- You don’t know the root cause
- Multiple possible causes
- Issue is intermittent or environmental
- Need systematic investigation
- Want evidence trail for postmortem
- Complex system interactions
Integration with Phases
If debugging reveals a complex issue:Model Selection
The debugger agent respects your model profile:| Profile | Debugger Model |
|---|---|
| quality | Opus |
| balanced | Sonnet |
| budget | Sonnet |
Archival
When a debug session resolves:Context Efficiency
The debug orchestrator stays lean:- Gathers symptoms - Structured questions
- Spawns agent - Fresh 200K context
- Receives checkpoint - Brief summary only
- Spawns continuation - Fresh context again
Debug sessions can spawn multiple continuation agents if needed. Each gets a fresh context, ensuring investigation quality never degrades.