OpenClaw CLI 命令深度速查

基于 OpenClaw 2026.3.24,所有命令均支持 --help 查看完整参数。
文档: https://docs.openclaw.ai/cli


1. 初始化与引导

# 一站式引导 (推荐首次使用)
openclaw onboard --install-daemon

# 非交互式引导 (CI/自动化)
openclaw onboard --non-interactive --accept-risk \
  --auth-choice custom-api-key \
  --custom-base-url http://127.0.0.1:3000 \
  --custom-model-id doubao-seed-2.0-code

# 指定引导流程
openclaw onboard --flow quickstart     # 快速
openclaw onboard --flow advanced       # 高级
openclaw onboard --flow manual         # 手动

# 重置后重新引导
openclaw onboard --reset --reset-scope full

# 基础初始化 / 交互式配置
openclaw setup
openclaw configure
openclaw configure --section web       # 只配置 web 搜索部分

2. Gateway 网关

启动与运行

openclaw gateway                       # 启动 (前台)
openclaw gateway run                   # 同上,显式前台运行
openclaw gateway --force               # 强制启动 (释放占用端口)
openclaw gateway --port 18789          # 指定端口
openclaw gateway --verbose             # 详细日志
openclaw gateway --compact             # 紧凑日志
openclaw gateway --raw-stream          # 记录原始模型流到 jsonl
openclaw --dev gateway                 # 开发模式 (隔离状态, 端口 19001)
openclaw --dev gateway --reset         # 开发模式 + 重置所有状态

服务管理 (systemd/launchd)

openclaw gateway install               # 安装为系统服务
openclaw gateway start                 # 启动服务
openclaw gateway stop                  # 停止服务
openclaw gateway restart               # 重启服务
openclaw gateway uninstall             # 卸载服务
openclaw gateway status                # 服务状态 + 探测

网络与认证

openclaw gateway --bind loopback       # 仅本地 (默认)
openclaw gateway --bind lan            # 局域网
openclaw gateway --bind tailnet        # Tailscale 网络
openclaw gateway --auth token --token <tok>       # Token 认证
openclaw gateway --auth password --password <pwd> # 密码认证
openclaw gateway --tailscale serve     # Tailscale Serve (内网)
openclaw gateway --tailscale funnel    # Tailscale Funnel (公网)

网关查询

openclaw gateway call health           # RPC 调用
openclaw gateway discover              # Bonjour 发现 (本地+广域)
openclaw gateway probe                 # 可达性 + 发现 + 健康 + 状态
openclaw gateway usage-cost            # 用量费用汇总

3. 健康与诊断

openclaw health                        # 快速健康检查
openclaw doctor                        # 全面诊断
openclaw doctor --fix                  # 自动修复
openclaw doctor --force                # 强力修复 (覆盖自定义配置)
openclaw doctor --deep                 # 深度扫描系统服务
openclaw doctor --non-interactive      # 非交互式 (仅安全迁移)
openclaw doctor --generate-gateway-token  # 生成网关 token
openclaw status                        # 渠道健康 + 最近会话
openclaw logs                          # 实时日志

4. 渠道管理

# 列表与状态
openclaw channels list                 # 列出所有渠道和认证配置
openclaw channels status               # 网关渠道状态
openclaw channels status --probe       # 深度探测
openclaw channels capabilities --channel feishu  # 渠道能力

# 添加渠道
openclaw channels add --channel feishu           # 交互式
openclaw channels add --channel telegram --token <BOT_TOKEN>  # 非交互式
openclaw channels add --channel feishu --account bot-code \
  --app-id cli_xxx --app-secret xxx              # 飞书多账户

# 登录/登出
openclaw channels login --channel whatsapp --verbose  # WhatsApp 扫码
openclaw channels logout --channel whatsapp

# 移除
openclaw channels remove --channel feishu --account bot-code
openclaw channels remove --channel feishu --account bot-code --delete

# 日志与解析
openclaw channels logs                 # 渠道日志
openclaw channels resolve --channel telegram --query "username"  # 解析 ID

5. 消息系统

# 发送消息
openclaw message send --target +15555550123 --message "Hi"
openclaw message send --target +15555550123 --message "Hi" --media photo.jpg
openclaw message send --channel telegram --target @mychat --message "Hi"

