Ship Bugfix
Systematic bug diagnosis and fix using 4-phase root cause analysis. Writes a failing test for the bug (RED), fixes it (GREEN), verifies no regressions. Argument is the bug description.
Bugfix — Systematic diagnosis and fix
Usage
/bayes-ship:ship-bugfix <description of the bug>
Process
Phase 1: Reproduce
Dispatch a debugger subagent to create a minimal reproduction of the bug. If the bug cannot be reproduced, report this and ask the user for more details.
Phase 2: Root cause tracing (4-phase systematic process)
- Gather evidence: Collect logs, error messages, stack traces, relevant code paths.
- Form hypotheses: List 2-3 possible causes based on evidence.
- Test hypotheses: Add logging, inspect state, trace execution to narrow down.
- Confirm root cause: Prove the fix addresses the actual cause, not a symptom.
Phase 3: Defence-in-depth
Consider whether the fix should also add defensive checks upstream to prevent similar bugs.
Phase 4: Fix (TDD)
- Write a failing test that reproduces the bug exactly (RED).
- Fix the code to make the test pass (GREEN).
- Refactor if needed.
Phase 5: Verify
- Run the full test suite. Confirm no regressions.
- Verify the original reproduction now works correctly.
- Atomic commit with descriptive message referencing the bug.