Awesome Loop Engineering

Design loops,
not just prompts.

Loop Engineering is the AI and coding-agent practice of designing recurring systems that discover work, delegate it to agents, verify results, persist state, decide next actions, and run again.

Diagram of the engineering stack: Prompt, Context, and Harness Engineering improve one run; Loop Engineering governs recurring agent work over time.
15operational patterns
15loop contracts
6runnable templates
270curated entries
8languages
Canonical definition. Loop Engineering is the AI and coding-agent practice of designing recurring systems that discover work, delegate it to agents, verify results, persist state, decide next actions, and run again on a cadence, event, or until a verifiable goal is reached.
The stack

Four layers, one recurring system

Prompt, context, and harness engineering make a single agent run better. Loop Engineering sits on top and governs agent work over time.

Prompt Engineeringwhat should I say to the model?
Context Engineeringwhat state, memory, and knowledge should the model see?
Harness Engineeringwhat tools, permissions, sandboxes, and checks surround one run?
Loop Engineeringwhat recurring system governs agent work over time?
The lifecycle

One pass of a recurring loop

Verification is a deterministic gate, not the agent's opinion. State persists outside the model. Every loop has a budget and a human exit.

Loop Engineering lifecycle: Intake, Delegate, Act, Verify, Persist, Decide; Decide retries by feeding evidence back, escalates to a human, or exits when the goal is met.
The loop contract

Every loop names the same parts

A useful loop has a contract. If a part is missing, it becomes either a manual prompt habit or an unsafe background automation.

Loop Contract cards: objective, trigger, intake, workspace, context, delegation, verification, state, budget, escalation, and exit.

Verifiable by design

Tests, typechecks, evals, traces, or reviewers decide done — never the acting agent alone.

State outside the model

Progress files, issues, checkpoints, and traces survive the next run and every context reset.

Budgeted and bounded

Retries, runtime, and concurrency are capped, with a clear human exit before anything risky ships.

Loop maturity model

Climb the model slowly

A reliable Level 3 loop with clear state and deterministic checks is usually more valuable than a flashy Level 5 loop with vague goals.

0
Manual prompting
A human reads state and writes the next prompt.
1
Scripted retry
A shell or script loop feeds errors back to an agent.
2
Scheduled loop
The agent runs on a cadence and reports findings.
3
Stateful loop
Progress survives across sessions through files, issues, or checkpoints.
4
Self-verifying loop
Deterministic checks or evaluator agents gate completion.
5
Multi-agent loop
Specialized agents split discovery, implementation, review, and judgment.
6
Production-supervised loop
Observability, budgets, approvals, rollback, and escalation are first-class.
The curated list

Browse by category

Primary sources, official docs, papers, benchmarks, and implementation-heavy write-ups — selective, not a dump. Jump into any section of the README.

FAQ

Loop Engineering, answered

Short answers to the questions people ask first.

What is loop engineering?

Loop Engineering is the practice of designing recurring AI agent and coding-agent systems. Instead of prompting an agent turn by turn, you build a loop that discovers work, delegates it to agents, verifies the result against tests or other gates, persists state outside the model, decides what happens next, and runs again on a cadence or until a verifiable goal is reached.

How is loop engineering different from prompt, context, and harness engineering?

Prompt engineering improves what you ask, context engineering improves what the model can see, and harness engineering improves the tools, permissions, and checks around a single run. Loop engineering sits above all three: it governs how agent work repeats, verifies, persists state, and escalates over time.

When should you use an agent loop?

Use a loop when work recurs and a deterministic check can decide success, such as keeping a pull request moving, repairing failing CI, monitoring a deploy, or triaging dependency updates. If a task is one-off, or "done" depends only on a human's judgment, a single agent run is usually enough.

What is in a loop contract?

A loop contract names the parts every reliable loop shares: objective, trigger, intake, workspace, context, delegation, a verification gate, durable state, budget, escalation, and an exit condition. The repository ships a JSON schema and validated example contracts for each pattern.

Which runtimes can run agent loops?

The same loop can run as a Claude Code /loop or scheduled task, a Codex automation, a GitHub agentic workflow, a shell or cron wrapper, or a durable-execution runtime. The runtime selection guide compares persistence, file access, isolation, and permissions so you can choose deliberately.