本 Fork 针对任何本地小参数模型进行优化,不限特定硬件。只要在
openclaw.json中配置localprovider(支持 Ollama、vLLM、llama.cpp 等任何 OpenAI 兼容 API),即可自动启用所有优化。已在后摩智能 M50 NPU + Qwen3 30B / GPT-OSS 20B 上验证通过。
- 本地模型提示词优化 — 精简 system prompt,首字响应时间从 25-40 秒降到约 350 毫秒
- 工具精简 — 只保留 19 个常用工具,裁剪参数和描述,减少输入 token 数量
- 实时搜索能力 — 本地模型自动检测实时问题并搜索(Google Serper 优先,DuckDuckGo 备用),搜索结果注入对话防止模型编造答案;云端模型无搜索密钥时隐藏搜索工具避免报错
- 网络安全调整 — 放行内网测试地址,拦截云元数据地址
- 推理后端: Ollama、vLLM、llama.cpp、SGLang 等任何兼容 OpenAI API 的服务
- 硬件: NPU、GPU、CPU 均可,不绑定特定硬件
- 模型: 7B-30B 参数范围的小模型效果最佳(如 Qwen3、Llama、Mistral、GPT-OSS 等)
- 触发方式: 在
openclaw.json中将推理后端配置为localprovider,优化自动生效
This fork optimises OpenClaw for any local small-parameter model, regardless of hardware. Simply configure a
localprovider inopenclaw.json(works with Ollama, vLLM, llama.cpp, or any OpenAI-compatible API) and all optimisations activate automatically. Validated on the Houmo M50 NPU with Qwen3 30B and GPT-OSS 20B.
- Prompt optimisation — Slimmed system prompt, TTFT reduced from 25–40s to ~350ms
- Tool slimming — Whitelisted 19 essential tools with trimmed parameters and descriptions to cut token usage
- Real-time search — Auto-detects real-time queries for local models and searches via Google Serper (with DuckDuckGo fallback), injecting results into the conversation to prevent hallucination; hides the search tool from cloud models when no API key is present
- Network security — Permits RFC 2544 test addresses, blocks cloud metadata endpoints
- Inference backends: Ollama, vLLM, llama.cpp, SGLang, or any OpenAI-compatible API
- Hardware: NPU, GPU, or CPU — not tied to any specific hardware
- Models: Best suited for 7B–30B parameter models (e.g. Qwen3, Llama, Mistral, GPT-OSS)
- Activation: Configure your inference backend as a
localprovider inopenclaw.json— optimisations apply automatically
注意: 本 Fork 不发布到 npm,不能用
npm install -g openclaw安装。请从源码构建。
- Node.js ≥ 22
- pnpm (
npm install -g pnpm) - git(离线安装可不需要)
适用于全新机器,自动安装所有依赖(nvm、Node.js、pnpm、git)并构建。脚本会自动检测同目录下的源码压缩包(.tar.gz 或 .zip),优先使用本地包跳过 git clone。
# 克隆或下载本仓库
git clone --depth 1 https://github.com/DexterSLamb/openclaw-tianjun.git
cd openclaw-tianjun
# 可选:如果网络慢,先在浏览器下载源码包放到当前目录
# 浏览器打开: https://github.com/DexterSLamb/openclaw-tianjun/archive/refs/heads/main.zip
# 或: https://github.com/DexterSLamb/openclaw-tianjun/archive/refs/heads/main.tar.gz
# 运行安装脚本
chmod +x scripts/install-openclaw-fork.sh
./scripts/install-openclaw-fork.shgit clone https://github.com/DexterSLamb/openclaw-tianjun.git
cd openclaw-tianjun
pnpm install
node scripts/tsdown-build.mjs
pnpm ui:build
# 启动引导
node openclaw.mjs onboard --install-daemon网络较慢或无法访问 GitHub 时,可在其他机器下载后离线安装:
- 在能访问 GitHub 的机器上下载:
https://github.com/DexterSLamb/openclaw-tianjun/archive/refs/heads/main.zip - 将 zip 文件拷贝到目标机器,解压并构建:
unzip openclaw-tianjun-main.zip
cd openclaw-tianjun-main
pnpm install
node scripts/tsdown-build.mjs
pnpm ui:build
node openclaw.mjs onboard --install-daemon如果使用后摩智能 M50 NPU 运行本地模型,还需要:
- 安装 NPU 驱动和 SDK(参见后摩智能文档)
- 安装 llama-server:
# 需要 HLIELLama 安装包(向后摩智能获取)
./install-llama-server-1.4.0.sh- 在
~/.openclaw/openclaw.json中添加 local provider:
{
"models": {
"providers": {
"local": {
"baseUrl": "http://127.0.0.1:17701/v1",
"apiKey": "no-key",
"api": "openai-completions",
"models": [
{
"id": "qwen3-30b",
"name": "Qwen3 30B (NPU)",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 32768,
"maxTokens": 8192
},
{
"id": "gpt-oss-20b",
"name": "GPT-OSS 20B (NPU)",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 65536,
"maxTokens": 8192
}
]
}
}
},
"agents": { "defaults": { "model": "local/qwen3-30b" } },
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"auth": { "mode": "token", "token": "openclaw-local-token" }
}
}Note: This fork is NOT published to npm. Do not use
npm install -g openclaw. Build from source instead.
- Node.js ≥ 22
- pnpm (
npm install -g pnpm) - git (not required for offline install)
For fresh machines — automatically installs all dependencies (nvm, Node.js, pnpm, git) and builds. The script auto-detects local source archives (.tar.gz or .zip) in the same directory and uses them instead of git clone.
git clone --depth 1 https://github.com/DexterSLamb/openclaw-tianjun.git
cd openclaw-tianjun
# Optional: download source archive first if network is slow
# https://github.com/DexterSLamb/openclaw-tianjun/archive/refs/heads/main.zip
chmod +x scripts/install-openclaw-fork.sh
./scripts/install-openclaw-fork.shgit clone https://github.com/DexterSLamb/openclaw-tianjun.git
cd openclaw-tianjun
pnpm install
node scripts/tsdown-build.mjs
pnpm ui:build
# Launch onboarding
node openclaw.mjs onboard --install-daemonIf GitHub access is slow or unavailable, download the zip on another machine and transfer it:
- Download:
https://github.com/DexterSLamb/openclaw-tianjun/archive/refs/heads/main.zip - Unzip and build:
unzip openclaw-tianjun-main.zip
cd openclaw-tianjun-main
pnpm install
node scripts/tsdown-build.mjs
pnpm ui:build
node openclaw.mjs onboard --install-daemonTo run local models on a Houmo M50 NPU:
- Install NPU drivers and SDK (see Houmo documentation)
- Install llama-server:
# Requires HLIELLama package (obtain from Houmo)
./install-llama-server-1.4.0.sh- Add a local provider to
~/.openclaw/openclaw.json:
{
"models": {
"providers": {
"local": {
"baseUrl": "http://127.0.0.1:17701/v1",
"apiKey": "no-key",
"api": "openai-completions",
"models": [
{
"id": "qwen3-30b",
"name": "Qwen3 30B (NPU)",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 32768,
"maxTokens": 8192
},
{
"id": "gpt-oss-20b",
"name": "GPT-OSS 20B (NPU)",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 65536,
"maxTokens": 8192
}
]
}
}
},
"agents": { "defaults": { "model": "local/qwen3-30b" } },
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"auth": { "mode": "token", "token": "openclaw-local-token" }
}
}
EXFOLIATE! EXFOLIATE!
OpenClaw is a personal AI assistant you run on your own devices. It answers you on the channels you already use (WhatsApp, Telegram, Slack, Discord, Google Chat, Signal, iMessage, BlueBubbles, IRC, Microsoft Teams, Matrix, Feishu, LINE, Mattermost, Nextcloud Talk, Nostr, Synology Chat, Tlon, Twitch, Zalo, Zalo Personal, WebChat). It can speak and listen on macOS/iOS/Android, and can render a live Canvas you control. The Gateway is just the control plane — the product is the assistant.
If you want a personal, single-user assistant that feels local, fast, and always-on, this is it.
Website · Docs · Vision · DeepWiki · Getting Started · Updating · Showcase · FAQ · Wizard · Nix · Docker · Discord
Preferred setup: run the onboarding wizard (openclaw onboard) in your terminal.
The wizard guides you step by step through setting up the gateway, workspace, channels, and skills. The CLI wizard is the recommended path and works on macOS, Linux, and Windows (via WSL2; strongly recommended).
Works with npm, pnpm, or bun.
New install? Start here: Getting started
| OpenAI | Vercel | Blacksmith | Convex |
|---|---|---|---|
Subscriptions (OAuth):
- OpenAI (ChatGPT/Codex)
Model note: while many providers/models are supported, for the best experience and lower prompt-injection risk use the strongest latest-generation model available to you. See Onboarding.
- Models config + CLI: Models
- Auth profile rotation (OAuth vs API keys) + fallbacks: Model failover
Runtime: Node ≥22.
npm install -g openclaw@latest
# or: pnpm add -g openclaw@latest
openclaw onboard --install-daemonThe wizard installs the Gateway daemon (launchd/systemd user service) so it stays running.
Runtime: Node ≥22.
Full beginner guide (auth, pairing, channels): Getting started
openclaw onboard --install-daemon
openclaw gateway --port 18789 --verbose
# Send a message
openclaw message send --to +1234567890 --message "Hello from OpenClaw"
# Talk to the assistant (optionally deliver back to any connected channel: WhatsApp/Telegram/Slack/Discord/Google Chat/Signal/iMessage/BlueBubbles/IRC/Microsoft Teams/Matrix/Feishu/LINE/Mattermost/Nextcloud Talk/Nostr/Synology Chat/Tlon/Twitch/Zalo/Zalo Personal/WebChat)
openclaw agent --message "Ship checklist" --thinking highUpgrading? Updating guide (and run openclaw doctor).
- stable: tagged releases (
vYYYY.M.DorvYYYY.M.D-<patch>), npm dist-taglatest. - beta: prerelease tags (
vYYYY.M.D-beta.N), npm dist-tagbeta(macOS app may be missing). - dev: moving head of
main, npm dist-tagdev(when published).
Switch channels (git + npm): openclaw update --channel stable|beta|dev.
Details: Development channels.
Prefer pnpm for builds from source. Bun is optional for running TypeScript directly.
git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
pnpm ui:build # auto-installs UI deps on first run
pnpm build
pnpm openclaw onboard --install-daemon
# Dev loop (auto-reload on TS changes)
pnpm gateway:watchNote: pnpm openclaw ... runs TypeScript directly (via tsx). pnpm build produces dist/ for running via Node / the packaged openclaw binary.
OpenClaw connects to real messaging surfaces. Treat inbound DMs as untrusted input.
Full security guide: Security
Default behavior on Telegram/WhatsApp/Signal/iMessage/Microsoft Teams/Discord/Google Chat/Slack:
- DM pairing (
dmPolicy="pairing"/channels.discord.dmPolicy="pairing"/channels.slack.dmPolicy="pairing"; legacy:channels.discord.dm.policy,channels.slack.dm.policy): unknown senders receive a short pairing code and the bot does not process their message. - Approve with:
openclaw pairing approve <channel> <code>(then the sender is added to a local allowlist store). - Public inbound DMs require an explicit opt-in: set
dmPolicy="open"and include"*"in the channel allowlist (allowFrom/channels.discord.allowFrom/channels.slack.allowFrom; legacy:channels.discord.dm.allowFrom,channels.slack.dm.allowFrom).
Run openclaw doctor to surface risky/misconfigured DM policies.
- Local-first Gateway — single control plane for sessions, channels, tools, and events.
- Multi-channel inbox — WhatsApp, Telegram, Slack, Discord, Google Chat, Signal, BlueBubbles (iMessage), iMessage (legacy), IRC, Microsoft Teams, Matrix, Feishu, LINE, Mattermost, Nextcloud Talk, Nostr, Synology Chat, Tlon, Twitch, Zalo, Zalo Personal, WebChat, macOS, iOS/Android.
- Multi-agent routing — route inbound channels/accounts/peers to isolated agents (workspaces + per-agent sessions).
- Voice Wake + Talk Mode — wake words on macOS/iOS and continuous voice on Android (ElevenLabs + system TTS fallback).
- Live Canvas — agent-driven visual workspace with A2UI.
- First-class tools — browser, canvas, nodes, cron, sessions, and Discord/Slack actions.
- Companion apps — macOS menu bar app + iOS/Android nodes.
- Onboarding + skills — wizard-driven setup with bundled/managed/workspace skills.
- Gateway WS control plane with sessions, presence, config, cron, webhooks, Control UI, and Canvas host.
- CLI surface: gateway, agent, send, wizard, and doctor.
- Pi agent runtime in RPC mode with tool streaming and block streaming.
- Session model:
mainfor direct chats, group isolation, activation modes, queue modes, reply-back. Group rules: Groups. - Media pipeline: images/audio/video, transcription hooks, size caps, temp file lifecycle. Audio details: Audio.
- Channels: WhatsApp (Baileys), Telegram (grammY), Slack (Bolt), Discord (discord.js), Google Chat (Chat API), Signal (signal-cli), BlueBubbles (iMessage, recommended), iMessage (legacy imsg), IRC, Microsoft Teams, Matrix, Feishu, LINE, Mattermost, Nextcloud Talk, Nostr, Synology Chat, Tlon, Twitch, Zalo, Zalo Personal, WebChat.
- Group routing: mention gating, reply tags, per-channel chunking and routing. Channel rules: Channels.
- macOS app: menu bar control plane, Voice Wake/PTT, Talk Mode overlay, WebChat, debug tools, remote gateway control.
- iOS node: Canvas, Voice Wake, Talk Mode, camera, screen recording, Bonjour + device pairing.
- Android node: Connect tab (setup code/manual), chat sessions, voice tab, Canvas, camera/screen recording, and Android device commands (notifications/location/SMS/photos/contacts/calendar/motion/app update).
- macOS node mode: system.run/notify + canvas/camera exposure.
- Browser control: dedicated openclaw Chrome/Chromium, snapshots, actions, uploads, profiles.
- Canvas: A2UI push/reset, eval, snapshot.
- Nodes: camera snap/clip, screen record, location.get, notifications.
- Cron + wakeups; webhooks; Gmail Pub/Sub.
- Skills platform: bundled, managed, and workspace skills with install gating + UI.
- Channel routing, retry policy, and streaming/chunking.
- Presence, typing indicators, and usage tracking.
- Models, model failover, and session pruning.
- Security and troubleshooting.
- Control UI + WebChat served directly from the Gateway.
- Tailscale Serve/Funnel or SSH tunnels with token/password auth.
- Nix mode for declarative config; Docker-based installs.
- Doctor migrations, logging.
WhatsApp / Telegram / Slack / Discord / Google Chat / Signal / iMessage / BlueBubbles / IRC / Microsoft Teams / Matrix / Feishu / LINE / Mattermost / Nextcloud Talk / Nostr / Synology Chat / Tlon / Twitch / Zalo / Zalo Personal / WebChat
│
▼
┌───────────────────────────────┐
│ Gateway │
│ (control plane) │
│ ws://127.0.0.1:18789 │
└──────────────┬────────────────┘
│
├─ Pi agent (RPC)
├─ CLI (openclaw …)
├─ WebChat UI
├─ macOS app
└─ iOS / Android nodes
- Gateway WebSocket network — single WS control plane for clients, tools, and events (plus ops: Gateway runbook).
- Tailscale exposure — Serve/Funnel for the Gateway dashboard + WS (remote access: Remote).
- Browser control — openclaw‑managed Chrome/Chromium with CDP control.
- Canvas + A2UI — agent‑driven visual workspace (A2UI host: Canvas/A2UI).
- Voice Wake + Talk Mode — wake words on macOS/iOS plus continuous voice on Android.
- Nodes — Canvas, camera snap/clip, screen record,
location.get, notifications, plus macOS‑onlysystem.run/system.notify.
OpenClaw can auto-configure Tailscale Serve (tailnet-only) or Funnel (public) while the Gateway stays bound to loopback. Configure gateway.tailscale.mode:
off: no Tailscale automation (default).serve: tailnet-only HTTPS viatailscale serve(uses Tailscale identity headers by default).funnel: public HTTPS viatailscale funnel(requires shared password auth).
Notes:
gateway.bindmust stayloopbackwhen Serve/Funnel is enabled (OpenClaw enforces this).- Serve can be forced to require a password by setting
gateway.auth.mode: "password"orgateway.auth.allowTailscale: false. - Funnel refuses to start unless
gateway.auth.mode: "password"is set. - Optional:
gateway.tailscale.resetOnExitto undo Serve/Funnel on shutdown.
Details: Tailscale guide · Web surfaces
It’s perfectly fine to run the Gateway on a small Linux instance. Clients (macOS app, CLI, WebChat) can connect over Tailscale Serve/Funnel or SSH tunnels, and you can still pair device nodes (macOS/iOS/Android) to execute device‑local actions when needed.
- Gateway host runs the exec tool and channel connections by default.
- Device nodes run device‑local actions (
system.run, camera, screen recording, notifications) vianode.invoke. In short: exec runs where the Gateway lives; device actions run where the device lives.
Details: Remote access · Nodes · Security
The macOS app can run in node mode and advertises its capabilities + permission map over the Gateway WebSocket (node.list / node.describe). Clients can then execute local actions via node.invoke:
system.runruns a local command and returns stdout/stderr/exit code; setneedsScreenRecording: trueto require screen-recording permission (otherwise you’ll getPERMISSION_MISSING).system.notifyposts a user notification and fails if notifications are denied.canvas.*,camera.*,screen.record, andlocation.getare also routed vianode.invokeand follow TCC permission status.
Elevated bash (host permissions) is separate from macOS TCC:
- Use
/elevated on|offto toggle per‑session elevated access when enabled + allowlisted. - Gateway persists the per‑session toggle via
sessions.patch(WS method) alongsidethinkingLevel,verboseLevel,model,sendPolicy, andgroupActivation.
Details: Nodes · macOS app · Gateway protocol
- Use these to coordinate work across sessions without jumping between chat surfaces.
sessions_list— discover active sessions (agents) and their metadata.sessions_history— fetch transcript logs for a session.sessions_send— message another session; optional reply‑back ping‑pong + announce step (REPLY_SKIP,ANNOUNCE_SKIP).
Details: Session tools
ClawHub is a minimal skill registry. With ClawHub enabled, the agent can search for skills automatically and pull in new ones as needed.
Send these in WhatsApp/Telegram/Slack/Google Chat/Microsoft Teams/WebChat (group commands are owner-only):
/status— compact session status (model + tokens, cost when available)/newor/reset— reset the session/compact— compact session context (summary)/think <level>— off|minimal|low|medium|high|xhigh (GPT-5.2 + Codex models only)/verbose on|off/usage off|tokens|full— per-response usage footer/restart— restart the gateway (owner-only in groups)/activation mention|always— group activation toggle (groups only)
The Gateway alone delivers a great experience. All apps are optional and add extra features.
If you plan to build/run companion apps, follow the platform runbooks below.
- Menu bar control for the Gateway and health.
- Voice Wake + push-to-talk overlay.
- WebChat + debug tools.
- Remote gateway control over SSH.
Note: signed builds required for macOS permissions to stick across rebuilds (see docs/mac/permissions.md).
- Pairs as a node over the Gateway WebSocket (device pairing).
- Voice trigger forwarding + Canvas surface.
- Controlled via
openclaw nodes ….
Runbook: iOS connect.
- Pairs as a WS node via device pairing (
openclaw devices ...). - Exposes Connect/Chat/Voice tabs plus Canvas, Camera, Screen capture, and Android device command families.
- Runbook: Android connect.
- Workspace root:
~/.openclaw/workspace(configurable viaagents.defaults.workspace). - Injected prompt files:
AGENTS.md,SOUL.md,TOOLS.md. - Skills:
~/.openclaw/workspace/skills/<skill>/SKILL.md.
Minimal ~/.openclaw/openclaw.json (model + defaults):
{
agent: {
model: "anthropic/claude-opus-4-6",
},
}Full configuration reference (all keys + examples).
- Default: tools run on the host for the main session, so the agent has full access when it’s just you.
- Group/channel safety: set
agents.defaults.sandbox.mode: "non-main"to run non‑main sessions (groups/channels) inside per‑session Docker sandboxes; bash then runs in Docker for those sessions. - Sandbox defaults: allowlist
bash,process,read,write,edit,sessions_list,sessions_history,sessions_send,sessions_spawn; denylistbrowser,canvas,nodes,cron,discord,gateway.
Details: Security guide · Docker + sandboxing · Sandbox config
- Link the device:
pnpm openclaw channels login(stores creds in~/.openclaw/credentials). - Allowlist who can talk to the assistant via
channels.whatsapp.allowFrom. - If
channels.whatsapp.groupsis set, it becomes a group allowlist; include"*"to allow all.
- Set
TELEGRAM_BOT_TOKENorchannels.telegram.botToken(env wins). - Optional: set
channels.telegram.groups(withchannels.telegram.groups."*".requireMention); when set, it is a group allowlist (include"*"to allow all). Alsochannels.telegram.allowFromorchannels.telegram.webhookUrl+channels.telegram.webhookSecretas needed.
{
channels: {
telegram: {
botToken: "123456:ABCDEF",
},
},
}- Set
SLACK_BOT_TOKEN+SLACK_APP_TOKEN(orchannels.slack.botToken+channels.slack.appToken).
- Set
DISCORD_BOT_TOKENorchannels.discord.token(env wins). - Optional: set
commands.native,commands.text, orcommands.useAccessGroups, pluschannels.discord.allowFrom,channels.discord.guilds, orchannels.discord.mediaMaxMbas needed.
{
channels: {
discord: {
token: "1234abcd",
},
},
}- Requires
signal-cliand achannels.signalconfig section.
- Recommended iMessage integration.
- Configure
channels.bluebubbles.serverUrl+channels.bluebubbles.passwordand a webhook (channels.bluebubbles.webhookPath). - The BlueBubbles server runs on macOS; the Gateway can run on macOS or elsewhere.
- Legacy macOS-only integration via
imsg(Messages must be signed in). - If
channels.imessage.groupsis set, it becomes a group allowlist; include"*"to allow all.
- Configure a Teams app + Bot Framework, then add a
msteamsconfig section. - Allowlist who can talk via
msteams.allowFrom; group access viamsteams.groupAllowFromormsteams.groupPolicy: "open".
- Uses the Gateway WebSocket; no separate WebChat port/config.
Browser control (optional):
{
browser: {
enabled: true,
color: "#FF4500",
},
}Use these when you’re past the onboarding flow and want the deeper reference.
- Start with the docs index for navigation and “what’s where.”
- Read the architecture overview for the gateway + protocol model.
- Use the full configuration reference when you need every key and example.
- Run the Gateway by the book with the operational runbook.
- Learn how the Control UI/Web surfaces work and how to expose them safely.
- Understand remote access over SSH tunnels or tailnets.
- Follow the onboarding wizard flow for a guided setup.
- Wire external triggers via the webhook surface.
- Set up Gmail Pub/Sub triggers.
- Learn the macOS menu bar companion details.
- Platform guides: Windows (WSL2), Linux, macOS, iOS, Android
- Debug common failures with the troubleshooting guide.
- Review security guidance before exposing anything.
- Skills config
- Default AGENTS
- Templates: AGENTS
- Templates: BOOTSTRAP
- Templates: IDENTITY
- Templates: SOUL
- Templates: TOOLS
- Templates: USER
OpenClaw was built for Molty, a space lobster AI assistant. 🦞 by Peter Steinberger and the community.
See CONTRIBUTING.md for guidelines, maintainers, and how to submit PRs. AI/vibe-coded PRs welcome! 🤖
Special thanks to Mario Zechner for his support and for pi-mono. Special thanks to Adam Doppelt for lobster.bot.
Thanks to all clawtributors: