Skip to content
Loop Engineering Tools

Loop Engineering Tools

Design loops that stop on time, stay on budget, and never merge without approval.

Loop Engineering helps you create safe, verifiable, token-aware workflows for Claude Code, Codex, Cursor, GitHub Actions, and Ralphify.

Free, no sign-up
Nothing runs your code
Safety-first
Works with
Claude CodeCodexCursorGitHub ActionsRalphify
free
Require human approval before merge / deploy
claude-goal.txt
/goal Fix the failing CI checks for this pull request with the smallest safe change.
 
Work toward this goal until all validation checks pass or the stop rule is reached.
 
Loop cycle:
1. Discovery — Read the latest CI failure, related pull request comments, and recent commits before choosing the next action.
2. Handoff — Assign the work to one coding agent in an isolated branch or worktree. Keep the final merge decision with a human reviewer.
3. Verification — A separate reviewer checks the diff, confirms validation results, and rejects shortcuts such as deleting tests or weakening checks.
4. Persistence — Write a short run note with the error seen, files changed, checks run, and the next recommended action.
5. Scheduling — Run manually for each failing pull request. Move to a scheduled check only after the loop is reliable.
 
Context:
This is a TypeScript project. Prefer small focused changes. Read existing patterns before editing.
 
Validation:
pnpm lint
pnpm test
pnpm build
 
Independent checker:
A separate reviewer checks the diff, confirms validation results, and rejects shortcuts such as deleting tests or weakening checks.
 
Boundaries:
Do not delete tests.
Do not bypass lint or type checks.
Do not modify unrelated files.
Do not merge without human approval.
 
Stop rule:
Stop when all validation commands pass, or after 5 failed iterations.
Maximum iterations: 5
 
Budget:
Stop before exceeding the agreed per-run token budget.
 
Human approval:
Required before merge, deploy, delete, purchase, or external communication.
 
Fallback:
If blocked, summarize the current errors, attempted fixes, and recommended human decision.
 
Do not delete tests, bypass checks, or modify unrelated files just to satisfy the validation condition. If blocked, stop and summarize the blocker, attempted fixes, and recommended next action.
Copyable prompt only — nothing runs, connects, or executes.Send feedback
01 / Concept

What Is Loop Engineering?

Loop Engineering is what comes after a good prompt. You design the small system around the agent: what it reads, who receives the work, how the result is checked, what gets remembered, and when the loop should stop.

Prompt
One instruction: what you ask an agent to do right now.
Context
The files, facts, logs, and notes the agent needs for this turn.
Harness
The tools, permissions, checks, and guardrails around a single run.
Loop
The system that finds work, hands it off, checks it, records state, and runs again.
A prompt asks for one answer. A loop keeps returning to the work with rules, memory, and a reason to stop.
The goal is not to remove judgment. It is to keep repeated agent work legible enough for a human to trust.
02 / Core loop

The Five Moves That Make a Loop Work

A loop is not just a long prompt. It is a repeatable path from a signal to a checked result, with enough memory to improve the next pass.

01Discovery

The loop reads the signal: CI failure, issue, review comment, commit, inbox, or saved report.

02Handoff

The work is given to the right agent, branch, worktree, or human owner with a clear goal.

03Verification

A checker tests the result against commands, artifacts, review rules, and real intent.

04Persistence

The loop saves what happened, what changed, and what still needs attention next time.

05Scheduling

The loop either stops for a human or runs again on a manual, timed, or event-based trigger.

03 / Checker

The agent that makes the thing should not be the only one grading it.

A loop becomes safer when the maker and checker are separate. The checker can be a test suite, a review checklist, another agent, or a human reviewer. What matters is that it can say no.

Check Loop Readiness
01

Who checks the result?

Name a separate reviewer, test suite, scoring rule, or second agent. The maker should not be the only judge.

02

What does the checker reject?

Call out shortcuts: deleted tests, skipped checks, unrelated edits, vague summaries, or changes that only satisfy the metric.

03

What happens on failure?

A good loop stops, reports the blocker, and asks for a human decision instead of quietly trying forever.

04 / First loop

Start with one small loop you would actually review.

A good first loop is boring in the best way: one source, one goal, one check, one stop rule. For example, read a failing CI run, propose the smallest fix, run the checks, then stop for a human before merge.

  1. 01Pick one discovery source, such as CI failures or open review comments.
  2. 02Write one outcome-based goal and the validation command that proves it.
  3. 03Add a checker that can say no.
  4. 04Set a stop rule, budget cap, and human approval point.
  5. 05Save a short run note so the next pass has memory.
07 / Safety

Loop Safety Checklist

  • Is the goal machine-verifiable?
  • Is the discovery source clear?
  • Is there an independent checker?
  • Can the agent run tests or checks?
  • Are forbidden actions clearly defined?
  • Is there a max iteration limit?
  • Is there a budget limit?
  • Is there a rollback or fallback plan?
  • Is human approval required before merge, deploy, delete, purchase, or external communication?
Check Loop Readiness
08 / Budget

Token-Aware Loop Engineering

Long-running loops can burn tokens quickly. Good loop design defines max iterations, retry limits, memory strategy, and human review gates before the agent starts.

Define max iterations and retry limits up front
Choose a memory strategy: keep, summarize, or retrieve
Add human review gates before high-risk actions
Estimate Loop Cost
Risk reminders

What goes wrong when a loop runs without judgment

Verification debt

Outputs pile up faster than anyone checks them. The fix is a real checker and a clear human review point.

Comprehension rot

The loop keeps changing things while your mental map falls behind. Read the run notes and review diffs regularly.

Cognitive surrender

The loop sounds confident, so you stop having opinions. Let agents execute; keep judgment with a person.

Token blowout

Scheduled loops multiply cost quickly. Set retry caps, daily limits, and smaller context windows before scheduling.

11 / Feedback

Help improve Loop Engineering templates.

Send feedback, report a broken template, or ask for new loop examples. You can also join the update list for new agent loop templates and safety checklists.

Contact: hello@loopengineering.app

12 / FAQ

Loop Engineering FAQ

Loop Engineering is designing the system around an AI agent — the goal, context, validation, boundaries, budget, stop rule, and feedback — instead of prompting turn by turn.