dsh-recall-rebuild
linkpain/dsh-recall-rebuild
Ricostruisce frammenti in ricordi contestuali/emotivi via LLM prima dell’iniezione. Archivio sola lettura, più fonti, isolamento IM per utente, consolidamento nel sonno, audit JSONL.
Installazione
dsh plugin --profile web add github:linkpain/dsh-recall-rebuildREADME
dsh-recall-rebuild
重建式回忆增强插件(DeepSeek Harness):增强现有记忆插件,让"回忆"从"念档案"变成"想起来了"。 Enhancer for DSH memory plugins: recall that feels like remembering, not quoting a file.
dsh-prime-memory 等现有 DSH 记忆插件已经把存储层做得非常扎实——跨会话捕获、蒸馏、持久化都很成熟,值得先装它们。本插件不做重复的事,只在一个环节上做增强:回忆的呈现方式——把检索到的记忆碎片交给 LLM 重建为带语境与情绪的回忆片段再注入,让"想起来了"更自然,而不是"念档案"。
痛点:回忆不应该是"念档案"
传统记忆插件(录音式):检索 → 把原文/摘要塞进上下文。
用户:我今天心情不太好。 助手(传统):根据我的记录,你喜欢喝冰美式咖啡、养了一只叫煤球的猫、上周去过成都出差。你怎么了?
本插件(重建式回忆):检索 → LLM 按当前对话现场重建 → 注入一段"回忆"。
用户:我今天心情不太好。 助手(本插件):记得你养了只叫煤球的黑猫,平时它一蹭你你就笑;上周你还说靠冰美式续命。今天是不顺心了吗?
同一份记忆,前者是"读档案",后者是"想起来了"。对桌宠、虚拟角色、陪伴型助手来说,这决定了它像机器还是像活人。
特性
- 只读增强,零污染:以
readOnly打开现有记忆库($DSH_HOME/memory/memory.db),不重写捕获管线、不写任何数据,装/卸都不影响原插件; - 多记忆源可插拔:
source支持 dsh-prime-memory(SQLite FTS5)、@max-null/dsh-memory(JSON 记忆库)与 dsh-memory-palace(Markdown 文件)三种底层记忆,auto自动探测,后续可继续扩展; - IM 用户级命名空间隔离:QQ/微信 多人共用角色时,自动解析桥接插件注入的
<dsh_im_source>sender 信息,把记忆按用户隔离——「用户 A 的记忆」不会注入给「用户 B」;同一人多会话记忆共享;隔离索引写在插件自己的目录,仍不碰底层记忆库; - 生成式重建:在
agent/pre-step用会话末尾消息召回碎片,LLM 重建为带语境/情绪/时间感的回忆片段,替代生硬原文注入; - 与生态共存不错位:注入消息
source.kind='plugin:recall-rebuild',不会被 prime-memory 当作新用户消息再次捕获/蒸馏;replace策略原位替换对方的原文召回,append策略追加,不重复注入; - 永不阻塞对话:无记忆库/无模型路由/超时/重建失败,一律静默跳过本轮;
- 重建质量可观测:每轮在
~/.dsh/recall-rebuild/logs/recall-YYYY-MM-DD.log写一条 JSONL 审计日志,「原始检索碎片 ↔ 重建后片段」同屏对比 + 注入方式/耗时/跳过原因,附带stats.json统计——零额外注入、零 token 成本,自己判断重建效果; - 睡眠巩固 + 联想扩散(长期记忆子系统):空闲时把累积的碎片「聚类 → LLM 抽象为稳定记忆 → 联想图扩散 → 低频遗忘降权」,巩固层条目在召回时优先注入、命中越用越稳、强关联主题顺带想起——更接近人脑的「夜间回放迁移到新皮层」;产出只存本插件目录,底层记忆库保持只读;
- 巩固层交互命令:
/recall-rebuild list | now | edit <id> <内容> | forget <id>——像管理自己的记忆一样查看长期记忆、立即触发一次巩固、修正记错的、主动忘掉不想留的(操作遵循同一套用户隔离视图); - 中文召回不再"整句一个词元":内置分词把查询切成「拉丁词 ∪ 中文二元组」,并在 FTS5 严格 AND 之外补四条召回通道(宽松 OR、LIKE 覆盖度、单字覆盖、字符 n-gram 语义),多路结果先 RRF 融合再做语义精排——中文记忆 recall@5 从 0% 提到 70.0%(附可复跑的评测脚本,见下);
- 时效衰减:排序分数按
priority × max(0.5, 0.5^(天数/30))衰减,半衰期 30 天、下限 0.5——刚说的事优先于半年前的旧账,但旧记忆不会被彻底压死; - 跨轮不重复念叨:同一 agent 在 30 分钟内注入过的记忆会被降到候选末尾(不是删除,本轮只有它时仍会注入),避免连续几轮反复提同一件事;
- 零部署硬件成本:不买显卡、不租 GPU,重建调用走宿主已有的 LLM 路由,每轮只消耗百级 token;
- 零额外运行时依赖:用 Node 22+ 内置
node:sqlite读库,安装即用。
适合谁
- DSH 桌宠 / 虚拟角色 / 陪伴型 AI 玩家——想要"像人一样记着你",而不是"查到你的档案";
- 已把角色接入 QQ / 微信 等 IM 的 DSH 用户——角色同时服务多个人的私聊/群聊时,希望每个用户的记忆互不串味,同一人跨会话记忆共享;
- 觉得现有记忆插件"注入的原文太生硬、像在念记录"的开发者与用户。
安装
前置:
- DeepSeek Harness
0.1.0-rc.2 … 0.2.1-rc.3; - Node ≥ 22.5(需要内置
node:sqlite); - 已安装并运行过
dsh-prime-memory(0.26.x,SQLite 记忆库)、dsh-memory(@max-null,JSON 记忆库)或dsh-memory-palace(Markdown 记忆文件),且已有记忆数据。
dsh plugin --profile <你的配置文件名> add dsh-recall-rebuild
安装后无需手动改 profile 的 cordis.patch.yml(包内组合层自动插入插件行)。
如需覆盖配置,在 profile 的 cordis.patch.yml 写顶层裸 patch(同 id 再 insert 会报 duplicate loader entry,按行整体替换、不深合并):
- id: recall-rebuild
name: dsh-recall-rebuild
config:
enabled: true
rebuild:
maxResults: 5
maxOutputChars: 600
timeoutMs: 8000
inject:
strategy: replace # replace = 替换 prime-memory 的原文注入; append = 追加
工作原理
flowchart LR
U["IM 用户新消息<br/>(带 <dsh_im_source> sender)"] --> P["agent/pre-step<br/>(本插件 prepend)"]
P --> K["提取当前用户键<br/>(senderId / chatId)"]
P --> Q["构造召回查询<br/>(会话末尾消息)"]
Q --> S[("记忆库<br/>prime(SQLite)/ dsh-memory(JSON)/ palace(Markdown)")]
S --> F["用户命名空间过滤<br/>(auto/strict/off)"]
S -. "碎片累积(pending)" .-> C["睡眠巩固(空闲异步)<br/>聚类 → LLM 抽象 → 联想 → 遗忘"]
C --> C2[("巩固层<br/>~/.dsh/recall-rebuild/consolidated")]
C2 -. "active 条目 + 联想扩散" .-> F
F --> R["LLM 重建式回忆<br/>(碎片 → 带语境的回忆片段)"]
R --> I["注入回忆片段<br/>source.kind = plugin:recall-rebuild"]
F --> N[("归属索引<br/>~/.dsh/recall-rebuild/namespaces")]
F -. 命中候选归属当前用户 .-> N
P --> M["模型推理"]
I --> M
M --> A["回复"]
R -. "失败/超时 → 静默跳过" .-> M
一句话流程:提取用户 → 检索 → 用户隔离过滤 → 合并巩固层 → 重建 → 注入,而不是检索 → 注入;碎片在空闲时「睡眠巩固」沉淀为稳定记忆,下次召回优先想起。
与现有插件的错开与共存
- 注入消息
source.kind用 v4 语义plugin:recall-rebuild,与 prime-memory 的plugin:memory互不干扰;capture 侧只收source.kind==='user',天然不被二次捕获。 strategy=replace时只替换本轮已存在的原文召回消息;没有则退化为追加,不重复注入。
配置项
| 键 | 默认 | 说明 |
|---|---|---|
enabled | true | 总开关 |
dataDir | '' | 记忆库目录;空 = $DSH_HOME/memory |
source | auto | 记忆来源:auto 自动探测(prime → dsh-memory → palace);prime = dsh-prime-memory SQLite 库;dsh-memory = @max-null/dsh-memory JSON 记忆库;palace = dsh-memory-palace Markdown 文件 |
rebuild.enabled | true | 重建式回忆开关;false 退化为原文检索注入 |
rebuild.maxResults | 5 | 每轮检索条数 |
rebuild.maxMemoryChars | 400 | 单条记忆进重建 prompt 的字符上限 |
rebuild.maxTotalChars | 2000 | 重建 prompt 记忆总量上限 |
rebuild.maxOutputChars | 600 | 重建片段输出上限 |
rebuild.temperature | 0.7 | 重建调用温度 |
rebuild.maxTokens | 1024 | 重建调用输出 token 上限 |
rebuild.timeoutMs | 8000 | 重建总超时;超时跳过本轮 |
inject.strategy | replace | replace = 原位替换 prime-memory 的原文召回;append = 追加 |
inject.maxChars | 1200 | 注入正文单条上限 |
inject.includeSources | true | 注入时附记忆来源 id 标注 |
query.tailMessages | 8 | 召回查询取会话末尾消息条数 |
query.maxChars | 1200 | 召回查询字符上限 |
user.isolation | auto | IM 用户隔离模式:auto 剔除「明确属于其他用户」的记忆(无主记忆默认可见,命中后归位);strict 只注入「已归属当前用户」的记忆(新用户零记忆起步);off 不过滤。桌面直接对话自动不隔离 |
user.isolationDir | '' | 归属索引目录;空 = <DSH_HOME>/recall-rebuild/namespaces |
user.sourceTagPattern | '' | 覆盖内置 <dsh_im_source> 解析正则;不同桥接插件字段不同时可自定义(需含一个捕获组取用户 id) |
observability.logEnabled | true | 每轮重建审计日志开关(JSON Lines,按天滚动) |
observability.logDir | '' | 日志目录;空 = <DSH_HOME>/recall-rebuild/logs |
observability.includeFragments | true | 日志是否记录原始检索碎片(与重建片段同屏对比);false 只记重建结果 |
observability.statsEnabled | true | 是否写统计文件 stats.json(30s 节流) |
consolidate.enabled | true | 睡眠巩固总开关 |
consolidate.dir | '' | 巩固层目录;空 = <DSH_HOME>/recall-rebuild/consolidated |
consolidate.minFragments | 20 | 待巩固碎片累积多少条触发一次巩固 |
consolidate.minIntervalMs | 21600000 | 距上次巩固最短间隔(6h) |
consolidate.checkIntervalMs | 3600000 | 定时检查间隔(1h) |
consolidate.maxFragmentsPerRun | 50 | 单次巩固最多处理碎片数 |
consolidate.clusterThreshold | 0.25 | 聚类相似度阈值(同主题碎片 ≥ 阈值归为一簇) |
consolidate.maxCluster | 8 | 单簇最多碎片数 |
consolidate.maxOutputChars | 400 | 单条巩固输出字符上限 |
consolidate.temperature | 0.4 | 巩固调用温度(低于重建,求稳) |
consolidate.maxTokens | 1024 | 巩固调用输出 token 上限 |
consolidate.timeoutMs | 20000 | 单簇巩固超时(离线任务可放宽) |
consolidate.confidenceThreshold | 0.4 | 遗忘阈值:置信度低于它且长期未命中 → dormant(召回降权) |
consolidate.dormantDays | 30 | 多少天未命中(且低置信)进入 dormant |
commands.enabled | true | 巩固层交互命令总开关 |
commands.name | recall-rebuild | 注册的命令名(不含前导 /);与其它插件冲突时改名 |
长期记忆子系统:睡眠巩固与联想扩散
类比人脑:底层记忆插件 = 海马体(即时捕获碎片),本插件的巩固层 = 新皮层(把碎片沉淀为稳定记忆)。这层只存在本插件自己的目录(~/.dsh/recall-rebuild/consolidated/),底层记忆库始终保持只读。
一次巩固(空闲异步,不阻塞对话)做什么:
- 累积:每轮检索命中的碎片进入
pending.json(去重、限量); - 聚类:纯本地按 2-gram 相似度把同主题碎片分簇(无需 LLM、零成本);
- LLM 抽象:每簇交给宿主 LLM,提炼为 1-3 条稳定的长期记忆(
stable-fact / pattern / preference / relationship / mood),忽略一次性噪音; - 联想扩散:本轮产出的条目两两建立关联边(
links.json权重累加)——召回命中一条时,强关联主题顺带想起; - 遗忘(只读侧):低置信 + 30 天未命中的条目进入
dormant(召回降权,不删除、不写底层库); - 越用越稳:每次命中
touchCount+1,高置信条目优先注入。
触发:启动后空闲 10s 查一次,之后每 checkIntervalMs 查一次;pending 达标且距上次巩固超 minIntervalMs 才真正执行;失败保留 pending 下次再试。
加固了这一层的定位:它不替代底层记忆插件,也不重复存储——底层负责「记住」,巩固层负责「把记住的东西变成稳定的自己」。
管理长期记忆(命令)
像管理自己的记忆一样管理巩固层(命令在支持 / 命令的 DSH 界面输入;宿主没有命令服务时自动跳过,不影响插件主体):
| 命令 | 作用 |
|---|---|
/recall-rebuild list [--all] | 查看长期记忆:类型 / 置信度 / 命中次数 / 更新时间;dormant(已降权)单独标出。默认只显示当前用户的记忆 + 共享记忆,--all 查看全部(含其它 IM 用户) |
/recall-rebuild now | 立即触发一次睡眠巩固(绕过最短间隔;pending 为空时提示) |
/recall-rebuild edit <id> <新内容> | 修正一条记忆的内容(人也会记错、改口) |
/recall-rebuild forget <id> | 主动删除一条记忆及其联想边(与被动遗忘不同,这是显式操作,不写底层库) |
/recall-rebuild help | 显示用法 |
命令的可见范围与召回隔离是同一套规则:当前会话能识别 IM 用户时,只能查看/修改「该用户 + 无主共享」的记忆;桌面会话(识别不到用户)或 --all 时不受限。命令名冲突时用 commands.name 改名。
观测:怎么判断重建是否真的更好
每轮运行后,打开日志目录(~/.dsh/recall-rebuild/logs/):
recall-YYYY-MM-DD.log:每轮一行 JSON,同一轮里fragments(原始检索碎片)与rebuilt(重建后片段)并排——直接对比同一份记忆的两种呈现,自己判断哪种更"像人";stats.json:累计轮数 / 命中轮 / 重建成功 / 注入 / 替换数,看重建的覆盖面和替换率。
字段速览:round 轮次、userKey 当前 IM 用户、hitCount 命中数、memoryIds 依据记忆 id、fragments 原始碎片、rebuilt 重建片段、injection 注入方式(replaced 替换了对方原文召回 / appended 追加 / none 未注入)、latencyMs 耗时、error 跳过原因。
想运行时真·对比(同一轮同时看到原文召回与重建片段),把
inject.strategy设为append;想零成本对比,看日志即可。
检索质量(为什么值得单独讲一节)
底层记忆库里中文占绝大多数,而 SQLite FTS5 的 unicode61 分词器把一整句中文当成一个词元。原来的查询构造直接用句子里切出的 token 拼 AND,于是「用户说他最近特别喜欢吃火锅」这条记忆,用「火锅」「吃火锅」「深夜」去查全部 0 命中——记忆存进去了,但永远召不回来。
修法不是换分词器(trigram 对 2 字词同样失效),而是在应用层把查询切开:
- 分词:拉丁词(过滤停用词)+ 中文二元组(过滤高频虚词二元组)取并集;
- 五路召回:① 严格 FTS(AND,精度最高,权重 1)② 宽松 FTS(OR,扩召回,0.8)③ LIKE 覆盖度打分(整词兜底,1)④ 单字覆盖(unicode61 下唯一能救换说法的通道,0.6)⑤ 字符 n-gram 语义余弦(跨同义改写,0.7);
- RRF 融合(Reciprocal Rank Fusion,
k=60):按「各路名次」而不是「各路分数」合并——分数不可比,名次可比; - 语义精排:对融合后的头部候选再算一次「RRF 名次分 + 0.8 × 余弦」。只加通道不加精排,语义通道捞回来的同义改写会被字面通道的顺序稀释掉(实测 65.0% → 精排后 70.0%)。
第 ⑤ 路值得单独解释:DSH 的 LLM 服务不提供 embedding 接口,引入本地嵌入模型又会破坏"零运行时依赖"这条铁律。折中方案是把字符 n-gram 频次当向量维度做余弦相似度(拉丁词权重 1、中文二元组 1、中文单字 0.4)——它不是语义模型,但足以把「女朋友 / 对象」「医生 / 值夜班」这类同义改写捞回来,零依赖、毫秒级、可离线复现。真正的语义模型仍是 Roadmap 里的事。
配套评测脚本 scripts/eval-recall.mjs 用 40 条中文记忆 + 换说法查询(不是原文子串)跑 before/after:
| 实现 | recall@5 | MRR@5 | 未命中 |
|---|---|---|---|
| 旧分词(整句一个词元) | 0.0% | 0.000 | 40/40 |
| 新分词(拉丁词 + 中文二元组) | 47.5% | 0.412 | 21/40 |
| + 宽松 OR 通道 | 47.5% | 0.412 | 21/40 |
| + 单字覆盖通道 | 62.5% | 0.533 | 15/40 |
| + 语义通道(不精排) | 65.0% | 0.596 | 14/40 |
| + 语义精排(当前) | 70.0% | 0.615 | 12/40 |
剩下 12 条属零字面重叠(如「我这个配置跑得动 Docker 吗」对「MacBook Pro 14 寸 M2 Pro 芯片」)或需要真实语义理解(「我室友白天在家睡觉」对「夜班护士」)。字符 n-gram 已经是零依赖方案的极限,再往上必须上嵌入模型——那会破坏"零额外依赖",如实标注在 Roadmap 与局限里。
Roadmap
- 更多记忆源 adapter(
dsh-memory-vault、dsh-auto-memory、dsh-memory-gate等变体); - IM 用户级命名空间隔离(跨 QQ/微信的同一人记忆共享)—— v0.1.3 已实现;
- 重建质量可观测(每轮 JSONL 日志 + stats)—— v0.1.4 已实现;
- 睡眠巩固 / 联想扩散(长期记忆子系统:聚类 → LLM 抽象 → 联想 → 遗忘)—— v0.1.5 已实现;
- 巩固层交互命令(list / now / edit / forget,管理长期记忆)—— v0.1.6 已实现;
- 中文检索修复(二元组分词 + 五路 RRF 融合,recall@5 0% → 70.0%)—— v0.1.7/v0.1.8 已实现;
- 时效衰减(半衰期 30 天)+ 跨轮去重(30 分钟窗口)—— v0.1.7 已实现;
- 遗忘真正生效(修掉
confidenceThreshold恒不触发的死代码)+ 命中落盘批量化(原来每条记忆一次全量重写)—— v0.1.7 已实现; - CI(typecheck + 运行时验证 + 召回评测闸门,Node 22/24 矩阵)—— v0.1.7 已实现;
- 语义召回通道(字符 n-gram 余弦 + 精排,零依赖解决同义改写漏召,62.5% → 70.0%)—— v0.1.8 已实现;
- 真·嵌入向量通道(需要引入嵌入模型或宿主提供 embedding 接口,暂不破坏零依赖);
- 记忆的增改删写入流水线(ADD/UPDATE/DELETE 判定),欢迎提 issue。
局限(如实声明)
- 只增强召回/呈现层:底层库捕获了什么,重建就基于什么;库缺字段(如没有情绪标注)时,重建不会凭空造出它。
- 用户隔离是观察式启发式,非底层强隔离:底层记忆库(prime 等)没有 IM 用户字段,本插件靠「谁在会话中命中过这条记忆,它就归谁」建立归属。因此:
auto模式防得住「已明确归属他人」的记忆,防不住「从未被命中过的无主记忆」(它们默认可见,命中后归位);strict模式从零记忆起步,聊过的话题才开始归位。需要强隐私隔离且不介意冷启动时用strict。 - 用户识别依赖桥接插件约定:优先解析
<dsh_im_source>JSON(senderId/chatId/threadId/botId),兜底常见字段(senderId/userId/openid/fromUser);不同桥接字段不同时用user.sourceTagPattern覆盖。识别不到用户(桌面会话)时不做隔离。 - 幻觉受控但非零:重建 prompt 明确禁止编造碎片外事实,但 LLM 仍有漂移概率;注入标注记忆依据 id 便于审计。需要强事实的场景可关掉重建(
rebuild.enabled=false)。 - token 消耗:每轮召回命中即产生一次重建调用(通常百级 token),由宿主模型路由计费;巩固只在空闲且碎片达标时发生,每次几十~几百 token。
- 日志零成本但非自动诊断:日志只记录事实(碎片/重建/耗时/跳过原因),不做好坏判定;用户可对比判断,或切换
inject.strategy=append运行时对比。 - 巩固层是启发式蒸馏,非底层改写:聚类基于 2-gram 相似度(可能把近义不同词的两条碎片分到不同簇);LLM 抽象有轻幻觉风险(已在 prompt 禁止编造);dormant 只是召回降权,不会删底层库、也不会在本插件内物理删除。
- 未覆盖:LoRA 权重内化等权重级记忆不在本插件范围(见 Roadmap)。
- 交互命令依赖宿主命令服务:支持
/命令的界面(桌面/Web UI)都有;无命令服务的组合(如 headless)下命令静默不注册,插件其余功能不受影响。
开发与验证
npm install
npm run typecheck # tsc --noEmit
npm run build # 编译到 dist/
npm test # build + scripts/verify.mjs(140 条运行时断言)
npm run test:eval # 中文召回评测,recall@5 低于 0.65 直接失败
npm run test:all # 两者串跑(CI 跑的就是这套)
npm pack --dry-run # 检查发布包内容
scripts/verify.mjs 覆盖:导出与 Config 默认值、sanitizeFts、FTS 命中与 LIKE 兜底、palace(Markdown)与 dsh-memory(JSON)适配器、命名空间隔离、可观测日志、巩固层聚类/遗忘、命令解析、时效衰减、RRF 融合与排序、跨轮去重、字符 n-gram 语义通道与精排。它 import 的是 dist/,所以必须先 build。
评测闸门可用环境变量放宽/收紧:EVAL_MIN_RECALL=0.7 npm run test:eval(默认 0.65,当前实测 70.0%)。
License
MIT
English Overview
dsh-recall-rebuild is an enhancer for memory plugins in DeepSeek Harness (DSH). Existing memory plugins such as dsh-prime-memory (SQLite), @max-null/dsh-memory (JSON) or dsh-memory-palace (Markdown) already handle storage very well — cross-session capture, distillation and persistence are mature, so install one first. This plugin does not duplicate that work; it enhances a single layer: how memories are recalled — instead of injecting raw snippets as-is, it has the LLM reconstruct them into contextual recollections, so "remembering" feels natural rather than like quoting a file.
This plugin upgrades the recall/presentation layer:
- Opens the existing memory store (
$DSH_HOME/memory/memory.db) read-only, never writes, never touches the capture pipeline; - Before every model step, it retrieves memory fragments and asks the LLM to reconstruct them into contextual, emotionally-toned recollection snippets (using only in-fragment facts — no fabrication);
- Per-user memory isolation for IM (QQ/WeChat…): it parses the
<dsh_im_source>block that IM bridge plugins attach to messages, extractssenderId/chatId, and keeps each user's memories out of other users' recalls via an ownership index it maintains in its own directory (<DSH_HOME>/recall-rebuild/namespaces) — the underlying memory DB is still never written. Modes:auto(drop memories clearly owned by others; ownerless memories are conservatively visible until claimed),strict(only inject memories already owned by the current user),off(no filtering). Desktop chats with no detectable user are never filtered; - Injects via
agent/pre-stepwithsource.kind='plugin:recall-rebuild', so it is never re-captured by the underlying memory plugin;replacestrategy swaps out the other plugin's raw-text recall in place,appendadds alongside; - Never blocks a conversation: missing store, missing model route, timeout or rebuild failure all silently skip the step;
- Observable rebuild quality: every round appends one JSONL audit line to
~/.dsh/recall-rebuild/logs/recall-YYYY-MM-DD.log— raw fragments vs rebuilt snippet side by side, injection mode / latency / skip reason, plus a throttledstats.json— zero extra injection, zero token cost, so you can judge for yourself whether rebuilding beats raw recall; - Sleep consolidation + associative spreading (long-term memory layer): while idle, accumulated fragments are clustered (local 2-gram similarity), LLM-distilled into stable memories (
stable-fact/pattern/preference/relationship/mood), linked in a spreading-activation graph, and low-confidence long-unused entries decay todormant(recall down-weighting, never deleted, never written to the base store). Consolidated entries are recalled first, get more stable the more they are hit, and strong links make related topics surface too — closer to how the brain consolidates daytime experience overnight. Everything lives under<DSH_HOME>/recall-rebuild/consolidated/; - Manage your long-term memories with slash commands:
/recall-rebuild list [--all](view consolidated memories with type/confidence/hit count),now(trigger a consolidation immediately),edit <id> <text>(fix a misremembered entry) andforget <id>(explicitly delete an entry and its links). The command view follows the same per-user isolation rules; it silently skips registration when the host has no command service; - Zero infra cost: no GPU/VM — rebuild calls go through the host's existing LLM routing, ~hundreds of tokens per hit; uses only Node's built-in
node:sqlite.
Who it's for: DSH desktop-pet / virtual-character / companion users who want the bot to "remember like a person" rather than "quote a file", including characters bridged to QQ/WeChat.
Install (after dsh-prime-memory):
dsh plugin --profile <your-profile> add dsh-recall-rebuild