Loop Engineering:把 prompt agent 替换为设计循环系统

速读:[[../raw/2026-06-Addy-Osmani-Loop-Engineering-digest Raw Digest]] · 原文:[[../raw/2026-06-Addy-Osmani-Loop-Engineering Raw 原文]]

核心结论(一句话)

Loop engineering = 用一个”会自己循环的 5+1 积木系统”替代”人按 turn 提示 agent”的新范式;Claude Code 与 Codex 已具备全部 5 个积木 + MCP 互通 = 跨工具设计 loop 成为可能;但真正的难点不是工具,是设计 loop 时的工程判断力——verification / comprehension debt / cognitive surrender 三个反噬不警惕,再好的 loop 也会变成灾难加速器。

分类提炼

知识节点(10 个独立概念)

每条独立成段可理解,对应一个可 grep 关键词,不与同篇其他节点重叠。

关联图谱

上游(基于 / 来自)

下游(应用于 / 验证于)

同级(横向 / 并列 / 镜像)

正文要点(7 条)

一、范式跃迁:从”你按 turn 提示 agent”到”你设计系统调 agent”

过去两年用 coding agent 的方式是:你写 prompt → 看输出 → 写下一个 prompt → 重复。agent 是工具,你全程握着。这件事正在结束。新范式是:你建一个小型系统,让系统去找工作、分派工作、验收、记下结果、决定下一步——系统替你戳 agent。

二、Loop = 递归目标:定义目的,AI 迭代到完成

一个 loop = 一个递归目标(你给目的,AI 迭代到完成)。这是对 loop 的最简定义。Loop engineering = 设计这种递归系统。Loop engineering 之于 harness,等于工厂之于车间——harness 是车间,loop 是工厂。

三、5+1 积木框架(一张可以照搬的设计 checklist)

积木 Codex Claude Code
Automations Automations tab /loop / cron / hooks / GitHub Actions
Worktrees 内建多线程 worktree git worktree + --worktree flag + subagent isolation: worktree
Skills SKILL.md($ 或 /skills 或自动匹配) SKILL.md 格式
Plugins + Connectors MCP MCP(互通)
Sub-agents .codex/agents/ TOML .claude/agents/ + agent teams
Memory(第 6 块) markdown / Linear board

关键洞察:跨产品形状完全一致——别再争哪个工具好,直接设计一个在两边都能跑的 loop

四、5 积木详解(每一块都讲 Codex 和 Claude Code 双实现)

五、最值得知道的原语:/loop + /goal

/loop 按周期重跑。/goal 跑到你写的条件真正成立——每轮之后用独立小模型验是否 done。Codex 也有 /goal,同名同行为——这是跨工具统一的原语。给个条件如”test/auth 全过 + lint 干净”然后走开。

六、一个 loop 长什么样(Addy 自用模板)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
每天早上 9 点在仓库跑 automation
  ↓
prompt 调起 triage skill:读昨日 CI failures / open issues / recent commits
  ↓
findings 写进 markdown 或 Linear board
  ↓
对每个值得做的 finding:在独立 worktree 开新线程
  ↓
sub-agent 写 fix,第二个 sub-agent 对照项目 skills + 现有 tests review
  ↓
connector 让 loop 自动开 PR + 更新 ticket
  ↓
loop 处理不了的东西进 triage inbox 等人
  ↓
state file 是整个系统的脊椎——明天的运行从今天停的地方继续

关键认知:你只设计一次。其余步骤你一个都没 prompt。

七、三个反噬(loop 越强越尖锐,不是更简单)

  1. Verification 还是你的。无人值守的 loop = 无人值守地犯错。”完成了”是声明不是证明——your job is to ship code you confirmed works
  2. 理解会腐烂。loop 越快产你没写的代码,”存在”和”你懂”之间的 gap 越大。Comprehension debt——一个顺滑的 loop 让它长得更快
  3. 认知投降是最舒服的姿势。loop 自跑时最诱惑的就是停止有意见。Cognitive surrender——设计 loop 是药(有判断地设计)也是毒(为不思考而设计)

结尾金句

Build the loop. Stay the engineer.

Two people can build the exact same loop and get completely opposite results. One uses it to move faster on work they understand deeply. The other uses it to avoid understanding the work at all. The loop doesn’t know the difference. You do.

That’s what makes loop design harder than prompt engineering, not easier. Cherny’s point isn’t that the work got easier. It’s that the leverage point moved.

Build the loop. But build it like someone who intends to stay the engineer, not just the person who presses go.

标签

#主题/AI-Coding #主题/AI-Agent #节点/Agent-Loop #节点/Codex #节点/Skill #节点/Harness #节点/Memory #场景/技术博客 #场景/方法论 #手法/范式归纳 #手法/对比冲突 #手法/警示提醒