| name | debug |
| description | Guide systematic debugging through hypothesis generation and verification |
Structured Debugging Workflow
Current Time: !date
System: !uname -a
Guide systematic debugging through hypothesis generation, investigation, and verification. Documents findings to Obsidian for knowledge retention.
Input
- Problem statement: symptoms, error messages, reproduction steps
- Context: environment, recent changes, frequency
- Optional: initial hypotheses or suspected areas
Investigation Strategy
Launch parallel investigation tracks:
Track 1: Codebase Exploration (explore agent)
- Trace code paths related to error messages/symptoms
- Find error handling and logging in affected areas
- Identify recent changes to suspect code
- Map data flow through affected components
Track 2: Code Analysis (inferred agent: go/frontend/postgres)
- Deep analysis of suspect code paths
- Identify potential failure modes
- Review error handling completeness
- Check for race conditions, edge cases, nil handling
Track 3: External Research (librarian agent)
- Search for known issues matching error signatures
- Find similar bugs in dependency issue trackers
- Research common causes for the symptom pattern
Debugging Framework
1. Problem Definition
- What is the expected behavior?
- What is the actual behavior?
- What changed recently?
- Is it reproducible? How?
2. Hypothesis Generation
Generate ranked hypotheses based on:
- Probability (how likely is this the cause?)
- Testability (how easy to verify/falsify?)
- Recent changes (correlation with deployments)
- Error signatures (what do the errors suggest?)
3. Investigation Plan
For each hypothesis:
- What evidence would confirm it?
- What evidence would refute it?
- What's the fastest way to test?
4. Evidence Collection
- Log analysis
- Metric correlation
- Code inspection
- Reproduction attempts
- Binary search (git bisect)
5. Root Cause Identification
- Distinguish symptoms from causes
- Identify contributing factors
- Verify fix addresses root cause
Output
Write to Obsidian via obsidian_append_content at:
$OBSIDIAN_PATH/Debugging/YYYY-MM-DD-HHMM-issue-title.md
Note:
$OBSIDIAN_PATHmust be a vault-relative path (e.g.,Projects/myapp), set per-project via direnv. Theobsidian_append_contenttool expects paths relative to the vault root.
Document Structure
Use this template for the Obsidian document:
@~/.config/opencode/templates/debug-session.md
Behavior
- Parse problem statement to extract symptoms and context
- Infer appropriate code agent from error context
- Launch explore, librarian, and inferred code agent in parallel
- Generate ranked hypotheses based on findings
- Create investigation plan for top hypotheses
- Document evidence and investigation log
- Write debug session to Obsidian via
obsidian_append_contentwith auto-generated filename:YYYY-MM-DD-HHMM-issue-title.md
$ARGUMENTS