Skip to Content
👋 欢迎来到 HowToUseMoltbot 快速入门
CLI 参考CLI 参考

CLI 参考

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

命令页面

全局参数

  • --dev: 将状态隔离到 ~/.clawdbot-dev 并偏移默认端口。
  • --profile <name>: 将状态隔离到 ~/.clawdbot-<name>
  • --no-color: 禁用 ANSI 颜色。
  • --update: moltbot update 的简写(仅源码安装)。
  • -V, --version, -v: 打印版本并退出。

输出样式

  • ANSI 颜色和进度条仅在 TTY 会话中渲染。
  • OSC-8 超链接在支持的终端中显示为可点击链接;否则回退为纯 URL。
  • --json(及在支持处的 --plain)禁用样式以得到干净输出。
  • --no-color 禁用 ANSI 样式;NO_COLOR=1 同样生效。
  • 长时间运行的命令会显示进度条(在支持时使用 OSC 9;4)。

配色

Moltbot CLI 输出使用 lobster 配色。

  • accent (#FF5A2D): 标题、标签、主要高亮。
  • accentBright (#FF7A3D): 命令名、强调。
  • accentDim (#D14A22): 次要高亮文本。
  • info (#FF8A5B): 信息值。
  • success (#2FBF71): 成功状态。
  • warn (#FFB020): 警告、回退、注意。
  • error (#E23D2D): 错误、失败。
  • muted (#8B7F77): 弱化、元数据。

配色来源:src/terminal/palette.ts(又称 “lobster seam”)。

命令树

moltbot [--dev] [--profile <name>] <command> 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

注意:插件可添加额外顶级命令(例如 moltbot voicecall)。

安全

  • moltbot security audit — 审计配置与本地状态中的常见安全隐患。
  • moltbot security audit --deep — 尽力的网关实时探测。
  • moltbot security audit --fix — 收紧安全默认值并对 state/config 做 chmod。

插件

管理扩展及其配置:

  • moltbot plugins list — 发现插件(使用 --json 输出机器可读)。
  • moltbot plugins info <id> — 显示插件详情。
  • moltbot plugins install <path|.tgz|npm-spec> — 安装插件(或将插件路径加入 plugins.load.paths)。
  • moltbot plugins enable <id> / disable <id> — 切换 plugins.entries.<id>.enabled
  • moltbot plugins doctor — 报告插件加载错误。

多数插件变更需重启网关。参见 插件

内存

MEMORY.mdmemory/*.md 的向量搜索:

  • moltbot memory status — 显示索引统计。
  • moltbot memory index — 重建内存文件索引。
  • moltbot memory search "<query>" — 对内存做语义搜索。

聊天斜杠命令

聊天消息支持 /... 命令(文本与原生)。参见 斜杠命令。要点:

  • /status 快速诊断。
  • /config 持久化配置变更。
  • /debug 仅运行时配置覆盖(内存,非磁盘;需 commands.debug: true)。

设置与引导

setup

初始化配置与工作区。选项:

  • --workspace <dir>: 代理工作区路径(默认 ~/clawd)。
  • --wizard: 运行引导向导。
  • --non-interactive: 无提示运行向导。
  • --mode <local|remote>: 向导模式。
  • --remote-url <url>: 远程网关 URL。
  • --remote-token <token>: 远程网关令牌。

出现任一向导相关参数(--non-interactive--mode--remote-url--remote-token)时会自动运行向导。

onboard

交互式向导,用于设置网关、工作区和技能。选项:

  • --workspace <dir>
  • --reset(在向导前重置配置、凭证、会话和工作区)
  • --non-interactive
  • --mode <local|remote>
  • --flow <quickstart|advanced|manual>(manual 为 advanced 的别名)
  • --auth-choice <setup-token|token|...|skip>
  • --token-provider <id>(非交互;与 --auth-choice token 同用)
  • --token <token>(非交互;与 --auth-choice token 同用)
  • --token-profile-id <id>(非交互;默认 <provider>:manual
  • --token-expires-in <duration>(非交互;如 365d12h
  • 以及各 API key、gateway、remote、tailscale、daemon、skip 等选项
  • --json

configure

交互式配置向导(模型、频道、技能、网关)。

config

非交互式配置辅助(get/set/unset)。不带子命令运行 moltbot config 会启动向导。子命令:

  • config get <path>: 打印配置值(点号/方括号路径)。
  • config set <path> <value>: 设置值(JSON5 或原始字符串)。
  • config unset <path>: 移除值。

doctor

健康检查与快速修复(配置、网关及旧服务)。选项:

  • --no-workspace-suggestions: 禁用工作区记忆提示。
  • --yes: 无提示接受默认(无头)。
  • --non-interactive: 跳过提示;仅应用安全迁移。
  • --deep: 扫描系统服务以发现额外网关安装。

频道辅助

channels

管理聊天频道账户(WhatsApp/Telegram/Discord/Google Chat/Slack/Mattermost(插件)/Signal/iMessage/MS Teams)。子命令:

  • channels list: 显示已配置频道与认证配置。
  • channels status: 检查网关可达性与频道健康(--probe 执行额外检查;网关健康探测用 moltbot healthmoltbot status --deep)。
  • 提示:channels status 在检测到常见配置错误时会打印警告与修复建议(并指向 moltbot 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>: 账户显示名

更多说明:OAuth。示例:

moltbot channels add --channel telegram --account alerts --name "Alerts Bot" --token $TELEGRAM_BOT_TOKEN moltbot channels add --channel discord --account work --name "Work Bot" --token $DISCORD_BOT_TOKEN moltbot channels remove --channel discord --account work --delete moltbot channels status --probe moltbot status --deep

skills

列出并查看可用技能及就绪信息。子命令:

  • skills list: 列出技能(无子命令时的默认)。
  • skills info <name>: 显示单个技能详情。
  • skills check: 就绪与缺失需求的摘要。

选项:--eligible--json-v/--verbose。提示:使用 npx clawdhub 搜索、安装和同步技能。

pairing

跨频道审批私信配对请求。子命令:pairing list <channel> [--json]pairing approve <channel> <code> [--notify]

webhooks gmail

Gmail Pub/Sub 钩子设置与运行。参见 Gmail Pub/Sub。子命令:webhooks gmail setupwebhooks gmail run

dns setup

广域发现 DNS 辅助(CoreDNS + Tailscale)。参见 服务发现。选项:--apply(需 sudo;仅 macOS)。

消息与代理

message

统一出站消息与频道操作。参见 message。子命令:message send|poll|react|...message thread <create|list|reply> 等。示例:moltbot message send --target +15555550123 --message "Hi"

agent

通过网关运行一轮代理(或 --local 嵌入式)。必选:--message <text>。选项:--to--session-id--thinking--verbose--channel--local--deliver--json--timeout

agents

管理隔离代理(工作区、认证与路由)。agents listagents add [name]agents delete <id>。绑定格式为 channel[:accountId]

acp

运行连接 IDE 与网关的 ACP 桥。参见 acp

status

显示关联会话健康与近期收件人。选项:--json--all--deep--usage--timeout--verbose--debug。概览会包含网关与节点主机服务状态(如有)。

用量追踪

在具备 OAuth/API 凭证时,Moltbot 可展示提供商用量/配额。展示位置:/statusmoltbot status --usage、macOS 菜单栏。详见 用量追踪

health

从运行中的网关获取健康状态。选项:--json--timeout--verbose

sessions

列出已存储的会话。选项:--json--verbose--store--active

重置 / 卸载

reset

重置本地配置/状态(保留已安装的 CLI)。选项:--scope <config|config+creds+sessions|full>--yes--non-interactive--dry-run--non-interactive 需同时指定 --scope--yes

uninstall

卸载网关服务与本地数据(CLI 保留)。选项:--service--state--workspace--app--all--yes--non-interactive--dry-run--non-interactive--yes 与显式范围(或 --all)。

网关

gateway

运行 WebSocket 网关。选项:--port--bind--token--auth--password--tailscale--allow-unconfigured--dev--reset--force--verbose--ws-log--raw-stream 等。

gateway service

管理网关服务(launchd/systemd/schtasks)。子命令:gateway statusinstalluninstallstartstoprestartgateway status 默认会探测网关 RPC。gateway install 默认使用 Node 运行时;不推荐 bun(WhatsApp/Telegram 问题)。

logs

通过 RPC 跟踪网关文件日志。TTY 下为彩色结构化视图;非 TTY 为纯文本。--json 输出逐行 JSON。

gateway <subcommand>

网关 CLI 辅助。子命令:gateway call <method>gateway healthgateway statusgateway probegateway discovergateway install|uninstall|start|stop|restartgateway run。常用 RPC:config.applyconfig.patchupdate.run。直接调用 config.set/config.apply/config.patch 时,若已有配置请传入 config.getbaseHash

模型

参见 模型 了解故障转移与扫描策略。推荐 Anthropic 认证(setup-token):claude setup-tokenmoltbot models auth setup-token --provider anthropicmoltbot models status

models(根)

moltbot modelsmodels status 的别名。根选项:--status-json--status-plain

models list

选项:--all--local--provider--json--plain

models status

选项:--json--plain--check--probe--probe-provider--probe-profile--probe-timeout--probe-concurrency--probe-max-tokens。始终包含认证概览与 OAuth 过期状态。--probe 会发真实请求(可能消耗令牌并触发限流)。

models set / models set-image

分别设置 agents.defaults.model.primaryagents.defaults.imageModel.primary

models aliases / models fallbacks / models image-fallbacks

list|add|remove|clear 等子命令。选项:--json--plain

models scan

选项:--min-params--max-age-days--provider--max-candidates--timeout--concurrency--no-probe--yes--no-input--set-default--set-image--json

models auth add|setup-token|paste-token

add 为交互式认证辅助;setup-token 支持 --provider(默认 anthropic)、--yespaste-token 支持 --provider--profile-id--expires-in

models auth order get|set|clear

选项:get--provider--agent--json)、set--provider--agent<profileIds...>)、clear--provider--agent)。

系统

system event

入队系统事件并可触发心跳(网关 RPC)。必选:--text <text>。选项:--mode <now|next-heartbeat>--json--url--token--timeout--expect-final

system heartbeat last|enable|disable

心跳控制(网关 RPC)。选项:--json--url--token--timeout--expect-final

system presence

列出系统在线状态条目(网关 RPC)。选项:--json--url--token--timeout--expect-final

Cron

管理定时任务(网关 RPC)。参见 Cron 任务。子命令:cron statuscron listcron addcron editcron rmcron enablecron disablecron runscron run。所有 cron 命令支持 --url--token--timeout--expect-final

节点主机

node 运行无头节点主机或作为后台服务管理。参见 moltbot node。子命令:node runnode statusnode installnode uninstallnode stopnode restart

节点

nodes 与网关通信并针对已配对节点。参见 节点。通用选项:--url--token--timeout--json。子命令:nodes statusnodes describenodes listnodes pendingnodes approvenodes rejectnodes renamenodes invokenodes runnodes notify;相机:nodes camera list|snap|clip;画布与屏幕:nodes canvas snapshot|present|hide|navigate|eval|a2ui push|resetnodes screen record;位置:nodes location get

浏览器

浏览器控制 CLI(专用 Chrome/Brave/Edge/Chromium)。参见 moltbot browser浏览器工具。通用选项:--url--token--timeout--json--browser-profile。管理:browser statusstartstopreset-profiletabsopenfocuscloseprofilescreate-profiledelete-profile。检查:browser screenshotbrowser snapshot。操作:browser navigateresizeclicktypepresshoverdragselectuploadfilldialogwaitevaluateconsolepdf

文档搜索

docs [query...]

搜索在线文档索引。

TUI

tui

打开连接网关的终端 UI。选项:--url--token--password--session--deliver--thinking--message--timeout-ms(默认 agents.defaults.timeoutSeconds)、--history-limit

最后更新于: