CLI 参考手册

OpenClaw CLI 完整命令参考

版本:2026-03。覆盖安装初始化、配置管理、Gateway、Agent、频道、模型、浏览器控制等所有命令。

1. 安装与初始化

openclaw setup初始化配置和工作区,首次安装后必须执行
openclaw onboard交互式引导流程,依次配置 Gateway、工作区、Skills
openclaw configure交互式配置向导,涵盖模型、频道、技能、网关等设置
openclaw update更新 CLI 到最新版本
openclaw update --channel stable更新到 stable 频道(可选 beta、dev)
openclaw update --dry-run仅检查可用更新,不实际安装
openclaw uninstall卸载 Gateway 服务和相关数据
openclaw --version查看当前 CLI 版本号

2. 配置管理

openclaw config get <path>读取指定配置路径的值
openclaw config set <path> <value>设置指定配置路径的值
openclaw config unset <path>删除指定配置路径
openclaw config file显示当前配置文件的路径
openclaw config validate校验当前配置文件的有效性
openclaw completion生成 Shell 补全脚本(支持 bash/zsh/fish)
openclaw config set gateway.mode local
openclaw config set gateway.bind loopback
openclaw config set providers.anthropic.apiKey "sk-ant-xxxxx"
openclaw config set agents.defaults.memorySearch.enabled false

3. 系统与健康检查

openclaw doctor最有用的单条命令 — 全面健康检查并提供快速修复建议
openclaw health获取运行中 Gateway 的健康状态
openclaw status显示会话健康状态和最近接收者
openclaw system event --text <text>向系统事件队列入队一条事件
openclaw system heartbeat last查看上次心跳时间
openclaw system heartbeat enable启用心跳
openclaw system heartbeat disable禁用心跳
openclaw system presence列出系统在线状态

4. Gateway 管理

openclaw gateway前台运行 Gateway(常搭配 screen 或 tmux 使用)
openclaw gateway start后台启动 Gateway 服务
openclaw gateway stop停止 Gateway 服务
openclaw gateway restart重启 Gateway 服务(配置变更后最常用)
openclaw gateway status探测 Gateway RPC 状态
openclaw gateway install将 Gateway 安装为系统服务(systemd 等)
openclaw gateway uninstall卸载系统服务
openclaw gateway call <method>调用指定 RPC 方法
openclaw gateway probe探测 Gateway(调试连接问题时使用)
openclaw gateway discover发现局域网中的 Gateway 实例

5. Agent 管理

openclaw agent --message <text>通过 Gateway 运行一次 agent 回合
openclaw agents list列出所有已配置的 agents
openclaw agents add [name]通过向导添加新 agent
openclaw agents delete <id>删除指定 agent
openclaw agents bindings列出所有路由绑定
openclaw agents bind添加路由绑定(将 agent 绑定到频道/群组)
openclaw agents unbind移除路由绑定

6. 频道管理

openclaw channels list显示所有已配置频道
openclaw channels status检查频道健康状态
openclaw channels status --probe带深度探测的频道状态检查
openclaw channels add向导式添加新频道
openclaw channels login交互式登录(如 WhatsApp 扫码)
openclaw channels login --channel <name>登录指定频道
openclaw channels logout登出频道
openclaw channels remove禁用并移除频道
openclaw channels logs显示频道相关日志
# Telegram
openclaw channels add --channel telegram --token "<Bot Token>"

# Discord
openclaw channels add --channel discord --token "<Bot Token>"

# WhatsApp(扫码登录)
openclaw channels login

7. 模型管理

openclaw models list列出所有可用模型
openclaw models status模型状态概览
openclaw models status --probe带探测的模型状态检查
openclaw models set <model>设置主模型
openclaw models set-image <model>设置图片生成模型
openclaw models scan扫描当前提供商可用的所有模型
openclaw models aliases list列出模型别名
openclaw models aliases add添加模型别名
openclaw models aliases remove移除模型别名
openclaw models fallbacks list列出回退模型列表
openclaw models fallbacks add添加回退模型
openclaw models fallbacks remove移除回退模型
openclaw models fallbacks clear清空回退模型列表
openclaw models auth add添加模型认证
openclaw models auth setup-token交互式设置 API token
openclaw models auth paste-token直接粘贴 API token
openclaw models auth order get查看认证提供商顺序
openclaw models auth order set设置认证提供商顺序

8. Skills 与 Plugins

openclaw skills list列出所有已加载技能
openclaw skills info <name>查看指定技能的详细信息
openclaw skills check就绪/缺失状态摘要
openclaw plugins list发现并列出所有插件
openclaw plugins info <id>查看插件详细信息
openclaw plugins install <path|.tgz|npm>安装插件(支持本地路径、tgz 或 npm 包名)
openclaw plugins enable <id>启用插件
openclaw plugins disable <id>禁用插件
openclaw plugins doctor插件加载错误诊断报告

9. 消息操作

openclaw message send发送消息
openclaw message edit编辑已发送的消息
openclaw message delete删除消息
openclaw message poll创建投票
openclaw message react给消息添加反应/表情
openclaw message search搜索消息
openclaw message read标记消息已读
openclaw message pin / unpin / pins置顶管理
openclaw message kick / ban / timeout成员管理操作
openclaw message thread create创建话题
openclaw message thread list列出话题
openclaw message thread reply回复话题
openclaw message emoji list / upload表情管理
openclaw message sticker send / upload贴纸管理
openclaw message role info / add / remove角色与权限管理
openclaw message channel info / list频道信息
openclaw message member info查看成员信息
openclaw message voice status语音频道状态
openclaw message event list / create事件管理

10. 记忆管理

