graph-memory
Imports memories from Hermes (an AI coding agent) into the knowledge graph.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@graph-memoryremember that vLLM 0.25 now supports speculative decoding"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Graph Memory
本地知识图谱记忆系统 — 一个桌面常驻的记忆网关,让 AI agent(Claude Code / Codex / Hermes)跨会话检索和写入同一张知识图谱,不用从头交代。
English: Graph Memory is a local knowledge-graph memory gateway. Agents read/write a shared graph via MCP tools, so knowledge captured in one session is reachable in every other. Runs locally — embeddings are a local BGE-Small-ZH model, the graph is SQLite + FTS5, and the LLM is only used (optionally) for knowledge extraction.
特性
混合检索 — BM25 (FTS5 trigram) + Embedding (BGE-Small-ZH) → RRF 融合 → PPR 多跳图扩散 → MMR 多样性
多实体分路检索 — "8397板子和A800的区别" 能同时覆盖两个实体邻域
跨 agent 接入 — 一键接入 Claude Code / Hermes / Codex,自动部署 SKILL.md 行为指令
知识生命周期 — 写入(auto_link 建边 + 三层去重)→ 提炼(LLM,标记防重复花 token)→ 更新(存历史)→ 合并 → 遗忘(后台自动)
embedding 持久化 — SQLite 存储向量,重启不重算
时间衰减 + 访问计数 — 常用的、近期更新的节点优先返回
后台维护 — 每 60 分钟自动遗忘陈旧节点 + 去重扫描,零 LLM token
系统托盘常驻 — 关窗不退进程,保证 agent 随时能调到 HTTP API
本地运行 — 数据不出本机,embedding 模型本地加载
Related MCP server: io.github.pmgarg/cgraphy
快速开始
1. 构建
git clone https://github.com/Doodle-Lin/graph-memory.git
cd graph-memory
cd src-tauri
cargo tauri build产物:target/release/bundle/nsis/Graph Memory_0.2.0_x64-setup.exe
2. 启动
双击安装后启动,或开发模式:
cd src-tauri
cargo tauri dev首次启动会下载 embedding 模型(BGE-Small-ZH-v1.5,~100MB),之后缓存到本地。
3. 导入已有记忆
在应用界面点"导入"按钮,或:
curl -X POST http://127.0.0.1:9121/api/import?source=all支持 Hermes(MEMORY.md / USER.md / skills)、Claude Code(memory/*.md)、Codex(history.jsonl)。
4. 接入 Agent
在应用左侧"Agent 接入"面板,点"接入"按钮。会自动:
写 MCP 配置到 agent 的配置文件(Claude:
.claude.json/ Hermes:config.yaml)部署 SKILL.md 到 agent 的 skills 目录(教 agent 自动检索/写入记忆)
重启 agent 后,自动获得 7 个记忆工具。
5. 配置 LLM 提炼(可选)
在应用界面点齿轮按钮,填入 Base URL / API Key / 模型名。提炼功能立即可用,检索/写入不需要 LLM。
在 Agent 中使用
Agent 加载 SKILL.md 后会自动执行:
回答前:静默调
retrieve检索已有知识回答后:如果有有价值知识,自动调
write写入发现过时:调
update修正无需用户指令 — agent 自动判断内容是否有价值
MCP 工具(7 个)
工具 | 说明 |
| 检索记忆(BM25+Embedding+RRF → PPR 多跳 → MMR) |
| 写入新知识(auto_link 建边 + 三层去重) |
| LLM 提炼对话→知识(批量,跨批次边解析) |
| 修正已有节点(存历史,content_hash 同步) |
| 查看最近添加 |
| 合并两个近似节点(边迁移,内容存历史) |
| 遗忘陈旧节点(>180天 + access<2 + 保留桥节点) |
架构
┌─────────────────────────────────────────────────┐
│ Agent (Claude Code / Codex / Hermes) │
│ ┌─────────────┐ ┌──────────────────┐ │
│ │ MCP Client │ │ SKILL.md (行为指令) │ │
│ └──────┬──────┘ └──────────────────┘ │
│ │ stdio (JSON-RPC 2.0) │
│ ┌──────▼──────┐ │
│ │ MCP Server │ (轻量 HTTP 代理) │
│ └──────┬──────┘ │
└─────────┼─────────────────────────────────────┘
│ HTTP (127.0.0.1:9121)
┌─────────▼─────────────────────────────────────┐
│ Tauri 2 桌面进程 (graph-memory.exe) │
│ ┌──────────────┐ ┌────────────┐ ┌────────┐ │
│ │ GraphEngine │ │ LLM 提炼 │ │ 导入器 │ │
│ │ SQLite+FTS5 │ │ OpenAI兼容 │ │ │ │
│ │ BGE-Small-ZH │ └────────────┘ └────────┘ │
│ │ PPR 多跳 │ │
│ │ MMR 去重 │ ┌────────────────────────┐ │
│ └──────┬───────┘ │ 后台维护线程 │ │
│ │ │ (每60min: forget+dedup)│ │
│ ┌──────▼────┐ └────────────────────────┘ │
│ │ SQLite │ ┌──────────────────────────┐ │
│ │ graph.db │ │ Webview (前端 SPA) │ │
│ │ + FTS5 │ │ 检索列表 + 详情 + 图谱 │ │
│ │ + embeddings│ └──────────────────────────┘ │
│ └───────────┘ 系统托盘常驻 │
└─────────────────────────────────────────────────┘检索算法
query → 实体抽取(ASCII标识符分路)
→ BM25 (FTS5 trigram, OR 连接) ─┐
→ Embedding (BGE-Small-ZH 语义) ─┤→ RRF(k=60) 融合 → 归一化
→ 准入门槛(cosine≥0.2 OR BM25命中) │
↓
PPR 迭代(3轮, α=0.5)
双向扩散(Out+In)
边类型加权(depends_on>same_topic)
↓
时间衰减(90天半衰期)
访问计数加成(log(1+n))
MMR 多样性(>0.85 跳过)
↓
top_k 结果API
端点 | 方法 | 说明 |
| POST | 检索知识 |
| POST | 写入新知识 |
| POST | 更新已有节点 |
| POST | LLM 提炼对话→知识 |
| POST | SSE 流式批量提炼 |
| GET | 最近添加 |
| GET | 全图快照 |
| GET | 图统计 + 类型/来源分布 |
| GET | 关键词搜索 |
| GET | BFS 邻居 |
| DELETE | 删除节点 |
| POST | 导入外部记忆 |
| POST | 补全 embedding + 建边 |
| POST | 合并两个节点 |
| POST | 遗忘陈旧节点 |
| GET | 近似对候选(只读) |
| GET | LLM 配置状态 |
| POST | 写 LLM 配置到 .env |
| GET | 检测已安装的 agent |
| POST | 接入 agent(写配置+部署SKILL) |
| POST | 断开 agent(清配置+删SKILL) |
| GET | 健康检查 |
配置项
环境变量 | 默认 | 说明 |
| (无) | LLM API key,仅 extract/refine 需要 |
| (无) | OpenAI 兼容 base url |
| (无) | 模型名 |
| BGE-Small-ZH-v1.5 | 本地嵌入模型 |
| 9121 | 服务端口 |
| %LOCALAPPDATA%\hermes | Hermes 记忆根 |
| ~/.claude | Claude Code 根 |
| ~/.codex | Codex 根 |
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Personal knowledge graph as an AI memory layer over MCP - read, save, and link your memories.
Graph-native persistent memory for AI agents — 33 MCP tools, zero-LLM writes.
Shared long-term memory for AI agents: save and recall context as a searchable knowledge graph.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn in-memory knowledge graph MCP server that gives coding agents structural and semantic recall over codebases by indexing Python source, ADR documents, and project configuration, exposing 7 tools for search, traversal, context retrieval, and natural-language Q&A.-
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to query a codebase as a knowledge graph, providing token-budgeted context, search, and impact analysis via MCP tools.MIT
- AlicenseNot gradedqualityAmaintenanceProvides local-first persistent memory with a typed knowledge graph and bounded multi-hop retrieval via MCP, letting coding agents and local LLM systems store, search, and recall facts across sessions without hosted services or model dependencies.MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to query a local, multi-repo code graph for symbol exploration, blast radius analysis, co-change mining, and durable code-anchored memory via MCP tools.69 npm14Business Source 1.1