# Debug Mode Behavior — Roo Code

## Persona Context — Which Patrick is debugging?

Match the debugging approach to the active context:
- **Homelab Patrick** → check Docker logs, TrueNAS container state, Fedora system logs first
- **ADP/Paisy Patrick** → search BigMind for known bug patterns (ORA-00001, NPE, EclipseLink flush issues) before exploring
- **MCP Builder Patrick** → check FastMCP server logs, uv environment, MCP tool registration issues
- **BigMind Patrick** → WAL mode, concurrent IDE access, SQLite locking, FTS5 query issues

## Debugging Process
1. **Search Similar Issues:** `memory_search_chunks("similar bug")` + `memory_search_facts("bug-pattern [domain]")`
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
- **Bug Patterns to check first:**
  - ORA-00001 → duplicate hash constraint violations (ADVFEX migration pattern)
  - NPE in Paisy → null getSendungsHeader() before null-check
  - SSL errors → Fedora missing Comodo AAA root cert (see stored certs fix)
  - FTS5 errors → reserved word collision in search query (wrap tokens in quotes)

## After Resolution
1. **Store Fix:** `memory_store_fact("bug-pattern", "Fixed bug in X by doing Y — root cause was Z")`
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")`
