OpenClaw 命令行大全

基于本机安装版本 OpenClaw 2026.7.1-2 的官方文档(docs/cli/*.md)与 openclaw --help 整理。
在线文档:https://docs.openclaw.ai/cli 运行 openclaw <命令> --help 可查看每个命令的完整参数。


目录

  1. 基本用法与全局选项
  2. 安装、配置与引导
  3. Gateway 运行与管理
  4. 状态、健康与日志
  5. 消息与频道
  6. Agent 与会话
  7. 模型与推理
  8. 记忆与承诺
  9. 自动化:cron / tasks / hooks / webhooks
  10. 安全与权限
  11. 插件与技能
  12. 节点与设备
  13. 浏览器控制
  14. 沙箱
  15. MCP / ACP / 附加
  16. 备份、迁移、更新、重置、卸载
  17. 其他工具
  18. Shell 补全与聊天斜杠命令

1. 基本用法与全局选项

openclaw [全局选项] <command> [子命令] [参数]

全局选项

选项 说明
--container <name> 在指定的 Podman/Docker 容器内运行 CLI(默认读 OPENCLAW_CONTAINER
--dev 开发模式:状态隔离到 ~/.openclaw-dev,Gateway 默认端口 19001
--profile <name> 使用命名配置档,隔离状态到 ~/.openclaw-<name>
--log-level <level> 覆盖日志级别:silent|fatal|error|warn|info|debug|trace
--no-color 关闭 ANSI 颜色(也尊重 NO_COLOR=1
--update 等价于 openclaw update
-V, --version 打印版本号
-h, --help 显示帮助

输出约定

  • --json:机器可读 JSON 输出(禁用样式/进度条)
  • --plain:纯文本输出
  • TTY 终端才有颜色与进度条;OSC-8 超链接在支持处可点击
  • 主色调为龙虾色系:accent #FF5A2D、success #2FBF71、warn #FFB020、error #E23D2D

无子命令时的行为

  • 配置文件缺失/无内容 → 启动经典引导(onboard)
  • 配置存在但校验失败 → 启动 Crestodian 修复
  • 配置有效 → 打开 agent TUI(优先连 Gateway,连不上则本地模式)

2. 安装、配置与引导

openclaw onboard(= openclaw setup

引导式初始化:模型认证、工作区、Gateway、频道、技能、健康检查。

openclaw onboard
openclaw onboard --flow quickstart        # 最少提问,自动生成 gateway token
openclaw onboard --flow manual            # 完整提问(端口/bind/auth)
openclaw onboard --flow import            # 从其他 agent 系统迁移导入
openclaw onboard --import-from hermes --import-source ~/.hermes
openclaw onboard --mode remote --remote-url wss://gateway-host:18789
openclaw onboard --skip-bootstrap
openclaw onboard --modern                 # 用 Crestodian 对话式引导

openclaw setup

与 onboard 相同的引导流程,另支持:

openclaw setup --baseline                # 只创建基础 config/workspace/session 目录
openclaw setup --workspace ~/.openclaw/workspace
openclaw setup --non-interactive --accept-risk
openclaw setup --reset --reset-scope full

openclaw configure

交互式修改已有配置的指定部分(需要 TTY):

openclaw configure
openclaw configure --section web          # 可选:workspace/model/web/gateway/daemon/channels/plugins/skills/health
openclaw configure --section model --section channels

openclaw config

非交互式读写 openclaw.json(点号或括号路径):

openclaw config file                      # 打印配置文件路径
openclaw config get agents.defaults.workspace
openclaw config get 'agents.list[0].id' --json
openclaw config set agents.defaults.heartbeat.every "2h"
openclaw config set browser.executablePath "/usr/bin/google-chrome"
openclaw config set channels.discord.token --ref-provider default --ref-source env --ref-id DISCORD_BOT_TOKEN
openclaw config set agents.defaults.models '{"openai/gpt-5.4":{}}' --strict-json --merge
openclaw config patch --file ./openclaw.patch.json5 --dry-run
openclaw config unset plugins.entries.brave.config.webSearch.apiKey
openclaw config schema                     # 打印 JSON Schema(可重定向到文件)
openclaw config validate [--json]
openclaw config --section gateway          # 不带子命令时 = configure 向导

openclaw crestodian

配置安全型的设置/修复助手;配置文件损坏、Gateway 挂掉时仍可用:

openclaw crestodian                        # 交互式 TUI
openclaw crestodian --message "status"     # 非交互:请求状态清单

openclaw doctor

健康检查 + 引导修复(首选排查命令):

openclaw doctor                           # 检查模式
openclaw doctor --fix                     # 应用修复
openclaw doctor --lint [--json]           # 只读结构化发现(CI 用)
openclaw doctor --deep                    # 扫描系统级服务
openclaw doctor --generate-gateway-token  # 生成并配置 gateway token
openclaw doctor --post-upgrade [--json]   # 升级后插件兼容性探测
openclaw doctor --fix --non-interactive

openclaw completion

生成/安装 shell 补全脚本(zsh 默认,支持 bash/powershell/fish):

openclaw completion                        # 打印 zsh 脚本
openclaw completion --shell fish
openclaw completion --write-state          # 缓存到 ~/.openclaw/completions
openclaw completion --write-state --install

openclaw dashboard

用当前 token 打开 Control UI:

openclaw dashboard
openclaw dashboard --no-open               # 只打印 URL
openclaw dashboard --yes                   # 必要时自动启动 Gateway

3. Gateway 运行与管理

openclaw gateway

openclaw gateway                           # 前台运行(等价 gateway run)
openclaw gateway run --force               # 启动并干掉占用端口的进程
openclaw gateway run --port 18789 --bind loopback|lan|tailnet|auto|custom
openclaw gateway run --auth token --token <token>
openclaw gateway run --auth password --password-file <path>
openclaw gateway run --tailscale serve|funnel
openclaw gateway run --allow-unconfigured  # 绕过 gateway.mode=local 守卫(临时)
openclaw gateway run --dev --reset         # 开发配置,重置

服务生命周期(macOS launchd / Linux systemd / Windows schtasks)

openclaw gateway install [--port 18789] [--runtime node] [--wrapper <path>] [--force]
openclaw gateway start
openclaw gateway stop [--disable]          # --disable 持久禁用 KeepAlive(launchd)
openclaw gateway restart
openclaw gateway restart --safe            # 等活跃工作排空后合并重启
openclaw gateway restart --safe --skip-deferral
openclaw gateway restart --force           # 立即重启
openclaw gateway restart --wait 30s        # 自定义排空预算
openclaw gateway uninstall

openclaw daemon 是 legacy 别名,子命令与参数相同:daemon status|install|start|stop|restart|uninstall

查询运行中的 Gateway(WebSocket RPC)

openclaw gateway health --port 18789                       # /healthz 存活探测
openclaw gateway health --url ws://127.0.0.1:18789
openclaw gateway status [--json] [--no-probe] [--deep] [--require-rpc]
openclaw gateway probe [--json] [--port 18789]             # “调试一切”探测
openclaw gateway probe --ssh user@host                     # 经 SSH 隧道探测远端
openclaw gateway call status                               # 底层 RPC
openclaw gateway call logs.tail --params '{"limit": 200}'
openclaw gateway usage-cost [--days 7] [--agent work] [--all-agents] [--json]
openclaw gateway stability [--type payload.large] [--json] # 诊断稳定性记录
openclaw gateway stability --bundle latest --export        # 导出诊断 zip
openclaw gateway diagnostics export [--output diag.zip]    # 故障上报包
openclaw gateway discover [--timeout 4000] [--json]        # Bonjour 发现

查询命令通用:--url--token--password--timeout <ms>--expect-final--json。设置 --url 后不会回退到配置凭据,需显式传 --token/--password


4. 状态、健康与日志

openclaw status

openclaw status                 # 快速诊断(只读快路径)
openclaw status --all           # 完整诊断(含安全审计/插件兼容/内存向量探测)
openclaw status --deep          # 实时探测各频道 + 安全审计
openclaw status --usage         # 供应商用量 `X% left`
openclaw status --json

openclaw health

openclaw health                  # Gateway 健康快照(缓存≤60s)
openclaw health --verbose        # 强制实时探测所有账号/agent
openclaw health --json --timeout 2500

openclaw logs

openclaw logs                     # 最近 200 行
openclaw logs --follow            # 跟随(自动重连,指数退避)
openclaw logs --limit 500 --max-bytes 500000
openclaw logs --json | --plain | --no-color | --utc | --local-time
openclaw logs --url ws://127.0.0.1:18789 --token "$OPENCLAW_GATEWAY_TOKEN"

openclaw system

openclaw system event --text "检查紧急跟进" --mode now       # 注入系统事件(now / next-heartbeat)
openclaw system event --text "..." --session-key agent:main:main
openclaw system heartbeat last | enable | disable
openclaw system presence                                      # 列出系统在场条目

openclaw audit

元数据级审计账本(agent 运行 / 工具动作;不含消息内容):

openclaw audit
openclaw audit --agent main --status failed
openclaw audit --kind tool_action --limit 50 --json
openclaw audit --run <run-id> --after 2026-07-01T00:00:00Z

5. 消息与频道

openclaw message

跨 Discord / Google Chat / iMessage / Matrix / Mattermost / Teams / Signal / Slack / Telegram / WhatsApp 的统一发消息命令。

openclaw message send --channel telegram --target @mychat --message "Hi"
openclaw message send --channel discord --target channel:123 --message "hi" --reply-to 456
openclaw message send --channel telegram --target @mychat --media ./diagram.png --force-document
openclaw message send --channel telegram --target 123456789 --message "选一个:" \
  --presentation '{"blocks":[{"type":"buttons","buttons":[{"label":"是","value":"cmd:yes"},{"label":"否","value":"cmd:no"}]}]}'
openclaw message poll --channel discord --target channel:123 \
  --poll-question "零食?" --poll-option Pizza --poll-option Sushi --poll-multi
openclaw message react --channel telegram --target @mychat --message-id 42 --emoji 👍
openclaw message reactions --channel slack --target channel:C123 --message-id 42
openclaw message read --channel slack --target channel:C123 --limit 20
openclaw message edit --channel telegram --target @mychat --message-id 42 --message "更正"
openclaw message delete --channel telegram --target @mychat --message-id 42
openclaw message pin / unpin / pins
openclaw message permissions --channel discord --target channel:123
openclaw message search --channel discord --guild-id <id> --query "关键词"
openclaw message thread create|list|reply
openclaw message emoji list|upload · sticker send|upload · role info|add|remove
openclaw message timeout / kick / ban · member info · channel info|list
openclaw message voice status · event list|create

常用参数--channel <name>--account <id>-t/--target <dest>--message--media <path|url>--presentation <json>--reply-to <id>--thread-id <id>--pin--silent--dry-run--json--verbose

target 格式速查(部分):

频道 格式
Discord channel:<id>user:<id><@id> 或裸数字 id
Telegram chat id、@username<chatId>:topic:<topicId>
Signal +E.164group:<id>uuid:<id>username:<name>
Slack channel:<id>user:<id>
WhatsApp E.164、群 JID ...@g.us、频道 JID ...@newsletter
Matrix @user:server!room:server#alias:server
Teams conversation:<id>19:...@thread.tacv2)或 user:<aad-id>

openclaw channels

openclaw channels list [--all] [--json]
openclaw channels status [--probe] [--channel <name>] [--json]
openclaw channels capabilities [--channel discord --target channel:123]
openclaw channels resolve --channel slack "#general" "@jane"      # 名称解析为 ID
openclaw channels logs [--channel all] [--lines 200]
openclaw channels add --channel telegram --token <bot-token>      # 无参数=交互向导
openclaw channels add --channel nostr --private-key "$KEY"
openclaw channels remove --channel telegram --delete
openclaw channels login --channel whatsapp                        # 交互式登录(需在终端)
openclaw channels logout --channel whatsapp

添加账号常用非交互参数:--account--token/--token-file--bot-token--app-token--secret--password--cli-path--url--auth-dir--use-env 等;各频道另有专属参数(如 Matrix 的 --homeserver、Signal 的 --signal-number、WhatsApp 的 --auth-dir)。

openclaw directory

查找联系人/群/自己(用于 message send --target):

openclaw directory self --channel zalouser
openclaw directory peers list --channel slack --query "U0" --limit 50
openclaw directory groups list --channel telegram
openclaw directory groups members --channel discord --group <id>

openclaw pairing / openclaw qr

openclaw pairing list telegram
openclaw pairing approve <code> [--notify]        # 批准 DM 配对请求
openclaw qr                                        # 生成手机 App 配对二维码 + setup code
openclaw qr --setup-code-only
openclaw qr --remote --json

6. Agent 与会话

openclaw agent

通过 Gateway 跑一次 agent turn(脚本友好):

openclaw agent --to +15555550123 --message "status update" --deliver
openclaw agent --agent ops --message "Summarize logs" --message-file ./task.md
openclaw agent --agent ops --model openai/gpt-5.4 --thinking medium --message "..."
openclaw agent --session-key agent:ops:incident-42 --message "..."
openclaw agent --agent ops --message "..." --deliver --reply-channel slack --reply-to "#reports"
openclaw agent --agent ops --message "Run locally" --local       # 强制嵌入式 agent
openclaw agent --agent ops --message "..." --timeout 1200 --json

参数:-m/--message--message-file-t/--to--session-key--session-id--agent--model--thinking <off|minimal|low|medium|high|...>--verbose on|off--channel--reply-to--reply-channel--reply-account--local--deliver--timeout <秒>--json

openclaw agents

管理多个隔离 agent(工作区 + 路由 + 身份):

openclaw agents list [--bindings] [--json]
openclaw agents add work --workspace ~/.openclaw/workspace-work --bind telegram:* --bind discord:*
openclaw agents bindings [--agent work]
openclaw agents bind --agent work --bind telegram:ops
openclaw agents unbind --agent work --bind telegram:ops --all
openclaw agents set-identity --agent main --avatar avatars/openclaw.png
openclaw agents delete work [--force]

openclaw sessions

openclaw sessions                    # 列出存储的会话(默认最新 100 条)
openclaw sessions --agent work
openclaw sessions --all-agents --active 120 --limit 25
openclaw sessions --store ./tmp/sessions.json
openclaw sessions cleanup            # 会话清理
openclaw sessions compact <key>      # 压缩会话(slash /compact 的 CLI 版)

openclaw transcripts

查看 transcripts 工具生成的只读记录(~/.openclaw/transcripts/YYYY-MM-DD/<session>/):

openclaw transcripts list
openclaw transcripts show <session>          # 打印 summary.md
openclaw transcripts path <session> [--dir|--metadata|--transcript]
openclaw transcripts list --json

openclaw tui(别名 openclaw chatopenclaw terminal

openclaw tui                      # 连接 Gateway 的终端 UI
openclaw chat                     # 本地嵌入式模式(= tui --local)
openclaw tui --local
openclaw tui --url ws://127.0.0.1:18789 --token <token> --session main --deliver
openclaw chat --message "帮我看看配置有什么问题"

7. 模型与推理

openclaw models

openclaw models status [--check] [--probe] [--agent <id>] [--json]
openclaw models list [--all] [--local] [--provider <id>] [--json]
openclaw models set <model-or-alias>          # 设置默认模型(写 agents.defaults.model.primary)
openclaw models set-image <model-or-alias>    # 设置默认图像模型
openclaw models scan [--set-default] [--yes]  # 扫描 OpenRouter :free 目录
openclaw models aliases list | add <alias> <model> | remove <alias>
openclaw models fallbacks list|add|remove|clear
openclaw models image-fallbacks list|add|remove|clear
openclaw models auth list [--provider <id>]
openclaw models auth login --provider <id> [--set-default]
openclaw models auth order get|set|clear

openclaw promos

发现/领取 ClawHub 上的促销模型:

openclaw promos list
openclaw promos claim <slug> [--api-key <key>] [--set-default]

openclaw infer(别名 openclaw capability

面向脚本的推理 CLI,按能力族组织:

openclaw infer list | inspect
openclaw infer model run <model> --prompt "..." --json
openclaw infer model list --provider <id>
openclaw infer model auth login|logout|status
openclaw infer image generate --prompt "..." --out ./x.png
openclaw infer image edit | describe | describe-many
openclaw infer audio transcribe --file ./a.mp3
openclaw infer tts convert --text "你好" --voice <v> --out ./x.mp3
openclaw infer tts voices | status | enable | disable | set-provider | set-persona
openclaw infer video generate | describe
openclaw infer web search "query" | web fetch <url>
openclaw infer embedding create --input "text" --out ./emb.json

8. 记忆与承诺

openclaw memory

openclaw memory status [--deep] [--index] [--fix] [--json]   # 索引/向量存储状态
openclaw memory index [--force] [--verbose]                  # 重建索引
openclaw memory search "关键词" [--max-results 10] [--min-score 0.6] [--json]
openclaw memory promote [--limit 10] [--apply] [--json]      # 把短期记忆提升进 MEMORY.md

openclaw commitments

openclaw commitments [--all] [--status pending] [--json]     # 列出推断的跟进承诺
openclaw commitments dismiss <id...>                         # 取消待办提醒

9. 自动化:cron / tasks / hooks / webhooks

openclaw cron

openclaw cron status
openclaw cron list [--json] / cron get <job-id>
openclaw cron add "0 7 * * *" "总结昨晚更新。" --name "晨报" --agent ops
openclaw cron create "0 18 * * 1-5" "生成部署摘要 JSON" --name "Deploy digest" --webhook <url>
openclaw cron create "*/15 * * * *" --name "队列深度" --command "scripts/check-queue.sh" --command-cwd "/srv/app" --announce --channel telegram --to "-1001234567890"
openclaw cron edit <job-id> [--schedule "0 8 * * *"] [--clear-to]
openclaw cron enable <job-id> / cron disable <job-id>
openclaw cron rm <job-id>
openclaw cron runs <job-id>
openclaw cron run <job-id> [--force]

关键参数:--session main|isolated|current|session:<id>--agent <id>--announce/--no-deliver--channel--to--thread-id--webhook <url>--command

openclaw tasks

后台任务账本(subagent/acp/cron/cli 运行记录):

openclaw tasks                      # = tasks list
openclaw tasks list [--runtime subagent] [--status running] [--json]
openclaw tasks show <lookup>        # 按任务/运行 ID 或 session key
openclaw tasks notify <lookup> state_changes
openclaw tasks cancel <lookup>
openclaw tasks audit [--severity warn] [--code <name>]
openclaw tasks maintenance [--apply]
openclaw tasks flow list | show <lookup> | cancel <lookup>

openclaw hooks

agent 钩子(/new/reset、Gateway 启动等事件自动化):

openclaw hooks list [--eligible] [--verbose]
openclaw hooks info <name>
openclaw hooks check [--json]
openclaw hooks enable <name>        # 启用后需重启 Gateway
openclaw hooks disable <name>
openclaw hooks install / update

openclaw webhooks

当前聚焦 Gmail Pub/Sub 集成:

openclaw webhooks gmail setup --account you@example.com [--project my-gcp-project] [--hook-url <url>]
openclaw webhooks gmail run [--account you@example.com]

10. 安全与权限

openclaw approvals(别名 openclaw exec-approvals

管理 exec 批准策略(本地 / gateway / node 主机):

openclaw approvals get [--gateway] [--node <id|name|ip>]
openclaw approvals set --file ./exec-approvals.json
openclaw approvals set --stdin < policy.json5
openclaw approvals set --gateway --file ./exec-approvals.json
openclaw approvals allowlist add <pattern> [--gateway|--node ...]
openclaw approvals allowlist remove <pattern>

openclaw exec-policy

本地同步 tools.exec.* 配置与批准文件:

openclaw exec-policy show [--json]
openclaw exec-policy preset yolo | cautious | deny-all
openclaw exec-policy set --host gateway --security full --ask off --ask-fallback full

--host auto|sandbox|gateway|node--security deny|allowlist|full--ask off|on-miss|always

openclaw security

openclaw security audit [--deep] [--json]
openclaw security audit --fix              # 应用安全修复
openclaw security audit --auth password --password <pw>

openclaw secrets

SecretRef 管理:

openclaw secrets audit --check             # 扫描明文/未解析引用(退出码 1=有发现, 2=未解析引用)
openclaw secrets configure                 # 交互式规划(需 TTY)
openclaw secrets apply --from /tmp/plan.json [--dry-run] [--allow-exec]
openclaw secrets reload [--json]           # 重新解析引用并热替换运行时快照

11. 插件与技能

openclaw plugins

openclaw plugins list [--enabled] [--verbose] [--json]
openclaw plugins search <query> [--limit <n>]
openclaw plugins install <path-or-spec> [--link] [--force] [--pin] [--marketplace <source>]
openclaw plugins inspect <id> [--runtime] / plugins info <id>
openclaw plugins enable <id> | disable <id>
openclaw plugins update <id> | --all [--dry-run]
openclaw plugins uninstall <id> [--dry-run] [--keep-files] [--force]
openclaw plugins doctor
openclaw plugins registry [--refresh]
openclaw plugins init <id> [--name <name>] [--type tool|provider]   # 脚手架新插件
openclaw plugins build [--entry <path>] [--check]
openclaw plugins validate [--entry <path>]
openclaw plugins marketplace entries | list <source> | refresh

插件开发流程:openclaw plugins init stock-quotesnpm run plugin:buildnpm run plugin:validate

openclaw skills

openclaw skills search "calendar" [--limit 20] [--json]
openclaw skills install @owner/<slug> [--version <v>] [--force] [--agent <id>] [--global]
openclaw skills install git:owner/repo@main
openclaw skills install ./path/to/skill --as custom-name
openclaw skills update @owner/<slug> | --all
openclaw skills verify @owner/<slug> [--card]
openclaw skills list [--eligible] [--verbose] [--json]
openclaw skills info <name>
openclaw skills check [--json]             # 检查缺失的二进制/env/配置
openclaw skills workshop list | inspect <id> | propose-create | propose-update | revise | apply | reject | quarantine

12. 节点与设备

openclaw nodes

管理配对节点(摄像头、屏幕、画布等)并调用其能力:

openclaw nodes status [--connected] [--last-connected 24h]
openclaw nodes list / nodes describe --node <idOrNameOrIp>
openclaw nodes pending / approve <requestId> / reject <requestId>
openclaw nodes remove --node <id|name|ip> / rename --node <id> --name <显示名>
openclaw nodes invoke --node <id> --command canvas.eval --params '{}'
openclaw nodes notify --node <id> --title "构建" --body "完成" --priority timeSensitive
openclaw nodes push --node <id> --title "OpenClaw" --environment sandbox   # iOS APNs 测试推送
openclaw nodes location get --node <id> --accuracy precise
openclaw nodes screen record --node <id> --duration 10s --fps 10 --out ./clip.mp4
openclaw nodes canvas snapshot|present|hide|navigate|eval|a2ui push
openclaw nodes camera list|snap|clip

openclaw devices

设备配对与令牌管理(与 nodes 的节点配对分层):

openclaw devices list [--json]
openclaw devices approve <requestId>       # 省略 id 或 --latest 只预览
openclaw devices reject <requestId>
openclaw devices remove <deviceId>
openclaw devices rotate <deviceId> / revoke <deviceId>
openclaw devices clear

openclaw node

以无头 node host 连接 Gateway,暴露 system.run/system.which

openclaw node run --host <gateway-host> --port 18789
openclaw node status | install | uninstall | stop | restart

13. 浏览器控制

openclaw browser status
openclaw browser doctor [--deep]                       # CDP 就绪检查
openclaw browser start [--headless] [--browser-profile <name>]
openclaw browser stop
openclaw browser profiles / create-profile <name> / delete-profile <name>
openclaw browser tabs / open <url> / close
openclaw browser snapshot / screenshot [--out x.png] / pdf
openclaw browser navigate <url> / resize / wait
openclaw browser click / type / press / hover / drag / select / upload / fill / dialog
openclaw browser evaluate --script "document.title"
openclaw browser console [--limit 50]
openclaw browser reset-profile

常用:--url <gatewayWsUrl>--token--timeout--browser-profile(默认 openclaw)、--json


14. 沙箱

openclaw sandbox list [--browser] [--json]
openclaw sandbox recreate --all | --agent mybot | --session "agent:main:main" [--browser] [--force]
openclaw sandbox explain [--session agent:main:main] [--agent work] [--json]   # 查看生效策略

15. MCP / ACP / 附加

openclaw mcp

openclaw mcp serve                                  # OpenClaw 作为 MCP 服务器(stdio)
openclaw mcp list | show <name> | set <name> | unset <name>
openclaw mcp status [--verbose] | doctor | probe <name>
openclaw mcp add <name> -- ... / configure <name> / tools <name>
openclaw mcp login <name> | logout <name> | reload

openclaw acp

ACP(Agent Client Protocol)桥:IDE 经 stdio 连接,转发到 Gateway 会话。

openclaw acp
openclaw acp --url ws://gateway:18789 --token <token>

openclaw attach

以临时 MCP 授权启动 Claude Code,绑定单个 Gateway 会话:

openclaw attach
openclaw attach --session agent:main:telegram:123 --ttl 600000
openclaw attach --print-config      # 只打印 .mcp.json / 启动命令,不启动

openclaw proxy

openclaw proxy validate [--proxy-url <url>] [--allowed-url ...] [--denied-url ...] [--json]
openclaw proxy start [--host 127.0.0.1] [--port 8000]      # 本地捕获代理
openclaw proxy run -- <cmd...>                             # 经代理运行子命令
openclaw proxy sessions [--limit <n>] / query --preset <name> / blob --id <id> / purge

16. 备份、迁移、更新、重置、卸载

openclaw backup

openclaw backup create                     # 备份状态/配置/凭据/会话(默认当前目录)
openclaw backup create --output ~/Backups
openclaw backup create --verify
openclaw backup create --only-config       # 只备份配置文件
openclaw backup create --no-include-workspace
openclaw backup verify ./xxx-openclaw-backup.tar.gz

openclaw migrate

从 Claude / Codex / Hermes 等导入状态:

openclaw migrate list
openclaw migrate hermes --dry-run
openclaw migrate codex --plugin google-calendar --dry-run
openclaw migrate apply codex --yes [--include-secrets]
openclaw migrate apply claude --yes

openclaw update

openclaw update                          # 更新 + 自动重启 Gateway
openclaw update status
openclaw update --channel beta           # stable | extended-stable | beta | dev
openclaw update --tag main --dry-run
openclaw update --no-restart --yes
openclaw --update                        # 简写

降级需要确认;npm 全局安装走包管理器流程。

openclaw reset

openclaw reset --dry-run
openclaw reset --scope config --yes --non-interactive
openclaw reset --scope config+creds+sessions --yes --non-interactive
openclaw reset --scope full --yes --non-interactive

范围:config(仅配置)/ config+creds+sessions(+凭据与会话)/ full(整个状态目录+工作区)。操作前先 openclaw backup create

openclaw uninstall

openclaw uninstall --service --yes --non-interactive
openclaw uninstall --state --workspace --yes
openclaw uninstall --all --yes
openclaw uninstall --dry-run

--service 移除 Gateway 服务,--state 移除状态/配置,--workspace 移除工作区,--app 移除 macOS app,--all 全部。


17. 其他工具

命令 说明与示例
openclaw docs <query...> 搜索在线文档:openclaw docs gateway token secretref
openclaw dns setup [--domain openclaw.internal] [--apply] 广域发现 DNS-SD(macOS + CoreDNS)
openclaw clawbot qr legacy 别名 → openclaw qr
openclaw workboard list|create|show|dispatch 看板(插件提供)
openclaw path resolve|find|set|validate|emit 路径工具(插件提供)
openclaw policy ... / openclaw voicecall ... 策略 / 语音通话(可选插件)
openclaw capability ... openclaw infer 的别名

18. Shell 补全与聊天斜杠命令

补全

openclaw completion --shell bash --write-state --install

聊天内斜杠命令(高频)

命令 用途
/status 快速诊断(模型、用量、时间)
/model <id> 切换会话模型;/model default 恢复默认
/trace 会话级插件跟踪/调试行
/config 持久化配置修改
/debug 运行时临时配置覆盖(不落盘,需 commands.debug: true
/compact 压缩会话上下文(等价 openclaw sessions compact <key>
/crestodian TUI 内打开修复助手
/auth [provider] 本地模式下的认证(tui --local
/goal 管理会话目标

附:常用速查组合

# 一条命令搞定“我机器上 OpenClaw 状态怎么样”
openclaw status --all

# 出问题先看日志再修
openclaw logs --follow
openclaw doctor --fix

# 重启 Gateway(安全排空)
openclaw gateway restart --safe

# 发消息
openclaw message send --channel telegram --target @someone --message "你好"

# 定时任务:每天早上 8 点总结
openclaw cron create "0 8 * * *" "总结昨日进展" --name "每日总结" --agent main --announce

# 非交互配置
openclaw config set agents.defaults.heartbeat.every "2h"
openclaw models set deepseek/deepseek-v4-flash

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