Investigation Script Loop
FeaturedOn demandAbout Investigation Script Loop
A manually started debugging loop. Each round forms a hypothesis, edits scripts/investigate.mjs, then runs node scripts/investigate.mjs and reads the output. It runs for up to 8 rounds and is listed for Cursor and Claude Code.
Key features
- 01Manual trigger
- 02Capped at 8 rounds
- 03Judged by the output of node scripts/investigate.mjs
- 04Supports Cursor and Claude Code
Use cases
- 01Tracking down a hard-to-locate intermittent bug
- 02Giving a team runnable evidence of a problem's root cause
- 03Checking that a suspected cause holds before writing a fix
- Goal
- A minimal repro script demonstrates the root cause of the problem.
- Exit when
- Stop when the output of node scripts/investigate.mjs demonstrates the root cause, or after the 8-round limit is reached.
- Between iterations run
- node scripts/investigate.mjs
Launch prompt
Paste into Cursor / Claude Code. The agent repeats the steps below until the exit condition is met.
Start the "Investigation Script Loop" loop. Goal: A minimal repro script demonstrates the root cause of the problem. Max iterations: 8. Step 1: Form a hypothesis — Using the known symptoms and the previous round's output, write down a root-cause guess that can be confirmed or ruled out. Step 2: Update the script — Edit scripts/investigate.mjs so it keeps only the code needed to trigger the problem and prints information that tells the hypotheses apart. Step 3: Run and read the output — Execute node scripts/investigate.mjs and check whether the output reproduces the problem and agrees with the hypothesis. Step 4: Judge the evidence — If the output clearly shows the root cause, end the loop. If it is ambiguous or contradicts the hypothesis, carry the new findings into the next round. Between iterations run: `node scripts/investigate.mjs` Exit when: Stop when the output of node scripts/investigate.mjs demonstrates the root cause, or after the 8-round limit is reached.
Steps
Each round runs in order; if the exit condition isn’t met, another round starts, up to 8.
Using the known symptoms and the previous round's output, write down a root-cause guess that can be confirmed or ruled out.
Edit scripts/investigate.mjs so it keeps only the code needed to trigger the problem and prints information that tells the hypotheses apart.
Execute node scripts/investigate.mjs and check whether the output reproduces the problem and agrees with the hypothesis.
If the output clearly shows the root cause, end the loop. If it is ambiguous or contradicts the hypothesis, carry the new findings into the next round.
Supported agents
Coding agents that can run this loop directly.