Skip to main content

graph-memory

562Stars80Forks9Issues3Watchers

Provides a local SQLite knowledge

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
TypeScript
License
MIT
Branch
main
claude-codecodexdeepseekdeepseek-harnessdshdsh-plugindsh-pluginsknowledge-graph

Install

cmdweb profile
$ dsh plugin --profile web add github:adoresever/graph-memory

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin adoresever/graph-memory for me: review the repository at https://github.com/adoresever/graph-memory first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Sentence Positioning

graph-memory沉淀AI对话中产生的任务、技能、事件及其关系成本地知识图谱,并在新问题出现时只召回相关的局部子图注入上下文,从而让DeepSeek Harness拥有可追溯、可搜索、跨会话共享的长期记忆。

Core Capabilities

  • 自动把对话消息抽取成TASK / SKILL / EVENT三类节点,带USED_SKILL、SOLVED_BY、REQUIRES、PATCHES、CONFLICTS_WITH几类因果关系
  • 每个节点都关联原始user / assistant片段,召回时能告诉用户这条记忆来自哪个会话、因为什么被想起
  • 在Prompt Assembly阶段自动检索相关子图注入system prompt,不需要模型主动调用工具
  • 提供gm_status、gm_search、gm_record、gm_stats四个原生工具,支持主动搜索、确定性记录和统计查看
  • 支持语义向量检索(可选)与SQLite FTS5全文检索双通道:未配向量时自动降级到FTS5,永远不阻断对话
  • 跨DSH重启保留数据,事件ID稳定使HMR和恢复期间不会重复入库

Technical Implementation

  • Language: TypeScript
  • Key Dependencies: @photostructure/sqlite(本地SQLite存储 + FTS5)、@sinclair/typebox(Schema)、可选的OpenAI兼容Embedding HTTP服务
  • Architecture Pattern: 宿主无关内核 + 双宿主适配器 —— dsh.ts作为DeepSeek Harness / Cordis适配器走bundle.patch自动注入;index.ts保留对OpenClaw的兼容入口;src/{extractor,recaller,graph,store,format,engine}六个子目录共享一套算法层
  • Entry Files: dsh.ts(DSH入口,apply函数挂载tools / llm / systemPrompt / agentLoop / sessions / credentials六个接缝),cordis.patch.yml(DSH bundle声明)

Use Cases

日常用DSH跟AI协作开发时,经常出现几周前讨论过某个库的用法、某次bug修复方案、某个API设计决策,但新会话里模型完全不知道 —— 用户不得不反复贴历史。Graph Memory让模型在每次新会话启动前自动看到这些沉淀下来的知识,无需手动复制粘贴。它也适合长流程项目(持续数天的开发任务、多分支并行迭代),因为它能区分不同来源节点并保持召回路径可解释。

Prerequisites and Compatibility

DependencyMinimum VersionDescription
DeepSeek Harness0.1.0-rc.5实测验证(DSH仍为Developer Preview)插件走Cordis bundle.patch注入;当前DSH未公开最低版本约束
Node.js>=20(package.json声明);DSH实际使用建议22.19+或24+
PlatformmacOS / Windows / Linux跨平台,无额外系统库要求
Native Module@photostructure/sqlite(native)@photostructure/sqlite跨平台预编译;@sinclair/typebox纯JS

Installation

dsh plugin --profile web add github:adoresever/graph-memory

Configuration Options

ConfigTypeDescriptionDefault
dbPathstringSQLite图谱数据库存放路径,留空则使用$DSH_HOME/graph-memory/graph-memory.db~/.dsh/graph-memory/graph-memory.db
extractionEnabledboolean是否启用自动从对话里抽取任务/技能/事件true
recallEnabledboolean是否在Prompt Assembly阶段自动注入相关记忆true
recallMaxNodesinteger跨会话召回时最多向当前prompt注入的节点数6
recallMaxDepthinteger图遍历深度(从召回种子节点出发走几跳)2
maintenanceIntervalinteger每隔多少轮检查一次信号,触发PageRank + 社区检测6
embedding.apiKeyEnvstringEmbedding服务的key在启动环境里的变量名(如GRAPH_MEMORY_EMBEDDING_API_KEY),由DSH Credentials解析真实值未设置
embedding.baseURLstringEmbedding服务的接口地址,OpenAI兼容,DashScope / OpenAI / 本地服务都能接OpenAI默认
embedding.modelstring向量模型名,默认text-embedding-3-smalltext-embedding-3-small
embedding.dimensionsinteger向量维度(如DashScope text-embedding-v4为1024),仅在服务支持时设置由服务决定

未列出的env变量名对照:GRAPH_MEMORY_EMBEDDING_API_KEY / GRAPH_MEMORY_EMBEDDING_BASE_URL / GRAPH_MEMORY_EMBEDDING_MODEL / GRAPH_MEMORY_EMBEDDING_DIMENSIONS,由cordis.patch.yml读取并注入到上面这套字段里。

FAQ

Q: 这个插件需要联网吗?API key会泄露吗?

A: 默认完全离线运行,只有当用户主动配置向量服务(Embedding)时才会发请求。key只以环境变量名形式写在Cordis patch里,真实密钥由DSH Credentials解析,数据库里不会持久化任何secret。

Q: 卸载插件会丢失我之前的记忆吗?

A: 不会丢失。SQLite数据库独立于插件存在,禁用或卸载插件都只是不再读取/写入,原graph-memory.db随时可重新挂载复用。

Q: 想清空记忆怎么操作?

A: 关闭插件后手动删除$DSH_HOME/graph-memory/graph-memory.db文件即可。Community版未提供一键清空工具,删除前建议备份。

Q: 跟DSH自带的会话压缩有冲突吗?

A: 不冲突。压缩决定当前窗口还能装多少原始历史,图谱记忆决定哪些"已经被消化过的知识"值得在下一轮唤醒 —— 两者目标正交,可同时启用。

Q: 自动抽取偶尔漏掉重要内容怎么办?

A: 用gm_record工具主动写入,给出name / type(TASK/SKILL/EVENT)/ description / content四个字段,会跳过LLM抽取链路直接落库,可作为beta阶段的兜底手段。

Q: DSH模式下找不到gm_update / gm_maintain?

A: 这是预期行为。DSH/Cordis适配器只暴露gm_status、gm_search、gm_record、gm_stats四个工具,gm_update和gm_maintain暂时保留在OpenClaw入口,DSH端未实现。

Q: 是否支持中文和长内容?

A: FTS5检索对中文按unicode分词匹配;向量检索走Embedding模型,与语种无关。长内容会被分块抽取,不要求完整塞进单条节点。

Difficulty Level

进阶 — 需要懂DSH的Cordis bundle安装机制、能配置Embedding服务的环境变量,并理解SQLite与FTS5的基本概念才能调优召回;但装好即用的默认配置也能正常工作,普通用户也能跑起来。

Known Issues and Limitations

  • DSH版暂未暴露gm_update和gm_maintain工具,这两个能力目前只在OpenClaw入口可见
  • 自动抽取依赖辅助模型输出的稳定性,关键知识建议使用gm_record工具手动写库
  • 当前beta 1.6.0-beta.1还未发布到npm registry,必须通过git clone + npm run build + npm pack走本地tarball安装
  • DSH端Pro版(Neo4j适配器 + 可视化工作台 + Client Plugin)尚未实现,Community版只走SQLite
  • 配置项freshTailCount在openclaw.plugin.json中已被标记deprecated(旧方案按"新鲜尾部"切分,现已改为按用户轮次切分,不再生效)
  • DSH仍处于Developer Preview阶段,后续版本可能引入破坏性变更,插件在0.1.0-rc.5上验证过

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/adoresever/graph-memory)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory