Skip to content

本页是 openclaw CLI 的完整命令参考,涵盖所有子命令、全局参数、命令树和输出样式说明。无论你是要管理 Gateway 服务、配置渠道账号、切换模型、操控浏览器,还是设定定时任务,在这里都能找到入口。把这页收藏好,你的龙虾就不会迷路。

CLI 参考

本页描述当前 CLI 的行为。如果命令有变动,请同步更新文档。

命令页面

全局参数

  • --dev:将状态隔离到 ~/.openclaw-dev 并移动默认端口。
  • --profile <name>:将状态隔离到 ~/.openclaw-<name>
  • --container <name>:指定执行目标容器。
  • --no-color:禁用 ANSI 颜色。
  • --updateopenclaw 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 palette")。

命令树

openclaw [--dev] [--profile <name>] <command>
  setup
  onboard
  configure
  config
    get
    set
    unset
    file
    schema
    validate
  completion
  doctor
  dashboard
  backup
    create
    verify
  security
    audit
  secrets
    reload
    audit
    configure
    apply
  reset
  uninstall
  update
    wizard
    status
  channels
    list
    status
    capabilities
    resolve
    logs
    add
    remove
    login
    logout
  directory
    self
    peers list
    groups list|members
  skills
    search
    install
    update
    list
    info
    check
  plugins
    list
    inspect
    install
    uninstall
    update
    enable
    disable
    doctor
    marketplace list
  memory
    status
    index
    search
  message
    send
    broadcast
    poll
    react
    reactions
    read
    edit
    delete
    pin
    unpin
    pins
    permissions
    search
    thread create|list|reply
    emoji list|upload
    sticker send|upload
    role info|add|remove
    channel info|list
    member info
    voice status
    event list|create
    timeout
    kick
    ban
  agent
  agents
    list
    add
    delete
    bindings
    bind
    unbind
    set-identity
  acp
  mcp
    serve
    list
    show
    set
    unset
  status
  health
  sessions
    cleanup
  tasks
    list
    audit
    maintenance
    show
    notify
    cancel
    flow list|show|cancel
  gateway
    call
    usage-cost
    health
    status
    probe
    discover
    install
    uninstall
    start
    stop
    restart
    run
  daemon
    status
    install
    uninstall
    start
    stop
    restart
  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|login|login-github-copilot|setup-token|paste-token
    auth order get|set|clear
  sandbox
    list
    recreate
    explain
  cron
    status
    list
    add
    edit
    rm
    enable
    disable
    runs
    run
  nodes
    status
    describe
    list
    pending
    approve
    reject
    rename
    invoke
    notify
    push
    canvas snapshot|present|hide|navigate|eval
    canvas a2ui push|reset
    camera list|snap|clip
    screen record
    location get
  devices
    list
    remove
    clear
    approve
    reject
    rotate
    revoke
  node
    run
    status
    install
    uninstall
    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
  qr
  clawbot
    qr
  docs
  dns
    setup
  tui

注意:插件可以追加顶级命令(例如 openclaw voicecall)。

安全审计

  • openclaw security audit — 审计配置和本地状态中常见的安全隐患。
  • openclaw security audit --deep — 尽力执行实时 Gateway 探测。
  • openclaw security audit --fix — 收紧安全默认值和状态/配置权限。

Secrets 密钥管理

secrets

管理 SecretRef 和相关的运行时/配置卫生工作。

子命令:

  • secrets reload
  • secrets audit
  • secrets configure
  • secrets apply --from <path>

secrets reload 选项:

  • --url--token--timeout--expect-final--json

secrets audit 选项:

  • --check
  • --allow-exec
  • --json

secrets configure 选项:

  • --apply
  • --yes
  • --providers-only
  • --skip-provider-setup
  • --agent <id>
  • --allow-exec
  • --plan-out <path>
  • --json

secrets apply --from <path> 选项:

  • --dry-run
  • --allow-exec
  • --json

备注:

  • reload 是 Gateway RPC,当解析失败时保留上次已知的良好运行时快照。
  • audit --check 发现问题时返回非零退出码;未解析的 ref 使用更高优先级的非零退出码。
  • 默认跳过 exec 的 dry-run 检查;使用 --allow-exec 可选入。

