OpenClaw CLI 常用命令指南
命令前缀为
openclaw(或你的安装别名)。CLI 行为以官方文档为准:docs.openclaw.ai/cli
全局选项(常用)
openclaw --version # 或 -V、-v,查看版本
openclaw --dev <command> # 状态隔离到 ~/.openclaw-dev,端口偏移
openclaw --profile <name> <command> # 状态隔离到 ~/.openclaw-<name>
openclaw --no-color <command> # 关闭彩色输出
openclaw <command> --json # 多数子命令支持机器可读 JSON 输出
环境变量:NO_COLOR=1 也会关闭 ANSI 颜色。
安装与首次配置
初始化工作区与配置
openclaw setup # 初始化配置 + 工作区
openclaw setup --wizard # 带引导向导
openclaw setup --non-interactive # 无交互(可配合 --mode、--remote-url 等)
交互式入门(网关、工作区、技能等)
openclaw onboard
openclaw onboard --reset # 入门前重置配置与凭据、会话
openclaw configure # 交互配置向导(模型、频道、技能、网关等)
非交互式读写配置
openclaw config # 无子命令时进入向导
openclaw config file # 打印当前配置文件路径
openclaw config get <路径> # 按 dot/bracket 路径读取
openclaw config set <路径> <值>
openclaw config unset <路径>
openclaw config validate # 校验 openclaw.json,不启动网关
openclaw config validate --json
诊断与维护
openclaw doctor # 健康检查与快速修复建议
openclaw doctor --repair # 尝试自动修复(别名 --fix)
openclaw doctor --deep # 更深扫描本机多余网关安装等
openclaw doctor --yes # 无提示接受默认(适合脚本)
openclaw security audit # 审计配置与本地状态常见安全问题
openclaw security audit --deep # 尽力探测运行中的 Gateway
openclaw security audit --fix # 收紧安全默认值并调整权限(需谨慎)
openclaw secrets reload # 重新解析 Secret 引用并更新运行时快照
openclaw secrets audit # 扫描明文残留、未解析引用等
网关(Gateway)与服务
openclaw gateway status
openclaw gateway health
openclaw gateway probe
openclaw gateway discover
openclaw gateway start
openclaw gateway stop
openclaw gateway restart
openclaw gateway run # 前台运行(视环境而定)
# 安装/卸载网关系统服务(与具体平台相关,见官方文档)
openclaw gateway install
openclaw gateway uninstall
兼容:daemon 为网关服务相关命令的旧别名命名空间。
openclaw logs # 查看网关日志(支持过滤与跟随,见 help)
openclaw dashboard # 打开控制面板(若已配置)
状态与健康
openclaw status # 会话健康、近期收发等概览
openclaw status --deep # 探测频道等
openclaw status --all # 只读完整诊断,便于复制粘贴排查
openclaw status --usage # 模型提供方用量/配额(需已配置对应凭据)
openclaw health # 从运行中的 Gateway 拉取健康信息
频道(Channels)
openclaw channels list
openclaw channels list --json
openclaw channels status # 频道与网关连通性
openclaw channels status --probe
openclaw channels logs # 最近频道相关日志(默认约 200 行)
openclaw channels logs --lines 500
# 向导式添加;也可用非交互参数(见官方文档)
openclaw channels add
openclaw channels remove --channel <名> --account <账户>
openclaw channels login # 如 WhatsApp Web 等支持的场景
openclaw channels logout
示例(非交互,需事先准备 Token 环境变量):
openclaw channels add --channel telegram --account alerts --name "Alerts Bot" --token $TELEGRAM_BOT_TOKEN
智能体(Agents)
openclaw agents list
openclaw agents list --bindings
openclaw agents add [名称] # 向导;非交互需 --workspace 等
openclaw agents bindings
openclaw agents bind --agent <id> --bind <规范>
openclaw agents unbind --agent <id> --bind <规范>
openclaw agents delete <名称或 id>
绑定规格常用形式:channel[:accountId]。
单次对话回合(CLI 直连 Gateway)
openclaw agent -m "你的问题或指令"
openclaw agent -m "..." --session-id <id>
openclaw agent -m "..." --local # 嵌入式本地执行(不连网关时)
openclaw agent -m "..." --json
消息(Message)
统一出站消息与部分频道动作,子命令较多(send / poll / react 等)。
openclaw message send --target +15555550123 --message "Hi"
# 详细子命令见:openclaw message --help 与 https://docs.openclaw.ai/cli/message
模型(Models)
openclaw models list
openclaw models status
openclaw models set ...
openclaw models scan
openclaw models auth --help # add / login / paste-token 等子命令
记忆(Memory)
针对 MEMORY.md 与 memory/*.md 的索引与向量检索:
openclaw memory status
openclaw memory index # 重建索引
openclaw memory search "查询内容"
技能(Skills)与插件(Plugins)
openclaw skills list
openclaw skills info <技能名>
openclaw skills check # 就绪与缺失依赖摘要
openclaw skills search <关键词>
openclaw skills install <技能>
openclaw skills update <技能>
openclaw plugins list
openclaw plugins inspect <插件>
openclaw plugins install <插件>
openclaw plugins enable <插件>
openclaw plugins disable <插件>
openclaw plugins doctor
多数插件改动后需要重启 Gateway。
会话、任务与其它
openclaw sessions cleanup # 清理会话(参数见 help)
openclaw tasks list
openclaw tasks show <id>
openclaw tasks cancel <id>
openclaw pairing list # DM 配对请求
openclaw pairing approve
openclaw devices list
openclaw devices approve --latest # 等设备相关操作见 help
openclaw backup create
openclaw backup verify
openclaw update # 升级 OpenClaw
openclaw completion # Shell 补全安装说明
聊天内斜杠命令(简要)
在支持的消息界面中可使用 /... 指令,例如:
/status:快速诊断/config:持久化配置(具体以文档为准)/debug:运行时覆盖(需在配置中启用commands.debug: true)
详见:docs.openclaw.ai/tools/slash…
IDE 与 MCP / ACP
openclaw acp # ACP 桥接,连接 IDE 与 Gateway
openclaw mcp # MCP 相关(见官方子命令说明)
📝 文档信息
- 作者: 阿鑫
- 更新日期: 2026.1