ClawHub
SkillsPluginsOfficialDocsSupport
K
skills/duzhilei951/memory-vector-bge
AgentsKnowledge
#知识库#记忆系统#知识#记忆

memory-vector-bge

No summary provided.

duzhilei951@duzhilei951

memory-vector 技能 v2.0 (完整版)

分布式记忆系统,支持知识库 + 向量检索 + 自动蒸馏

🎯 整体架构

text
┌─────────────────────────────────────────────────────────────────┐
│                      记忆系统架构 (v2.0)                         │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │  知识库层 (长期记忆)                                       │  │
│  │  ├── MEMORY.md        - 核心准则/精选记忆                  │  │
│  │  ├── SOUL.md          - 人设定义                         │  │
│  │  ├── USER.md          - 用户信息                         │  │
│  │  └── AGENTS.md        - 智能体配置                        │  │
│  └──────────────────────────────────────────────────────────┘  │
│                              ↑                                   │
│                      [蒸馏同步]                                  │
│                              │                                   │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │  日志层 (中期记忆)                                        │  │
│  │  └── memory/YYYY-MM-DD.md - 每日对话日志                 │  │
│  └──────────────────────────────────────────────────────────┘  │
│                              ↑                                   │
│                      [自动蒸馏]                                  │
│                              │                                   │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │  向量层 (快速检索)                                        │  │
│  │  └── memory/vector/memories.json                        │  │
│  │       - 1024维向量 (BGE-M3)                               │  │
│  │       - 标签 + 重要性权重                                │  │
│  │       - 语义搜索支持                                      │  │
│  └──────────────────────────────────────────────────────────┘  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

📦 功能特性

v2.0 完整功能

功能说明
三层存储知识库 + 日志 + 向量,各司其职
自动蒸馏每日/每周自动提取关键信息
向量搜索BGE-M3 语义匹配,支持按标签/重要性筛选
智能评分综合评分 = 语义×0.7 + 重要性×0.3
定期同步蒸馏结果自动写入 MEMORY.md

🔧 环境变量配置

变量说明默认值
EMBEDDING_URLEmbedding 服务http://localhost:11434/v1/embeddings
EMBEDDING_MODELEmbedding 模型bge-m3
EMBEDDING_API_KEYAPI 密钥(空)
LLM_URLLLM 服务http://localhost:11434/v1/chat/completions
LLM_MODELLLM 模型qwen2.5:7b
DISTILL_DAYS蒸馏天数7

📁 文件结构

text
skills/memory-vector/
├── SKILL.md                    # 本文件
├── dist/
│   ├── memory-distill.js       # 蒸馏脚本
│   └── memory-search.js        # 搜索脚本
└── references/
    └── config.json             # 配置文件

🚀 使用方法

1. 蒸馏记忆

bash
# 蒸馏最近7天
node skills/memory-vector/dist/memory-distill.js

# 蒸馏最近30天
node skills/memory-vector/dist/memory-distill.js 30

蒸馏流程:

  1. 读取 memory/*.md 日志文件
  2. 分析内容,提取关键信息 + 标签 + 重要性
  3. 使用 BGE-M3 生成向量
  4. 存入 memory/vector/memories.json
  5. 更新 MEMORY.md 核心准则

2. 搜索记忆

bash
# 基本搜索
node memory-search.js "搜索内容"

# 按标签筛选
node memory-search.js "内容" --tag 家庭

# 按重要性筛选 (0-1)
node memory-search.js "内容" --min-importance 0.7

# 查看所有标签
node memory-search.js --tags

# 列出所有记忆
node memory-search.js --list

3. 自动蒸馏 (Heartbeat)

在 HEARTBEAT.md 中配置:

markdown
### 🧠 记忆维护(每3天执行一次)
1. 运行记忆蒸馏:
   - 命令: `node skills/memory-vector/dist/memory-distill.js 7`
   - 功能:
     - 读取近期7天日志
     - BGE-M3 向量化
     - 存入向量数据库
     - 同步到 MEMORY.md
2. 清理过期记忆

💡 方案对比

模式v1.0 (旧)v2.0 (新)
存储仅文件三层互补
搜索关键词匹配向量语义
重要性无0-1 权重
标签无多标签
同步无自动

📊 存储格式

memories.json (v2.0)

json
{
  "version": "2.0",
  "updated": "2026-03-23T12:00:00Z",
  "memories": [
    {
      "id": "2026-03-23-xxx",
      "content": "记忆内容...",
      "summary": "一句话摘要",
      "tags": ["家庭", "工作"],
      "importance": 0.8,
      "keyInfo": ["关键点1", "关键点2"],
      "embedding": [0.1, -0.2, ...],
      "source": "2026-03-23.md",
      "created": "2026-03-23T..."
    }
  ],
  "index": {
    "byTag": {
      "家庭": ["id1", "id2"],
      "工作": ["id1"]
    },
    "byImportance": [
      { "id": "id1", "importance": 0.9 },
      { "id": "id2", "importance": 0.7 }
    ]
  }
}

🔐 安全机制

  • 蒸馏时自动过滤敏感信息(API keys, tokens)
  • 不保存完整凭据到向量库
  • MEMORY.md 仅保存脱敏后的核心准则

⚠️ 注意事项

  1. Ollama 必须保持运行
  2. 首次运行需要足够日志才能生成向量
  3. 建议每周运行一次蒸馏
  4. 重要记忆会自动标注重要性分数

📈 性能

  • 向量维度: 1024 (BGE-M3)
  • 支持标签: 无限
  • 搜索速度: <100ms
  • 最大存储: 受磁盘空间限制

此技能为分布式记忆系统,结合知识库与向量检索

Related skills

More in Agents
Downloads
1.3kAll time
Security audit
Review
Last updated
2mo ago
Current version
v2.0.0
License
MIT-0

Install

$
openclaw skills install @duzhilei951/memory-vector-bge
Downloads
1.3kAll time
Security audit
Review
Last updated
2mo ago
Current version
v2.0.0
License
MIT-0
ClawHub

Skills and plugins for OpenClaw agents. Part of the wider OpenClaw ecosystem.

Explore docs

SkillsPluginsOfficialAudits

Publish SkillPublish PluginCreate org

OverviewOpenClawDocsBlog

SupportGitHubDiscord

Built alongside the OpenClaw ecosystem

LobsterCrabboxClickClackCrabfleetOctopoolClawSweeperagent-skillsdiscrawlgitcrawlslacrawlnotcrawltelecrawlgraincrawlcrawlkitcrawlbaracpxmcporterTachikomaclawpatchclawbenchPeekaboocookbookplugin-inspectorwacrawlcrabpotAll projectsLobsterCrabboxClickClackCrabfleetOctopoolClawSweeperagent-skillsdiscrawlgitcrawlslacrawlnotcrawltelecrawlgraincrawlcrawlkitcrawlbaracpxmcporterTachikomaclawpatchclawbenchPeekaboocookbookplugin-inspectorwacrawlcrabpotAll projects

© 2026 OpenClaw Foundation

Privacy policy·Status·Deployed on Vercel·Powered by Convex

....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals