乐于分享
好东西不私藏

OpenClaw 完整命令手册(转存)

OpenClaw 完整命令手册(转存)

本文档为 OpenClaw 完整命令手册,涵盖终端 CLI 命令和频道斜杠命令两大部分。

快速提示

  • 终端命令:运行 openclaw --help 或 openclaw <command> --help 查看详细帮助

  • 斜杠命令:在频道中输入 /commands 查看可用命令列表


第一部分:终端命令(CLI)

以下命令在终端(Terminal / Shell)中运行,用于管理 OpenClaw 的安装、配置、服务和设备。


📦 全局参数

所有 CLI 命令都支持以下全局参数:

参数

说明

--dev

在 ~/.openclaw-dev 下隔离状态,并偏移默认端口

--profile <name>

在 ~/.openclaw-<name> 下隔离状态

--no-color

禁用 ANSI 颜色输出

--update

执行更新(源码安装时可用)

-V--version-v

打印版本

--json

输出 JSON 格式(禁用样式)


🚀 安装与初始化

setup

初始化配置和工作区。

选项:

  • --workspace <dir> - 指定工作区路径(默认 ~/.openclaw/workspace

  • --wizard - 运行入职向导

  • --non-interactive - 非交互模式运行向导

  • --mode <local|remote> - 向导模式

  • --remote-url <url> - 远程 Gateway URL

  • --remote-token <token> - 远程 Gateway token

示例:

openclaw setup --wizard
openclaw setup --workspace /custom/path --non-interactive

onboard

交互式向导,设置 gateway、工作区和技能。

选项:

  • --workspace <dir> - 工作区路径

  • --reset - 重置配置和凭证

  • --reset-scope <config|config+creds+sessions|full> - 重置范围

  • --non-interactive - 非交互模式

  • --mode <local|remote> - 运行模式

  • --flow <quickstart|advanced|manual> - 流程类型

  • --auth-choice <...> - 认证方式选择

  • --gateway-port <port> - Gateway 端口

  • --gateway-bind <loopback|lan|tailnet|auto> - 绑定模式

  • --gateway-auth <token|password> - 认证方式

  • --install-daemon - 安装守护进程

  • --skip-channels - 跳过通道配置

  • --skip-skills - 跳过技能配置

示例:

openclaw onboard --flow quickstart
openclaw onboard --mode remote --remote-url https://gateway.example.com

configure

交互式配置向导(模型、通道、技能、Gateway)。


⚙️ 配置管理

config get

获取配置值。

openclaw config get <path>
openclaw config get agents.defaults.model.primary

config set

设置配置值。

openclaw config set <path> <value>
openclaw config set agents.defaults.model.primary zai/glm-4.7

config unset

移除配置值。

openclaw config unset <path>

config file

打印当前使用的配置文件路径。

config validate

验证当前配置(不启动 Gateway)。

openclaw config validate --json


📱 通道管理

channels list

列出已配置的通道和账号。

openclaw channels list
openclaw channels list --json
openclaw channels list --no-usage

channels status

检查 Gateway 可达性和通道健康状态。

openclaw channels status
openclaw channels status --probe

channels logs

显示通道最近的日志。

openclaw channels logs --channel all --lines 200
openclaw channels logs --channel discord --json

channels add

添加新通道账号(非交互模式)。

选项:

  • --channel <name> - 通道类型(whatsapp/telegram/discord/googlechat/slack/signal/imessage/msteams)

  • --account <id> - 账号 ID

  • --name <label> - 显示名称

  • --token <token> - Bot token

示例:

openclaw channels add --channel telegram --account alerts --name "Alerts Bot" --token $TELEGRAM_BOT_TOKEN
openclaw channels add --channel discord --account work --name "Work Bot" --token $DISCORD_BOT_TOKEN

channels remove

移除通道账号。

openclaw channels remove --channel discord --account work
openclaw channels remove --channel discord --account work --delete

channels login

交互式通道登录(WhatsApp Web)。

openclaw channels login --channel whatsapp

channels logout

登出通道会话。

openclaw channels logout --channel whatsapp


🤖 Agent 管理

agents list

列出已配置的 agent。

openclaw agents list
openclaw agents list --bindings --json

agents add

添加新的独立 agent。

选项:

  • --workspace <dir> - 工作区路径(必填)

  • --model <id> - 默认模型

  • --agent-dir <dir> - agent 目录

  • --bind <channel[:accountId]> - 绑定通道(可重复)

  • --non-interactive - 非交互模式

示例:

openclaw agents add --workspace /path/to/agent --bind discord:work
openclaw agents add my-agent --workspace /custom/path --model openrouter/auto --non-interactive

agents delete

删除 agent 及其工作区和状态。

openclaw agents delete <id>
openclaw agents delete my-agent --force

agents bindings

列出路由绑定。

openclaw agents bindings
openclaw agents bindings --agent my-agent --json

agents bind

添加路由绑定。

openclaw agents bind --agent my-agent --bind telegram
openclaw agents bind --agent my-agent --bind discord:alerts --bind whatsapp:personal

agents unbind

移除路由绑定。

openclaw agents unbind --agent my-agent --bind discord:work


🧠 模型管理

models

查看模型状态(models status 的别名)。

models list

列出可用模型。

选项:

  • --all - 显示所有模型

  • --local - 仅本地模型

  • --provider <name> - 按提供者筛选

  • --json - JSON 输出

示例:

openclaw models list --provider anthropic
openclaw models list --json

models status

显示认证状态和模型配置。

选项:

  • --json - JSON 输出

  • --plain - 纯文本输出

  • --check - 检查过期状态(退出码 1=过期/缺失,2=即将过期)

  • --probe - 探测配置的认证配置

  • --probe-provider <name> - 探测指定提供者

  • --probe-profile <id> - 探测指定 profile

示例:

openclaw models status
openclaw models status --probe
openclaw models status --check

models set

设置默认模型。

openclaw models set zai/glm-4.7

models set-image

设置默认图像模型。

openclaw models set-image openrouter/openai/dall-e-3

models aliases

管理模型别名。

openclaw models aliases list
openclaw models aliases add fast zai/glm-4.7-mini
openclaw models aliases remove fast

models fallbacks

管理模型备选列表。

openclaw models fallbacks list
openclaw models fallbacks add openrouter/claude-3.5-sonnet
openclaw models fallbacks remove zai/glm-4.7
openclaw models fallbacks clear

models image-fallbacks

管理图像模型备选列表。

openclaw models image-fallbacks list
openclaw models image-fallbacks add openrouter/openai/dall-e-3

models scan

扫描 OpenRouter 的免费模型。

选项:

  • --min-params <b> - 最小参数量

  • --max-age-days <days> - 最大模型年龄

  • --provider <name> - 按提供者筛选

  • --max-candidates <n> - 最大候选数

  • --set-default - 设置为默认模型

  • --set-image - 设置为默认图像模型

  • --yes - 自动确认

  • --no-input - 无输入模式

示例:

openclaw models scan --provider anthropic --set-default
openclaw models scan --yes --no-input

models auth add

添加模型认证。

openclaw models auth add

models auth setup-token

使用 Anthropic setup-token 认证。

openclaw models auth setup-token --provider anthropic

models auth paste-token

粘贴 token 认证。

openclaw models auth paste-token --provider openai --profile-id my-profile --expires-in 365d

models auth order

管理认证顺序。

openclaw models auth order get --provider anthropic
openclaw models auth order set --provider openai --agent my-agent profile1 profile2
openclaw models auth order clear --provider anthropic


📊 系统与健康

status

显示链接的会话健康状态和最近收件人。

选项:

  • --json - JSON 输出

  • --all - 完整诊断

  • --deep - 深度探测通道

  • --usage - 显示提供者使用情况/配额

  • --verbose - 详细输出

  • --timeout <ms> - 超时时间

示例:

openclaw status
openclaw status --deep --usage
openclaw status --jso

health

从运行的 Gateway 获取健康状态。

选项:

  • --json - JSON 输出

  • --verbose - 详细输出

  • --timeout <ms> - 超时时间

doctor

健康检查和快速修复(配置 + Gateway + 遗留服务)。

选项:

  • --no-workspace-suggestions - 禁用工作区提示

  • --yes - 自动接受默认值

  • --non-interactive - 跳过提示

  • --deep - 扫描系统服务的额外 Gateway 安装

示例:

openclaw doctor
openclaw doctor --deep --yes

logs

通过 RPC 追踪 Gateway 文件日志。

选项:

  • --follow - 持续跟踪

  • --limit <n> - 限制行数

  • --plain - 纯文本输出

  • --json - JSON 输出

  • --no-color - 禁用颜色

示例:

openclaw logs --follow
openclaw logs --limit 200
openclaw logs --json


🌐 Gateway 服务

gateway

运行 WebSocket Gateway。

选项:

  • --port <port> - 监听端口

  • --bind <loopback|tailnet|lan|auto> - 绑定模式

  • --token <token> - 认证 token

  • --auth <token|password> - 认证方式

  • --password <password> - 密码

  • --password-file <path> - 密码文件路径

  • --tailscale <off|serve|funnel> - Tailscale 模式

  • --dev - 开发模式

  • --force - 强制占用端口

  • --verbose - 详细输出

  • --ws-log <auto|full|compact> - WebSocket 日志级别

示例:

openclaw gateway --bind lan --port 3000
openclaw gateway --tailscale serve --dev

gateway status

显示 Gateway 状态。

openclaw gateway status
openclaw gateway status --json

gateway install

安装 Gateway 服务(launchd/systemd)。

选项:

  • --port <port> - 端口

  • --runtime <node|bun> - 运行时

  • --token <token> - 认证 token

  • --force - 强制安装

  • --json - JSON 输出

gateway uninstall

卸载 Gateway 服务。

openclaw gateway uninstall

gateway start / stop / restart

管理 Gateway 服务。

openclaw gateway start
openclaw gateway stop
openclaw gateway restart

gateway call

调用 Gateway RPC 方法。

openclaw gateway call config.get
openclaw gateway call config.apply --params '{"key":"value"}'

gateway health

检查 Gateway 健康状态。

gateway probe

探测 Gateway 服务。

gateway discover

发现 Gateway 实例。


🎯 节点与设备

nodes status

显示节点状态。

选项:

  • --connected - 仅显示已连接的节点

  • --last-connected <duration> - 最近连接的节点

nodes list

列出节点。

openclaw nodes list --connected
openclaw nodes list --last-connected 1h

nodes describe

查看节点详细信息。

openclaw nodes describe --node node-001

nodes pending

列出待审批的节点请求。

nodes approve / reject

审批或拒绝节点请求。

openclaw nodes approve <requestId>
openclaw nodes reject <requestId>

nodes rename

重命名节点。

openclaw nodes rename --node node-001 --name "New Name"

nodes invoke

在节点上调用命令。

openclaw nodes invoke --node node-001 --command system.exec --params '{"command":"ls -la"}'

nodes run

在节点上运行命令。

openclaw nodes run --node node-001 --cwd /tmp --command-timeout 60000 python script.py

nodes notify

发送通知到节点(macOS only)。

openclaw nodes notify --node node-001 --title "Hello" --body "Message"

nodes camera list / snap / clip

节点摄像头控制。

openclaw nodes camera list --node node-001
openclaw nodes camera snap --node node-001 --facing front --max-width 1920
openclaw nodes camera clip --node node-001 --duration 10s

nodes canvas snapshot / present / hide / navigate / eval / a2ui

节点画布和屏幕操作。

openclaw nodes canvas snapshot --node node-001 --format png
openclaw nodes canvas present --node node-001 --target https://example.com
openclaw nodes canvas hide --node node-001
openclaw nodes canvas navigate https://example.com --node node-001
openclaw nodes canvas eval "document.title" --node node-001

nodes screen record

节点屏幕录制。

openclaw nodes screen record --node node-001 --duration 30s --fps 30

nodes location get

获取节点位置信息。

openclaw nodes location get --node node-001 --accuracy precise


🌐 浏览器控制

browser status / start / stop

管理浏览器服务。

openclaw browser status
openclaw browser start
openclaw browser stop

browser tabs

列出浏览器标签页。

openclaw browser tabs

browser open

打开 URL。

openclaw browser open https://example.com

browser focus

聚焦到指定标签页。

openclaw browser focus <targetId>

browser close

关闭标签页。

openclaw browser close <targetId>

browser screenshot

截图。

openclaw browser screenshot
openclaw browser screenshot --full-page
openclaw browser screenshot --target-id <id> --type png

browser snapshot

获取页面快照。

openclaw browser snapshot --format aria
openclaw browser snapshot --target-id <id> --limit 50

browser navigate

导航到 URL。

openclaw browser navigate https://example.com --target-id <id>

browser resize

调整窗口大小。

openclaw browser resize 1920 1080

browser click / type / press / hover / drag / select

页面交互操作。

openclaw browser click <ref> --double
openclaw browser type <ref> "Hello" --submit
openclaw browser press Enter
openclaw browser hover <ref>
openclaw browser drag <startRef> <endRef>
openclaw browser select <ref> option1 option2

browser upload

上传文件。

openclaw browser upload /path/to/file.png --ref <input-ref>

browser fill

填充表单。

openclaw browser fill --fields '{"name":"John","email":"john@example.com"}'

browser dialog

处理对话框。

openclaw browser dialog --accept
openclaw browser dialog --dismiss --prompt "Enter text

browser wait

等待条件。

openclaw browser wait --time 1000
openclaw browser wait --text "Loading..." --text-gone

browser evaluate / execute

执行 JavaScript。

openclaw browser evaluate --fn "document.title" --ref <ref>

browser console

控制台操作。

openclaw browser console --level info --target-id <id>

browser pdf

导出 PDF。

openclaw browser pdf --target-id <id>

browser profiles / create-profile / delete-profile

管理浏览器配置文件。

openclaw browser profiles
openclaw browser create-profile --name MyProfile --color "#FF0000"
openclaw browser delete-profile --name MyProfile

browser reset-profile

重置浏览器配置文件。

openclaw browser reset-profile


📅 计划任务(Cron)

cron status

显示 cron 服务状态。

openclaw cron status --json

cron list

列出计划任务。

openclaw cron list
openclaw cron list --all --json

cron add

添加计划任务。

必需参数:

  • --name <name> - 任务名称

  • 以下之一:--at <time> | --every <duration> | --cron <expression>

  • 以下之一:--system-event <event> | --message <text>

示例:

openclaw cron add --name "Daily Brief" --every 1d --message "HEARTBEAT.md"
openclaw cron add --name "Event" --at "2025-03-15T09:00:00+08:00" --message "Morning"
openclaw cron add --name "Cron Job" --cron "0 9 * * *" --message "Run daily"

cron edit

编辑计划任务。

openclaw cron edit <id> --message "New message"

cron rm

删除计划任务。

openclaw cron rm <id>

cron enable / disable

启用/禁用任务。

openclaw cron enable <id>
openclaw cron disable <id>

cron runs

查看任务运行历史。

openclaw cron runs --id <task-id> --limit 10

cron run

手动运行任务。

openclaw cron run <id>
openclaw cron run <id> --force


🔧 其他工具

memory status / index / search

管理内存向量搜索。

openclaw memory status
openclaw memory index
openclaw memory search "what did I do yesterday"

system event / heartbeat / presence

系统事件和心跳控制。

openclaw system event --text "Event message" --mode now
openclaw system heartbeat enable --json
openclaw system presence --json

security audit

安全审计。

openclaw security audit
openclaw security audit --deep
openclaw security audit --fix

secrets reload / migrate / configure

密钥管理。

openclaw secrets reload
openclaw secrets migrate
openclaw secrets configure

skills list / info / check

技能管理。

openclaw skills list
openclaw skills list --eligible --json
openclaw skills info weather
openclaw skills check --verbose

plugins list / info / install / enable / disable / doctor

插件管理。

openclaw plugins list
openclaw plugins info <id>
openclaw plugins install /path/to/plugin
openclaw plugins enable <id>
openclaw plugins disable <id>
openclaw plugins doctor

pairing list / approve

配对管理。

openclaw pairing list --channel discord
openclaw pairing approve discord ABC123 --notify

devices list / approve / reject / remove / clear

设备管理。

openclaw devices list
openclaw devices approve <requestId>
openclaw devices reject <requestId>
openclaw devices remove <deviceId>
openclaw devices clear --yes

message

统一消息发送和通道操作。

子命令:

  • send - 发送消息

  • poll - 创建投票

  • react - 添加反应

  • reactions - 查看反应

  • read - 标记已读

  • edit - 编辑消息

  • delete - 删除消息

  • pin / unpin - 置顶/取消置顶

  • pins - 查看置顶

  • permissions - 权限管理

  • search - 搜索消息

  • timeout - 设置超时

  • kick - 踢出成员

  • ban - 封禁用户

示例:

openclaw message send --target +1234567890 --message "Hello"
openclaw message poll --channel discord --target channel:123 --poll-question "Choice?" --poll-option A --poll-option B

agent

运行 agent 轮次。

选项:

  • --message <text> - 消息内容(必填)

  • --to <dest> - 目标

  • --session-id <id> - 会话 ID

  • --thinking <off|minimal|low|medium|high|xhigh> - 推理级别

  • --verbose <on|full|off> - 详细输出

  • --channel <whatsapp|telegram|discord...> - 通道

  • --local - 本地运行

  • --deliver - 递送消息

  • --json - JSON 输出

示例:

openclaw agent --message "Help me with coding" --thinking medium
openclaw agent --message "Test" --to session:xyz --deliver

acp

运行 ACP 桥接器(连接 IDE 到 Gateway)。详见 openclaw acp --help

sessions

列出会话。

openclaw sessions --verbose
openclaw sessions --active 60 --json

docs

搜索实时文档索引。

openclaw docs search query
openclaw docs gateway authentication

tui

打开终端 UI 连接到 Gateway。

openclaw tui
openclaw tui --session <key> --deliver


第二部分:斜杠命令(Slash Commands)

以下命令在频道(飞书 等)的聊天窗口中直接输入,用于实时控制会话和 Agent 行为。


📋 会话管理(Session)

命令

说明

/session

管理会话级设置(例如:/session idle 设置空闲超时)

/stop

停止当前运行

/reset

重置当前会话

/new

开始新会话

/compact

压缩会话上下文


⚙️ 选项配置(Options)

命令

说明

/usage

显示使用统计或成本摘要

/think / /thinking / /t

设置思考级别(思考模式)

/verbose / /v

切换详细模式

/reasoning / /reason

切换推理可见性

/elevated / /elev

切换提升模式

/exec

为当前会话设置 exec 默认值

/model

显示或设置模型

/models

列出模型提供商或提供商模型

/queue

调整队列设置


📊 状态查询(Status)

命令

说明

/help

显示可用命令

/commands

列出所有斜杠命令

/status

显示当前状态

/context

解释上下文如何构建和使用

/export-session / /export

将当前会话导出为包含完整系统提示的 HTML 文件

/whoami / /id

显示你的发送者 ID


🔧 管理(Management)

命令

说明

/allowlist [text]

列出/添加/删除白名单条目

/approve

批准或拒绝 exec 请求

/subagents

列出、终止、记录、生成或指导此会话的子代理运行

/acp

管理 ACP 会话和运行时选项

/focus

将此 Discord 线程(或新线程)绑定到会话目标

/unfocus

移除当前的 Discord 线程绑定

/agents

列出此会话的线程绑定代理

/kill

终止正在运行的子代理(或全部)

/steer / /tell

向正在运行的子代理发送指导

/activation

设置组激活模式

/send

设置发送策略


🎙️ 媒体(Media)

命令

说明

/tts

控制文本转语音(TTS)


🛠️ 工具(Tools)

命令

说明

/skill

按名称运行技能

/restart

重启 OpenClaw


🚢 停靠切换(Docks)

命令

说明

/dock_telegram / /dock-telegram

切换到 Telegram 进行回复

/dock_discord / /dock-discord

切换到 Discord 进行回复

/dock_slack / /dock-slack

切换到 Slack 进行回复

/dock_feishu / /dock-feishu

切换到飞书进行回复


🔌 飞书插件(Plugins)

命令

说明

/feishu_diagnose

运行飞书插件诊断,检查配置、连通性和权限状态

/feishu_doctor

运行飞书插件诊断

/feishu_auth

飞书用户权限批量授权

/feishu

飞书插件命令(支持子命令:auth, onboarding, doctor)


🔗 相关链接

  • 官方网站:https://openclaw.ai

  • 官方文档:https://docs.openclaw.ai/zh-CN

  • GitHub:https://github.com/openclaw/openclaw

原作者:小AI