← Back to Skills Marketplace
wljmmx

Cross Channel Memory

by wljmmx · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ⚠ suspicious
280
Downloads
0
Stars
1
Active Installs
2
Versions
Install in OpenClaw
/install cross-channel-memory
Description
跨渠道记忆同步。实现QQ、飞书等多渠道用户身份识别和记忆共享。当用户在不同渠道与机器人对话时,agent能识别同一用户并读取统一记忆。触发条件:用户提到"跨渠道"、"多渠道"、"飞书和QQ"、"记忆同步"、"换渠道聊",或agent需要查询用户跨渠道历史时。
README (SKILL.md)

跨渠道记忆同步

概述

实现多渠道用户身份映射,让不同 agent 在 QQ、飞书等渠道识别同一用户,并共享记忆。

核心特性:

  • 用户身份统一:同一用户在不同渠道使用同一身份标识
  • 记忆共享:各渠道的对话记录统一存储,可跨渠道查询
  • 独立存储:每个 agent 的记忆保存在自己的 workspace 目录
  • 实时同步:写入时自动同步到所有关联 agent

架构设计

┌─────────────────────────────────────────────────────────────┐
│                    用户映射中心                              │
│         ~/.openclaw/data/cross-channel-users.json           │
│                                                             │
│  ┌─────────────────────────────────────────────────────┐    │
│  │ users: {                                            │    │
│  │   "xiaokeai": {                                     │    │
│  │     displayName: "小可爱",                           │    │
│  │     channels: {                                     │    │
│  │       qqbot: { main: "QQ_ID_123" },                 │    │
│  │       feishu: { main: "ou_abc123" }                 │    │
│  │     }                                               │    │
│  │   }                                                 │    │
│  │ }                                                   │    │
│  │ lookupIndex: {                                      │    │
│  │   qqbot: { "QQ_ID_123": { userId: "xiaokeai" } },   │    │
│  │   feishu: { "ou_abc123": { userId: "xiaokeai" } }   │    │
│  │ }                                                   │    │
│  └─────────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────────┘
                           │
           ┌───────────────┼───────────────┐
           ▼               ▼               ▼
    ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
    │   main      │ │   coder     │ │  checker    │
    │  workspace  │ │  workspace  │ │  workspace  │
    │             │ │             │ │             │
    │ memory/     │ │ memory/     │ │ memory/     │
    │ ├MEMORY.md  │ │ ├MEMORY.md  │ │ ├MEMORY.md  │
    │ └YYYY-MM-DD│ │ └YYYY-MM-DD│ │ └YYYY-MM-DD│
    └─────────────┘ └─────────────┘ └─────────────┘

使用方法

步骤 1:初始化用户映射

在用户首次使用时,需要建立渠道用户 ID 与统一用户 ID 的映射(按 agent 精确绑定):

# QQ coder agent 绑定
python3 ~/.openclaw/skills/cross-channel-memory/scripts/init_mapping.py link \
  --user "xiaokeai" \
  --channel qqbot \
  --channel-id "QQ_USER_ID" \
  --account coder

# 飞书 coder agent 绑定(同一用户)
python3 ~/.openclaw/skills/cross-channel-memory/scripts/init_mapping.py link \
  --user "xiaokeai" \
  --channel feishu \
  --channel-id "FEISHU_USER_ID" \
  --account coder

# 飞书 main agent 绑定(同一用户,不同 agent)
python3 ~/.openclaw/skills/cross-channel-memory/scripts/init_mapping.py link \
  --user "xiaokeai" \
  --channel feishu \
  --channel-id "FEISHU_USER_ID" \
  --account main

参数说明:

  • --user: 统一用户 ID (自定义,用于跨渠道识别)
  • --channel: 渠道名称 (qqbot, feishu)
  • --channel-id: 渠道中的用户 ID
  • --account: agent 标识 (coder, main, checker, menowriter 等)

步骤 2:查找用户信息(按 agent 精确查找)

根据渠道用户 ID 和 agent 查找统一用户信息:

python3 ~/.openclaw/skills/cross-channel-memory/scripts/memory_sync.py lookup \
  --channel qqbot \
  --id "QQ_USER_ID" \
  --account coder

返回:

{
  "userId": "xiaokeai",
  "displayName": "小可爱",
  "memoryPaths": [
    { "accountId": "coder", "memoryPath": "/home/user/.openclaw/workspace/coder/memory" }
  ],
  "accountId": "coder"
}

步骤 3:写入记忆(按 agent 精确写入)

将对话记录写入指定 agent 的记忆:

python3 ~/.openclaw/skills/cross-channel-memory/scripts/memory_sync.py write \
  --channel qqbot \
  --id "QQ_USER_ID" \
  --account coder \
  --type user \
  --content "我想学习 Python 编程" \
  --timestamp "2026-03-13T08:30:00"

步骤 4:读取记忆

使用内置工具读取记忆:

memory_search(query: "Python", path: "~/.openclaw/workspace/coder/memory")

渠道识别字段

渠道 用户ID字段 来源
QQ (qqbot) sender_id inbound_meta.sender_id
飞书 (feishu) sender_id / open_id inbound_meta.sender_id

目录结构

~/.openclaw/
├── skills/
│   └── cross-channel-memory/
│       ├── SKILL.md              # 本文档
│       ├── scripts/
│       │   ├── lookup_user.py    # 用户查找工具
│       │   ├── memory_sync.py    # 记忆同步工具
│       │   └── init_mapping.py   # 初始化脚本
│       └── examples/
│           └── sample_mapping.json
├── data/
│   └── cross-channel-users.json  # 用户映射(共享)
└── workspace/
    ├── main/memory/              # main agent 记忆
    ├── coder/memory/             # coder agent 记忆
    └── checker/memory/           # checker agent 记忆

配置示例

cross-channel-users.json(按 agent 精确绑定)

{
  "users": {
    "xiaokeai": {
      "displayName": "小可爱",
      "channels": {
        "qqbot": {
          "coder": "QQ_USER_ID_C"
        },
        "feishu": {
          "coder": "FEISHU_USER_ID_C",
          "main": "FEISHU_USER_ID_M",
          "checker": "FEISHU_USER_ID_K",
          "menowriter": "FEISHU_USER_ID_W"
        }
      }
    }
  },
  "lookupIndex": {
    "qqbot": {
      "QQ_USER_ID_C_coder": {
        "userId": "xiaokeai",
        "accountId": "coder",
        "channelUserId": "QQ_USER_ID_C"
      }
    },
    "feishu": {
      "FEISHU_USER_ID_C_coder": {
        "userId": "xiaokeai",
        "accountId": "coder",
        "channelUserId": "FEISHU_USER_ID_C"
      },
      "FEISHU_USER_ID_M_main": {
        "userId": "xiaokeai",
        "accountId": "main",
        "channelUserId": "FEISHU_USER_ID_M"
      }
    }
  }
}

绑定关系:

  • QQ coder agent ← 用户 QQ_USER_ID_C → 统一用户 xiaokeai → 飞书 coder agent
  • QQ main agent ← 用户 QQ_USER_ID_M → 统一用户 xiaokeai → 飞书 main agent
  • 每个渠道的每个 agent 精确绑定,记忆独立存储

Agent 使用流程

接收消息时

  1. 从 inbound_meta 获取 channel 和 sender_id
  2. 调用 lookup_user.py 查找统一用户 ID
  3. 如果找到,使用该用户的记忆路径

写入记忆时

  1. 使用 memory_sync.py write 命令
  2. 自动同步到用户关联的所有 agent

查询记忆时

  1. 使用 memory_search 工具
  2. 指定正确的记忆路径

注意事项

  1. 用户映射是共享的:所有 agent 使用同一份映射文件
  2. 记忆按 agent 分离:各 agent 的记忆独立存储在自己的 workspace
  3. 首次使用需初始化:新用户需要先建立映射关系
  4. 支持增量更新:可随时添加新的渠道映射

与内置 memory 工具配合

本 skill 与 OpenClaw 内置的 memory_search/memory_get 工具配合使用:

# 先用本 skill 查找用户
user_info = lookup_user(channel="qqbot", user_id="xxx")

# 再用内置工具搜索记忆
memory_search(query="Python", path=user_info["memoryPath"])

最佳实践

用户 ID 映射策略

  1. 统一 ID 命名:建议使用易识别的 ID,如用户昵称的拼音
  2. 渠道 ID 格式:直接使用渠道提供的原始 ID
  3. agent 绑定:如用户使用多个 agent,分别记录每个 agent 的渠道 ID

记忆存储建议

  1. 按日期组织:每日记忆存储在 YYYY-MM-DD.md
  2. 重要信息:永久记忆存储在 MEMORY.md
  3. 定期整理:建议定期将重要信息从日记忆迁移到永久记忆

更新日志

  • v1.1.0 (2026-03-13): 按 agent 精确绑定,QQ coder → 飞书 coder,支持多 agent 独立记忆
  • v1.0.0 (2026-03-13): 初始版本,支持 QQ 和飞书渠道
