Community编程与开发github.com

openclaw-performance

OpenClaw 性能工作:处理慢速或重负载流程(延迟、CPU、内存、SQL、RPC、渲染),编写或评审性能 PR,或添加缓存。先统计工作,删除浪费,最后才用缓存。

openclaw-performance 是什么?

OpenClaw Performance 是一个专注于 OpenClaw 系统性能优化的技能。核心原则是:性能提升主要来自删除不必要的“浪费”工作,而不是加速现有工作;缓存是最后的手段,因为它只是掩盖浪费。技能提供了一套系统化的方法论,包括:先测量(定义明确的接受规则和基准测试)、然后查找浪费(如急切导入、重复工作、冗余检查)、再按优先级顺序修复(删除、上移、携带、批处理、最后缓存),最后验证并提交。支持 CLI、Gateway、Chat、Control UI、Session 等多种流程的基准测试脚本,并强调所有测试必须可重复、有基线对比。最终证据必须呈现在 PR 中,每个用户可见指标必须持平或改善。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/.agents/skills/openclaw-performance

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

OpenClaw 性能

浪费 是请求不需要的工作。大的加速来自于删除浪费,而不是更快地做同样的工作。缓存是最后的手段:它隐藏浪费,直到其键、失效或命中率出问题,浪费重新出现。

1. 测量

在第一次运行之前,在 PR 中写下验收规则:流程、工作负载、指标、冷热、样本数,以及被视为胜利或回退的变化。

流程已提交的工作负载
CLI 启动pnpm test:startup:bench(:check 持有预算)
Gateway 启动/重启scripts/bench-gateway-startup.ts, scripts/bench-gateway-restart.ts, scripts/perf/post-restart-burst-measure.ts
聊天轮次,每轮帧数scripts/bench-channel-turn.mts, scripts/perf/transcript-broadcast-measure.ts
Control UI 冷加载scripts/bench-control-ui-cold-load.ts, pnpm ui:check-performance(:base 比较)
Control UI 历史记录分页scripts/bench-control-ui-history-depth.ts
会话列表,多智能体形态scripts/perf/team-shape-fixture.ts, src/gateway/session-list-viewers.perf.test.ts
并发,SQLite 状态scripts/bench-gateway-concurrency.ts, pnpm test:sqlite:perf
  • 先统计次数: 在墙钟时间之前,统计每个动作的操作次数(SQL 语句、RPC 和帧、文件读取、目录或注册表加载、派生、渲染)。次数在负载主机上保持稳定。应为零的次数就是 Bug。
  • 真实流程: 使用被测头部的独立 Gateway、真实传输、包含慢路径。模拟 Gateway、陈旧构建或开发服务器测量的结果是其他东西。
  • 样本: 基线和候选交替(ABAB),至少各 5 个,冷热分开;中位数和 p95 带散布,串行运行,记录主机负载。
  • 可重复运行: 只有已提交的脚本才算数;如果没有合适的脚本,扩展现有脚本。
  • 性能分析: 在热路径上,每个线程使用 node --cpu-prof,或浏览器性能跟踪。

当流程具有已提交的工作负载、基线表和书面规则时,测量完成。

2. 查找浪费

对每个统计的操作提出问题:这个请求需要它吗?查找:

  • 急切导入: 注册表查找加载插件运行时,或启动时加载可选运行时。
  • 重复工作: 对每个归档行进行同步读取,每帧解析日志模式,或每次查找派生子进程。
  • 冗余检查和备份: 在热句柄上重新检查 schema 或 admission,或重新扫描和备份刚刚检查或写入的状态。
  • 目录重建: 每次智能体、每次未命中或每次 TTL 过期时重建目录。
  • 不相关的等待: 在可选的提供者计划上阻塞 Usage 页面,或重试不相关的读取。
  • 不必要的拷贝: 每轮克隆有效负载,或每次值跨越边界时包装。
  • 随每个增量增长的工作: 每个 token 重新解析整个回复,每次更新时重新渲染,或为一次更改重新发送完整行。

当每个主导次数追溯到发出它的代码,并且对“是否需要”有明确的是或否时,查找浪费完成。

3. 按此顺序修复

  1. 删除 浪费。保留保护契约并证明契约仍然成立的检查。
  2. 在所有者处一次完成: 调用者消费所有者记录的事实。
  3. 在热路径中携带准备好的事实。
  4. 批处理 独立的工作,并证明批处理保持帧数、延迟尾部和冷启动稳定。
  5. 缓存,附上书面理由说明为什么步骤 1-4 不适用。遵循根“缓存身份”,根据所有者的写入失效,限制大小,并添加交替的工作计数测试。检查读取者是否相互驱逐,或预算导致重复未命中。

工作线程迁移或延迟会转移成本;同时计数主线程和总工作量。

当浪费从计数中消失,或 PR 说明在哪个步骤停止及原因时,修复完成。

4. 落地

  • 在相同规则下,对基线和候选重新运行步骤 1 的工作负载。
  • 每个面向用户的指标持平或改善: 延迟、p95/p99、帧数、冷启动、CPU、内存、计数。变差的指标需要所有者明确接受并在 PR 中说明。一个单元格中 20% 的变化就是停止信号,绝不是“在散布范围内”。
  • 没有可测量增益的更改应回退。
  • 证据存在于 PR 中,而不是新测试中: 前后计数就是证据。仅当这种浪费之前曾反复出现时,才扩展流程的现有工作计数测试;test-audit 拥有测试价值。
  • PR 证据:工作负载命令、验收规则、前后对比表(计数和时间、中位数和 p95、样本数)、已删除的浪费,以及任何朝错误方向变化的指标。

当表格满足步骤 1 中编写的规则时,落地完成。

相关

测试套件速度: openclaw-test-performance。测试堆增长: openclaw-test-heap-leaks。CI 容量: openclaw-ci-limits。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Verify Telegram draft and final delivery sequencing in QA Lab with QA Channel or Crabline Telegram.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Find an integration when asked to install, connect, or set up an app. Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

相关技能