rag-memory

智能记忆系统,支持 SQLite(零配置)和 Milvus(向量搜索)后端。用于存储、检索和管理 AI 助手的记忆,支持语义搜索和自动备份。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "rag-memory" with this command: npx skills add liushuangfa666/mem-rag-milvus

RAG Memory Skill - 智能记忆系统

📚 描述

支持多种后端的智能记忆系统,可选择:

  • SQLite(默认):开箱即用,无需额外服务
  • Milvus:向量数据库,支持语义搜索
  • ChromaDB:轻量级向量数据库(待实现)

🏗️ 架构

SQLite 模式(默认)

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│  OpenClaw   │ ──> │ RAG Memory   │ ──> │   SQLite    │
│  (记忆请求)  │     │   (技能模块)  │     │  (本地 DB)  │
└─────────────┘     └──────────────┘     └─────────────┘

Milvus 模式(可选)

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│  OpenClaw   │ ──> │ RAG Memory   │ ──> │   Milvus    │
│  (记忆请求)  │     │   (技能模块)  │     │ (向量存储)  │
└─────────────┘     └──────────────┘     └─────────────┘
                           │
                           v
                    ┌──────────────┐
                    │   Ollama     │
                    │  (可选)      │
                    │  嵌入生成     │
                    └──────────────┘

🔧 配置

快速开始(SQLite - 无需配置)

# 直接使用,零配置
python -c "from rag_memory import store, search; store('测试记忆')"

Milvus 模式(高级用户)

# 环境变量配置
export RAG_MEMORY_BACKEND=milvus
export MILVUS_URL=http://localhost:19530
export OLLAMA_URL=http://localhost:11434  # 可选,用于向量搜索

# 安装依赖
pip install pymilvus

所有环境变量

RAG_MEMORY_BACKEND=sqlite          # sqlite | milvus | chromadb
RAG_MEMORY_SQLITE_DB=./memory.db   # SQLite 数据库路径
MILVUS_URL=http://localhost:19530  # Milvus 服务地址
OLLAMA_URL=http://localhost:11434  # Ollama 服务地址(可选)
RAG_MEMORY_COLLECTION=openclaw_memory  # 集合名称
RAG_MEMORY_BACKUP_DIR=./memory_backup  # 备份目录

依赖

最小依赖(SQLite 模式)

pip install requests

完整依赖(Milvus 模式)

pip install requests pymilvus

📖 使用方法

Python API

from rag_memory import store, search

# 存储记忆
memory_id = store("今天讨论了 RAG 系统", {"type": "conversation", "topic": "RAG"})

# 搜索记忆
results = search("RAG 系统讨论", top_k=3)

# 删除记忆
from rag_memory import get_memory
get_memory().delete_memory(memory_id)

功能说明

函数说明参数返回值
store()存储记忆content: str, metadata: Dictmemory_id: int
search()搜索记忆query: str, top_k: intList[Dict]
get_memory()获取实例-RAGMemory

📊 记忆数据结构

{
  "id": 1,
  "content": "今天讨论了 RAG 系统",
  "timestamp": "2026-03-18T15:30:00",
  "metadata": {
    "type": "conversation",
    "topic": "RAG"
  },
  "distance": 0.85  // 仅 Milvus 模式有
}

🔄 后端对比

特性SQLiteMilvus
安装难度⭐ 零配置⭐⭐⭐ 需要 Docker
向量搜索❌ 不支持✅ 支持
搜索方式最近优先语义相似度
适用场景个人使用生产环境
资源占用中 - 高

⚠️ 注意事项

  1. SQLite 模式:开箱即用,无需额外配置
  2. Milvus 模式:需要 Docker 运行 Milvus 服务
  3. Ollama:可选,用于向量嵌入生成
  4. 备份机制:自动备份到 JSON 文件

🐛 故障排除

问题:无法导入 pymilvus

# 仅 Milvus 模式需要
pip install pymilvus

问题:无法连接 Milvus

# 检查 Milvus 服务
docker ps | grep milvus
curl http://localhost:19530/v1/version

问题:嵌入生成失败

# 检查 Ollama 服务(可选功能)
curl http://localhost:11434/api/tags
ollama pull bge-m3  # 如需使用

📦 发布到 ClawHub

打包

cd /app/skills/rag-memory
tar -czf rag-memory.tar.gz SKILL.md rag_memory.py

上传

  1. 访问 https://clawhub.com
  2. 创建开发者账号
  3. 上传 rag-memory.tar.gz
  4. 填写技能描述和配置说明

用户安装

openclaw skills install rag-memory

📝 更新日志

  • 2026-03-18: 初始版本,替代文件记忆系统
  • 自动备份到 JSON 文件
  • 语义搜索功能
  • 元数据支持

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

gitlab-mr-reviewer

当需要审核 GitLab 合并请求、检查 MR diff 风险、发布 GitLab 审查评论、执行 approve/request changes,或发送 MR 审查通知时使用。

Registry SourceRecently Updated
1490whrime
General

Voice Transcriber Toolkit

Voice-to-Text Transcription Toolkit - 语音识别转文字,支持Whisper/Vosk引擎,批量处理,字幕导出 | Speech recognition & transcription with Whisper/Vosk engines, batch processing, su...

Registry SourceRecently Updated
General

Gigo Lobster Taster

🦞 GIGO · gigo-lobster-taster: 正式试吃模式:跑完整评测,默认上传云端、生成个人结果页并进入排行榜。 Triggers: 试吃我的龙虾 / 品鉴我的龙虾 / lobster taste / lobster taster.

Registry SourceRecently Updated
General

Gigo Lobster Local

🦞 GIGO · gigo-lobster-local: 本地模式:跑完整评测,但不上云、不注册个人结果页,证书二维码回到官网首页。 Triggers: 本地试吃龙虾 / 离线试吃龙虾 / local lobster taste / offline lobster taste.

Registry SourceRecently Updated