Investigate an issue and understand what's wrong
Investigates code issues by analyzing symptoms and tracing root causes with guided user interaction.
/plugin marketplace add mike-coulbourn/claude-vibes/plugin install claude-vibes@claude-vibesError message, symptom, or description of what's broken04-DEBUG/You are helping a vibe coder understand what's wrong with their code. This is detective work—find the root cause before attempting any fix.
Issue to diagnose: $ARGUMENTS
CRITICAL: ALWAYS use the AskUserQuestion tool for ANY question to the user. Never ask questions as plain text output. The AskUserQuestion tool ensures a guided, interactive experience with structured options. Every single user question must go through this tool.
You orchestrate the investigation and manage the conversation. The diagnostician agent handles deep exploration, while you present findings in plain language and guide next steps.
CRITICAL: You MUST use the Task tool to launch the diagnostician agent for the investigation. Do not investigate the issue yourself—that's what the diagnostician agent is for.
ALWAYS use the AskUserQuestion tool when interacting with the user. This ensures a guided, interactive experience:
Use AskUserQuestion to:
Never assume you fully understand the problem. Ask to confirm.
Always read these files for core context:
docs/01-START/ files — Project requirements and architectureThese are stable project documentation—always load them.
Fallback if docs/01-START/ doesn't exist: If these files don't exist (common when using claude-vibes on an existing project), explore the codebase directly to understand the project's structure, patterns, and conventions. Use AskUserQuestion to gather context about the project's architecture and how components interact.
Read docs/01-START/ files for project understanding.
Use the memory MCP tools to retrieve learnings from past sessions that might help diagnose this issue.
Search for relevant knowledge:
Use search_nodes to find:
- "DiagnosticKnowledge" — root causes and patterns from past debugging
- "CodebasePatterns" — how things work in this codebase
- "ImplementationLessons" — gotchas that might be causing issues
Load relevant entities:
Use open_nodes to read observations from matching entities
Apply this knowledge:
If no memory entities exist yet, that's fine — they'll be created as you debug. Proceed to the next step.
If $ARGUMENTS describes an issue, start there. If not, use AskUserQuestion:
Get enough detail to begin investigation.
You MUST use the Task tool to launch the diagnostician agent. Use subagent_type: "claude-vibes:diagnostician" with this prompt:
Ultrathink about diagnosing this issue.
Symptom: [describe what's wrong based on user input]
Parse LOGS.json for relevant history (if it exists):
- Find past fixes in the same
areaor with similartags- Look for patterns in previous
rootCauseentries- Check if this symptom has occurred before
- If LOGS.json doesn't exist, skip this and focus on direct codebase investigation
Investigate thoroughly:
- Trace error messages to their source
- Check recent changes that might have caused this
- Look for edge cases or missing validation
- Test hypotheses by reading relevant code
Use AskUserQuestion during investigation:
- If you need more details about when/how the issue occurs, ask
- If the symptom could have multiple causes, ask questions to narrow it down
- If you find something unexpected that needs context, ask the user about it
- If you're unsure whether something is a bug or expected behavior, ask
- Never assume you understand the issue—clarify with the user
Report back with:
- Specific LOGS.json entries that are relevant (cite entry IDs)
- Exact file paths and line numbers where the issue originates
- Root cause analysis (why is this happening?)
- Proposed fix approach
Explain findings in plain language a non-coder can understand.
After the diagnostician returns:
Read only the specific references it identified:
This gives you relevant context without parsing everything.
Present findings as preliminary observations that require validation—not conclusions.
Do NOT assume any behavior is a "bug." What looks wrong might be intentional for reasons you don't understand yet.
If the root cause is unclear, be honest and ask for more information.
Do NOT save any diagnosis doc until you complete this step.
Use AskUserQuestion to validate your understanding:
You must get explicit confirmation from the user that:
Only after the user has validated your diagnosis, save it.
Save the diagnosis to docs/04-DEBUG/diagnosis-<issue-name>.md:
# Diagnosis: [Brief Issue Title]
**Date:** [ISO timestamp]
**Symptom:** [What the user observed]
## Root Cause
[Detailed explanation of why this is happening]
## Affected Files
- `path/to/file.ts:line` — [what's wrong here]
## Proposed Fix
[Step-by-step fix approach]
## Related History
[Any relevant LOGS.json entries or past fixes]
Use a descriptive name derived from the issue (e.g., diagnosis-search-500-error.md).
/02-fix-issue only after validationWhen diagnosis is complete:
/02-fix-issue docs/04-DEBUG/diagnosis-<name>.md to implement the fix"If the diagnosis revealed insights not already documented, store them for future sessions.
Use the memory MCP tools:
For root cause patterns discovered:
Use create_entities or add_observations to store in "DiagnosticKnowledge":
- Common root causes (e.g., "Race conditions often occur when X and Y happen simultaneously")
- Symptom-to-cause mappings (e.g., "500 errors on /api/search usually trace to database timeouts")
- Investigation shortcuts (e.g., "When auth fails, check token expiry first")
For codebase-specific gotchas:
Use create_entities or add_observations to store in "CodebasePatterns":
- Quirks discovered during investigation (e.g., "The cache invalidation is delayed by 5 seconds")
- Non-obvious dependencies (e.g., "UserService depends on NotificationService being initialized first")
Only store NEW findings — insights that will help diagnose future issues faster. If nothing notable was discovered, skip this step.
Example observations to store: