Root Cause Finder
A systematic loop for identifying the root cause of code issues, bugs, or unexpected behavior through iterative investigation and analysis, ensuring developers address foundational problems rather than surface-level symptoms.
Goal
Identify root cause
How to Run
Run this prompt in your coding agent to begin systematic root cause investigation. The agent will iterate through investigation steps until the root cause is identified or maximum iterations are reached.
- 01
Step 1: Describe the Problem
Explain the bug, issue, or unexpected behavior you're experiencing including error messages, symptoms, and affected components.
- 02
Step 2: Provide Context
Share relevant code snippets, recent changes, environment details, and any initial hypotheses about the cause.
- 03
Step 3: Let Agent Investigate
The agent will perform systematic investigation steps, asking follow-up questions and analyzing findings.
- 04
Step 4: Confirm Root Cause
When the agent identifies the root cause, verify accuracy and request documentation of findings.
Workflow Steps
- 01
Define and clarify the problem statement with user input
- 02
Gather relevant context including codebase, recent changes, and environment
- 03
Perform initial code investigation and hypothesis formation
- 04
Run diagnostic checks and tests to validate hypotheses
- 05
Analyze results and narrow down potential root causes
- 06
Document findings and propose root cause with evidence
- 07
Confirm with user and finalize documentation if correct
iteration_check
- 08
Check if root cause is documented and iterations under limit
If documented, exit; else return to step 3
Kickoff Prompt
Start the "Root Cause Finder" loop. Goal: Identify root cause Max iterations: 10 Between iterations run: investigation review Exit when: Root cause documented I'm experiencing an issue where [describe specific problem - e.g., 'my API returns 500 errors when processing POST requests']. The error occurs in [component/context] and started happening after [recent changes or timeline if applicable]. I suspect it might be related to [initial hypothesis], but want to systematically identify the root cause. Can you investigate this step by step? Self-pace this loop. After each iteration, run `investigation review` and evaluate the output, and only continue if the exit condition is not met (Root cause documented). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Do not make code changes without fully understanding the problem first
- ·Focus on identifying underlying causes, not just treating symptoms
- ·Stop immediately once root cause is documented and confirmed
- ·Limit investigation to 10 iterations to maintain focus
Flow Diagram
Related loops — Debugging
Debugging
Reproduce and Fix
This loop guides you through reproducing a reported bug, identifying its root cause, implementing a fix, and verifying the solution through automated testing. The agent will iteratively work to resolve the issue while maintaining system integrity.
Debugging
Error Log Reduction
This loop analyzes application error logs to identify and fix recurring errors, reducing their frequency over time through iterative debugging and targeted code improvements.
Debugging
Production Incident Resolver
A coding agent loop designed to diagnose and resolve production incidents through iterative investigation, targeted fixes, and continuous health monitoring until system stability is restored.