Skip to content

Recipe: Fix a Bug

A bug has been reported or you’ve discovered an issue that needs investigation. You want GSD to manage the full lifecycle: create a milestone, research the codebase, plan a fix, execute it, and verify the result. This recipe walks through a real example using the full milestone flow.

Use the full lifecycle when the bug might be non-trivial — when you’re not sure of the root cause, when the fix might touch multiple files, or when you want GSD’s structured verification to confirm the fix works. For simple one-line fixes, consider the small change recipe instead.

  • GSD installed and available in your terminal
  • A project with a .gsd/ directory (run /gsd to start one if needed)
  • A bug to fix — either a report from a user or an issue you’ve noticed

The scenario: A Cookmate user reports that searching for “Pasta” returns no results, but searching for “pasta” (lowercase) works fine. The search is case-sensitive when it shouldn’t be.

Run /gsd and describe the bug when the smart entry wizard asks what you’re working on. Or, if you already have an active project and want to jump straight to milestone creation for this bug, run /gsd new-milestone:

> /gsd new-milestone
What's the goal for this milestone?
> Users are reporting that search in Cookmate is case-sensitive.
> Searching for "Pasta" returns nothing, but "pasta" works.
> This should be a case-insensitive search.

GSD asks clarifying questions to lock down scope — such as whether the issue is in the API query, the database index, or the frontend — then writes a milestone context file.

After the conversation, GSD writes the milestone brief to disk:

.gsd/
└── milestones/
└── M003/
└── M003-CONTEXT.md ← bug scope, root cause hypothesis, fix approach

The context file captures what was discussed: the symptoms, the suspected root cause (PostgreSQL LIKE is case-sensitive by default), and the agreed approach (switch to ILIKE or add a LOWER() wrapper).

After the context file and STATE.md are written, auto-mode starts automatically. If it doesn’t, run:

> /gsd auto

GSD dispatches units in sequence:

  1. Milestone Research — scouts the codebase for search-related code, checks Prisma docs for case-insensitive query options
  2. Slice Research — zooms in on the specific slice goal and integration points. For a focused single-slice bug fix, this step may be skipped if the milestone research already covered the relevant code.
  3. Plan the slice — breaks the slice into tasks (update query, add tests, verify)
.gsd/
└── milestones/
└── M003/
├── M003-CONTEXT.md
├── M003-RESEARCH.md ← found: searchRecipes() in lib/search.ts uses where: { title: { contains: query } }
├── M003-ROADMAP.md ← S01: Fix case-sensitive search
└── slices/
└── S01/
├── S01-RESEARCH.md
├── S01-PLAN.md
└── tasks/
├── T01-PLAN.md ← update query to use case-insensitive mode
└── T02-PLAN.md ← add test cases for mixed-case search

GSD executes each task in a fresh context window. For this bug fix:

  • T01 updates the Prisma query from contains: query to contains: query, mode: 'insensitive'
  • T02 adds test cases verifying that “Pasta”, “PASTA”, and “pasta” all return the same results

Each task writes a summary when done, documenting what changed and what was verified. Each summary is automatically committed with a meaningful commit message.

After the last task, GSD runs slice-level and milestone-level completion in sequence:

  • Writes a slice summary compressing all task work
  • Writes a UAT script with concrete test cases
  • Marks the slice done in the roadmap
  • Executes automated UAT checks against the completed slice — confirms mixed-case searches return results
  • Reassesses the roadmap — confirms no further slices are needed (requires phases.reassess_after_slice preference)
  • Validates the milestone against the original success criteria
  • Seals the milestone with a completion summary
.gsd/
└── milestones/
└── M003/
├── M003-CONTEXT.md
├── M003-RESEARCH.md
├── M003-ROADMAP.md ← S01 ✓ checked off
├── M003-VALIDATION.md ← milestone QA check
├── M003-SUMMARY.md ← milestone completion record
└── slices/
└── S01/
├── S01-RESEARCH.md
├── S01-PLAN.md
├── S01-SUMMARY.md ← compressed slice record
├── S01-UAT.md ← test script for manual verification
├── S01-UAT-RESULT.md ← automated UAT execution results
├── S01-ASSESSMENT.md ← roadmap reassessment notes (opt-in)
└── tasks/
├── T01-PLAN.md
├── T01-SUMMARY.md
├── T02-PLAN.md
└── T02-SUMMARY.md
FilePurpose
.gsd/milestones/M003/M003-CONTEXT.mdBug scope, root cause hypothesis, fix approach
.gsd/milestones/M003/M003-RESEARCH.mdCodebase findings — what code does what
.gsd/milestones/M003/M003-ROADMAP.mdSlice structure with completion checkboxes
.gsd/milestones/M003/slices/S01/S01-RESEARCH.mdSlice-level research and integration points
.gsd/milestones/M003/slices/S01/S01-PLAN.mdTask breakdown for the fix slice
.gsd/milestones/M003/slices/S01/tasks/T##-PLAN.mdIndividual task plans
.gsd/milestones/M003/slices/S01/tasks/T##-SUMMARY.mdTask completion records
.gsd/milestones/M003/slices/S01/S01-SUMMARY.mdCompressed slice record
.gsd/milestones/M003/slices/S01/S01-UAT.mdAcceptance test script
.gsd/milestones/M003/slices/S01/S01-UAT-RESULT.mdAutomated UAT execution results
.gsd/milestones/M003/slices/S01/S01-ASSESSMENT.mdRoadmap reassessment after slice completes (opt-in via phases.reassess_after_slice)
.gsd/milestones/M003/M003-VALIDATION.mdMilestone QA check against original success criteria
.gsd/milestones/M003/M003-SUMMARY.mdMilestone completion record
FilePurpose
.gsd/STATE.mdCurrent project state to determine next unit
.gsd/KNOWLEDGE.mdAccumulated gotchas and patterns
.gsd/DECISIONS.mdArchitectural decisions that constrain the fix
.gsd/OVERRIDES.mdAny user-issued steering overrides
FilePurpose
.gsd/STATE.mdUpdated after each unit completes
.gsd/KNOWLEDGE.mdAny new patterns discovered (e.g., Prisma mode flag)
.gsd/gsd.dbSQLite database opened or auto-migrated at startup — tracks units, metrics, and routing history
.gsd/completed-units.jsonDisk-backed idempotency log — prevents double-dispatch on restart
.gsd/activity/JSONL execution logs per session
.gsd/runtime/Session metadata and lock files