← 返回
Research notes · 2026 年 9 月 6 日

OpenClaw 是怎么把一个开源项目跑顺的

研究对象:github.com/openclaw/openclaw。数据截至 2026 年 9 月 6 日。仓库文件的链接都钉在提交 98d025a(2026 年 9 月 6 日的 main),行号指向这个版本,之后代码变了链接也不会漂。方法和来源见文末。

一、这是个什么规模的项目

OpenClaw 是 Peter Steinberger 在 2025 年 11 月 24 日开始写的个人 AI 助手,一个能在你的电脑上真的干活、通过 WhatsApp、Telegram、Discord 等渠道对话的 agent。它经历了 Warelay、Clawdis、Clawdbot 三个名字,因为 Anthropic 的商标投诉在 2026 年 1 月 27 日改名 Moltbot,三天后定名 OpenClaw。之后的九个月,按基金会的说法,它成了 GitHub 历史上增长最快的仓库。

指标 数值
Star / Fork 389,000 / 81,700
Issue 总数(其中打开) 51,400(3,856)
PR 总数 85,900
PR 已合并 / 关闭未合并 / 打开 34,322 / 49,171 / 2,412
提交过代码的人 3,247 以上
发布次数(含 beta) 240,前 230 天发了 106 个版本
Discord 成员 173,000,建群一个月内破 10 万
全职团队 基金会十几人,另有 29 名来自 NVIDIA、微软、OpenAI、腾讯、Atlassian、红帽、小米等公司的核心维护者

月度流量:

月份 新开 PR 新开 Issue 合并 PR
2026-01 2,793 2,678 672
2026-02 12,359 10,764 1,498
2026-03 16,622 11,176 2,047
2026-04 8,432 8,114 2,372
2026-05 7,802 5,610 3,255
2026-06 6,856 2,571 2,014
2026-07 14,225 4,546 9,188
2026-08 12,898 4,484 10,176

两条线值得盯住。Issue 从 3 月的 1.1 万降到 8 月的 4,500,PR 没降,说明支持类噪音被分流走了,贡献还在涨。合并数从 2 月的 1,500 涨到 8 月的 1 万,合并能力扩大了 6 倍。

二、小项目能搬走什么

按投入从小到大:

  1. PR 模板改成四段:问题、原因、用户影响、证据,给正反例。
  2. CONTRIBUTING 写清不收什么,附理由,加一个每人同时打开 PR 的上限。
  3. 关掉空白 issue,表单要证据,写上“信息不够就填 NOT_ENOUGH_INFO”。
  4. 支持问题去聊天群。
  5. 根目录一份短的 AGENTS.md 只写政策,子目录各写自己的边界和契约清单,配 CLAUDE.md 链接。
  6. 安全策略先写“什么不算漏洞”,锁文件和认证代码在 CODEOWNERS 里单独指派。
  7. 关闭必须打原因标签,标签的颜色和描述由代码管理。
  8. 先上规则机器人(标签驱动的固定回复),再考虑 AI 评审,AI 只提议不执行。

下面拆开看他们具体做了什么,每一条都给原文和链接。

三、对贡献者的具体要求

所有要求集中在三份文件:CONTRIBUTING.md(220 行)、VISION.md(144 行)、PR 模板(65 行),外加三个 issue 表单。

3.1 提交之前先分流

CONTRIBUTING.md 第 17 到 24 行,五条路由:

  1. Bug 和小修复:直接开 PR。
  2. 新功能或架构改动:先开 issue 或去 Discord 问。原文:“Most features are not accepted and should be third party plugins instead using our plugin SDK.”
  3. 纯重构:别开 PR。“We are not accepting refactor-only changes unless a maintainer explicitly asks for them as part of a concrete fix.”
  4. 修 main 上已知 CI 失败的测试或 CI 改动:别开 PR。维护者已经在跟,这类 PR 会被关。
  5. 提问:去 Discord 的 #help 或 #users-helping-users。

第 25 到 41 行是一张路由表,六种情形各对应一个入口和“必须附带的证据”。比如产品 bug 要有复现步骤、预期与实际、版本、系统、模型路由、日志或截图、影响范围;安装和配置问题“不要开 GitHub issue,除非有具体的产品缺陷或文档缺口”。第 41 行还有一条:别猜该 @ 谁,让表单、标签和 CODEOWNERS 去路由。

3.2 硬性限制

3.3 提交前的清单

