dsh-unified-memory

DSH PLUGIN记忆与知识

仓库 mattcarvercom/dsh-unified-memory · npm dsh-unified-memory

记忆与知识 L5 · 运行验证通过 安全审查:低风险 可信度:金 可安装插件
安装这个插件

为 DeepSeek Harness 提供长期记忆的 DSH plugin,用本地 SQLite 全文索引按需检索记忆,只预载常驻规则,让每轮上下文开销几乎不随记忆增长。

验证等级 L5 L5 · 运行验证通过
GitHub 星标 2 复刻 0 · 未关闭 issue 0
最近更新 2026-09-29 创建于 2026-09-25
README 13.5 KB 正文体量,越大说明说明书写得越细

安装

可安装插件
在 DSH 里执行,装完用 dsh plugin list 确认已挂上;标了 L4 / L5 的命令已在沙盒里真实跑通
dsh plugin --profile web add github:mattcarvercom/dsh-unified-memory#v1.0.1
兼容 DSH 版本0.2.0-rc.2 等 3 个版本版本不匹配时安装会报错
Node.js 要求未标注来自仓库 package.json 的 engines 字段
前置依赖@deepseek-ai/dsh-tools@>=0.1.6-alpha.0、@deepseek-ai/schemastery@^3.18.0需要同时安装的同级依赖
npm 包名dsh-unified-memory可用 npm view 查看包信息

能做什么

5 项功能
字段来自项目仓库与公开索引,中文说明由本站标注

dsh-unified-memory:为 DeepSeek Harness 提供低开销的长期记忆

  • 本地 SQLite 全文索引按需检索
  • 三种模式:独立、叠加、共享
  • 记忆为 Claude Code 格式 markdown
  • 每个文件带来源标记可清理
  • 全程离线,数据不出本机

适用场景

记忆文件读写代码评审

上游标签

claude-codedeepseek-harnessdeepseek-harness-plugindshdsh-pluginmemory

验证等级与安全审查

L5 · 运行验证通过
自动化流程结论,不是人工审核
验证等级L5 · 运行验证通过在 dsh 沙盒中完成安装与运行冒烟——装得上、跑得起来
安全审查低风险静态分析结论,未标注不代表已通过审查
仓库健康度活跃按仓库活跃度与最近更新时间给出
可信度金综合仓库活跃度与验证结果

上面的结论来自上游最近一次自动化验证(2026-10-08): 同一套检查会在插件发新版后重跑,页面显示的是最新一次的逐项结果。

逐项检查结果

L1 · 已找到 ✓ 通过
  • L1.0_DEFAULTED_FROM_L3 由 L3 推定 默认通过——L3 安装规范已通过(全库 L3 扫描策略)
L2 · 结构化 ✓ 通过
  • L2.0_DEFAULTED_FROM_L3 由 L3 推定 默认通过——L3 安装规范已通过(全库 L3 扫描策略)
L3 · 安装规范 ✓ 通过
  • L3.1_INSTALL_COMMAND_PARSED 安装命令已解析 方式:安装规范解析
  • L3.2_DSH_VERSION_DECLARED DSH 版本已声明 方式:DSH 版本声明
L4 · 安装已测 ✓ 通过
  • L4.1_INSTALL_EXECUTED_CONFINED 受限沙盒内执行安装 方式:沙盒安装执行
  • L4.2_INSTALL_SUCCESS 沙盒安装成功 方式:沙盒安装执行
  • L4.3_ARTIFACT_CONFIRMED 安装产物已确认 方式:沙盒安装执行
L5 · 运行已测 ✓ 通过
  • L5.1_INSTALL_PASSED_SANDBOXED 沙盒安装通过 方式:沙盒安装执行
  • L5.2_WEB_BOOT_READY Web 启动就绪 方式:Web 启动
  • L5.3_HTTP_SERVED HTTP 服务响应 方式:HTTP 请求
  • L5.4_PLUGIN_INVENTORY_ACTIVE 插件清单中已激活 方式:插件清单查询

风险详情

  • 审查结论 通过
  • 结论说明 vet 静态分析未发现可疑行为,判定为干净(clean)。
  • 风险计数 严重 0 / 高 0 / 中 0
  • 风险详情 未发现严重或警告级问题。

仓库档案

记忆与知识
字段来自项目仓库与公开索引,中文说明由本站标注
作者 / 维护方mattcarvercom仓库 dsh-unified-memory · 默认分支 main
分类记忆与知识memory
收录类型可安装插件声明了 dsh.bundle、可用 dsh plugin add 安装的条目
开发语言JavaScript仓库主语言
许可证MIT商用或二次分发前请确认条款原文
星标 / 复刻 / issue2 / 0 / 0收录时的数值,非实时
创建 / 更新2026-09-25 · 2026-09-29最后推送 2026-09-29
本站收录2026-09-27首次进入本站目录的时间

README 全文

13.5 KB
作者原文,中文版优先;只做安全转义,不改内容

dsh-unified-memory

Long-term memory for DeepSeek Harness (dsh) that keeps the per-turn cost of memory small. Whatever a memory system puts in the system prompt takes up context on every turn, whether or not the task needs it, so memory tools that preload their whole index, Claude Code's MEMORY.md included, get more expensive with every memory they save. This plugin preloads only your standing feedback rules and finds everything else through a local SQLite full-text index when a task calls for it. On one store of about 150 memories, that is roughly 1.3k tokens per turn against about 15k with the whole index preloaded. The per-turn cost stays nearly flat as the store grows, and each memory costs context only in the turns that actually use it.

That matters most where context is scarce. A locally hosted model often runs with a context window of a few tens of thousands of tokens, and every token spent on memory it will not use comes out of the room left for code, tool output and reasoning, and is prefilled again on hardware that has none to spare. Long agentic runs feel the same pressure over hundreds of turns. A memory that grows without growing the prompt lets these setups remember as much as a large hosted deployment, without giving up the context they need to do the work.

Memories are plain markdown files in Claude Code's memory format. Run it as dsh's own private store, as a private store that also reads Claude Code's memories, or as one store shared with Claude Code so both agents read and write the same memories. Every file dsh creates says so in its frontmatter, which makes switching modes a mechanical migration and lets you remove everything dsh ever wrote with one command.

If you also use opencode, this fork of opencode-claude-memory shares the same Claude Code memory folders and keeps dsh's provenance intact: it edits frontmatter line by line instead of rewriting files, marks what it writes with origin: opencode, and keeps a copy of any dsh memory it deletes.

Modes

Mode dsh writes to dsh reads and searches Claude Code sees dsh's memories
dsh the dsh store (~/.dsh/memory) the dsh store no
overlay the dsh store the dsh store, plus Claude Code's memories (read-only) no
shared Claude Code's memory folder Claude Code's memory folder yes
  • shared suits one person using both agents on one machine: neither agent relearns what the other already knows.
  • overlay lets dsh benefit from Claude Code's memories without ever writing into them.
  • dsh keeps everything separate, and works without Claude Code installed.

Install

dsh plugin --profile web add github:mattcarvercom/dsh-unified-memory#v1.0.1

Restart dsh web afterwards. The plugin starts in dsh mode (its own store in ~/.dsh/memory); see Modes to share memories with Claude Code.

To work on the plugin itself, install from a checkout instead. dsh then loads it from outside the profile, so link the checkout's node_modules to the runtime's for its @deepseek-ai/* imports to resolve:

git clone https://github.com/mattcarvercom/dsh-unified-memory
ln -s ~/.dsh/profiles/node_modules dsh-unified-memory/node_modules
dsh plugin --profile web add ./dsh-unified-memory

Compatibility and permissions

dsh Tested with DeepSeek Harness 0.1.7-rc.1, web profile
Node Whatever dsh requires (22.19+ or 24+), which includes the built-in node:sqlite used for search; tested on Node 24
Claude Code Key and folder rules verified against Claude Code 2.1.282; only needed for overlay and shared modes
Platforms Linux and macOS tested paths; Windows paths follow the same key rule but are untested
Dependencies None beyond the dsh runtime (@deepseek-ai/dsh-tools, @deepseek-ai/schemastery)
Network None. Nothing leaves your machine
Files read The dsh store (~/.dsh/memory) and, in overlay and shared modes, ~/.claude/projects/*/memory
Files written The dsh store, plus Claude Code's memory folders in shared mode only; search indexes in ~/.cache/dsh-unified-memory
Processes Runs git rev-parse to find a session's repository root

Memories are plain text on disk. Do not store secrets in them; the injected prompt tells the agent the same.

Configure

Override the memory row in your profile's cordis.patch.yml. The override replaces the row's config wholesale, so restate every field you set.

- id: memory
config:
mode: shared
promptMode: full    # opt out of the default (feedback) and also preload MEMORY.md
Key Default Meaning
mode unset dsh, overlay or shared. Unset follows whatever mem mode last recorded
dshRoot $DSH_HOME/memory, else ~/.dsh/memory The dsh store
claudeRoot $CLAUDE_CONFIG_DIR or ~/.claude Claude Code's home
projectAliases {} Project key to canonical key, so several checkouts share one folder
promptMode feedback feedback injects only the standing feedback rules and relies on search; full also injects each folder's MEMORY.md and a file list
includeInPrompt true Inject the memory section into the system prompt
maxIndexLines / maxIndexBytes 200 / 25000 How much of MEMORY.md is injected in full mode
maxList 200 Default cap for the list action, and on files listed in the prompt in full mode
searchLimit 5 Default hits returned by search
indexDir $XDG_CACHE_HOME/dsh-unified-memory Search index cache
minResyncIntervalMs 60000 Minimum time between automatic rescans of a folder for search; dsh's own writes reindex immediately

Setting mode never moves files. The files on disk are in the mode recorded in /state.json. When the configured mode differs, the plugin stays readable but refuses writes and tells the agent to have you run mem mode.

A fresh install adopts the configured mode (or dsh) on first use, since there is nothing to migrate.

Changing modes: mem mode

mem mode                        # print the current mode
mem mode shared --dry-run       # show exactly what would move
mem mode shared                 # back up, migrate, rebuild search indexes
From To What moves
dsh overlay nothing
overlay dsh nothing
dsh or overlay shared dsh's memories move into Claude Code's folders, with their MEMORY.md lines
shared overlay memories dsh created move out to the dsh store
shared dsh as above, plus copies of Claude Code's memories, so dsh keeps what it knew; --clean skips the copies

Details that keep this safe:

  • Backups. Every migration first copies the dsh store and each Claude Code memory folder to /backups//. Only the memory folders are copied, never Claude Code's session transcripts.
  • Name collisions. An incoming file whose name is taken is renamed with a -dsh (or -claude) suffix, and the dry run shows it.
  • Edits stay with the file. A Claude Code memory that dsh edited stays in Claude Code's folder when you leave shared mode.
  • Returning to shared with copies. An unchanged copy is dropped, because the original is already there. A copy dsh edited is a conflict: rerun with --prefer dsh (dsh's version replaces the original's body and description) or --prefer claude. A copy whose original you deleted is dropped unless you pass --restore-deleted.

Provenance and removal

Files dsh creates carry provenance under metadata::

---
name: deploy-notes
description: How myapp deploys
metadata:
type: project
origin: dsh
originSessionId: session-7c1e4b2a-9d3f-4a6b-8e5c-2f1a0b9c8d7e
modified: 2026-09-24T18:02:11.000Z
---
Field Meaning
origin Who created the file. Absent means Claude Code in Claude Code's folders, and dsh in the dsh store
originSessionId The dsh session that created it (Claude Code writes the same field for its own files)
updatedBy Added when dsh edits a file it did not create; origin never changes
copiedFrom, copiedAt On copies taken when leaving shared mode
mem list --origin dsh           # everything dsh created
mem list --updated-by dsh       # Claude Code memories dsh edited
mem purge --origin dsh --dry-run
mem purge --origin dsh          # back up, then delete dsh's files and their index lines

Purge never removes files dsh only edited; it lists them. When dsh deletes a memory it did not create, a copy goes to /trash/.

How files are written

  • Claude Code's format. A memory is a markdown file with YAML frontmatter; each folder has a MEMORY.md index with one - [Title](file.md) — hook line per memory.
  • Edits change only what they set. Updating a file rewrites just the frontmatter lines being changed; unknown fields, lists and comments are kept byte for byte. A file that keeps type: at the top level keeps it there.
  • Index edits re-read MEMORY.md first. Claude Code takes no lock, so the plugin reads the index immediately before each change to keep a concurrent edit from being lost.
  • Types: user, feedback, project, reference.

Which folder a session uses

Claude Code keys memory by the git repository root of the directory it was launched from (a worktree maps to its main checkout), or the directory itself outside a repository. The key replaces every non-alphanumeric character with -, so /home/me/dev becomes -home-me-dev; keys over 200 characters are cut and given a hash suffix.

dsh sessions often start deeper than where Claude Code was launched, so the plugin walks from the session's root up to the nearest ancestor that already has a memory folder on either side, stopping at your home directory. Without a match, the root's own key is used. projectAliases apply before the walk.

Search

