1---2name: debug3description: Debug failing, flaky, slow, or incorrect behavior with a reproducible feedback loop. Use when something is broken, throwing, failing tests, behaving unexpectedly, or showing a performance regression.4---56# Debug78## Input910- A bug report, failing command, test, error, performance complaint, repro steps, or affected area.11- Use explicit input first; otherwise infer from context, recent edits, selected files, or branch.12- Safest default: find an agent-runnable repro before patching.1314## Workflow15161. **Build a feedback loop**. Reproduce the issue with a runnable command, test, script, request, or browser flow.172. **Confirm the symptom**. Verify the repro matches the user's reported behavior, not a nearby failure.183. **Minimize the repro**. Reduce inputs, state, or steps until the failing behavior is clear.194. **Form hypotheses**. List 2-4 falsifiable causes and test one at a time.205. **Instrument narrowly**. Add targeted logs, assertions, debugger probes, or measurements only where they distinguish hypotheses.216. **Fix the root cause**. Keep the change scoped to the proven cause.227. **Add regression coverage**. Add or update a test when there is a suitable behavior-facing seam.238. **Clean up**. Remove temporary probes, scripts, and logs.2425## Output2627- Repro used28- Root cause29- Fix applied30- Regression coverage added or skipped31- Validation run3233## Guardrails3435- Do not patch before reproducing unless reproduction is impossible.36- If no repro is possible, state what was tried and what artifact or access is needed.37- Do not leave temporary debug logs, scripts, or instrumentation behind.38- For performance issues, measure before and after.