debug this, fix this bug, why is this failing, investigate error, trace the issue, something is broken, test failure, systematic debugging, diagnose, root cause. Four-phase systematic debugging: investigate → analyze patterns → hypothesis test → fix. Parallel investigation for independent failures.
Four mandatory phases. Do not skip ahead to fixing — understand first.
Don't skim. Read the full error output, stack trace, and surrounding logs. Extract:
# Run the failing command/test
<reproduce command>
If it doesn't reproduce, it's likely a race condition, environment issue, or flaky test. Investigate those vectors specifically.
git log --oneline -10
git diff HEAD~3 --stat
Did a recent commit touch the failing area? If so, read that diff first.
If the failure spans multiple components, trace the data flow:
Add temporary logging if needed to narrow down the boundary.
Find code that does something similar and works:
# Search for similar patterns
Use Grep/Glob to find analogous code paths, test cases, or previous implementations.
What's different between the working version and the broken one? Common differences:
Trace what the broken code depends on:
Based on evidence from Phases 1-2, state one clear hypothesis:
"The failure occurs because X, which causes Y, resulting in Z."
Make the smallest possible change to test your hypothesis. If the hypothesis is right, the minimal fix should resolve the issue. If wrong, revert and form a new hypothesis.
Do NOT:
Run the reproduction again. If the fix works, proceed to Phase 4. If not, go back to Phase 2 with new information.
Before applying the fix permanently, write a test that captures the bug:
# Test that reproduces the exact failure
This ensures the bug doesn't regress.
Apply the minimal fix. One change, one commit. Don't bundle unrelated cleanup.
Stop. Question the architecture:
When you encounter 2+ independent failures (different root causes, different components):
Dispatch one agent per independent failure domain: