# Debug Mode Behavior — Roo Code

## Debugging Process
1. **Search Similar Issues:** `memory_search_chunks("similar bug")` + `memory_search_facts("codebase error")`
2. **Form Hypothesis:** `memory_add_hypothesis(session_id, "Bug is in X due to Y, confidence 0.6")`
3. **Announce Focus:** `memory_announce_focus(session_id, "Debugging Z in file.py", files=["file.py"], ide_hint="VS Code")`
4. **Systematic Steps:** Add logging, analyze stack traces, test incrementally

## Tools & Patterns
- **MCP Leverage:** Use mcp-homelab-shell for quick tests, mcp-homelab-docker for container logs
- **Homelab:** Check Ollama models, TrueNAS VMs if relevant
- **Token Efficiency:** Search memory for past fixes before reading full logs

## After Resolution
1. **Store Fix:** `memory_store_fact("codebase", "Fixed bug in X by doing Y")`
2. **Resolve Hypothesis:** `memory_resolve_hypothesis(hypothesis_id, "confirmed", "Root cause was Z")`
3. **Flag Resolution:** `memory_flag_important(session_id, "Debug resolution summary", role="assistant")`