OpenClaw命令大全

OpenClaw命令大全

摘要:

OpenClaw 命令大全涵盖全局选项、各功能模块命令及使用示例等内容。关键要点包括:

  1. 全局选项:提供输出版本号、显示帮助信息、禁用颜色、设置日志级别等选项。

  2. 服务管理:可对 Gateway 服务进行启动、停止、重启等操作,还能查看状态、健康信息等。

  3. 会话管理:支持列出、查看、清理会话,以及在 Web UI 进行新建、重置会话等操作。

  4. 模型管理:能列出、查看、配置模型,在 Web UI 可查看和切换模型。

  5. 消息管理:可进行消息的发送、读取、编辑、删除等操作,还有互动、频道与成员管理功能。

  6. 定时任务:可对定时任务进行增删改查、启用禁用等操作,Web UI 也有相应快捷命令。

  7. 配置管理:能查看、修改配置,还有交互式配置向导和初始化操作。

全局选项

选项

说明

-V, --version

输出版本号

-h, --help

显示帮助信息

--no-color

禁用 ANSI 颜色

--log-level <level>

全局日志级别(silent/fatal/error/warn/info/debug/trace)

--container <name>

在指定 Docker/Podman 容器内运行 CLI

--dev

开发模式:隔离状态至 ~/.openclaw-dev,默认端口 19001

--profile <name>

使用命名配置文件(隔离状态和配置)

一、Gateway 服务管理

1.1 服务控制

命令

说明

openclaw gateway start

启动 Gateway 服务

openclaw gateway stop

停止 Gateway 服务

openclaw gateway restart

重启 Gateway 服务

openclaw gateway run

前台运行 Gateway(调试用)

openclaw gateway install

安装 Gateway 为系统服务

openclaw gateway uninstall

卸载 Gateway 系统服务

1.2 状态与探测

命令

说明

openclaw gateway status

显示服务状态 + 探测可达性

openclaw gateway health

获取 Gateway 健康信息

openclaw gateway probe

显示可达性 + 发现 + 健康 + 状态摘要

openclaw gateway discover

通过 Bonjour 发现本地和广域 Gateway

openclaw gateway call <method>

直接调用 Gateway RPC 方法

openclaw gateway usage-cost

从会话日志获取使用费用摘要

1.3 Gateway 启动选项

选项

说明

--port <port>

监听端口(默认 18789)

--force

强制启动(杀死占用端口的进程)

--token <token>

设置认证 Token

--tailscale <mode>

Tailscale 暴露模式(off/serve/funnel)

--ws-log <style>

WebSocket 日志样式(auto/full/compact)

--verbose

详细日志输出

二、会话管理

2.1 CLI 命令

命令

说明

openclaw sessions

列出所有会话

openclaw sessions --active <分钟>

查看最近 N 分钟活跃的会话

openclaw sessions --agent <id>

查看指定 Agent 的会话

openclaw sessions --all-agents

聚合所有 Agent 的会话

openclaw sessions --json

JSON 格式输出

openclaw sessions cleanup

执行会话存储维护清理

openclaw sessions cleanup --dry-run

预览清理(不实际执行)

openclaw sessions cleanup --enforce

强制执行清理

三、模型管理

3.1 模型查看

命令

说明

openclaw models list

列出已配置模型

openclaw models status

显示配置的模型状态

openclaw models status --json

JSON 格式输出模型状态

openclaw models status --plain

纯文本格式输出

openclaw models scan

扫描 OpenRouter 免费模型

3.2 模型配置

命令

说明

openclaw models set <model>

设置默认模型

openclaw models set-image <model>

设置图像模型

openclaw models aliases

管理模型别名

openclaw models auth

管理模型认证配置

openclaw models fallbacks

管理模型回退列表

openclaw models image-fallbacks

管理图像模型回退列表

四、通道管理(Channels)

命令

说明

openclaw channels list

列出已配置通道和认证配置

openclaw channels status

查看 Gateway 通道状态

openclaw channels status --deep

深度探测通道状态

openclaw channels status --probe

运行通道状态检查和探测

openclaw channels add --channel <name>

添加或更新通道账号

openclaw channels remove <channel>

禁用或删除通道账号

openclaw channels login --channel <name>

链接通道账号(如 WhatsApp)

openclaw channels logout --channel <name>

登出通道会话

openclaw channels logs

显示最近通道日志

openclaw channels capabilities

显示通道能力

openclaw channels resolve

解析通道/用户名称为 ID

