Structured diagnostic protocol enforcing systematic hypothesis testing when investigating issues.
Bug hunting assistance via AI Distiller (AID):
# Systematically search for bugs
aid <path> --ai-action prompt-for-bug-hunting
AID prompt-for-bug-hunting provides:
When to use AID for diagnosis:
Integration: Run AID bug hunting before hypothesis generation to inform H1-H3 list.
When to use:
When NOT to use:
/diagnose enforces the Structured Diagnostic Protocol from MEMORY.md:
## Diagnostic Investigation
**Issue**: [brief problem description]
**Hypotheses**:
H1: [description]
H2: [description]
H3: [description]
**Test Results**:
H1: Test `[command]` → Result `[output]` → RULED OUT/CONFIRMED
H2: Test `[command]` → Result `[output]` → RULED OUT/CONFIRMED
H3: Test `[command]` → Result `[output]` → RULED OUT/CONFIRMED
**Conclusion**: H[confirmed] is the root cause
**Next Step**: [proposed fix]
## Diagnostic Investigation
**Issue**: pytest hangs indefinitely when running test suite
**Hypotheses**:
H1: pytest-testmon plugin interference with test collection
H2: Missing tot_tracer module causing import hang
H3: Hook interference during test collection
H4: Recursive test imports causing circular dependency
**Test Results**:
H1: Test `pytest tests/ -v -p no:testmon` → Tests complete in 0.15s → RULED OUT
H2: Test `grep -r "tot_tracer" tests/` → No matches → RULED OUT
H3: Test `mv .claude/hooks .claude/hooks.bak && pytest tests/` → Still hangs → RULED OUT
H4: Test `pytest --collect-only` → Hangs at same point → CONFIRMED
**Conclusion**: H4 is the root cause - test collection has circular import
**Next Step**: Analyze test import graph with `pytest --collect-only --verbose`
## Diagnostic Investigation
**Issue**: Intermittent KeyError in async handler
**Hypotheses**:
H1: Multiple tasks accessing shared dict without lock
H2: Event loop order causing premature deletion
H3: Exception handler swallowing race condition error
H4: Task cancellation during dict access
**Test Results**:
H1: Test `add locks to dict access` → Still fails → RULED OUT
H2: Test `add logging before deletion` → KeyError happens before delete → RULED OUT
H3: Test `remove try/except wrapper` → RuntimeError appears → CONFIRMED
H4: N/A (H3 confirmed)
**Conclusion**: H3 - Exception wrapper was hiding RuntimeError, manifesting as KeyError
**Next Step**: Remove exception wrapper, let RuntimeError propagate for proper stack trace
This skill REQUIRES:
This skill enforces these protocols from MEMORY.md:
Required sections (in order):
DO NOT:
| Violation | Detection | Correction |
|---|---|---|
| Single hypothesis | Only H1 listed | Add H2, H3 upfront |
| Untested claim | "Probably caused by X" | Show test output |
| Missing conclusion | Tests but no winner | State which hypothesis confirmed |
| Premature fix | "Let's try X" before tests | Complete protocol first |
Version: 1.0.0 Enforcement: Stop hook checks for violations