--- read_when: - 添加或修改 CLI 命令或选项 - 为新命令界面编写文档 summary: OpenClaw `openclaw` 命令、子命令和选项的 CLI 参考 title: CLI 参考 x-i18n: generated_at: "2026-02-03T07:47:54Z" model: claude-opus-4-5 provider: pi source_hash: a73923763d7b89d4b183f569d543927ffbfd1f3e02f9e66639913f6daf226850 source_path: cli/index.md workflow: 15 --- # CLI 参考 本页描述当前的 CLI 行为。如果命令发生变化,请更新此文档。 ## 命令页面 - [`setup`](/cli/setup) - [`onboard`](/cli/onboard) - [`configure`](/cli/configure) - [`config`](/cli/config) - [`doctor`](/cli/doctor) - [`dashboard`](/cli/dashboard) - [`reset`](/cli/reset) - [`uninstall`](/cli/uninstall) - [`update`](/cli/update) - [`message`](/cli/message) - [`agent`](/cli/agent) - [`agents`](/cli/agents) - [`acp`](/cli/acp) - [`status`](/cli/status) - [`health`](/cli/health) - [`sessions`](/cli/sessions) - [`gateway`](/cli/gateway) - [`logs`](/cli/logs) - [`system`](/cli/system) - [`models`](/cli/models) - [`memory`](/cli/memory) - [`nodes`](/cli/nodes) - [`devices`](/cli/devices) - [`node`](/cli/node) - [`approvals`](/cli/approvals) - [`sandbox`](/cli/sandbox) - [`tui`](/cli/tui) - [`browser`](/cli/browser) - [`cron`](/cli/cron) - [`dns`](/cli/dns) - [`docs`](/cli/docs) - [`hooks`](/cli/hooks) - [`webhooks`](/cli/webhooks) - [`pairing`](/cli/pairing) - [`plugins`](/cli/plugins)(插件命令) - [`channels`](/cli/channels) - [`security`](/cli/security) - [`skills`](/cli/skills) - [`voicecall`](/cli/voicecall)(插件;如已安装) ## 全局标志 - `--dev`:将状态隔离到 `~/.openclaw-dev` 下并调整默认端口。 - `--profile `:将状态隔离到 `~/.openclaw-` 下。 - `--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):标题、标签、主要高亮。 - `accentBright`(#FF7A3D):命令名称、强调。 - `accentDim`(#D14A22):次要高亮文本。 - `info`(#FF8A5B):信息性值。 - `success`(#2FBF71):成功状态。 - `warn`(#FFB020):警告、回退、注意。 - `error`(#E23D2D):错误、失败。 - `muted`(#8B7F77):弱化、元数据。 调色板权威来源:`src/terminal/palette.ts`(又名"lobster seam")。 ## 命令树 ``` openclaw [--dev] [--profile ] setup onboard configure config get set unset doctor security audit reset uninstall update channels list status logs add remove login logout skills list info check plugins list info install enable disable doctor memory status index search message agent agents list add delete acp status health sessions gateway call health status probe discover install uninstall start stop restart run logs system event heartbeat last|enable|disable presence models list status set set-image aliases list|add|remove fallbacks list|add|remove|clear image-fallbacks list|add|remove|clear scan auth add|setup-token|paste-token auth order get|set|clear sandbox list recreate explain cron status list add edit rm enable disable runs run nodes devices node run status install uninstall start stop restart approvals get set allowlist add|remove browser status start stop reset-profile tabs open focus close profiles create-profile delete-profile screenshot snapshot navigate resize click type press hover drag select upload fill dialog wait evaluate console pdf hooks list info check enable disable install update webhooks gmail setup|run pairing list approve docs dns setup tui ``` 注意:插件可以添加额外的顶级命令(例如 `openclaw voicecall`)。 ## 安全 - `openclaw security audit` — 审计配置 + 本地状态中常见的安全隐患。 - `openclaw security audit --deep` — 尽力进行实时 Gateway 网关探测。 - `openclaw security audit --fix` — 收紧安全默认值并 chmod 状态/配置。 ## 插件 管理扩展及其配置: - `openclaw plugins list` — 发现插件(使用 `--json` 获取机器可读输出)。 - `openclaw plugins info ` — 显示插件详情。 - `openclaw plugins install ` — 安装插件(或将插件路径添加到 `plugins.load.paths`)。 - `openclaw plugins enable ` / `disable ` — 切换 `plugins.entries..enabled`。 - `openclaw plugins doctor` — 报告插件加载错误。 大多数插件更改需要重启 Gateway 网关。参见 [/plugin](/plugin)。 ## 记忆 对 `MEMORY.md` + `memory/*.md` 进行向量搜索: - `openclaw memory status` — 显示索引统计。 - `openclaw memory index` — 重新索引记忆文件。 - `openclaw memory search ""` — 对记忆进行语义搜索。 ## 聊天斜杠命令 聊天消息支持 `/...` 命令(文本和原生)。参见 [/tools/slash-commands](/tools/slash-commands)。 亮点: - `/status` 用于快速诊断。 - `/config` 用于持久化配置更改。 - `/debug` 用于仅运行时的配置覆盖(内存中,不写入磁盘;需要 `commands.debug: true`)。 ## 设置 + 新手引导 ### `setup` 初始化配置 + 工作区。 选项: - `--workspace `:智能体工作区路径(默认 `~/.openclaw/workspace`)。 - `--wizard`:运行新手引导向导。 - `--non-interactive`:无提示运行向导。 - `--mode `:向导模式。 - `--remote-url `:远程 Gateway 网关 URL。 - `--remote-token `:远程 Gateway 网关令牌。 当存在任何向导标志(`--non-interactive`、`--mode`、`--remote-url`、`--remote-token`)时,向导自动运行。 ### `onboard` 交互式向导,用于设置 Gateway 网关、工作区和 Skills。 选项: - `--workspace ` - `--reset`(在向导之前重置配置 + 凭证 + 会话 + 工作区) - `--non-interactive` - `--mode ` - `--flow `(manual 是 advanced 的别名) - `--auth-choice ` - `--token-provider `(非交互式;与 `--auth-choice token` 配合使用) - `--token `(非交互式;与 `--auth-choice token` 配合使用) - `--token-profile-id `(非交互式;默认:`:manual`) - `--token-expires-in `(非交互式;例如 `365d`、`12h`) - `--anthropic-api-key ` - `--openai-api-key ` - `--openrouter-api-key ` - `--ai-gateway-api-key ` - `--moonshot-api-key ` - `--kimi-code-api-key ` - `--gemini-api-key ` - `--zai-api-key ` - `--minimax-api-key ` - `--opencode-zen-api-key ` - `--gateway-port ` - `--gateway-bind ` - `--gateway-auth ` - `--gateway-token ` - `--gateway-password ` - `--remote-url ` - `--remote-token ` - `--tailscale ` - `--tailscale-reset-on-exit` - `--install-daemon` - `--no-install-daemon`(别名:`--skip-daemon`) - `--daemon-runtime ` - `--skip-channels` - `--skip-skills` - `--skip-health` - `--skip-ui` - `--node-manager `(推荐 pnpm;不建议将 bun 用于 Gateway 网关运行时) - `--json` ### `configure` 交互式配置向导(模型、渠道、Skills、Gateway 网关)。 ### `config` 非交互式配置辅助工具(get/set/unset)。不带子命令运行 `openclaw config` 会启动向导。 子命令: - `config get `:打印配置值(点/括号路径)。 - `config set `:设置值(JSON5 或原始字符串)。 - `config unset `:删除值。 ### `doctor` 健康检查 + 快速修复(配置 + Gateway 网关 + 旧版服务)。 选项: - `--no-workspace-suggestions`:禁用工作区记忆提示。 - `--yes`:无提示接受默认值(无头模式)。 - `--non-interactive`:跳过提示;仅应用安全迁移。 - `--deep`:扫描系统服务以查找额外的 Gateway 网关安装。 ## 渠道辅助工具 ### `channels` 管理聊天渠道账户(WhatsApp/Telegram/Discord/Google Chat/Slack/Mattermost(插件)/Signal/iMessage/MS Teams)。 子命令: - `channels list`:显示已配置的渠道和认证配置文件。 - `channels status`:检查 Gateway 网关可达性和渠道健康状况(`--probe` 运行额外检查;使用 `openclaw health` 或 `openclaw status --deep` 进行 Gateway 网关健康探测)。 - 提示:`channels status` 在检测到常见配置错误时会打印带有建议修复的警告(然后指向 `openclaw doctor`)。 - `channels logs`:显示 Gateway 网关日志文件中最近的渠道日志。 - `channels add`:不传标志时使用向导式设置;标志切换到非交互模式。 - `channels remove`:默认禁用;传 `--delete` 可无提示删除配置条目。 - `channels login`:交互式渠道登录(仅限 WhatsApp Web)。 - `channels logout`:登出渠道会话(如支持)。 通用选项: - `--channel `:`whatsapp|telegram|discord|googlechat|slack|mattermost|signal|imessage|msteams` - `--account `:渠道账户 id(默认 `default`) - `--name