五、消息管理(Message)

5.1 基础消息操作

命令

说明

openclaw message send --target <id> --message <text>

发送文本消息

openclaw message send --target <id> --media <file>

发送带媒体的消息

openclaw message send --channel <ch> --target <id>

指定通道发送

openclaw message broadcast

广播消息到多个目标

openclaw message read

读取最近消息

openclaw message edit

编辑已发送的消息

openclaw message delete

删除消息

openclaw message search

搜索 Discord 消息

5.2 互动操作

命令

说明

openclaw message react --emoji <emoji>

添加或移除表情反应

openclaw message reactions

列出消息上的反应

openclaw message pin

置顶消息

openclaw message pins

列出置顶消息

openclaw message unpin

取消置顶

openclaw message poll

发送投票

5.3 频道与成员管理

命令

说明

openclaw message thread

话题/线程操作

openclaw message channel

频道操作

openclaw message member

成员操作

openclaw message role

角色操作

openclaw message permissions

获取频道权限

openclaw message ban

封禁成员

openclaw message kick

踢出成员

openclaw message timeout

禁言成员

openclaw message sticker

贴纸操作

openclaw message emoji

表情操作

openclaw message event

事件操作

openclaw message voice

语音操作

六、定时任务(Cron)

6.1 CLI 命令

命令

说明

openclaw cron list

列出所有定时任务

openclaw cron add

添加定时任务

openclaw cron edit <jobId>

编辑定时任务

openclaw cron rm <jobId>

删除定时任务

openclaw cron enable <jobId>

启用定时任务

openclaw cron disable <jobId>

禁用定时任务

openclaw cron run <jobId>

立即执行指定任务

openclaw cron runs <jobId>

查看任务执行历史

openclaw cron status

显示调度器状态

6.2 Web UI 快捷命令

命令

说明

/cron list

查看所有定时任务

/cron run <jobId>

立即执行指定任务

/cron runs <jobId>

查看任务执行历史

/cron disable <jobId>

禁用定时任务

/cron enable <jobId>

启用定时任务

七、Agent 管理

命令

说明

openclaw agents list

列出已配置的 Agent

openclaw agents add

添加新的隔离 Agent

openclaw agents delete <id>

删除 Agent 并清理工作空间

openclaw agents set-identity

更新 Agent 身份(名称/主题/表情/头像)

openclaw agents bind

为 Agent 添加路由绑定

openclaw agents unbind

移除 Agent 路由绑定

openclaw agents bindings

列出路由绑定

八、设备与节点管理

8.1 设备管理(Devices)

命令

说明

openclaw devices list

列出待配对和已配对设备

openclaw devices approve <id>

批准待配对请求

openclaw devices reject <id>

拒绝待配对请求

openclaw devices remove <id>

移除已配对设备

openclaw devices clear

清除所有配对设备

openclaw devices rotate <role>

轮换设备 Token

openclaw devices revoke <role>

撤销设备 Token

8.2 节点管理(Nodes)

命令

说明

openclaw nodes status

列出节点连接状态和能力

openclaw nodes list

列出待配对和已配对节点

openclaw nodes pending

列出待批准的配对请求

openclaw nodes approve <id>

批准配对请求

openclaw nodes reject <id>

拒绝配对请求

openclaw nodes rename <id>

重命名节点

openclaw nodes describe <id>

描述节点能力和支持命令

8.3 节点远程操作

命令

说明

openclaw nodes run --node <id> --raw <cmd>

在节点上执行 Shell 命令(仅 Mac)

openclaw nodes invoke --node <id>

在节点上调用命令

openclaw nodes camera snap --node <id>

节点摄像头拍照

openclaw nodes camera list --node <id>

列出节点摄像头

openclaw nodes camera clip --node <id>

节点摄像头录制视频片段

openclaw nodes screen --node <id>

节点屏幕录制

openclaw nodes canvas --node <id>

节点 Canvas 内容捕获

openclaw nodes location --node <id>

获取节点位置

openclaw nodes notify --node <id>

发送本地通知(仅 Mac)

openclaw nodes push --node <id>

发送 APNs 测试推送(仅 iOS)

九、配置管理(Config)

9.1 配置查看

命令

说明

openclaw config get

获取完整配置

openclaw config get <path>

按点路径获取配置值

openclaw config file

显示当前配置文件路径

openclaw config schema

打印配置 JSON Schema

openclaw config validate

验证当前配置是否合规

9.2 配置修改

命令

说明

openclaw config set <path> <value>

