Test Until Green
Run your test suite, fix the smallest root cause on failure, and repeat until every test passes.
// parameters
// run_this_loop
Copy the kickoff into your agent first. The blueprint below explains how the loop evaluates progress and when it should stop.
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 test-until-green.md.
Start the "Test Until Green" loop.
Goal: all tests pass
Max iterations: 10
Between iterations run: npm test
Exit when: tests exit 0
Step 1: Run tests. If there are failures, fix the smallest root cause, then repeat.
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.
all tests pass
// loop_sequence
Trigger
Manual start
Actions block
Feedback gate
Evaluate: npm test
Run the check, read the output, then decide whether the loop is complete.
Check failed
Repeat actions with the latest feedback.
Success
All tests pass (exit code 0)
// steps
- 1Run tests
Run the project test command and capture failures.
npm test - 2Fix failures
Fix the smallest root cause for the current failing tests. Prefer minimal diffs.
- 3Re-run tests
Run tests again and verify progress toward zero failures.
npm test
Guardrails
- •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
- •Do not weaken, delete, or skip tests to make the suite pass
- •Do not replace real assertions with trivial always-pass tests
- •Prefer fixing production code over patching tests to go green
Comments from loop runners.
No comments yet. Be the first to leave implementation notes.
Tom Osman's app testing automation
This "loop" automation is nuts inside of Codex.
Post-Merge Regression Guard
Hook that runs smoke tests after git merge or rebase to catch integration regressions immediately.
Autoloop TDD
Test-first loop: write a failing test, implement the minimum code to pass, refactor, and repeat.