插件管理

管理扩展及其配置:

  • openclaw plugins list — 发现插件(使用 --json 获取机器可读输出)。
  • openclaw plugins inspect <id> — 显示插件详情(info 是别名)。
  • openclaw plugins install <path|.tgz|npm-spec|plugin@marketplace> — 安装插件(或将插件路径追加到 plugins.load.paths;使用 --force 覆盖已有安装目标)。
  • openclaw plugins marketplace list <marketplace> — 安装前列出市场条目。
  • openclaw plugins enable <id> / disable <id> — 切换 plugins.entries.<id>.enabled
  • openclaw plugins doctor — 报告插件加载错误。

大多数插件更改需要重启 gateway。详见 plugin 工具

记忆管理

MEMORY.mdmemory/*.md 进行向量语义搜索:

  • openclaw memory status — 显示索引统计;用 --deep 做向量和 embedding 就绪检查,或 --fix 修复过期的 recall/promotion 工件。
  • openclaw memory index — 重新索引记忆文件。
  • openclaw memory search "<query>"(或 --query "<query>")— 对记忆进行语义搜索。
  • openclaw memory promote — 对短期 recall 进行排名,并可选地将最高分条目追加到 MEMORY.md

Sandbox 沙箱

管理隔离 agent 执行的沙箱运行时。

子命令:

  • sandbox list [--browser] [--json]
  • sandbox recreate [--all] [--session <key>] [--agent <id>] [--browser] [--force]
  • sandbox explain [--session <key>] [--agent <id>] [--json]

备注:

  • sandbox recreate 删除已有运行时,下次使用时用当前配置重新初始化。
  • 对于 ssh 和 OpenShell remote 后端,recreate 会删除所选范围的规范远程工作区。

聊天斜杠命令

聊天消息支持 /... 命令(文本和原生均可)。

要点:

  • /status 用于快速诊断。
  • /config 用于持久化配置更改。
  • /debug 用于仅运行时的配置覆盖(不写磁盘;需要 commands.debug: true)。

初始设置与引导

completion

生成 shell 补全脚本并可选安装到 shell 配置文件。

选项:

  • -s, --shell <zsh|bash|powershell|fish>
  • -i, --install
  • --write-state
  • -y, --yes

备注:

  • 不带 --install--write-state 时,completion 将脚本打印到 stdout。
  • --install 向 shell 配置文件写入 OpenClaw Completion 块,指向 OpenClaw 状态目录下的缓存脚本。

setup

初始化配置和工作区。

选项:

  • --workspace <dir>:agent 工作区路径(默认 ~/.openclaw/workspace)。
  • --wizard:运行引导程序。
  • --non-interactive:无交互地运行引导程序。
  • --mode <local|remote>:引导模式。
  • --remote-url <url>:远程 Gateway URL。
  • --remote-token <token>:远程 Gateway token。

当存在任何引导参数(--non-interactive--mode--remote-url--remote-token)时,引导程序自动运行。

onboard

交互式引导,配置 gateway、工作区和技能。

选项(部分):

  • --workspace <dir>
  • --reset(引导前重置配置、凭证和会话)
  • --reset-scope <config|config+creds+sessions|full>
  • --non-interactive
  • --mode <local|remote>
  • --flow <quickstart|advanced|manual>
  • --auth-choice <choice>
  • --gateway-port <port>
  • --gateway-bind <loopback|lan|tailnet|auto|custom>
  • --gateway-auth <token|password>
  • --install-daemon / --no-install-daemon
  • --skip-channels / --skip-skills

configure

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

config

非交互式配置助手(get/set/unset/file/schema/validate)。

子命令:

  • config get <path>:打印配置值。
  • config set <path> <value>:设置配置值(支持 JSON5 或字符串解析)。
  • config set --dry-run:验证赋值而不写入文件。
  • config unset <path>:删除值。
  • config file:打印当前活动配置文件路径。
  • config schema:打印生成的 JSON schema。
  • config validate:验证当前配置。

doctor

健康检查和快速修复(配置 + gateway + 旧版服务)。

选项:

  • --yes:不提示,接受默认值。
  • --non-interactive:跳过提示,只应用安全迁移。
  • --repair(别名 --fix):尝试自动修复检测到的问题。
  • --generate-gateway-token:生成新的 gateway 认证 token。

dashboard

用当前 token 打开 Control UI。

update

更新已安装的 CLI。

选项:

  • --json / --no-restart / --dry-run
  • --channel <stable|beta|dev>
  • --tag <dist-tag|version|spec>
  • --yes

子命令:update statusupdate wizard

backup

为 OpenClaw 状态创建和验证本地备份存档。

子命令:

  • backup create
  • backup verify <archive>

渠道帮助命令

channels

管理聊天渠道账号(WhatsApp/Telegram/Discord/Google Chat/Slack/Mattermost/Signal/iMessage/Microsoft Teams)。

子命令:

  • channels list:显示已配置渠道和认证配置文件。
  • channels status:检查 gateway 可达性和渠道健康状态(--probe 运行实时探测)。
  • channels logs:显示来自 gateway 日志文件的最近渠道日志。
  • 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>:账号显示名称

示例:

bash
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
openclaw channels remove --channel discord --account work --delete
openclaw channels status --probe
openclaw status --deep

directory

查找支持目录的渠道中的 self、peer 和 group ID。

子命令:

  • directory self
  • directory peers list [--query <text>] [--limit <n>]
  • directory groups list [--query <text>] [--limit <n>]
  • directory groups members --group-id <id> [--limit <n>]

skills

列出和检查可用技能及就绪状态。

子命令:

  • skills search [query...]:搜索 ClawHub 技能。
  • skills install <slug>:从 ClawHub 安装技能到当前工作区。
  • skills update <slug|--all>:更新已追踪的 ClawHub 技能。
  • skills list:列出技能(默认行为)。
  • skills info <name>:显示单个技能的详情。
  • skills check:显示就绪 vs 缺失要求的摘要。

pairing

跨渠道批准 DM 配对请求。

子命令:

  • pairing list [channel] [--channel <channel>] [--account <id>] [--json]
  • pairing approve <channel> <code> [--account <id>] [--notify]

devices

管理 gateway 设备配对条目和每角色设备 token。

qr

从当前 Gateway 配置生成移动端配对二维码和设置码。

hooks

管理内部 agent hooks。

子命令:

  • hooks list / info <name> / check
  • hooks enable <name> / disable <name>

webhooks

Webhook 助手。当前内置功能为 Gmail Pub/Sub 设置和运行:

  • webhooks gmail setup
  • webhooks gmail run

dns

广域发现 DNS 助手(CoreDNS + Tailscale)。

  • dns setup [--domain <domain>] [--apply]

消息与 Agent

message

统一出站消息和渠道操作。详见 openclaw message

示例:

  • openclaw message send --target +15555550123 --message "Hi"
  • openclaw message poll --channel discord --target channel:123 --poll-question "Snack?" --poll-option Pizza --poll-option Sushi

agent

通过 Gateway 运行一次 agent 轮次(或 --local 嵌入式)。

必填:

  • -m, --message <text>

agents

管理隔离 agent(工作区 + 认证 + 路由)。

子命令:

  • agents list:列出已配置 agent。
  • agents add [name]:添加新隔离 agent。
  • agents bindings:列出路由绑定。
  • agents bind:为 agent 添加路由绑定。
  • agents unbind:删除 agent 的路由绑定。
  • agents delete <id>:删除 agent 和其工作区及状态。
  • agents set-identity:更新 agent 身份(名称/主题/emoji/头像)。

acp

运行 ACP 桥接,将 IDE 连接到 Gateway。

mcp

管理保存的 MCP 服务器定义,并将 OpenClaw 渠道暴露为 MCP stdio 服务器。详见 openclaw mcp

approvals

管理 exec 审批。

子命令:

  • approvals get:获取 exec 审批快照和有效策略。
  • approvals set:用文件或 stdin 的 JSON 替换 exec 审批。
  • approvals allowlist add|remove:编辑每 agent 的 exec 允许列表。

status

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

health

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

sessions

列出已存储的对话会话。

子命令:sessions cleanup — 删除过期或孤立的会话。

重置与卸载

reset

重置本地配置/状态(保留已安装的 CLI)。

uninstall

卸载 gateway 服务和本地数据(CLI 保留)。

tasks

列出和管理跨 agent 的后台任务运行。

  • tasks list / show <id> / notify <id> / cancel <id>
  • tasks audit / tasks maintenance
  • tasks flow list|show|cancel

Gateway

gateway

运行 WebSocket Gateway。

选项(部分):

  • --port <port>
  • --bind <loopback|tailnet|lan|auto|custom>
  • --token <token>
  • --tailscale <off|serve|funnel>
  • --force(强制结束已占用端口的进程)

gateway service

管理 Gateway 服务(launchd/systemd/schtasks)。

子命令:

  • gateway status / install / uninstall / start / stop / restart

logs

通过 RPC 追踪 Gateway 文件日志。

bash
openclaw logs --follow
openclaw logs --limit 200
openclaw logs --plain
openclaw logs --json
openclaw logs --no-color

模型管理

关于 Anthropic 计费说明:使用 Anthropic 时,推荐 API Key 或支持外部工具的订阅(如 OpenAI Codex、阿里云 Model Studio Coding Plan、MiniMax Coding Plan、Z.AI Coding Plan)。Anthropic 已通知 OpenClaw 用户,通过 Claude 订阅在 OpenClaw 中使用需额外付费(Extra Usage)。

models 命令

  • models list — 列出可用模型。
  • models status — 显示模型和认证状态。
  • models set <model> — 设置默认主模型。
  • models set-image <model> — 设置默认图片模型。
  • models aliases list|add|remove — 管理模型别名。
  • models fallbacks list|add|remove|clear — 管理降级模型列表。
  • models scan — 扫描新可用模型。
  • models auth add|login|... — 添加和管理认证配置。
  • models auth order get|set|clear — 管理认证顺序。

系统命令

system event

将系统事件加入队列,并可选触发心跳(Gateway RPC)。

system heartbeat last|enable|disable

心跳控制(Gateway RPC)。

system presence

列出系统在线状态条目(Gateway RPC)。

Cron 定时任务

管理定时任务(Gateway RPC)。详见 定时任务文档

子命令:

  • cron status / list / add / edit / rm / enable / disable / runs / run

Node 主机

node

运行无头 node 主机或将其作为后台服务管理。

子命令:

  • node run / status / install / uninstall / stop / restart

Nodes(远程节点)

nodes 与 Gateway 通信并操作已配对节点。

子命令(部分):

  • nodes list / status / describe / pending / approve / reject / rename
  • nodes invoke — 调用节点命令
  • nodes camera list|snap|clip — 摄像头操作
  • nodes canvas snapshot|present|... — 画布和屏幕操作
  • nodes screen record — 录屏
  • nodes location get — 获取位置

浏览器控制

专用 Chrome/Brave/Edge/Chromium 浏览器控制 CLI。

管理:

  • browser status / start / stop / reset-profile
  • browser tabs / open <url> / focus / close

检查:

  • browser screenshot / snapshot

操作:

  • browser navigate / click / type / press / hover / drag
  • browser select / upload / fill / dialog / wait
  • browser evaluate / console / pdf

语音通话

voicecall

插件提供的语音通话工具。仅在安装并启用 voice-call 插件时出现。

常用命令:

  • voicecall call --to <phone> --message <text>
  • voicecall start / continue / speak / end
  • voicecall status / tail / latency / expose

文档搜索

docs

搜索实时 OpenClaw 文档索引。

TUI 终端界面

tui

打开连接到 Gateway 的终端 UI。

选项:

  • --url / --token / --password
  • --session <key>
  • --deliver
  • --thinking <level>
  • --message <text>

常见问题

Q: 怎么快速确认我的龙虾是否活着?

A: 运行 openclaw status,会显示 Gateway 状态、渠道健康状态和近期会话。如果有问题,再运行 openclaw doctor 自动修复。

Q: --dev--profile 参数有什么区别?

A: --dev 固定使用 ~/.openclaw-dev 目录和开发端口,适合本地测试。--profile <name> 允许你自定义隔离名称,适合管理多个独立 OpenClaw 实例(比如个人版和工作版)。

Q: 如何切换到 beta 版本?

A: 运行 openclaw update --channel beta,或重新运行安装脚本加上 --beta 参数。