Graph Memory keeps the last five turns and archives the rest
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
At a glance
- What is it?
- Graph Memory is a DeepSeek Harness and OpenClaw plugin that takes over the model visible history, keeping the newest completed turns in context, archiving older ones behind a marker, and recalling older knowledge through a knowledge graph and vector search. It publishes its own benchmark, and the benchmark carries its own caveats.
- Who is it for?
- Adopt Graph Memory if you run long agent sessions where the history itself is the cost, you accept a beta plugin pinned to a GitHub tag rather than an npm version, and you are willing to read the benchmark caveats before trusting the numbers. Do not adopt it if you need the reasoning and tool transcripts retained in the prompt, because the plugin removes them by design, and do not treat the published token reduction as a general result.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 23 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
A plugin that takes over the history the model can see
Graph Memory is a memory plugin for DeepSeek Harness and OpenClaw, and its pitch is stated in one line in the README: bound the context, keep the memory.
The problem it addresses is context growth. A long agent session accumulates turns, and every turn you keep in the request costs tokens forever, because the whole history is resent each time. The plugin's answer is to own the model visible historical surface without deleting the host's event log. By default it keeps the newest five completed user turns, removes completed reasoning and tool traces from future requests, and recalls relevant older or cross-session source question and answer pairs automatically.
That last part is the interesting part. The plugin does not simply truncate. It keeps a knowledge graph underneath, and when the current window no longer contains what the agent needs, it recalls the original exchange from an earlier turn or from a previous session and puts the actual source text back into the request.
The project describes itself as a native DeepSeek Harness memory plugin, with the repository description calling it a knowledge graph context engine for OpenClaw. The primary language is TypeScript, the licence is MIT, and the package name is graph-memory with Node 22.13 or newer required by its engines field. The repository carries DESIGN.md and PRODUCT.md alongside the README and a Chinese README_CN.md, plus a benchmarks/ directory, a docs/ directory, cordis patch files and an openclaw.plugin.json, which tells you the two hosts are first class rather than an afterthought.
The 1.6 change: one summary per turn, and SPO derived from it
The README documents the 1.6 turn memory navigation upgrade as a before and now table, and the change of approach is more informative than the feature list.
Before, TASK, SKILL and EVENT were extracted directly from the raw messages, and the graph nodes themselves could become the factual payload that was handed to the model. Now, one self-contained turn summary is created first, and SPO triples are derived from that same sentence. The graph is a navigation layer, and the original question and final answer remain the evidence. In the plugin's own words, the graph nodes point back to the original user question and final visible answer, and recalled context includes those exact source messages.
That is a meaningful correction. A model that receives a compressed triple has a compressed fact, which is lossy in a way the original question and answer are not. Under the new design, the triple tells the system where to look, and the evidence is still the conversation.
The other changes follow the same logic. Completed turns retain the question and the final answer, while older prefixes collapse to one fixed marker instead of a pile of reasoning traces. Old memories from the active session can no longer be filtered wholesale, and instead only sources still visible in the fresh window are excluded, so archived same-session and cross-session recall share one path. Community expansion no longer pulls in a whole neighbourhood: local LPA narrows candidates, query time PPR ranks them, and only matched question and answer pairs are recovered.
The cost is stated plainly in one sentence. Writing one completed turn costs exactly one auxiliary LLM call. Community detection and PPR are local, there are no hard coded node or edge counts, no semantic direction gates, and no JSON repair step that turns invalid output into accepted data.
The published numbers, and the footnote that qualifies them
The README leads with a measured comparison, and it is worth reading both halves of it.
The table reports a real 20 turn GLM-5.2 run. On the T20 first request, the historical native DSH baseline was 56,998 tokens against 11,008 for the latest Graph Memory, a reduction of 80.69 percent. Model visible messages fell from 171 to 21, a reduction of 87.72 percent. Across T01 to T20, first request context went from 532,451 tokens to 165,896, a reduction of 68.84 percent. And the all measured tokens figure, which is the one that matters for billing, went from 2,487,776 to 2,327,728, a change of minus 6.43 percent.
That last row is the honest one. The context takeover is dramatic, and the total token bill barely moves, because the plugin itself spends tokens: the candidate includes 166 main agent requests, 20 turn extractions and 41 embedding requests, while the historical baseline made 77 main requests.
The footnote is equally clear that this is not a strict A/B. DSH commits and nondeterministic tool loops differ between the two runs, so first request context is the direct takeover metric while the full bill remains visible. The scenario results are 20 of 20 scenario turns passed, 20 of 20 structured extractions succeeded, zero quarantined, 20 turn summaries, 92 SPO triples, 30 communities and 20 summary vectors, with T11, T19 and T20 automatically recalling out-of-window memory with exact source question and final answer.
The README calls this section Measured first, and the benchmark is a separate Markdown document with per-turn data, method and limits. Whether you believe it is a question of how much you trust a vendor's own numbers on a benchmark they designed.
Installing on DeepSeek Harness, and the npm trap in the instructions
The install path is short, and the README flags one trap in it that will save you time.
The requirement is Node.js 22.13 or newer, and there is no DSH fork involved. Until npm 1.6 is published, the README tells you to install the pinned GitHub release:
npx @deepseek-ai/dsh plugin --profile web add github:adoresever/graph-memory#v1.6.0-beta.17
npx @deepseek-ai/dsh --profile web --dump-config
npx @deepseek-ai/dsh webThe second command dumps the configuration and the third starts the host.
The trap: the npm registry still serves the old 1.5.8, and the README says not to use it to validate DSH. You should only switch to the short form, npx @deepseek-ai/dsh plugin --profile web add graph-memory, after npm view graph-memory version reports 1.6.0-beta.17 or newer. The package version in package.json is 1.6.0-beta.17, and the release list shows v1.6.0-beta.16 from 2026-09-09 and v2.0.0 from 2026-03-18. The version numbering is inconsistent across those tags, so read the version field rather than the tag.
After installation you confirm that graph-memory/dsh is active under Settings, Plugins, and the default database lives at $DSH_HOME/graph-memory/graph-memory.db, normally ~/.dsh/graph-memory/graph-memory.db.
The 1.6.0-beta.17 notes are also worth reading, because they are compatibility fixes: producer attribution on DSH 0.1.7 and Session V4, extraction on models that cannot use the off option, and configurable SQLite lock waiting. Context window and recall policies are unchanged by that release.
SQLite, FTS5 fallback and quarantine instead of repair
The capability table in the README is the clearest statement of the design, and two rows in it matter most.
Durable memory is local SQLite with stable provenance and cross-session and cross-project recall. Query first recall is vector Top-K with an FTS5 fallback, and the exact source question and answer travels with the graph hits. So the search path is a vector index when embeddings are available and SQLite's full text search when they are not, and either way the payload is the original exchange rather than a summary of it.
The other row is failure behaviour, and it is the one to read twice. An invalid extraction is quarantined, the foreground conversation continues, and bad data is not repaired or persisted. Combined with the statement that there is no JSON repair that turns invalid output into accepted data, this is a plugin that refuses to pretend it understood something it did not. A broken extraction costs you one remembered turn, not a corrupted graph and not a stalled session.
The rest of the table covers context takeover, which is a configurable newest N completed turns with one archive marker replacing the older model surface, and lightweight extraction, which uses only the user question and the final answer with a strict structured tool contract and no reasoning or tool transcript ingestion. Host support is a native DSH and Cordis adapter plus a maintained OpenClaw Context Engine adapter.
The tools exposed to the agent are named in the README's table. gm_status reports store, extraction, recall, vector and retention state, and gm_search is an explicit graph memory search.
Embeddings are optional, and the environment variables are explicit
The plugin works without any embedding service, which removes the most common objection to this kind of component.
Graph Memory supports OpenAI compatible embedding endpoints, and without embeddings it falls back to FTS5 and does not block the conversation. The optional section shows the four environment variables that switch it on:
export GRAPH_MEMORY_EMBEDDING_API_KEY='replace-with-your-key'
export GRAPH_MEMORY_EMBEDDING_BASE_URL='https://dashscope.aliyuncs.com/compatible-mode/v1'
export GRAPH_MEMORY_EMBEDDING_MODEL='text-embedding-v4'
export GRAPH_MEMORY_EMBEDDING_DIMENSIONS='1024'
dsh webThe variable names are prefixed, the base URL is a generic OpenAI compatible endpoint rather than a vendor specific one, and the dimensions variable tells the plugin what geometry to expect from the embedding model. The example points at a DashScope compatible mode endpoint, which is a hint about where the author tests, not a requirement.
The runtime dependency list is short, which is another point in the plugin's favour. The single production dependency is @sinclair/typebox, a schema and validation library, which is what implements the strict structured tool contract for extraction. The development dependencies include the Cordis framework, a session format migration package for v3 to v4, a type protocol package, TypeScript and vitest. The build is plain tsc with a separate dsh configuration, the tests run under vitest, and there is a verify:package script that checks what would actually be published.
Editorial conclusion
Adopt Graph Memory if you run long agent sessions where the history itself is the cost, you accept a beta plugin pinned to a GitHub tag rather than an npm version, and you are willing to read the benchmark caveats before trusting the numbers. Do not adopt it if you need the reasoning and tool transcripts retained in the prompt, because the plugin removes them by design, and do not treat the published token reduction as a general result. Before installing, check that the npm registry version is at least 1.6.0-beta.17 as the README instructs, decide whether you will enable OpenAI compatible embeddings or accept the FTS5 fallback, and confirm your host is one of the two adapters the package ships.
Frequently asked questions
What does the graph-memory plugin do for DeepSeek Harness?
It owns the model visible history: by default it keeps the newest five completed user turns in context, removes completed reasoning and tool traces from future requests, and archives older history behind a marker while recalling relevant older or cross-session source exchanges automatically.
How do I install graph-memory on DeepSeek Harness?
With Node.js 22.13 or newer, run `npx @deepseek-ai/dsh plugin --profile web add github:adoresever/graph-memory#v1.6.0-beta.17`. The README warns that the npm registry still serves the old 1.5.8, so use the short npm form only once `npm view graph-memory version` reports 1.6.0-beta.17 or newer.
Does graph-memory work without an embedding service?
Yes. It supports OpenAI compatible embedding endpoints, but without embeddings it falls back to SQLite FTS5 search and does not block the conversation. Setting GRAPH_MEMORY_EMBEDDING_API_KEY, GRAPH_MEMORY_EMBEDDING_BASE_URL, GRAPH_MEMORY_EMBEDDING_MODEL and GRAPH_MEMORY_EMBEDDING_DIMENSIONS turns the vector path on.
What happens when graph-memory fails to extract a turn?
The invalid extraction is quarantined, the foreground conversation continues, and the bad data is not repaired or persisted. The plugin deliberately does not run a JSON repair step that would turn invalid output into accepted data.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/adoresever-graph-memory)Was this useful?