Skip to main content
Glama

WanYi Memory Core 万忆中枢

永不遗忘的全量记忆系统 — 面向 AI 智能体的事件溯源长期记忆:过程记忆、错题本、经验结晶、基于置信度的决策拦截、反事实分支、跨域类比、轨迹回放、主动伙伴、语义向量检索、重排序器、记忆图谱、时间衰减和元认知知识缺口。以本地优先的 MCP 服务器形式交付,包含 23 个工具。您的数据永远不会离开您的机器。

Python License Version MCP CI PyPI


为什么

LLM 智能体会遗忘。每一个聊天窗口都是一次失忆:当会话结束时,偏好、教训和来之不易的经验都会蒸发。现有的记忆系统要么将数据存储在云端(存在隐私风险),要么需要重型基础设施,要么只能做关键词搜索(缺乏语义召回)。

WanYi Memory Core 是一个本地优先、全量、自我进化的记忆系统

  • 事件溯源 — 仅追加的 WAL 是唯一事实来源。任何内容都不会被删除;衰减只影响检索排序。

  • 语义召回 — 混合检索:BM25 关键词 + 本地中文嵌入模型(BAAI/bge-small-zh-v1.5)+ 重排序器(BAAI/bge-reranker-base)+ 知识图谱扩展 + 显式时间衰减。

  • 元认知 — 当召回较弱时,系统会坦然承认,并记录一个知识缺口,而不是编造答案。

  • 决策护栏 — 高风险操作(满仓、报复性交易、force-push、rm -rf)会触发基于置信度的拦截,并附带反事实分支:你会看到如果你当初听从了会发生什么。

  • 零参与进化 — 无需说“记住这个”;系统自行决定存储什么,在夜间整合,并呈现每周轨迹回顾。

Related MCP server: Memory MCP

安装

pip install wanyimem            # core
pip install "wanyimem[all]"     # + vector & reranker models deps

需要 Python 3.10+。模型(嵌入模型 ~95MB,重排序器 ~1.1GB)会在首次使用时从 HuggingFace 下载;如果您在中国大陆,请设置 HF_ENDPOINT=https://hf-mirror.com

在 PyPI 版本正式发布之前,您也可以直接从 GitHub 安装(代码完全相同):

pip install "git+https://github.com/17861102832/wanyimem.git"

快速开始(MCP)

添加到您的 mcp.json(Claude Desktop、Cursor、Trae 等):

{
  "mcpServers": {
    "wanyi": {
      "command": "python",
      "args": ["-m", "wanyi.memory_core"],
      "env": {
        "万忆中枢_STORE_DIR": "C:/path/to/your/memory"
      }
    }
  }
}

然后任何智能体都可以调用这 23 个工具,例如:

万忆记录见闻 → "2026年5月基金大跌时我死扛不止损,亏了18%才割肉。"
万忆召回记忆 → query "认赔离场到底对不对"   # semantic match even with zero shared keywords
万忆置信度决策检查 → "我要全仓梭哈"          # BLOCK if confidence is low, with historical mistakes

快速开始(库)

from wanyi import WanYiCore

engine = WanYiCore()
engine.tool_record_memory(
    content="止损纪律:亏损超过8%必须无条件卖出",
    layer="法", mem_type="principle",
)
resp = engine.tool_recall_memory("认赔离场到底对不对", limit=5)
for m in resp["memories"]:
    print(m["content"], m.get("_rerank_score"))

功能特性

领域

能力

存储

SQLite + 仅追加事件 WAL;道/法/术 三层半衰期

检索

关键词 BM25 + 向量(bge-small-zh)+ 重排序器(bge-reranker-base)+ 图谱扩展 + 时间衰减字段

元认知

知识缺口自动记录、stats 自检、诚实的“我不知道”

护栏

基于置信度的决策拦截、带自动结算的反事实分支、跨域类比桥接

主动性

LOAD 时每日简报、到期分支提醒、每周轨迹回放、风险关键词警报

成长

错题本、经验结晶、夜间整合、进化查询

隐私

完全本地、零遥测、无云端依赖

基准测试(mini LongMemEval,跨会话事实召回,10 个案例):Recall@5 = 90%,MRR = 0.900

文档

贡献

参见 CONTRIBUTING.md。请通过 SECURITY.md 私下报告漏洞。

许可证

MIT © 2026 Zhao Xikun

A
license - permissive license
Not graded
quality - not tested
A
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides AI agents with persistent, searchable memory that survives across conversations using semantic search, temporal versioning, and smart organization. Enables long-term context retention and cross-session continuity for AI assistants.
    14
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides persistent AI agent memory using a local vector database for long-term semantic storage and short-term session scratchpads. It enables low-latency memory operations including search, storage, and bulk management without external cloud dependencies.
  • A
    license
    A
    quality
    D
    maintenance
    Provides persistent long-term memory for AI agents through semantic search and automated knowledge graph extraction. It enables agents to store, recall, and reason over facts, preferences, and relationships across multiple conversations and sessions.
    14
    8
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Local-first, multi-user shared memory for AI agents with semantic search, offline support, and team synchronization.
    MIT

View all related MCP servers

Related MCP Connectors

  • Persistent memory for AI agents — verbatim conversations, searchable by meaning.

  • Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.

  • Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.

View all MCP Connectors

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/17861102832/wanyimem'

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