wanyimem
万忆 · 永不遗忘的全量记忆系统 — MCP 标准 stdio + 事件溯源 + 过程记忆 + 语义向量检索 + sqlite-vec ANN + reranker 精排 + 记忆图谱 + 元认知知识空白 + 只读 Markdown 镜像 + 护城河全自动,23 个 MCP 工具。
Install / Use
claude mcp add 17861102832 -- npx -y github:17861102832/wanyimemIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
AI & Machine LearningSupported Platforms
Our assessment of wanyimem
wanyimem scores 81/100 on our quality scale, 727th of 947 AI & Machine Learning skills we index.
Its MCP Server is 8.8 KB long, well organised into 12 sections with 6 code examples: a thorough specification that gives an agent plenty to work with.
It has 3 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated 12 days ago, so wanyimem is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 92/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
wanyimem compared with similar skills
All 4 of these similar skills score higher than wanyimem; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| wanyimem (this skill)by 17861102832 | 81 | 3 | 12d ago | MCP Server |
| claude-memby thedotmack | 100 | 112.4k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 108.6k | today | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 90.4k | 9d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 78.8k | today | CLAUDE.md |
Frequently asked questions
- How do I install wanyimem?
- Run
claude mcp add 17861102832 -- npx -y github:17861102832/wanyimem. The install tabs above show the steps for each supported agent. - Which AI agents does wanyimem work with?
- It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
- Is wanyimem safe to use?
- It is MIT-licensed and scores 92/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is wanyimem still maintained?
- The repository was last updated 12 days ago, so wanyimem is actively maintained.
Skill content
View source on GitHubWanYi Memory Core 万忆中枢
永不遗忘的全量记忆系统 — Event-sourced long-term memory for AI agents: process memory, mistake books, experience crystallization, confidence-based decision blocking, counterfactual branches, cross-domain analogy, trajectory replay, proactive partner, semantic vector retrieval, reranker, memory graph, time decay and metacognitive knowledge-gaps. Ships as a local-first MCP server with 23 tools. Your data never leaves your machine.
🎬 Live Demo: 交互式演示页 · 源码
docs/demo.html
Why this is different
Most memory systems store your data in the cloud, need a heavy dependency stack, or only do keyword search. wanyimem is local-first, single-file SQLite, and installs with one dependency (numpy).
| | wanyimem | typical memory server | |---|---|---| | Data | never leaves your machine (zero telemetry) | cloud / SaaS | | Infra | SQLite single file, no separate vector DB | Qdrant / Neo4j / Postgres | | Defaults | shadows the agent, blocks high-risk actions, opens counterfactual branches | stores & retrieves | | Resources | runs on 2-core / 2GB | heavier | | Evolves | zero-participation (learns from your mistakes automatically) | manual "remember this" |
23 MCP tools, open source (MIT), Python 3.10+, pip install wanyimem.
Why
LLM agents forget. Every chat window is amnesia: preferences, lessons, and hard-won experience evaporate when the session ends.
WanYi Memory Core is a local-first, full-quantity, self-evolving memory system:
- Event sourcing — an append-only WAL is the single source of truth. Nothing is ever deleted; decay only affects retrieval ranking.
- Semantic recall — hybrid retrieval: BM25 keywords + local Chinese embedding (BAAI/bge-small-zh-v1.5) + reranker (BAAI/bge-reranker-base) + knowledge-graph expansion + explicit time decay. Vector search is hybrid itself: exact cosine below
ANN_MIN_COUNT, and asqlite-vecANN pre-filter + exact re-rank above it — so it stays fast at scale without sacrificing recall quality. - Metacognition — when recall is weak, the system admits it and records a knowledge-gap instead of hallucinating an answer.
- Decision guardrails — high-risk actions (all-in, revenge-trading, force-push, rm -rf) trigger confidence-based blocking with counterfactual branches: you see what would have happened if you had listened.
- Zero-participation evolution — no need to say "remember this"; the system decides what to store, consolidates overnight, and surfaces weekly trajectory reviews.
Install
pip install wanyimem # core
pip install "wanyimem[all]" # + vector/reranker models + sqlite-vec ANN (use [ann] for ANN only)
Requires Python 3.10+. Models (embedding ~95MB, reranker ~1.1GB) are downloaded on first use from HuggingFace; set HF_ENDPOINT=https://hf-mirror.com if you are in mainland China.
Before the PyPI release lands, you can also install directly from GitHub (identical code):
pip install "git+https://github.com/17861102832/wanyimem.git"
CLI & Automation
Beyond the MCP server, wanyimem ships two console commands after pip install wanyimem:
wanyi-export --db memory.db --out memory.md # readable, diff-able Markdown mirror of all memory (read-only)
wanyi-auto --db memory.db # one AutoMoat pass: honest counterfactual auto-settlement + consolidation + analog patrol
wanyi-auto --db memory.db --loop 3600 # periodic scheduler (daemon background; off by default)
wanyi-exportrenders the event-sourced store into a human-readable, version-controllable Markdown mirror (grouped by 道/法/术, plus mistakes / experiences / knowledge-gaps / counterfactual branches / cross-domain patterns).wanyi-autoautomates the guardrails: it honestly settles overdue counterfactual branches (marking themexpiredrather than fabricating a winner), runs sleep + deep consolidation, and surfaces the cross-domain analog patterns most worth recalling.
Quick Start (MCP)
Add to your mcp.json (Claude Desktop, Cursor, Trae, etc.):
{
"mcpServers": {
"wanyi": {
"command": "python",
"args": ["-m", "wanyi.memory_core"],
"env": {
"WANYI_STORE_DIR": "C:/path/to/your/memory"
}
}
}
}
Env keys are "Chinese-first, ASCII-fallback": the new
WANYI_STORE_DIR(recommended, more portable) and the legacy万忆中枢_STORE_DIRboth work. Barepythondepends on PATH and may fail; prefer an absolute interpreter path, orpip install wanyimemthen use"command": "wanyi".
Then any agent can call the 23 tools, e.g.:
万忆记录见闻 → "2026年5月基金大跌时我死扛不止损,亏了18%才割肉。"
万忆召回记忆 → query "认赔离场到底对不对" # semantic match even with zero shared keywords
万忆置信度决策检查 → "我要全仓梭哈" # BLOCK if confidence is low, with historical mistakes
Quick Start (Library)
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"))
Features
| Area | Capability |
|---|---|
| Storage | SQLite + append-only event WAL; 道/法/术 three-layer half-lives |
| Retrieval | Keyword BM25 + vector (bge-small-zh) + reranker (bge-reranker-base) + graph expansion + time-decay fields |
| Metacognition | knowledge-gap auto-record, stats self-check, honest "I don't know" |
| Guardrails | confidence-based decision blocking, counterfactual branches with auto-settlement, cross-domain analogy bridging |
| Proactivity | daily brief on LOAD, due-branch reminders, weekly trajectory replay, risk-keyword alert |
| Growth | mistake book, experience crystallization, overnight consolidation, evolution queries |
| Privacy | fully local, zero telemetry, no cloud dependency |
Public benchmark (LongMemEval) — session-level retrieval, full results in benchmark/RESULTS.md. Core (BM25 + graph, no models) reaches Recall@5 = 0.960 / MRR = 0.907 on s_cleaned (with ~40 distractor sessions). Reproduce via python benchmark/longmemeval_run.py.
Benchmark — reproducible mini LongMemEval (14 keyword-mismatched cross-session fact queries, run via python benchmark/recall_benchmark.py):
| Version | Recall@5 | MRR | |---|---|---| | Core (keyword BM25 + knowledge-graph, no models) | 1.000 (14/14) | 0.857 | | Full (bge-small-zh vector + bge-reranker-base rerank) | 1.000 (14/14) | 0.857 |
Every query is intentionally phrased with different keywords than its answer (e.g. 本地数据库怎么提高并发写 → WAL模式, 记忆系统最怕什么 → 事件溯源), so 14/14 reflects genuine semantic recall, not string matching. The knowledge-graph channel (active in the core, model-free) already lifts BM25 to parity here; the vector + reranker path shows its edge on larger-scale semantic expansion ("pip install wanyimem[all]" downloads the models).
Architecture (1.1.0)
wanyi/
├── core_base.py # constants · four-factor scoring · MemoryDB (SQLite engine)
├── engine.py # WanYiCore · 23 MCP tools · MCP_TOOLS registry · JSON-RPC dispatch
├── transport.py # MCP stdio: newline-delimited JSON (+ legacy Content-Length frame compat)
├── memory_core.py # compat facade — every legacy import path keeps working
├── version.py # single source of truth for the version
└── hooks / gardener / confidence / vector_memory / reranker / mirror / auto_moat ...
- Standards-compliant stdio: speaks MCP newline-delimited JSON and still parses legacy LSP
Content-Lengthframes. - Compat facade:
wanyi.memory_core,python -m wanyi.memory_core,python -m wanyiand thewanyiconsole script all keep working after the 1.1.0 module split. - 33 tests (pytest, py3.10–3.12 CI matrix + ruff): stdio protocol compliance, module-split integrity (symtable-based missing-global guard) and a full 23-tool smoke pass.
Docs
Contributing
See CONTRIBUTING.md. Report vulnerabilities privately via SECURITY.md.
License
MIT © 2026 Zhao Xikun
Related Skills
claude-mem
112.4kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
108.6kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Understand-Anything
90.4kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
78.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
