Skip to content

CLI 命令总览

openclaw 是 OpenClaw 的命令行工具,负责初始化、配置、启动 Gateway、管理渠道和任务等。

全局参数

参数说明
--dev开发模式:状态隔离到 ~/.openclaw-dev,端口偏移
--profile <名称>指定 Profile:状态隔离到 ~/.openclaw-<名称>
--no-color禁用 ANSI 彩色输出
-V / --version打印版本并退出

初始化与配置

setup — 初始化配置和工作区

bash
openclaw setup                          # 交互式初始化
openclaw setup --workspace ~/my-ws      # 指定工作区目录
openclaw setup --wizard                 # 运行引导向导

onboard — 完整引导向导

一次性完成 Gateway、工作区、渠道、技能的全部配置:

bash
openclaw onboard                        # 交互式引导
openclaw onboard --non-interactive      # 无交互模式(适合脚本)
openclaw onboard --install-daemon       # 同时安装系统服务
openclaw onboard --reset                # 重置配置后重新引导
openclaw onboard --anthropic-api-key sk-ant-xxx  # 直接提供 API Key

configure — 配置向导

交互式配置模型、渠道、Skills 和 Gateway:

bash
openclaw configure

config — 非交互式配置

bash
openclaw config get agents.defaults.model.primary  # 读取配置值
openclaw config set gateway.port 18790             # 设置配置值
openclaw config unset gateway.auth.token           # 删除配置值
openclaw config file                               # 显示配置文件路径
openclaw config validate                           # 验证配置合法性

Gateway 管理

gateway — 运行与管理 Gateway

bash
openclaw gateway                      # 前台运行 Gateway
openclaw gateway --port 18789         # 指定端口
openclaw gateway --verbose            # 显示详细日志
openclaw gateway --force              # 强制替换运行中的实例
openclaw gateway status               # 查看 Gateway 状态
openclaw gateway install              # 安装为系统服务
openclaw gateway uninstall            # 卸载系统服务
openclaw gateway start                # 启动服务
openclaw gateway stop                 # 停止服务
openclaw gateway restart              # 重启服务

status / health

bash
openclaw status                       # 快速状态概览
openclaw health                       # 详细健康检查
openclaw dashboard                    # 打开 Web Control UI

渠道管理

bash
openclaw channels list                # 列出所有渠道
openclaw channels status              # 查看渠道连接状态
openclaw channels status --probe      # 主动探测连接
openclaw channels logs                # 查看渠道日志
openclaw channels login <>        # 登录渠道(如 WhatsApp QR 码)
openclaw channels logout <>       # 退出渠道
openclaw qr                           # 显示 QR 码

模型管理

bash
openclaw models list                  # 列出可用模型
openclaw models status                # 查看模型和认证状态
openclaw models status --json         # JSON 格式(含冷却中的认证配置)
openclaw models set <>            # 设置主模型
openclaw models set-image <>      # 设置图像模型
openclaw models aliases list          # 列出模型别名
openclaw models fallbacks list        # 列出备用模型

会话管理

bash
openclaw sessions                     # 列出所有会话

Cron 定时任务

bash
openclaw cron list                    # 列出所有任务
openclaw cron status                  # 查看调度器状态
openclaw cron add --name "提醒" --at "20m" --session main --system-event "检查日历"
openclaw cron edit <jobId>            # 编辑任务
openclaw cron run <jobId>             # 立即触发
openclaw cron runs --id <jobId>       # 查看运行历史
openclaw cron enable <jobId>          # 启用任务
openclaw cron disable <jobId>         # 禁用任务
openclaw cron rm <jobId>              # 删除任务

Hooks 管理

bash
openclaw hooks list                   # 列出所有 Hook
openclaw hooks info <>            # 查看 Hook 详情
openclaw hooks check                  # 检查 Hook 状态
openclaw hooks enable <>          # 启用 Hook
openclaw hooks disable <>         # 禁用 Hook
openclaw hooks install <路径/包>    # 安装 Hook Pack
openclaw hooks update                 # 更新已安装 Hook

Webhook 辅助

bash
openclaw webhooks gmail setup         # 配置 Gmail Pub/Sub
openclaw webhooks gmail run           # 启动 Gmail 监听

Skills 管理

bash
openclaw skills list                  # 列出所有 Skill
openclaw skills info <>           # 查看 Skill 详情
openclaw skills check                 # 检查 Skill 资格

浏览器工具

bash
openclaw browser status               # 查看浏览器状态
openclaw browser start                # 启动浏览器
openclaw browser stop                 # 停止浏览器
openclaw browser profiles             # 列出 Profile
openclaw browser create-profile <>
openclaw browser screenshot           # 截图
openclaw browser navigate <URL>       # 跳转

记忆管理

bash
openclaw memory status                # 查看记忆索引状态
openclaw memory index                 # 重建索引
openclaw memory search "关键词"       # 语义搜索记忆

安全与诊断

bash
openclaw doctor                       # 健康检查 + 自动修复建议
openclaw doctor --fix                 # 自动修复常见问题
openclaw security audit               # 配置安全审计
openclaw security audit --deep        # 深度审计(实时探测 Gateway)
openclaw security audit --fix         # 自动收紧安全配置

openclaw secrets audit                # 扫描明文密钥残留
openclaw secrets reload               # 重新解析 SecretRef

系统事件

bash
openclaw system event --mode now --text "检查通知"  # 发送系统事件
openclaw system heartbeat last        # 查看上次心跳
openclaw system heartbeat enable      # 启用心跳
openclaw system heartbeat disable     # 禁用心跳

节点管理

bash
openclaw nodes                        # 列出配对的节点
openclaw node status                  # 节点状态
openclaw node install                 # 安装节点服务

其他常用命令

bash
openclaw logs                         # 查看 Gateway 日志
openclaw update                       # 更新 OpenClaw
openclaw uninstall                    # 卸载 OpenClaw
openclaw reset                        # 重置配置
openclaw completion                   # 生成 Shell 补全脚本
openclaw docs                         # 打开文档
openclaw pairing list                 # 列出待审批的配对请求
openclaw pairing approve <id>         # 批准配对