OpenClaw 命令清单及操作指南
- • 数据来源:OpenClaw CLI
openclaw --help / openclaw <subcommand> --help 实时输出;OpenClaw 官方文档 - • CLI 版本:OpenClaw 2026.3.23-2 (7ffe7e4)
- • 说明:所有命令均基于实际 CLI 帮助输出或官方文档,未编造任何不存在的命令或参数
一、Gateway 管理命令
Gateway(网关)是 OpenClaw 的核心进程,负责会话路由、渠道连接和 Agent 调度。
核心命令
| | |
openclaw gateway run | 前台运行 WebSocket Gateway(阻塞) | 开发调试时直接观察日志,macOS 无 systemd 时手动前台运行 |
openclaw gateway start | 注册为系统服务(launchd/systemd/schtasks)并启动 | |
openclaw gateway stop | | |
openclaw gateway restart | | |
openclaw gateway status | | |
openclaw gateway health | | |
openclaw gateway probe | | |
openclaw gateway discover | 通过 Bonjour 发现局域网内 Gateway | |
openclaw gateway install / uninstall | | |
openclaw gateway call <method> | | |
常用 Gateway 选项
| |
--port <port> | 指定 Gateway WebSocket 端口(默认 18789) |
--force | |
--token <token> | |
--bind <mode> | 绑定模式:loopback(默认)/ lan / tailnet / auto |
--tailscale <mode> | Tailscale 暴露:off / serve / funnel |
--dev | |
--verbose | |
--ws-log <style> | WebSocket 日志样式:auto / full / compact |
二、会话控制命令(Channel 内 Slash 命令)
以 / 开头,在飞书、Telegram、Discord 等渠道直接发送。
核心会话命令
| |
/new [model] | 创建新会话(重置上下文)。/new gpt-5.2 指定模型 |
/reset | |
/status | 显示会话状态(模型、Token 用量、Provider 配额) |
/whoami | |
/context [list|detail|json] | |
/export-session [path] | |
模型与推理控制
| |
/model <name> | 切换模型。/model 查看列表,/model 3 选编号 |
/reasoning on|off|stream | |
/think <level> | 设置推理详细程度(off|minimal|low|medium|high|xhigh) |
/fast on|off | |
/verbose on|full|off | |
工具与执行控制
| |
/elevated on|off|ask|full | |
/exec host=<sandbox|gateway|node> security=<deny|allowlist|full> | |
/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 | |
/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] | |
/help | |
三、Skills 命令
Skills(技能)是扩展 OpenClaw 功能的插件模块。
CLI 命令
openclaw skills list # 列出当前工作区所有可用 Skillsopenclaw skills search [query...] # 在 ClawHub 搜索 Skillsopenclaw skills install <slug> # 从 ClawHub 安装技能(如 feishu-doc)openclaw skills update <slug|--all> # 更新已安装的 ClawHub Skillsopenclaw 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 cancel | |
/acp steer <id|#> <message> | |
/acp close | |
/acp status | |
/acp set-mode | |
/acp sessions | |
/acp doctor | |
/acp install | |
/acp cwd <path> | |
/acp permissions <spec> | |
/acp timeout <seconds> | |
/acp model <name> | |
/acp reset-options | |
渠道内 Subagent 命令
| |
/subagents list | |
/subagents kill <id|#|all> | |
/subagents log <id|#> | |
/subagents info <id|#> | |
/subagents send <id|#> <message> | |
/subagents steer <id|#> <message> | |
/subagents spawn | |
CLI 端 ACP 命令
openclaw acp # 运行 ACP 桥接程序(stdio 与 Gateway 通信)openclaw acp client # 运行交互式 ACP 客户端(调试用)
Agents 管理(CLI)
openclaw agents list [--bindings] [--json] # 列出所有配置的 Agentopenclaw agents add [name] # 添加新的隔离 Agentopenclaw agents delete <name> # 删除一个 Agent 及其工作区和状态openclaw agents bind / unbind # 为 Agent 添加/移除渠道路由绑定
六、诊断与配置命令
诊断
openclaw doctor [options] # 健康检查+快速修复# 选项:--fix/--repair(应用修复)、--force(激进修复)、--deep(深度扫描)、# --generate-gateway-token、--yes(不询问)、--non-interactiveopenclaw 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 --latestopenclaw devices revoke --device <id> --role <role>
Hooks 管理
openclaw hooks list / enable <name> / disable <name> / check
七、常用操作场景清单
场景 1:首次安装并启动
npm install -g openclaw@latestopenclaw onboard --install-daemonopenclaw dashboard
场景 2:启动/重启 Gateway
openclaw gateway startopenclaw gateway restartopenclaw gateway run --verbose # 前台运行(调试)
场景 3:连接飞书渠道
openclaw channels add --channel feishu --app-id <id> --app-secret <secret>openclaw channels statusopenclaw channels logs --channel feishu
场景 4:安装新技能
openclaw skills search weatheropenclaw skills install weatheropenclaw 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.2openclaw agents bind --agent research-agent --bind feishu:default
场景 7:查看和管理会话
openclaw sessionsopenclaw sessions --agent research-agent --active 120openclaw sessions cleanup
场景 8:实时调试日志
openclaw logs --followopenclaw channels logs --channel feishu --lines 100openclaw logs --follow --json
场景 9:运行诊断和修复
openclaw doctoropenclaw doctor --fixopenclaw doctor --deep
场景 10:更新 OpenClaw
openclaw update statusopenclaw updateopenclaw update --channel beta
场景 11:创建定时任务
openclaw cron add \ --name "Daily Report" \ --agent main \ --message "用中文总结今日工作进展" \ --cron "0 9 * * *"openclaw cron listopenclaw cron run <task-id>
场景 12:子 Agent 并行处理
在飞书/Telegram 中发送:
/subagents spawn # 启动子 Agent/subagents list # 查看状态/subagents steer 1 继续执行这个任务 # 注入指令/subagents kill all # 停止所有
场景 13:配置变更(非交互式)
openclaw config get gateway.portopenclaw config set gateway.port 19001openclaw config validate
场景 14:安全审计
openclaw security auditopenclaw security audit --deepopenclaw security audit --fix
场景 15:备份与恢复
openclaw backup createopenclaw backup verify
参考资料
引用链接
[1] OpenClaw 官方文档:https://docs.openclaw.ai[2]OpenClaw CLI 参考:https://docs.openclaw.ai/cli[3]Slash Commands 文档:https://docs.openclaw.ai/tools/slash-commands[4]ACP 文档:https://docs.openclaw.ai/cli/acp[5]Skills 文档:https://docs.openclaw.ai/cli/skills[6]Gateway 文档:https://docs.openclaw.ai/cli/gateway[7]Channels 文档:https://docs.openclaw.ai/cli/channels[8]MCP 文档:https://docs.openclaw.ai/cli/mcp[9]Agents 文档:https://docs.openclaw.ai/cli/agents[10]Security 文档:https://docs.openclaw.ai/gateway/security