v2026.3.28 · 16 phần · 150+ lệnh

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

NEW
🔗 Liên kết

Các tính năng mới nhất trong bản phát hành gần đây.

Tính năng mới
Tính năngChi tiết
Qwen DashScopeEndpoint pay-as-you-go cho Qwen API keys (Trung Quốc & toàn cầu)
UI ClarityTheme Knot, icon config, WCAG 2.1 AA contrast
Bundled Plugin RuntimesWhatsApp, Matrix runtime sidecar trở lại npm
Channel AuthAuto-select single channel, hardened ids
openclaw skills search|installNative ClawHub flows
Breaking Changes v2026.3.22
  • • 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
Cập nhật ngay
sudo npm i -g openclaw@latest
openclaw update status
openclaw update --dry-run    # Xem trước
openclaw update wizard
openclaw gateway restart

Cài Đặt Nhanh

🔗 Liên kết

Con đường nhanh nhất từ zero đến trợ lý AI hoạt động.

One-Liner
# npm global (Node.js 24+ required)
npm install -g openclaw@latest

# Onboard wizard
openclaw onboard --install-daemon
Từ Source
git 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
Yêu cầu hệ thống
  • • 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"
Kiểm tra sau cài đặt
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 web
📁

Tệp Workspace

🔗 Liên kết

Hành vi của OpenClaw được định nghĩa bởi các file workspace, không phải prompt ẩn.

Bảng tham chiếu
FileMục đíchTải khi
AGENTS.mdHướng dẫn vận hành, ưu tiên, quy trìnhMỗi phiên
SOUL.mdTính cách, giọng điệu, giá trịMỗi phiên
USER.mdVề bạn — tên, sở thích, phong cáchMỗi phiên
IDENTITY.mdTên agent, vai trò, mục tiêuMỗi phiên
TOOLS.mdGhi chú công cụ, calendar IDMỗi phiên
HEARTBEAT.mdChecklist cho heartbeatChỉ heartbeat
BOOT.mdNghi thức khởi động khi restartBoot hook
MEMORY.mdBộ nhớ dài hạn (tùy chọn)Chỉ DM chính
memory/YYYY-MM-DD.mdNhật ký hàng ngàyKhởi đầu phiên
Nên đặt ở đâu
  • • 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
Git Backup
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

CONFIG
🔗 Liên kết

Hầu hết vấn đề setup đến từ cấu hình sai: model, channel auth, heartbeat.

Config khởi đầu
// ~/.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..." } }
}
CLI Cấu hình
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 đổi
Model Fallbacks
agent: { 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

CLI
🔗 Liên kết

Giao diện chính để quản lý gateway, kênh, agent và plugin.

Gateway
openclaw gateway status|start|stop|restart
openclaw dashboard         # Giao diện web
openclaw tui               # Giao diện terminal
Kênh
openclaw 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 --delete
Agent
openclaw agents list --bindings
openclaw agents add|delete <tên>
openclaw agents bindings|bind|unbind
openclaw agents set-identity --from-identity
Nhật ký & Chẩn đoán
openclaw logs --follow
openclaw logs --json --limit 200
openclaw status --all --deep
openclaw status --usage
openclaw doctor --deep --yes
openclaw health --json --verbose
Plugin & Kỹ năng
openclaw plugins list|info|enable|disable|install|doctor
openclaw skills list|info|check
clawhub install|uninstall <slug>
clawhub update --all
Phiên & Cập nhật
openclaw 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|dev
💬

Lệnh Slash

🔗 Liên kết

Được Gateway xử lý trước khi AI nhìn thấy — nhanh và chính xác.

Lệnh trong chat
LệnhChức năng
/statusModel, context, queue, runtime
/help, /commandsCá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
/stopHủ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|costFooter mỗi response
/fastToggle fast mode (Anthropic/OpenAI)
/tts on|off|always|inboundToggle text-to-speech
/send on|off|inheritOverride delivery (owner-only)
/reasoning on|off|streamTách reasoning message
/elevated on|off|ask|fullExec approval level
/whoamiDanh tính người gửi (alias: /id)
/context [list|detail|json]Token usage per-file
/subagents spawn|list|kill|steerSpawn/điều khiển sub-agents
Directives
: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 approval
Stop Phrases

Hủ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

🔗 Liên kết

Telegram ổn định nhất. WhatsApp cần QR scan. Discord hỗ trợ voice.

Telegram
{ channels: { telegram: {
  enabled: true,
  botToken: "123456:ABC-DEF..."
}}}
WhatsApp
{ channels: { whatsapp: {
  enabled: true,
  allowFrom: ["+84..."],
  groupPolicy: "allowlist"
}}}
Discord
{ channels: { discord: {
  enabled: true,
  token: "BOT_TOKEN",
  allowFrom: ["USER_ID"],
  autoArchiveDuration: 4320
}}}
Tất cả kênh phổ biến
KênhGhi 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 ChatChat API. Native support.
WebChatGiao diện tích hợp sẵn tại localhost:18789
🧠

Hệ Thống Bộ Nhớ

🔗 Liên kết

Nhật ký hàng ngày, MEMORY.md dài hạn, và vector search.

Cách hoạt động
  • • 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
CLI Bộ nhớ
openclaw memory index --all
openclaw memory search --query "text"
openclaw sessions cleanup    # Dọn dẹp dung lượng
🧩

Kỹ Năng & ClawHub

🔗 Liên kết

Mở rộng khả năng trợ lý — từ web search đến tự động hóa.

SKILL.md Format
---
name: my-skill
description: "Mô tả chức năng"
metadata: { "openclaw": { "requires": {
  "bins": ["uv"], "env": ["API_KEY"]
}}}
---
Frontmatter Options
KeyDefaultEffect
user-invocabletrue/slash command
disable-model-invocationfalseLoại khỏi prompt
command-dispatch"tool" = bypass model
osalldarwin, linux, win32
Thứ tự ưu tiên
MứcLoạiĐường dẫn
1Workspace (Cao nhất)workspace/skills/
2Managed~/.openclaw/skills/
3Bundled (Thấp nhất)Nội bộ package
💓

Heartbeat & Cron

🔗 Liên kết

Vòng lặp chủ động — chạy theo lịch, chỉ thông báo khi cần.

Heartbeat Config
heartbeat: {
  every: "30m", target: "last",
  model: "cheap-model",
  activeHours: { start: "08:00", end: "22:00",
    timezone: "Asia/Ho_Chi_Minh" }
}
Cách hoạt động
  • • 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
Cron Job Format
{ "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." }
}
CronMô tả
0 7 * * *Bản tin sáng hàng ngày
0 18 * * 1-5Tóm tắt ngày (Thứ 2 đến Thứ 6)
0 10 * * 1Báo cáo đầu tuần
🤖

