JunNanLYS/dsh-layered-memory ↗★ 1
dsh-layered-memory
L0~L3 分层蒸馏记忆插件 for DeepSeek Harness:自动捕获对话(L0)、抽取原子记忆(L1)、整合场景块(L2)、蒸馏核心画像/团队方法论(L3),并在模型步骤前自动召回注入。移植自 MemoryCore (TencentDB Agent Memory) 的管线设计。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:JunNanLYS/dsh-layered-memory说明文档
阅读完整 README ↗配置
覆盖配置写在 profile 自己的 cordis.patch.yml,用顶层裸 patch 条目(直接 id:,
不要包在 insert: 里——insert 与 bundle 层同 id 追加会导致 duplicate loader entry id
启动失败):
- id: dsh-memory
name: dsh-layered-memory
config: # 键按行整体替换(不深合并),按需写全要保留的键
family: auto # 新会话默认档:auto | chat | work
llm: # 蒸馏模型路由(不写则跟随当前默认模型)
provider: ''
model: ''
| 字段 | 默认 | 说明 |
|---|---|---|
family | auto | 新会话默认记忆档位:auto(双族自动)| chat(个人)| work(工作);会话内可用输入栏控件临时切换 |
dataDir | $DSH_HOME/memory | 数据目录 |
capture.enabled | true | L0 捕获 |
capture.stripCodeBlocks | true | 助手消息剥离代码块 |
capture.maxMessageChars | 4000 | 单条消息最大字符数 |
extract.enabled | true | L1 抽取 |
extract.minMessages | 1 | 攒够 N 条新消息跑一次 L1 抽取 |
extract.backgroundMessages | 10 | 抽取时附带的背景消息条数 |
extract.candidatePool | 5 | 去重候选池大小 |
l2.enabled | true | L2 场景整合 |
l2.minNewMemories | 5 | 距上次 L2 整合的新记忆阈值 |
l2.maxScenes | 12 | 场景块数量上限 |
l2.sceneContextLimit | 3 | L2 prompt 附带的相似场景全文上限 |
l3.enabled | true | L3 画像蒸馏 |
l3.interval | 20 | L3 蒸馏间隔(新记忆条数) |
recall.enabled | true | 自动召回 |
recall.maxResults | 5 | 每步召回注入的 L1 条数 |
recall.strategy | hybrid | 检索策略:keyword / embedding / hybrid |
recall.scoreThreshold | 0.3 | 召回分数阈值(低于不注入;仅 keyword/embedding 策略生效,hybrid 融合前不过滤;工具路径不过滤) |
embedding.enabled | false | 向量检索开关;关闭即纯 FTS 运行 |
embedding.baseUrl | 空 | OpenAI 兼容 /embeddings 地址(如 https://api.siliconflow.cn/v1) |
embedding.apiKey | 空 | API Key |
embedding.model | 空 | embedding 模型名 |
embedding.dimensions | 0 | 向量维度(启用时必填,须与模型输出一致) |
llm.provider/model | 空 | 蒸馏模型覆盖(默认用当前默认选择) |
llm.maxTokens | 256000 | 单次蒸馏输出 token 上限(全阶段统一;推理模型的 reasoning 与正文共享该预算,过低会被思考吃光导致正文 0 字符) |
llm.reasoningEffort | off | 蒸馏思考档位(部署默认):off / high / max,空串不传(跟随模型默认)。蒸馏是结构化抽取任务,默认关思考——推理模型(如 v4-flash)默认 high 档的思考可把任意输出预算全部吃光导致正文 0 字符;非推理模型不认识 effort 时需设为空串。运行时可在设置页 → 记忆 → 概览临时切换(选"跟随配置"即回退本值) |
llm.temperature | 0.3 | 蒸馏温度 |
llm.maxInputChars | 700000 | 单次蒸馏输入字符预算(超限的 L1 输入自动分块抽取) |
tools | true | 是否注册模型可调用的记忆工具 |