Back to loops
Debuggingmanual

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.

0 views0 usesby solo lemon.

// parameters

Triggermanual
Max iterations8
Check commandnpm test -- --testNamePattern=<failing-test>
Exit conditionPreviously failing test passes

// run_this_loop

Copy the kickoff into your agent first. The blueprint below explains how the loop evaluates progress and when it should stop.

Open in CursorOpen in Claude

Use loop copies the kickoff prompt. Share copies the loop link. Open in Cursor / Claude only pre-fill that prompt — they do not install hook files. Download loop saves the loop as reflexion-debug-loop.md.

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.

// blueprint

The loop contract: target outcome, execution sequence, checks, stopping condition, and safety constraints.

Goal

the failing test or repro passes

// loop_sequence

// loop_sequence_diagram.json
closed loop

Trigger

Manual start

Actions block

3 steps
1Reproduce bug
2Reflect on failure
3Apply targeted fix

Feedback gate

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

Run the check, read the output, then decide whether the loop is complete.

Check failed

Repeat actions with the latest feedback.

Success

Previously failing test passes

Safety capMax 8 iterations

// steps

  1. 1
    Reproduce bug

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

    npm test -- --testNamePattern=<failing-test>
  2. 2
    Reflect on failure

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

  3. 3
    Apply targeted fix

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