Skip to main content
Glama
cx2002302-lang

memory_plus

🧠 Memory Plus

一个为 OpenClawHermes Agent 设计的记忆管理组件,基于 SVM(Structured Visual Memory)架构,集成 Zettelkasten 知识笔记双向同步,让 AI Agent 拥有持久化、可检索的结构化记忆。

English · 简体中文

Version OpenClaw Hermes MCP Server License: MIT Python


✨ 核心功能

功能

描述

🧠 内存存储

内存 LRU 缓存 + SQLite 持久化,支持多租户隔离

🔍 关键词匹配

Aho-Corasick 多模式匹配引擎(pyahocorasick / 纯 Python 回退)

📋 审计日志

SQLite 存储的 store/recall/forget/config 操作事件日志

🔄 Zettelkasten 同步

双向同步:SVM→ZK(冷数据备份)+ ZK→SVM(热加载重要/近期/常青笔记)

🛡️ 淘汰保护

LRU 淘汰前自动同步到 ZK,防止数据丢失

⚖️ 准入控制

可配置最低权重和压力阈值,保护高价值记忆

📥 导入迁移

svm import 命令,将旧版 OpenClaw 记忆 chunks 迁移为 SVM 内存块

🔌 MCP Server

内置 stdio 协议的 MCP 服务,接入 Hermes / OpenClaw 等 Agent 框架

🐳 Docker 支持

4 种容器环境预装 SVM(Hermes + 3 版本 OpenClaw)

🎯 命令行

完整的 CLI 界面,支持 JSON 输出,跨语言调用


Related MCP server: Cortex

⚡ 性能基准

测试环境: Python 3.12.3, SQLite WAL
测试规模: 553K blocks/sec 存储 · 52K matches/sec Aho-Corasick(5000 关键词)
当前测试套件: 80 个单元测试全部通过 ✅


🇺🇸 Looking for English documentation? Click here for English


🚀 快速开始

AI Agent 一句话安装

curl -fsSL https://raw.githubusercontent.com/cx2002302-lang/memory_plus/master/scripts/quick-install.sh | bash

pip 安装

pip install memory-plus

或从源码安装(推荐开发模式):

git clone https://github.com/cx2002302-lang/memory_plus.git
cd memory_plus
pip install -e ".[test]"

# 运行测试
pytest tests/

CLI 基本用法

# 存储记忆
svm store --key my_key --value "记忆内容"

# 检索记忆
svm recall --keyword kw1 --keyword kw2

# 与 Zettelkasten 同步
svm sync auto

# 导入旧版记忆
svm import --source ~/.openclaw/memory/main.sqlite

# 搜索(SVM + ZK)
svm search "关键词"

# 查看状态
svm stats

Docker 部署

# 使用 svm-deploy skill(需要先安装 skill)
svm-deploy

# 或手动挂载:
#   svm 数据库路径: ~/.openclaw/svm/memory.db
#   ZK 数据库路径: ~/.openclaw/zettelkasten/zettelkasten.db

🧩 MCP 工具(用于 AI Agent)

工具

权限

描述

svm_store

写入

存储一个记忆块

svm_recall

读取

按关键词检索记忆块

svm_forget

写入

删除指定记忆块

svm_list

读取

列出所有记忆块

svm_stats

读取

获取内存统计信息

svm_audit

读取

查询审计日志


🛡️ 数据安全

Memory Plus 与 Zettelkasten 双向同步遵循以下安全原则:

操作

安全策略

SVM → ZK 写入

仅 INSERT,永不 UPDATE/DELETE/DROP

ZK → SVM 读取

只读 QUERY,不修改 ZK 数据

标签写入

INSERT OR IGNORE,不覆盖已有标签

淘汰保护

LRU 淘汰前先同步到 ZK,防止数据丢失

准入控制

内存使用率 ≥ 80% 时拒绝低权重(< 0.1)写操作

FTS5 搜索

使用 n.id IN (SELECT id FROM zettel_fts ...) 确保 rowid 正确映射

重要警告:切勿在已有数据的 ZK 数据库上运行 openclaw zk initmigrateNotesTableForArchive() 可能重新创建 zettel_notes 表并导致数据丢失。 详见 Schema 兼容性文档


📁 项目结构

memory_plus/
├── svm/                     # Python 模块
│   ├── __init__.py          # 版本号
│   ├── cli.py               # CLI 入口
│   ├── config.py            # 配置管理(预设、自动检测内存)
│   ├── audit.py             # 审计日志
│   ├── exceptions.py        # 异常体系
│   ├── injector.py          # 上下文注入器
│   ├── mcp_server.py        # MCP 服务
│   ├── models/              # 数据模型
│   │   └── block.py         # MemoryBlock(核心内存块)
│   ├── store/               # 存储层
│   │   ├── memory_store.py  # 内存 LRU 缓存
│   │   └── persistent.py    # SQLite 持久化
│   ├── sync/                # Zettelkasten 同步引擎
│   │   ├── engine.py        # 同步编排
│   │   └── zk_sync.py       # ZK 数据库读写
│   └── trigger/             # 检索触发
│       ├── matcher.py       # Aho-Corasick 关键词匹配
│       └── strategy.py      # 检索策略
├── tests/                   # 测试套件
│   ├── test_basic.py        # 58 个基础测试
│   ├── test_import.py       # 8 个导入测试
│   ├── test_sync.py         # 18 个同步测试
│   └── test_perf.py         # 性能基准测试
├── image/                   # 配图
├── docs/                    # 文档
├── CHANGELOG.md
├── LICENSE
└── README.md

📜 许可证

MIT © Memory Plus Contributors

Available Tools

6 tools
svm_auditC

Query SVM audit log

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMax records (default: 20)
actionNoFilter by action (store/recall/forget/config_change)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavior. It only states 'Query SVM audit log' without mentioning side effects, authentication needs, rate limits, or read-only nature. This is insufficient for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single focused sentence is concise and front-loaded. However, it may be too terse, sacrificing useful context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with two optional parameters and no output schema, so the description is minimally adequate. It could describe return format or typical entries to be more complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the description does not add extra meaning beyond the schema's parameter descriptions. It maintains baseline adequacy but does not enrich understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Query SVM audit log' provides a clear verb and resource, distinguishing it from sibling tools like svm_store and svm_forget. However, it lacks explicit differentiation or context about the audit log's scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives, nor are there any when-not or prerequisite conditions. The description is purely functional.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

svm_forgetB

Delete a memory block by key

ParametersJSON Schema
NameRequiredDescriptionDefault
keyYesKey of the block to delete
tenant_idNoOptional tenant ID

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description should disclose behavioral traits like permanence, error handling, or auth needs. It only says 'Delete' without additional context, which is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single short sentence, front-loaded with the key action, no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple delete tool, the description is minimal. It lacks details on success/failure responses or behavior when key is missing, but given simplicity, it is adequate but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the description adds no extra meaning beyond the schema. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Delete' and the resource 'memory block by key', distinguishing it from sibling tools like svm_store or svm_recall.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives, or any prerequisites or exclusions. The description only states the action without usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

svm_listC

List all memory blocks

ParametersJSON Schema
NameRequiredDescriptionDefault
slot_idNoOptional slot/group filter
tenant_idNoOptional tenant ID

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden for behavioral disclosure. It only states 'List', implying read-only behavior, but doesn't explicitly confirm idempotency, side effects, or permissions. For a list operation, this is minimal transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no wasted words. It is front-loaded and easy to parse. However, it could include more context without becoming verbose, so not a perfect 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with no output schema and two optional parameters, the description is adequate but incomplete. It mentions 'all memory blocks' but doesn't hint at filtering capabilities or return structure. The schema compensates, but the description could be richer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents 'slot_id' and 'tenant_id' filters. The tool description adds no additional meaning or usage context for these parameters, meeting baseline but not exceeding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List all memory blocks' clearly states the verb (list) and resource (memory blocks). It distinguishes itself from sibling tools like svm_audit or svm_store by the action, but does not elaborate on scope or exclude other behaviors. A more specific description would rate 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool vs alternatives like svm_audit or svm_stats. An agent has no context about appropriate scenarios or exclusions. This is a significant gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

svm_recallB

Recall memory blocks from SVM by keywords

ParametersJSON Schema
NameRequiredDescriptionDefault
top_nNoMaximum results (default: 5)
slot_idNoOptional slot/group filter
keywordsYesKeywords to search for
tenant_idNoOptional tenant ID

TDQS

B3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are absent, so the description must fully disclose behavior. It does not specify if the operation is read-only, what side effects exist, or any required permissions. The term 'recall' implies retrieval but no further details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very short (one sentence), which is concise but lacks detail. It could include more context without being verbose, balancing conciseness with informativeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters, no output schema, and no annotations, the description is insufficient. It does not explain return format, pagination, or how keywords interact, leaving the agent underinformed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so each parameter has a description. The tool description adds 'by keywords', aligning with the required parameter, but does not add meaning beyond the schema for optional parameters like top_n or slot_id.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Recall memory blocks from SVM by keywords', using a specific verb ('Recall') and resource ('memory blocks from SVM'), and distinguishes it from siblings like svm_store and svm_forget.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as svm_list or svm_stats. The description lacks any when-to-use or when-not-to-use context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

svm_statsC

Get SVM memory statistics

ParametersJSON Schema
NameRequiredDescriptionDefault
tenant_idNoOptional tenant ID

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It indicates a read operation but omits any details about permissions, cost, state effects, or reliability.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One concise sentence with no wasted words, though it could be slightly expanded with key context without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple stats tool with one optional parameter, the description is functional but lacks details about return format, scope of 'memory statistics', and how tenant_id affects results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides 100% coverage for the single parameter. The description adds no extra meaning beyond what the schema states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves 'SVM memory statistics' with a specific verb and resource, but does not distinguish from siblings like svm_list or svm_audit which might also involve statistics.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., svm_list or svm_audit) or any prerequisites or restrictions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

svm_storeB

Store a memory block in SVM (Structured Visual Memory)

ParametersJSON Schema
NameRequiredDescriptionDefault
keyYesUnique key for the memory block
valueYesContent/value of the memory block
slot_idNoOptional slot/group identifier
tenant_idNoOptional tenant ID (default: default)

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose behavioral traits such as idempotency, overwrite behavior, or side effects of storing. The agent is left to infer critical details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no redundant words. Every word contributes to stating the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description lacks critical context such as return values, storage behavior (e.g., update vs. create), and any constraints. Given no output schema and four parameters, more completeness is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with each parameter described in the schema. The tool description adds no additional meaning beyond what is already in the structured data, meeting the baseline expectation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Store' and the resource 'memory block in SVM', and the acronym SVM is expanded. This distinguishes it from sibling tools like svm_recall (retrieve) and svm_forget (delete).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs. alternatives. It only implies storage usage without specifying conditions or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 6 tool updatesv0.2.1
    • First observedsvm_audit
    • First observedsvm_forget
    • First observedsvm_list
    • First observedsvm_recall
    • First observedsvm_stats
    • First observedsvm_store

TDQS

A3.5/5.0
Disambiguation5/5

Each tool has a clearly distinct operation on memory: audit (log query), forget (delete), list (list all), recall (keyword search), stats (statistics), store (create). No overlap in purpose.

Naming Consistency5/5

All tools follow the pattern 'svm_<verb>', using consistent snake_case and lowercase verbs. The naming is uniform and predictable.

Tool Count5/5

Six tools cover the essential memory operations (CRUD plus audit and stats) without being excessive or too sparse. The scope is well-balanced for a memory management server.

Completeness4/5

Core operations create (store), read (recall, list), and delete (forget) are present. Audit and stats provide additional oversight. An explicit update operation is missing, but store may serve as upsert, so gap is minor.

Maintenance

ActivityStale
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides persistent, local-first AI memory across sessions via MCP tools for storing, searching, and retrieving context from past interactions.
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Local-first AI memory layer with hybrid retrieval and brain-inspired namespaces. Enables agents to save, search, and manage memories directly via MCP tools.
    5
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Provides persistent, graph-based memory for AI agents via MCP, enabling semantic search, wikilink traversal, reminders, and injection protection.
    9
    30
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cx2002302-lang/memory_plus'

If you have feedback or need assistance with the MCP directory API, please join our Discord server