设置配置值

openclaw config set --batch-file <file>

批量设置配置

openclaw config unset <path>

删除指定配置项

9.3 交互式配置

命令

说明

openclaw configure

交互式配置向导

openclaw setup

初始化本地配置和 Agent 工作空间

openclaw onboard

交互式引导(Gateway、工作空间、技能)


十、技能管理(Skills)

命令

说明

openclaw skills list

列出所有可用技能

openclaw skills info <name>

显示技能详细信息

openclaw skills check

检查技能就绪状态

openclaw skills search <query>

搜索 ClawHub 技能

openclaw skills install <name>

从 ClawHub 安装技能

openclaw skills update

更新已安装的技能


十一、插件管理(Plugins)

命令

说明

openclaw plugins list

列出已发现的插件

openclaw plugins inspect <name>

查看插件详细信息

openclaw plugins install <source>

安装插件

openclaw plugins uninstall <name>

卸载插件

openclaw plugins update

更新已安装的插件

openclaw plugins enable <name>

启用插件

openclaw plugins disable <name>

禁用插件

openclaw plugins doctor

报告插件加载问题

openclaw plugins marketplace

查看插件市场


十二、Hooks 管理

命令

说明

openclaw hooks list

列出所有钩子

openclaw hooks info <name>

显示钩子详细信息

openclaw hooks check

检查钩子资格状态

openclaw hooks enable <name>

启用钩子

openclaw hooks disable <name>

禁用钩子


十三、记忆管理(Memory)

命令

说明

openclaw memory status

显示索引和提供者状态

openclaw memory status --deep

探测嵌入提供者就绪状态

openclaw memory status --json

JSON 格式输出

openclaw memory search <query>

搜索记忆文件

openclaw memory search --max-results 20

限制搜索结果数

openclaw memory index

重新索引记忆文件

openclaw memory index --force

强制完整重新索引

十四、安全与审计

14.1 安全审计(Security)

命令

说明

openclaw security audit

运行本地安全审计

openclaw security audit --deep

包含 Gateway 实时探测检查

openclaw security audit --fix

应用安全修复

openclaw security audit --json

JSON 格式输出

14.2 密钥管理(Secrets)

命令

说明

openclaw secrets reload

重新解析密钥引用并原子交换运行时快照

openclaw secrets audit

审计明文密钥、未解析引用

openclaw secrets configure

交互式密钥助手

openclaw secrets apply

应用密钥计划

14.3 执行审批(Approvals)

命令

说明

openclaw approvals get

获取执行审批快照

openclaw approvals set <file>

用 JSON 文件替换执行审批

openclaw approvals allowlist

编辑 Agent 白名单


十五、沙箱管理(Sandbox)

命令

说明

openclaw sandbox list

列出所有沙箱容器及状态

openclaw sandbox list --browser

仅列出浏览器容器

openclaw sandbox recreate --all

重建所有容器

openclaw sandbox recreate --session <name>

重建指定会话容器

openclaw sandbox recreate --agent <id>

重建指定 Agent 容器

openclaw sandbox explain

解释有效的沙箱/工具策略

十六、备份管理(Backup)

命令

说明

openclaw backup create

创建配置、凭证、会话、工作空间的备份归档

openclaw backup verify <file>

验证备份归档及其嵌入清单


十七、更新管理(Update)

命令

说明

openclaw update

执行更新(Git/npm)

openclaw update --dry-run

预览更新内容(不实际安装)

openclaw update --channel stable

切换到稳定更新通道

openclaw update --channel beta

切换到 Beta 更新通道

openclaw update --channel dev

切换到开发更新通道

openclaw update --tag <version>

一次性更新到指定版本

openclaw update --no-restart

更新后不重启服务

openclaw update --yes

非交互模式(跳过确认)

openclaw update --json

JSON 格式输出

openclaw update status

显示当前更新通道和版本状态

openclaw update wizard

交互式更新向导

十八、联系人目录(Directory)

命令

说明

openclaw directory self --channel <name>

显示当前账号身份

openclaw directory peers list --channel <name>

列出联系人/用户

openclaw directory peers list --query <name>

按名称搜索联系人

openclaw directory groups list --channel <name>

列出可用群组/频道

openclaw directory groups members --group-id <id>

列出群组成员


十九、MCP 管理

命令

说明

openclaw mcp list

列出已配置的 MCP 服务器

openclaw mcp show <name>

显示 MCP 服务器配置

openclaw mcp set <name> <json>

设置 MCP 服务器

