Back to loops
Testingevent triggerhook-bundle-ready Hardened

Post-Edit Test Guard

A compact quality gate for agents that edit code and stop without verification. It requires a post-edit check plan tied to the changed files.

Use loop copies the kickoff prompt. Copy Markdown and Download loop include the complete Markdown page with context, source attribution, anchors, and guardrails. Cursor / Claude Code buttons prepare the shorter kickoff prompt only.

Run shape

Supported agents

CursorClaude CodeCodex

Goal

Run the closest meaningful verification after edits and report evidence.

Feedback gate

git diff --name-only HEAD

Stop condition

Relevant validation has been run and either passes or failures are reported with evidence.

Do not weaken, skip, delete, or rewrite the validation command to force success.
Do not claim completion until the stated exit condition is actually satisfied.
If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
Required context

Give the agent these inputs before it starts the loop. This keeps discovery bounded and prevents vague retries.

Changed files.
Relevant package scripts.
Any user-defined verification constraints.
Required tools

The loop assumes these commands or integrations are available. Missing tools should be reported as blockers, not ignored.

git
package scripts
How to run

Two separate pieces: the kickoff prompt starts the loop, while the downloaded Markdown carries the complete reference page.

1. Copy or download

Use the kickoff for a fast agent run. Download the full Markdown when you need source, context, and attribution in one file.

2. Paste into the agent

Start a fresh agent session in the target repo and provide the requested project context if the loop asks for it.

3. Let it self-pace

The agent should act, check evidence, retry only when the gate fails, and stop at the stated exit condition.

eventTesting Step flow
Event
List changed files
Choose validation
Run validation
Report evidence
Feedback gate
Goal complete with evidence
not done → return to next actiondone → exit condition met
EventList changed filesChoose validationRun validationReport evidenceFeedback gatedoneGoal complete with evidencenot done
Action checklist

The diagram shows the order. This checklist keeps only the action, command, and failure handling needed during a real pass.

1. List changed files

Identify the affected code surface.

git diff --name-only HEAD

2. Choose validation

Pick the nearest test, build, typecheck, or lint command based on changed files.

3. Run validation

Run the chosen command and capture output.

4. Report evidence

Summarize exactly what was changed and verified.

Kickoff prompt

This is the text copied by Use loop. It is intentionally shorter than the Markdown export.

After every code edit, list changed files, choose the closest meaningful validation, run it, and report evidence before claiming completion.
Goal: Run the closest meaningful verification after edits and report evidence.
Check command: git diff --name-only HEAD
Exit condition: Relevant validation has been run and either passes or failures are reported with evidence.
Max iterations: 4
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not say “not run” without explaining why no meaningful check exists.

Quality

88/100

Safety

92/100

Expected output

A changed-files summary and verification evidence tied to the modified surface.

Related loops

Browse all
Testingmanual trigger Hardened

Test Until Green

Run the project test suite, fix root causes, and keep iterating until the selected test command passes.

CursorClaude CodeCodexGemini CLIOpenCode
testsregressionfeedback-gate

Kickoff preview

Run the project tests, inspect failures, fix the smallest root cause, and repeat until the test command passes. Do not weaken the tests or change the check command.
Goal: Make the selected test command pass without weakening coverage.
Check command: pnpm test
Exit condition: The test command exits successfully with no failing tests.
Max iterations: 8
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not delete, skip, or mark tests as todo unless explicitly requested.
View
Securityevent trigger Hardened

Pre-Commit Guard

Before committing, run diff hygiene, secrets checks, and the closest validation command.

Claude CodeCodexGemini CLIOpenCode
pre-commitsecuritygit

Kickoff preview

Before committing, inspect the staged diff, scan for secrets/debug flags, run relevant validation, and only commit if the guard passes.
Goal: Block commits that contain secrets, debug switches, or unverified broken code.
Check command: git diff --cached --check
Exit condition: Staged diff is clean, no obvious secrets/debug flags are present, and relevant validation passes or is explained.
Max iterations: 3
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not commit secrets, local env files, debug flags, or generated private artifacts.
View
Reviewmanual trigger Hardened

Independent Verifier Pass

Review an agent-produced change as a skeptical verifier before it is marked done.

CursorClaude CodeCodex
reviewverificationquality

Kickoff preview

Act as an independent verifier. Restate the requirements, inspect the diff, run relevant checks, and return a pass/fail/blocker verdict with evidence.
Goal: Prove the implementation satisfies the request without relying on the implementer’s claim.
Check command: git diff --stat && git diff --check
Exit condition: The verifier can map each requirement to code and verification evidence.
Max iterations: 3
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not rubber-stamp. Find at least one plausible failure mode and check it.
View
CImanual trigger Hardened

Ship PR Until Green

Implement a scoped change, open or update a pull request, inspect CI, and continue until all required PR checks pass.

CursorClaude CodeCodex
pull-requestcigithub-actionsverification

Kickoff preview

Take this branch to a green pull request. Implement the requested change, run local verification, open or update the PR, run `gh pr checks`, inspect failures, fix root causes, and repeat until every required check passes or you hit the iteration cap.
Goal: Open or update a pull request and stop only when all required PR checks are green.
Check command: gh pr checks
Exit condition: All required pull request checks are successful and the PR is ready for review or merge.
Max iterations: 10
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not disable required checks, edit loops to skip jobs, or remove tests to make CI green.
- Do not merge the PR unless the user explicitly asked for merge authority.
View