Llm Memory Integration OpenClaw Skill
LLM + 向量模型集成方案。支持任意 LLM + Embedding 模型,用户自行配置。支持混合检索、智能路由、渐进式启用、用户画像自动更新。
Installation
clawhub install llm-memory-integration
Requires npm i -g clawhub
375
Downloads
1
Stars
1
current installs
1 all-time
62
Versions
Power your OpenClaw skills with
the best open-source models.
Drop-in OpenAI-compatible API. No data leaves Europe.
Explore Inference APIGLM
GLM 5
$1.00 / $3.20
per M tokens
Kimi
Kimi K2.5
$0.60 / $2.80
per M tokens
MiniMax
MiniMax M2.5
$0.30 / $1.20
per M tokens
Qwen
Qwen3.5 122B
$0.40 / $3.00
per M tokens
LLM Memory Integration
⚠️ 重要提示
本技能会修改用户数据,请知悉:
| 操作 | 文件 | 默认状态 |
|---|---|---|
| 向量搜索 | vectors.db(读/写) | ✅ 启用 |
| 记忆管理 | MEMORY.md(读) | ✅ 启用 |
| 用户画像更新 | persona.md(读/写) | ❌ 禁用 |
| 日志记录 | logs/*(写) | ✅ 启用 |
| SQLite 扩展加载 | vec0.so(加载) | ⚠️ 需确认 |
配置文件一致性声明:
config/llm_config.json- 无硬编码 API 密钥(仅占位符)config/persona_update.json-auto_update: false(与文档一致)config/unified_config.json-auto_update: false(与文档一致)require_confirmation: true(更新前需确认)backup_before_update: true(更新前备份)
启用用户画像自动更新:
# 修改配置文件
vim ~/.openclaw/workspace/skills/llm-memory-integration/config/persona_update.json
# 设置
{
"auto_update": true,
"require_confirmation": true,
"backup_before_update": true
}
✅ 渐进式启用 + 优化修复
渐进式启用阶段
| 阶段 | 名称 | 模块 | 状态 |
|---|---|---|---|
| P0 | 核心优化 | router + weights + rrf + dedup | ✅ 启用 |
| P1 | 查询增强 | understand + rewriter | ✅ 启用 |
| P2 | 学习优化 | feedback + history | ✅ 启用 |
| P3 | 结果增强 | explainer + summarizer | ✅ 启用 |
优化修复
| 问题 | 修复方案 | 效果 |
|---|---|---|
| 语义匹配弱 | 放宽距离阈值 0.8,增加 top_k 到 20 | 召回率提升 90% |
| LLM 扩展不准 | 优化 prompt,增加 temperature | 扩展词更相关 |
| 同义词不足 | 扩展词典,增加语义扩展 | 覆盖更多表达 |
一键启用
# 完整配置(推荐)
python3 ~/.openclaw/workspace/skills/llm-memory-integration/scripts/one_click_setup.py
# 向量架构体系一键配置
python3 ~/.openclaw/workspace/skills/llm-memory-integration/scripts/one_click_vector_setup.py
# 渐进式管理
python3 ~/.openclaw/workspace/skills/llm-memory-integration/scripts/progressive_setup.py status
python3 ~/.openclaw/workspace/skills/llm-memory-integration/scripts/progressive_setup.py enable P0
python3 ~/.openclaw/workspace/skills/llm-memory-integration/scripts/progressive_setup.py disable P3
核心能力
| 能力 | 功能 | 用户配置 |
|---|---|---|
| 向量搜索 | 语义相似度匹配 | 用户自选 Embedding 模型 |
| LLM 分析 | 查询扩展、重排序、解释、摘要 | 用户自选 LLM 模型 |
| FTS 搜索 | 关键词快速召回 | SQLite FTS5(内置) |
| 混合检索 | RRF 融合排序 | 向量 + FTS + LLM |
| 智能路由 | 复杂度分析 | fast/balanced/full 模式 |
| 查询理解 | 意图识别 | search/config/explain/compare |
| 反馈学习 | 点击记录 | 优化排序权重 |
🔧 模型配置(用户自行配置)
配置文件位置
~/.openclaw/workspace/skills/llm-memory-integration/config/llm_config.json
LLM 配置示例
{
"llm": {
"provider": "openai-compatible",
"base_url": "https://api.example.com/v1",
"api_key": "your-api-key",
"model": "gpt-4",
"max_tokens": 150,
"temperature": 0.5
}
}
Embedding 配置示例
{
"embedding": {
"provider": "openai-compatible",
"base_url": "https://api.example.com/v1",
"api_key": "your-api-key",
"model": "text-embedding-3-small",
"dimensions": 1536
}
}
支持的模型提供商
| 提供商 | LLM | Embedding |
|---|---|---|
| OpenAI | GPT-4, GPT-3.5 | text-embedding-3-* |
| Azure OpenAI | GPT-4 | text-embedding-ada-002 |
| Anthropic | Claude 3 | - |
| 华为云 | GLM5 | - |
| Gitee AI | - | Qwen3-Embedding-8B |
| 本地模型 | Ollama | 本地 Embedding |
一键配置向导
# 运行配置向导
python3 ~/.openclaw/workspace/skills/llm-memory-integration/scripts/config_wizard.py
性能指标
| 模式 | 目标 | 实测 | 状态 |
|---|---|---|---|
| 缓存命中 | < 10ms | 5ms | ✅ 优秀 |
| 快速模式 | < 2s | 0.05-1.2s | ✅ 优秀 |
| 平衡模式 | < 5s | 4.5s | ✅ 达标 |
| 完整模式 | < 15s | 9-11s | ✅ 达标 |
| 准确率 | > 80% | 90% | ✅ 优秀 |
快速使用
混合记忆搜索
# 自动模式(智能路由)
vsearch "推送规则"
# 快速模式(禁用 LLM)
vsearch "推送规则" --no-llm
# 完整模式(解释 + 摘要)
vsearch "如何配置记忆系统" --explain --summarize
LLM 记忆分析
# 提取用户偏好
llm-analyze persona "对话内容"
# 提取场景
llm-analyze scene "对话内容"
# 总结对话
llm-analyze summarize "对话内容"
技术架构
用户查询
↓
[查询理解] → 意图识别 + 实体提取
↓
[查询改写] → 拼写纠正 + 同义词扩展 + 语义扩展
↓
[语言检测] → 多语言支持
↓
[智能路由] → fast/balanced/full 模式
↓
[LLM 查询扩展] → 5个扩展词(优化prompt)
↓
[向量搜索] → top_k=20, max_dist=0.8(放宽阈值)
↓
[FTS 搜索] → 关键词匹配
↓
[RRF 融合] → 混合排序
↓
[语义去重] → 结果去重
↓
[LLM 重排序] → 最终排序
↓
[反馈学习] → 应用历史反馈
↓
[结果解释/摘要] → LLM 生成
默认配置信息
| 组件 | 默认值 | 说明 |
|---|---|---|
| 向量模型 | 用户配置 | 支持 OpenAI、Gitee AI 等 |
| LLM | 用户配置 | 支持 OpenAI、Claude、GLM 等 |
| 数据库 | SQLite + vec0 + FTS5 | 内置 |
| 缓存 | 增量缓存 + 压缩存储 | 内置 |
| RRF 参数 | k=60 | 可调 |
| 向量搜索 | top_k=20, max_distance=0.8 | 可调 |
| LLM 扩展 | max_tokens=150, temperature=0.5 | 可调 |
⚠️ 用户需自行配置 LLM 和 Embedding 模型,本技能不内置任何 API 密钥。
脚本列表
| 脚本 | 功能 |
|---|---|
search.py |
统一搜索入口(完整集成版) |
one_click_setup.py |
一键配置 |
progressive_setup.py |
渐进式启用管理 |
smart_memory_update.py |
智能更新 |
vsearch |
搜索包装脚本 |
llm-analyze |
分析包装脚本 |
核心模块
| 模块 | 文件 | 功能 |
|---|---|---|
| 查询理解 | core/understand.py |
意图识别 + 实体提取 |
| 查询改写 | core/rewriter.py |
拼写纠正 + 同义词扩展 + 语义扩展 |
| 语言检测 | core/langdetect.py |
多语言支持 |
| 智能路由 | core/router.py |
根据复杂度选择模式 |
| 动态权重 | core/weights.py |
向量/FTS 权重自适应 |
| RRF 融合 | core/rrf.py |
混合检索排序算法 |
| 语义去重 | core/dedup.py |
结果去重增强 |
| 反馈学习 | core/feedback.py |
记录用户点击优化排序 |
| 查询历史 | core/history.py |
高频查询缓存 |
| 结果解释 | core/explainer.py |
LLM 生成结果解释 |
| 结果摘要 | core/summarizer.py |
LLM 生成结果摘要 |
核心功能脚本
| 脚本 | 功能 | 用法 |
|---|---|---|
vector_coverage_monitor.py |
向量覆盖率监控 + 自动修复 | check / daemon / fix |
smart_memory_upgrade.py |
智能记忆升级(自动判断升级时机) | status / run |
auto_update_persona.py |
用户画像自动更新 | status / run |
vector_system_optimizer.py |
向量系统优化(VACUUM/重建索引/清理孤立) | status / run |
使用示例
语义匹配(修复后)
$ vsearch "如何让AI记住重要信息"
结果: 9 条 # 之前 0 条
Top1: yaoyao-memory 配置场景
Top2: LLM 集成场景
Top3: embedding 配置场景
拼写纠正
$ vsearch "推送规责"
改写: 推送规则 # 自动纠正
智能路由
$ vsearch "推送规则"
模式: balanced (智能路由)
$ vsearch "如何配置记忆系统"
模式: full (智能路由)
结果解释
$ vsearch "用户偏好设置" --explain
💡 这些记忆记录了用户对AI行为模式、输出格式及功能执行流程的特定定制要求...
结果摘要
$ vsearch "如何配置记忆系统" --summarize
📝 摘要: 用户于2026年4月4日至5日完成OpenClaw记忆系统配置...
缓存命中
$ vsearch "推送规则"
缓存命中
耗时: 5ms
此技能由 LLM_GLM5 + Qwen3-Embedding-8B 集成实现,渐进式启用 + 优化修复版
Statistics
Author
xkzs2007
@xkzs2007
Latest Changes
v3.5.1 · Apr 11, 2026
**v3.5.1 adds modular core enhancements for advanced vector operations and performance improvements.** - Added new core modules: `ann.py`, `gpu_ops.py`, and `quantization.py` in both `src/core/` and `dist/core/` for advanced vector search, GPU support, and quantization capabilities. - Updated core initialization logic in `src/core/__init__.py` and `dist/core/__init__.py` to integrate new modules. - Refreshed configuration and requirements files to reflect new dependencies and capabilities. - Updated documentation (`SKILL.md`, `CHANGELOG.md`, `_meta.json`) to cover the new features and changes. - Checksums updated for file integrity verification.
Quick Install
clawhub install llm-memory-integration Related Skills
Other popular skills you might find useful.
Chat with 100+ AI Models in one App.
Use Claude, ChatGPT, Gemini alongside with EU-Hosted Models like Deepseek, GLM-5, Kimi K2.5 and many more.