openclaw memory status查看记忆索引统计信息
openclaw memory index重建记忆索引
openclaw memory search "<query>"对记忆进行语义搜索

11. 日志

openclaw logs查看日志
openclaw logs --follow实时跟踪日志输出(类似 tail -f)
openclaw logs --limit <n>限制输出行数
openclaw logs --jsonJSON 格式输出
openclaw logs --plain纯文本输出(无颜色)

12. 定时任务

openclaw cron status查看定时任务系统状态
openclaw cron list列出所有定时任务
openclaw cron add创建新定时任务
openclaw cron edit <id>编辑指定任务
openclaw cron rm <id>删除指定任务
openclaw cron enable <id>启用任务
openclaw cron disable <id>禁用任务
openclaw cron runs --id <id>查看任务运行历史
openclaw cron run <id>立即执行任务(不等待调度时间)

13. 浏览器控制

openclaw browser start / stop / status浏览器实例生命周期
openclaw browser tabs列出所有标签页
openclaw browser open <url>打开新标签页
openclaw browser focus / close标签页聚焦/关闭
openclaw browser screenshot截取页面截图
openclaw browser snapshot获取页面快照(DOM)
openclaw browser pdf导出页面为 PDF
openclaw browser navigate <url>导航到指定 URL
openclaw browser resize调整浏览器窗口大小
openclaw browser click <ref>点击页面元素
openclaw browser type <ref> <text>在元素中输入文本
openclaw browser press <key>模拟按键
openclaw browser hover / drag / select页面交互操作
openclaw browser fill填充表单
openclaw browser upload上传文件
openclaw browser evaluate --fn <code>在页面上下文中执行 JavaScript
openclaw browser console查看控制台消息
openclaw browser profiles列出浏览器配置文件
openclaw browser create-profile / delete-profile / reset-profile配置文件管理
openclaw browser dialog处理对话框(alert/confirm/prompt)
openclaw browser wait等待页面条件满足

14. 设备与节点

openclaw devices list列出所有已注册设备
openclaw devices approve / reject / remove设备审批管理
openclaw devices clear / rotate / revoke设备密钥管理
openclaw node run / status / install / uninstall本地节点管理
openclaw node stop / restart本地节点控制
openclaw nodes list / status / describe远程节点概览
openclaw nodes pending / approve / reject节点审批
openclaw nodes invoke / run / notify远程执行
openclaw nodes camera list / snap / clip摄像头操作
openclaw nodes canvas snapshot / present / hide画布管理
openclaw nodes canvas navigate / eval / a2ui画布交互
openclaw nodes screen record远程录屏
openclaw nodes location get获取节点地理位置

15. 安全与密钥

openclaw security audit审计当前配置安全性
openclaw security audit --deep深度探测审计
openclaw security audit --fix自动修复发现的安全问题
openclaw secrets reload重新加载密钥文件
openclaw secrets migrate迁移密钥到新格式
openclaw secrets apply --from <plan.json>应用密钥迁移计划
openclaw sandbox沙箱管理(隔离执行环境)

16. 其他命令

openclaw sessions列出所有活跃会话
openclaw backup create / verify配置备份管理
openclaw reset --scope config仅重置配置
openclaw reset --scope config+creds+sessions重置配置、凭据和会话
openclaw reset --scope full完全重置(恢复出厂设置)
openclaw pairing list / approve配对请求管理
openclaw approvals审批设置管理
openclaw webhooks gmail setup / runGmail Webhook 管理
openclaw acpACP 桥接(IDE 连接 Gateway)
openclaw tui启动终端 UI 界面
openclaw dashboard打开 Web 仪表板
openclaw docs [query...]搜索官方文档
openclaw dns setupDNS 发现设置
openclaw qr二维码操作
openclaw voicecall语音通话

17. 全局选项

--dev开发模式 — 隔离到 ~/.openclaw-dev,端口自动偏移
--profile <name>隔离到 ~/.openclaw-<name>(多实例运行)
--no-color禁用 ANSI 颜色输出
--update等同于 openclaw update

18. 常见 RPC 连接选项

--url <url>指定 Gateway URL
--token <token>认证 token
--password <password>认证密码
--timeout <ms>RPC 超时时间(毫秒)
--expect-final等待最终响应(而非流式)

19. 输出格式

--jsonJSON 格式输出(适合脚本处理)
--plain纯文本输出(无颜色、无格式)
--no-color禁用 ANSI 颜色(保留格式)

20. VPS 常用设置命令速查

首次安装后配置

openclaw setup
openclaw configure
openclaw config set gateway.mode local
openclaw config set gateway.bind loopback
openclaw config set providers.anthropic.apiKey "sk-ant-你的密钥"
openclaw config set agents.defaults.memorySearch.enabled false
openclaw doctor

添加频道

# Telegram
openclaw channels add --channel telegram --token "<Bot Token>"

# Discord
openclaw channels add --channel discord --token "<Bot Token>"

# WhatsApp(扫码)
openclaw channels login

启动与管理

# 使用 screen 保持后台运行
screen -S openclaw
openclaw gateway
# Ctrl+A, D 脱离 screen

# 或者使用 systemd 服务
openclaw gateway install
openclaw gateway start

日常检查

openclaw doctor                    # 全面健康检查
openclaw health                    # Gateway 状态
openclaw channels status --probe   # 频道连接状态
openclaw logs --follow             # 实时日志
openclaw models status --probe     # 模型可用性

故障排查

openclaw doctor                    # 第一步:总是先跑 doctor
openclaw logs --follow             # 查看实时日志
openclaw gateway probe             # 探测 Gateway 连通性
openclaw channels status --probe   # 频道探测
openclaw security audit --deep     # 安全审计
openclaw plugins doctor            # 插件诊断