Memorine
Persistent memory for OpenClaw agents. No APIs, no Docker, no external services. Just Python and SQLite.
What it does
- - Facts -- store, recall, and search with full-text search (FTS5). Near-duplicates are reinforced, contradictions are flagged automatically.
- Forgetting curve -- memories decay over time if not accessed, just like human memory. Old garbage cleans itself up.
- Events -- log what happened with causal chains (this caused that, which caused this other thing).
- Procedures -- track multi-step workflows, learn which steps tend to fail, anticipate what you will need before starting a task.
- Cross-agent sharing -- agents share facts with each other or the whole team through the same database.
- Semantic search (optional) -- install
memorine[embeddings] to add meaning-based search on top of keyword search.
14 MCP tools
Once installed, your agents get access to:
| Tool | What it does |
|---|
| INLINECODE1 | Store a fact. Detects contradictions. |
| INLINECODE2 |
Batch-learn multiple facts at once. |
|
memorine_recall | Search memory by query. Ranked by importance and recency. |
|
memorine_log_event | Record an event. Supports causal chains. |
|
memorine_events | Search past events by text or tags. |
|
memorine_share | Share a fact with another agent or the team. |
|
memorine_team_knowledge | Get collective knowledge across agents. |
|
memorine_profile | Full cognitive profile of what an agent knows. |
|
memorine_anticipate | Predict what you need for a task before starting. |
|
memorine_procedure_start | Start tracking a procedure. |
|
memorine_procedure_step | Log a step result in a running procedure. |
|
memorine_procedure_complete | Mark a procedure as done. |
|
memorine_correct | Fix a fact that turned out to be wrong. |
|
memorine_stats | Database stats: facts, events, procedures, db size. |
Setup
Install Memorine:
CODEBLOCK0
Add the MCP server to your OpenClaw config (openclaw.json):
CODEBLOCK1
Allow the tools for your agents:
CODEBLOCK2
Optional semantic search (adds meaning-based matching on top of keyword search):
CODEBLOCK3
Security
Each agent can only modify its own data. Forget, correct, link, and procedure operations all validate ownership. No agent can touch another agent's memories.
How it works
Everything lives in a single SQLite file at ~/.memorine/memorine.db. FTS5 handles keyword search, triggers keep indexes in sync, and WAL mode allows concurrent reads. The forgetting curve uses retention = e^(-days / stability) where stability grows each time a memory is accessed. No LLM needed for any of this.
Memorine
OpenClaw代理的持久化记忆。无需API,无需Docker,无需外部服务。只需Python和SQLite。
功能特性
- - 事实 —— 通过全文搜索(FTS5)存储、回忆和检索。近似重复项会被强化,矛盾项会被自动标记。
- 遗忘曲线 —— 记忆若不被访问会随时间衰减,如同人类记忆。旧垃圾数据会自动清理。
- 事件 —— 通过因果链(A导致B,B导致C)记录已发生事件。
- 流程 —— 追踪多步骤工作流,学习哪些步骤容易失败,在开始任务前预测所需内容。
- 跨代理共享 —— 代理之间或与整个团队通过同一数据库共享事实。
- 语义搜索(可选) —— 安装memorine[embeddings]可在关键词搜索基础上增加基于含义的搜索。
14个MCP工具
安装后,您的代理可获得以下工具:
| 工具 | 功能说明 |
|---|
| memorinelearn | 存储事实。检测矛盾。 |
| memorinelearn_batch |
批量学习多个事实。 |
| memorine_recall | 按查询搜索记忆。按重要性和时效性排序。 |
| memorine
logevent | 记录事件。支持因果链。 |
| memorine_events | 按文本或标签搜索历史事件。 |
| memorine_share | 与其他代理或团队共享事实。 |
| memorine
teamknowledge | 获取跨代理的集体知识。 |
| memorine_profile | 代理所知的完整认知画像。 |
| memorine_anticipate | 在开始前预测任务所需内容。 |
| memorine
procedurestart | 开始追踪流程。 |
| memorine
procedurestep | 记录进行中流程的步骤结果。 |
| memorine
procedurecomplete | 标记流程完成。 |
| memorine_correct | 修正错误的事实。 |
| memorine_stats | 数据库统计:事实、事件、流程、数据库大小。 |
安装配置
安装Memorine:
bash
pip install memorine
将MCP服务器添加到OpenClaw配置(openclaw.json):
json
{
mcpServers: {
memorine: {
command: python3,
args: [-m, memorine.mcp_server]
}
}
}
为代理启用工具:
json
{
tools: {
allow: [
memorine_learn,
memorine_recall,
memorinelogevent,
memorine_events,
memorine_share,
memorineteamknowledge,
memorine_profile,
memorine_anticipate,
memorineprocedurestart,
memorineprocedurestep,
memorineprocedurecomplete,
memorine_correct,
memorine_stats,
memorinelearnbatch
]
}
}
可选语义搜索(在关键词搜索基础上增加基于含义的匹配):
bash
pip install memorine[embeddings]
安全性
每个代理只能修改自己的数据。遗忘、修正、链接和流程操作均会验证所有权。任何代理都无法触碰其他代理的记忆。
工作原理
所有数据都存储在~/.memorine/memorine.db的单个SQLite文件中。FTS5处理关键词搜索,触发器保持索引同步,WAL模式支持并发读取。遗忘曲线使用retention = e^(-days / stability)公式,其中每次访问记忆时稳定性都会增长。所有这些功能都不需要LLM。