@aronhouyu: Loop Engineering 现在很多人用 Claude Code、Codex 或者 Cursor 的时候, 还跟聊天机器人一样操作: 先扔个 prompt → 等它回 → 复制出来 → 改改 bug → 再扔新 prompt……循环…
摘要
Loop Engineering is a new methodology and open-source toolkit that replaces manual prompting of AI coding agents with automated loops. It provides pre-built patterns and CLI tools for tasks like PR review, CI checks, and dependency updates, enabling developers to design systems that autonomously direct agents.
查看缓存全文
缓存时间: 2026/07/05 18:36
Loop Engineering
现在很多人用 Claude Code、Codex 或者 Cursor 的时候,
还跟聊天机器人一样操作:
先扔个 prompt → 等它回 → 复制出来 → 改改 bug → 再扔新 prompt……循环往复。
这个 repo 直接告诉你:
别再自己一直 prompt 了,
你去设计一个 loop,
让这个 loop 自动去给 agent 下指令、指挥它干活。
里面已经帮你准备好好几种现成的 loop,比如:
• 每天任务分流 loop • PR 自动审查 loop • CI 检查 loop • 依赖更新 loop • 写 changelog loop • 合并后自动清理 loop • issue 分类处理 loop
还附带了好几个 CLI 工具,能让你:
• 把 loop 放大规模 • 估算大概花多少 token • 检查你的 repo 适不适合用这套东西 • 给 agent 加记忆/状态 • 加人工接管环节 • 加验证关卡 • 还能安全地通过 GitHub Actions 跑
以前 Prompt Engineering 是教你怎么写好指令,
现在 Loop Engineering 是让你搭一个系统, 让 agent 自己跑、自己检查、自己改、自己扩展,
你只要在关键节点看看就行。
https://github.com/cobusgreyling/loop-engineering…
cobusgreyling/loop-engineering
Source: https://github.com/cobusgreyling/loop-engineering
Loop Engineering
Stop prompting. Design the loop. Get a score.
npx @cobusgreyling/loop-init .
loop-init scaffolds skills, state, and budget files, then prints your Loop Ready score and first loop command. Swap --tool for claude, codex, or opencode.
Loop engineering replaces you as the person who prompts the agent — you design the system that does it instead.
New here? Quickstart (5 min) · Interactive picker
For developers using Grok, Claude Code, Codex, Cursor, and other AI coding agents.
→ Interactive showcase + pattern picker · Essay · Addy Osmani
Contents
- Quickstart (5 min)
- Quick Links
- Why This Matters
- The Five Building Blocks + Memory
- Patterns
- Getting Started (5 minutes)
- Examples by Tool
- Operating & Safety
- Caveats
- Contributing
- Sources
- License
Quick Links
| Start here | Description |
|---|---|
| Quickstart (5 min) | Scaffold → cost check → audit → first loop — start here if you just landed |
| Loop Engineering essay | The concept, primitives, and Grok mapping — read for the why |
| Pattern Picker | Which loop to run first — start here if unsure |
| Primitives Matrix | Cross-tool loop primitive mapping — bookmark this |
| Loop Design Checklist | Ship readiness rubric |
| Patterns | 7 production patterns + interactive picker |
| Starters | Clone-and-run kits (Grok, Claude Code, Codex, Opencode) |
| Opencode examples | CLI-first loops: cron/systemd + opencode run, skills, worktrees |
| loop-audit | Loop Readiness Score CLI (v1.5 + constraints scoring) — npx @cobusgreyling/loop-audit . --suggest · --badge for README |
| loop-init | Scaffold starters + budget/run-log + constraints (v1.2) — npx @cobusgreyling/loop-init . --pattern daily-triage --tool grok |
| loop-cost | Token spend estimator — npx @cobusgreyling/loop-cost |
| loop-sync | Drift detection between STATE.md and LOOP.md — npx @cobusgreyling/loop-sync . |
| loop-context | Stateful memory manager + circuit breaker for long runs — npx @cobusgreyling/loop-context --check --ledger run.json |
| loop-mcp-server | MCP runtime lookup for patterns, skills, state — node tools/mcp-server/dist/index.js (repo v1; npm pending) |
| Goal Engineering | Companion: loops discover, goals finish — /goal + stack cookbook (npx @cobusgreyling/goal doctor .) |
| Stories | Real wins and honest failures |
| Contributor quickstart | Help wanted: 12 scoped good first issues — comment I’ll take this to get assigned |
| Community update | July 4: 5.5k stars, traffic sources, contributor merges |
| Prior release notes | v1.5.0 — loop-sync, constraints, MCP server |
| Add your project | Pinned: Loop Ready badge + adopters list |
Why This Matters
Peter Steinberger:
“You shouldn’t be prompting coding agents anymore. You should be designing loops that prompt your agents.”
Boris Cherny (Head of Claude Code at Anthropic):
“I don’t prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops.”
The leverage point has moved from crafting individual prompts to designing the control systems that orchestrate agents over time.
The Five Building Blocks + Memory
| Primitive | Job in the Loop |
|---|---|
| Automations / Scheduling | Discovery + triage on a cadence |
| Worktrees | Safe parallel execution |
| Skills | Persistent project knowledge |
| Plugins & Connectors | Reach into your real tools (MCP) |
| Sub-agents | Maker / checker split |
| + Memory / State | Durable spine outside any conversation |
Full detail: docs/primitives.md · Cross-tool matrix: docs/primitives-matrix.md
Visual Overview
Anatomy of a Loop
Mermaid diagram (copy-friendly)
flowchart LR
A[Schedule / Automation] --> B[Triage Skill]
B --> C[Read + Write STATE / Memory]
C --> D[Isolated Worktree]
D --> E[Implementer Sub-agent]
E --> F[Verifier Sub-agent<br/>tests + gates]
F --> G[MCP / Git / Tickets]
G --> H{Human Gate?}
H -->|safe / allowlisted| I[Commit / PR / Action]
H -->|risky / ambiguous| J[Escalate to human<br/>with full context]
I --> A
J --> A
This reference repo now runs its own validate-patterns + audit workflows on every push/PR (see .github/workflows/). We also added LOOP.md describing the loops that will maintain it.
Patterns
| Pattern | Cadence | Starter | Week 1 | Token cost |
|---|---|---|---|---|
| Daily Triage | 1d–2h | minimal-loop | L1 report | Low |
| PR Babysitter | 5–15m | pr-babysitter | L1 watch | High |
| CI Sweeper | 5–15m | ci-sweeper | L2 cautious | Very high |
| Dependency Sweeper | 6h–1d | dependency-sweeper | L2 patch-only | Medium |
| Changelog Drafter | 1d or tag | changelog-drafter | L1 draft | Low |
| Post-Merge Cleanup | 1d–6h | post-merge-cleanup | L1 off-peak | Low |
| Issue Triage | 2h–1d | issue-triage | L1 propose-only | Low |
Not sure which to pick? Try the interactive picker or pattern-picker.
Machine-readable index: patterns/registry.yaml (7 patterns)
Getting Started (5 minutes)
# 1. Scaffold + get your Loop Ready score (printed automatically)
npx @cobusgreyling/loop-init . --pattern daily-triage --tool grok
# 2. Estimate token spend for your cadence
npx @cobusgreyling/loop-cost --pattern daily-triage --level L1
# 3. Re-audit after improvements
npx @cobusgreyling/loop-audit . --suggest
# Optional: paste Loop Ready badge into your README
npx @cobusgreyling/loop-audit . --badge
# 4. See scores climb: empty → L1 → L2
bash scripts/before-after-demo.sh
# 5. Start report-only (Grok example)
/loop 1d Run loop-triage. Update STATE.md. No auto-fix in week one.
All three CLIs publish to npm from tagged releases — see docs/RELEASE.md. No clone required.
Develop from source (monorepo contributors):
cd tools/loop-init && npm ci && npm test && node dist/cli.js /path/to/project --pattern daily-triage --tool grok
cd tools/loop-audit && npm ci && npm test && node dist/cli.js /path/to/project --suggest
cd tools/loop-cost && npm ci && npm test && node dist/cli.js --pattern ci-sweeper --cadence 15m
Phased rollout: L1 report → L2 assisted fixes → L3 unattended — see loop-design-checklist.
Examples by Tool
Operating & Safety
- Failure Modes — incident-style catalog
- Anti-Patterns — design mistakes before production
- Multi-Loop Coordination — when loops collide
- Operating Loops — cost, logging, when to kill
- Safety — denylist, auto-merge, MCP scopes
- Security — reporting and unattended automation risks
- Concepts — intent debt, comprehension debt, harness vs loop
- MCP Cookbook — connector examples by pattern
Caveats
Loop engineering amplifies judgment — both good and bad.
- Token costs can explode with sub-agents and long-running loops.
- Verification is still on you. Unattended loops make unattended mistakes.
- Comprehension debt grows faster unless you read what the loop ships.
- Two people can run the same loop and get opposite results. The loop doesn’t know. You do.
Addy Osmani:
“Build the loop. But build it like someone who intends to stay the engineer, not just the person who presses go.”
Help wanted
First PR? Start with the contributor quickstart — ~10 min to ~1 hr tasks with same-day review on stories and adopters.
| Pick one | Issue |
|---|---|
| ~10 min | #120 — Add your project to adopters |
| ~20 min | #121 — QUICKSTART loop-init --tool values |
| ~1 hr | #118 / #119 — failure stories welcome |
Comment “I’ll take this” on any good first issue for assignment.
Contributing
Share production patterns, tool mappings, and failure stories. See CONTRIBUTING.md (contribution ladder + good first issue backlog), adopters, and GitHub Discussions.
Sources
- Cobus Greyling – Loop Engineering (Substack)
- Addy Osmani – Loop Engineering
- Attribution & further reading
License
MIT
Practical, tool-aware reference for loop engineering, patterns you can clone, checklists you can ship against, and stories that include what broke.
相似文章
@RoundtableSpace:循环工程正在取代提示工程 仓库:https://github.com/cobusgreyling/loop-engineering…
一种称为循环工程的新范式被引入,从手动提示工程转向设计能够自主提示AI代理的系统。该GitHub仓库提供了模式、快速入门指南以及npm包,用于实现与Grok、Claude Code和Cursor等编码代理的循环。
@cellinlab: https://x.com/cellinlab/status/2064144608242679822
这篇文章介绍了 Loop Engineering 的概念——不再直接给 AI agent 写 prompt,而是设计一个系统(loop)来递归地让 agent 迭代工作,直到任务完成。文章详细对比了 Claude Code 和 Codex 在 automations、worktrees、skills、sub-agents 等五个构建块上的实现,认为这可能是未来与 coding agent 协作的趋势,但仍需警惕 token 成本和 AI slop 问题。
@Xudong07452910: 开源项目推荐:loop-engineering —— 让你的 AI 编码 Agent 拥有自循环与智能编排能力的实用框架 loop-engineering 是目前很火的概念,该项目提供了实用模式、启动器和 CLI 工具,帮助开发者设计系统…
loop-engineering 是一个开源框架,为 AI 编码代理(如 Claude Code、Codex、Cursor)提供自循环和智能编排能力,包含 7 个生产级循环模式、实用 CLI 工具和五大数据块设计,帮助开发者从手动提示转向系统化自动化。
@Huahuazo: Boris Cherny作为Claude Code的负责人,早就放话说不手动写prompt了——他写自动化循环程序来驱动AI工作。 OpenClaw的创建者也有差不多的实践心得。圈子里管这叫Loop Engineering,把提示词工程从…
介绍开源项目 Loop Engineering,将提示词工程升级为构建自动化循环系统,提供多个生产级模式与工具,支持 Claude Code、Codex 等。
@Lonely__MH: 提示词已死,Loop Engineering 已来! 最近,AI 编程领域的 Loop Engineering(循环工程) 概念引发了技术圈的广泛讨论。 Claude Code 负责人 Boris Cherny 在近期采访中,分享了团队内…
Claude Code负责人Boris Cherny提出AI编程正从提示词工程转向循环工程(Loop Engineering),未来开发者核心任务是设计自动化循环而非编写提示词,这一趋势有望拉平开发门槛。