@Huahuazo: Boris Cherny作为Claude Code的负责人,早就放话说不手动写prompt了——他写自动化循环程序来驱动AI工作。 OpenClaw的创建者也有差不多的实践心得。圈子里管这叫Loop Engineering,把提示词工程从…
摘要
介绍开源项目 Loop Engineering,将提示词工程升级为构建自动化循环系统,提供多个生产级模式与工具,支持 Claude Code、Codex 等。
查看缓存全文
缓存时间: 2026/08/14 03:28
Boris Cherny作为Claude Code的负责人,早就放话说不手动写prompt了——他写自动化循环程序来驱动AI工作。
OpenClaw的创建者也有差不多的实践心得。圈子里管这叫Loop Engineering,把提示词工程从“写话术”升级成了“搭系统”。
这个开源项目把这套思路做成了可以直接落地的方案:automations做定时触发,worktrees提供隔离环境,skills沉淀项目上下文,plugins通过MCP对接外部工具,sub-agents把工作流拆成生成和校验两段,STATE文件负责跨会话记忆。
7个经过验证的生产级模式,每个都提供了Claude Code、Codex等四种工具的实现,还附带了loop-audit、loop-init、loop-cost三个管理工具。
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.
Start in 5 minutes · Quickstart · Pattern picker · Contribute · ⭐ Star
If this repo changed how you run agents, a star helps others find the patterns. Docs & small PRs: we aim to review within 48 hours.
# One front door — init + doctor + status
npx @cobusgreyling/loop init . --pattern daily-triage --tool grok
npx @cobusgreyling/loop doctor .
loop init scaffolds skills, state, and budget files, then prints your Loop Ready score. loop doctor turns audit + sync into top-3 next actions. Swap --tool for claude, codex, or opencode. Optional: --with-foundry for a versioned harness stack. Legacy npx @cobusgreyling/loop-init . still works. See docs/cli-front-door.md.
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 · Help wanted
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
- Help wanted
- Contributing
- Sources
- License
Quick Links
| Start here | Description |
|---|---|
| Quickstart (5 min) | loop init → loop doctor → first loop — start here if you just landed |
| CLI front door | Unified @cobusgreyling/loop — old packages stay open |
| 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 (front door) | Unified CLI — npx @cobusgreyling/loop init | doctor | status | audit | cost · cli-front-door |
| loop-audit | Loop Readiness Score CLI (v1.7 — constraints + governance + Harness Runtime) — npx @cobusgreyling/loop audit . --suggest · also loop-audit |
| loop-init | Scaffold starters + budget/run-log + constraints (v1.5) — npx @cobusgreyling/loop init . --pattern daily-triage --tool grok · also loop-init |
| harness-foundry | Companion runtime: versioned stacks, sessions, traces — npx @cobusgreyling/harness-foundry init --from loop-engineering:daily-triage |
| outerloop | Companion governance: evidence → verdict → answerability |
| 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 — npx @cobusgreyling/loop-mcp-server |
| loop-worktree | Manage isolated git worktrees per fix attempt — npx @cobusgreyling/loop-worktree create --run-id <id> --pattern <p> |
| loop-gate | Mechanical enforcement of the path denylist + auto-merge allowlist from gate.yaml — npx @cobusgreyling/loop-gate check --action auto-merge --paths <f1,f2,...> |
| loop-sandbox | Ephemeral git worktree isolation + patch capture — npx @cobusgreyling/loop-sandbox run -- <cmd> |
| loop-action | GitHub Composite Action for running loops in CI — uses: cobusgreyling/loop-engineering/tools/loop-action@main |
| Goal Engineering | Companion: loops discover, goals finish — /goal + stack cookbook (npx @cobusgreyling/goal doctor .) |
| Memory Engineering | Companion: stop re-explaining the repo — tiers, budget, Memory Ready score (node tools/memory-init/cli.js .) |
| Fleet Engineering | Companion: govern populations of agents — registry, inbox, Fleet Ready score (npx @cobusgreyling/fleet-init .) |
| Stories | Real wins and honest failures |
Ecosystem stack
memory-engineering → loop-engineering → harness-foundry → outerloop → fleet-engineering
(persist) (patterns) (runtime) (verdict) (population)
| Layer | You get | Start |
|---|---|---|
| Memory | Tiers, recall budget, Memory Ready score | memory-engineering |
| Design (this repo) | Patterns, starters, Loop Ready score | npx @cobusgreyling/loop init . then loop doctor . |
| Runtime | Versioned harness, traces, evolve | npx @cobusgreyling/loop init . --with-foundry or Foundry showcase |
| Govern | Evidence, verdict, answerability | outerloop |
| Fleet | Registry, inbox, budgets, kill switch | npx @cobusgreyling/fleet-init . · Fleet Ready |
Scale beyond one loop: when agents forget across sessions, add memory-engineering. When you have many agents/loops on a team, add fleet-engineering.
Next after Loop Ready 80+: version the loop as a harness — loop-init prints the CTA automatically; loop-audit recommends Foundry when the score is strong but .foundry/stack.yaml is missing.
Community & announcements
| Discussion | Summary |
|---|---|
| Contributor quickstart | Help wanted: open good first issues — comment I’ll take this to get assigned · see Help wanted |
| Community update | July 4: 5.5k stars, traffic sources, contributor merges |
| Community week (Jul 8) | loop-worktree npm, MCP quickstart, tool appendices |
| npm update (Jul 16) | loop-context 1.2.0 + loop-worktree 1.1.0 — daily budget, path locks |
| Maintenance (Jul 10) | Doc sync, branch prune, loop-audit 1.6.0 follow-up |
| 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
Deeper diagrams — the actor-level sequence within one run, the run lifecycle’s states, autonomy levels L1-L3, and how tools/ maps onto the primitives — live in docs/architecture-diagrams.md.
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 + Loop Ready score (printed automatically)
npx @cobusgreyling/loop init . --pattern daily-triage --tool grok
# 2. One health check (audit + sync + files → top 3 actions)
npx @cobusgreyling/loop doctor .
# 3. Optional: cost estimate / badge / day-2 dashboard
npx @cobusgreyling/loop cost --pattern daily-triage --level L1
npx @cobusgreyling/loop badge .
npx @cobusgreyling/loop status .
# 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.
Same as before: npx @cobusgreyling/loop-init and loop-audit still work — CLI front door.
All npm CLIs publish from tagged releases — see docs/RELEASE.md. No clone required.
Develop from source (monorepo contributors):
cd tools/loop && npm ci && npm test && node dist/cli.js doctor ../..
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? Pick an open issue below, or Add Adopter / Share a story.
Review SLA: docs, stories, adopters, and small tests — within 48 hours (same-day when possible). See CONTRIBUTORS.md and the contributor quickstart.
good first issue backlog (comment “I’ll take this” for assignment). Prefer the live filter if a row below looks stale.
| Time | Issue | What you ship |
|---|---|---|
| ~10 min | #120 — Adopters list | One row in docs/adopters.md (or Add Adopter template) |
| ~15–20 min | #118 — Daily Triage story · #173 — Issue Triage story · #119 — PR Babysitter failure | Honest stories/ write-up + index row |
| ~20–25 min | #483 — Windows notes | Windows/CRLF landing notes in QUICKSTART (pain from #476) |
| ~20–40 min | #481 — append-run-log JSON test · #480 — skill-dedup test · #479 — loop-sync CRLF tests | Regression tests locking fixes from #474–#476 |
| ~40–45 min | #387 — Hermes CI Sweeper · #388 — Hermes Issue Triage · #484 — Windsurf Post-Merge · #485 — Windsurf Changelog | Fill pattern-coverage gaps in examples/ |
| Anytime | Templates | Add Adopter · Share a story |
| Hubs | Discussions | Show your loop · Ask anything |
Recently shipped (thanks!): @pxmpsdev — loop-sync CRLF tests (#496), readiness skill-dedup (#497), append-run-log invalid-JSON (#498), metrics unparseable run_id (#499). @shixi-li — Hermes CI Sweeper example (#500). Earlier: @pxmpsdev #474–#477.
Docs/examples triage: @AIMindCrafter co-owns docs/, examples/, and stories/ (see CODEOWNERS + docs/area-owners.md).
Maintainers re-seed the backlog with bash scripts/create-good-first-issues.sh (idempotent; skips existing titles). Prefer live open GFI filter over this table if a row looks stale.
Contributing
Share production patterns, tool mappings, and failure stories. See CONTRIBUTING.md (ladder + setup), Code of Conduct, adopters, and hubs: Show your loop · Ask anything.
We aim to first-respond within 48 hours on external PRs. Start here: good first issue · Help wanted.
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.
Essay · Showcase · Cobus Greyling
Static chart (CI-updated daily). Live chart needs a GitHub token — stored in your browser only.
相似文章
@Lonely__MH: 提示词已死,Loop Engineering 已来! 最近,AI 编程领域的 Loop Engineering(循环工程) 概念引发了技术圈的广泛讨论。 Claude Code 负责人 Boris Cherny 在近期采访中,分享了团队内…
Claude Code负责人Boris Cherny提出AI编程正从提示词工程转向循环工程(Loop Engineering),未来开发者核心任务是设计自动化循环而非编写提示词,这一趋势有望拉平开发门槛。
@seclink: 开发者正从“一次性提示词”转向“智能体循环”模式——即让像 Anthropic 旗下 Claude 这样的 AI 自主设定目标、利用工具执行操作、观察结果并不断迭代,直至任务成功。 Claude Code 的开发者 Boris Chern…
开发者正从一次性提示词转向'智能体循环'模式,让AI自主设定目标、利用工具迭代执行任务。Claude Code的开发者Boris Cherny已彻底放弃传统IDE,转而运行数百个智能体来监控问题和合并PR,甚至仅靠手机完成这些工作。
@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.
@Xudong07452910: 开源项目推荐:loop-engineering —— 让你的 AI 编码 Agent 拥有自循环与智能编排能力的实用框架 loop-engineering 是目前很火的概念,该项目提供了实用模式、启动器和 CLI 工具,帮助开发者设计系统…
loop-engineering 是一个开源框架,为 AI 编码代理(如 Claude Code、Codex、Cursor)提供自循环和智能编排能力,包含 7 个生产级循环模式、实用 CLI 工具和五大数据块设计,帮助开发者从手动提示转向系统化自动化。
@Mikocrypto11: Claude Code 的创造者 Boris 讲了一个很关键的转变: “我现在不再给 Claude 写 prompts。 我写 loops 然后让 loops 去完成工作 我的工作,就是写 loops。” 这其实也是很多人用 Claude…
Claude Code 的创造者 Boris 分享了一个关键转变:从写 prompts 转为写 loops,让模型在可重复执行的循环中持续推进任务,而非一次性给出答案。