OpenClaw Bí Kíp
Mọi lệnh, cấu hình, tệp và mẹo — trên một trang.
Có Gì Mới v2026.3.23
NEWCác tính năng mới nhất trong bản phát hành gần đây.
| Tính năng | Chi tiết |
|---|---|
| Qwen DashScope | Endpoint pay-as-you-go cho Qwen API keys (Trung Quốc & toàn cầu) |
| UI Clarity | Theme Knot, icon config, WCAG 2.1 AA contrast |
| Bundled Plugin Runtimes | WhatsApp, Matrix runtime sidecar trở lại npm |
| Channel Auth | Auto-select single channel, hardened ids |
| openclaw skills search|install|update | Native ClawHub flows |
sudo npm i -g openclaw@latest
openclaw update status
openclaw update --dry-run # Xem trước
openclaw update wizard
openclaw gateway restartCài Đặt Nhanh
Con đường nhanh nhất từ zero đến trợ lý AI hoạt động.
# macOS / Linux
curl -fsSL https://openclaw.ai/install.sh | bash
# Windows (PowerShell)
iwr -useb https://openclaw.ai/install.ps1 | iex
# npm global
npm i -g openclaw
# Onboard wizard
openclaw onboard --install-daemongit clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install && pnpm ui:build && pnpm build
pnpm openclaw onboard --install-daemon
# Dev loop (auto-reload)
pnpm gateway:watchopenclaw --version # Phiên bản
openclaw doctor # Kiểm tra sức khỏe
openclaw doctor --deep --yes # Sửa tự động
openclaw test model # Test AI
openclaw dashboard # Giao diện webTệp Workspace
Hành vi của OpenClaw được định nghĩa bởi các file workspace, không phải prompt ẩn.
| File | Mục đích | Tải khi |
|---|---|---|
| AGENTS.md | Hướng dẫn vận hành, ưu tiên, quy trình | Mỗi phiên |
| SOUL.md | Tính cách, giọng điệu, giá trị | Mỗi phiên |
| USER.md | Về bạn — tên, sở thích, phong cách | Mỗi phiên |
| IDENTITY.md | Tên agent, vai trò, mục tiêu | Mỗi phiên |
| TOOLS.md | Ghi chú công cụ, calendar ID | Mỗi phiên |
| HEARTBEAT.md | Checklist cho heartbeat | Chỉ heartbeat |
| BOOT.md | Nghi thức khởi động khi restart | Boot hook |
| MEMORY.md | Bộ nhớ dài hạn (tùy chọn) | Chỉ DM chính |
| memory/YYYY-MM-DD.md | Nhật ký hàng ngày | Khởi đầu phiên |
cd ~/.openclaw/workspace
git init && git add AGENTS.md SOUL.md TOOLS.md \
IDENTITY.md USER.md HEARTBEAT.md memory/
git commit -m "Add workspace"
# KHÔNG commit: API keys, OAuth tokens, config.Cấu Hình openclaw.json
CONFIGHầu hết vấn đề setup đến từ cấu hình sai: model, channel auth, heartbeat.
// ~/.openclaw/openclaw.json — JSON5
{
identity: { name: "Clawd", emoji: "🦞", theme: "helpful lobster" },
agent: {
workspace: "~/.openclaw/workspace",
model: { primary: "anthropic/claude-sonnet-4-6" },
heartbeat: { every: "30m", target: "last" },
},
channels: { telegram: { enabled: true, botToken: "123456:ABC..." } }
}openclaw config file # Đường dẫn config hiện tại
openclaw config get <key> # Giá trị (đã che)
openclaw config set <key> <val>
openclaw config unset <key>
openclaw config validate # Kiểm tra JSON/schema
openclaw gateway restart # Bắt buộc sau thay đổiagent: { model: {
primary: "anthropic/claude-sonnet-4-6",
fallbacks: ["anthropic/claude-opus-4-6", "mistral/mistral-large"],
params: { context1m: true } // 1M context beta
}}gateway: {
auth: {
mode: "token", // hoặc "password"
token: "..."
}
}Lệnh CLI Chính
CLIGiao diện chính để quản lý gateway, kênh, agent và plugin.
openclaw gateway status|start|stop|restart
openclaw dashboard # Giao diện web
openclaw tui # Giao diện terminalopenclaw channels list
openclaw channels status --probe
openclaw channels login # WhatsApp QR
openclaw channels add --channel telegram --token $TOK
openclaw channels logs --channel telegram
openclaw channels remove --channel discord --deleteopenclaw agents list --bindings
openclaw agents add|delete <tên>
openclaw agents bindings|bind|unbind
openclaw agents set-identity --from-identityopenclaw logs --follow
openclaw logs --json --limit 200
openclaw status --all --deep
openclaw status --usage
openclaw doctor --deep --yes
openclaw health --json --verboseopenclaw plugins list|info|enable|disable|install|doctor
openclaw skills list|info|check
clawhub install|uninstall <slug>
clawhub update --allopenclaw sessions cleanup
openclaw memory search --query "text"
openclaw cron list|add|edit|rm|enable|disable|run
openclaw update --dry-run
openclaw update --channel stable|beta|devopenclaw backup create
openclaw backup create --only-config
openclaw backup create --no-include-workspace
openclaw backup verify <đường_dẫn>Lệnh Slash
Được Gateway xử lý trước khi AI nhìn thấy — nhanh và chính xác.
| Lệnh | Chức năng |
|---|---|
| /status | Model, context, queue, runtime |
| /help, /commands | Các lệnh thường dùng |
| /new [model] | Phiên mới (alias: /reset) |
| /compact [instr] | Tóm tắt context, giải phóng token |
| /stop | Hủy chạy + xóa queue |
| /think [level] | off, minimal, low, medium, high, xhigh, adaptive |
| /model [id] | Đổi model; /model list, /model status |
| /usage off|tokens|full|cost | Footer mỗi response |
| /fast | Toggle fast mode (Anthropic/OpenAI) |
| /tts on|off|always|inbound | Toggle text-to-speech |
| /send on|off|inherit | Override delivery (owner-only) |
| /reasoning on|off|stream | Tách reasoning message |
| /elevated on|off|ask|full | Exec approval level |
| /whoami | Danh tính người gửi (alias: /id) |
| /context [list|detail|json] | Token usage per-file |
| /subagents spawn|list|kill|steer | Spawn/điều khiển sub-agents |
| /export-session [path] | Xuất session ra HTML |
| /approve allow-once|deny | Giải quyết exec approval |
:think high # Thinking level
:model opus # Model override
:fast # Fast mode
:send off # Tắt delivery
:verbose # Verbose mode
:reasoning on # Tách reasoning
:elevated ask # Exec approvalThiết Lập Kênh
Telegram ổn định nhất. WhatsApp cần QR scan. Discord hỗ trợ voice.
{ channels: { telegram: {
enabled: true,
botToken: "123456:ABC-DEF..."
}}}{ channels: { whatsapp: {
enabled: true,
allowFrom: ["+84..."],
groupPolicy: "allowlist"
}}}{ channels: { discord: {
enabled: true,
token: "BOT_TOKEN",
allowFrom: ["USER_ID"],
autoArchiveDuration: 4320
}}}| Kênh | Ghi chú |
|---|---|
| Telegram | Ổn định nhất. Bot API. DM voice. |
| QR scan. Mất kết nối khi reboot. | |
| Discord | Voice + text. DAVE recovery. |
| Google Chat | Native support. |
| Slack | Bot + App Token + Signing Secret. |
| iMessage | macOS only, Shortcuts bridge. |
| Signal | Cần signal-cli. |
| MS Teams | Extension channel. |
| Synology Chat | Native plugin. Webhook. MỚI |
| WebChat | Built-in tại localhost:18789 |
| Matrix | Extension. BlueBubbles, Zalo cũng hỗ trợ. |
Hệ Thống Bộ Nhớ
Nhật ký hàng ngày, MEMORY.md dài hạn, và vector search.
openclaw memory index --all
openclaw memory search --query "text"
openclaw sessions cleanup # Dọn dẹp dung lượngKỹ Năng & ClawHub
Mở rộng khả năng trợ lý — từ web search đến tự động hóa.
---
name: my-skill
description: "Mô tả chức năng"
metadata: { "openclaw": { "requires": {
"bins": ["uv"], "env": ["API_KEY"]
}}}
---| Key | Default | Effect |
|---|---|---|
| user-invocable | true | /slash command |
| disable-model-invocation | false | Loại khỏi prompt |
| command-dispatch | — | "tool" = bypass model |
| os | all | darwin, linux, win32 |
Heartbeat & Cron
Vòng lặp chủ động — chạy theo lịch, chỉ thông báo khi cần.
heartbeat: {
every: "30m", target: "last",
model: "cheap-model",
activeHours: { start: "08:00", end: "22:00",
timezone: "Asia/Ho_Chi_Minh" }
}{ "name": "Bản tin sáng",
"schedule": { "kind": "cron", "expr": "0 8 * * *" },
"sessionTarget": "isolated",
"payload": { "kind": "agentTurn",
"message": "Gửi bản tin sáng." }
}| Cron | Mô tả |
|---|---|
| 0 7 * * * | Bản tin sáng |
| 0 18 * * 1-5 | Tóm tắt ngày (thứ 2-6) |
| 0 10 * * 1 | Báo cáo tuần |
| 0 8 1 * * | Nhắc nhở tháng |
Nhà Cung Cấp Model
Chọn model ảnh hưởng chất lượng, tốc độ và chi phí.
| Provider | Format | Auth |
|---|---|---|
| Anthropic | anthropic/claude-* | API / OAuth |
| OpenAI | openai/gpt-* | API / OAuth |
| Mistral MỚI | mistral/* | API key |
| google/gemini-* | API key | |
| OpenRouter | openrouter/* | Single key |
| Kilo Gateway MỚI | kilocode/* | Auth + onboarding |
| Vercel AI GW | vercel-ai-gateway/* | Normalized refs |
| Amazon Bedrock | amazon-bedrock/* | AWS SDK |
| Ollama | ollama/* | Local |
| LM Studio | Custom baseUrl | Local |
models: { providers: { "ollama": {
baseUrl: "http://127.0.0.1:11434/v1",
apiKey: "ollama",
api: "openai-responses"
}}}Bảo Mật
SECURITYBắt đầu với DM pairing, allowlist và sandbox.
openclaw doctor --fix
openclaw security audit --deep
chmod 700 ~/.openclaw
chmod 600 ~/.openclaw/openclaw.json
chmod 700 ~/.openclaw/credentialssecurity: {
dmPolicy: "pairing",
groupPolicy: "allowlist",
sandboxEnabled: true,
trust_model: {
multi_user_heuristic: true
}
}Voice & TTS
Biến OpenClaw thành trợ lý rảnh tay với giọng nói.
| Provider | Chất lượng | Chi phí |
|---|---|---|
| ElevenLabs | Ultra-realistic | Premium |
| OpenAI TTS | Nhanh, chất lượng cao | Standard |
| Edge TTS | Đa ngôn ngữ | Miễn phí |
| Mistral Voice MỚI | Provider mới | Standard |
Xử Lý Sự Cố
openclaw doctor --deep --yes giải quyết 80% vấn đề.
openclaw doctor --deep --yes # Giải quyết 80% vấn đề| Vấn đề | Giải pháp |
|---|---|
| Port conflict | lsof -i :18789 |
| Context đầy | /compact hoặc /new |
| Kênh down | openclaw channels status --probe |
| Không phản hồi | openclaw logs --follow |
| WhatsApp mất kết nối | Scan lại QR. Dùng Telegram. |
| Config lỗi | openclaw config validate |
| Đầy ổ đĩa sessions | openclaw sessions cleanup |
sudo npm i -g openclaw@latest
openclaw update --dry-run
openclaw update wizardĐường Dẫn Quan Trọng
Biết file ở đâu để backup, debug và chỉnh tay.
~/.openclaw/
├── openclaw.json ← Config chính
├── credentials/ ← OAuth/API keys
├── workspace/ ← Nhà của Agent
│ ├── AGENTS.md SOUL.md USER.md
│ ├── TOOLS.md HEARTBEAT.md MEMORY.md
│ ├── memory/ ← Nhật ký hàng ngày
│ └── skills/ �� Workspace skills
├── agents/<id>/sessions/ ← Lịch sử chat
├── skills/ ← Managed skills
├── cron/jobs.json ← Lịch tự động
└── sandboxes/ ← SandboxThuật Ngữ
Tra cứu nhanh các thuật ngữ OpenClaw.
| Thuật ngữ | Giải thích |
|---|---|
| Gateway | Process chạy nền, định tuyến tin nhắn giữa kênh và AI |
| Workspace | Thư mục nhà của agent (~/.openclaw/workspace/) |
| SOUL.md | Tính cách agent — giọng điệu, giá trị. Tải mỗi phiên |
| ClawHub | Kho kỹ năng cộng đồng. clawhub install <slug> |
| Heartbeat | Kiểm tra định kỳ (mặc định 30m). Chỉ thông báo khi cần |
| Compaction | Tóm tắt context dài → nhật ký. Tự động hoặc /compact |
| Pairing | Liên kết danh tính user với kênh |
| Sandbox | Môi trường exec cách ly cho skills |
| JSON5 | Format config. Hỗ trợ comment (//) và trailing comma |