Usage Guidance
This skill is functionally coherent with its stated purpose, but review and adjust before installing: - Path hardcoding: the Python scripts use /home/wljmmx/.openclaw/... while documentation uses ~/.openclaw. Update the scripts to use a configurable base path or expand ~ at runtime; otherwise the scripts may fail or write into an unexpected home directory. - Privacy: the skill writes conversation content and mapping data to shared JSON and markdown files. If you install it, decide where those files should live, set proper filesystem permissions, and inform users that cross-channel history will be stored and potentially shared across agents. - Auto-creation: session_hooks auto-creates user mappings by default (auto_create=True). If you need explicit consent or verification, change that behavior before use. - Operational checks: test in a safe environment (non-production account) first. Run the provided tests and inspect the created files to confirm paths and contents. Consider locking down file permissions and backing up existing ~/.openclaw data. Given the absolute-path inconsistency and automatic writes/creation behavior, treat this skill as suspicious until the path and auto-create behaviors are fixed or confirmed acceptable.
Capability Analysis
Type: OpenClaw Skill Name: cross-channel-memory Version: 1.0.1 The skill bundle contains multiple scripts (init_mapping.py, lookup_user.py, memory_sync.py, and session_hooks.py) that use hardcoded absolute file paths pointing to a specific local user's home directory (/home/wljmmx/). While the logic appears to support the stated goal of cross-channel memory synchronization, hardcoding a specific username in a distributed skill bundle is a significant security and functional risk, as it targets a specific environment and lacks portability. There is no clear evidence of intentional data exfiltration or malicious intent, but the practice is highly irregular for a general-purpose agent skill.
Capability Assessment
Purpose & Capability
The skill's name/description (cross-channel identity mapping and memory sync) aligns with the provided scripts: init_mapping.py, lookup_user.py, memory_sync.py and session_hooks.py implement mapping, lookup, read/write of per-agent memory files and session hooks. There is no network or unrelated functionality. However, the code hardcodes filesystem roots (e.g. /home/wljmmx/.openclaw) while documentation references ~/.openclaw, which is an inconsistency that may cause unexpected behavior.
Instruction Scope
Runtime instructions and code focus on reading/writing mapping and memory files — consistent with purpose — but session_hooks automatically creates mappings (auto_create=True) and writes session-state files; this can create entries and write user-visible mapping files without explicit human approval. All scripts read/write global shared JSON and memory files containing conversation content, which is a privacy concern. The SKILL.md references tilde (~) paths but scripts use absolute /home/wljmmx paths, creating a scope mismatch.
Install Mechanism
There is no install spec (instruction-only install) and no external downloads or packages. The skill ships Python scripts that run locally; this is the lowest install risk, though the shipped code will be written to disk when the skill is installed/extracted by the platform.
Credentials
No environment variables or external credentials are requested (which is good). But the scripts directly access and create files under an absolute home path (/home/wljmmx/.openclaw/...) and workspace directories, storing potentially sensitive conversation data and shared mapping. The hard-coded /home/wljmmx path is disproportionate/unexpected: it assumes a specific user's home and will not adapt to the actual runtime user, leading to either failures or writes to someone else's home path if executed with sufficient privileges.
Persistence & Privilege
always:false and normal autonomous invocation settings. The skill persists data by creating and updating mapping JSON, per-agent memory markdown files, and session-state JSON in ~/.openclaw/data and workspace. That persistence is expected for a memory-sync tool, but note it writes global shared files across agents and will auto-create mappings and session state unless configured otherwise.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install cross-channel-memory
  3. After installation, invoke the skill by name or use /cross-channel-memory
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
cross-channel-memory v1.0.1 - Added basic automated tests (tests/test_all.py). - Improved lookup_user.py for code or test correctness. - No user-facing feature changes.
v1.0.0
cross-channel-memory v1.2.0 - 支持多渠道(QQ、飞书等)用户身份映射,实现跨渠道记忆共享与同步 - 新增按 agent 精确绑定,每个 agent 的用户 ID 映射和记忆独立管理 - 提供初始化、查找、写入等命令行脚本,便于操作用户映射与记忆同步 - 记忆可在各 agent 间实时同步,支持查询和同步用户历史记录 - 优化文档,详细说明使用步骤、数据结构与最佳实践
Metadata
Slug cross-channel-memory
Version 1.0.1
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 2
Frequently Asked Questions

What is Cross Channel Memory?

跨渠道记忆同步。实现QQ、飞书等多渠道用户身份识别和记忆共享。当用户在不同渠道与机器人对话时,agent能识别同一用户并读取统一记忆。触发条件:用户提到"跨渠道"、"多渠道"、"飞书和QQ"、"记忆同步"、"换渠道聊",或agent需要查询用户跨渠道历史时。 It is an AI Agent Skill for Claude Code / OpenClaw, with 280 downloads so far.

How do I install Cross Channel Memory?

Run "/install cross-channel-memory" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Cross Channel Memory free?

Yes, Cross Channel Memory is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Cross Channel Memory support?

Cross Channel Memory is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Cross Channel Memory?

It is built and maintained by wljmmx (@wljmmx); the current version is v1.0.1.

💬 Comments