简介
OpenClaw官方生态的本地向量记忆插件,基于ChromaDB+Ollama实现零云依赖的长期语义记忆与自动上下文召回,保障数据隐私的同时提升Agent对话连贯性。
原始描述
Long-term memory via ChromaDB with local Ollama embeddings. Auto-recall injects relevant context every turn. No cloud APIs required — fully self-hosted.
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
中文使用说明 来自收录源
核心用法
chromadb-memory 是一款面向 OpenClaw Agent 生态的长期记忆插件,通过 ChromaDB 向量数据库与 Ollama 本地嵌入模型实现完全离线的语义记忆系统。其核心工作流程为:用户每次发送消息时,插件自动调用 Ollama(默认 nomic-embed-text 模型)将消息编码为 768 维向量,随后查询本地 ChromaDB 获取相似度高于阈值(默认 0.5)的历史记忆,并以 <chromadb-memories>> 标签形式注入当前对话上下文。此外,插件还提供 chromadb_search 工具供手动检索使用。
部署需预先启动 ChromaDB 服务(推荐 Docker)与 Ollama 嵌入模型,配置 collectionId 等参数后即可启用。关键配置项包括:autoRecall 开关、召回结果数量(默认 3 条)、相似度阈值 minScore,以及各服务端点地址。
显著优点
隐私优先的架构设计:100% 本地运行,零云 API 依赖,用户数据完全留存于自有硬件,彻底规避第三方服务的数据泄露风险。对于金融、医疗、法律等敏感场景尤为关键。
无缝的自动召回机制:无需用户手动触发,每轮对话自动完成嵌入、检索、注入全流程,大幅降低记忆管理的心智负担。Token 开销可控(最坏情况约 275 tokens),在 200K+ 上下文窗口下几乎无感知。
高度可调的检索策略:通过 minScore 与 autoRecallResults 参数灵活平衡召回精度与覆盖度,既支持高阈值精准匹配,也支持放宽条件获取更广泛关联信息。
清晰的生态定位:作为 OpenClaw 官方插件生态组成部分,与框架深度集成,配置规范统一,维护路径明确。
潜在缺点与局限性
基础设施依赖较重:需独立维护 ChromaDB 与 Ollama 两个本地服务,对非技术用户存在部署门槛;容器化方案虽简化操作,但仍要求 Docker 环境支持。
记忆质量依赖前置索引:插件本身不提供文档索引功能,用户需自行使用 ChromaDB 兼容工具完成数据入库,形成完整记忆闭环需额外工程投入。
召回效果受限于嵌入模型:默认 nomic-embed-text 虽为优质开源模型,但在特定垂直领域(如专业术语密集场景)的语义理解能力可能不及商业大模型嵌入服务。
无内置访问控制:若 ChromaDB 实例暴露于网络且未配置独立认证,存在潜在的数据越权访问风险,需用户自行加固网络隔离。
适合的目标群体
- 隐私敏感型用户:企业内网部署、涉密数据处理、个人知识库管理等对数据主权有严格要求的场景。
- 技术型开发者与运维人员:具备 Docker 与本地服务运维能力,追求架构可控性与成本优化的工程团队。
- 长期对话场景需求方:客服机器人、个人 AI 助手、研究辅助工具等需要跨会话维持上下文连贯性的应用。
- 开源生态拥抱者:偏好完全开源栈、希望避免 vendor lock-in 的独立开发者与组织。
使用风险
SSRF 配置风险:chromaUrl 与 ollamaUrl 参数接受任意 URL,若配置不当可能指向非预期服务,建议配合网络策略限制可访问端点。
服务可用性依赖:ChromaDB 或 Ollama 服务中断将直接导致记忆功能失效,需建立服务健康监控与故障降级机制。
召回噪声与信息过载:minScore 设置过低可能注入大量低相关记忆,干扰 Agent 判断;设置过高则可能导致关键上下文遗漏,需根据实际数据分布反复调优。
Token 预算累积:虽单次开销微小,但高频长对话场景下自动召回的累积 Token 消耗仍需纳入上下文窗口规划。
版本兼容性:ChromaDB 与 Ollama 的 API 演进可能引入破坏性变更,升级依赖服务前需验证插件兼容性。
技能正文
name: chromadb-memory description: Long-term memory via ChromaDB with local Ollama embeddings. Auto-recall injects relevant context every turn. No cloud APIs required — fully self-hosted. version: 1.0.0 author: matts homepage: https://github.com/openclaw/openclaw metadata: openclaw: emoji: "🧠" requires: bins: ["curl"] category: "memory" tags:
- memory
- chromadb
- ollama
- vector-search
- local
- self-hosted
- auto-recall
ChromaDB Memory
Long-term semantic memory backed by ChromaDB and local Ollama embeddings. Zero cloud dependencies.
What It Does
- Auto-recall: Before every agent turn, queries ChromaDB with the user's message and injects relevant context automatically
chromadb_searchtool: Manual semantic search over your ChromaDB collection- 100% local: Ollama (nomic-embed-text) for embeddings, ChromaDB for vector storage
Prerequisites
-
ChromaDB running (Docker recommended):
docker run -d --name chromadb -p 8100:8000 chromadb/chroma:latest -
Ollama with an embedding model:
ollama pull nomic-embed-text -
Indexed documents in ChromaDB. Use any ChromaDB-compatible indexer to populate your collection.
Install
# 1. Copy the plugin extension
mkdir -p ~/.openclaw/extensions/chromadb-memory
cp {baseDir}/scripts/index.ts ~/.openclaw/extensions/chromadb-memory/
cp {baseDir}/scripts/openclaw.plugin.json ~/.openclaw/extensions/chromadb-memory/
# 2. Get your collection ID
curl -s http://localhost:8100/api/v2/tenants/default_tenant/databases/default_database/collections | python3 -c "import json,sys; [print(f'{c[\"id\"]} {c[\"name\"]}') for c in json.load(sys.stdin)]"
# 3. Add to your OpenClaw config (~/.openclaw/openclaw.json):
{
"plugins": {
"entries": {
"chromadb-memory": {
"enabled": true,
"config": {
"chromaUrl": "http://localhost:8100",
"collectionId": "YOUR_COLLECTION_ID",
"ollamaUrl": "http://localhost:11434",
"embeddingModel": "nomic-embed-text",
"autoRecall": true,
"autoRecallResults": 3,
"minScore": 0.5
}
}
}
}
}
# 4. Restart the gateway
openclaw gateway restart
Config Options
| Option | Default | Description |
|---|---|---|
chromaUrl |
http://localhost:8100 |
ChromaDB server URL |
collectionId |
required | ChromaDB collection UUID |
ollamaUrl |
http://localhost:11434 |
Ollama API URL |
embeddingModel |
nomic-embed-text |
Ollama embedding model |
autoRecall |
true |
Auto-inject relevant memories each turn |
autoRecallResults |
3 |
Max auto-recall results per turn |
minScore |
0.5 |
Minimum similarity score (0-1) |
How It Works
- You send a message
- Plugin embeds your message via Ollama (nomic-embed-text, 768 dimensions)
- Queries ChromaDB for nearest neighbors
- Results above
minScoreare injected into the agent's context as<chromadb-memories> - Agent responds with relevant long-term context available
Token Cost
Auto-recall adds ~275 tokens per turn worst case (3 results × ~300 chars + wrapper). Against a 200K+ context window, this is negligible.
Tuning
- Too noisy? Raise
minScoreto 0.6 or 0.7 - Missing context? Lower
minScoreto 0.4, increaseautoRecallResultsto 5 - Want manual only? Set
autoRecall: false, usechromadb_searchtool
Architecture
User Message → Ollama (embed) → ChromaDB (query) → Context Injection
↓
Agent Response
No OpenAI. No cloud. Your memories stay on your hardware.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。