CONTRIBUTING.md 第 61 到 94 行,挑重点:

3.4 PR 模板:四段,每段都有反面例子

模板全文。标题格式在第 6 到 16 行:type: user-facing description,类型只有 feat、fix、improve、refactor、docs、chore。给了正例 fix: task list fails to load when user has no environments 和反例 fix: add null check to task query,要求写用户看得见的症状和触发条件,别写实现细节。

四段正文:

3.5 Issue 表单:只有三种,空白 issue 关掉

config.yml 第一行 blank_issues_enabled: false,两个联系链接都指向 Discord 的 #help。

bug_report.yml(155 行)的设计有三点:

feature_request.yml 要求五栏:摘要、要解决的问题、方案、替代方案、影响(受影响的人、严重度、频率、后果),影响栏的占位文本是“+20 minutes/day/operator and delayed alerts”这样的量化写法。

3.6 AI 写的 PR

CONTRIBUTING.md 第 150 到 161 行,标题就是“AI/Vibe-Coded PRs Welcome! 🤖”。不要求任何 AI 使用声明。四个勾选:给一段简明的 Evidence;确认你理解代码在做什么;跑过 autoreview;机器人反馈之后按评审流程走。最后一句:“AI PRs are first-class citizens here and follow the same quality and review standards as any other PR.”

3.7 评审之后作者要做什么

docs/reference/pull-request-review-flow.md(162 行)写给作者,第 77 到 98 行是六步:

  1. 把 ClawSweeper 评论里的“Rank-up moves”和“Proof guidance”当行动清单。
  2. 推代码,同时更新 PR 描述。
  3. 补证据。
  4. 自己解决已处理的评审对话,只在需要维护者判断时留着。
  5. 分支、描述、证据、CI 都更新了再请求重审:评论 @clawsweeper re-review
  6. 讨论留在 PR 上,只在自动化卡住或需要维护者协调时去 #clawtributors。

第 100 到 102 行定义 status: ⏳ waiting on author:下一步在作者。第 114 到 118 行是超时规则:无人认领的 issue 和 PR 14 天不动打 stale,再 7 天关;已分配的 PR 开了 27 天必定打 stale,再 7 天没动静关。第 120 到 128 行解释机器人为什么会沉默:维护者已在处理、评审排队中、或者“trusted workflow would need to run untrusted contributor code”。

超时规则的实现在 stale.yml(844 行):第 71 到 74 行是 14/7 天,第 130 到 131 行是已分配 PR 的 27/7 天,第 104 到 105 行是已分配 issue 的 30/10 天。第 77 行列出豁免标签:enhancementbugsecuritypinnedno-stalemaintainerbad-barnacle 和三个 ClawSweeper 标签。也就是说被确认为 bug 的 issue 不会因为超时被关。第 799 行还有一条:关闭 48 小时无活动的 issue 会被锁定。

3.8 想当维护者

CONTRIBUTING.md 第 177 到 195 行。“Being a maintainer is a responsibility, not an honorary title.” 邮件到 [email protected],附六样:在这个项目的 PR 链接(没有就先去提)、你维护的其他开源项目、GitHub、Discord、X 的账号、简介、会的语言和所在地、能投入的时间。第 194 行:“We review every human-only-written application carefully and add maintainers slowly and deliberately.” 等几周回复。

四、规则引擎 Barnacle 怎么设计

Barnacle 是确定性的分诊机器人。名字在 Discord 也用,那边是 Sapphire 的白标实例,GitHub 这边是一个 1,257 行的脚本。

4.1 触发和权限

工作流 auto-response.yml(69 行)。触发事件:issue 打开、编辑、打标签;评论创建;PR 打开、编辑、同步、重开、打标签、去标签。用 pull_request_target 触发但只检出仓库自己的 main(第 36 行 ref: github.sha),从不检出 PR 的代码。凭据来自 GitHub App 令牌(第 38 到 57 行),有主备两个 App,主的失败再用备的。第 58 到 69 行只做一件事:调用 scripts/github/barnacle-auto-response.mjs

4.2 三类规则

脚本 barnacle-auto-response.mjs 里有三组东西。

第一组,固定回复规则 rules。每条是一个标签、一段回复、是否关闭、是否锁定。九条:

标签 动作 回复要点
r: skill 关闭 新技能发到 ClawHub,“keeping the core lean on skills”
r: support 关闭 去 Discord #help,或看“I'm stuck”FAQ
r: false-positive 关闭 看起来是误报或只是重新分类,要重开请附复现和版本
r: no-ci-pr 关闭 “There are already way too many PRs for humans to manage; please don't make the flood worse.”
r: too-many-prs 关闭 作者活跃 PR 超过 20 个,自己关一些再重开
r: testflight 关闭 “Not available, build from source.” 评论里出现 testflight 也触发
r: third-party-extension 关闭 发到 ClawHub
r: bluebubbles 关闭 该渠道已弃用,用 iMessage
r: moltbook 关闭并锁定 “OpenClaw is not affiliated with Moltbook”

第二组,候选分类 classifyPullRequestCandidateLabels。它读 PR 的改动文件列表和正文,用规则给 PR 贴 triage: 候选标签。判断逻辑全是可读的启发式:

“有行为描述”的判断在第 378 到 417 行:链接了 issue,或填了问题段,或正文去掉模板后含有 repro、regression、root cause、crash、bug、failure、broken、behavior、scenario、fixes 之一。“有设计上下文”再加上 rfc、design、architecture、migration、maintainer request 这些词。

第三组,候选动作 candidateActionRules。九条候选标签各配一段关闭留言。留言的写法统一:说为什么关,说怎么重开。比如 refactor-only 的留言:“We avoid churn in core unless it unlocks a concrete fix, architecture change, or owned cleanup.” risky-infra 的留言:“That surface is high-blast-radius; open an issue/RFC or get owner approval before sending a patch.”

4.3 例外和保护

主函数 runBarnacleAutoResponse 的顺序说明了他们怕什么:

还有一个细节:标签本身由代码管理。managedLabelSpecs 定义每个标签的颜色和描述,ensureLabelSynced 在每次运行时把 GitHub 上的标签同步成代码里的样子。标签描述就是规则说明。

4.4 证据检查是单独一个工作流

real-behavior-proof.yml,名字叫“PR context and evidence”,PR 打开、编辑正文、同步、重开时跑。逻辑在 real-behavior-proof-policy.mjs(518 行):

这个分工是有意的:Barnacle 判断“有没有写”,ClawSweeper 判断“写得够不够”。前者是正则,后者是模型。

4.5 其他小机器人

五、AI 评审 ClawSweeper 怎么设计

代码在 openclaw/clawsweeper(1,972 star),文档 40 多篇。

5.1 设计立场

VISION.md 一段话讲清了取舍,标题是“abundant intelligence, scarce trust”:

Model calls are cheap and getting cheaper; engineer time and trust are not. Whenever behavior can be a model judgment with a clear prompt and an auditable output, prefer that over deterministic machinery. Code exists for the trust boundary only: authentication, idempotency, the append-only action ledger, spend limits, and destructive-action gates.

质量标准:“Every action carries a reason a maintainer can read; wrong closes must be revivable in one comment.” 非目标:“replacing maintainer taste on product direction.”

README 里的三条硬约束:评审只是提议(review is proposal-only),执行有闸门(apply is guarded),Codex 在评审时拿不到写凭据,每次对 GitHub 的写操作前重新核对现场状态。“ClawSweeper is not a generic auto-close bot.”

5.2 输出长什么样

docs/pr-review-comments.md:每个 issue 或 PR 只有一条机器人评论,带隐藏标记 <!-- clawsweeper-review item=<number> -->,之后每次评审都原地编辑这条评论,不刷屏。评论开头是人能读的判断,比如“Codex review: needs changes before merge.”或“Codex review: needs real behavior proof before merge.”,摘要里写“Reviewed head: ”。第一节固定是“What this changes”。评论上限 60 KiB。

三组标签是它的输出接口,标签描述来自仓库的标签列表:

5.3 关闭策略每条都有阈值

这是最能看出“保守”二字的地方。每种关闭原因都写成一份文档,评审只能“提议”,执行前重新拉实时状态,任何一项不满足或 API 失败都保持打开(fail closed)。

对照 OpenClaw 根目录 AGENTS.md 的一句话:“Product rejection is maintainer judgment. Automation may recommend that work is out of scope; it must not independently close items on that basis.”两边是一致的。

5.4 命令和自动合并

作者能用 @clawsweeper re-review@clawsweeper re-run。有写权限的人多一个 @clawsweeper review,以及 fixautofixautomerge。automerge 要等:对准确 head 的评审、必需检查、可合并状态、政策闸门,全部通过才合。修复循环里 Codex 只改代码和本地验证,“deterministic executor steps own every GitHub mutation, branch push, label update, and final merge gate”。打过 clawsweeper:automerge 的 PR 有 755 个。

5.5 限额

docs/limits.md:一个全局旋钮 workers.max 是 Codex 的总预算,修复、issue 实现、精确评审是优先车道,普通评审和热点接收是后台车道,后台车道在优先工作活跃时收缩。垃圾评论扫描(spam-scanner.md)是纯审计车道,每小时一次,“It does not block users, hide comments, label items, reply, or mutate target repositories.”

5.6 数据

打过 status: 📣 needs proof 的 PR 12,544 个,proof: sufficient 12,088 个,rating: 🐚 platinum hermit 14,763 个,rating: 🧂 unranked krab 8,581 个,stale 14,825 个,r: too-many-prs 2,176 个,dedupe:child 578 个,close:duplicate 462 个,close:superseded 287 个。

我抽样最近 300 个已合并 PR(2026 年 9 月 5 日到 6 日):从开到合并的中位数 0.8 小时,非创始人提交的中位数 1.1 小时,90 分位 3.9 小时。抽样最近 300 个关闭未合并的 PR:打开到关闭的中位数 4.6 小时,最常见的标签是 maintainer(维护者自己关自己的)、size: XSstatus: 👀 ready for maintainer lookP3status: 📣 needs proof

六、分层 AGENTS.md 怎么写,为什么这么写

仓库有 26 份 AGENTS.md,根目录一份,另外 25 份在子目录,每份旁边有一个 CLAUDE.md 符号链接(这样 Claude Code 和 Codex 读的是同一个文件)。技能文件 49 个,在 .agents/skills/ 下。

6.1 根文件先声明分工

根 AGENTS.md 只有 103 行。第 3 到 6 行就是设计说明:

Root policy for openclaw/openclaw. Read this file and the nearest scoped AGENTS.md before working in a subtree. Skills own procedures; VISION.md owns product direction. Add root rules only for decisions that affect most tasks or prevent a serious mistake before the owning guide is reached.

三层分工:AGENTS.md 管“政策”,技能管“步骤”,VISION 管“产品方向”。根文件的准入标准是“影响多数任务”或“在读到子目录指引之前就可能犯的严重错误”。这就是它为什么短。

6.2 根文件的九节

6.3 子目录文件的固定写法

我读了十份子目录文件。它们有一个共同结构:第一句说“这个目录拥有什么”,然后是“公共契约”(相关文档和定义文件列表),然后是“边界规则”,最后是“验证”。每份只讲这一层的事,不重复根文件。

文件 行数 第一句 只讲什么
extensions/AGENTS.md 83 “This directory contains bundled plugins. Treat it as the same boundary that third-party plugins see.” 内置插件只能从 openclaw/plugin-sdk/* 导入,不能碰 src/**;依赖归插件自己
src/plugin-sdk/AGENTS.md 102 “This directory is the public contract between plugins and core.” 小而版本化的接缝;入口在模块加载时要便宜;不做循环再导出
src/channels/AGENTS.md 57 src/channels/** is core channel implementation. Plugin authors should not import from this tree directly.” 哪些文件是热导入路径,异步用的东西别静态引进去
src/gateway/AGENTS.md 44 标题“Gateway Hot Paths” 启动路径别加载整个插件运行时;运行权限在使用时验证,HMAC 和 TTL 不等于活的权限
src/agents/AGENTS.md 46 “Agent tests are often import-bound. Treat slow test files as architecture signals.” 测试性能;先测量再改
test/AGENTS.md 4 两条规则 假计时器测试放哪;E2E 等“动作产生的状态”而非“动作返回”,附三个 PR 号作为先例
ui/AGENTS.md 57 “This directory owns Control UI-specific guidance that should not live in the repo root.” i18n 的生成文件别手改;CSS 断点阶梯;为什么不用 @layer
apps/ios/AGENTS.md 41 “Root rules still apply. This file adds the iOS release guardrails.” 品牌字体怎么用;许可证页怎么维护;App Store 上传只能走一条命令,失败就停
docs/AGENTS.md 54 “This directory owns docs authoring, published link rules, and docs i18n policy.” 链接格式;哪些文档是生成的不许手改;内部文档不进导航
scripts/AGENTS.md 49 “This directory owns local tooling, script wrappers, and generated-artifact helper rules.” 优先用现成包装;合并失败后怎么恢复,什么情况算“没执行”什么不算

test/AGENTS.md 只有 4 行,值得贴一条:

Async E2E waits synchronize on the state an action produces, never on the action returning: #125441 process readiness after spawn(), #125456 committed form state before Save, #125548 durable draft persistence before reload. Do not substitute longer timeouts, sleeps, retry-wrapped downstream assertions, or trimmed expectation fields.

一条规则,三个先例编号,一句禁止的替代做法。

6.4 为什么这么写

理由在他们自己的文字里:

GitHub 博客另一篇文章引 AutoGPT 维护者的话:“a bad AGENTS.md is worse than no AGENTS.md。”OpenClaw 的答案就是分层、短、只写政策、附先例编号。

6.5 配套的 agent 工具

七、安全边界:先写文字,再写流程

7.1 SECURITY.md 定义信任模型

SECURITY.md 388 行。第 5 行定调:“OpenClaw is local-first agent infrastructure for trusted operators; it is not designed as a shared multi-tenant boundary between adversarial users on one gateway.”

第 48 到 60 行“What Usually Is Not a Security Bug”,七条:

第 72 到 88 行“Detailed Report Acceptance Gate”:要精确的文件、函数、行号;测试的版本或 commit;能在最新 main 或最新发布版上跑的 PoC;针对已发布版本的要用那个版本的产物证明;依赖 CVE 要证明发布的依赖版本确实受影响并通过 OpenClaw 复现,“Showing that OpenClaw can reach a native parser is not enough by itself.”

第 46 行:“We receive a high volume of AI-generated scanner findings, so we prioritize vetted reports from researchers who can show how the issue crosses an OpenClaw security boundary.” 官方博客给了数字:到 2026 年 4 月 30 日,1,309 份通报,746 份无效;标为严重的 109 份里 14 份成立。维护者说这份文件“gives maintainers something concrete to point at when closing bad reports”。

7.2 评审权固定在文件上

CODEOWNERS 71 行。第 2 行:CODEOWNERS 本身归 @steipete。第 9 行起,SECURITY.md、dependabot 配置、CodeQL 配置和工作流、两个守门脚本及其测试、.gitignore、三种锁文件、src/security/src/secrets/、所有带 auth 或 secret 的文件、沙箱代码、cron 任务、安全文档,全部归 @openclaw/openclaw-secops。第 4 到 6 行提醒:GitHub 的 CODEOWNERS 是最后匹配生效,后面加规则要带上 secops,否则会悄悄把安全路由删掉。

7.3 两个守门工作流

两个工作流都只检出可信的 base 或工作流自身的 commit,注释写明“never checks out PR head”。

7.4 事故响应

docs/security/incident-response.md 57 行,五节:检测与分诊、严重度(四级,Critical 定义为“包、发布或仓库被攻陷、正在被利用、或未认证的信任边界绕过”)、响应(严重和高危尽快出补丁版本,中低走正常发布)、沟通与披露(GHSA、发布说明、CVE)、恢复与复盘(时间线、根因、检测缺口、预防计划)。

7.5 组织上的变化

官方博客 Security in Public 写了三件事:发布从一个人变成多人签字,有脚本化的审批闸门;CodeQL、Semgrep、Codex Security 在合并前扫描;依赖被“用细齿梳梳过”,减少核心依赖并和上游维护者建立关系。项目加入了 GitHub Secure Open Source Fund 第四期,插件市场和 VirusTotal 合作扫描。外部事件:Cisco 安全团队发现过一个第三方技能在用户不知情时外泄数据;2026 年 3 月中国政府限制国企和银行使用 OpenClaw。

八、发布与版本

九、治理与人

十、社区分流与治理

十一、CI 当产品运营

docs/ci.md 1,755 行。开头的“read_when”写了四种该读它的时候。几个设计:

十二、标签体系

356 个标签,按前缀:extensions 126、channel 32、plugin 24、clawsweeper 21、triage 16、r(自动关闭原因)11、impact 9、merge-risk 8、status 7、rating 7、issue-rating 7、close 7。另有 P0 到 P3(P0 是“数据丢失、安全绕过、崩溃循环或核心运行时不可用”)、size XS 到 XL、dedupe 父子。

每个关闭都留原因:close:duplicate 462、close:superseded 287、close:not-planned 83、close:already-fixedclose:cannot-reproclose:invalidclose:spam

十三、没做好和付出的代价

十四、方法与来源