OpenClaw Agent 运行时工作流
OpenClaw 仓库中 agent runtime(src/agents/)的开发者工作流。
类型检查与代码风格检查¶
- 默认本地检查门槛:
pnpm check(类型检查、代码风格检查、策略守卫) - 构建门槛:当改动会影响构建产物、打包或懒加载/模块边界时,运行
pnpm build - 完整的推送前检查门槛:
pnpm build && pnpm check && pnpm check:test-types && pnpm test
运行 Agent Runtime 测试¶
运行 agent runtime 单元测试套件:
pnpm test \
"src/agents/agent-*.test.ts" \
"src/agents/embedded-agent-*.test.ts" \
"src/agents/agent-hooks/**/*.test.ts"
第一个 glob 还涵盖 agent-tools*、agent-settings 和 agent-tool-definition-adapter* 测试套件。
Live 测试已从单元测试配置中排除;请通过 live 包装器运行它们(该包装器会设置 OPENCLAW_LIVE_TEST=1,并且需要 provider 凭据):
手动测试¶
- 以开发模式运行 Gateway(通过
OPENCLAW_SKIP_CHANNELS=1跳过频道连接):pnpm gateway:dev - 通过 Gateway 触发一次 agent 轮次:
pnpm openclaw agent --message "Hello" --thinking low - 使用 TUI 进行交互式调试:
pnpm tui
如需观察工具调用行为,请提示执行 read 或 exec 操作,以便查看工具流式输出和 payload 处理。
完全重置¶
状态数据存放在 OpenClaw 状态目录中:默认为 ~/.openclaw,若设置了 $OPENCLAW_STATE_DIR 则使用该路径。以下路径均相对于该目录:
| 路径 | 存放内容 |
|---|---|
openclaw.json |
配置 |
state/openclaw.sqlite |
共享运行时状态数据库 |
agents/<agentId>/agent/openclaw-agent.sqlite |
每个 agent 的模型认证配置(API 密钥 + OAuth)及运行时状态 |
credentials/ |
认证配置存储之外的 provider/频道凭据 |
agents/<agentId>/sessions/ |
对话记录历史与旧版会话迁移来源 |
sessions/ |
旧版单 agent 会话存储(仅旧安装) |
workspace/ |
默认 agent 工作区(其他 agent 使用 workspace-<agentId>) |
删除这些路径即可完全重置。更细粒度的重置方式:
- 仅重置会话:不要删除
agents/<agentId>/agent/openclaw-agent.sqlite;会话记录与其他 per-agent 状态一起存放在该文件中。使用/new或/reset为单个聊天开启全新会话,并使用openclaw sessions cleanup进行会话维护。 - 保留认证:将
agents/<agentId>/agent/openclaw-agent.sqlite和credentials/留在原处。
运行时不再读取旧版 auth-profiles.json 文件;openclaw doctor --fix 会将它们导入 SQLite 存储。
相关文档¶
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 cl/openclaw