Traceable, searchable cross-session memory for DeepSeek Harness — conversation knowledge as typed graph nodes (TASK/SKILL/EVENT) and typed edges.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:adoresever/graph-memory
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
The problem it solves
Graph Memory owns the model-visible historical surface without deleting DSH's event log. By default it keeps the newest five completed user turns, removes completed reasoning/tool traces from future requests, and recalls relevant older or cross-session source Q/A automatically.
The 1.6 turn-memory navigation upgrade
| Before | Now |
|---|---|
| Extract TASK / SKILL / EVENT directly from messages | Create one self-contained turn summary, then derive SPO from that same sentence |
| Graph nodes could become the factual payload | Summary, SPO, and communities only navigate; original question and final answer remain the evidence |
| Old memories from the active session could be filtered wholesale | Exclude only sources still visible in the fresh window; archived same-session and cross-session recall share one path |
| Community expansion could pull a whole neighborhood | Local LPA narrows candidates, query-time PPR ranks them, and only matched Q/A is recovered |
| DSH retained complete tool and reasoning traces | Completed turns retain question + final answer; older prefixes collapse to one fixed marker |
Writing one completed turn costs exactly one auxiliary LLM call. Community detection and PPR are local. There are no hard-coded node/edge counts, semantic direction gates, or JSON repair that turns invalid output into accepted data. Read the complete design, source map, and porting sequence →
Measured first
| Real 20-turn GLM-5.2 run | Historical native DSH baseline | Latest Graph Memory | Change |
|---|---|---|---|
| T20 first request | 56,998 tokens | 11,008 tokens | −80.69% |
| T20 model-visible messages | 171 | 21 | −87.72% |
| T01–T20 first-request context | 532,451 tokens | 165,896 tokens | −68.84% |
| All measured tokens¹ | 2,487,776 | 2,327,728 | −6.43% |
¹ The latest candidate includes 166 main-agent requests, 20 turn extractions, and 41 embedding requests; the historical baseline made 77 main requests. DSH commits and nondeterministic tool loops differ, so this is not a simultaneous strict A/B. First-request context is the direct takeover metric; the full bill remains visible.
20/20 scenario turns passed · 20/20 structured extractions succeeded · 0 quarantined · 20 turn summaries · 92 SPO triples · 30 communities · 20 summary vectors. T11, T19, and T20 automatically recalled out-of-window memory with exact source question and final answer.
Read the Markdown benchmark, per-turn data, method, and limits →
Memory survives the context window
The graph is a navigation layer, not a replacement for evidence. TASK, SKILL, and EVENT nodes point back to the original user question and final visible answer; recalled context includes those exact source messages.
Install on DeepSeek Harness
1.6.0-beta.17 fixes producer attribution on DSH 0.1.7+ / Session V4 (#113), extraction on models that cannot use off (#117), and configurable SQLite lock waiting. Context-window and recall policies remain unchanged. Fix details and recovery instructions (Chinese) →
Node.js 22.13+ · no DSH fork · until npm 1.6 is published, 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 web
The npm registry still serves the old 1.5.8; do not use it to validate DSH. Switch to npx @deepseek-ai/dsh plugin --profile web add graph-memory only after npm view graph-memory version reports 1.6.0-beta.17 or newer.
Confirm that graph-memory/dsh is active under Settings → Plugins. The default database is $DSH_HOME/graph-memory/graph-memory.db, normally ~/.dsh/graph-memory/graph-memory.db.
What ships
| Capability | Implementation |
|---|---|
| Context takeover | Configurable newest-N completed turns; one archive marker replaces the older model surface |
| Lightweight extraction | Only the user question and final answer; strict structured tool contract; no reasoning/tool transcript ingestion |
| Query-first recall | Vector Top-K with FTS5 fallback; exact source Q/A travels with graph hits |
| Durable memory | Local SQLite, stable provenance, cross-session and cross-project recall |
| Failure behavior | Invalid extraction is quarantined; foreground conversation continues; bad data is not repaired or persisted |
| Host support | Native DSH/Cordis adapter; maintained OpenClaw Context Engine adapter |
Graph Memory supports OpenAI-compatible embedding endpoints. Without embeddings it falls back to FTS5 and does not block conversation.
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 web
| Tool | Purpose |
|---|---|
gm_status |
Store, extraction, recall, vector, and retention state |
gm_search |
Explicit graph-memory search |
gm_record |
Deterministically persist a TASK, SKILL, or EVENT |
gm_stats |
Graph and retention receipts |
gm_maintain |
One bounded maintenance tick |
gm_retry_extraction |
Explicitly retry pending or quarantined extraction |
Automatic recall needs no tool call. Extraction may use a dedicated model via GRAPH_MEMORY_LLM_PROVIDER and GRAPH_MEMORY_LLM_MODEL; optional reasoning and output controls are GRAPH_MEMORY_LLM_REASONING_EFFORT and GRAPH_MEMORY_LLM_MAX_TOKENS.
Without an explicit effort, extraction reads the exact model capability: prefer off, otherwise the host's first advertised effort, or omit the field on non-reasoning models. Route/provider failures keep source Q/A pending and report the cause in logs and gm_status. To recover old quarantined records, enable assistantTools: all and invoke gm_retry_extraction. Configure SQLite lock waiting with GRAPH_MEMORY_DB_BUSY_TIMEOUT_MS (default: 5000 milliseconds).
openclaw plugins install graph-memory
openclaw plugins enable graph-memory
openclaw gateway restart
Activate the Context Engine slot in ~/.openclaw/openclaw.json:
{
"plugins": {
"slots": { "contextEngine": "graph-memory" },
"entries": { "graph-memory": { "enabled": true } }
}
}
The repository also contains an experimental read-only DSH Pro Lite Host + Client plugin backed by Community SQLite. The 2D/3D graph workbench, split view, and controlled drag-to-context remain planned. See dsh-pro/README_CN.md.
Verification and limits
Current beta 1.6.0-beta.17 passes 149/149 automated tests, including DSH 0.2.0-rc.2's official V4 validator and real SQLite write contention. The GLM-5.2 20-turn figures above come from the navigation-upgrade run on 2026-09-09; this compatibility patch did not rerun that paid experiment.
- Structured extraction still depends on model contract compliance: the historical run succeeded 20/20 times. Contract failures stay quarantined; route/provider failures remain pending for explicit retry after configuration is corrected.
- Recall is bounded by configurable Top-K. Focused probes succeeded; one broad multi-topic query can require a larger Top-K or separate questions.
- The published run is an engineering workload, not a universal LoCoMo/LongMemEval score.
- The design, source-code map, and porting sequence for the summary + SPO navigation + exact-Q/A upgrade are documented in the Chinese upgrade guide.
Reproduce it from benchmarks/dsh-context-takeover/. Raw conversations, provider responses, local paths, and credentials are excluded.
Development
npm install
npm test
npm run build
npm run verify:package
MIT © 2026 adoresever · Asset and trademark notes
Links
More in this category
vectorize-io/hindsight#coding-agents★ 62937
Hindsight, agent memory that learns: long-term project memory with auto recall and retain, knowledge pages, deep reflection, and per-repo memory banks.
volcengine/OpenViking#examples/dsh-memory-plugin★ 42667
OpenViking memory and context bundle for DeepSeek Harness: pre-step auto-recall and profile injection, session capture, `viking://` URI guarding, and recall/write memory tools backed by an OpenViking server.
MemTensor/MemOS#memos-local-plugin★ 12491
Local-first memory plugin for DeepSeek Harness: layered L1/L2/L3 memory with automatic capture, manual memos_* retrieval tools, and a built-in memory viewer.
agentscope-ai/ReMe#dsh★ 3832
Connects DeepSeek Harness to ReMe's local-first, self-evolving personal knowledge base: automatically captures completed main-agent conversations as user-owned Markdown memory, searches conversations and source material through reme_search with BM25, optional embeddings, and wikilink expansion, and schedules daily memory consolidation.
zilliztech/memsearch#MemSearch★ 2930
Shared Markdown memory for DSH and other coding agents, with automatic capture, pre-step context injection, searchable recall, and memory-to-skill self-evolution through a review panel.
vshulcz/deja-vu#extensions/dsh★ 1658
Cross-session memory and context recovery across forty-five other coding agents (45+) on this machine, reading session files they already wrote before install (Claude Code, Codex, Cursor, Windsurf, Trae, Antigravity, VS Code Copilot Chat, opencode, OpenClaw, Hermes, Kimi, Qoder, Cline, Zed, Magpie and more): six tools (deja_recall, deja_session, deja_blame, deja_fix, deja_how, deja_remember), a /deja command, and optional automatic recall injected into runtime context. Local BM25 CLI/MCP index, no LLM, no embeddings, no network (dsh plugin --profile web add dsh-deja).
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.