Skip to content

Agents that run on a heartbeat

Loop Engineering: Build Agents That Run Themselves

Stop prompting. Start looping.

A hands-on crash course in loop engineering — building agents that run on a heartbeat, checked by a second pair of eyes, and gated by a human who stays the engineer.

MIT · 6 parts · 20 starter kits · 11 projects

loop-kit — daily-triage
npx @loop-engineering/loop-kit daily-triage
fetching @loop-engineering/loop-kitno clone · no global install
scaffolding daily-triage into ./Node 18+, nothing else
loops/daily-triage/
LOOP.mdthe definition — six parts, prompt, stops
daily-triage-state.mdthe spine — commit before beat 1
loop-budget.mdcaps + the 80% tripwire
loop-constraints.mdthe constitution
loop-run-log.mdappend-only, one line per beat
.claude/
skills/daily-triage/SKILL.mdthe procedure
agents/loop-verifier.mdthe read-only checker
Loop Ready ████████████ L1 · report-only
First loop command:
/loop 1d Run loop-triage. Update STATE.md. No auto-fix in week one.
done · 7 files · Node 18+ · no clone required

Anatomy of a loop

What one loop looks like

A loop is not a prompt you re-send. It's a cycle that schedules itself, does the work in isolation, gets graded by a second pair of eyes, and stops at a human. Then it beats again.

  1. 01 Schedule

    The heartbeat fires — a timer, a condition, or an event.

  2. 02 Load state

    Read STATE.md and the run log — what survived the last beat.

  3. 03 Triage

    Pick the next unit of work, or stop if there's none.

  4. 04 Worktree

    Isolate the run in its own checkout so nothing collides.

  5. 05 Implement

    The maker agent does the work inside the worktree.

  6. 06 Verify

    A separate checker grades it — never the maker itself.

  7. 07 Human gate

    A person approves, escalates, or rejects the change.

  8. 08 Commit

    Apply over MCP, append one line to the log — then beat again.

The six parts

Drop any one and the loop earns a familiar failure name — no heartbeat and it's a script you run by hand; no checker and it grades itself; no human gate and it ships with no owner.

Heartbeatpulse
When does a beat start?
Bodyhands
What may it do and touch?
Spinememory
What survives between beats?
Stopping conditionfinish line
How does it provably end?
Checkersecond pair of eyes
Who grades the work?
Human gatesignature
Where does a person decide?

Architecture

How a loop is built up

The same five layers under every loop. A human designs the top; work descends to real tools at the bottom; results climb back up to the gate.

  1. L0

    Human

    Design the loop, hold the gate, review the diffs.

    The engineer
  2. L1

    Control plane

    Scheduling, pattern selection, and budget caps.

    Heartbeat
  3. L2

    Durable memory

    STATE.md, LOOP.md, and the run log — carried between beats.

    Spine
  4. L3

    Execution

    Worktrees and the maker / checker agents doing the work.

    Body
  5. L4

    Tooling

    CLIs and MCP connectors — the hands that touch real systems.

    Hands

Three rungs of autonomy

Every loop starts on the bottom rung and earns its way up. You decide how far.

  1. L1Report-only

    The loop looks and tells you. It writes findings; a human makes every change.

    Where triage-loop runs.

  2. L2Assisted

    The loop proposes and drafts — one small change at a time — and waits at the gate.

    Small auto-wins after week one.

  3. L3Unattended

    The loop runs to completion on its own, stopping only when done or stuck.

    Where build-loop runs — still human-gated on deploy.

Patterns

Production patterns, ready to fork

Six loops that already earn their keep. Each ships as a write-up plus a starter kit you can fork today.

PatternCadenceRiskWhat it doesLinks
PR BabysitterOn PR eventsmediumShepherds a PR through review, CI, and rebase. The human stays in the merge seat.
Daily TriageDailylowA morning scan of CI, issues, and commits. Report-only in week one, small auto-wins after.
CI SweeperOn CI failuremediumReacts to a failing check with the smallest fix that passes it. Escalates after three tries.
Dependency SweeperWeeklymediumOpens one PR per upgrade, reads the changelog, and flags anything that needs a human look.
Issue TriageOn new issuelowLabels, dedupes, and routes a new issue before anyone on the team has seen it.
Changelog DrafterOn releaselowReads the merged commits since last tag and drafts release notes for a human to edit.

Get started

Clone it and go

bash — LoopEngineering-CrashCourse
$ git clone https://github.com/ayeshakhalid192007-dev/LoopEngineering-CrashCourse.git
public repo · MIT · git 2.x
  1. 1

    Clone & skim the map

    Start here — the course overview and how to navigate it.

  2. 2

    Learn the foundations

    The primitives and mental models every loop is built from.

  3. 3

    Build your first loop

    A guided watch loop — your first hands-on project.

Build a loop that ships while you sleep.