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.
Goal
Resolve reported bug
How to Run
Run this loop by providing a bug report and context. The agent will automatically reproduce, fix, and validate the solution.
- 01
Install Agent
Ensure your coding environment supports prompt-driven agents (Cursor, Claude Code, Codex, etc.)
- 02
Provide Bug Context
Share the bug report, error messages, and any relevant code snippets with the agent
- 03
Execute Loop
Invoke the agent with the kickoff prompt and let it self-pace through the debugging workflow
- 04
Wait for Resolution
The agent will exit once the regression test confirms the bug is fixed or reaches max iterations
Workflow Steps
- 01
Reproduce Bug
Recreate the exact conditions of the reported bug using provided context and logs
- 02
Analyze Code
Examine source files related to the bug, focusing on error stack traces and component interactions
- 03
Identify Root Cause
Determine the underlying logic or implementation error causing the bug
- 04
Implement Fix
Apply minimal, targeted code changes to address the identified root cause
- 05
Run Regression Test
Execute automated tests to verify the fix resolves the bug without introducing side effects
- 06
Validate Solution
Confirm the fix meets all requirements by checking exit conditions and test results
Kickoff Prompt
Start the "Reproduce and Fix" loop. Goal: Resolve reported bug Max iterations: 10 Between iterations run: bug regression test Exit when: Bug test passes I need your help resolving a bug in my codebase. Please start by reproducing and fixing the following issue: [PASTE_BUG_REPORT_HERE]. Include any error logs, failing tests, or unexpected behavior descriptions. Then run the 'bug regression test' command to verify your solution. Self-pace this loop. After each iteration, run `bug regression test` and evaluate the output, and only continue if the exit condition is not met (Bug test passes). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Never modify unrelated files or introduce new features beyond the bug fix
- ·Prioritize existing test suites to validate changes
- ·If regression tests fail, revert changes and try alternative approaches
- ·Respect codebase conventions and architectural patterns
- ·Document all changes with clear commit messages
Flow Diagram
Related loops — Debugging
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.
Debugging
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.