feat: add /gsd:debug for systematic debugging with persistent state

- Creates .planning/debug/[slug].md immediately on command
- Continuous updates: file IS the debugging brain
- Clear section rules: OVERWRITE (Current Focus, Resolution) vs APPEND (Evidence, Eliminated)
- Survives /clear perfectly - resume from any interruption point
- Scientific method: evidence → hypothesis → test → eliminate or confirm
- Includes debugging reference files (mindset, hypothesis testing, investigation techniques)

Closes #53, closes #44

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-01-13 11:48:14 -06:00
parent 0821ebe254
commit f0b4c7d853
11 changed files with 2403 additions and 0 deletions

58
commands/gsd/debug.md Normal file
View File

@@ -0,0 +1,58 @@
---
name: gsd:debug
description: Systematic debugging with persistent state across context resets
argument-hint: [issue description]
allowed-tools:
- Read
- Write
- Edit
- Bash
- Grep
- Glob
- AskUserQuestion
---
<objective>
Debug issues using scientific method with a persistent debug document that survives `/clear`.
If resuming (no arguments and active session exists): pick up where you left off.
If starting new: gather symptoms, then investigate autonomously.
</objective>
<execution_context>
@~/.claude/get-shit-done/workflows/debug.md
@~/.claude/get-shit-done/templates/DEBUG.md
</execution_context>
<context>
User's issue: $ARGUMENTS
Check for active debug sessions:
```bash
ls .planning/debug/*.md 2>/dev/null | head -5
```
</context>
<process>
Follow the workflow in @~/.claude/get-shit-done/workflows/debug.md
**Quick reference:**
1. **Check for active sessions** - Offer to resume or start new
2. **Gather symptoms** - What happened? What should happen? Errors? When?
3. **Create DEBUG.md** - Document symptoms in `.planning/debug/[slug].md`
4. **Investigate** - Evidence → Hypothesis → Test → Eliminate or Confirm
5. **Fix and verify** - Minimal fix, verify against original symptoms
6. **Archive** - Move to `.planning/debug/resolved/`
**Key principle:** The DEBUG.md is your memory. Update it constantly. It survives `/clear`.
</process>
<success_criteria>
- [ ] Active sessions checked before starting new
- [ ] Symptoms gathered through AskUserQuestion (not inline questions)
- [ ] DEBUG.md tracks all investigation state
- [ ] Scientific method followed (not random fixes)
- [ ] Root cause confirmed with evidence before fixing
- [ ] Fix verified and session archived
</success_criteria>

View File

@@ -248,6 +248,20 @@ Review deferred issues with codebase context.
Usage: `/gsd:consider-issues`
### Debugging
**`/gsd:debug [issue description]`**
Systematic debugging with persistent state across context resets.
- Gathers symptoms through adaptive questioning
- Creates `.planning/debug/[slug].md` to track investigation
- Investigates using scientific method (evidence → hypothesis → test)
- Survives `/clear` — run `/gsd:debug` with no args to resume
- Archives resolved issues to `.planning/debug/resolved/`
Usage: `/gsd:debug "login button doesn't work"`
Usage: `/gsd:debug` (resume active session)
### Todo Management
**`/gsd:add-todo [description]`**
@@ -291,6 +305,8 @@ Show this command reference.
├── todos/ # Captured ideas and tasks
│ ├── pending/ # Todos waiting to be worked on
│ └── done/ # Completed todos
├── debug/ # Active debug sessions
│ └── resolved/ # Archived resolved issues
├── codebase/ # Codebase map (brownfield projects)
│ ├── STACK.md # Languages, frameworks, dependencies
│ ├── ARCHITECTURE.md # Patterns, layers, data flow
@@ -367,6 +383,15 @@ Change anytime by editing `.planning/config.json`
/gsd:check-todos api # Filter by area
```
**Debugging an issue:**
```
/gsd:debug "form submission fails silently" # Start debug session
# ... investigation happens, context fills up ...
/clear
/gsd:debug # Resume from where you left off
```
## Getting Help
- Read `.planning/PROJECT.md` for project vision

View File

@@ -58,6 +58,7 @@ If missing STATE.md or ROADMAP.md: inform what's missing, suggest running `/gsd:
- Note any blockers, concerns, or deferred issues
- Check for CONTEXT.md: For phases without PLAN.md files, check if `{phase}-CONTEXT.md` exists in phase directory
- Count pending todos: `ls .planning/todos/pending/*.md 2>/dev/null | wc -l`
- Check for active debug sessions: `ls .planning/debug/*.md 2>/dev/null | grep -v resolved | wc -l`
</step>
<step name="report">
@@ -87,6 +88,10 @@ CONTEXT: [✓ if CONTEXT.md exists | - if not]
## Pending Todos
- [count] pending — /gsd:check-todos to review
## Active Debug Sessions
- [count] active — /gsd:debug to continue
(Only show this section if count > 0)
## What's Next
[Next phase/plan objective from ROADMAP]
```