Loop Engineering — stop babysitting your agents

teamagentic-engineeringv2agentic-engineeringreference
What this is. The Cofoundy operating doctrine for getting agents OUT of the hot path: how to give an agent the tools + instructions to verify its own work, run many in parallel, and keep looping in the background — so your keyboard stops being the bottleneck. Part of agentic engineering (the operator-fluency layer).

The mental shift: the prompt is the source

The code is no longer the source of truth — it's the build artifact of a prompt. The programmer writes the prompt; the prompt writes the code. So the thing worth versioning above the code is the prompt (and the intent behind it). Lose the prompt and you've lost the thing that can regenerate and evolve the code; keep it and the code is reproducible, auditable, improvable.

Practice: version prompts as a first-class artifact (a prompts/ log linked to the commit/PR each produced), and consolidate the intent above them. Code review becomes prompt review.

The flywheel: three layers that compound

Three capabilities stack — each one unlocks the next. (Framework credit: Sid Bhattacharya, "Stop babysitting your agents," Claude Code team.)

  1. Verification
    Teach the agent to check its own work in a loop. Reliability is the prerequisite for everything else.
  2. Multi-agent
    Once an agent is reliable, run many in parallel with confidence — waves, worktrees, councils.
  3. 3
    Background loops
    Take the keyboard out of the hot path entirely — the loop runs and self-perpetuates while you sleep.

1. Verification loops — teach the agent to check its own work

A loop is an autonomous circuit: write code → build/run → observe (logs, browser, DB, tests) → on failure, debug + rewrite → repeat until a success state. Give the agent the tools (dev server, browser MCP, smoke scripts, test runner) and the instructions, and it hill-climbs to a working result — so the PR it hands you actually works.

Run the thing (dev server / worker / container)
Drive it (browser MCP, or direct API/JSON-RPC calls)
Prove it (assert before/after; capture evidence — screenshot, curl output, status codes)
Unblock it (auth identity + seeded state, as dynamic scripts the agent can run)
Live > mocks. Mocked tests pass while the real path is broken. On the docs-ai MCP build, live e2e against a preview caught 4 real bugs mocks hid (a no-try/catch dispatch, an unmapped error code, a missing asset-serving route, an over-strict sanitizer). Always smoke the real surface before merge; the smoke script is itself a deliverable.

Package a verification loop as a self-improving skill: instruct the skill to edit itself whenever it hits a blocker. The next agent (or teammate) never hits that blocker again — the skill compounds across the team.

2. Multi-agent — parallelize once reliable

When each agent verifies itself, you can fan out. Cofoundy's patterns:

Waves + worktrees: disjoint file-ownership matrix → zero-conflict parallel merges
Councils: N agents argue distinct stances → a judge panel scores → synthesize (design/research)
Adversarial gates: an independent ceo-agent / CSO review before merge (caught a real stored-XSS this way)
Integrators between waves: tsc + tests + commit, so wave N+1 builds on verified wave N

3. Background loops — keyboard out of the hot path

The endgame: you stop spinning up sessions. The loop runs on a trigger and self-perpetuates.

/loop — run a prompt on an interval (babysit PRs, keep CI green, update docs)
Routines / scheduled cloud agents — the same, remote, on cron or events
Next-session prompt — at run end the agent writes the prompt that kicks off the next run (prompt as source, applied to continuity)
Human stays at the gates (strategy, prod, irreversibles) — not in the typing loop

The Cofoundy CTO flywheel (worked example)

/cto is this flywheel made concrete: ground → council (design) → ceo-gate → parallel build in worktrees → integrate → live e2e verify → gated merge to prod → prod smoke → publish + handoff. The overnight T1.9 run that produced this very page:

Agents orchestrated
30+
Prod e2e (live MCP)
13/13
Bugs caught by live e2e
4
Human gates hit
design · prod-merge
Dogfood: this page was authored as MDX, compiled locally, and published to docs.cofoundy.dev through the MCP publish tool the same run shipped — the loop closing on itself.

Where this lives

Loop engineering is the how of agentic engineering. The fluency map (24 progressive concepts, operator → system-improver) is the AI-Native Curriculum; the access + integrity layer is the onboarding protocol. Together they're the agentic-engineering knowledge base every Cofoundy operator works from.

Operate the loop
New here? Start with the AI-Native Curriculum for fluency, then come back here to put agents in loops.
AI-Native Curriculum →