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 --json | JSON 格式输出 |
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 / run | Gmail Webhook 管理 |
openclaw acp | ACP 桥接(IDE 连接 Gateway) |
openclaw tui | 启动终端 UI 界面 |
openclaw dashboard | 打开 Web 仪表板 |
openclaw docs [query...] | 搜索官方文档 |
openclaw dns setup | DNS 发现设置 |
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. 输出格式
--json | JSON 格式输出(适合脚本处理) |
--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 # 插件诊断