openclaw mcp unset <name>

移除 MCP 服务器

openclaw mcp serve

通过 MCP stdio 暴露 OpenClaw 通道


二十、ACP 管理

命令

说明

openclaw acp client

运行交互式 ACP 客户端

ACP 选项

选项

说明

--session <key>

默认会话密钥

--session-label <label>

会话标签

--token <token>

Gateway Token

--password <password>

Gateway 密码

--url <url>

Gateway WebSocket URL

--reset-session

首次使用前重置会话

--require-existing

仅使用已存在的会话

--provenance <mode>

溯源模式(off/meta/meta+receipt)


二十一、DNS 与 Webhooks

命令

说明

openclaw dns setup

设置 CoreDNS 以支持 DNS-SD 广域发现

openclaw webhooks gmail

Gmail Pub/Sub 钩子


二十二、系统诊断与工具

22.1 诊断命令

命令

说明

openclaw status

显示通道健康状态和最近会话接收者

openclaw status --all

完整诊断(只读,可粘贴分享)

openclaw status --deep

深度探测通道

openclaw status --usage

显示模型使用量/配额

openclaw status --json

JSON 格式输出

openclaw health

获取 Gateway 健康状态

openclaw doctor

健康检查 + 快速修复

openclaw doctor --fix

应用推荐修复

openclaw doctor --deep

扫描系统服务中的额外 Gateway 安装

openclaw doctor --force

强制修复(覆盖自定义配置)

openclaw doctor --generate-gateway-token

生成并配置 Gateway Token

22.2 日志与文档

命令

说明

openclaw logs

通过 RPC 尾随 Gateway 文件日志

openclaw logs --tail <n>

查看最近 N 条日志

openclaw docs <关键词>

搜索官方文档

二十三、浏览器控制

命令

说明

/browser start

启动浏览器

/browser stop

停止浏览器

/browser status

查看浏览器状态

/browser tabs

查看打开的标签页


二十四、其他命令

命令

说明

openclaw agent --message <msg>

通过 Gateway 与 Agent 对话

openclaw agent --to <target> --deliver

对话并发送回复到指定目标

openclaw dashboard

打开控制台 Web UI

openclaw tui

打开终端 UI(TUI)

openclaw completion

生成 Shell 自动补全脚本

openclaw reset

重置本地配置/状态(保留 CLI)

openclaw uninstall

卸载 Gateway 服务 + 本地数据


附录 A:命令速查表(按使用频率)

日常高频命令

openclaw status                     # 查看整体状态
openclaw gateway status             # 查看 Gateway 状态
openclaw gateway restart            # 重启 Gateway
openclaw sessions                   # 查看会话列表
openclaw models list                # 查看模型
openclaw channels status            # 查看通道状态
openclaw message send               # 发送消息
openclaw cron list                  # 查看定时任务
openclaw doctor                     # 健康检查
openclaw logs                       # 查看日志

Web UI 高频命令

/status          查看会话状态
/new             新建会话
/reset           重置会话
/models          查看模型
/thinking on     开启深度思考
/cron list       查看定时任务
/help            显示帮助

附录 B:常用命令组合示例

完整部署流程

openclaw setup                                          # 初始化
openclaw configure                                      # 交互式配置
openclaw gateway install                                # 安装服务
openclaw gateway start                                  # 启动服务
openclaw channels login --channel whatsapp              # 连接 WhatsApp
openclaw channels add --channel telegram --token <tok>  # 连接 Telegram
openclaw status --all                                   # 验证状态
openclaw doctor                                         # 健康检查
openclaw security audit                                 # 安全审计

日常运维流程

openclaw status --deep            # 检查状态
openclaw gateway health           # 检查 Gateway
openclaw update --dry-run         # 预览更新
openclaw update                   # 执行更新
openclaw backup create            # 创建备份
openclaw security audit --fix     # 安全审计并修复

故障排查流程

openclaw status --all             # 快速诊断
openclaw doctor --fix             # 自动修复
openclaw logs --tail 100          # 查看日志
openclaw channels logs            # 查看通道日志
openclaw gateway probe            # 探测 Gateway
openclaw channels status --deep   # 深度检查通道
openclaw sandbox list             # 检查沙箱
openclaw gateway restart          # 重启 Gateway
openclaw sandbox recreate --all   # 重建沙箱

为什么推荐用 VPS 部署 OpenClaw? 2026-04-03
基于 Mac 的 OpenClaw 安装部署文档 2026-04-03

评论区