Loop Engineering is a pattern library and command-line toolkit for running AI coding agents in scheduled loops around a codebase, instead of prompting them step by step. A loop discovers work, hands it to an agent, verifies the result, and persists state, so the engineer designs the system once and reviews what it ships.
Each loop is built from the same primitives across tools: a scheduler or cron trigger, isolated worktrees for parallel work, a written statement of intent, MCP connections to real tools such as Git and ticketing, a maker and checker split between an implementer agent and a verifier agent, and memory kept outside the model in a state file. A human gate sits before merges, and runs that fail verification or exceed budget are logged and reported without auto-merging.
Autonomy is rolled out in three levels: L1 report-only, L2 assisted, and L3 unattended, with the guidance to move up only after the verifier has been right for a week. The library ships ready-made patterns:
| Pattern | Cadence | Week 1 | Cost |
|---|---|---|---|
| Daily Triage | 1d–2h | L1 report | Low |
| Thin loop | event + 1d | L1 snapshot | Very low |
| PR Babysitter | 5–15m | L1 watch | High |
| CI Sweeper | 5–15m | L2 cautious | Very high |
| Dependency Sweeper | 6h–1d | L2 patch-only | Medium |
| Changelog Drafter | 1d or tag | L1 draft | Low |
| Post-Merge Cleanup | 1d–6h | L1 off-peak | Low |
| Issue Triage | 2h–1d | L1 propose-only | Low |
A unified CLI scaffolds a pattern into a repository, checks readiness, audits it into a Loop Ready score that weights recent runs over files on disk, and estimates token cost per pattern and autonomy level. Examples cover Claude Code (including a plugin), Grok, Codex, OpenClaw, OpenCode, and GitHub Actions, alongside documentation on failure modes, anti-patterns, and safety.
Features
- Pattern library: eight loop patterns for triage, PR babysitting, CI and dependency sweeps, changelogs, post-merge cleanup, and issue triage
- Autonomy levels: staged rollout from L1 report-only to L2 assisted to L3 unattended
- Maker and checker split: an implementer agent works in an isolated worktree and a verifier agent runs tests and policy gates before anything ships
- Human gate: risky or ambiguous changes escalate to an engineer, while allowlisted safe changes can proceed
- Loop Ready score: an audit command scores a repository's loop setup and weights recent runs over static files
- Cost estimates: projects token cost for a pattern at a given autonomy level
- Cross-tool examples: starters for Claude Code, Grok, Codex, OpenClaw, OpenCode, and GitHub Actions
- Thin loop starter: a GitHub Actions loop that needs almost no files and no state file
- Operating guidance: failure modes, anti-patterns, safety notes, and run stories including failures