loops!
BrowseSign in
Back to loops
Debugging
manual
Claude CodeCursor

Reflexion Debug Loop

On each failed repro attempt, write a short reflection to disk, then retry with that memory — avoids repeating the same wrong fix.

3 copies · 1 installs · 14 views

by loops!

Use loop copies the kickoff. Share copies the loop link. Open in Cursor / Claude Code only pre-fill that prompt — they do not install hook files. Click Install files, extract the zip into your repo, then restart your agent. Full install guide

Sign in to save
Guardrails
Hardened
Anti-gaming rules
Rules the agent must follow so it cannot cheat the exit condition.
  • Do not modify the check command or exit criteria to force success
  • Do not skip, disable, or bypass checks to pass the exit condition
  • If stuck after several iterations, stop and report blockers instead of gaming metrics
How to run this loop
Includes install files
Run “Reflexion Debug Loop” in your agent
Deeplinks and “Open in Cursor” only paste the kickoff prompt. They do not install hook files — your agent cannot tell whether files are on disk until you add them yourself.

Two separate pieces

  • Kickoff prompt — tells the agent the goal, check command, exit condition, and how to self-pace between passes.
  • Install files — optional hooks under .cursor/ or .claude/ that fire on events (save, commit, etc.). You must download and extract these into your repo.
  1. 1

    Download and extract install files

    Click Install files on this loop, unzip, and merge into your project root so paths like .loops/reflexion.md exist on disk.

    Restart Cursor or reload the Claude Code session so hooks are picked up. Until then, nothing is “installed” — the browser cannot write into your repo.

  2. 2

    Copy or open the kickoff prompt

    Use Use loop to copy the kickoff, or Open in Cursor / Open in Claude Code to pre-fill the prompt in that app. Those links only carry text, not hook files.

  3. 3

    Paste and let the agent self-pace

    Paste the kickoff into agent chat. The agent should run your check command between iterations and stop when the exit condition passes.

Full guide with Cursor /loop notes: How to install loops

manual trigger
Debugging
Manual start
Reproduce bug
Reflect on failure
Apply targeted fix
Previously failing test passes
Rendering diagram…
Steps
What the agent does on each pass.

1. Reproduce bug

Run the minimal repro steps or failing test. Capture exact error output.

npm test -- --testNamePattern=<failing-test>

2. Reflect on failure

Append to .loops/reflexion.md: what you tried, what failed, and one hypothesis to avoid next pass.

3. Apply targeted fix

Read reflexion.md. Apply a different fix than prior attempts. Prefer root cause over symptoms.

Kickoff prompt
Copy this into your coding agent to start the loop.
Start the "Reflexion Debug Loop" loop.

Goal: the failing test or repro passes
Max iterations: 8
Between iterations run: npm test -- --testNamePattern=<failing-test>
Exit when: the repro test exits 0

Step 1: Reproduce the bug. If it fails, append a reflection to .loops/reflexion.md before trying a new fix.

Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.

Related loops

Debugging
manual
5 copies
Write a small throwaway script to reproduce a bug, run it, read output, and iterate until the root cause is proven.

Start the "Investigation Script Loop" loop. Goal: prove the root cause with a minimal repro script Max iterations: 8 Between iterations run: node scripts/investigate.mjs Exit when: script output demonstrates root cause Step 1: Write a tiny throwaway script that reproduces the issue. Run it and iterate on what the output shows. Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.

CursorClaude CodeCodex
debugging
repro
scripts
by loops!
View