乐于分享
好东西不私藏

一家人共用一个 AI 助手——OpenClaw + 微信实战

一家人共用一个 AI 助手——OpenClaw + 微信实战

一、理解概念

**1️⃣ Gateway = 一个「总机」**

– 跑在你家电脑/服务器上的一个进程

– 所有微信消息都经过它,再分发给 AI

**2️⃣ Agent = AI 的「人格」**

– 每个 Agent 有自己的:记忆(workspace)、对话历史(session)、性格(SOUL.md)

– 可以创建多个 Agent,比如:

  – `main` → 老公用的(记着你的健康档案、股票持仓)

  – `wife` → 老婆用的(记着她关心的事)

  – `kid` → 给孩子用的(耐心辅导风格)

**3️⃣ Session 隔离 = 互不偷看**

– 关键配置:`session.dmScope: “per-account-channel-peer”`

– 效果:张三发的消息,李四完全看不到

– 每个人有独立的对话上下文和记忆

**4️⃣ Pairing 配对 = 安全门禁**

– 新人第一次给 AI 发消息,会收到一个配对码

– 管理员批准后才能使用

– 防止陌生人骚扰你的 AI

二、实操步骤

**Step 1:安装 OpenClaw + 微信插件**(安装步骤看openclaw安装指南

npm install -g openclaw@latestopenclaw plugins install "@tencent-weixin/openclaw-weixin"openclaw channels login --channel openclaw-weixin# 扫码登录微信

**Step 2:创建多个 Agent**

openclaw agents add wifeopenclaw agents add kid

每个 Agent 有自己的 workspace,可以写不同的 SOUL.md:

– `wife/SOUL.md`:温柔的家政助手风格

– `kid/SOUL.md`:耐心的老师风格

**Step 3:配置 Session 隔离**

{  session: {    dmScope: "per-account-channel-peer"  }}

这行配置是关键——每个人的消息走独立会话。

**Step 4:配置路由绑定(bindings)**

{  agents: {    list: [      { id: "main", default: true },      { id: "wife" },      { id: "kid" }    ]  },  bindings: [    { peer: { kind: "openclaw-weixin", id: "老婆的微信ID" }, agentId: "wife" },    { peer: { kind: "openclaw-weixin", id: "孩子的微信ID" }, agentId: "kid" }  ]}

**Step 5:安全门禁**

# 新人发消息后会收到配对码openclaw pairing list openclaw-weixinopenclaw pairing approve openclaw-weixin <CODE>

三、进阶玩法

玩法                说明

**共享技能** `~/.openclaw/skills` 下的技能所��

**独立技能** 每个 Agent workspace 下的 `skills/` 只有自己能�

**不同模型** 给不同 Agent 配不同模型(便宜的给小孩用)

**群聊模式** 全家群可以设置 @AI 才回复

**身份关联** 同一个人多个渠道用 session.identity

四、最后附上架构图

┌──────────────┐     ┌──────────────┐     ┌──────────────┐│  老公的微信   │     │  老婆的微信   │     │  孩子的微信   │└──────┬───────┘     └──────┬───────┘     └──────┬───────┘       │                    │                    │       └────────────┬───────┴────────────┬───────┘                    │                    │            ┌───────▼────────────────────▼───────┐            │     OpenClaw Gateway (家里电脑)      │            │  ┌─────────┬─────────┬──────────┐  │            │  │ Agent:  │ Agent:  │ Agent:   │  │            │  │ main    │ wife    │ kid      │  │            │  │ 独立记忆 │ 独立记忆 │ 独立记忆  │  │            │  └─────────┴─────────┴──────────┘  │            └────────────────────────────────────┘

五、注意有坑

1. **微信插件是外部的**——需要单独安装,不在 OpenClaw 核心里

2. **必须开 dmScope**——不开的话所有人共享上下文,隐私全泄露

3. **配对码 1 小时过期**——过期了要让对方重新发消息

4. **每个 Agent 的 auth 是独立的**——OAuth token 不会自动复制