BrainDB
Persistent, semantic memory for AI agents. Built for OpenClaw.
What It Does
Your AI forgets everything between sessions. BrainDB fixes that.
It gives your assistant a memory system that automatically captures important context from conversations and recalls it when relevant — who you are, what you're working on, what you've told it before. Memories persist across compaction, session resets, and restarts.
How it works:
CODEBLOCK0
No commands. No manual saving. It just works.
Install
Requires Docker and ~4 GB RAM.
CODEBLOCK1
Or manually:
CODEBLOCK2
First run: 3–5 minutes (downloads embedding model). After that: ~10 seconds.
What the installer does:
- 1. Backs up your existing memory files to INLINECODE0
- Builds and starts 3 Docker containers (Neo4j, embedder, gateway)
- Patches your OpenClaw config (
~/.openclaw/openclaw.json) to enable the plugin - Optionally offers to migrate existing workspace files into BrainDB
Review install.sh before running if you want to understand each step.
What You Get
- - 768-dim semantic search — finds conceptually related memories, not just keyword matches
- 4 memory types — episodic (events), semantic (facts), procedural (skills), association (links)
- Tiered ranking — semantic similarity always beats keyword match
- Auto-dedup — won't store near-duplicate memories
- Hebbian reinforcement — memories strengthen with use, decay without it
- Query expansion — understands colloquial phrases
- 98% recall accuracy on a 50-test benchmark suite
- 12–20 ms average query latency
Security & Privacy
Core operation is fully local:
- - Gateway binds to localhost only — not exposed to your network
- Neo4j and embedder are not accessible from the host (isolated Docker network)
- Neo4j password is auto-generated (24-char random)
- Optional API key authentication via INLINECODE3
- Containers run as non-root users
- All embedding, search, and storage runs locally — no external API calls during normal operation
What the installer reads/writes:
- - Reads your OpenClaw config (
~/.openclaw/openclaw.json) to add the plugin entry - Reads workspace files during optional migration (preview with
--scan first) - Writes
.env with generated Neo4j credentials - Creates Docker volumes for persistent storage
Migration privacy notice:
- - Default migration (
--no-swarm): Fully local. File contents never leave your machine. - Migration with swarm: Sends file contents to Google's Gemini API for intelligent fact extraction. This is opt-in only — you must have swarm installed and explicitly allow it. Use
--no-swarm to guarantee local-only processing. - Always run
node migrate.cjs --scan or --dry-run first to see exactly what would be processed.
Migrating Existing Memories
Already have MEMORY.md, daily notes, or other workspace files? Import them:
CODEBLOCK3
Your files are never modified. BrainDB copies facts from them — it doesn't replace anything.
Failover
BrainDB fails gracefully:
- 1. Gateway down: OpenClaw works normally — the memory block is simply absent from prompts. Your AI still has
MEMORY.md and workspace files. - Neo4j down: Gateway returns empty results. No errors, just no memories.
- Embedder down: Falls back to text-only search (less accurate but functional).
Your workspace files are the safety net. BrainDB is additive — remove it and you're back to defaults with zero data loss.
Uninstall
CODEBLOCK4
The uninstaller exports all memories (JSON + readable markdown), stops containers, removes the plugin config from OpenClaw, and leaves your workspace files untouched. Docker volumes are preserved until you explicitly delete them.
Performance
| Metric | Value |
|---|
| Recall accuracy | 98% (50-test suite) |
| Avg latency |
12–20 ms |
| Cold query | ~60 ms |
| Capacity | 10K+ memories |
| Storage | ~3 GB |
| RAM | ~2.5 GB |
Links
MIT —
Oaiken LLC
BrainDB
为AI智能体提供的持久化语义记忆系统。专为OpenClaw构建。
功能概述
你的AI会在每次会话之间遗忘所有内容。BrainDB解决了这个问题。
它为你的助手提供了一个记忆系统,能够自动捕获对话中的重要上下文,并在相关时进行回忆——你是谁、你在做什么、你之前告诉过它什么。记忆在压缩、会话重置和重启后依然持久存在。
工作原理:
你说些什么 → OpenClaw捕获重要事实 → BrainDB存储它们
你问些什么 → OpenClaw回忆相关记忆 → AI拥有上下文
无需命令。无需手动保存。它自动运行。
安装
需要Docker和约4 GB内存。
bash
openclaw plugin install braindb
或手动安装:
bash
git clone https://github.com/Chair4ce/braindb.git ~/.openclaw/plugins/braindb
cd ~/.openclaw/plugins/braindb
bash install.sh
首次运行:3–5分钟(下载嵌入模型)。之后:约10秒。
安装程序执行的操作:
- 1. 将现有记忆文件备份到~/.openclaw/braindb-backup/
- 构建并启动3个Docker容器(Neo4j、嵌入器、网关)
- 修改你的OpenClaw配置(~/.openclaw/openclaw.json)以启用插件
- 可选地提供将现有工作区文件迁移到BrainDB的功能
如果你希望了解每个步骤,请在运行前查看install.sh。
功能特性
- - 768维语义搜索 — 查找概念相关的记忆,而不仅仅是关键词匹配
- 4种记忆类型 — 情景记忆(事件)、语义记忆(事实)、程序记忆(技能)、关联记忆(链接)
- 分层排序 — 语义相似度始终优先于关键词匹配
- 自动去重 — 不会存储近似重复的记忆
- 赫布强化 — 记忆随使用而增强,随遗忘而衰减
- 查询扩展 — 理解口语化短语
- 98%的召回准确率(基于50项测试基准套件)
- 12–20毫秒平均查询延迟
安全与隐私
核心操作完全本地化:
- - 网关仅绑定到localhost — 不暴露到你的网络
- Neo4j和嵌入器无法从宿主机访问(隔离的Docker网络)
- Neo4j密码自动生成(24位随机字符)
- 可选API密钥认证,通过BRAINDBAPIKEY设置
- 容器以非root用户身份运行
- 所有嵌入、搜索和存储均在本地运行 — 正常操作期间无外部API调用
安装程序读取/写入的内容:
- - 读取你的OpenClaw配置(~/.openclaw/openclaw.json)以添加插件条目
- 在可选迁移期间读取工作区文件(先使用--scan预览)
- 写入包含生成的Neo4j凭据的.env文件
- 创建用于持久化存储的Docker卷
迁移隐私声明:
- - 默认迁移(--no-swarm): 完全本地化。文件内容永远不会离开你的机器。
- 使用swarm迁移: 将文件内容发送到Google的Gemini API进行智能事实提取。这是仅限主动选择的功能——你必须已安装swarm并明确允许。使用--no-swarm确保仅本地处理。
- 始终先运行node migrate.cjs --scan或--dry-run,以查看将要处理的内容。
迁移现有记忆
已有MEMORY.md、每日笔记或其他工作区文件?导入它们:
bash
node migrate.cjs --scan /path/to/workspace # 预览文件(不发送任何数据)
node migrate.cjs --dry-run /path/to/workspace # 本地提取事实,不进行编码
node migrate.cjs --no-swarm /path/to/workspace # 导入,完全本地化
node migrate.cjs /path/to/workspace # 导入(如果可用则使用swarm)
你的文件永远不会被修改。BrainDB从它们中复制事实——它不会替换任何内容。
故障切换
BrainDB优雅地处理故障:
- 1. 网关宕机: OpenClaw正常运行——记忆块仅从提示中消失。你的AI仍然拥有MEMORY.md和工作区文件。
- Neo4j宕机: 网关返回空结果。没有错误,只是没有记忆。
- 嵌入器宕机: 回退到纯文本搜索(准确度较低但功能正常)。
你的工作区文件是安全网。BrainDB是附加性的——移除它,你将回到默认状态,且零数据丢失。
卸载
bash
openclaw plugin remove braindb
卸载程序会导出所有记忆(JSON + 可读的markdown格式),停止容器,从OpenClaw中移除插件配置,并保留你的工作区文件不变。Docker卷会保留,直到你明确删除它们。
性能
| 指标 | 数值 |
|---|
| 召回准确率 | 98%(50项测试套件) |
| 平均延迟 |
12–20毫秒 |
| 冷查询 | 约60毫秒 |
| 容量 | 10K+条记忆 |
| 存储 | 约3 GB |
| 内存 | 约2.5 GB |
链接
MIT —
Oaiken LLC