CLI 参考
本页面描述了当前 CLI 的行为。如果命令发生更改,请更新此文档。命令页面
setuponboardconfigureconfigdoctordashboardresetuninstallupdatemessageagentagentsacpstatushealthsessionsgatewaylogssystemmodelsmemorynodesdevicesnodeapprovalssandboxtuibrowsercrondnsdocshookswebhookspairingplugins(插件命令)channelssecurityskillsvoicecall(插件;若已安装)
全局标志
--dev:在--profile <name>下隔离状态,并调整默认端口。--profile <name>:在~/.openclaw-<name>下隔离状态。--no-color:禁用 ANSI 颜色。--update:是openclaw update的简写(仅适用于源码安装)。-V、--version、-v:打印版本并退出。
输出样式
- ANSI 颜色和进度指示器仅在 TTY 会话中渲染。
- 在支持的终端中,OSC-8 超链接显示为可点击链接;否则,我们将回退到普通 URL。
--json(以及在支持的情况下--plain)会禁用样式,以生成简洁的输出。--no-color会禁用 ANSI 样式;同时也会尊重NO_COLOR=1。- 长时间运行的命令会显示进度指示器(在支持的情况下使用 OSC 9;4)。
色彩调色板
OpenClaw 在 CLI 输出中使用龙虾色调色板。accent(#FF5A2D):标题、标签、主要高亮。accentDim(#FF7A3D):命令名称、强调。accentDim(#D14A22):次要高亮文本。info(#FF8A5B):信息性数值。success(#2FBF71):成功状态。warn(#FFB020):警告、回退、注意。error(#E23D2D):错误、失败。muted(#8B7F77):弱化、元数据。
src/terminal/palette.ts(又称“龙虾缝”)。
命令树
openclaw voicecall)。
安全
openclaw security audit— 审计配置 + 本地状态,以防范常见的安全漏洞。openclaw security audit --deep— 尽力而为的实时网关探测。openclaw security audit --fix— 加强安全默认设置,并调整状态/配置的权限。
插件
管理扩展及其配置:openclaw plugins list— 发现插件(使用--json获取机器可读输出)。openclaw plugins info <id>— 显示插件的详细信息。openclaw plugins install <path|.tgz|npm-spec>— 安装插件(或将插件路径添加到plugins.load.paths)。openclaw plugins enable <id>/disable <id>— 切换plugins.entries.<id>.enabled。openclaw plugins doctor— 报告插件加载错误。
内存
对MEMORY.md + memory/*.md 进行向量搜索:
openclaw memory status— 显示索引统计信息。openclaw memory search "<query>"— 重新索引内存文件。openclaw memory search "<query>"— 对内存进行语义搜索。
聊天斜杠命令
聊天消息支持/... 命令(文本和原生)。请参阅 /tools/slash-commands。
亮点:
/status用于快速诊断。/config用于持久化的配置更改。/debug用于仅在运行时生效的配置覆盖(存储在内存而非磁盘;需要commands.debug: true)。
设置 + 上手
INLINE_CODE_0
初始化配置 + 工作区。 选项:--workspace <dir>:代理工作区路径(默认~/.openclaw/workspace)。--wizard:运行上手向导。--non-interactive:在没有提示的情况下运行向导。--mode <local|remote>:向导模式。--remote-url <url>:远程网关 URL。--remote-token <token>:远程网关令牌。
--non-interactive、--mode、--remote-url、--remote-token),向导会自动运行。
INLINE_CODE_0
交互式向导,用于设置网关、工作区和技能。 选项:--workspace <dir>--non-interactive(在向导之前重置配置 + 凭证 + 会话 + 工作区)--non-interactive--mode <local|remote>--flow <quickstart|advanced|manual>(manual 是 advanced 的别名)--auth-choice <setup-token|token|chutes|openai-codex|openai-api-key|openrouter-api-key|ai-gateway-api-key|moonshot-api-key|kimi-code-api-key|synthetic-api-key|venice-api-key|gemini-api-key|zai-api-key|apiKey|minimax-api|minimax-api-lightning|opencode-zen|skip>--token-provider <id>(非交互式;与--auth-choice token一起使用)--token <token>(非交互式;与--auth-choice token一起使用)--token-profile-id <id>(非交互式;默认:<provider>:manual)--token-expires-in <duration>(非交互式;例如365d、12h)--anthropic-api-key <key>--openai-api-key <key>--openrouter-api-key <key>--ai-gateway-api-key <key>--moonshot-api-key <key>--kimi-code-api-key <key>--gemini-api-key <key>--zai-api-key <key>--minimax-api-key <key>--opencode-zen-api-key <key>--gateway-port <port>--gateway-bind <loopback|lan|tailnet|auto|custom>--gateway-auth <token|password>--gateway-token <token>--gateway-password <password>--remote-url <url>--remote-token <token>--tailscale <off|serve|funnel>--tailscale-reset-on-exit--install-daemon--no-install-daemon(别名:--skip-daemon)--daemon-runtime <node|bun>--skip-channels--skip-skills--skip-health--skip-ui--node-manager <npm|pnpm|bun>(推荐使用 pnpm;不推荐在 Gateway 运行时使用 bun)--json
INLINE_CODE_0
交互式配置向导(模型、渠道、技能、网关)。INLINE_CODE_0
非交互式配置助手(获取/设置/取消设置)。运行openclaw config 且不带子命令时,将启动向导。
子命令:
config get <path>:打印配置值(点/方括号路径)。config unset <path>:设置值(JSON5 或原始字符串)。config unset <path>:删除一个值。
INLINE_CODE_0
健康检查 + 快速修复(配置 + 网关 + 旧版服务)。 选项:--no-workspace-suggestions:禁用工作区内存提示。--non-interactive:接受默认设置,不显示提示(无头模式)。--non-interactive:跳过提示;仅执行安全迁移。--deep:扫描系统服务,查找额外的网关安装。
INLINE_CODE_0
管理聊天渠道账户(WhatsApp/Telegram/Discord/Google Chat/Slack/Mattermost(插件)/Signal/iMessage/MS Teams)。 子命令:channels list:显示已配置的渠道和认证资料。--probe:检查网关可达性和渠道健康状况(--probe执行额外的检查;使用openclaw health或openclaw status --deep进行网关健康探测)。- 提示:当检测到常见配置错误时,
channels status会打印警告并提供修复建议(随后引导您前往openclaw doctor)。 channels logs:从网关日志文件中显示最近的渠道日志。channels add:在未传递任何标志时,采用向导式设置;标志切换到非交互式模式。channels remove:默认禁用;传递--delete可以在不提示的情况下移除配置条目。channels login:交互式渠道登录(仅限 WhatsApp Web)。channels logout:注销渠道会话(如果支持)。
--channel <name>:whatsapp|telegram|discord|googlechat|slack|mattermost|signal|imessage|msteams--account <id>:渠道账户 ID(默认default)--name <label>:账户的显示名称
channels login 选项:
--channel <channel>(默认whatsapp;支持whatsapp/web)--account <id>--verbose
channels logout 选项:
--channel <channel>(默认whatsapp)--account <id>
channels list 选项:
--no-usage:跳过模型提供商使用情况/配额快照(仅 OAuth/API 支持)。--no-usage:输出 JSON(包括使用情况,除非设置了--no-usage)。
channels logs 选项:
--channel <name|all>(默认all)200(默认200)--json
INLINE_CODE_0
列出并检查可用技能及就绪信息。 子命令:skills list:列出技能(无子命令时默认)。skills info <name>:显示单个技能的详细信息。skills check:总结已满足与缺失的要求。
--eligible:仅显示已就绪的技能。--json:输出 JSON(无样式)。-v、--verbose:包含缺失要求的详细信息。
npx clawhub 来搜索、安装和同步技能。
INLINE_CODE_0
批准跨渠道的直邮匹配请求。 子命令:pairing list <channel> [--json]pairing approve <channel> <code> [--notify]
INLINE_CODE_0
Gmail Pub/Sub 钩子设置与运行器。请参阅 /automation/gmail-pubsub。 子命令:webhooks gmail setup(需要--account <email>;支持--project、--topic、--subscription、--label、--hook-url、--hook-token、--push-token、--bind、--port、--path、--include-body、--max-bytes、--renew-minutes、--tailscale、--tailscale-path、--tailscale-target、--push-endpoint、--json)webhooks gmail run(针对相同标志的运行时覆盖)
INLINE_CODE_0
广域发现 DNS 助手(CoreDNS + Tailscale)。请参阅 /gateway/discovery。 选项:--apply:安装或更新 CoreDNS 配置(需要使用 sudo;仅适用于 macOS)。
INLINE_CODE_0
统一的出站消息传递与渠道操作。 详情:/cli/message 子命令:message send|poll|react|reactions|read|edit|delete|pin|unpin|pins|permissions|search|timeout|kick|banmessage thread <create|list|reply>message emoji <list|upload>message sticker <send|upload>message role <info|add|remove>message channel <info|list>message member infomessage voice statusmessage event <list|create>
openclaw message send --target +15555550123 --message "Hi"openclaw message poll --channel discord --target channel:123 --poll-question "Snack?" --poll-option Pizza --poll-option Sushi
INLINE_CODE_0
通过网关运行一次代理回合(或嵌入--local)。
必需:
--message <text>
--to <dest>(用于会话密钥和可选交付)--session-id <id>--thinking <off|minimal|low|medium|high|xhigh>(仅 GPT-5.2 + Codex 模型)--verbose <on|full|off>--channel <whatsapp|telegram|discord|slack|mattermost|signal|imessage|msteams>--local--deliver--json--timeout <seconds>
INLINE_CODE_0
管理隔离的代理(工作区 + 认证 + 路由)。INLINE_CODE_0
列出已配置的代理。 选项:--json--bindings
INLINE_CODE_0
添加一个新的隔离代理。除非传递了标志(或--non-interactive),否则会运行引导向导;在非交互式模式下,必须使用 --workspace。
选项:
--workspace <dir>--agent-dir <dir>--agent-dir <dir>--bind <channel[:accountId]>(可重复)--non-interactive--json
channel[:accountId]。当 WhatsApp 缺少 accountId 时,将使用默认账户 ID。
INLINE_CODE_0
删除代理并清理其工作区和状态。 选项:--force--json
INLINE_CODE_0
运行连接 IDE 和网关的 ACP 桥。 完整选项和示例请参见acp。
INLINE_CODE_0
显示关联会话的健康状况和最近的接收者。 选项:--json--all(全面诊断;只读,可粘贴)--deep(探测渠道)--usage(显示模型提供商的使用情况/配额)--timeout <ms>--verbose--debug(是--verbose的别名)
- 概览包括网关和节点主机服务的状态(如有)。
使用跟踪
当拥有 OAuth/API 凭据时,OpenClaw 可以显示提供商的使用情况和配额。 显示内容:/status(在可用时添加一行简短的提供商使用情况)openclaw status --usage(打印完整的提供商细分)- macOS 菜单栏(上下文中的“使用”部分)
- 数据直接来自提供商的使用端点,不涉及任何估算。
- 支持的提供商包括:Anthropic、GitHub Copilot、OpenAI Codex OAuth 以及 Gemini CLI/Antigravity,前提是这些提供商插件已启用。
- 如果找不到匹配的凭据,使用情况将被隐藏。
- 有关更多详细信息,请参阅 使用跟踪。
INLINE_CODE_0
从正在运行的网关获取健康信息。 选项:--json--timeout <ms>--verbose
INLINE_CODE_0
列出存储的对话会话。 选项:--json--verbose--store <path>--active <minutes>
INLINE_CODE_0
重置本地配置/状态(保留 CLI 安装)。 选项:--scope <config|config+creds+sessions|full>--yes--non-interactive--dry-run
--non-interactive需要--scope和--yes。
INLINE_CODE_0
卸载网关服务 + 本地数据(CLI 保留)。 选项:--service--state--workspace--app--all--yes--non-interactive--dry-run
--non-interactive需要--yes和明确的范围(或--all)。
网关
INLINE_CODE_0
运行 WebSocket 网关。 选项:--port <port>--token <token>--token <token>--auth <token|password>--password <password>--tailscale <off|serve|funnel>--tailscale-reset-on-exit--allow-unconfigured--dev--reset(重置开发配置 + 凭证 + 会话 + 工作区)--force(终止端口上的现有监听器)--verbose--claude-cli-logs--ws-log <auto|full|compact>--compact(是--ws-log compact的别名)--raw-stream--raw-stream-path <path>
INLINE_CODE_0
管理网关服务(launchd/systemd/schtasks)。 子命令:gateway status(默认探测网关 RPC)gateway install(安装服务)gateway uninstallgateway startgateway stopgateway restart
gateway status默认使用服务解析的端口/配置来探测网关 RPC(可用gateway status进行覆盖)。gateway status支持--no-probe、--deep和--json用于脚本编写。gateway status还会在检测到时显示遗留或额外的网关服务(--deep添加系统级扫描)。以 Profile 命名的 OpenClaw 服务被视为一流服务,不会被标记为“额外”。gateway status打印 CLI 使用的配置路径与服务可能使用的配置路径(服务环境),以及解析后的探测目标 URL。gateway install|uninstall|start|stop|restart支持--json用于脚本编写(默认输出保持人性化)。gateway install默认使用 Node 运行时;不推荐使用 bun(WhatsApp/Telegram 错误)。gateway install选项:--port、--runtime、--token、--force、--json。
INLINE_CODE_0
通过 RPC 尾部查看网关文件日志。 注释:- TTY 会话会呈现彩色、结构化的视图;非 TTY 则回退到纯文本。
--json输出以分隔行分隔的 JSON(每行一个日志事件)。
INLINE_CODE_0
网关 CLI 助手(使用--url、--token、--password、--timeout、--expect-final 处理 RPC 子命令)。
子命令:
gateway call <method> [--params <json>]gateway statusgateway statusgateway probegateway discovergateway install|uninstall|start|stop|restartgateway run
config.apply(验证 + 写入配置 + 重启 + 唤醒)config.patch(合并部分更新 + 重启 + 唤醒)update.run(执行更新 + 重启 + 唤醒)
config.set/config.apply/config.patch 时,如果已有配置,应从 config.get 传递 baseHash。
模型
有关回退行为和扫描策略,请参阅 /concepts/models。 首选 Anthropic 认证(设置令牌):models(根)
openclaw models 是 models status 的别名。
根选项:
--status-json(是models status --json的别名)--status-plain(是models status --plain的别名)
INLINE_CODE_0
选项:--all--local--provider <name>--json--plain
INLINE_CODE_0
选项:--json--plain--check(退出 1=已过期/缺失,2=即将到期)--probe(对已配置的认证资料进行实时探测)--probe-provider <name>--probe-profile <id>(可重复或用逗号分隔)--probe-timeout <ms>--probe-concurrency <n>--probe-max-tokens <n>
--probe 执行实时请求(可能会消耗令牌并触发速率限制)。
INLINE_CODE_0
设置agents.defaults.model.primary。
INLINE_CODE_0
设置agents.defaults.imageModel.primary。
INLINE_CODE_0
选项:list:--json、--plainadd <alias> <model>remove <alias>
INLINE_CODE_0
选项:list:--json、--plainadd <model>remove <model>clear
INLINE_CODE_0
选项:list:--json、--plainadd <model>remove <model>clear
INLINE_CODE_0
选项:--min-params <b>--max-age-days <days>--provider <name>--max-candidates <n>--timeout <ms>--concurrency <n>--no-probe--yes--no-input--set-default--set-image--json
INLINE_CODE_0
选项:add:交互式认证助手setup-token:--provider <name>(默认anthropic)、--yespaste-token:--provider <name>、--profile-id <id>、--expires-in <duration>
INLINE_CODE_0
选项:get:--provider <name>、--agent <id>、--jsonset:--provider <name>、--agent <id>、<profileIds...>clear:--provider <name>、--agent <id>
系统
INLINE_CODE_0
将一个系统事件加入队列,并可选择触发心跳(网关 RPC)。 必需:--text <text>
--mode <now|next-heartbeat>--json--url、--token、--timeout、--expect-final
INLINE_CODE_0
心跳控制(网关 RPC)。 选项:--json--url、--token、--timeout、--expect-final
INLINE_CODE_0
列出系统中存在的条目(网关 RPC)。 选项:--json--url、--token、--timeout、--expect-final
定时任务
管理计划任务(网关 RPC)。请参阅 /automation/cron-jobs。 子命令:cron status [--json]cron list [--all] [--json](默认输出表格;使用--json获取原始数据)cron add(别名:create;需要--name并且必须精确地选择--at|--every|--cron,以及精确地选择一个有效载荷--system-event|--message)cron edit <id>(修补字段)cron rm <id>(别名:remove、delete)cron enable <id>cron disable <id>cron runs --id <id> [--limit <n>]cron run <id> [--force]
cron 命令都接受 --url、--token、--timeout、--expect-final。
节点主机
node 运行无头节点主机,或将其作为后台服务进行管理。请参阅 openclaw node。
子命令:
node run --host <gateway-host> --port 18789node statusnode install [--host <gateway-host>] [--port <port>] [--tls] [--tls-fingerprint <sha256>] [--node-id <id>] [--display-name <name>] [--runtime <node|bun>] [--force]node uninstallnode stopnode restart
nodes 与网关通信,并瞄准配对的节点。请参阅 /nodes。
常见选项:
--url、--token、--timeout、--json
nodes status [--connected] [--last-connected <duration>]nodes describe --node <id|name|ip>nodes list [--connected] [--last-connected <duration>]nodes pendingnodes approve <requestId>nodes reject <requestId>nodes rename --node <id|name|ip> --name <displayName>nodes invoke --node <id|name|ip> --command <command> [--params <json>] [--invoke-timeout <ms>] [--idempotency-key <key>]nodes run --node <id|name|ip> [--cwd <path>] [--env KEY=VAL] [--command-timeout <ms>] [--needs-screen-recording] [--invoke-timeout <ms>] <command...>(mac 节点或无头节点主机)nodes notify --node <id|name|ip> [--title <text>] [--body <text>] [--sound <name>] [--priority <passive|active|timeSensitive>] [--delivery <system|overlay|auto>] [--invoke-timeout <ms>](仅适用于 mac)
nodes camera list --node <id|name|ip>nodes camera snap --node <id|name|ip> [--facing front|back|both] [--device-id <id>] [--max-width <px>] [--quality 小于 0-1>] [--delay-ms <ms>] [--invoke-timeout <ms>]nodes camera clip --node <id|name|ip> [--facing front|back] [--device-id <id>] [--duration <ms|10s|1m>] [--no-audio] [--invoke-timeout <ms>]
nodes canvas snapshot --node <id|name|ip> [--format png|jpg|jpeg] [--max-width <px>] [--quality 小于 0-1>] [--invoke-timeout <ms>]nodes canvas present --node <id|name|ip> [--target <urlOrPath>] [--x <px>] [--y <px>] [--width <px>] [--height <px>] [--invoke-timeout <ms>]nodes canvas hide --node <id|name|ip> [--invoke-timeout <ms>]nodes canvas navigate <url> --node <id|name|ip> [--invoke-timeout <ms>]nodes canvas eval [<js>] --node <id|name|ip> [--js <code>] [--invoke-timeout <ms>]nodes canvas a2ui push --node <id|name|ip> (--jsonl <path> | --text <text>) [--invoke-timeout <ms>]nodes canvas a2ui reset --node <id|name|ip> [--invoke-timeout <ms>]nodes screen record --node <id|name|ip> [--screen <index>] [--duration <ms|10s>] [--fps <n>] [--no-audio] [--out <path>] [--invoke-timeout <ms>]
nodes location get --node <id|name|ip> [--max-age <ms>] [--accuracy <coarse|balanced|precise>] [--location-timeout <ms>] [--invoke-timeout <ms>]
浏览器
浏览器控制 CLI(专用于 Chrome/Brave/Edge/Chromium)。请参阅openclaw browser 和 浏览器工具。
常见选项:
--url、--token、--timeout、--json--browser-profile <name>
browser statusbrowser startbrowser stopbrowser reset-profilebrowser tabsbrowser open <url>browser focus <targetId>browser close [targetId]browser profilesbrowser create-profile --name <name> [--color <hex>] [--cdp-url <url>]browser delete-profile --name <name>
browser screenshot [targetId] [--full-page] [--ref <ref>] [--element <selector>] [--type png|jpeg]browser snapshot [--format aria|ai] [--target-id <id>] [--limit <n>] [--interactive] [--compact] [--depth <n>] [--selector <sel>] [--out <path>]
browser navigate <url> [--target-id <id>]browser resize <width> <height> [--target-id <id>]browser click <ref> [--double] [--button <left|right|middle>] [--modifiers <csv>] [--target-id <id>]browser type <ref> <text> [--submit] [--slowly] [--target-id <id>]browser press <key> [--target-id <id>]browser hover <ref> [--target-id <id>]browser drag <startRef> <endRef> [--target-id <id>]browser select <ref> <values...> [--target-id <id>]browser upload <paths...> [--ref <ref>] [--input-ref <ref>] [--element <selector>] [--target-id <id>] [--timeout-ms <ms>]browser fill [--fields <json>] [--fields-file <path>] [--target-id <id>]browser dialog --accept|--dismiss [--prompt <text>] [--target-id <id>] [--timeout-ms <ms>]browser wait [--time <ms>] [--text <value>] [--text-gone <value>] [--target-id <id>]browser evaluate --fn <code> [--ref <ref>] [--target-id <id>]browser console [--level <error|warn|info>] [--target-id <id>]browser pdf [--target-id <id>]
文档搜索
INLINE_CODE_0
搜索实时文档索引。图易
INLINE_CODE_0
打开与网关相连的终端用户界面。 选项:--url <url>--password <password>--password <password>--session <key>--deliver--thinking <level>--message <text>--timeout-ms <ms>(默认为agents.defaults.timeoutSeconds)