-
Notifications
You must be signed in to change notification settings - Fork 0
LoopEngineering
Most work with an AI coding agent is hand-driven: a person writes a prompt, reads the reply, writes the next prompt, and re-explains context every session. Loop engineering is the practice of removing the person from that inner loop by building a system that prompts the agent instead. As Addy Osmani describes it, "loop engineering is replacing yourself as the person who prompts the agent; you design the system that does it instead." The system discovers work, executes it, verifies the result, and decides the next step without a human in the middle.
Manual prompt-read-prompt iteration does not scale, and it forgets. Each session starts cold, with context re-explained by hand, so knowledge that should accumulate across runs is lost. The pattern's premise is that a well-designed loop remembers what humans forget.
- Automations: scheduled tasks that trigger discovery and triage on their own.
- Worktrees: isolated parallel branches so multiple agents do not conflict.
- Skills: documented project knowledge (conventions, build steps) that agents reuse across runs.
- Connectors: integrations to real tools such as issue trackers, chat, and APIs so the agent can act, not just suggest.
- Sub-agents: separate agents for ideation and for verification, so the maker does not grade its own work.
- State tracking: persistent Markdown or boards that record progress between runs, letting knowledge compound.
The post is explicit that loops amplify both productivity and risk. Verification remains a human responsibility, and building loops without keeping engineering judgment in place risks what it calls cognitive surrender. The pattern is a way to scale attention, not to remove it.
An intended instantiation of this pattern as an "auditor loop": an autonomous loop whose prompt includes an audit step that grades each durable artifact against existing decision ladders and objective checks, escalating to a single human gate. Recorded as a decision record so the choices are not re-derived later. Not yet executed; running it once end to end, where the auditor escalates a real CONFIRMED finding and the loop stops for review, is the gate to promote this blip to Trial.
| Decision | Choice | Why |
|---|---|---|
| Audit trigger | An explicit step in the loop prompt, not a hook | Hooks firing inside loops is undocumented; a prompt step relies only on documented behavior |
| Auditor mechanism | A cold verifier subagent, not a second nested loop | Reuses the native subagent; one loop whose prompt includes the audit |
| Rubric | ponytail + wiki placement ladder + i-have-adhd, plus objective passes (triage, check scaffold, tests) | Reuses existing ladders; objective passes are model-independent |
| Escalation payload | ReportFindings (empty = pass, CONFIRMED = escalate) | Native, already structured worst-first |
| Pass/escalate | Escalate CONFIRMED and stop the loop; auto-retry PLAUSIBLE once | Stops errors compounding while unattended |
| Scope and state | git diff for scope; git is the state | Reuse; no separate audit ledger |
| Iteration budget | Stop after 2 iterations via a self-stop | Usage percentage is not machine-readable; iteration count is a proxy that is |
| Usage backstops | /usage-credits monthly cap and the 7-day loop auto-expiry | Native, documented |
| Worker model / effort | Opus / low, set at the session | A strong maker avoids audit-retry churn; the audit is the quality gate |
| Verifier model / effort | Opus / medium, pinned in the subagent definition | Audit judgment is the point; the only real per-role lever |
| Cadence | Dynamic (1 minute to 1 hour) | Self-paces; matters once the iteration budget grows |
| Permissions | Medium for in-branch actions; escalate anything a branch cannot undo (main push, VPS SSH, secret reads, network calls) | A working branch reverses repo actions, not external side effects |
| loop.md location | .claude/loop.md in the target repo | Co-located with the work and the settings.json permissions it inherits; goal and boundaries are per-repo |
The runnable spec (the loop prompt, the verifier subagent definition, the permissions allow-list) lives in the target repo's .claude/ directory; this section records the reasoning, not the executable form.
Loop engineering sits next to Scaling Long-Running Autonomous Coding but is kept separate: this entry is the construction pattern for the autonomous loop itself (automations, worktrees, sub-agents, state), while the other addresses the endurance and scaling behavior of long-running agents.
Assess. The pattern is documented in a single blog post by Addy Osmani and describes a reusable workflow rather than a product; it is captured here as a technique with the post as source evidence, following the practice of absorbing a documented workflow as a Techniques entry rather than a blog article. There is no first-person production loop yet, so it stays in Assess. Center position reflects that the value is the assembled pattern rather than any single component, most of which already exist individually.