
研究时间:2026-03-25
数据来源:OpenClaw CLI openclaw --help / openclaw <subcommand> --help 实时输出;OpenClaw 官方文档
CLI 版本:OpenClaw 2026.3.23-2 (7ffe7e4)
一、Gateway 管理命令
Gateway(网关)是 OpenClaw 的核心进程,负责会话路由、渠道连接和 Agent 调度。
核心命令
| 命令 | 作用 | 场景 |
|---|
openclaw gateway run | 前台运行 WebSocket Gateway(阻塞) | 开发调试时直接观察日志,macOS 无 systemd 时手动前台运行 |
openclaw gateway start | 注册为系统服务(launchd/systemd/schtasks)并启动 | 首次安装或机器重启后启动 Gateway |
openclaw gateway stop | 停止 Gateway 系统服务 | 需要完全关闭时 |
openclaw gateway restart | 重启 Gateway 系统服务 | 配置更新后 |
openclaw gateway status | 显示服务状态,探测本地 Gateway 是否可达 | 检查 Gateway 是否在运行 |
openclaw gateway health | 通过 RPC 获取健康状态详情 | 诊断 Gateway 内部状态 |
openclaw gateway probe | 综合探测(可达性、发现服务、运行状态摘要) | 全面诊断网关连接 |
openclaw gateway discover | 通过 Bonjour 发现局域网内 Gateway | 多设备环境中发现附近 Gateway |
openclaw gateway install / uninstall | 安装或卸载 Gateway 系统服务 | 首次安装或彻底移除 |
openclaw gateway call <method> | 直接调用 Gateway RPC 方法 | 高级调试 |
常用 Gateway 选项
| 选项 | 说明 |
|---|
--port <port> | 指定 Gateway WebSocket 端口(默认 18789) |
--force | 杀掉占用端口的进程后强制启动 |
--token <token> | 设置共享认证 Token |
--bind <mode> | 绑定模式:loopback(默认)/ lan / tailnet / auto |
--tailscale <mode> | Tailscale 暴露:off / serve / funnel |
--dev | 开发模式(隔离状态,端口 19001) |
--verbose | 输出详细日志到 stdout |
--ws-log <style> | WebSocket 日志样式:auto / full / compact |
二、会话控制命令(Channel 内 Slash 命令)
以 / 开头,在飞书、Telegram、Discord 等渠道直接发送。
核心会话命令
| 命令 | 作用 |
|---|
/new [model] | 创建新会话(重置上下文)。/new gpt-5.2 指定模型 |
/reset | 重置当前会话,等效于 /new |
/status | 显示会话状态(模型、Token 用量、Provider 配额) |
/whoami(别名 /id) | 显示当前发送者 ID(渠道相关) |
/context [list|detail|json] | 显示上下文构成及各部分大小 |
/export-session [path](别名 /export) | 导出当前会话为 HTML(含完整系统提示词) |
模型与推理控制
| 命令 | 作用 |
|---|
/model <name>(别名 /models) | 切换模型。/model 查看列表,/model 3 选编号 |
/reasoning on|off|stream(别名 /reason) | 开启/关闭推理过程显示 |
/think <level>(别名 /thinking, /t) | 设置推理详细程度(off|minimal|low|medium|high|xhigh) |
/fast on|off | 开启/关闭快速回复模式 |
/verbose on|full|off(别名 /v) | 控制详细输出,显示调试信息 |
工具与执行控制
| 命令 | 作用 |
|---|
/elevated on|off|ask|full(别名 /elev) | 提升执行权限(跳过 exec 审批) |
/exec host=<sandbox|gateway|node> security=<deny|allowlist|full> | 控制 exec 执行的主机和安全策略 |
/tools [compact|verbose] | 显示当前可用工具列表 |
/queue <mode> | 控制消息队列模式(防抖、容量、丢弃策略) |
配置命令
| 命令 | 作用 |
|---|
/config show|get|set|unset | 查看或修改 openclaw.json 配置(需 commands.config: true) |
/debug show|set|unset|reset | 运行时配置覆盖(内存级别,不写磁盘,需 commands.debug: true) |
/mcp show|get|set|unset | 管理 MCP 服务器配置(需 commands.mcp: true) |
其他实用命令
| 命令 | 作用 |
|---|
/stop | 停止当前正在运行的 Agent 响应 |
/restart | 重启 Gateway(需 commands.restart: true) |
/usage off|tokens|full|cost | 控制用量信息显示 |
/tts off|always|inbound|tagged|status|... | 控制文本转语音行为 |
/btw <question> | 向当前会话提出临时侧问,不影响后续上下文 |
/compact [instructions] | 触发会话压缩,减少上下文长度 |
/allowlist add|remove | 管理允许列表条目 |
/approve <id> allow-once|allow-always|deny | 审批执行权限请求 |
/session idle <duration|off> / /session max-age <duration|off> | 管理空闲自动取消聚焦 / 最大年龄 |
/dock-telegram / /dock-discord / /dock-slack | 切换回复目标到指定渠道 |
/activation mention|always | 控制群组中的激活方式 |
/send on|off|inherit | 控制是否发送回复(静默调试模式) |
/skill <name> [input] | 按名称运行一个已安装的 Skill |
/help / /commands | 显示帮助或列出所有可用命令 |
三、Skills 命令
Skills(技能)是扩展 OpenClaw 功能的插件模块。
CLI 命令
openclaw skills list # 列出当前工作区所有可用 Skills
openclaw skills search [query...] # 在 ClawHub 搜索 Skills
openclaw skills install <slug> # 从 ClawHub 安装技能(如 feishu-doc)
openclaw skills update <slug|--all> # 更新已安装的 ClawHub Skills
openclaw skills info <name> # 显示技能详细信息
openclaw skills check # 检查哪些 Skills 已就绪,哪些缺少依赖
渠道内 Skill 命令
/skill <name> [input] — 运行指定技能
四、MCP 命令
MCP(Model Context Protocol)服务器为 Agent 提供额外工具能力。
CLI 命令
openclaw mcp list # 列出所有已配置的 MCP 服务器
openclaw mcp show [name] # 显示某个 MCP 服务器的详细配置
openclaw mcp set <name> <json> # 设置一个 MCP 服务器配置
openclaw mcp unset <name> # 删除一个已配置的 MCP 服务器
渠道内 MCP 命令(需 commands.mcp: true)
/mcp show — 查看 MCP 配置
/mcp get <path> — 获取配置值
/mcp set <path> <value> — 设置配置值
/mcp unset <path> — 删除配置
五、ACP / Subagent 命令
ACP(Agent Client Protocol)用于 IDE/编辑器通过 stdio 控制 OpenClaw Gateway;Subagent 命令用于在当前会话中派生和管理子 Agent。
渠道内 ACP 核心命令
| 命令 | 作用 |
|---|
/acp spawn | 派生新的 ACP 会话/子 Agent |
/acp cancel | 取消正在运行的 ACP 会话 |
/acp steer <id|#> <message> | 引导正在运行的子 Agent 响应指定消息 |
/acp close | 关闭 ACP 会话 |
/acp status | 查看 ACP 会话状态 |
/acp set-mode / /acp set | 设置 ACP 会话模式或参数 |
/acp sessions | 列出所有 ACP 会话 |
/acp doctor | 运行 ACP 诊断检查 |
/acp install | 安装 ACP 相关组件 |
/acp cwd <path> | 设置 ACP 会话工作目录 |
/acp permissions <spec> | 设置 ACP 会话权限参数 |
/acp timeout <seconds> | 设置 ACP 会话超时时间 |
/acp model <name> | 为 ACP 会话指定模型 |
/acp reset-options | 重置 ACP 会话选项到默认值 |
渠道内 Subagent 命令
| 命令 | 作用 |
|---|
/subagents list | 列出当前会话中所有运行中的子 Agent |
/subagents kill <id|#|all> | 终止一个或所有子 Agent |
/subagents log <id|#> | 查看某个子 Agent 的日志输出 |
/subagents info <id|#> | 查看子 Agent 详细信息 |
/subagents send <id|#> <message>(别名 /tell) | 向指定子 Agent 发送消息 |
/subagents steer <id|#> <message>(别名 /steer) | 引导正在运行的子 Agent 响应新消息 |
/subagents spawn | 在当前会话中派生出新的子 Agent |
CLI 端 ACP 命令
openclaw acp # 运行 ACP 桥接程序(stdio 与 Gateway 通信)
openclaw acp client # 运行交互式 ACP 客户端(调试用)
Agents 管理(CLI)
openclaw agents list [--bindings] [--json] # 列出所有配置的 Agent
openclaw agents add [name] # 添加新的隔离 Agent
openclaw agents delete <name> # 删除一个 Agent 及其工作区和状态
openclaw agents bind / unbind # 为 Agent 添加/移除渠道路由绑定
六、诊断与配置命令
诊断
openclaw doctor [options] # 健康检查+快速修复
# 选项:--fix/--repair(应用修复)、--force(激进修复)、--deep(深度扫描)、
# --generate-gateway-token、--yes(不询问)、--non-interactive
openclaw status # 显示渠道健康状态和会话概览
openclaw health # 获取 Gateway 内部详细健康数据
openclaw logs [--follow] # 实时跟踪 Gateway 日志
配置
openclaw config get <path> # 获取配置值(如 gateway.port)
openclaw config set <path> <value> # 设置配置值(支持 JSON5)
openclaw config set <path> --ref-provider default --ref-source env --ref-id TOKEN # 安全存储密钥
openclaw config set --batch-file ./config-set.batch.json --dry-run # 批量模式
openclaw config unset <path> # 删除配置项
openclaw config file # 打印当前配置文件路径
openclaw config validate [--json] # 验证配置合法性
安全
openclaw security audit # 本地安全审计
openclaw security audit --deep # 含 Gateway 实时探测
openclaw security audit --fix # 自动收紧安全默认配置
会话管理
openclaw sessions [--agent <id>] [--active <minutes>] # 列出所有存储的会话
openclaw sessions cleanup # 执行会话存储维护
模型管理
openclaw models list # 列出所有可用模型
openclaw models set <model-id> # 设置默认模型
openclaw models status [--json] # 显示模型配置状态
openclaw models scan # 扫描 OpenRouter 免费模型
openclaw models aliases list / add / remove # 管理模型别名
更新与备份
openclaw update # 更新到最新稳定版
openclaw update --channel beta # 切换到 beta 通道
openclaw update --dry-run # 预览更新
openclaw update status # 查看当前通道和版本
openclaw backup create # 创建本地备份
openclaw backup verify # 验证备份
初始化与配置向导
openclaw setup [--workspace <dir>] [--non-interactive] # 初始化配置和工作区
openclaw onboard [--install-daemon] [--mode local|remote] # 交互式引导配置
openclaw configure # 交互式配置向导
openclaw dashboard # 打开 Control UI(浏览器)
openclaw tui # 打开终端 UI(类似聊天界面)
插件管理
openclaw plugins list [--json] # 列出所有已发现插件
openclaw plugins inspect <id> # 显示插件详细信息
openclaw plugins install <spec> # 安装插件
openclaw plugins enable / disable <id> # 启用/禁用插件
openclaw plugins doctor # 报告插件加载错误
内存管理
openclaw memory status # 显示内存索引统计
openclaw memory index # 重新索引内存文件
openclaw memory search "<query>" # 在内存文件中语义搜索
渠道管理
openclaw channels list # 列出配置的渠道和认证信息
openclaw channels status [--probe] # 检查渠道状态
openclaw channels add --channel <name> [options] # 添加渠道账号(非交互式)
openclaw channels login --channel <name> # 交互式登录(如 WhatsApp Web)
openclaw channels remove --channel <name> # 移除渠道账号
openclaw channels logs [--channel <name>] # 查看渠道日志
定时任务
openclaw cron list # 列出所有定时任务
openclaw cron add [options] # 添加新的定时任务
openclaw cron rm <id> # 删除定时任务
openclaw cron run <id> # 立即触发一次定时任务
openclaw cron runs <id> # 查看执行历史
节点管理
openclaw nodes list # 列出已配对节点
openclaw node run / status / install / start / stop / restart # 控制节点服务
设备配对
openclaw devices list # 管理网关设备配对条目
openclaw devices approve --latest
openclaw devices revoke --device <id> --role <role>
Hooks 管理
openclaw hooks list / enable <name> / disable <name> / check
七、常用操作场景清单
场景 1:首次安装并启动
npm install -g openclaw@latest
openclaw onboard --install-daemon
openclaw dashboard
场景 2:启动/重启 Gateway
openclaw gateway start
openclaw gateway restart
openclaw gateway run --verbose # 前台运行(调试)
场景 3:连接飞书渠道
openclaw channels add --channel feishu --app-id <id> --app-secret <secret>
openclaw channels status
openclaw channels logs --channel feishu
场景 4:安装新技能
openclaw skills search weather
openclaw skills install weather
openclaw skills check
场景 5:配置 MCP 服务器
openclaw mcp set filesystem '{"command":"npx","args":["-y","@modelcontextprotocol/server-filesystem","/tmp"]}'
openclaw mcp list
场景 6:创建新 Agent
openclaw agents add research-agent --workspace ~/.openclaw/agents/research --model gpt-5.2
openclaw agents bind --agent research-agent --bind feishu:default
场景 7:查看和管理会话
openclaw sessions
openclaw sessions --agent research-agent --active 120
openclaw sessions cleanup
场景 8:实时调试日志
openclaw logs --follow
openclaw channels logs --channel feishu --lines 100
openclaw logs --follow --json
场景 9:运行诊断和修复
openclaw doctor
openclaw doctor --fix
openclaw doctor --deep
场景 10:更新 OpenClaw
openclaw update status
openclaw update
openclaw update --channel beta
场景 11:创建定时任务
openclaw cron add \
--name "Daily Report" \
--agent main \
--message "用中文总结今日工作进展" \
--cron "0 9 * * *"
openclaw cron list
openclaw cron run <task-id>
场景 12:子 Agent 并行处理
在飞书/Telegram 中发送:
/subagents spawn # 启动子 Agent
/subagents list # 查看状态
/subagents steer 1 继续执行这个任务 # 注入指令
/subagents kill all # 停止所有
场景 13:配置变更(非交互式)
openclaw config get gateway.port
openclaw config set gateway.port 19001
openclaw config validate
场景 14:安全审计
openclaw security audit
openclaw security audit --deep
openclaw security audit --fix
场景 15:备份与恢复
openclaw backup create
openclaw backup verify
参考资料