# 广播
openclaw message broadcast --targets "+1234,+5678" --message "通知"

# 消息操作
openclaw message read --target <id>                    # 读取消息
openclaw message edit --message-id <id> --text "新内容" # 编辑
openclaw message delete --message-id <id>              # 删除
openclaw message pin --message-id <id>                 # 置顶
openclaw message unpin --message-id <id>               # 取消置顶
openclaw message pins --target <id>                    # 列出置顶

# 表情与投票
openclaw message react --channel discord --target <id> --message-id <id> --emoji "✅"
openclaw message poll --channel discord --target channel:123 \
  --poll-question "选哪个?" --poll-option A --poll-option B

# 搜索
openclaw message search --channel discord --query "关键词"

# 成员管理
openclaw message ban --channel discord --target <id> --user <uid>
openclaw message kick --channel discord --target <id> --user <uid>
openclaw message timeout --channel discord --target <id> --user <uid>

# 角色与权限
openclaw message role --help
openclaw message permissions --channel discord --target <id>

# 线程与语音
openclaw message thread --help
openclaw message voice --help

6. Agent 与对话

# 与 Agent 对话
openclaw agent --message "你好"
openclaw agent --to +15555550123 --message "状态更新"
openclaw agent --agent ops --message "汇总日志"
openclaw agent --session-id 1234 --message "总结" --thinking medium

# 投递回复到渠道
openclaw agent --message "生成报告" --deliver
openclaw agent --message "报告" --deliver --reply-channel slack --reply-to "#reports"

# 本地运行 (不经过 Gateway)
openclaw agent --local --message "测试"

# 输出与超时
openclaw agent --json                  # JSON 输出
openclaw agent --verbose on            # 详细模式
openclaw agent --thinking high         # 思考级别
openclaw agent --timeout 300           # 超时 (秒)

Agent 工作区管理

openclaw agents list                   # 列出所有 Agent
openclaw agents add                    # 添加新 Agent
openclaw agents delete <id>            # 删除 Agent

# 路由绑定 (渠道→Agent)
openclaw agents bind <id>              # 添加路由
openclaw agents unbind <id>            # 移除路由
openclaw agents bindings               # 列出所有绑定

# 身份设置
openclaw agents set-identity <id>      # 设置名称/主题/emoji/头像

7. 模型管理

openclaw models list                   # 列出已配置模型
openclaw models scan                   # 扫描 OpenRouter 免费模型
openclaw models status                 # 模型状态
openclaw models status --json          # JSON 输出
openclaw models set <model-id>         # 设置默认模型
openclaw models set-image <model-id>   # 设置图像模型

# 别名
openclaw models aliases                # 管理模型别名

# 认证配置
openclaw models auth                   # 管理认证配置

# 故障转移
openclaw models fallbacks              # 管理模型故障转移列表
openclaw models image-fallbacks        # 管理图像模型故障转移

# 指定 Agent 查看
openclaw models --agent ops status     # 查看特定 Agent 的模型状态

8. 插件系统

openclaw plugins list                  # 列出所有插件 (82+)
openclaw plugins enable <id>           # 启用插件
openclaw plugins disable <id>          # 禁用插件
openclaw plugins inspect <id>          # 查看插件详情
openclaw plugins doctor                # 插件加载问题诊断

# 安装/卸载第三方插件
openclaw plugins install <spec>        # 支持: 路径/归档/npm包/clawhub:包名
openclaw plugins uninstall <id>        # 卸载
openclaw plugins update                # 更新已安装插件

# 插件市场
openclaw plugins marketplace           # 浏览 Claude 兼容插件市场

9. 技能 (Skills)

openclaw skills list                   # 列出可用技能
openclaw skills info <name>            # 技能详情
openclaw skills check                  # 检查技能就绪状态
openclaw skills search "关键词"        # 搜索 ClawHub 技能
openclaw skills install <name>         # 从 ClawHub 安装技能
openclaw skills update                 # 更新已安装技能

10. 记忆系统

openclaw memory status                 # 索引和 provider 状态
openclaw memory status --deep          # 深度探测 embedding provider
openclaw memory status --json          # JSON 输出
openclaw memory search "会议记录"      # 搜索记忆
openclaw memory search --query "部署" --max-results 20  # 限制结果数
openclaw memory index --force          # 强制全量重建索引

