你大概率遇到过:网关又挂了、配对码过期了、文档翻了三层还没找到那条命令——纯干货清单人人会收藏,但缺一张「遇事能秒翻」的桌面。这篇写给已经决定自托管 OpenClaw、又不想每次从搜索引擎重新拼关键词的人:读完你可以把浏览器关掉,靠本页搞定端口与路径、完整 CLI(含 tui / daemon / gateway / models 等子命令索引)、架构名词、Skills/MCP 区别、排错起手式。
下面是并列模块:从哪一部分读都行;要和长文教程配合用时,安装与踩坑请看同目录《OpenClaw 从安装到入门的完全指南》。
用途:日常查阅命令、路径、概念与排错入口。架构细节:见仓库
architecture-design/openclaw/与 官方文档。分析对象:openclaw/openclaw。本文第 4 部分对应文中标题「4. CLI 速查(细表)」;该部分据 OpenClaw 2026.3.23-2(7ffe7e4)本机openclaw --help与子命令--help交叉整理。升级 CLI 后请以本机--help与 官方 CLI 为准。
1. 一句话
OpenClaw(小龙虾):自托管的个人智能体平台——在 Telegram / WhatsApp / Discord / Web 等入口用自然语言下指令,在你自己的机器上执行(文件、终端、浏览器、邮箱等),并把结果推回聊天窗口。口号:The AI that actually does things。
2. 架构一屏(谁干什么)
| Gateway | ||
| Agent Runtime | ||
| Channel | ||
| Tool Engine | ||
| Model Provider | ||
| Session + Memory | ||
| Workspace + Prompt | ||
| Security |
默认控制面:本机 WebSocket,不默认暴露公网。
3. 默认端口与路径
ws://127.0.0.1:18789/ws | |
http://127.0.0.1:18789/ | |
http://127.0.0.1:18789/health | |
http://127.0.0.1:18789/status | |
http://127.0.0.1:18789/webhook/whatsapp | |
~/.openclaw/ | |
~/.openclaw/openclaw.json | |
~/.openclaw/.envcredentials/ 等 | |
~/.openclaw/workspace/ | |
/tmp/openclaw-gateway.pid | |
~/.openclaw/logs/gateway.log |
4. CLI 速查(细表)
命令形式:openclaw [全局选项] <command> [子命令] [选项]。带 * 的命令有子命令,务必 openclaw <command> --help。下文 4.0~4.15 为同级小节,文内交叉引用统一写作「见 4.x」。
4.0 全局选项(最常用)
-h, --help | |
-V, --version | |
--dev | ~/.openclaw-dev,Gateway 默认端口 19001,衍生端口顺延 |
--profile <name> | ~/.openclaw-<name> |
--log-level <level> | silent | fatal | error | warn | info | debug | trace |
--no-color |
示例:openclaw --dev gateway run(独立 dev 网关)。
4.1 一级命令索引(速览)
tui | 终端 UI |
gateway * | |
daemon * | Gateway 系统服务gateway 服务子命令同类) |
agent | --deliver 回渠道) |
dashboard | |
health | |
onboardsetup / configure | |
config * | 非交互 |
models * | |
channels *message * / directory * | |
pairing * | |
devices *qr | |
nodes *node * | |
sessions *memory * | |
approvals * | exec-approvals) |
security *secrets * / sandbox * | |
cron *hooks * / plugins * | |
browser *acp * | |
backup *system * / webhooks * / dns * | |
logsdoctor / docs / status | |
skills *agents * | |
update *reset / uninstall | |
completionclawbot * |
4.2 tui:终端 UI
前置:Gateway 已运行(gateway run 或 gateway start / daemon start)。
openclaw tui--session <key> | main |
--message <text> | |
--history-limit <n> | 200 |
--thinking <level> | |
--timeout-ms <ms> | |
--deliver | |
--token--password | |
--url <url> | gateway.remote.url) |
文档:https://docs.openclaw.ai/cli/tui
4.3 gateway * 与 daemon *
gateway | |
|---|---|
run | |
startstop / restart / install / uninstall | |
status | |
health | |
probe | |
discover | |
call | gateway call health) |
usage-cost |
gateway run 常见选项:--port、--bind(loopback | lan | tailnet 等)、--token、--force(占端口时强杀旧进程)、--tailscale、--verbose、--ws-log …
daemon:install / start / stop / restart / status / uninstall —— 专注 Gateway 服务;官方 CLI 说明其为 legacy alias,文档入口仍指向 gateway。
4.4 agent / dashboard / health
openclaw agent -m "…" | --agent、--session-id、--thinking、--json |
openclaw agent --local -m "…" | 本机嵌入式 |
openclaw agent --deliver … | -t / --to(E.164)、--reply-channel、--reply-to |
openclaw dashboard | |
openclaw health | --json 便于脚本) |
4.5 onboard / setup / configure / config
openclaw onboard | --install-daemon |
openclaw setup | |
openclaw configure | --section:workspace / model / web / gateway / daemon / channels / skills / health |
openclaw config | |
openclaw config get <dot.path>set / unset / validate | set 支持 --ref-source env 等引用密钥 |
4.6 models *
liststatus | --status-json) |
setset-image | |
auth | |
fallbacksimage-fallbacks | |
aliases | |
scan |
4.7 channels * / message * / directory *
channels:list、add、remove、login、logout、status(可加 --deep)、capabilities、resolve、logs。
message:send、read、react、poll、thread、Discord search、成员/权限等 —— 子命令很多,message --help。
directory:self、peers、groups(查联系人/群 ID)。
4.8 pairing * / devices * / qr / nodes * / node *
pairing list | |
pairing approve | <code> 或 --channel <ch> <code>(见 pairing approve --help) |
devices … | listapprove / reject / remove / revoke / rotate |
qr | --remote、--token、--public-url 等 |
nodes … | statusinvoke、相机/投屏/通知等(移动端 Node) |
node … | run / install / status … |
4.9 sessions * / memory *
• sessions:列表 + --agent/--all-agents/--active <分钟>/--json;子命令cleanup。• memory: search(--query、--max-results)、index(--force)、status(--deep、--json)。
4.10 approvals * / security * / secrets * / sandbox *
• approvals:get/set/allowlist• security audit:--deep、--fix、--json• secrets:reload、audit、configure、apply• sandbox:list、explain、recreate(可加--browser、--session、--agent)
4.11 cron * / hooks * / plugins * / system * / webhooks * / backup *
• cron: list、add、edit、enable、disable、rm、run、runs、status• hooks: list、enable、disable、info、check• plugins: list、install、enable、disable、inspect、marketplace、update、uninstall、doctor• system: event、heartbeat、presence• webhooks:如 gmail• backup: create、verify
4.12 browser * / acp *
• browser: start/stop/status、snapshot、navigate、click、screenshot、tabs、cookies、evaluate…• acp: acp client等(--token、--url、--session),见 https://docs.openclaw.ai/cli/acp
4.13 dns * 与网关发现
dns setup(CoreDNS + 广域发现)、gateway discover、gateway probe。
4.14 logs / doctor / docs / completion / update / reset / uninstall
logs | --follow--limit、--json、--token、--url |
doctor | --fix / --repair、--deep、--force、--non-interactive 等(见 doctor --help) |
docs <query...> | |
completion | |
update | update status / update wizard;`--channel stable |
reset | --scope--dry-run |
uninstall | --service--state / --workspace / --all 等 |
4.15 Skills / agents *
skills listinfo / check | |
skills searchinstall / update | |
agents … | agents --help |
以上 skills 子命令为 OpenClaw 运行时 能力(与编辑器里的 Cursor Skill 不是同一套)。
安装:npm install -g openclaw 或官方脚本(Getting Started)。
5. 推荐首次闭环(最短路径)
1. 安装 CLI → openclaw onboard(需要系统服务时加--install-daemon)2. 配置模型与至少一个 Channel 3. 启动 Gateway: gateway run或gateway start(亦可用daemon start)4. 新用户 DM 配对 → pairing approve …(语法见pairing approve --help)5. 验证任选: openclaw tui、openclaw agent -m "你好"、openclaw dashboard
6. Workspace 与 Prompt 文件(记名字即可)
AGENTS.md | |
SOUL.md | |
USER.md | |
TOOLS.md | |
IDENTITY.md | |
BOOT.md | |
BOOTSTRAP.md | |
MEMORY.mdmemory/ |
Skills 安装后,工具说明会进入 TOOLS.md 等上下文;MCP 在配置中挂载后由 Tool Engine 动态发现。
7. 安全与沙盒(三档)
| off | ||
| non-main | 默认推荐 | |
| all |
另需关注:工具白名单 / 黑名单、危险操作审批(exec-approvals 等)、配对与权限、MCP/Skill 来源可信。详见 Security、Sandboxing。
8. Session vs Memory(概念)
| 是什么 | ||
| 典型存储 | agents/<agentId>/sessions/<sessionId>/ | memory/ |
| 检索 |
记忆条目有 L0 / L1 / L2 分层(摘要到全文);可选用 FSRS 做复习调度。细节见 03-session-memory.md。
9. 工具扩展三条路
1. 内置工具:终端、读写、浏览器、网页搜索等 2. Skills:npm 包形态,manifest 声明工具,配置启用 3. MCP Server:标准协议,动态挂载工具
10. 常用常量(心里有数)
MAX_TOOL_ROUNDS | ||
TOOL_TIMEOUT_MS | ||
PAIRING_CODE_EXPIRY | ||
APPROVAL_TIMEOUT |
11. 排错速查
openclaw gateway statusopenclaw gateway probe、openclaw doctor;TUI 连不上时加 --token 或检查 gateway.remote.url | |
openclaw statusopenclaw channels list、查网关日志 | |
non-main vs all | |
openclaw config~/.openclaw/openclaw.json | |
openclaw reset |
12. 官方与源码
• 文档:https://docs.openclaw.ai/ • 仓库:https://github.com/openclaw/openclaw • 架构概念:https://docs.openclaw.ai/concepts/architecture
夜雨聆风