返回目录

graph-memory

编辑精选维护状态: 活跃

adoresever/graph-memory

Deepseek Harness、Openclaw知识图谱记忆插件。2026年4月受邀发布在清华大学讨论会。Knowledge Graph + Memory;Knowledge Graph Context Engine for OpenClaw — extracts structured triples from conversations, compresses context 75%, enables cross-session experience reuse

前往 GitHub
$ git clone https://github.com/adoresever/graph-memory.git && cd graph-memory && npm install && npm test && npm run build && npm pack

607

星标

89

Fork

TypeScript

语言

MIT

许可证

2026-03-10

创建于

2026-09-09

最近推送

MIT 协议、本地优先的 agent memory 内核,经 Cordis 插件生命周期原生载入 DeepSeek Harness:类型化知识图谱、跨会话自动召回与 gm_* 工具,SQLite 存储并可选向量检索。

DSH 适配

原生运行时

作者声明

安全审计

未审计

最后核验

2026-08-21

许可证

MIT

01它能帮你完成什么?

  • Give DeepSeek Harness agents durable, traceable cross-session memory

    A typed knowledge graph (TASK / SKILL / EVENT nodes with typed edges) in local SQLite, with relevant memory automatically recalled in new sessions — even after DSH restarts

    DeepSeek Harness users who want their agent to remember past tasks, fixes and reusable skills across sessions

  • Shrink context by recalling only relevant memory instead of replaying full history

    A relevant local subgraph injected into the prompt during Prompt Assembly; the author's seven-turn benchmark measured an ~75% token reduction at turn R7

    DSH users hitting context limits or paying for redundant history replay in long workflows

  • Explicitly record and search long-term knowledge inside DSH

    gm_record persists TASK / SKILL / EVENT nodes deterministically; gm_search runs long-term graph search; gm_status and gm_stats expose store and graph state

    DSH users who need deterministic control over what critical knowledge is remembered and why a memory was recalled

02如何接入 DeepSeek Harness?

前置条件

  • Node.js `22.19+` or `24+`
  • DeepSeek Harness (dsh) with the web profile — the README uses `npx @deepseek-ai/dsh`; local acceptance was tested on DSH `0.1.0-rc.5`

安装步骤

  1. 01

    Clone and build the tarball from source (the beta is not on npm yet): `git clone https://github.com/adoresever/graph-memory.git && cd graph-memory && npm install && npm test && npm run build && npm pack`

    $ git clone https://github.com/adoresever/graph-memory.git && cd graph-memory && npm install && npm test && npm run build && npm pack

  2. 02

    Install the generated tarball into the DSH web profile: `npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/graph-memory-1.6.0-beta.1.tgz`

    $ npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/graph-memory-1.6.0-beta.1.tgz

  3. 03

    Optionally dump the config to confirm registration: `npx @deepseek-ai/dsh --profile web --dump-config`

    $ npx @deepseek-ai/dsh --profile web --dump-config

  4. 04

    Start DSH web: `npx @deepseek-ai/dsh web`

    $ npx @deepseek-ai/dsh web

  5. 05

    Optional vector retrieval: export `GRAPH_MEMORY_EMBEDDING_API_KEY`, `GRAPH_MEMORY_EMBEDDING_BASE_URL`, `GRAPH_MEMORY_EMBEDDING_MODEL`, `GRAPH_MEMORY_EMBEDDING_DIMENSIONS` before `dsh web`

    $ dsh web

验证接入成功

  • Confirm that `graph-memory/dsh` is enabled under Settings → Plugins → Plugin list
  • Use `gm_status` to check store path, graph counts, vector coverage, mode, and dimensions

03DSH 适配与能力边界

DSH 适配原生运行时

Native DSH plugin loaded by the Cordis plugin lifecycle via the cordis.patch.yml bundle entry — registers gm_* tools, auto-recall during Prompt Assembly, and DSH Credentials access

  • Typed knowledge-graph memory core

    DSH session conversation eventsTASK / SKILL / EVENT nodes with typed edges (USED_SKILL, SOLVED_BY, REQUIRES, PATCHES, CONFLICTS_WITH) plus episodic provenance, stored in local SQLite

    Writes a local SQLite database at $DSH_HOME/graph-memory/graph-memory.db (normally ~/.dsh/graph-memory/graph-memory.db)
  • Dual-path recall with graph ranking

    the current user query during Prompt Assemblya deduplicated relevant local subgraph (vector or FTS5 search + community expansion + Personalized PageRank) injected into the prompt

    Optional network calls to OpenAI-compatible embedding providers (DashScope, OpenAI, local) when vector retrieval is configured
  • gm_* tools for record, search and observability

    explicit agent or user tool calls inside DSHgm_record persists knowledge deterministically; gm_search runs long-term graph search; gm_status and gm_stats report store, extraction, recall, vector and community state

    gm_record writes new nodes into the local graph store
  • Safe, local-first context assembly

    recalled memory nodesrecalled history injected as untrusted reference material that cannot override current user instructions

    Memory data stays in the user's local profile by default; API keys come from host credentials or environment variables, never the database

04适合谁?何时不该用?

适合

  • DeepSeek Harness users who want their agent to remember past tasks, fixes and reusable skills across sessions
  • DSH users hitting context limits or paying for redundant history replay in long workflows
  • DSH users who need deterministic control over what critical knowledge is remembered and why a memory was recalled

不适合

  • The current build is 1.6.0-beta.1 and DeepSeek Harness is still in Developer Preview, which may introduce compatibility-breaking changes; local acceptance was tested on DSH 0.1.0-rc.5.
  • npm registry publication is pending, so installation requires cloning the repository and building the tarball from source instead of a one-command npm install.
  • Automatic extraction depends on auxiliary-model output stability, so critical knowledge should be persisted explicitly with gm_record; DSH does not yet expose gm_update and gm_maintain.

05兼容性、维护与安全提示

  • The current build is 1.6.0-beta.1 and DeepSeek Harness is still in Developer Preview, which may introduce compatibility-breaking changes; local acceptance was tested on DSH 0.1.0-rc.5.
  • npm registry publication is pending, so installation requires cloning the repository and building the tarball from source instead of a one-command npm install.
  • Automatic extraction depends on auxiliary-model output stability, so critical knowledge should be persisted explicitly with gm_record; DSH does not yet expose gm_update and gm_maintain.
2026-03-102026-08-14v1.5.5

MIT · actively maintained (last push 2026-08-14; current beta 1.6.0-beta.1)

06常见问题

Graph Memory 如何接入 DeepSeek Harness?原生还是 MCP?

原生接入。它通过 cordis.patch.yml 由 DSH/Cordis 插件生命周期加载,打通 Session、Tool、Agent Loop、Prompt Assembly、LLM 与 Credentials 接缝,不是走 MCP 旁路模拟,也不需要 fork DSH。

安装前需要什么?

Node.js 22.19+ 或 24+,以及 DeepSeek Harness。当前 beta 尚未发布到 npm,需要克隆仓库执行 `npm install`、`npm test`、`npm run build`、`npm pack`,再用 `npx @deepseek-ai/dsh plugin --profile web add` 安装生成的 tarball。

必须配置 embedding API key 吗?

不需要。Embedding 是可选项,不配置时召回自动回退到 FTS5 词法检索。如需向量检索,设置 GRAPH_MEMORY_EMBEDDING_* 环境变量即可接入任意 OpenAI 兼容服务(DashScope、OpenAI 或本地 provider)。

记忆数据存在哪里?

本地 SQLite 数据库:$DSH_HOME/graph-memory/graph-memory.db(通常为 ~/.dsh/graph-memory/graph-memory.db)。数据默认保存在用户本地 profile,API key 来自宿主凭据或环境变量,不会写入数据库。

目前有哪些限制?

当前版本为 1.6.0-beta.1,且 DeepSeek Harness 仍处于 Developer Preview,可能出现破坏兼容性的变更;DSH 侧暂未暴露 gm_update 和 gm_maintain,Pro 可视化图谱工作台也尚未发布。

08数据与来源

  • 作者声明github.com2c20ed9f3c16…

    Loaded by the DSH/Cordis plugin lifecycle, not simulated through an MCP side channel.

  • 作者声明github.com2c20ed9f3c16…

    Integrates Session, Tool, Agent Loop, Prompt Assembly, LLM, and Credentials seams.

页面基于项目公开文档、仓库元数据和 DSH Plugins 的结构化解析生成;最后核验于 2026-08-21。发现错误?提交更正。

🏆

最佳 DeepSeek Harness 插件

从全目录挑出的 12 个值得优先安装的插件,覆盖各个分类。

DSH Plugins 是独立的 DeepSeek Harness 插件市场,与 DeepSeek 官方无关,也不代表官方背书。第三方插件未经安全审计,安装前请审查源码。

每周获取最新的 DeepSeek Harness 插件,绝不滥发。