11. 会话管理

openclaw sessions                      # 列出所有会话
openclaw sessions --agent work         # 指定 Agent 的会话
openclaw sessions --all-agents         # 跨 Agent 聚合
openclaw sessions --active 120         # 最近 2 小时活跃的
openclaw sessions --json               # JSON 输出
openclaw sessions cleanup              # 会话存储维护

12. 定时任务 (Cron)

openclaw cron list                     # 列出任务
openclaw cron add                      # 添加任务
openclaw cron edit <id>                # 编辑任务
openclaw cron enable <id>              # 启用
openclaw cron disable <id>             # 禁用
openclaw cron rm <id>                  # 删除
openclaw cron run <id>                 # 立即执行 (调试)
openclaw cron runs                     # 执行历史
openclaw cron status                   # 调度器状态

13. 浏览器控制

# 基础操作
openclaw browser status                # 浏览器状态
openclaw browser start                 # 启动浏览器
openclaw browser stop                  # 停止浏览器
openclaw browser tabs                  # 列出标签页
openclaw browser open https://example.com  # 新标签页打开
openclaw browser navigate https://example.com  # 当前页导航
openclaw browser close <tab-id>        # 关闭标签页
openclaw browser focus <tab-id>        # 聚焦标签页

# 截图与快照
openclaw browser screenshot            # 截图
openclaw browser screenshot --full-page  # 全页截图
openclaw browser screenshot --ref 12   # 元素截图
openclaw browser snapshot              # AI 快照
openclaw browser snapshot --format aria --limit 200  # 无障碍树
openclaw browser snapshot --efficient  # 精简快照
openclaw browser pdf                   # 保存为 PDF

# 页面交互
openclaw browser click 12              # 点击元素
openclaw browser click 12 --double     # 双击
openclaw browser type 23 "hello" --submit  # 输入并提交
openclaw browser press Enter           # 按键
openclaw browser hover 44              # 悬停
openclaw browser drag 10 11            # 拖拽
openclaw browser select 9 OptionA OptionB  # 下拉选择
openclaw browser fill --fields '[{"ref":"1","value":"Ada"}]'  # 填表
openclaw browser upload /tmp/file.pdf  # 上传文件
openclaw browser dialog --accept       # 处理弹窗
openclaw browser wait --text "Done"    # 等待文本出现
openclaw browser resize 1280 720       # 调整视口

# 高级
openclaw browser evaluate --fn '(el) => el.textContent' --ref 7  # 执行 JS
openclaw browser console --level error # 控制台消息
openclaw browser requests              # 网络请求
openclaw browser cookies               # Cookie 管理
openclaw browser storage               # localStorage/sessionStorage
openclaw browser trace                 # Playwright trace 录制
openclaw browser download              # 下载文件

# Profile 管理
openclaw browser profiles              # 列出配置
openclaw browser create-profile        # 创建
openclaw browser reset-profile         # 重置
openclaw browser --browser-profile <name>  # 使用指定配置

14. 设备与节点 (Nodes)

# 节点服务
openclaw node run                      # 前台运行节点主机
openclaw node install                  # 安装为系统服务
openclaw node start / stop / restart   # 服务控制
openclaw node status                   # 节点状态

# 节点管理
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>           # 节点能力描述

# 远程操作
openclaw nodes run --node <id> --raw "uname -a"  # 远程执行命令 (macOS)
openclaw nodes notify --node <id> --title "提醒"  # 发送通知 (macOS)
openclaw nodes camera snap --node <id>            # 拍照
openclaw nodes screen --node <id>                 # 屏幕录制
openclaw nodes location --node <id>               # 获取位置
openclaw nodes canvas --node <id>                 # Canvas 内容
openclaw nodes invoke --node <id> --command <cmd> # 通用调用

# 设备 Token 管理
openclaw devices list                  # 列出设备
openclaw devices approve <id>          # 批准设备
openclaw devices reject <id>           # 拒绝设备
openclaw devices remove <id>           # 移除设备
openclaw devices revoke <id>           # 吊销 Token
openclaw devices rotate <id>           # 轮换 Token
openclaw devices clear                 # 清除所有

15. 安全

openclaw security audit                # 安全审计
openclaw security audit --deep         # 深度审计 (含网关探测)
openclaw security audit --fix          # 自动修复
openclaw security audit --json         # JSON 输出

# 密钥管理
openclaw secrets audit                 # 审计明文密钥和未解析引用
openclaw secrets configure             # 交互式密钥配置
openclaw secrets reload                # 重新解析密钥引用
openclaw secrets apply                 # 应用密钥计划

# DM 配对安全
openclaw pairing list                  # 待配对列表
openclaw pairing approve <channel> <code>  # 批准配对码

# 执行审批
openclaw approvals get                 # 查看审批快照
openclaw approvals set <file>          # 替换审批配置
openclaw approvals allowlist           # 编辑 Agent 白名单

16. 配置管理

openclaw config file                   # 配置文件路径
openclaw config get gateway.port       # 读取配置值
openclaw config set gateway.port 19001 --strict-json  # 设置配置值
openclaw config unset gateway.port     # 删除配置值
openclaw config validate               # 验证配置
openclaw config schema                 # 输出 JSON Schema

# SecretRef 配置
openclaw config set channels.discord.token \
  --ref-provider default \
  --ref-source env \
  --ref-id DISCORD_BOT_TOKEN

# 批量配置
openclaw config set --batch-file ./config.batch.json --dry-run

17. 联系人目录

openclaw directory self --channel slack              # 当前账户
openclaw directory peers list --channel slack --query "alice"  # 搜索联系人
openclaw directory groups list --channel discord      # 列出群组
openclaw directory groups members --channel discord --group-id <id>  # 群成员

18. ACP (Agent Control Protocol)

openclaw acp client                    # 交互式 ACP 客户端
openclaw acp --session <key>           # 指定会话
openclaw acp --verbose                 # 详细日志
openclaw acp --provenance meta         # 溯源模式

19. Hooks

openclaw hooks list                    # 列出所有 hooks
openclaw hooks info <id>               # Hook 详情
openclaw hooks enable <id>             # 启用
openclaw hooks disable <id>            # 禁用
openclaw hooks check                   # 检查 hooks 资格

20. 系统与自动化

# 系统事件
openclaw system event                  # 入队系统事件
openclaw system heartbeat              # 心跳控制
openclaw system presence               # 在线状态列表

# Webhooks
openclaw webhooks gmail                # Gmail Pub/Sub 集成

# DNS 发现
openclaw dns setup                     # 配置 CoreDNS 广域发现

# iOS 配对
openclaw qr                            # 生成 iOS 配对二维码

21. 备份与更新

# 备份
openclaw backup create                 # 创建备份归档
openclaw backup verify <file>          # 验证备份

# 更新
openclaw update                        # 更新到最新版
openclaw update --channel beta         # 切换到 beta 通道
openclaw update --channel dev          # 切换到 dev 通道
openclaw update --tag v2026.3.28       # 指定版本
openclaw update --dry-run              # 预览更新
openclaw update --yes --no-restart     # 非交互式,不重启
openclaw update status                 # 查看通道和版本状态
openclaw update wizard                 # 交互式更新向导

22. 沙箱 (Docker 隔离)

openclaw sandbox list                  # 列出沙箱容器
openclaw sandbox list --browser        # 仅浏览器容器
openclaw sandbox recreate --all        # 重建所有容器
openclaw sandbox recreate --session main  # 重建指定会话
openclaw sandbox recreate --agent mybot   # 重建 Agent 容器
openclaw sandbox explain               # 解释有效沙箱策略

23. 其他

openclaw tui                           # 终端 UI
openclaw tui --thinking high           # 带思考级别
openclaw dashboard                     # 打开 Web 控制面板
openclaw docs                          # 搜索在线文档
openclaw completion                    # 生成 shell 补全脚本
openclaw reset                         # 重置本地配置
openclaw uninstall                     # 卸载网关 + 数据

全局选项

openclaw --profile <name>              # 命名配置 (隔离到 ~/.openclaw-<name>)
openclaw --dev                         # 开发配置 (隔离到 ~/.openclaw-dev)
openclaw --container <name>            # 在 Podman/Docker 容器内运行
openclaw --log-level debug             # 日志级别: silent|fatal|error|warn|info|debug|trace
openclaw --no-color                    # 禁用 ANSI 颜色
openclaw -V                            # 版本号
Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