Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.
TypeScript agentic-aiai-agentsai-codinganthropicautomationclaudeclaude-codecodexcoding-agentsdevops-automationdevtoolsgithub-actionsgrokllmloop-engineeringmcpprompt-engineering
Safe Write Pattern (MCP + Loops)
Any time a loop needs to change external state (create PR, update ticket, post comment that looks official), follow this pattern:
- Discovery / Triage (read MCP or local git)
- Worktree for code changes (isolated)
- Implementer sub-agent (minimal-fix or equivalent)
- Verifier sub-agent (separate session or higher-reasoning model)
- Propose only:
- Open a draft PR (or comment with diff link + summary)
- Or create/update a ticket with "proposed by loop — human review requested"
- Sign everything:
🤖 Loop Engineering — <Pattern Name>
- Record in state (what was proposed, link, timestamp, risk)
- Human gate (or very narrow allowlist + extra verifier for trivial patches)
- Prune / close stale proposals on next runs
Example MCP + Prompt Snippet (Grok)
/loop 15m
Use github-propose MCP (read + draft PR + comment).
Run pr-review-triage on open PRs.
For low-risk, allowlisted items that pass verifier:
- open worktree
- minimal-fix
- loop-verifier
- post signed comment + link to worktree (or open draft PR)
Never merge. Update pr-babysitter-state.md.
Why This Works
- The loop has agency (it can discover and propose quickly).
- The human (or strict allowlist) retains final authority on mutation.
- Full context lives in STATE + the PR/ticket, so comprehension debt stays manageable.
- Easy to pause:
scheduler_deleteor disable the Action.
This is the recommended default for all L2+ loops that touch external systems.