dsh-lite-memory
让东坡肉滚出系统提示:记忆不常驻,命中只给标题,正文读了才进上下文,项目规范还能自己长。
安装
dsh plugin --profile web add dsh-lite-memory
沙箱测试结果
| 阶段 | 结果 |
|---|---|
| 1 安装 | ✓ |
| 2 列装 | ✓ |
| 3 挂载 | — |
| 4 启动 | — |
四阶段在隔离沙箱里跑:安装(有网)→ 列装 → 挂载 → 启动(后三步断网)。
README
dsh-lite-memory
全库不常驻:没有命中的轮次不追加记忆内容,命中时最多三条卡片,正文按需读。
Nothing resident: a turn that misses adds no memory text; a hit adds at most three cards, bodies read on demand.
它是什么 / What it is
给 DeepSeek Harness 的轻量记忆:全库不进常驻提示、不逐轮注入、不扫描文件。记忆只在两种时刻出现——你说「记一下」,或者这句话跟已有条目真有关(最多三条卡片:标题、摘要、前提,正文仍按需读)。
Lightweight memory for the DeepSeek Harness. Nothing resident: no standing prompt, no per-turn injection, no file scanning. Memory appears at exactly two moments: you ask it to remember, or the message genuinely overlaps an existing entry (at most three cards with title, summary and preconditions; bodies are read on demand).
触发方式 / Triggers
场景 · 行为
L0 你明确要求「记住这个」 · 立即写盘,一条确认行
L1 它发现有跨会话价值的经验 · 一行灰字 memory · suggested "X" + 一个「保留」按钮;标题加一句话,看得懂才点,不点就永远不写,48 小时内不重复
L2 常识、一次性参数、凭据的值 · 永不写入
这些行只属于产生它的那一轮:每轮按那轮自己的工具结果重建,重进会话还能看见,别的轮不会混进来。再记一次时插件自己判是更新还是新增:同一层里标题(或这条用过的旧标题)完全一致就更新原条目,前置条件不同也更新这一条,不并存两条同名;换过说法而标题变了的旧标题记成别名以后也认得。像但不同名的不写:先在结果里回「相近:X」,确认要更新就用那个标题重存,确认是另一条才加 resolution="distinct"——另存要换个能区分的标题。更新时没给的字段保持原值,正文整段替换——旧正文只作内部撤回依据,不展示、不参与检索。旧数据里已经分叉的同名条目,下一次写入这一层时自动收并成一条,另一条进可恢复归档。读取时标题只记得一半(到逗号或括号为止)也认得:唯一一条前缀对得上就直接读,对得上两条就把候选标题列出来,不猜;同名前缀的归档副本不算第二条候选,活条目优先。
写入时分两层:默认只在这个项目生效;用户说「以后所有项目都这样」才进全局层(200 条起提示,硬上限 1000 条),检索时一起查。同一主题在不同前提下用 when 区分,各存一条。
写入前先蒸馏:标题是结论,正文只留原则、判断规则和触发条件,不把具体尺寸、字号、层级、颜色或一次性数字记进来;需要这些值时按记忆里的指针查当前代码或文档。单条正文超过 4096 字节会被拒绝,先删细节再存;摘要超长自动截到 60 字。
触发词:记住、记一下、上次、规范、约定、路径、凭据怎么取。
真命中看这句话和记忆的标题(含旧标题)、标签、触发词、摘要有没有对得上的词:有就多一行「已有记忆可能相关」,最多三条标题,每条前面标归属([global] 或项目目录名如 [DSH]);没对上就不出现,不改命中计数,正文要 memory_read 才读。一条记忆写了触发词,用户说到那个词也算命中。
普通记忆卡片和实验规则共用一份额度:一次最多 3 条、1200 字节,按整条准入,先到先占;自动提示只带标题和摘要,不带正文。实验短规则(正文不超过 240 字且不超过 4 行)直接带正文,更长的只给标题和用途,正文仍要 memory_read。
Case · Behaviour
L0 you ask it to remember · written immediately, one confirmation line
L1 it spots something worth keeping · one muted line memory · suggested "X" · sug_x with a single 「保留」 button — readable before you click, nothing written unless you click, at most once per two days
L2 common sense, one-off parameters, credential values · never written
The automatic hint carries titles and summaries, never bodies. Normal cards and experimental rules share one budget: at most 3 cards / 1200 bytes per request, admitted as whole cards, first come first served. An experimental rule with a body of at most 240 characters and 4 lines is inlined; a longer one gives only its title and purpose, and the body still requires memory_read.
Those lines belong to the turn that made them: each turn is rebuilt from its own tool results, so reopening the session shows them again and no other turn leaks in. Saving again updates an entry whenever the title (or one of its earlier titles) matches exactly inside the same layer — different preconditions still update that one entry, never a second entry with the same title. A merely similar title writes nothing first: the result names the closest entry, so the caller either re-saves with that title or adds resolution="distinct", which requires a genuinely different title. An update keeps every field it was not given and replaces the body wholesale; the previous body is kept only for internal undo and never shown or searched. Legacy duplicate titles already on disk fold into one row on the next write to that layer, and the extra row moves to recoverable archive.
Writes land in one of two layers: the current project by default, or the global layer (warns past 200, hard ceiling 1000) when the user says the rule holds for every project. Both layers are searched together, and a when field separates the same subject under different preconditions.
Before writing, distill: the title is the conclusion and the body keeps only the principle, decision rule and trigger condition. Concrete dimensions, font sizes, z-index, colors and one-off numbers stay out; the memory points at where to read the current value instead. A body over 4096 bytes is refused, so drop detail before saving; an over-long summary is truncated to 60 characters.
点一下就存 / One click, no turn
「保留」是同源直写:不产生消息、不动输入框、不打断当前回复。点完按钮消失,行变成 memory · kept。真写过的行尾才有 ✕,按标题撤销:改过的条目还原成上一版(显示 restored),刚建的条目移入归档(显示 archived);条目后来又改过就停下并说明已经变过,不覆盖后来的修改。没变、需要确认、保存失败的行没有撤销。
The 「保留」 button writes straight to disk from the page: no message, no extra model turn, the input box untouched. It disappears and the row becomes memory · kept — that is the whole interaction. Only a row that really changed gets the ✕, and it undoes by title: an edited entry goes back to its previous body (restored), a freshly created one moves to the archive (archived); if the entry changed again it stops and says so instead of overwriting. Noop, needs-confirmation and failed saves get no undo.
每轮引用条 / Per-turn references
每次回复末尾、在「已编辑 N 个文件」下面,按这一轮实际发生的工具结果留几行:本轮参考 N 条 和 本轮更新 N 条。点开是记忆名,再点一条就地展开当前正文;名字和正文都取当前值——改过名显示新名字,归档的标「已归档」,删掉的显示「已删除」。同一轮同一条只出现一次;没读过也没写过就整段不出现。切换会话不丢,每轮只按自己的工具结果重建。
Each completed turn keeps a few lines under 「已编辑 N 个文件」, built from that turn's own tool results: 本轮参考 N 条 and 本轮更新 N 条. A line expands to memory names, a name expands to the body as it is now — current title, current body, archived marked, deleted said outright. One row per entry per turn; nothing read or written, nothing shown. Switching conversations keeps them, because each turn is rebuilt from its own tool results only.
记忆面板 / Memory panel
会话头的大脑图标打开居中的记忆面板。浮层挂到 document.body 上,尺寸按视口算,宿主容器的高度和定位不影响它;点遮罩或右上角关闭。面板自带错误边界:万一渲染出错,浮层里直接显示原因而不是整个面板消失。内容分「记忆」「自进化」「设置」三个页签:前两页只放内容,开关和调参都在「设置」里,不占列表和宫殿的位置。「设置」里是「启用记忆」「自进化」「记住我」三个开关、「启用图谱」「启用记忆宫殿」两个只影响展示的开关(默认关闭,按项目记住)和排序调参;回执与召回提示只在有话说时占面板底部一行。默认看当前项目,也可以切到其他项目或全局层;切过去只读,不回写、不迁移旧格式。
「记忆」页签里,搜索框右侧可以在「列表」「图谱」「宫殿」之间切换;列表、图谱或宫殿占满内容宽度,选中记忆后右侧才出现正文与归属。当前项目里点「修改」可以就地改标题和正文,保存后版本加一;别的项目和全局层只读。图谱按真实数据画,点记忆节点读正文,点标签或主题节点转成搜索,右上角可缩放。宫殿按类型分四间:习惯与规范、方法与经验、资料与入口、其他记录;一次只展开一间,每间每页 24 条,点展品只读正文。宫殿只决
…(truncated)
以上内容来自 npm 上的 README,我们只做格式化,不改内容。
版本
npm 上共发布:73,最后更新 2026-11-04