OpenClaw Mega Cheatsheet 命令速查表
⌨️ 核心CLI命令 (Core CLI Commands)
|
|
|
|
openclaw gateway |
|
--port
|
openclaw gateway start|stop|restart |
管理Gateway服务 (launchd/systemd)
|
|
openclaw channels login |
|
|
openclaw channels add |
添加Telegram/Discord/Slack机器人
|
--token |
openclaw channels status --probe |
|
|
openclaw onboard |
|
--install-daemon |
openclaw doctor |
|
--deep
|
openclaw config get|set|unset |
|
|
openclaw models list|set|status |
|
|
openclaw models auth setup-token |
|
|
openclaw models fallbacks add|remove |
|
|
openclaw memory status|index|search |
|
|
openclaw agents list|add|delete |
|
|
openclaw logs --follow |
|
|
openclaw status --all --deep |
|
--usage |
openclaw sessions --json |
|
|
openclaw security audit |
|
--fix |
openclaw browser start|tabs|screenshot |
|
|
openclaw cron list|add|run |
|
|
openclaw pairing list|approve |
|
|
openclaw reset --scope |
重置 config/creds/sessions/full
|
|
🚩 全局标志 (Global Flags)
|
|
|
--dev |
在 ~/.openclaw-dev 下隔离状态,切换端口
|
--profile <name> |
|
--no-color |
|
--update |
openclaw update
|
-V
|
|
🛠️ 高级命令 (Power Commands)
|
|
|
openclaw plugins list|enable|disable |
|
openclaw approvals get|set|allowlist |
|
openclaw sandbox list|recreate|explain |
|
openclaw system event --text "X" |
|
openclaw system heartbeat enable|disable|last |
|
openclaw update status|wizard |
|
openclaw nodes list|pending|approve |
|
openclaw devices list|approve|rotate|revoke |
|
openclaw directory peers|groups list |
|
openclaw health --json --verbose |
|
openclaw dashboard |
|
openclaw tui --url --token |
|
⚠️ 命令注意事项 (Command Gotchas)
|
|
|
models status --probe |
|
channels status --probe |
使用 status --deep 进行完整的gateway级诊断
|
security audit --fix |
|
--update |
|
💬 频道设置 (Channel Setup)
|
|
|
|
|
|
|
openclaw channels login |
|
|
|
channels add --channel telegram --token $TOKEN |
|
|
|
channels add --channel discord --token $TOKEN |
|
|
|
|
|
|
|
channels add --channel slack |
|
|
|
channels add --channel googlechat |
|
|
|
channels add --channel signal |
|
|
|
channels add --channel msteams |
快速诊断:
-
状态:
openclaw channels status --probe
-
日志:
openclaw channels logs --channel [id]
📁 工作区文件 (Workspace Files)
根目录:~/.openclaw/workspace
🧠 记忆系统 (Memory System)
|
|
|
| 每日日志 |
memory/YYYY-MM-DD.md
|
| 长期记忆 |
MEMORY.md
|
| 向量搜索 |
memory_search
工具 - 对记忆块进行语义搜索 (~400 tokens)
|
| 提供商 |
memorySearch.provider
- 自动选择: local GGUF → OpenAI → Gemini → Voyage
|
| QMD后端 |
memory.backend = "qmd"
|
| 混合搜索 |
0.7/0.3 默认权重 - 向量相似度 + BM25关键词相关性
|
命令:
-
openclaw memory index --all
-
openclaw memory search "X"
🤖 模型与认证 (Models & Auth)
|
|
|
openclaw models list --all |
|
openclaw models set <model> |
设置 agents.defaults.model.primary
|
openclaw models set-image <model> |
|
openclaw models fallbacks add <model> |
|
openclaw models auth setup-token |
Anthropic首选认证 (setup-token)
|
openclaw models auth add --provider <p> |
|
openclaw models status --probe |
|
openclaw models aliases add <a> <m> |
|
故障转移与冷却时间
🔐 会话配置 (Sessions)
|
|
|
session.dmScope |
main (默认) | per-peer | per-channel-peer | per-account-channel-peer
|
session.reset.mode |
daily (默认, 凌晨4点本地时间) | idle
|
session.reset.idleMinutes |
|
session.resetByType |
覆盖 dm, group, thread 会话策略
|
session.resetByChannel |
|
session.identityLinks |
|
session.sendPolicy |
|
session.store |
~/.openclaw/agents/{agentId}/sessions/sessions.json |
“
⚠️ 安全提示: 多用户收件箱请使用 per-channel-peer 防止上下文泄露
⚡ 斜杠命令 (Slash Commands)
|
|
|
/status |
会话健康 + 上下文使用 + WhatsApp凭证
|
/context list |
|
/context detail |
|
/model <model> |
|
/compact [instructions] |
|
/new [model] |
|
/reset |
/new
|
/stop |
|
/send on|off|inherit |
|
/tts on|off |
|
/think
|
|
/config |
|
/debug |
仅运行时配置覆盖 (需要 commands.debug: true)
|
🔊 文字转语音 (Text-to-Speech)
启用自动TTS:
messages.tts.auto: "always"
📊 日志与诊断 (Logging & Diagnostics)
|
|
|
openclaw logs --follow |
|
openclaw logs --json |
|
openclaw logs --limit 200 |
|
openclaw channels logs --channel whatsapp |
|
OTel导出配置:
"diagnostics": {
"otel": {
"enabled": true
}
}
🌐 浏览器与定时任务 (Browser & Cron)
浏览器操作
|
|
|
openclaw browser start|stop |
|
openclaw browser tabs |
|
openclaw browser open <url> |
|
openclaw browser screenshot |
|
openclaw browser navigate <url> |
|
openclaw browser click|type|press |
|
openclaw browser evaluate <js> |
|
openclaw browser pdf |
|
定时任务
|
|
|
openclaw cron list |
|
openclaw cron add |
|
openclaw cron edit <id> |
|
openclaw cron enable|disable <id> |
|
openclaw cron run <id> |
|
openclaw cron runs |
|
🔗 钩子与自动化 (Hooks & Automation)
内置钩子
钩子命令
|
|
|
openclaw hooks list |
|
openclaw hooks enable <name> |
|
openclaw hooks disable <name> |
|
openclaw hooks info <name> |
|
openclaw hooks check |
|
事件类型
|
|
|
command:new |
|
command:reset |
|
command:stop |
|
gateway:startup |
|
agent:bootstrap |
|
🧩 技能系统 (Skills System)
技能优先级
|
|
|
|
|
|
<workspace>/skills/ |
|
|
|
~/.openclaw/skills/ |
|
|
|
|
|
ClawHub注册表
|
|
|
clawhub install <slug> |
|
clawhub update --all |
|
clawhub sync --all |
|
SKILL.md格式
---
name: my-skill
description: "What this skill does"
metadata:
openclaw:
requires: {...}
---
👥 多代理路由 (Multi-Agent Routing)
|
|
|
| 隔离工作区 |
每个代理有自己的 AGENTS.md, SOUL.md, USER.md
|
| 每代理认证 |
|
| 会话存储 |
聊天记录在 ~/.openclaw/agents/<id>/sessions
|
| 绑定 |
|
路由优先级
命令:
-
openclaw agents add <name>
-
openclaw agents list --bindings
💓 心跳系统 (Heartbeat System)
|
|
|
heartbeat.every |
间隔 (默认: 30m, Anthropic OAuth为1h)
|
heartbeat.target |
last | none | <channel id>
|
heartbeat.to |
|
heartbeat.model |
|
heartbeat.prompt |
|
heartbeat.activeHours |
限制到时间窗口 (start/end/timezone)
|
“
📋 契约: 如果没有需要关注的事项,回复 HEARTBEAT_OK。代理会删除仅包含OK的回复。
HEARTBEAT.md示例
# Heartbeat checklist
- Quick scan: anything urgent?
- Daytime: lightweight check-in
- Blocked? Note what's missing
🔐 沙箱配置 (Sandboxing)
sandbox.mode
sandbox.scope
|
|
|
"session" |
|
"agent" |
|
"shared" |
|
workspaceAccess
设置镜像:scripts/sandbox-setup.sh
默认镜像:openclaw-sandbox:bookworm-slim
🎯 子代理 (Sub-Agents)
子代理命令
|
|
|
/subagents list |
|
/subagents stop <id|#|all> |
|
/subagents log <id|#> |
|
/subagents info <id|#> |
|
/subagents send <id|#> <msg> |
|
sessions_spawn工具
{
"task": "...",
"label": "...",
"model": "...",
"thinking": "...",
"runTimeoutSeconds": "...",
"cleanup": "..."
}
返回:{ status, runId, childSessionKey }
🔧 故障排除 (Troubleshooting)
|
|
|
|
|
openclaw pairing list
|
|
|
检查 mentionPatterns 配置 (代理需要 @提及)
|
|
|
openclaw models auth setup-token --provider anthropic |
|
|
openclaw doctor --deep
|
|
|
openclaw memory index
|
|
|
/compact
|
|
|
openclaw channels status --probe |
|
|
openclaw reset --scope sessions |
| 通用修复命令 |
openclaw doctor --deep --yes
|
📂 关键路径 (Key Paths)
|
|
|
~/.openclaw/openclaw.json |
|
~/.openclaw/workspace/ |
|
~/.openclaw/agents/<id>/ |
|
~/.openclaw/agents/<id>/sessions/ |
|
~/.openclaw/credentials/ |
|
~/.openclaw/memory/<agentId>.sqlite |
|
/tmp/openclaw/openclaw-YYYY-MM-DD.log |
|
“
💡 提示: 使用 --dev 或 --profile <name> 在不同目录下隔离状态。
🚀 快速开始 (Quick Start)
全局安装
npm install -g openclaw@latest
引导设置
# 1. 引导设置
openclaw onboard --install-daemon
# 2. 频道链接
openclaw channels login
# 3. 启动Gateway
openclaw gateway --port 18789
Onboard标志
|
|
|
--mode local |
|
--mode remote |
|
--flow quickstart |
|
--skip-channels |
|
来源: https://moltfounders.com/openclaw-mega-cheatsheet
OpenClaw超级速查表