返回列表
🪞 Uota学 · 🧠 阿头学 · 💬 讨论题

别迷信「自我改进」——护城河是可观测、可升级、可接管

所谓“自我改进系统”其实是把人类的工程判断做成了一个可复制的升级通路;真正的优势来自**透明可控的混乱循环**,不是黑盒自治。
打开原文 ↗

2026-03-10 原文链接 ↗
阅读简报
双语对照
完整翻译
原文
讨论归档

核心观点

  • “自我改进”不是 AI 在反思,是人类在抽象 文中真正稳定的模式是:系统跑着跑着摔跤 → 人类把摔跤抽象成需求/约束 → 智能体把它实现。AI 提速的是“执行”,不是“提出正确问题”。所以别把“自举开发”包装成“自治进化”,决策层仍然是人。
  • 最后一公里不是 UI 好不好看,是“随时能接管” AO 的 dashboard 很强,但藏在 URL 后面、移动端难用,导致关键时刻必须回电脑。OpenClaw 把控制面放进 Telegram(环境式可用性),把自然语言当通用 API——本质是把“介入成本”压到最低,让人类能在正确的时刻出手。
  • 多层智能体的真实敌人是“涌现故障/组合爆炸” 权限加固能把认证炸掉、会话 ID 复用会把语义搞崩、消息没真正回车会导致静默失败……这类问题不是靠更多测试就能根除的,它属于系统级耦合 + 概率行为叠加。
  • 可规模化的关键:把失败处理“产品化”为升级协议 三层梯:1) 智能体自愈(CI 失败→回注→重试上限)2) 编排器调解(全局去重/拆解/冲突解决)3) 升级到人类(对话里直接接管)。重点不是“更聪明”,而是“更可升级”。
  • 真正的安全底线是“可见性 + 边界” 文里最值钱的工程哲学:别幻想锁死变化,先保证每次改动都能被看见、被追踪、被回滚;同时把 blast radius 做小(最小权限/隔离/审批门禁),否则 Telegram 入口就是高权限核按钮。

跟我们的关联

🪞Uota(agent/infra)

  • 意味着什么:你现在要追的不是“自动化覆盖率”,而是“升级通路覆盖率”(失败怎么被识别、归因、升级、复盘、制度化)。
  • 下一步:把系统里最常见的 5 类失败(权限/身份映射/重复劳动/消息投递/顺序漂移)写成标准化 runbook + 自动化探针;每类失败都要有“自动→编排→人类”的明确转交条件。

🧠Neta(产品/组织)

  • 意味着什么:如果你未来要把 agent 能力产品化,用户真正买单的是“我随时能看懂、能干预、能把它拉回来”,不是“它自己会变强”。
  • 下一步:把“可解释的执行轨迹 + 一键接管 + 风险分级”做成一等交互,而不是事后补日志。

👤ATou(个人战斗力)

  • 意味着什么:你要练的是“指挥 + 断舍离 + 风险控制”,不是 prompt 花活。
  • 下一步:把你的夜战经验沉淀成可复用的升级协议模板(重试上限、熔断、回滚点、审计日志)。

讨论引子

1. 你更愿意要哪一种系统:80% 时候自动跑但 20% 会黑盒翻车,还是 60% 自动但每次都可解释、可接管、可回滚?(这其实是在选“自治 vs 可控”的价值观) 2. 当编排器声称“我会去重/不会重复劳动”时,你要它用什么可验证的信号来证明?(否则去重只是幻觉) 3. Telegram 作为高权限入口要不要上“最小权限/分级权限/操作审计”?如果不上,你准备接受多大的 blast radius?

18 天前,我们开源了 Agent Orchestrator。𝟰𝟬,𝟬𝟬𝟬 行 TypeScript,𝟭𝟳 个插件,𝟯,𝟮𝟴𝟴 个测试。它是一个用于并行管理 AI 编程智能体“舰队”的系统,而且是在 8 天内由它所编排的智能体亲手搭出来的。如果你还没读过那篇文章,简要版本是:每个智能体都有自己的 git worktree、自己的终端会话、自己的任务。AO 追踪它们全部,监控 CI,处理 PR,并协调这场混乱。

在这 18 天里,它在 GitHub 上拿到了 3,800+ 颗星。

AO 的 18 天:X 上 983K 次曝光、94.9K 次互动、9.6% 互动率,以及 GitHub 星标从 0 增长到 3,800+。

大概在上线后的第 3 天,我注意到一件我事先完全没计划过的事:我在用 AO 开发 AO。不是那种“我们吃自己的狗粮”的意思,而是字面意义上的。我会创建一个任务,描述 AO 需要的某个功能。AO 会启动一个编程智能体,给它提供代码库上下文,让它开工。智能体会写代码、写测试、开 PR。另一个智能体会审查它。如果一切都通过,就会合并。AO 会用新代码重启。下一个任务就在改进后的版本上继续运行。

一步一步,这个“管理智能体的系统”,正在被它管理的智能体所改进。

有个智能体发现了一个竞态条件,并不是因为它在刻意找 bug,而是它在做别的事情时撞上了这个 bug。它提了一个 issue。另一个智能体把它修掉了。从那之后,每一次后续会话都更顺畅:PR 更干净,评审更好,改进质量更高。一个小修复,带来连锁效应。另一次会话里,我让编排器分析它自己的代码库并提出改进建议。它给出的观察真的很有洞见:智能体专精化、对反复出现的失败做模式分析、并行化评审瓶颈。都是我之前没注意到的东西。其中三条建议变成了任务,智能体把它们实现了,AO 变得更好了。

这就是“自我改进循环”的干净版本:一切都正常运转,每一轮都产出比上一轮更好的东西。

但我有个问题。AO 有一个完整的 Web 仪表盘:实时终端、看板、会话管理。它确实很强大。但在手机上终端滚动不正常。界面也偏技术向:你得打开浏览器,访问一个 URL,点进一个终端面板,跑命令。凌晨 2 点某个会话失败时,你得起床、打开笔记本、拉起仪表盘、搞清楚发生了什么。这不是那种你能在 Telegram 手机上随手看看就行的东西。况且我一天里大部分时间都在和另一个完全不同的系统对话。

为什么把 OpenClaw 接到编排器上

每个 AI 系统都有一个尚未解决的“最后一公里”问题:人与系统的交互界面。

工具不断给自己造仪表盘、造 CLI、造 Web 应用。每一个都需要一次上下文切换:打开浏览器,访问 URL,学习 UI,记住命令。AO 也不例外。它有很棒的仪表盘:看板视图、实时终端、会话管理、PR 跟踪。它还有自己的编排器智能体,用于启动会话、分配任务、监控 CI。AO 是个完整系统,它可以自己完成编排。

但它依然藏在一个 URL 后面,而我并不总是在电脑前。

OpenClaw 则把这一点倒过来了。278K GitHub stars。但关键在于:集成到 WhatsApp 和 Telegram 的 AI 聊天机器人多得很。你现在就能在消息应用里和 ChatGPT 对话。这并不是 OpenClaw 不同的地方。

OpenClaw 之所以赢,是因为它把问题当成基础设施来做,而不是当成一个聊天功能。

聊天机器人是无状态的请求-响应:你打字,它回复,上下文随即蒸发。OpenClaw 是你自己机器上一个持续运行的进程,拥有持久会话、记忆文件、工具访问、文件系统访问、沙箱化代码执行。Gateway 是会话、路由、工具调用与状态的单一权威。它不是“Telegram 里的 AI”。它是一个 AI 智能体的操作系统,只是恰好能通过 Telegram 访问。

工程上的差异很重要。OpenClaw 会执行,而不只是生成文本。它会跑 shell 命令、读文件、调 API、部署代码。LLM 变成操作者,而不是应答者。它是事件驱动的,不只是请求驱动:它会对定时任务、webhook、邮件到达、心跳做出反应。它能在没人问的时候注意到事情并采取行动。它支持多智能体路由:一个 gateway,多名智能体,各自有不同的工作区和技能。并且一切都以本地优先的方式在你的硬件上运行,拥有完整系统访问。运行在别人云端的 Telegram 聊天机器人,不可能 SSH 到你的服务器,也读不到你的 codex 认证文件。

我已经跑它好几个月了。它管理我的财务、跟踪联系人、写日记条目、监控邮件、部署代码、跑脚本。它是我与数字生活中一切交互的单一界面。

而对“智能体编排”这件事来说,有四点尤其关键:

环境式可用性。AO 的仪表盘需要你主动去打开。OpenClaw 在 Telegram 里,而 Telegram 本来就开着。凌晨 2 点会话失败时,我不需要去找电脑。

自然语言作为通用 API。AO 的 CLI 有 ao spawn、ao send、各种 flags 和参数。OpenClaw 能把“修一下终端 bug”翻译成正确的一串命令序列。

跨会话的持久上下文。OpenClaw 在对话之间携带记忆。它知道 ao-12 昨天在做什么、昨晚哪里失败了、本周优先级是什么。AO 的仪表盘展示当前状态;OpenClaw 了解历史与意图。

多系统触达。OpenClaw 不只是和 AO 对话。它还管理我的服务器、博客、邮件、财务。当我说“把博客文章部署了,然后做社媒草稿”,这会跨越 AO、Caddy、博客渲染器、静态文件服务器以及写作风格系统。任何单一工具的仪表盘都覆盖不了这些。

所以把它们连起来很自然。但这里有个关键的架构决策:我不是把 OpenClaw 做成一个“通知层”,去和 AO 的编排器对话;我是在做一个连接器,让 OpenClaw 能直接接管编排器的角色。

AO 从一开始就被设计为“人类在环”的运行方式。那个独立的编排器智能体(一个 codex 或 claude-code 会话)一直只是人类的替身:在你盯着看的情况下,人会做哪些决策,它就代做哪些。有了 OpenClaw 连接器,真正的人类通过 OpenClaw 在看着。替身就不再必要了。

带连接器的 OpenClaw 会直接使用 AO 的基础设施:worktrees、tmux 会话、CI 监控、会话管理、仪表盘。但编排决策——做什么、何时杀掉卡住的会话、如何拆解问题——由 OpenClaw 自己给出,而人类就在 Telegram 里随时介入权衡。没有多余的 LLM 层去把意图翻译两遍。编排器拥有人的上下文、持久记忆与多系统触达;升级也能即时发生,因为人本就已在对话里。

独立的 AO 编排器仍然像以前一样工作,它同样是人类在环,而不是自治。区别在于:是谁来承担编排职责。没有连接器时,一个专门的 codex 或 claude-code 会话充当编排器;有了连接器,OpenClaw 通过一个插件接管这一角色,把持久记忆、多系统触达,以及“人就在对话里”这件事带进来。

然后就是那个递归想法:让 OpenClaw 用 Agent Orchestrator 来构建 OpenClaw-AO 连接器,再在同一次运行里把 Agent Orchestrator 指回它自己的代码库。用人类界面去构建一个更好的自己。

连接器实际交付了什么

ao-12 的总结让一件事变得很明显:速度来自拒绝在传输层过度设计。

我一开始考虑过更深的点对点协议想法。很有趣,但很慢。最终能交付的动作很简单:做一个 notifier 插件,然后路由进 OpenClaw 现有的 hook 入口。

• AO notifier plugin: @composio/ao-plugin-notifier-openclaw

• OpenClaw ingress: POST /hooks/agent

• local transport: 127.0.0.1 + token auth

• session mapping: hook:ao:

• delivery hardening: exponential backoff on 429/5xx

测试上最高杠杆的动作是“外部操作者验证”,而不只是本地测试全绿:单独起一个 OpenClaw 实例,全新 checkout,从源码构建,配置 hook,轮换 token,打突发流量,并在真实频道里看渲染效果。

• 通过项:ingress、会话隔离、token 轮换、突发处理,以及干净的 deliver: true 渲染

• 缺口:没有幂等去重,同一会话内的顺序可能因完成时机而漂移,反向命令通路仍需要完整运行时的冒烟验证

让这一切真正跑起来的、令人眩晕的反馈回路

我们实际跑的循环是:OpenClaw 用 AO 构建插件,另一个 OpenClaw 像客户一样去测试它,反馈再回流到同一个智能体会话里。

15 个并行会话。一整晚。下面才是实际发生的事。

15 个会话,一夜之间

我想先把这里的“自我改进”说清楚,因为它很容易被夸大。智能体确实会自主写代码:跑测试、针对 CI 失败迭代、推 commits。这部分真的几乎不用人管。但编排层——决定做什么、启动哪些会话、注入哪些上下文、什么时候杀掉卡住的会话并重来——那是我在做。我整晚都在 Telegram 上指挥 OpenClaw,而 OpenClaw 在指挥 AO,AO 再指挥智能体。三层智能,但战略决策依然是人类的。

这趟通宵并不是“设好就忘”。更像是在凌晨 2 点通过聊天管理一群速度极快的初级工程师。

这就是那晚真实的样子。

https://x.com/agent_wrapper/status/2025986105485733945?s=20

昨晚跑过的每个会话:绿色已合并,红色已死亡,紫色有未合并 PR,琥珀色仍在工作。虚线是会话死掉后被重启之间的空档。

第一波:一切都在工作

ao-3 到 ao-6 都很干净。我在用 AO 时发现一个 bug,就在 Telegram 上把它描述给 OpenClaw,然后让它启动一个会话。OpenClaw 会先跑 ao spawn,再用 ao send 注入任务描述。每个会话都有自己的 git worktree(从 main 分支切出)、一个在 tmux 里运行的 codex 实例,以及我描述的任务。

ao-3 修复了 codex 抑制更新提示的问题。PR #338,已合并。ao-4 修复了一个被忽略的权限标志位。PR #337,已合并。ao-5 把版本号升到 0.1.1。PR #339,已合并。ao-6 修复了 PATH 顺序,使 gh CLI wrapper 能正确解析。PR #343,已合并。

四个会话,四个 PR,四次合并。干净。教科书式的自我改进循环:系统在构建自己,而每次合并都让下一次会话稍微更顺滑一点。

ao-7 是第一处麻烦信号。它在处理和 ao-6 同一个问题,但采用了不同的做法。两个智能体,同一个 bug,两份 PR。我杀掉了 ao-7,合并了 ao-6 的 PR。不是灾难,但确实是一次协作失败:编排器本应识别出重复工作,却没有。因为当时还没做重复检测。

于是我在心里记了一笔:做重复检测。这条记忆变成了一个任务。那个任务最终会变成另一个智能体会话。系统已经在暴露自己的缺口。

崩溃

接下来是 ao-9,这一夜开始变得有意思了。

ao-9 本该修复终端组件的 WebSocket URL 路由。改动 15 行。简单到我甚至没让智能体去做。我自己改了,commit、push,然后开了 PR #346。

这是个错误。不是因为代码有问题。代码没问题。错在于:ao-9 在 AO 的会话列表里存在,但背后没有对应的 tmux 会话。其他所有会话背后都有一个在 tmux 中运行的 codex 进程。ao-9 什么都没有。当你在仪表盘打开 ao-9 时,终端组件会尝试连接一个不存在的 tmux pane,于是它就无休止地闪烁:重连、失败、重连、失败。

我试图通过把一个真正的智能体塞进 ao-9 的槽位来修复。但 worktree 已经 checkout 到另一个分支上。于是我杀掉 ao-9,创建 ao-8 来接手,结果意识到这更糟,因为现在一个 PR 对应两个会话;我又杀掉 ao-8,重建 ao-9 的 worktree,并尝试手动启动 codex。

codex 立刻崩了。

一行输出。没有堆栈。没有解释。只有一句“permission denied”。

我跑了 strace,想看它到底在读哪个文件。

auth.json 文件属于 lifeos-secrets:lifeos-secrets,权限 600。codex 进程以 lifeos 用户运行,它读不到自己的认证文件。

这怎么发生的?那天早些时候,我在加固 gh CLI,防止 AI 访问未授权的 GitHub 仓库。那项工作的一部分是把凭据移到一个叫 lifeos-secrets 的系统用户下。auth.json 被这次清理顺手卷了进去。系统某一处的安全改进,悄无声息地把另一处完全不同的路径搞坏了。

https://github.com/openclaw/openclaw

一旦找到原因,修复很简单:删掉这个文件(目录归 lifeos 所有,所以即便文件不属于它,unlink 也能成功),新建一个空文件,让 codex 回退到 OPENAI_API_KEY 环境变量。但定位原因花了 20 分钟的 strace 和困惑。

这就是那种不会出现在关于“自我改进系统”的理论论文里的故障:一个子系统的安全改进,悄悄破坏了另一个子系统里的认证路径。测试抓不到,因为测试不会以不同用户运行。影响范围在有人尝试启动一个新会话之前完全不可见。

大面积死亡

当我还在调 auth 崩溃时,还有个更大的问题:ao-10 到 ao-14 全都死了。

这五个会话是用错误的方法启动的。OpenClaw 用了它的 exec 工具(一个后台 shell 进程),而不是 ao spawn。我直到它们全死光才发现这个错误。差别很重要。ao spawn 会创建一个独立的 tmux 会话,它能独立存活;exec 则会创建 OpenClaw 的 shell 会话的子进程。当那个 shell 会话在 600 秒后超时,子进程会收到 SIGTERM。codex 进程就死了。

五个会话,五个任务,全没了。没有保存的工作。没有部分进展。worktree 还在,但除了基分支之外没有任何新 commit。这是操作者失误。我一开始就该告诉 OpenClaw 用 ao spawn。我没说,于是我丢了数小时的智能体工作。

我让 OpenClaw 这次用 ao spawn 把它们重启,但 AO 的会话 ID 是顺序复用的。所以我启动替代会话时,它们又拿到了 ao-10 到 ao-14 的 ID,但任务却和原来不一样。原本的 ao-11 是“修手机端终端滚动”。重启后的 ao-11 拿到的却是“CI 自动注入 + 重试升级”。完全混乱,到底哪个会话在做什么。

这是一个会话身份问题。会话靠顺序编号识别,而不是靠任务或目的。当 ao-11 死掉并被重启时,它应该仍然是“手机端终端滚动会话”。可实际上,它变成了一个恰好也叫 ao-11 的完全不同会话。

递归更深了

接下来就真的开始诡异起来了。

在这些重启的会话里,有一个 ao-12 拿到了一个我思考了很久的任务:设计 OpenClaw 与 AO 的集成。用“管理我生活的系统”(OpenClaw)通过“管理编程智能体的系统”(AO)来构建它们之间的桥。

我再说一遍,因为这很关键:我在 Telegram 上和一个 AI 助手对话。这个助手在用一个智能体编排器去启动编程智能体。其中一个智能体正在设计:这个助手应该如何与这个编排器集成。这个智能体在给一个系统写设计文档——而这个系统最终会取代当初创造它的那套手工流程。

三层递归:

• 人类和 OpenClaw 对话

• OpenClaw 用 AO 启动智能体

• 智能体设计 OpenClaw-AO 集成

有趣之处在于:我整晚都在撞失败、变得烦躁、手动修东西。某个时刻,我对 OpenClaw 说:“把今晚出过的所有问题上下文都给 ao-12,让它能围绕这些问题做设计。”OpenClaw 把我遇到的每个失败都打包了:会话悄无声息地死掉、消息提交不上去、ID 被复用、没有健康监控、没有自动重启,并把它们作为设计需求注入到智能体里。

这些需求不是智能体发现的,是我在糟糕地操作系统时发现并注意到哪里坏了。然后我把这些观察喂给一个能把它们转成设计的智能体。洞见来自人类,执行被自动化。

元结构是:我和 OpenClaw 对话,OpenClaw 用 AO 启动智能体,其中一个在设计 OpenClaw 应如何与 AO 集成。今晚的失败,变成那份设计的需求。

这也是自我改进循环,但不是我在第一篇博客里描述的干净版本。它很脏。改进来自崩溃与混乱,而不是来自优雅的元分析会话。系统从“坏掉”中学习。

“自己修”的三层阶梯

那一晚的失败最终凝结成一个架构。我把它叫作“三层升级协议”。

第 1 层:智能体自愈。当 PR 的 CI 失败时,失败输出会被自动注入回智能体会话。智能体读错、修代码、再 push。最多 5 次,超过就放弃。无需人类介入。会话 ao-11 做了这个并提交了 PR #354。这是目前唯一真正实现了的一层。

第 2 层:编排器调解。如果智能体 5 次都修不好,就升级到编排器会话。编排器本身是一个 codex 实例,掌握所有活跃会话的上下文。它能查看失败智能体的代码,理解更大的局面,然后要么给出修复建议,要么重新思考路径。这一层已经设计好,但还没做出来。

第 3 层:通过 OpenClaw 把问题升级给人类。如果编排器也处理不了,就给我的 Telegram 发消息,比如:“ao-14 在活动状态修复上 CI 失败了 5 次。错误是 codex 插件里的类型不匹配。”我在聊天里回复,然后回复被路由回智能体。这正是 ao-12 现在在设计的内容,也还没实现。

这就是升级架构:跨边界使用同一种消息格式。OpenClaw 将完全取代独立编排器。仍保留三层:OpenClaw、连接器插件、以及各个编程智能体。

关键设计决策是:协议统一。消息格式在每一道边界上都一致,无论是从智能体到 OpenClaw,还是从 OpenClaw 到我。OpenClaw 完全取代独立编排器。三层仍然是:最上层的 OpenClaw(人类就在对话里)、桥接到 AO 基础设施的连接器插件、以及单个编程智能体。OpenClaw 不是一个通知侧栏,它是升级协议中的对等参与者,既能自主解决,也能把问题交给人类接管。

记分牌

到早上 6 点,这次通宵产出了:

