Files
my-project/doc/CLI_COMMAND_REFERENCE.md
T

5.6 KiB
Raw Blame History

OpenClaw CLI 命令参考

常用命令速查

命令 说明
openclaw status 基本状态检查
openclaw status --all 完整诊断(可分享)
openclaw status --deep 深度检测(探测通道)
openclaw doctor 健康检查 + 自动修复
openclaw doctor --fix 自动修复配置问题
openclaw logs --follow 实时日志
openclaw gateway status Gateway 服务状态
openclaw gateway restart 重启 Gateway

config - 配置管理

# 获取配置
openclaw config get agents.defaults.workspace
openclaw config get agents.list[0].id

# 设置配置
openclaw config set browser.executablePath "/usr/bin/google-chrome"
openclaw config set agents.defaults.heartbeat.every "2h"
openclaw config set gateway.port 19001 --json

# 删除配置
openclaw config unset tools.web.search.apiKey

gateway - Gateway 管理

运行 Gateway

openclaw gateway              # 前台运行
openclaw gateway run          # 前台运行(显式)
openclaw gateway --verbose    # 详细日志

服务管理

openclaw gateway install       # 安装服务
openclaw gateway start       # 启动服务
openclaw gateway stop        # 停止服务
openclaw gateway restart     # 重启服务
openclaw gateway uninstall   # 卸载服务

查询状态

openclaw gateway status              # 服务状态 + RPC 探测
openclaw gateway health             # 健康检查
openclaw gateway probe              # 发现所有 Gateway
openclaw gateway discover           # Bonjour 发现

常用选项

--port <port>         # WebSocket 端口(默认 18789)
--bind <mode>        # 绑定模式: loopback|lan|tailnet|auto|custom
--token <token>      # 认证 Token
--verbose            # 详细日志
--allow-unconfigured # 允许无配置启动

status - 状态诊断

openclaw status              # 基本状态
openclaw status --all       # 完整诊断(可粘贴分享)
openclaw status --deep      # 深度检测(探测通道)
openclaw status --usage     # 显示模型用量

doctor - 健康检查

openclaw doctor              # 检查问题
openclaw doctor --repair    # 自动修复
openclaw doctor --fix       # 自动修复(别名)
openclaw doctor --deep      # 深度扫描

logs - 日志查看

openclaw logs --follow       # 实时日志
openclaw logs --limit 200   # 最近 200 行
openclaw logs --json        # JSON 格式输出
openclaw logs --plain       # 纯文本格式
openclaw logs --no-color    # 禁用颜色

channels - 通道管理

openclaw channels list       # 列出已配置通道
openclaw channels status     # 通道状态
openclaw channels status --probe  # 深度探测
openclaw channels logs      # 通道日志
openclaw channels login     # 登录通道(WhatsApp)
openclaw channels logout    # 登出通道

models - 模型管理

openclaw models list         # 列出可用模型
openclaw models status       # 模型状态 + 认证信息
openclaw models scan         # 扫描新模型
openclaw models set <model>  # 设置默认模型

memory - 记忆管理

openclaw memory status       # 记忆索引状态
openclaw memory index        # 重新索引记忆文件
openclaw memory search "<query>"  # 语义搜索记忆

cron - 定时任务

openclaw cron list           # 列出定时任务
openclaw cron add            # 添加定时任务
openclaw cron rm <id>        # 删除定时任务
openclaw cron enable <id>   # 启用任务
openclaw cron disable <id>   # 禁用任务
openclaw cron runs --id <id> # 查看任务运行记录

plugins - 插件管理

openclaw plugins list        # 列出插件
openclaw plugins install <id>   # 安装插件
openclaw plugins enable <id>    # 启用插件
openclaw plugins disable <id>    # 禁用插件
openclaw plugins doctor      # 插件诊断

skills - 技能管理

openclaw skills list        # 列出技能
openclaw skills info <name> # 技能详情
openclaw skills check       # 检查技能就绪状态

pairing - 配对管理

openclaw pairing list <channel>   # 列出待配对请求
openclaw pairing approve <channel> <code>  # 批准配对

完整命令树

openclaw <command>
  setup           # 初始化配置
  onboard         # 向导式配置
  configure       # 交互式配置
  config          # 配置管理
    get/set/unset
  doctor          # 健康检查
  reset           # 重置本地状态
  uninstall       # 卸载
  update          # 更新
  channels        # 通道管理
  skills          # 技能管理
  plugins         # 插件管理
  memory          # 记忆管理
  message         # 发送消息
  agent           # 运行单次 agent
  agents          # 多 agent 管理
  status          # 状态诊断
  health          # 健康检查
  sessions        # 会话管理
  gateway         # Gateway 管理
  logs            # 日志查看
  system          # 系统事件
  models          # 模型管理
  cron            # 定时任务
  nodes           # 节点管理
  browser         # 浏览器控制
  hooks           # 钩子管理
  webhooks        # Webhook 管理
  pairing         # 配对管理
  sandbox         # 沙箱管理
  tui              # 终端 UI

全局选项

选项 说明
--dev 开发模式(隔离状态)
--profile <name> 指定配置 profile
--json JSON 格式输出
--no-color 禁用颜色
-v, --version 显示版本

最后更新: 2026-02-04