Files
kb/raw/2026-07/2026-07-15-loop-engineering.md

1.8 KiB

source_url, ingested, status, tags
source_url ingested status tags
https://x.com/AYi_AInotes/status/2069831601668915323 2026-07-15 inbox
tech/agent
tech/llm

Loop Engineering

来源

@AYi_AInotes 推文 (2026-06-24, 61K views) + @akshay_pachaar 文章 "Loop Engineering Clearly Explained"

核心概念

Prompt Engineering 已死,Loop Engineering 接棒。从"指挥 AI 一步步走"变成"设计一个能自己跑完的系统"。

@bcherny (Claude Code 构建者): "I don't prompt Claude anymore. I write loops, then let them run."

模型正在变成标准件——同一个模型配上更好的循环设计,效果能从中等拉到顶级。

四个支柱

1. 上下文管理

  • Compact: 每 N 轮摘要压缩
  • Offload: 大输出写文件,context 只放路径+摘要
  • Sub-agents: 混乱子任务 spawn 子 Agent 隔离

2. 刹车机制

  • max_iterations (硬上限)
  • budget + time (token/钱/时间)
  • no-progress detection (同调用同参数=卡死)
  • completion check (测试通过才是真完成)

3. Maker-Checker 分离

  • 干活的 Agent 和检查的 Agent 必须分开
  • 不同的 prompt,Checker 的任务是挑错不是认可
  • 自己不批改自己的作业

4. 工具收敛

  • 少而精,不重叠 (5-8 个核心工具)
  • 写入操作幂等
  • 错误信息写给 Agent 看(结构化)
  • 禁止 wildcard 执行 (npx *, bun run *)

Hermes 实现

  • delegate_task 分 Maker + Checker 两个 Agent
  • /new 开新会话 = context 压缩
  • cron job 天然有 max_iterations 和时间预算
  • Memory 精简 = 工具收敛

检查清单

  • 硬性 max_iterations
  • token/time 预算
  • no-progress 检测
  • objective completion check
  • Maker ≠ Checker
  • 定期 context 压缩
  • 大输出 offload
  • 工具 ≤ 10 且不重叠
  • 写入幂等
  • Agent-readable errors