Nhà Cung Cấp Model

🔗 Liên kết

Lựa chọn linh hoạt từ cloud API đến mô hình local miễn phí.

Danh sách Provider
ProviderFormat IDAuth
Anthropicanthropic/claude-*API / OAuth
OpenAIopenai/gpt-*API / OAuth
Googlegoogle/gemini-*API Key
Mistralmistral/*API Key
Ollamaollama/*Local
OpenRouteropenrouter/*Single Key
Local LLM (Ollama)
models: { providers: { "ollama": {
  baseUrl: "http://127.0.0.1:11434/v1",
  apiKey: "ollama",
  api: "openai-responses"
}}}
🔐

Bảo Mật

SECURITY
🔗 Liên kết

Thiết lập giới hạn an toàn cho môi trường thực thi của Agent.

Lệnh kiểm tra
openclaw doctor --fix
openclaw security audit --deep
chmod 700 ~/.openclaw
chmod 600 ~/.openclaw/openclaw.json
Chính sách an toàn
security: {
  dmPolicy: "pairing",
  groupPolicy: "allowlist",
  sandboxEnabled: true,
  trust_model: {
    multi_user_heuristic: true
  }
}
🔊

Voice & TTS

🔗 Liên kết

Biến OpenClaw thành trợ lý âm thanh rảnh tay.

Nhà cung cấp TTS
ProviderChất lượngChi phí
ElevenLabsUltra-realisticPremium
OpenAI TTSNhanh, chuẩn xácStandard
Edge TTSHỗ trợ đa ngôn ngữMiễn phí
/tts on|off
openclaw config set agent.voice.provider elevenlabs
🔧

Xử Lý Sự Cố

🔗 Liên kết

Bí kíp để tự khắc phục lỗi nhanh gọn.

Vấn đề thường gặp
Vấn đềGiải pháp
Port conflictChạy: lsof -i :18789 và kill tiến trình đó
Context đầyDùng lệnh /compact hoặc /new
WhatsApp lỗi mạngQuét lại QR code từ thiết bị chính
Config bị lỗi JSONChạy: openclaw config validate
Theo dõi lỗi
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

🔗 Liên kết

Biết rõ file nằm ở đâu để sao lưu, theo dõi log và tùy chỉnh tay.

Cấu trúc thư mục
~/.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 cron
📖

Thuật Ngữ

🔗 Liên kết

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
GatewayTiến trình chạy nền, định tuyến tin nhắn giữa nền tảng chat và AI
WorkspaceThư mục nhà chứa 'linh hồn' và dữ liệu của agent (~/.openclaw/workspace)
SOUL.mdTệp văn bản định nghĩa tính cách, thái độ và giá trị của agent
ClawHubKho lưu trữ kỹ năng (skills) cộng đồng có thể cài đặt dễ dàng
CompactionQuá trình tự động tóm tắt ngữ cảnh quá dài để tiết kiệm API token
PairingQuy 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

Xem gói VPS