把 Engramory 策展式记忆纪律做成可安装插件([npm: dsh-engramory](https://www.npmjs.com/package/dsh-engramory)):通过 `ctx.tools.guard()` 对 `MEMORY.md` 索引施加确定性的 200 行 / 25KB 上限(增长即拒、缩小的重写一律放行),并把协议注册为运行时 skill。记忆库是纯 markdown、一条事实一个文件,与 Claude Code、Codex、Kiro、OpenClaw 共用。
安装
# npm 包(预构建)
dsh plugin --profile web add dsh-engramory
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:tinqiao-oss/engramory#path:/adapters/dsh/plugin
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本。请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
Curated, file-based long-term memory for DeepSeek Harness — plain markdown notes you can open with anything, one store shared across every host you use, and an index cap that is a real refusal rather than a request. (If the store lives inside a project's git repo it must be git-ignored — memories carry machine-local detail; see SKILL.md §1. A dedicated private repo for the store itself is fine.)
Part of Engramory.
Why a plugin, when an AGENTS.md block already works
The block does carry the discipline, and for recall that is enough. Two things it cannot do:
The cap becomes deterministic. Engramory keeps its index under 200 lines / 25 KB
because the index loads every session and everything past the cap silently stops being
recalled. On most hosts that limit is rules plus a checker the agent has to remember to
run. dsh exposes ctx.tools.guard() — a synchronous, monotonic refusal: once a guard
returns a reason, no later listener can turn it back into an allow. So here the limit is
enforced, not requested — once the plugin is actually installed and running; a
profile install currently fails upstream (see "Known limits"), and until then the cap on
dsh is still rules plus the checker. Outside Claude Code, dsh is the first host with the
shim actually written (a few others expose equivalent pre-write seams — see PORTING.md —
but have no shim yet).
The protocol arrives with the plugin. ctx.skills.register() contributes the skill at
runtime, so it does not depend on landing files in one of the five skill roots dsh scans —
a path that is easy to get subtly wrong and fails silently when you do.
Install
dsh plugin --profile <name> add dsh-engramory
That is the whole install. The package ships a dsh.bundle manifest pointing at its own
cordis.patch.yml, so the row is inserted into the profile's plugin tree for you — no
hand-editing. To change a default, patch the EXISTING row by id in your profile's own
patch layer — do not use a second - insert: (insert always appends, so you would
end up with two engramory rows and the original caps still enforced):
- id: engramory
config:
indexName: MEMORY.md
maxLines: 200
maxBytes: 25600
A patch replaces the targeted row's whole config, so list every key you mean to keep.
For the store itself and the always-on block, use the installer in the Engramory repo
(python tools/engramory_init.py dsh --install-skill). This plugin enforces the cap and
supplies the protocol; it does not create the store.
Configuration
| Field | Default | Meaning |
|---|---|---|
indexName |
MEMORY.md |
Basename treated as the memory index (case-insensitive; both file_path and str_replace_editor's path are checked). An empty or non-string value falls back to the default. Nothing else is inspected. |
maxLines |
200 |
Hard line cap. Non-positive or non-finite values fall back to the default. |
maxBytes |
25600 |
Hard UTF-8 byte cap (25 KB). |
registerSkill |
true |
Set false to keep the cap but skip the runtime skill. |
skill |
built-in | Replace the skill body with your own markdown. |
What the guard actually does
| Call | Decision |
|---|---|
write (or str_replace_editor create) ending within caps |
allow |
write/create that GROWS the index past a cap |
deny, naming the numbers and what to compact |
write/create that SHRINKS or keeps an over-cap index |
allow — incremental compaction (210 → 205 → 198) must stay possible |
Edit carrying old_str/new_str: result simulated |
judged by the RESULT, same grow/shrink rule as a write |
Unsimulable partial (e.g. insert) on an over-cap index |
deny, telling the agent a shrinking whole-file write passes |
| Unsimulable partial on a healthy index | allow |
read, view, or any unknown tool |
allow — recall must never be blocked, even over cap |
| Any write to any other file | allow — not the guard's business |
| Missing/unreadable current index on a whole-file write | treated as EMPTY (mirrors the Python guard) — a within-caps write passes, an over-cap first write is refused |
| Missing/unreadable index on a partial edit | allow — a guard must never block work over a path it cannot read |
| Malformed execution (no arguments, non-string path/content) | allow — not recognisably a write |
The deny rule mirrors hooks/engramory_index_guard.py exactly: refuse only a result
that is over a cap AND grew past the current file. The line count ignores a trailing
newline, so an index sitting exactly at the cap stays writable.
Known limits
- An unsimulable partial that crosses the cap from under it is not caught.
insertand friends do not carry the resulting text. The breach is caught by the next whole-file write, or byengramory_check.py. What is guaranteed: an already-over index cannot be grown further, and a shrinking write always passes. - The tool roster follows dsh's documented tool-fs contract (
write/editwithfile_path,str_replace_editorwithpath) and is deliberately conservative: unknown tools pass. Until the plugin runs inside a real profile this mapping is documentation-verified only. - Not yet verified end to end inside dsh. The guard's decision table is covered by
node --test(21 cases, run in Engramory's CI), and the wiring for the AGENTS.md block and skill discovery was dogfooded against a livedeepseek-v4-flashsession. But installing a third-party plugin into a profile currently fails on dsh 0.1.0-rc.6:dsh pluginshells out topnpm(not bundled), and a directpnpm addthen dies onERR_PNPM_FETCH_404for@deepseek-ai/dsh-type-meta, a package the published tree depends on but which is not on the registry. That is a preview-packaging problem upstream, not a plugin defect; this note goes away once a profile install resolves. - dsh is a developer preview and its plugin API can change. This plugin deliberately
touches only
ctx.tools.guard()andctx.skills.register()so it stays cheap to fix.
License
MIT — see the Engramory repository.
链接
同类插件
volcengine/OpenViking#examples/dsh-memory-plugin★ 28525
面向 DeepSeek Harness 的 OpenViking 记忆与上下文插件:pre-step 自动召回与画像注入、会话捕获、`viking://` URI 防护,以及对接 OpenViking 服务端的 recall/write 记忆工具。
vectorize-io/hindsight#coding-agents★ 20019
Hindsight:会学习的 Agent 长期记忆系统,自动召回/保存、知识页、深度反思与按仓库隔离的记忆银行。
omdsh-dev/dsh-mnemon★ 40
由 Mnemon 驱动的 DeepSeek Harness(DSH)跨 Agent、本地优先的持久记忆插件。它可在支持 Mnemon 的 Agent 之间共享长期记忆,并提供运行时记忆、可检索项目档案、语义召回、知识图谱和 Sidebar UI。
LoserFox/distill★ 19
自动对话蒸馏:后台 subagent 反省 + 技能 create/update。
Tyan66666/billion-context-dsh★ 16
模型驱动的上下文压缩(Active Context Pruning):由模型决定何时压缩、压缩什么。
Aik358/dsh-auto-memory★ 15
DSH 自动记忆插件:三层记忆自动注入与检索、每轮对话自动沉淀、AI 时段问候与三级抽屉、智能检索、日历视图与设置页,支持继承其他 AI 工具的记忆。