OpenClaw Bí Kíp
Mọi lệnh, cấu hình, tệp và mẹo — trên một trang duy nhất.
Có Gì Mới v2026.3.28
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 | Native ClawHub flows |
- • Chrome extension relay đã bị xóa — chạy
openclaw doctor --fix - • nano-banana-pro skill đã bị xóa — dùng agents.defaults.imageGenerationModel
- • Legacy CLAWDBOT_*/MOLTBOT_* env đã bị xóa — dùng OPENCLAW_* và ~/.openclaw
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.
# npm global (Node.js 24+ required)
npm install -g openclaw@latest
# 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:watch- • Node.js 24+ (khuyên dùng) hoặc 22.16+
- • macOS 14+, Linux, hoặc Windows (WSL2)
- • API key: Anthropic, OpenAI, OpenRouter, Mistral, hoặc Google
- • RAM thấp?
export NODE_OPTIONS="--max-old-space-size=4096"
openclaw --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 |
- • AGENTS.md → quy tắc ổn định, không phải task tạm
- • SOUL.md → tính cách, không phải ticket
- • USER.md → cá nhân hóa (giọng, format)
- • TOOLS.md → hướng dẫn, không kiểm soát quyền
- • MEMORY.md → sự kiện quan trọng, không phải transcript
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
}}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|devLệ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 |
: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 approvalHủy bằng ngôn ngữ tự nhiên: "stop openclaw", "stop action", "please stop", "STOP!", "do not do that". Hoạt động cả tiếng Việt, ES, FR, ZH, JP, DE, PT, RU.
Thiế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 (grammY) | Ổn định nhất. Bot API. DM voice. |
| WhatsApp (Baileys) | QR scan. Mất kết nối khi reboot. |
| Discord (discord.js) | Voice + text. DAVE recovery. |
| Slack (Bolt) | Bot + App Token + Signing Secret. |
| Google Chat | Chat API. Native support. |
| WebChat | Giao diện tích hợp sẵn tại localhost:18789 |
Hệ Thống Bộ Nhớ
Nhật ký hàng ngày, MEMORY.md dài hạn, và vector search.
- • Nhật ký: memory/YYYY-MM-DD.md — hôm nay + hôm qua
- • Dài hạn: MEMORY.md — chỉ cho DM
- • Vector search — ~400 token chunks
- • Ngưỡng tự động nén: 40k tokens
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 |
| Mức | Loại | Đường dẫn |
|---|---|---|
| 1 | Workspace (Cao nhất) | workspace/skills/ |
| 2 | Managed | ~/.openclaw/skills/ |
| 3 | Bundled (Thấp nhất) | Nội bộ package |
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" }
}- • Mặc định: kiểm tra mỗi 30 phút
- • Rỗng hoặc trả về HEARTBEAT_OK → im lặng bỏ qua
- • Đặt every: "0m" → Tắt hoàn toàn heartbeat
{ "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 hàng ngày |
| 0 18 * * 1-5 | Tóm tắt ngày (Thứ 2 đến Thứ 6) |
| 0 10 * * 1 | Báo cáo đầu tuần |
Nhà Cung Cấp Model
Lựa chọn linh hoạt từ cloud API đến mô hình local miễn phí.
| Provider | Format ID | Auth |
|---|---|---|
| Anthropic | anthropic/claude-* | API / OAuth |
| OpenAI | openai/gpt-* | API / OAuth |
| google/gemini-* | API Key | |
| Mistral | mistral/* | API Key |
| Ollama | ollama/* | Local |
| OpenRouter | openrouter/* | Single Key |
models: { providers: { "ollama": {
baseUrl: "http://127.0.0.1:11434/v1",
apiKey: "ollama",
api: "openai-responses"
}}}Bảo Mật
SECURITYThiết lập giới hạn an toàn cho môi trường thực thi của Agent.
openclaw doctor --fix
openclaw security audit --deep
chmod 700 ~/.openclaw
chmod 600 ~/.openclaw/openclaw.jsonsecurity: {
dmPolicy: "pairing",
groupPolicy: "allowlist",
sandboxEnabled: true,
trust_model: {
multi_user_heuristic: true
}
}Voice & TTS
Biến OpenClaw thành trợ lý âm thanh rảnh tay.
| Provider | Chất lượng | Chi phí |
|---|---|---|
| ElevenLabs | Ultra-realistic | Premium |
| OpenAI TTS | Nhanh, chuẩn xác | Standard |
| Edge TTS | Hỗ trợ đa ngôn ngữ | Miễn phí |
/tts on|off
openclaw config set agent.voice.provider elevenlabsXử Lý Sự Cố
Bí kíp để tự khắc phục lỗi nhanh gọn.
| Vấn đề | Giải pháp |
|---|---|
| Port conflict | Chạy: lsof -i :18789 và kill tiến trình đó |
| Context đầy | Dùng lệnh /compact hoặc /new |
| WhatsApp lỗi mạng | Quét lại QR code từ thiết bị chính |
| Config bị lỗi JSON | Chạy: openclaw config validate |
openclaw doctor --deep --yes # Khắc phục tự động 80% lỗi
openclaw logs --follow # Theo dõi log thời gian thựcĐường Dẫn Quan Trọng
Biết rõ file nằm ở đâu để sao lưu, theo dõi log và tùy chỉnh tay.
~/.openclaw/
├── openclaw.json ← Cấu hình cốt lõi
├── credentials/ ← OAuth/API keys
├── workspace/ ← Nơi ở của Agent
│ ├── AGENTS.md, SOUL.md
│ └── skills/ ← Thư mục kỹ năng local
├── sessions/ ← Cơ sở dữ liệu chat
└── cron/jobs.json ← Lịch trình cronThuật Ngữ
Tra cứu nhanh các khái niệm nội bộ trong hệ sinh thái OpenClaw.
| Thuật ngữ | Giải thích |
|---|---|
| Gateway | Tiến trình chạy nền, định tuyến tin nhắn giữa nền tảng chat và AI |
| Workspace | Thư mục nhà chứa 'linh hồn' và dữ liệu của agent (~/.openclaw/workspace) |
| SOUL.md | Tệp văn bản định nghĩa tính cách, thái độ và giá trị của agent |
| ClawHub | Kho lưu trữ kỹ năng (skills) cộng đồng có thể cài đặt dễ dàng |
| Compaction | Quá trình tự động tóm tắt ngữ cảnh quá dài để tiết kiệm API token |
| Pairing | Quy trình xác thực an toàn liên kết danh tính người dùng với kênh chat |
💡 Không muốn cài đặt thủ công?
1 click setup hoàn chỉnh · Miễn phí tên miền · Từ 179K/tháng