dsh-memory
Manifest validDSH Cross-Session Semantic Memory Plugin: Zhipu embedding-3 + SQLite, providing memory_add / memory_search semantic recall; configuration is optional and it never crashes due to a missing key, database, or service.
dsh-memory
Cross-session semantic memory for DeepSeek Harness — installed into any profile, so your agent actually remembers you across sessions.
🌐 English · 简体中文
dsh-memory registers three tools for the web / headless profiles, so your agent can remember you across sessions:
memory_add— persist a fact worth keeping long-term, auto-vectorized on the way in.memory_search— recall relevant facts by semantics (cosine similarity), with a keyword fallback.memory_update— correct or retire an existing memory (supersede/retract/restore/verify/edit/set/link); the superseded entry stays traceable instead of being deleted./mem <question>— type this in the composer and the agent will callmemory_searchfirst (results render as a collapsible tool card), then answer from memory.
Under the hood: Zhipu embedding-3 (2048-dim) + SQLite (node:sqlite) + cosine similarity. Zero new infrastructure — no vector database, no sidecar containers. Hundreds to thousands of memories recall in milliseconds.
Why
Your agent forgets everything between sessions. dsh-memory gives it a durable, semantic recall layer without adding a new service to run. It solves the "who am I / what did we agree on" problem with a few hundred bytes of SQLite and one HTTP call per write.
Features
- Zero-config, never crashes — a missing Zhipu key, a missing database, a missing
toolsservice, or a failing embedding call all degrade gracefully. This plugin will never take the DSH tree down (see Design guarantee). - Semantic recall with keyword fallback —
memory_searchscores by embedding cosine similarity first, then weights keyword hits; when embeddings are unavailable it falls back to pure keyword (bigram) matching. - 8s embedding timeout — on a bad or missing network it fails fast and falls back to keyword search instead of hanging the session.
- Correction chain, not silent merging — when a fact changes, pass
replacestomemory_add: the old entry is stampedsuperseded+superseded_byand kept for traceability (it drops out of default search), while the search that would have returned it now surfaces the corrected conclusion — even when that conclusion only ranks 12th. Writing still runs one cosine pass over the library first, but it reports near-duplicates as a hint (replaced) and never silently merges two different facts. - Annotate, never filter —
scope, date and status are shown as information; they are never used as hard filters, and relevance is reported as high/medium/low instead of a threshold deciding "nothing found" (measured: genuine and absent answers overlap completely in cosine similarity). Entries over 800 chars are truncated by default, with the full length shown;full: truereturns the whole thing. - SQLite WAL + busy_timeout=5000 — applied when the DB opens; concurrent writers (e.g. DSH web + the Jarvis brain sharing one library) no longer hit
SQLITE_BUSY.
Design notes, the measured evidence behind each choice, and the assumptions that were disproved by data (so nobody re-walks them) live in LIFECYCLE.md.
Installation
This plugin follows the official DSH bundle convention (dsh.bundle in package.json), so dsh plugin recognizes it and activates it as a configuration layer — not a plain dependency.
Install into the target profile (e.g. web):
dsh plugin --profile web add dsh-memory
After installing, restart DSH web for it to take effect (the bundle layer is only composed at startup):
systemctl restart dsh # or restart however you run DSH
Local / pre-release install:
# Put this directory into the profile's node_modules and append "dsh-memory"
# to dsh.profile.bundles in package.json, then restart.
Configuration
Everything is optional — skip it all and the plugin still works (falling back to keyword search):
| Config | Description | Default |
|---|---|---|
enabled | false disables tool registration | true |
semantic | false skips embeddings, keyword-only | true |
memoryDbPath | SQLite database path | ~/.dsh-memory/memories.db |
zhipuEnvPath | Path to the Zhipu credentials .env file | ~/.dsh-memory/.memenv |
forceMemoryWords | Force-memory signal words (array). When any word appears in a user message, the agent must call memory_add first, then answer | [] (disabled by default) |
forceMemoryWords example (set in your profile's cordis.patch.yml, not in the public repo):
- id: dsh-memory
config:
forceMemoryWords:
- 记住
- 重要
- 珍贵
- 特别
- 务必
- 一定
- 必须
Zhipu credentials are read from environment variables first, then from the file at zhipuEnvPath:
ZHIPU_API_KEY=your-zhipu-key
ZHIPU_BASE_URL=https://open.bigmodel.cn/api/paas/v4/
Get a Zhipu key for free at open.bigmodel.cn (embedding-3 is billed per use).
Design guarantee
This plugin was born from a real incident: a misconfigured plugin sent a DSH web profile into a crash-loop. So dsh-memory is deliberately defensive:
apply()is wrapped in an overalltry/catch— no error is ever thrown up into the DSH tree.injectonly declarestools(a servicedsh-basealways provides). It does not depend ondsh-llm,agents, orhttp.- A missing key / database / service, or a failed embedding call → it logs and degrades, never interrupting startup.
- Errors raised inside a tool's
execute()are caught and returned as ordinary results, never bubbling up into a session exception.
Tools
memory_add— write a fact worth remembering; vectorized automatically.memory_search— semantically recall the most relevant facts for a question.memory_update— supersede / retract / restore / verify / edit / set / link an existing memory (superseded entries stay traceable)./mem— a manual override: "search memory first, then answer." If you're not sure the agent will recall on its own, type/mem <question>and it will run a semantic search, inject the results, and answer from them.
Storage schema
memories(id, text, category, source, created_at, updated_at,
status, kind, kind_source, scope, scope_source, superseded_by, last_verified_at)
memory_embeddings(memory_id, dim, vector) -- 2048-dim JSON array
memory_links(a, b, relation, created_at) -- links between related-but-different entries
memory_meta(key, value) -- schema_version
License
Comments
Loading…
Similar plugins
by 1304836815
DSH 会话级记忆插件:收尾提醒 + MEMORY.md 记忆索引维护 + 实时对话日志 + LLM 摘要压缩,配置面板在 设置→插件。Session memory for DeepSeek Harness.
★ 0
MIT
JavaScript
Aug 21, 2026
dsh plugin --profile web add @dsh-external/dsh-auto-memoryby fuyu-technology
DeepSeek Harness 插件:设置页里的「记忆与知识库」——会话短期记忆、长期记忆、知识库,支持多选归档与关键词按需召回。
★ 0
Apache-2.0
JavaScript
Nov 14, 2026
dsh plugin --profile web add dsh-memory-uiby SiriusWJ
DSH 简化版记忆插件:SQLite 条目化记忆(标题/重要程度/来源/内容,增删改查)+ 日历与到点提醒(月视图+时间轴+待执行/已完成双tab),对话面板记忆 tab 与设置二级菜单,中英双语自动跟随。
★ 2
BSD-3-Clause
JavaScript
Nov 11, 2026
dsh plugin --profile web add dsh-lite-memoryby wall1234567
DSH 长期记忆插件:上下文超过阈值时把最早的一段对话归档到 memory/ 回忆文件夹,之后按关键词与重要度概率自动回忆。Host-only, zero-dependency memory engine for DeepSeek Harness.
★ 17
↓ 1.4k/wk
MIT
JavaScript
Nov 15, 2026
dsh plugin --profile web add dsh-rofmby xs1023
DSH 外置记忆库插件(修复分支)— SQLite 长期记忆、分层压缩、搜索与归档
★ 0
MIT
JavaScript
Oct 4, 2026
dsh plugin --profile web add dsh-memory-vaultby leinian114514
DSH 自托管记忆插件:四层 SQLite(核心/项目/分支/细节,每层带分类)+ 中文优先的 BM25(拼音与首字母容错)+ 三条注入路径 + 10 个工具。零运行时依赖
★ 0
JavaScript
Nov 16, 2026
dsh plugin --profile web add dsh-memory-nian