memory action=search and mem search use a SQLite FTS5 index (built into Node's node:sqlite, no native dependency) with Porter stemming and bm25 ranking, name and description weighted above the body. The markdown files are the only source of truth: the index lives in indexDir, is updated incrementally, and can be deleted at any time.

With the default promptMode: feedback, only the standing feedback rules are preloaded (about 1k tokens for a hundred memories) and the agent searches for everything else per task. promptMode: full also preloads each MEMORY.md and a file list, which saves a search call per task at the cost of a prompt that grows with the store; before 1.0.1 it was the default.

The agent's tool

The memory tool offers add, update, delete, search, list and read. add refuses a memory whose name or description closely matches an existing one and lists the matches, so the agent updates one of them instead; force: true saves anyway. The model decides when to save; the injected prompt tells it what is worth keeping.

mem reference

mem status [--cwd DIR]
mem search  [-n N] [-o OFFSET] [-t TYPE] [--cwd DIR] [--json]
mem list [--origin dsh|claude] [--updated-by dsh] [--json]
mem mode [dsh|overlay|shared] [--dry-run] [--clean] [--prefer dsh|claude] [--restore-deleted]
mem purge --origin dsh [--dry-run]
mem move-legacy [--cwd DIR] [--dry-run]
mem reindex [--rebuild]

Common options: --dsh-root, --claude-root, and --alias RAW=KEY (repeatable). $DSH_MEMORY_ROOT (else $DSH_HOME/memory) and $CLAUDE_CONFIG_DIR set the defaults.

Upgrading from deepseek-harness-memory 0.1

  • The memoryRoot, scope and importClaudeMemory settings are gone (still accepted, and ignored with a warning). Use mode, dshRoot and claudeRoot.
  • An existing dsh store is treated as dsh mode. Run mem mode to move to another mode.
  • User-level memories at the top of the old store (~/.dsh/memory/*.md) stay readable but read-only; mem move-legacy --cwd folds them into a project.
  • The import-claude tool action is gone: overlay mode reads Claude Code's memories in place, and mem mode dsh from shared takes copies.
  • The search cache moved from ~/.cache/deepseek-harness-memory to ~/.cache/dsh-unified-memory; the old folder can be deleted.

Format contract for other tools

Anything else that reads or writes a folder shared with dsh-unified-memory and Claude Code should:

  1. Keep one .md file per memory, with YAML frontmatter holding at least name and description, and a type either as top-level type: or as metadata.type.
  2. Keep one - [Title](file.md) — hook line per memory in MEMORY.md, change only its own lines, and re-read the file immediately before writing it.
  3. Preserve every frontmatter field it does not understand.
  4. Mark files it creates with metadata.origin: and files it edits with metadata.updatedBy:, never changing another tool's origin.
  5. Write through a temporary file and rename it into place.

Development

ln -s ~/.dsh/profiles/node_modules node_modules   # runtime imports, for the plugin tests
npm test

Credits

dsh-unified-memory began as a fork of deepseek-harness-memory by jzc (MIT). Its frontmatter parsing and a few storage helpers still derive from that work; the storage modes, provenance tracking, migrations, full-text search, Claude Code key resolution, and the mem CLI are new.

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
dsh-unified-memory 怎么安装?

在 DSH 里执行 `dsh plugin --profile web add github:mattcarvercom/dsh-unified-memory#v1.0.1` 即可。对应的 npm 包名是 `dsh-unified-memory`。

dsh-unified-memory 的验证等级是什么意思?

L5 · 运行验证通过。在 dsh 沙盒中完成安装与运行冒烟——装得上、跑得起来

dsh-unified-memory 安全吗?

低风险。vet 静态分析未发现可疑行为,判定为干净(clean)。

dsh-unified-memory 支持哪些 DSH 版本?

上游记录的兼容版本包括 0.2.0-rc.2、0.2.0-rc.1、0.1.7-rc.2。

dsh-unified-memory 需要什么运行环境?

需要同时安装 @deepseek-ai/dsh-tools@>=0.1.6-alpha.0、@deepseek-ai/schemastery@^3.18.0。环境不满足时安装会失败,建议先确认本机版本。

dsh-unified-memory 用的是什么许可证?

上游标注为 MIT。商用或二次分发前请到仓库确认许可证原文。

dsh-unified-memory 有哪些功能?

本地 SQLite 全文索引按需检索、三种模式:独立、叠加、共享、记忆为 Claude Code 格式 markdown、每个文件带来源标记可清理、全程离线,数据不出本机。

这条记录的数据可靠吗?

本站按仓库名去重后合并整理,字段以作者仓库与 npm 元数据为准;安装命令、仓库地址与 README 保持原文,带 L4 / L5 标记的安装命令已在隔离沙盒里真实跑通。

记忆与知识
按星标排序,可作替代方案

ruflo

ruflo

L3 · 安装规范通过 7.4 万 星

OpenViking

OpenViking

面向 DeepSeek Harness 的 OpenViking 记忆与上下文插件:pre-step 自动召回与画像注入、会话捕获、`vik

L3 · 安装规范通过 3.9 万 星

WeKnora

WeKnora

把 WeKnora 知识库接入 dsh 的四个只读工具:列出知识库、混合检索原文片段、按顺序还原单篇文档,以及直接取用 WeKnora 自己

L4 · 沙盒安装通过 3.3 万 星

distilly

distilly

Distilly — Distill how they think into reusable Skills for any Agent o

L4 · 沙盒安装通过 2.5 万 星

EverOS

EverOS

L4 · 沙盒安装通过 1.3 万 星

MemOS

MemOS

L4 · 沙盒安装通过 1.2 万 星

mattcarvercom 的其它插件

1 个

插件的元信息来自作者仓库;分类、验证等级与安全结论的中文说明为中文整理,最近核验 2026-10-08。