Skip to content

What is "Loop Engineering"? — 摘要

Pragmatic Engineer 对 Loop Engineering 这个新趋势的全面调查:从 Ralph Loop 的起源,到各大 agent harness 内置 /goal 命令,再到实际开发者的用例和质疑。

Key Takeaways

  1. Loop Engineering 的定义 — 不再是手动写 prompt 驱动 AI agent,而是设计一个系统(循环)让 agent 自主运行直到目标达成。Boris Cherny(Claude Code 作者)的原话:"I don't prompt Claude anymore. I have loops running that prompt Claude."

  2. Ralph Loop 的起源 — Geoffrey Huntley 一年前提出的技巧,核心就是一个 Bash 循环 while :; do cat PROMPT.md | claude-code; done,让 agent 不断重新启动、用干净的 context window 执行任务,直到目标达成。

  3. /goal 命令成为标配 — 2026年5月,Codex → Hermes → Claude Code 在两周内相继推出内置的 /goal 命令,把"Ralph loop"浓缩成一行命令。OpenAI 的实现使用了文件系统做状态、日志记录、测试运行和生命周期控制。

  4. 实际用例 — 触发器和 cron job 是两种最常见的模式:Sentry 报错自动开 PR、nightly E2E 测试失败自动修、凌晨跑迁移脚本、Slack outage channel 里自动 triage。

  5. 争议与局限 — 并非所有人都买账:agent 漂移问题、token 费用高、context engineering 可能比 loop engineering 对普通开发者更有用。也有人认为 loop 只是 tooling 成熟前的 hack。

Notable Quotes

"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." — Boris Cherny, Claude Code 创建者

"Loop engineering is replacing yourself as the person who prompts the agent. You design the system that does it instead." — Addy Osmani

"Engineers are still needed. There is no way this is possible without senior expertise guiding Ralph." — Geoffrey Huntley

"A normal prompt says: do this next thing. A Goal says: keep working until this outcome is true." — OpenAI Codex 文档

相关概念

  • [[loop-engineering]] — 本文核心概念
  • [[ralph-loop]] — Ralph Loop 技术
  • [[hermes-agent-goals]] — Hermes Agent 的 /goal 实现

全文路径

raw/resources/what-is-loop-engineering.md