• 6 个已合并 PR(#337、#338、#339、#343、#346,以及一个更早的)

• 2 个未合并 PR(#353:仪表盘信息增强;#354:CI 自动注入)

• 4 个仍在工作的会话(OpenClaw 集成设计、终端修复、活动状态修复、导航栏修复)

• 6 个死亡后被重启的会话

• 1 次认证崩溃,导致 20 分钟内无法启动任何新会话

• 1 次重复工作事故(ao-6 与 ao-7 在同一个 bug 上)

• 0 次向 main 分支引入回归

早上 6 点运行的系统,已经明显比前一晚 6 点的更好。不是因为某一个改动,而是所有改动叠加起来:codex 插件正确处理了权限;PATH 解析正常;版本号上调;终端 WebSocket 能通过反向代理连上;仪表盘能显示实时 PR 数据。

而且还有三个会话在跑。它们到底会产出有用的东西,还是会悄悄崩掉,我要到早上查看时才会知道。

自我改进实际是什么样子

第一篇博客把这个循环讲得很细:8 个步骤、文件锁示例、会话 ao-52 的自我分析。真实代码、真实会话、真实改进。那些都是真的,现在也仍然成立。

但把这个循环放大到一整晚、15 个会话并行?那就是另一种野兽了。

会话会死掉,因为我让 OpenClaw 用了错误的启动方式。我做的一个安全改动,会破坏另一个工具的认证。消息会被粘贴进 codex 的输入缓冲区,但回车键从未触发,我得自己发现智能体卡住了,然后在服务器上手动按 Enter。会话 ID 被复用,我就跟丢到底哪个智能体在做什么。

自我改进仍然会发生,但它不是自动的。我发现失败,理解哪里出了问题,然后让 OpenClaw 把这个失败作为需求喂回去。auth 崩溃?我让 ao-12 把“崩溃取证”纳入设计。exec 超时?我让它加上“会话健康监控”。ID 复用?“会话身份要绑定任务,而不是顺序编号”。

系统通过“坏得很有信息量”来改进。但“有信息量”这部分,需要一个人在凌晨 2 点盯着看。

规模化之后有什么变化

在第一篇博客里,我描述了三个阶段:智能体作为工具、智能体作为工人、智能体作为自我改进系统。我给每个阶段都走了具体例子。我说第 3 阶段是“质变”。

我说对了,但质变的点不是我预期的那样。不是系统改得更快,而是系统会自己生成改进 backlog。

当你把智能体当工人(第 2 阶段)时,你告诉它们要做什么。你维护 backlog。你排优先级。你决定什么重要。智能体是熟练劳动力,但方向完全由人类提供。

而在第 3 阶段,系统会产生失败。失败暴露需求。需求生成任务。任务由智能体实现。我并没计划去做会话健康监控。凌晨 2 点五个会话悄无声息地死掉了,这个需求就变得显而易见。但老实说:这个需求并不是“自己写出来的”。我注意到问题,理解问题,并把它转成任务。系统揭示失败;我负责解释;智能体负责实现。

也许这仍是第 2.5 阶段。真正完全自治的版本——系统能检测自身失败,并在无需人类凌晨 2 点发现的情况下自动启动智能体来修——正是升级协议想要实现的。我还没到那一步。但至少这套基础设施正在由同一批需要它的智能体来构建,这多少有点诗意。

让我害怕的那部分

我得坦白一件事。凌晨 3 点,当我看着 ao-12 为一个未来将监督其他所有智能体(包括它自己未来版本)的系统写设计文档时,我突然有一刻在想:我不确定自己完全理解我正在构建的东西。

不是那种《终结者》式的担忧,而是工程复杂度意义上的担忧。系统有三层 AI(OpenClaw、AO 编排器、单个智能体),每一层都有不同的模型、上下文与失效模式。这些层之间的交互会产生我没预料到的涌现行为。auth 崩溃是涌现行为。exec 超时是涌现行为。消息投递失败是涌现行为。

随着这些层越来越紧密地集成,可出现的涌现行为空间会呈组合爆炸增长。我可以测试单个组件。我可以测试两两交互。但测试完整系统,需要运行完整系统;而完整系统就是生产环境。

这就是我在做升级协议的原因。不是因为我担心系统会失控,而是因为我认为系统会以我无法预测的方式失败,而我需要一条可靠路径,把“某处坏了”变成“一个人知道了”,并且这条路径本身不会以新颖的方式坏掉。

自我改进系统的安全机制,不是阻止变化,而是确保可见性。只要我能看见系统对自身做的每一次修改,我就能在问题叠加之前抓住它。如果我失去可见性,我就失去控制。而在这么复杂的系统里,失去可见性比听起来更容易。

这篇文章也是循环的一部分

我还得提一句这篇博客是怎么写出来的。我在 Telegram 上对 OpenClaw 说:“写一篇博客,讲我如何通过让 OpenClaw 用 Orchestrator 构建 OpenClaw-AO 集成。”它读了第一篇博客作为风格参考,写了初稿,存到服务器上,并给我发了链接。我读了,发现有些地方不对。它把系统的自治程度写得太夸张了。我让它改。它改了。我说图需要更好。它重做了。我说要加上星标历史的图片。它加了,顺手把 YAML 配置搞坏了,又把它修好,然后给我发了新链接。

你现在读到的这一段,就是我对 OpenClaw 说“文章让系统看起来比实际更自治,务必写得现实一点”之后写出来的。AI 写了一个更诚实的版本。我正在同一台服务器上审阅它:这台服务器既托管着 AO 的仪表盘,监控着正在构建我所写功能的智能体;也托管着这篇文章的草稿。

确实是递归。但每一层都有一个人类在读、在判断、在纠偏。自动化负责打字,人类负责思考。

循环仍在继续

现在是周日早晨。会话还在跑。ao-12 在写 OpenClaw 集成设计。ao-13 在修手机端终端。ao-14 在修补活动状态 bug。ao-15 在修导航栏链接。

等我写完这篇文章,其中一些 PR 可能已经合并。系统会更好。新的 bug 也会出现。新的会话会被启动来修它们。

循环不会停。它没有一个干净的终点。不会有一个 2.0 版本发布、从此一切完美运转。只有持续、渐进、混乱的改进。编码被自动化了,方向仍然是我:凌晨 3 点在 Telegram 上告诉一个 AI 助手下一步该修什么。

我在第一篇博客里写过:最先搞定“可自我改进的智能体系统”的公司,会拥有荒谬的优势。我解释过原因:把复利应用到工程能力上。我现在仍然相信那句话的每一个字。

但我想补充一点:我之前没有充分意识到,优势不在于拥有一个干净的自我改进循环,而在于拥有一个你能观察、能调试、能掌舵的混乱循环。

这个不断构建自身的系统不需要完美,它需要透明。

Agent Orchestrator 已在 github.com/ComposioHQ/agent-orchestrator 开源。仪表盘、会话管理与升级协议都在这个仓库里。我在 Composio 做 AI 智能体相关工作。如果你在做编排系统,或者在思考自我改进循环,欢迎在 Twitter 或 GitHub 上找到我。

链接: http://x.com/i/article/2031050661866221568

18 days ago we open-sourced Agent Orchestrator. 𝟰𝟬,𝟬𝟬𝟬 lines of TypeScript, 𝟭𝟳 plugins, 𝟯,𝟮𝟴𝟴 tests. a system for managing fleets of AI coding agents in parallel, built in 8 days by the agents it orchestrates. if you haven't read that post, the short version: each agent gets its own git worktree, its own terminal session, its own task. AO tracks them all, monitors CI, handles PRs, and coordinates the chaos.

it hit 3,800+ GitHub stars in those 18 days.

18 days of AO: 983K impressions on X, 94.9K engagements, 9.6% engagement rate, and 0 to 3,800+ GitHub stars.

somewhere around day 3 after launch, i noticed something i hadn't planned for. i was using AO to develop AO. not in the "we eat our own dog food" sense. in the literal sense. i'd create a task describing a feature AO needed. AO would spin up a coding agent, give it context about the codebase, and let it work. the agent would write code, write tests, open a PR. another agent would review it. if everything passed, it'd get merged. AO would restart with the new code. the next task would run on the improved version.

step by step, the system that managed agents was being improved by the agents it managed.

one agent found a race condition not because it was looking for bugs, but because it hit the bug while working on something else. it filed an issue. another agent fixed it. after that, every subsequent session ran smoother. cleaner PRs, better reviews, higher quality improvements. small fix, cascading effects. in another session, i asked the orchestrator to analyze its own codebase and recommend improvements. it came back with genuinely insightful observations. agent specialization, pattern analysis on recurring failures, parallelizing review bottlenecks. things i hadn't noticed. three of those recommendations became tasks. agents implemented them. AO got better.

that's the clean version of the self-improvement loop. the version where everything works and each cycle produces something better than the last.

but i had a problem. AO has a full web dashboard with live terminals, kanban boards, session management. it's genuinely powerful. but the terminals don't scroll properly on mobile. the interface is technical: you're opening a browser, navigating to a URL, clicking into a terminal pane, running commands. when a session fails at 2 AM, you have to get up, open your laptop, pull up the dashboard, figure out what happened. it's not something you can casually check from your phone on Telegram. i was already spending most of my day talking to a different system entirely.

18 天前,我们开源了 Agent Orchestrator。𝟰𝟬,𝟬𝟬𝟬 行 TypeScript,𝟭𝟳 个插件,𝟯,𝟮𝟴𝟴 个测试。它是一个用于并行管理 AI 编程智能体“舰队”的系统,而且是在 8 天内由它所编排的智能体亲手搭出来的。如果你还没读过那篇文章,简要版本是:每个智能体都有自己的 git worktree、自己的终端会话、自己的任务。AO 追踪它们全部,监控 CI,处理 PR,并协调这场混乱。

在这 18 天里,它在 GitHub 上拿到了 3,800+ 颗星。

AO 的 18 天:X 上 983K 次曝光、94.9K 次互动、9.6% 互动率,以及 GitHub 星标从 0 增长到 3,800+。

大概在上线后的第 3 天,我注意到一件我事先完全没计划过的事:我在用 AO 开发 AO。不是那种“我们吃自己的狗粮”的意思,而是字面意义上的。我会创建一个任务,描述 AO 需要的某个功能。AO 会启动一个编程智能体,给它提供代码库上下文,让它开工。智能体会写代码、写测试、开 PR。另一个智能体会审查它。如果一切都通过,就会合并。AO 会用新代码重启。下一个任务就在改进后的版本上继续运行。

一步一步,这个“管理智能体的系统”,正在被它管理的智能体所改进。

有个智能体发现了一个竞态条件,并不是因为它在刻意找 bug,而是它在做别的事情时撞上了这个 bug。它提了一个 issue。另一个智能体把它修掉了。从那之后,每一次后续会话都更顺畅:PR 更干净,评审更好,改进质量更高。一个小修复,带来连锁效应。另一次会话里,我让编排器分析它自己的代码库并提出改进建议。它给出的观察真的很有洞见:智能体专精化、对反复出现的失败做模式分析、并行化评审瓶颈。都是我之前没注意到的东西。其中三条建议变成了任务,智能体把它们实现了,AO 变得更好了。

这就是“自我改进循环”的干净版本:一切都正常运转,每一轮都产出比上一轮更好的东西。

但我有个问题。AO 有一个完整的 Web 仪表盘:实时终端、看板、会话管理。它确实很强大。但在手机上终端滚动不正常。界面也偏技术向:你得打开浏览器,访问一个 URL,点进一个终端面板,跑命令。凌晨 2 点某个会话失败时,你得起床、打开笔记本、拉起仪表盘、搞清楚发生了什么。这不是那种你能在 Telegram 手机上随手看看就行的东西。况且我一天里大部分时间都在和另一个完全不同的系统对话。

why connect OpenClaw to orchestrator

every AI system has an unsolved last-mile problem: the human interface.

tools keep building their own dashboards, their own CLIs, their own web apps. each one requires a context switch. open a browser. navigate to a URL. learn the UI. remember the commands. AO is no exception. it has a great dashboard with kanban views, live terminals, session management, PR tracking. it has its own orchestrator agent that spawns sessions, assigns tasks, monitors CI. AO is a complete system. it handles orchestration on its own.

but it still lives behind a URL. and i'm not always at my laptop.

OpenClaw inverts this. 278K GitHub stars. but here's the thing: there are plenty of AI chatbots integrated into WhatsApp and Telegram. you can talk to ChatGPT in a messaging app right now. that's not what makes OpenClaw different.

OpenClaw won because it treated the problem as infrastructure, not as a chat feature.

a chatbot is stateless request-response. you type, it replies, the context evaporates. OpenClaw is an always-running process on your own machine with persistent sessions, memory files, tool access, file system access, sandboxed code execution. the Gateway is the single authority over sessions, routing, tool invocation, and state. it's not "AI in Telegram." it's an operating system for AI agents that happens to be accessible through Telegram.

the engineering differences matter. OpenClaw executes, it doesn't just generate text. it runs shell commands, reads files, makes API calls, deploys code. the LLM becomes the operator, not the responder. it's event-driven, not just request-driven: it reacts to crons, webhooks, email arrivals, heartbeats. it notices things and acts without being asked. it supports multi-agent routing: one gateway, multiple agents with different workspaces and skills. and everything runs local-first on your hardware, with full system access. a Telegram chatbot running on someone else's cloud can't SSH into your server or read your codex auth file.

i've been running it for months. it manages my finances, tracks contacts, writes journal entries, monitors my email, deploys code, runs scripts. it's the single interface through which i interact with everything in my digital life.

for agent orchestration specifically, four things matter:

ambient availability. AO's dashboard requires intentional access. OpenClaw is in Telegram, which is already open. when a session fails at 2 AM, i don't need to find my laptop.

natural language as the universal API. AO's CLI has ao spawn, ao send, flags, arguments. OpenClaw translates "fix the terminal bug" into the right sequence of commands.

persistent context across sessions. OpenClaw carries memory between conversations. it knows what ao-12 was working on yesterday, what failed last night, what the priorities are this week. AO's dashboard shows current state. OpenClaw knows history and intent.

multi-system reach. OpenClaw doesn't just talk to AO. it manages my server, my blog, my email, my finances. when i say "deploy the blog post and then create the social media drafts," that crosses AO, Caddy, the blog renderer, the static file server, and the writing voice system. no single tool's dashboard spans all of that.

so the connection was natural. but here's the key architectural decision: i'm not building OpenClaw as a notification layer that talks to AO's orchestrator. i'm building a connector that lets OpenClaw take over the orchestrator role directly.

AO has always been designed for human-in-the-loop operation. the standalone orchestrator agent (a codex or claude-code session) was always a stand-in for the human, making decisions the human would make if they were watching. with the OpenClaw connector, the actual human IS watching, through OpenClaw. the stand-in becomes unnecessary.

OpenClaw with the connector uses AO's infrastructure directly: worktrees, tmux sessions, CI monitoring, session management, the dashboard. but the orchestration decisions, what to build, when to kill a stuck session, how to decompose a problem, come from OpenClaw itself, with the human right there on Telegram to weigh in. no redundant LLM layer translating intent twice. the orchestrator has human context, persistent memory, multi-system reach. escalation is instant because the human is already in the conversation.

the standalone AO orchestrator still works exactly as before, it's also human-in-the-loop, not autonomous. the difference is which agent handles the orchestration responsibilities. without the connector, a dedicated codex or claude-code session acts as orchestrator. with the connector, OpenClaw takes over that role through a plugin, bringing its persistent memory, multi-system reach, and the fact that the human is already in the conversation.

and then the recursive idea: have OpenClaw use Agent Orchestrator to build the OpenClaw-AO connector, then point Agent Orchestrator back at its own codebase in the same run. the human interface building a better version of itself.

为什么把 OpenClaw 接到编排器上

每个 AI 系统都有一个尚未解决的“最后一公里”问题:人与系统的交互界面。

工具不断给自己造仪表盘、造 CLI、造 Web 应用。每一个都需要一次上下文切换:打开浏览器,访问 URL,学习 UI,记住命令。AO 也不例外。它有很棒的仪表盘:看板视图、实时终端、会话管理、PR 跟踪。它还有自己的编排器智能体,用于启动会话、分配任务、监控 CI。AO 是个完整系统,它可以自己完成编排。

但它依然藏在一个 URL 后面,而我并不总是在电脑前。

OpenClaw 则把这一点倒过来了。278K GitHub stars。但关键在于:集成到 WhatsApp 和 Telegram 的 AI 聊天机器人多得很。你现在就能在消息应用里和 ChatGPT 对话。这并不是 OpenClaw 不同的地方。

OpenClaw 之所以赢,是因为它把问题当成基础设施来做,而不是当成一个聊天功能。

聊天机器人是无状态的请求-响应:你打字,它回复,上下文随即蒸发。OpenClaw 是你自己机器上一个持续运行的进程,拥有持久会话、记忆文件、工具访问、文件系统访问、沙箱化代码执行。Gateway 是会话、路由、工具调用与状态的单一权威。它不是“Telegram 里的 AI”。它是一个 AI 智能体的操作系统,只是恰好能通过 Telegram 访问。

工程上的差异很重要。OpenClaw 会执行,而不只是生成文本。它会跑 shell 命令、读文件、调 API、部署代码。LLM 变成操作者,而不是应答者。它是事件驱动的,不只是请求驱动:它会对定时任务、webhook、邮件到达、心跳做出反应。它能在没人问的时候注意到事情并采取行动。它支持多智能体路由:一个 gateway,多名智能体,各自有不同的工作区和技能。并且一切都以本地优先的方式在你的硬件上运行,拥有完整系统访问。运行在别人云端的 Telegram 聊天机器人,不可能 SSH 到你的服务器,也读不到你的 codex 认证文件。

我已经跑它好几个月了。它管理我的财务、跟踪联系人、写日记条目、监控邮件、部署代码、跑脚本。它是我与数字生活中一切交互的单一界面。

而对“智能体编排”这件事来说,有四点尤其关键:

环境式可用性。AO 的仪表盘需要你主动去打开。OpenClaw 在 Telegram 里,而 Telegram 本来就开着。凌晨 2 点会话失败时,我不需要去找电脑。

自然语言作为通用 API。AO 的 CLI 有 ao spawn、ao send、各种 flags 和参数。OpenClaw 能把“修一下终端 bug”翻译成正确的一串命令序列。

跨会话的持久上下文。OpenClaw 在对话之间携带记忆。它知道 ao-12 昨天在做什么、昨晚哪里失败了、本周优先级是什么。AO 的仪表盘展示当前状态;OpenClaw 了解历史与意图。

多系统触达。OpenClaw 不只是和 AO 对话。它还管理我的服务器、博客、邮件、财务。当我说“把博客文章部署了,然后做社媒草稿”,这会跨越 AO、Caddy、博客渲染器、静态文件服务器以及写作风格系统。任何单一工具的仪表盘都覆盖不了这些。

所以把它们连起来很自然。但这里有个关键的架构决策:我不是把 OpenClaw 做成一个“通知层”,去和 AO 的编排器对话;我是在做一个连接器,让 OpenClaw 能直接接管编排器的角色。

AO 从一开始就被设计为“人类在环”的运行方式。那个独立的编排器智能体(一个 codex 或 claude-code 会话)一直只是人类的替身:在你盯着看的情况下,人会做哪些决策,它就代做哪些。有了 OpenClaw 连接器,真正的人类通过 OpenClaw 在看着。替身就不再必要了。

带连接器的 OpenClaw 会直接使用 AO 的基础设施:worktrees、tmux 会话、CI 监控、会话管理、仪表盘。但编排决策——做什么、何时杀掉卡住的会话、如何拆解问题——由 OpenClaw 自己给出,而人类就在 Telegram 里随时介入权衡。没有多余的 LLM 层去把意图翻译两遍。编排器拥有人的上下文、持久记忆与多系统触达;升级也能即时发生,因为人本就已在对话里。

独立的 AO 编排器仍然像以前一样工作,它同样是人类在环,而不是自治。区别在于:是谁来承担编排职责。没有连接器时,一个专门的 codex 或 claude-code 会话充当编排器;有了连接器,OpenClaw 通过一个插件接管这一角色,把持久记忆、多系统触达,以及“人就在对话里”这件事带进来。

然后就是那个递归想法:让 OpenClaw 用 Agent Orchestrator 来构建 OpenClaw-AO 连接器,再在同一次运行里把 Agent Orchestrator 指回它自己的代码库。用人类界面去构建一个更好的自己。

what actually shipped in the connector

ao-12's writeup made one thing obvious: speed came from refusing to over-design transport.

i considered deeper peer-protocol ideas first. interesting, but slow. the move that shipped was simple: build a notifier plugin and route into OpenClaw's existing hook ingress.

• AO notifier plugin: @composio/ao-plugin-notifier-openclaw

• OpenClaw ingress: POST /hooks/agent

• local transport: 127.0.0.1 + token auth

• session mapping: hook:ao:

• delivery hardening: exponential backoff on 429/5xx

the highest leverage testing move was external operator validation, not just local green tests. separate OpenClaw instance, fresh checkout, build from source, hook config, token rotation, burst traffic, and live channel rendering.

• passed: ingress, session isolation, token rotation, burst handling, and clean deliver: true rendering

• gaps: no idempotent dedupe, same-session ordering can drift by completion timing, reverse command path still needs full runtime smoke validation

连接器实际交付了什么

ao-12 的总结让一件事变得很明显:速度来自拒绝在传输层过度设计。

我一开始考虑过更深的点对点协议想法。很有趣,但很慢。最终能交付的动作很简单:做一个 notifier 插件,然后路由进 OpenClaw 现有的 hook 入口。

• AO notifier plugin: @composio/ao-plugin-notifier-openclaw

• OpenClaw ingress: POST /hooks/agent

• local transport: 127.0.0.1 + token auth

• session mapping: hook:ao:

• delivery hardening: exponential backoff on 429/5xx

测试上最高杠杆的动作是“外部操作者验证”,而不只是本地测试全绿:单独起一个 OpenClaw 实例,全新 checkout,从源码构建,配置 hook,轮换 token,打突发流量,并在真实频道里看渲染效果。

• 通过项:ingress、会话隔离、token 轮换、突发处理,以及干净的 deliver: true 渲染

• 缺口:没有幂等去重,同一会话内的顺序可能因完成时机而漂移,反向命令通路仍需要完整运行时的冒烟验证

the mind-bending feedback loop that made this actually work

the loop we actually ran: OpenClaw used AO to build the plugin, another OpenClaw tested it like a customer, feedback went back into the same agent session.

15 parallel sessions. one overnight run. here's what actually happened.

让这一切真正跑起来的、令人眩晕的反馈回路

我们实际跑的循环是:OpenClaw 用 AO 构建插件,另一个 OpenClaw 像客户一样去测试它,反馈再回流到同一个智能体会话里。

15 个并行会话。一整晚。下面才是实际发生的事。

15 sessions, one night

i want to be clear about what "self-improving" means here, because it's easy to overstate. the agents write code autonomously. they run tests, iterate on CI failures, push commits. that part is genuinely hands-off. but the orchestration layer, deciding what to build, which sessions to spawn, what context to inject, when to kill a stuck session and start over, that was me. i was on Telegram the whole night, directing OpenClaw, which was directing AO, which was directing the agents. three layers of intelligence, but the strategic decisions were still human.

the overnight run wasn't "set it and forget it." it was more like managing a team of very fast junior engineers over chat at 2 AM.

here's what the night actually looked like.

https://x.com/agent_wrapper/status/2025986105485733945?s=20

every session that ran last night. green merged, red died, purple has an open PR, amber still working. the dashed lines are the gaps where sessions were dead before being respawned.

15 个会话,一夜之间

我想先把这里的“自我改进”说清楚,因为它很容易被夸大。智能体确实会自主写代码:跑测试、针对 CI 失败迭代、推 commits。这部分真的几乎不用人管。但编排层——决定做什么、启动哪些会话、注入哪些上下文、什么时候杀掉卡住的会话并重来——那是我在做。我整晚都在 Telegram 上指挥 OpenClaw,而 OpenClaw 在指挥 AO,AO 再指挥智能体。三层智能,但战略决策依然是人类的。

这趟通宵并不是“设好就忘”。更像是在凌晨 2 点通过聊天管理一群速度极快的初级工程师。

这就是那晚真实的样子。

https://x.com/agent_wrapper/status/2025986105485733945?s=20

昨晚跑过的每个会话:绿色已合并,红色已死亡,紫色有未合并 PR,琥珀色仍在工作。虚线是会话死掉后被重启之间的空档。

the first wave: things work

sessions ao-3 through ao-6 were clean. i'd notice a bug while using AO, describe it to OpenClaw on Telegram, and tell it to spawn a session. OpenClaw would run ao spawn, then ao send to inject the task description. each session got its own git worktree branched off main, a codex instance running inside tmux, and the task i'd described.

ao-3 fixed codex suppressing update prompts. PR #338, merged. ao-4 fixed a permissions flag that was being ignored. PR #337, merged. ao-5 bumped the version to 0.1.1. PR #339, merged. ao-6 fixed PATH ordering so the gh CLI wrapper would resolve correctly. PR #343, merged.

four sessions, four PRs, four merges. clean. textbook self-improvement loop. the system was building itself and each merge made the next session slightly smoother.

ao-7 was the first sign of trouble. it was working on the same issue as ao-6 but took a different approach. two agents, same bug, two PRs. i killed ao-7 and merged ao-6's PR. not a disaster, but a coordination failure. the orchestrator should have detected the duplicate. it didn't, because duplicate detection wasn't built yet.

so i made a mental note: build duplicate detection. that note became a task. that task would eventually become another agent session. the system was already surfacing its own gaps.

第一波:一切都在工作

ao-3 到 ao-6 都很干净。我在用 AO 时发现一个 bug,就在 Telegram 上把它描述给 OpenClaw,然后让它启动一个会话。OpenClaw 会先跑 ao spawn,再用 ao send 注入任务描述。每个会话都有自己的 git worktree(从 main 分支切出)、一个在 tmux 里运行的 codex 实例,以及我描述的任务。

ao-3 修复了 codex 抑制更新提示的问题。PR #338,已合并。ao-4 修复了一个被忽略的权限标志位。PR #337,已合并。ao-5 把版本号升到 0.1.1。PR #339,已合并。ao-6 修复了 PATH 顺序,使 gh CLI wrapper 能正确解析。PR #343,已合并。

四个会话,四个 PR,四次合并。干净。教科书式的自我改进循环:系统在构建自己,而每次合并都让下一次会话稍微更顺滑一点。

ao-7 是第一处麻烦信号。它在处理和 ao-6 同一个问题,但采用了不同的做法。两个智能体,同一个 bug,两份 PR。我杀掉了 ao-7,合并了 ao-6 的 PR。不是灾难,但确实是一次协作失败:编排器本应识别出重复工作,却没有。因为当时还没做重复检测。

于是我在心里记了一笔:做重复检测。这条记忆变成了一个任务。那个任务最终会变成另一个智能体会话。系统已经在暴露自己的缺口。

the crash

then came ao-9. this is where the night got interesting.

ao-9 was supposed to fix WebSocket URL routing for the terminal component. a 15-line change. simple enough that i didn't even bother spawning an agent for it. i just made the edit myself, committed, pushed, and opened PR #346.

this was a mistake. not because the code was wrong. the code was fine. the mistake was that ao-9 existed in AO's session list but had no tmux session behind it. every other session had a live codex process running in tmux. ao-9 had nothing. when you opened ao-9 on the dashboard, the terminal component tried to connect to a tmux pane that didn't exist. it flickered endlessly. reconnect, fail, reconnect, fail.

i tried to fix this by spawning a real agent into ao-9's slot. but the worktree was already checked out on a different branch. so i killed ao-9, created ao-8 to take over, realized that was worse because now i had two sessions for one PR, killed ao-8, recreated the worktree for ao-9, and tried to start codex manually.

codex crashed immediately.

one line. no stack trace. no explanation. just "permission denied."

i ran strace to figure out what file it was trying to read.

the auth.json file was owned by lifeos-secrets:lifeos-secrets with 600 permissions. the codex process was running as lifeos. it couldn't read its own authentication file.

how did this happen? earlier that day, i'd been hardening the gh CLI to prevent the AI from accessing unauthorized GitHub repos. part of that work involved moving credentials to a separate system user called lifeos-secrets. the auth.json file got caught in that sweep. a security improvement in one part of the system had silently broken a completely different part.

https://github.com/openclaw/openclaw

the fix was simple once i found it. delete the file (the directory was owned by lifeos, so unlinking worked even though the file wasn't), create a fresh empty one, and let codex fall back to the OPENAI_API_KEY environment variable. but finding the cause took 20 minutes of strace and confusion.

this is the kind of failure that doesn't show up in theory papers about self-improving systems. a security improvement in one subsystem silently breaks an authentication path in another. no test caught it because the tests don't run as a different user. the blast radius was invisible until someone tried to start a new session.

崩溃

接下来是 ao-9,这一夜开始变得有意思了。

ao-9 本该修复终端组件的 WebSocket URL 路由。改动 15 行。简单到我甚至没让智能体去做。我自己改了,commit、push,然后开了 PR #346。

这是个错误。不是因为代码有问题。代码没问题。错在于:ao-9 在 AO 的会话列表里存在,但背后没有对应的 tmux 会话。其他所有会话背后都有一个在 tmux 中运行的 codex 进程。ao-9 什么都没有。当你在仪表盘打开 ao-9 时,终端组件会尝试连接一个不存在的 tmux pane,于是它就无休止地闪烁:重连、失败、重连、失败。

我试图通过把一个真正的智能体塞进 ao-9 的槽位来修复。但 worktree 已经 checkout 到另一个分支上。于是我杀掉 ao-9,创建 ao-8 来接手,结果意识到这更糟,因为现在一个 PR 对应两个会话;我又杀掉 ao-8,重建 ao-9 的 worktree,并尝试手动启动 codex。

codex 立刻崩了。

一行输出。没有堆栈。没有解释。只有一句“permission denied”。

我跑了 strace,想看它到底在读哪个文件。

auth.json 文件属于 lifeos-secrets:lifeos-secrets,权限 600。codex 进程以 lifeos 用户运行,它读不到自己的认证文件。

这怎么发生的?那天早些时候,我在加固 gh CLI,防止 AI 访问未授权的 GitHub 仓库。那项工作的一部分是把凭据移到一个叫 lifeos-secrets 的系统用户下。auth.json 被这次清理顺手卷了进去。系统某一处的安全改进,悄无声息地把另一处完全不同的路径搞坏了。

https://github.com/openclaw/openclaw

一旦找到原因,修复很简单:删掉这个文件(目录归 lifeos 所有,所以即便文件不属于它,unlink 也能成功),新建一个空文件,让 codex 回退到 OPENAI_API_KEY 环境变量。但定位原因花了 20 分钟的 strace 和困惑。

这就是那种不会出现在关于“自我改进系统”的理论论文里的故障:一个子系统的安全改进,悄悄破坏了另一个子系统里的认证路径。测试抓不到,因为测试不会以不同用户运行。影响范围在有人尝试启动一个新会话之前完全不可见。

the mass death

while i was debugging the auth crash, i had a bigger problem. sessions ao-10 through ao-14 were all dead.

these five sessions had been spawned using the wrong method. OpenClaw used its exec tool (a background shell process) instead of ao spawn. i didn't catch the mistake until they were all dead. the difference matters. ao spawn creates a detached tmux session that lives independently. exec creates a child process of OpenClaw's shell session. when that shell session times out after 600 seconds, the child process gets SIGTERM'd. the codex process dies.

five sessions, five tasks, all gone. no work saved. no partial progress. the worktrees existed but had zero commits beyond the base branch. this was an operator error. i should have told OpenClaw to use ao spawn from the start. i didn't, and i lost hours of agent work.

i told OpenClaw to respawn them through ao spawn this time, but AO reuses session IDs sequentially. so when i spawned replacements, they got IDs ao-10 through ao-14, but with different tasks than the originals. ao-11 was originally "fix mobile terminal scrolling." the respawned ao-11 got "CI auto-injection with retry escalation." total confusion about which session was doing what.

this is a session identity problem. the sessions are identified by sequential numbers, not by their task or purpose. when ao-11 dies and gets respawned, it should still be "the mobile terminal scroll session." instead, it became a completely different session that happened to have the same number.

大面积死亡

当我还在调 auth 崩溃时,还有个更大的问题:ao-10 到 ao-14 全都死了。

这五个会话是用错误的方法启动的。OpenClaw 用了它的 exec 工具(一个后台 shell 进程),而不是 ao spawn。我直到它们全死光才发现这个错误。差别很重要。ao spawn 会创建一个独立的 tmux 会话,它能独立存活;exec 则会创建 OpenClaw 的 shell 会话的子进程。当那个 shell 会话在 600 秒后超时,子进程会收到 SIGTERM。codex 进程就死了。

五个会话,五个任务,全没了。没有保存的工作。没有部分进展。worktree 还在,但除了基分支之外没有任何新 commit。这是操作者失误。我一开始就该告诉 OpenClaw 用 ao spawn。我没说,于是我丢了数小时的智能体工作。

我让 OpenClaw 这次用 ao spawn 把它们重启,但 AO 的会话 ID 是顺序复用的。所以我启动替代会话时,它们又拿到了 ao-10 到 ao-14 的 ID,但任务却和原来不一样。原本的 ao-11 是“修手机端终端滚动”。重启后的 ao-11 拿到的却是“CI 自动注入 + 重试升级”。完全混乱,到底哪个会话在做什么。

这是一个会话身份问题。会话靠顺序编号识别,而不是靠任务或目的。当 ao-11 死掉并被重启时,它应该仍然是“手机端终端滚动会话”。可实际上,它变成了一个恰好也叫 ao-11 的完全不同会话。

the recursion gets deeper

here's where it gets properly weird.

one of the respawned sessions, ao-12, got a task that i've been thinking about for a while: design the integration between OpenClaw and AO. the system that manages my life (OpenClaw) using the system that manages coding agents (AO) to build the bridge between them.

let me say that again because it's important. i'm talking to an AI assistant on Telegram. the assistant is using an agent orchestrator to spawn coding agents. one of those agents is designing how the assistant should integrate with the orchestrator. the agent is writing a design document for the system that will eventually replace the manual process by which it was created.

three levels of recursion:

• human talks to OpenClaw

• OpenClaw uses AO to spawn agents

• agent designs the OpenClaw-AO integration

and here's what made it interesting. i'd been hitting failures all night, getting frustrated, fixing things manually. at some point i told OpenClaw: "give ao-12 all the context about what went wrong tonight so it can design around these problems." OpenClaw packaged up every failure i'd hit, sessions dying silently, messages not submitting, IDs getting reused, no health monitoring, no auto-respawn, and injected it into the agent as design requirements.

the agent didn't discover these requirements. i did, by operating the system badly and noticing what broke. then i fed those observations into an agent that could turn them into a design. the insight was human. the execution was automated.

the meta-structure: i talk to OpenClaw, which uses AO to spawn agents, one of which is designing how OpenClaw should integrate with AO. tonight's failures become the requirements for that design.

this is the self-improvement loop, but it's not the clean version i described in the first blog. it's messy. the improvements come from crashes and confusion, not from elegant meta-analysis sessions. the system learns from breaking.

递归更深了

接下来就真的开始诡异起来了。

在这些重启的会话里,有一个 ao-12 拿到了一个我思考了很久的任务:设计 OpenClaw 与 AO 的集成。用“管理我生活的系统”(OpenClaw)通过“管理编程智能体的系统”(AO)来构建它们之间的桥。

我再说一遍,因为这很关键:我在 Telegram 上和一个 AI 助手对话。这个助手在用一个智能体编排器去启动编程智能体。其中一个智能体正在设计:这个助手应该如何与这个编排器集成。这个智能体在给一个系统写设计文档——而这个系统最终会取代当初创造它的那套手工流程。

三层递归:

• 人类和 OpenClaw 对话

• OpenClaw 用 AO 启动智能体

• 智能体设计 OpenClaw-AO 集成

有趣之处在于:我整晚都在撞失败、变得烦躁、手动修东西。某个时刻,我对 OpenClaw 说:“把今晚出过的所有问题上下文都给 ao-12,让它能围绕这些问题做设计。”OpenClaw 把我遇到的每个失败都打包了:会话悄无声息地死掉、消息提交不上去、ID 被复用、没有健康监控、没有自动重启,并把它们作为设计需求注入到智能体里。

这些需求不是智能体发现的,是我在糟糕地操作系统时发现并注意到哪里坏了。然后我把这些观察喂给一个能把它们转成设计的智能体。洞见来自人类,执行被自动化。

元结构是:我和 OpenClaw 对话,OpenClaw 用 AO 启动智能体,其中一个在设计 OpenClaw 应如何与 AO 集成。今晚的失败,变成那份设计的需求。

这也是自我改进循环,但不是我在第一篇博客里描述的干净版本。它很脏。改进来自崩溃与混乱,而不是来自优雅的元分析会话。系统从“坏掉”中学习。

three tiers of "fix it yourself"

the failures from that night crystalized into an architecture. i call it the three-tier escalation protocol.

tier 1: agent self-healing. when CI fails on a PR, the failure output gets automatically injected back into the agent session. the agent reads the error, fixes the code, pushes again. up to 5 times before giving up. no human involved. session ao-11 built this and filed PR #354. this is the only tier that's actually implemented right now.

tier 2: orchestrator mediation. if the agent can't fix it after 5 tries, escalate to the orchestrator session. the orchestrator is itself a codex instance with context about all active sessions. it can look at the failing agent's code, understand the broader picture, and either suggest a fix or rethink the approach. this tier is designed but not built yet.

tier 3: human escalation via OpenClaw. if the orchestrator can't handle it, send a message to my Telegram. something like: "ao-14 failed CI 5 times on the activity state fix. error is a type mismatch in the codex plugin." i reply in chat and the response gets routed back to the agent. this is what ao-12 is designing right now. also not built yet.

the escalation architecture. same message format at every boundary. OpenClaw replaces the standalone orchestrator entirely. three layers remain: OpenClaw, the connector plugin, and the individual coding agents.

the key design decision: the protocol is uniform. the message format is identical whether it goes from agent to OpenClaw or from OpenClaw to me. OpenClaw replaces the standalone orchestrator entirely. three layers remain: OpenClaw at the top (with the human right there in the conversation), the connector plugin that bridges to AO's infrastructure, and the individual coding agents. OpenClaw isn't a notification sidebar. it's a peer in the escalation protocol, capable of both autonomous resolution and human handoff.

“自己修”的三层阶梯

那一晚的失败最终凝结成一个架构。我把它叫作“三层升级协议”。

第 1 层:智能体自愈。当 PR 的 CI 失败时,失败输出会被自动注入回智能体会话。智能体读错、修代码、再 push。最多 5 次,超过就放弃。无需人类介入。会话 ao-11 做了这个并提交了 PR #354。这是目前唯一真正实现了的一层。

第 2 层:编排器调解。如果智能体 5 次都修不好,就升级到编排器会话。编排器本身是一个 codex 实例,掌握所有活跃会话的上下文。它能查看失败智能体的代码,理解更大的局面,然后要么给出修复建议,要么重新思考路径。这一层已经设计好,但还没做出来。

第 3 层:通过 OpenClaw 把问题升级给人类。如果编排器也处理不了,就给我的 Telegram 发消息,比如:“ao-14 在活动状态修复上 CI 失败了 5 次。错误是 codex 插件里的类型不匹配。”我在聊天里回复,然后回复被路由回智能体。这正是 ao-12 现在在设计的内容,也还没实现。

这就是升级架构:跨边界使用同一种消息格式。OpenClaw 将完全取代独立编排器。仍保留三层:OpenClaw、连接器插件、以及各个编程智能体。

关键设计决策是:协议统一。消息格式在每一道边界上都一致,无论是从智能体到 OpenClaw,还是从 OpenClaw 到我。OpenClaw 完全取代独立编排器。三层仍然是:最上层的 OpenClaw(人类就在对话里)、桥接到 AO 基础设施的连接器插件、以及单个编程智能体。OpenClaw 不是一个通知侧栏,它是升级协议中的对等参与者,既能自主解决,也能把问题交给人类接管。

the scoreboard

by 6 AM, the overnight session had produced:

• 6 merged PRs (#337, #338, #339, #343, #346, and one from before)

• 2 open PRs (#353 for dashboard enrichment, #354 for CI auto-injection)

• 4 sessions actively working (OpenClaw integration design, terminal fixes, activity state fix, navbar fix)

• 6 sessions that died and were respawned

• 1 authentication crash that blocked all new sessions for 20 minutes

• 1 duplicate work incident (ao-6 and ao-7 on the same bug)

• 0 regressions introduced to the main branch

the system that ran at 6 AM was meaningfully better than the one at 6 PM. not because of any single change, but because of all of them together. the codex plugin handled permissions correctly. PATH resolution worked. the version was bumped. the terminal WebSocket connected through the reverse proxy. the dashboard showed live PR data.

and three sessions were still running. whether they'd produce something useful or crash silently, i wouldn't know until i checked in the morning.

记分牌

到早上 6 点,这次通宵产出了:

• 6 个已合并 PR(#337、#338、#339、#343、#346,以及一个更早的)

• 2 个未合并 PR(#353:仪表盘信息增强;#354:CI 自动注入)

• 4 个仍在工作的会话(OpenClaw 集成设计、终端修复、活动状态修复、导航栏修复)

• 6 个死亡后被重启的会话

• 1 次认证崩溃,导致 20 分钟内无法启动任何新会话

• 1 次重复工作事故(ao-6 与 ao-7 在同一个 bug 上)

• 0 次向 main 分支引入回归

早上 6 点运行的系统,已经明显比前一晚 6 点的更好。不是因为某一个改动,而是所有改动叠加起来:codex 插件正确处理了权限;PATH 解析正常;版本号上调;终端 WebSocket 能通过反向代理连上;仪表盘能显示实时 PR 数据。

而且还有三个会话在跑。它们到底会产出有用的东西,还是会悄悄崩掉,我要到早上查看时才会知道。

what self-improvement actually looks like

the first blog walked through the loop in detail. the 8 steps, the file-locking example, session ao-52's self-analysis. real code, real sessions, real improvements. all of that was true and still is.

but running the loop at scale, overnight, with 15 sessions in parallel? that's a different animal.

sessions die because i told OpenClaw to use the wrong spawn method. a security change i made breaks authentication for a different tool. messages get pasted into codex's input buffer but the Enter key never fires, and i have to notice the agent is stuck and manually press Enter on the server. session IDs get reused and i lose track of which agent is doing what.

the self-improvement still happens. but it's not automatic. i notice the failure. i understand what went wrong. i tell OpenClaw to feed that failure back as a requirement. the auth crash? i told ao-12 to include "crash forensics" in the design. the exec timeout? i told it to add "session health monitoring." the ID reuse? "session identity tied to task, not sequential numbers."

the system improves by being bad in informative ways. but the "informative" part requires a human paying attention at 2 AM.

自我改进实际是什么样子

第一篇博客把这个循环讲得很细:8 个步骤、文件锁示例、会话 ao-52 的自我分析。真实代码、真实会话、真实改进。那些都是真的,现在也仍然成立。

但把这个循环放大到一整晚、15 个会话并行?那就是另一种野兽了。

会话会死掉,因为我让 OpenClaw 用了错误的启动方式。我做的一个安全改动,会破坏另一个工具的认证。消息会被粘贴进 codex 的输入缓冲区,但回车键从未触发,我得自己发现智能体卡住了,然后在服务器上手动按 Enter。会话 ID 被复用,我就跟丢到底哪个智能体在做什么。

自我改进仍然会发生,但它不是自动的。我发现失败,理解哪里出了问题,然后让 OpenClaw 把这个失败作为需求喂回去。auth 崩溃?我让 ao-12 把“崩溃取证”纳入设计。exec 超时?我让它加上“会话健康监控”。ID 复用?“会话身份要绑定任务,而不是顺序编号”。

系统通过“坏得很有信息量”来改进。但“有信息量”这部分,需要一个人在凌晨 2 点盯着看。

what changes at scale

in the first blog, i described three phases: agents as tools, agents as workers, agents as self-improving systems. i walked through concrete examples of each. i said Phase 3 was "qualitatively different."

i was right, but the qualitative difference isn't what i expected. it's not that the system gets better faster. it's that the system generates its own improvement backlog.

when you use agents as workers (Phase 2), you tell them what to build. you maintain the backlog. you prioritize. you decide what matters. the agents are skilled labor, but the direction is entirely human.

in Phase 3, the system produces failures that reveal requirements that generate tasks that agents implement. i didn't plan to build session health monitoring. five sessions died silently at 2 AM and the need became obvious. but let me be honest: the requirement didn't "write itself." i noticed the problem, understood it, and turned it into a task. the system surfaced the failure. i did the interpretation. the agents did the implementation.

maybe that's still Phase 2.5. the fully autonomous version, where the system detects its own failures and spawns agents to fix them without a human noticing at 2 AM, is what the escalation protocol is designed to enable. i'm not there yet. but the infrastructure is being built by the same agents that need it, which is at least poetic.

规模化之后有什么变化

在第一篇博客里,我描述了三个阶段:智能体作为工具、智能体作为工人、智能体作为自我改进系统。我给每个阶段都走了具体例子。我说第 3 阶段是“质变”。

我说对了,但质变的点不是我预期的那样。不是系统改得更快,而是系统会自己生成改进 backlog。

当你把智能体当工人(第 2 阶段)时,你告诉它们要做什么。你维护 backlog。你排优先级。你决定什么重要。智能体是熟练劳动力,但方向完全由人类提供。

而在第 3 阶段,系统会产生失败。失败暴露需求。需求生成任务。任务由智能体实现。我并没计划去做会话健康监控。凌晨 2 点五个会话悄无声息地死掉了,这个需求就变得显而易见。但老实说:这个需求并不是“自己写出来的”。我注意到问题,理解问题,并把它转成任务。系统揭示失败;我负责解释;智能体负责实现。

也许这仍是第 2.5 阶段。真正完全自治的版本——系统能检测自身失败,并在无需人类凌晨 2 点发现的情况下自动启动智能体来修——正是升级协议想要实现的。我还没到那一步。但至少这套基础设施正在由同一批需要它的智能体来构建,这多少有点诗意。

the part that scares me

i'll be honest about something. at 3 AM, when i was watching ao-12 write a design document for the system that would eventually supervise all the other agents, including future versions of itself, i had a moment where i thought: i'm not sure i fully understand what i'm building.

not in a Terminator way. in an engineering complexity way. the system has three layers of AI (OpenClaw, AO orchestrator, individual agents), each with different models and contexts and failure modes. the interactions between these layers produce emergent behaviors i didn't predict. the auth crash was an emergent behavior. the exec timeout was an emergent behavior. the message delivery failure was an emergent behavior.

as these layers get more tightly integrated, the space of possible emergent behaviors grows combinatorially. i can test individual components. i can test pairwise interactions. but testing the full system requires running the full system, and the full system is the production environment.

this is why i'm building the escalation protocol. not because i think the system will go rogue. because i think the system will fail in ways i can't predict, and i need a reliable path from "something broke" to "a human knows about it" that doesn't itself break in novel ways.

the safety mechanism for a self-improving system isn't preventing change. it's ensuring visibility. if i can see every modification the system makes to itself, i can catch problems before they compound. if i lose visibility, i lose control. and in a system this complex, losing visibility is easier than it sounds.

让我害怕的那部分

我得坦白一件事。凌晨 3 点,当我看着 ao-12 为一个未来将监督其他所有智能体(包括它自己未来版本)的系统写设计文档时,我突然有一刻在想:我不确定自己完全理解我正在构建的东西。

不是那种《终结者》式的担忧,而是工程复杂度意义上的担忧。系统有三层 AI(OpenClaw、AO 编排器、单个智能体),每一层都有不同的模型、上下文与失效模式。这些层之间的交互会产生我没预料到的涌现行为。auth 崩溃是涌现行为。exec 超时是涌现行为。消息投递失败是涌现行为。

随着这些层越来越紧密地集成,可出现的涌现行为空间会呈组合爆炸增长。我可以测试单个组件。我可以测试两两交互。但测试完整系统,需要运行完整系统;而完整系统就是生产环境。

这就是我在做升级协议的原因。不是因为我担心系统会失控,而是因为我认为系统会以我无法预测的方式失败,而我需要一条可靠路径,把“某处坏了”变成“一个人知道了”,并且这条路径本身不会以新颖的方式坏掉。

自我改进系统的安全机制,不是阻止变化,而是确保可见性。只要我能看见系统对自身做的每一次修改,我就能在问题叠加之前抓住它。如果我失去可见性,我就失去控制。而在这么复杂的系统里,失去可见性比听起来更容易。

this post is part of the loop

i should mention how this blog post was written. i told OpenClaw on Telegram: "write a blog about how i built the OpenClaw-AO integration by asking OpenClaw to build it using Orchestrator." it read the first blog for style reference, wrote a draft, saved it to the server, and sent me a link. i read it. it was wrong in places. it overstated how autonomous the system was. i told it to fix that. it fixed it. i told it the diagrams needed to be better. it redid them. i told it to include the star history image. it added it, broke the YAML config in the process, fixed that too, and sent me a new link.

this paragraph you're reading right now was written after i told OpenClaw: "the article makes it look like the system was a lot more autonomous than it actually was. be realistic." the AI wrote a more honest version. i'm reviewing it on the same server that hosts the AO dashboard that monitors the agents that are building the features i'm writing about.

it's recursive, yes. but at every level, a human is reading, judging, and redirecting. the automation handles the typing. the human handles the thinking.

这篇文章也是循环的一部分

我还得提一句这篇博客是怎么写出来的。我在 Telegram 上对 OpenClaw 说:“写一篇博客,讲我如何通过让 OpenClaw 用 Orchestrator 构建 OpenClaw-AO 集成。”它读了第一篇博客作为风格参考,写了初稿,存到服务器上,并给我发了链接。我读了,发现有些地方不对。它把系统的自治程度写得太夸张了。我让它改。它改了。我说图需要更好。它重做了。我说要加上星标历史的图片。它加了,顺手把 YAML 配置搞坏了,又把它修好,然后给我发了新链接。

你现在读到的这一段,就是我对 OpenClaw 说“文章让系统看起来比实际更自治,务必写得现实一点”之后写出来的。AI 写了一个更诚实的版本。我正在同一台服务器上审阅它:这台服务器既托管着 AO 的仪表盘,监控着正在构建我所写功能的智能体;也托管着这篇文章的草稿。

确实是递归。但每一层都有一个人类在读、在判断、在纠偏。自动化负责打字,人类负责思考。

the loop continues

it's Sunday morning now. the sessions are still running. ao-12 is writing the OpenClaw integration design. ao-13 is fixing the mobile terminal. ao-14 is patching the activity state bug. ao-15 is fixing the navbar links.

by the time i finish writing this post, some of those PRs will be merged. the system will be better. new bugs will have appeared. new sessions will be spawned to fix them.

the loop doesn't stop. it doesn't have a clean endpoint. there's no version 2.0 release where everything works perfectly. there's just continuous, incremental, chaotic improvement. the coding is automated. the direction is still me, on Telegram, at 3 AM, telling an AI assistant what to fix next.

i wrote in the first blog that the companies who figure out self-improving agentic systems first will have an absurd advantage. i walked through why: compound interest applied to engineering capability. i still believe every word.

but i'd add something i didn't appreciate before: the advantage isn't in having a clean self-improvement loop. it's in having a messy one that you can observe, debug, and steer.

the system that keeps building itself doesn't need to be perfect. it needs to be transparent.

Agent Orchestrator is open source at github.com/ComposioHQ/agent-orchestrator. the dashboard, session management, and escalation protocol are all in the repo. i work on AI agents at Composio. if you're building orchestration systems or thinking about self-improvement loops, find me on Twitter or GitHub.

Link: http://x.com/i/article/2031050661866221568

循环仍在继续

现在是周日早晨。会话还在跑。ao-12 在写 OpenClaw 集成设计。ao-13 在修手机端终端。ao-14 在修补活动状态 bug。ao-15 在修导航栏链接。

等我写完这篇文章,其中一些 PR 可能已经合并。系统会更好。新的 bug 也会出现。新的会话会被启动来修它们。

循环不会停。它没有一个干净的终点。不会有一个 2.0 版本发布、从此一切完美运转。只有持续、渐进、混乱的改进。编码被自动化了,方向仍然是我:凌晨 3 点在 Telegram 上告诉一个 AI 助手下一步该修什么。

我在第一篇博客里写过:最先搞定“可自我改进的智能体系统”的公司,会拥有荒谬的优势。我解释过原因:把复利应用到工程能力上。我现在仍然相信那句话的每一个字。

但我想补充一点:我之前没有充分意识到,优势不在于拥有一个干净的自我改进循环,而在于拥有一个你能观察、能调试、能掌舵的混乱循环。

这个不断构建自身的系统不需要完美,它需要透明。

Agent Orchestrator 已在 github.com/ComposioHQ/agent-orchestrator 开源。仪表盘、会话管理与升级协议都在这个仓库里。我在 Composio 做 AI 智能体相关工作。如果你在做编排系统,或者在思考自我改进循环,欢迎在 Twitter 或 GitHub 上找到我。

链接: http://x.com/i/article/2031050661866221568

相关笔记

18 days ago we open-sourced Agent Orchestrator. 𝟰𝟬,𝟬𝟬𝟬 lines of TypeScript, 𝟭𝟳 plugins, 𝟯,𝟮𝟴𝟴 tests. a system for managing fleets of AI coding agents in parallel, built in 8 days by the agents it orchestrates. if you haven't read that post, the short version: each agent gets its own git worktree, its own terminal session, its own task. AO tracks them all, monitors CI, handles PRs, and coordinates the chaos.

it hit 3,800+ GitHub stars in those 18 days.

18 days of AO: 983K impressions on X, 94.9K engagements, 9.6% engagement rate, and 0 to 3,800+ GitHub stars.

somewhere around day 3 after launch, i noticed something i hadn't planned for. i was using AO to develop AO. not in the "we eat our own dog food" sense. in the literal sense. i'd create a task describing a feature AO needed. AO would spin up a coding agent, give it context about the codebase, and let it work. the agent would write code, write tests, open a PR. another agent would review it. if everything passed, it'd get merged. AO would restart with the new code. the next task would run on the improved version.

step by step, the system that managed agents was being improved by the agents it managed.

one agent found a race condition not because it was looking for bugs, but because it hit the bug while working on something else. it filed an issue. another agent fixed it. after that, every subsequent session ran smoother. cleaner PRs, better reviews, higher quality improvements. small fix, cascading effects. in another session, i asked the orchestrator to analyze its own codebase and recommend improvements. it came back with genuinely insightful observations. agent specialization, pattern analysis on recurring failures, parallelizing review bottlenecks. things i hadn't noticed. three of those recommendations became tasks. agents implemented them. AO got better.

that's the clean version of the self-improvement loop. the version where everything works and each cycle produces something better than the last.

but i had a problem. AO has a full web dashboard with live terminals, kanban boards, session management. it's genuinely powerful. but the terminals don't scroll properly on mobile. the interface is technical: you're opening a browser, navigating to a URL, clicking into a terminal pane, running commands. when a session fails at 2 AM, you have to get up, open your laptop, pull up the dashboard, figure out what happened. it's not something you can casually check from your phone on Telegram. i was already spending most of my day talking to a different system entirely.

why connect OpenClaw to orchestrator

every AI system has an unsolved last-mile problem: the human interface.

tools keep building their own dashboards, their own CLIs, their own web apps. each one requires a context switch. open a browser. navigate to a URL. learn the UI. remember the commands. AO is no exception. it has a great dashboard with kanban views, live terminals, session management, PR tracking. it has its own orchestrator agent that spawns sessions, assigns tasks, monitors CI. AO is a complete system. it handles orchestration on its own.

but it still lives behind a URL. and i'm not always at my laptop.

OpenClaw inverts this. 278K GitHub stars. but here's the thing: there are plenty of AI chatbots integrated into WhatsApp and Telegram. you can talk to ChatGPT in a messaging app right now. that's not what makes OpenClaw different.

OpenClaw won because it treated the problem as infrastructure, not as a chat feature.

a chatbot is stateless request-response. you type, it replies, the context evaporates. OpenClaw is an always-running process on your own machine with persistent sessions, memory files, tool access, file system access, sandboxed code execution. the Gateway is the single authority over sessions, routing, tool invocation, and state. it's not "AI in Telegram." it's an operating system for AI agents that happens to be accessible through Telegram.

the engineering differences matter. OpenClaw executes, it doesn't just generate text. it runs shell commands, reads files, makes API calls, deploys code. the LLM becomes the operator, not the responder. it's event-driven, not just request-driven: it reacts to crons, webhooks, email arrivals, heartbeats. it notices things and acts without being asked. it supports multi-agent routing: one gateway, multiple agents with different workspaces and skills. and everything runs local-first on your hardware, with full system access. a Telegram chatbot running on someone else's cloud can't SSH into your server or read your codex auth file.

i've been running it for months. it manages my finances, tracks contacts, writes journal entries, monitors my email, deploys code, runs scripts. it's the single interface through which i interact with everything in my digital life.

for agent orchestration specifically, four things matter:

ambient availability. AO's dashboard requires intentional access. OpenClaw is in Telegram, which is already open. when a session fails at 2 AM, i don't need to find my laptop.

natural language as the universal API. AO's CLI has ao spawn, ao send, flags, arguments. OpenClaw translates "fix the terminal bug" into the right sequence of commands.

persistent context across sessions. OpenClaw carries memory between conversations. it knows what ao-12 was working on yesterday, what failed last night, what the priorities are this week. AO's dashboard shows current state. OpenClaw knows history and intent.

multi-system reach. OpenClaw doesn't just talk to AO. it manages my server, my blog, my email, my finances. when i say "deploy the blog post and then create the social media drafts," that crosses AO, Caddy, the blog renderer, the static file server, and the writing voice system. no single tool's dashboard spans all of that.

so the connection was natural. but here's the key architectural decision: i'm not building OpenClaw as a notification layer that talks to AO's orchestrator. i'm building a connector that lets OpenClaw take over the orchestrator role directly.

AO has always been designed for human-in-the-loop operation. the standalone orchestrator agent (a codex or claude-code session) was always a stand-in for the human, making decisions the human would make if they were watching. with the OpenClaw connector, the actual human IS watching, through OpenClaw. the stand-in becomes unnecessary.

OpenClaw with the connector uses AO's infrastructure directly: worktrees, tmux sessions, CI monitoring, session management, the dashboard. but the orchestration decisions, what to build, when to kill a stuck session, how to decompose a problem, come from OpenClaw itself, with the human right there on Telegram to weigh in. no redundant LLM layer translating intent twice. the orchestrator has human context, persistent memory, multi-system reach. escalation is instant because the human is already in the conversation.

the standalone AO orchestrator still works exactly as before, it's also human-in-the-loop, not autonomous. the difference is which agent handles the orchestration responsibilities. without the connector, a dedicated codex or claude-code session acts as orchestrator. with the connector, OpenClaw takes over that role through a plugin, bringing its persistent memory, multi-system reach, and the fact that the human is already in the conversation.

and then the recursive idea: have OpenClaw use Agent Orchestrator to build the OpenClaw-AO connector, then point Agent Orchestrator back at its own codebase in the same run. the human interface building a better version of itself.

what actually shipped in the connector

ao-12's writeup made one thing obvious: speed came from refusing to over-design transport.

i considered deeper peer-protocol ideas first. interesting, but slow. the move that shipped was simple: build a notifier plugin and route into OpenClaw's existing hook ingress.

• AO notifier plugin: @composio/ao-plugin-notifier-openclaw

• OpenClaw ingress: POST /hooks/agent

• local transport: 127.0.0.1 + token auth

• session mapping: hook:ao:

• delivery hardening: exponential backoff on 429/5xx

the highest leverage testing move was external operator validation, not just local green tests. separate OpenClaw instance, fresh checkout, build from source, hook config, token rotation, burst traffic, and live channel rendering.

• passed: ingress, session isolation, token rotation, burst handling, and clean deliver: true rendering

• gaps: no idempotent dedupe, same-session ordering can drift by completion timing, reverse command path still needs full runtime smoke validation

the mind-bending feedback loop that made this actually work

the loop we actually ran: OpenClaw used AO to build the plugin, another OpenClaw tested it like a customer, feedback went back into the same agent session.

15 parallel sessions. one overnight run. here's what actually happened.

15 sessions, one night

i want to be clear about what "self-improving" means here, because it's easy to overstate. the agents write code autonomously. they run tests, iterate on CI failures, push commits. that part is genuinely hands-off. but the orchestration layer, deciding what to build, which sessions to spawn, what context to inject, when to kill a stuck session and start over, that was me. i was on Telegram the whole night, directing OpenClaw, which was directing AO, which was directing the agents. three layers of intelligence, but the strategic decisions were still human.

the overnight run wasn't "set it and forget it." it was more like managing a team of very fast junior engineers over chat at 2 AM.

here's what the night actually looked like.

https://x.com/agent_wrapper/status/2025986105485733945?s=20

every session that ran last night. green merged, red died, purple has an open PR, amber still working. the dashed lines are the gaps where sessions were dead before being respawned.

the first wave: things work

sessions ao-3 through ao-6 were clean. i'd notice a bug while using AO, describe it to OpenClaw on Telegram, and tell it to spawn a session. OpenClaw would run ao spawn, then ao send to inject the task description. each session got its own git worktree branched off main, a codex instance running inside tmux, and the task i'd described.

ao-3 fixed codex suppressing update prompts. PR #338, merged. ao-4 fixed a permissions flag that was being ignored. PR #337, merged. ao-5 bumped the version to 0.1.1. PR #339, merged. ao-6 fixed PATH ordering so the gh CLI wrapper would resolve correctly. PR #343, merged.

four sessions, four PRs, four merges. clean. textbook self-improvement loop. the system was building itself and each merge made the next session slightly smoother.

ao-7 was the first sign of trouble. it was working on the same issue as ao-6 but took a different approach. two agents, same bug, two PRs. i killed ao-7 and merged ao-6's PR. not a disaster, but a coordination failure. the orchestrator should have detected the duplicate. it didn't, because duplicate detection wasn't built yet.

so i made a mental note: build duplicate detection. that note became a task. that task would eventually become another agent session. the system was already surfacing its own gaps.

the crash

then came ao-9. this is where the night got interesting.

ao-9 was supposed to fix WebSocket URL routing for the terminal component. a 15-line change. simple enough that i didn't even bother spawning an agent for it. i just made the edit myself, committed, pushed, and opened PR #346.

this was a mistake. not because the code was wrong. the code was fine. the mistake was that ao-9 existed in AO's session list but had no tmux session behind it. every other session had a live codex process running in tmux. ao-9 had nothing. when you opened ao-9 on the dashboard, the terminal component tried to connect to a tmux pane that didn't exist. it flickered endlessly. reconnect, fail, reconnect, fail.

i tried to fix this by spawning a real agent into ao-9's slot. but the worktree was already checked out on a different branch. so i killed ao-9, created ao-8 to take over, realized that was worse because now i had two sessions for one PR, killed ao-8, recreated the worktree for ao-9, and tried to start codex manually.

codex crashed immediately.

one line. no stack trace. no explanation. just "permission denied."

i ran strace to figure out what file it was trying to read.

the auth.json file was owned by lifeos-secrets:lifeos-secrets with 600 permissions. the codex process was running as lifeos. it couldn't read its own authentication file.

how did this happen? earlier that day, i'd been hardening the gh CLI to prevent the AI from accessing unauthorized GitHub repos. part of that work involved moving credentials to a separate system user called lifeos-secrets. the auth.json file got caught in that sweep. a security improvement in one part of the system had silently broken a completely different part.

https://github.com/openclaw/openclaw

the fix was simple once i found it. delete the file (the directory was owned by lifeos, so unlinking worked even though the file wasn't), create a fresh empty one, and let codex fall back to the OPENAI_API_KEY environment variable. but finding the cause took 20 minutes of strace and confusion.

this is the kind of failure that doesn't show up in theory papers about self-improving systems. a security improvement in one subsystem silently breaks an authentication path in another. no test caught it because the tests don't run as a different user. the blast radius was invisible until someone tried to start a new session.

the mass death

while i was debugging the auth crash, i had a bigger problem. sessions ao-10 through ao-14 were all dead.

these five sessions had been spawned using the wrong method. OpenClaw used its exec tool (a background shell process) instead of ao spawn. i didn't catch the mistake until they were all dead. the difference matters. ao spawn creates a detached tmux session that lives independently. exec creates a child process of OpenClaw's shell session. when that shell session times out after 600 seconds, the child process gets SIGTERM'd. the codex process dies.

five sessions, five tasks, all gone. no work saved. no partial progress. the worktrees existed but had zero commits beyond the base branch. this was an operator error. i should have told OpenClaw to use ao spawn from the start. i didn't, and i lost hours of agent work.

i told OpenClaw to respawn them through ao spawn this time, but AO reuses session IDs sequentially. so when i spawned replacements, they got IDs ao-10 through ao-14, but with different tasks than the originals. ao-11 was originally "fix mobile terminal scrolling." the respawned ao-11 got "CI auto-injection with retry escalation." total confusion about which session was doing what.

this is a session identity problem. the sessions are identified by sequential numbers, not by their task or purpose. when ao-11 dies and gets respawned, it should still be "the mobile terminal scroll session." instead, it became a completely different session that happened to have the same number.

the recursion gets deeper

here's where it gets properly weird.

one of the respawned sessions, ao-12, got a task that i've been thinking about for a while: design the integration between OpenClaw and AO. the system that manages my life (OpenClaw) using the system that manages coding agents (AO) to build the bridge between them.

let me say that again because it's important. i'm talking to an AI assistant on Telegram. the assistant is using an agent orchestrator to spawn coding agents. one of those agents is designing how the assistant should integrate with the orchestrator. the agent is writing a design document for the system that will eventually replace the manual process by which it was created.

three levels of recursion:

• human talks to OpenClaw

• OpenClaw uses AO to spawn agents

• agent designs the OpenClaw-AO integration

and here's what made it interesting. i'd been hitting failures all night, getting frustrated, fixing things manually. at some point i told OpenClaw: "give ao-12 all the context about what went wrong tonight so it can design around these problems." OpenClaw packaged up every failure i'd hit, sessions dying silently, messages not submitting, IDs getting reused, no health monitoring, no auto-respawn, and injected it into the agent as design requirements.

the agent didn't discover these requirements. i did, by operating the system badly and noticing what broke. then i fed those observations into an agent that could turn them into a design. the insight was human. the execution was automated.

the meta-structure: i talk to OpenClaw, which uses AO to spawn agents, one of which is designing how OpenClaw should integrate with AO. tonight's failures become the requirements for that design.

this is the self-improvement loop, but it's not the clean version i described in the first blog. it's messy. the improvements come from crashes and confusion, not from elegant meta-analysis sessions. the system learns from breaking.

three tiers of "fix it yourself"

the failures from that night crystalized into an architecture. i call it the three-tier escalation protocol.

tier 1: agent self-healing. when CI fails on a PR, the failure output gets automatically injected back into the agent session. the agent reads the error, fixes the code, pushes again. up to 5 times before giving up. no human involved. session ao-11 built this and filed PR #354. this is the only tier that's actually implemented right now.

tier 2: orchestrator mediation. if the agent can't fix it after 5 tries, escalate to the orchestrator session. the orchestrator is itself a codex instance with context about all active sessions. it can look at the failing agent's code, understand the broader picture, and either suggest a fix or rethink the approach. this tier is designed but not built yet.

tier 3: human escalation via OpenClaw. if the orchestrator can't handle it, send a message to my Telegram. something like: "ao-14 failed CI 5 times on the activity state fix. error is a type mismatch in the codex plugin." i reply in chat and the response gets routed back to the agent. this is what ao-12 is designing right now. also not built yet.

the escalation architecture. same message format at every boundary. OpenClaw replaces the standalone orchestrator entirely. three layers remain: OpenClaw, the connector plugin, and the individual coding agents.

the key design decision: the protocol is uniform. the message format is identical whether it goes from agent to OpenClaw or from OpenClaw to me. OpenClaw replaces the standalone orchestrator entirely. three layers remain: OpenClaw at the top (with the human right there in the conversation), the connector plugin that bridges to AO's infrastructure, and the individual coding agents. OpenClaw isn't a notification sidebar. it's a peer in the escalation protocol, capable of both autonomous resolution and human handoff.

the scoreboard

by 6 AM, the overnight session had produced:

• 6 merged PRs (#337, #338, #339, #343, #346, and one from before)

• 2 open PRs (#353 for dashboard enrichment, #354 for CI auto-injection)

• 4 sessions actively working (OpenClaw integration design, terminal fixes, activity state fix, navbar fix)

• 6 sessions that died and were respawned

• 1 authentication crash that blocked all new sessions for 20 minutes

• 1 duplicate work incident (ao-6 and ao-7 on the same bug)

• 0 regressions introduced to the main branch

the system that ran at 6 AM was meaningfully better than the one at 6 PM. not because of any single change, but because of all of them together. the codex plugin handled permissions correctly. PATH resolution worked. the version was bumped. the terminal WebSocket connected through the reverse proxy. the dashboard showed live PR data.

and three sessions were still running. whether they'd produce something useful or crash silently, i wouldn't know until i checked in the morning.

what self-improvement actually looks like

the first blog walked through the loop in detail. the 8 steps, the file-locking example, session ao-52's self-analysis. real code, real sessions, real improvements. all of that was true and still is.

but running the loop at scale, overnight, with 15 sessions in parallel? that's a different animal.

sessions die because i told OpenClaw to use the wrong spawn method. a security change i made breaks authentication for a different tool. messages get pasted into codex's input buffer but the Enter key never fires, and i have to notice the agent is stuck and manually press Enter on the server. session IDs get reused and i lose track of which agent is doing what.

the self-improvement still happens. but it's not automatic. i notice the failure. i understand what went wrong. i tell OpenClaw to feed that failure back as a requirement. the auth crash? i told ao-12 to include "crash forensics" in the design. the exec timeout? i told it to add "session health monitoring." the ID reuse? "session identity tied to task, not sequential numbers."

the system improves by being bad in informative ways. but the "informative" part requires a human paying attention at 2 AM.

what changes at scale

in the first blog, i described three phases: agents as tools, agents as workers, agents as self-improving systems. i walked through concrete examples of each. i said Phase 3 was "qualitatively different."

i was right, but the qualitative difference isn't what i expected. it's not that the system gets better faster. it's that the system generates its own improvement backlog.

when you use agents as workers (Phase 2), you tell them what to build. you maintain the backlog. you prioritize. you decide what matters. the agents are skilled labor, but the direction is entirely human.

in Phase 3, the system produces failures that reveal requirements that generate tasks that agents implement. i didn't plan to build session health monitoring. five sessions died silently at 2 AM and the need became obvious. but let me be honest: the requirement didn't "write itself." i noticed the problem, understood it, and turned it into a task. the system surfaced the failure. i did the interpretation. the agents did the implementation.

maybe that's still Phase 2.5. the fully autonomous version, where the system detects its own failures and spawns agents to fix them without a human noticing at 2 AM, is what the escalation protocol is designed to enable. i'm not there yet. but the infrastructure is being built by the same agents that need it, which is at least poetic.

the part that scares me

i'll be honest about something. at 3 AM, when i was watching ao-12 write a design document for the system that would eventually supervise all the other agents, including future versions of itself, i had a moment where i thought: i'm not sure i fully understand what i'm building.

not in a Terminator way. in an engineering complexity way. the system has three layers of AI (OpenClaw, AO orchestrator, individual agents), each with different models and contexts and failure modes. the interactions between these layers produce emergent behaviors i didn't predict. the auth crash was an emergent behavior. the exec timeout was an emergent behavior. the message delivery failure was an emergent behavior.

as these layers get more tightly integrated, the space of possible emergent behaviors grows combinatorially. i can test individual components. i can test pairwise interactions. but testing the full system requires running the full system, and the full system is the production environment.

this is why i'm building the escalation protocol. not because i think the system will go rogue. because i think the system will fail in ways i can't predict, and i need a reliable path from "something broke" to "a human knows about it" that doesn't itself break in novel ways.

the safety mechanism for a self-improving system isn't preventing change. it's ensuring visibility. if i can see every modification the system makes to itself, i can catch problems before they compound. if i lose visibility, i lose control. and in a system this complex, losing visibility is easier than it sounds.

this post is part of the loop

i should mention how this blog post was written. i told OpenClaw on Telegram: "write a blog about how i built the OpenClaw-AO integration by asking OpenClaw to build it using Orchestrator." it read the first blog for style reference, wrote a draft, saved it to the server, and sent me a link. i read it. it was wrong in places. it overstated how autonomous the system was. i told it to fix that. it fixed it. i told it the diagrams needed to be better. it redid them. i told it to include the star history image. it added it, broke the YAML config in the process, fixed that too, and sent me a new link.

this paragraph you're reading right now was written after i told OpenClaw: "the article makes it look like the system was a lot more autonomous than it actually was. be realistic." the AI wrote a more honest version. i'm reviewing it on the same server that hosts the AO dashboard that monitors the agents that are building the features i'm writing about.

it's recursive, yes. but at every level, a human is reading, judging, and redirecting. the automation handles the typing. the human handles the thinking.

the loop continues

it's Sunday morning now. the sessions are still running. ao-12 is writing the OpenClaw integration design. ao-13 is fixing the mobile terminal. ao-14 is patching the activity state bug. ao-15 is fixing the navbar links.

by the time i finish writing this post, some of those PRs will be merged. the system will be better. new bugs will have appeared. new sessions will be spawned to fix them.

the loop doesn't stop. it doesn't have a clean endpoint. there's no version 2.0 release where everything works perfectly. there's just continuous, incremental, chaotic improvement. the coding is automated. the direction is still me, on Telegram, at 3 AM, telling an AI assistant what to fix next.

i wrote in the first blog that the companies who figure out self-improving agentic systems first will have an absurd advantage. i walked through why: compound interest applied to engineering capability. i still believe every word.

but i'd add something i didn't appreciate before: the advantage isn't in having a clean self-improvement loop. it's in having a messy one that you can observe, debug, and steer.

the system that keeps building itself doesn't need to be perfect. it needs to be transparent.

Agent Orchestrator is open source at github.com/ComposioHQ/agent-orchestrator. the dashboard, session management, and escalation protocol are all in the repo. i work on AI agents at Composio. if you're building orchestration systems or thinking about self-improvement loops, find me on Twitter or GitHub.

Link: http://x.com/i/article/2031050661866221568

📋 讨论归档

讨论进行中…