dsh-memory-triage
Manifest valid★ 1Memory triage for DeepSeek Harness: at the end of each turn it decides which entries to keep and which to archive, routes project-specific ones into a project bucket while global ones stay in the main
dsh-memory-triage

DeepSeek Harness 记忆分诊插件:自动判断记忆保留 / 归档,并自动路由到项目桶或总体桶。
规则优先 + LLM 兜底。自动动作只做可恢复的归档,永不直接删除。
功能
- 每轮对话结束自动分诊(防抖 5s + 阈值触发:新增 3 条或 3000 字符)
- 全局条目(用户画像、沟通偏好、纪律等)留在总体记忆
- 项目条目(具体项目的状态与决策)自动迁入 project 桶
- 低价值条目(importance ≤ 2 且非全局豁免的 preference)归档
- 近义重复条目自动合并(标题 dice 相似度 ≥ 0.62 或内容包含),其余归档
- 规则拿不准的条目用 LLM 兜底判定(每批 ≤ 8 条,失败静默跳过)
- 镜像 Markdown 与 dsh-mneme 格式字节级兼容,人工编辑仍可合并回库
安装
插件文件放到 ~/.dsh/profiles/web/plugins/dsh-memory-triage,在
~/.dsh/profiles/web/cordis.patch.yml 挂载:
- insert:
- id: dsh-memory-triage
name: ./plugins/dsh-memory-triage/lib/index.js
config:
memoryDir: ~/.dsh/memory
enabled: true
debounceMs: 5000
triggerThresholdCount: 3
triggerThresholdChars: 3000
archiveLowImportance: true
llmFallback: true
llmBatchSize: 8
purgeDays: 30
purgeOnSchedule: false
重启宿主后生效。
命令
/triage-run—— 立即全库分诊/triage-purge—— 彻底删除归档超过purgeDays天(默认 30)的条目(仅限已归档)/triage-persona <人格名>—— 切换当前人格:带旧人格标签的记忆自动隐去、通用记忆保持可见;/triage-persona none清除标记恢复全部可见/triage-repersona <新人格名> [新人设描述]—— 继承重写:把当前人格的带标签记忆按新人设改写一份副本(原文保留)并切换
人格标签(persona tagging)
- 记忆条目可通过标签
persona:<名字>归属某个人格;无该标签的条目为通用记忆,所有人格可见 - 库中存有"当前人格"标记;注入、搜索、列表只显示"当前人格 + 通用"条目,其他人格的条目自动隐去
- 切换人格零 LLM 消耗、零删除;切换时插件会用 LLM 扫描未打标的偏好/决策条目,把人格专属的条目补上旧人格标签(失败静默跳过,不阻塞切换)
- 此过滤由 dsh-mneme 的本地补丁实现(inject/search/list 统一按当前人格过滤,实时生效无需重启)
配置
| 键 | 默认 | 说明 |
|---|---|---|
memoryDir | ~/.dsh/memory | dsh-mneme 记忆目录(共用同一 SQLite) |
enabled | true | 总开关 |
debounceMs | 5000 | 回合结束防抖 |
triggerThresholdCount | 3 | 触发阈值(新增条数) |
triggerThresholdChars | 3000 | 触发阈值(新增字符) |
archiveLowImportance | true | 低价值偏好自动归档 |
minDice | 0.62 | 合并相似度阈值 |
exemptKeywords | 内置清单 | 全局豁免词(命中保留总体记忆) |
projectKeywords | 内置清单 | 项目词(命中迁入 project 桶) |
llmFallback | true | LLM 兜底开关 |
llmBatchSize | 8 | 兜底每批条数 |
purgeDays | 30 | 归档超期天数 |
purgeOnSchedule | false | 分诊时自动清理超期归档(默认关) |
安全设计
- 自动分诊只做三类软操作:保留、迁移类型、归档(archived=1,可恢复)
- 真删仅发生在
/triage-purge或purgeOnSchedule: true,且只作用于已归档条目 - LLM 兜底失败 / 余额不足时静默跳过,绝不影响记忆写入
- 与 dsh-mneme 多连接共用 WAL,busy_timeout 8000ms 串行化写入
测试
node --test test/triage.test.mjs
14 个单元测试覆盖分类规则、去重合并、LLM 决策解析。
License
GPL-3.0
Versions
| Latest version | Published | Size |
|---|---|---|
| 0.1.0 | — | — |
Comments
Loading…
Similar plugins
Persistent memory for DeepSeek Harness with curated facts, automatic turn retention, and graph- and vector-ranked recall.
★ 0
↓ 59/wk
dsh plugin --profile web add @yushenghai/dsh-memory-pluginOn-demand memory for DeepSeek Harness: session logs are distilled into layered markdown (a summary, an index and per-topic files), and a mem_query tool returns only the matched entries rather than the
★ 0
dsh plugin --profile web add dsh-memory-liteby CuteSamurai24
Small file memory for DeepSeek Harness. The model writes markdown, the host injects it.
★ 0
MIT
JavaScript
Aug 18, 2026
dsh plugin --profile web add dsh-md-memoryby Missher12
Project-scoped local memory with review-before-recall, source references, reversible consolidation, and a portable Cordis service; the Harness adapter provides search and settings, with optional Brain
★ 0
MIT
TypeScript
Sep 14, 2026
dsh plugin --profile web add dsh-missher-memoryby yan5236
Two-phase long-term memory plugin for DeepSeek Harness (DSH): per-session extraction + global consolidation, always-injected summary, and memory_list/read/search/add tools.
★ 3
MIT
TypeScript
Aug 25, 2026
dsh plugin --profile web add @nanmicoder/dsh-memoryby guyuefangyuanl
Cross-session persistent memory for the DeepSeek Harness: a model-facing memory tool, an always-on index section, and a bundled maintenance skill.
★ 3
↓ 488/wk
MIT
JavaScript
Aug 21, 2026
dsh plugin --profile web add dsh-memory