前言¶
在 DSH 里接 dsh-mnemon 做项目文档检索时,Documents Source 的行为更像一次性快照:导入后不会感知知识库里的新增、修改或删除。你在 Obsidian、Logseq 里改过的笔记,不会自动反映到 mnemon 的文档索引里;删掉的源文件,存储里的副本也会一直留着。社区维护者 Idhanker 的 dsh-mnemon-sync-monitor(分类:记忆)用文件监视与防抖合并,把本地 Markdown 目录与 mnemon 的 Project Documents 对齐,并可选地把变更蒸馏进 Memory Spaces。下面介绍它的定位、能力与配置方式。
这是什么¶
dsh-mnemon-sync-monitor 是 DeepSeek Harness 插件,仓库 Idlehanker/dsh-mnemon-sync-monitor,当前 package 版本 0.2.0,MIT 许可证,要求 Node >= 22。
一句话定位:Real-time file watcher that keeps dsh-mnemon Project Documents in sync with local Markdown knowledge bases。
README 对 dsh-mnemon 0.5.39 的实测说明:Documents Source 没有 fs.watch / chokidar 一类监视;index.json 是唯一真相源,也不会重扫目录。本插件补的是「源目录变了,存储跟着变」这一环。
核心功能¶
文档层同步¶
监视配置里的 roots(绝对路径目录),在防抖窗口内合并变更后,在 Documents 索引锁下原子应用:
| 源侧变化 | 插件动作 |
|---|---|
| 新文件 | 创建 document |
| 内容 hash 变化 | 原地更新,revision + 1 |
| 文件删除 | 仅在 prune: true 时归档 document |
| 未变化 | 跳过 |
启动时会对每个 root 做一次全量 reconcile,之后跟随文件系统变化。可选 dryRun: true 只检测并打日志,不写存储。
变更检测策略¶
有 git 的 root 优先用相对上次记录 commit 的 diff;非 git 目录用 mtime 高水位扫描。Git 是优化路径,不是硬性前提。
可选:蒸馏到 Memory Spaces¶
Documents 层是词面匹配(含中文二元组),换说法提问可能搜不到刚写的笔记。Memory Spaces 走向量召回,但 dsh-mnemon 自带的 idleReview 工具表里没有 mnemon_remember 等写入路径。插件可在笔记变更后,通过配置的模型命令把结论写入 Memory Spaces。
蒸馏有独立主开关 distill.enabled、防抖 distill.debounceMs、每轮文件数与每文件 insight 上限等字段;distill.command 从 stdin 读 {"messages":[...]},stdout 输出 completion 文本,以短生命周期子进程调用,凭证与重试留在 Host 外。
设置页与 Host API¶
插件 bundle 带 Client:Settings → 知识库同步,列出每个监视 root 的路径、是否存在、Markdown 数量;可增删 root、立即 Rescan、开关蒸馏、选蒸馏模型。增删 root 与蒸馏开关无需重启 DSH;改 root 会写回 profile 的 cordis.patch.yml,且 README 说明只替换 roots: 序列,其余行(含注释)按字节保留。
Host 路由前缀 /mnemon-sync-monitor,例如 GET /mnemon-sync-monitor/state、POST /mnemon-sync-monitor/roots、POST /mnemon-sync-monitor/rescan 等;模型列表与主 Composer 输入框下方共用 ctx.llm 注册表,身份编码为 JSON.stringify([provider, model])。
安装与启用¶
安装命令来自 README,需本地已有插件目录路径(不要用未在资料中出现的 github:owner/repo 形式):
dsh plugin --profile <name> add /path/to/dsh-mnemon-sync-monitor
在对应 profile 的 cordis.patch.yml 中配置监视目录,例如:
- id: mnemon-sync-monitor
name: dsh-mnemon-sync-monitor
config:
enabled: true
roots:
- C:\Users\me\Obsidian\vault
- C:\Users\me\Logseq\pages
debounceMs: 800
minBytes: 200
保存后重启 DSH。插件会在启动时对每个 root reconcile 一次,再持续监视变更。
典型配置¶
常用字段¶
| 字段 | 默认 | 含义 |
|---|---|---|
enabled |
true |
总开关 |
roots |
[] |
监视的绝对目录;空则等效禁用 |
storeDirectory |
~/.mnemon/documents |
写入的 Documents 存储路径 |
debounceMs |
800 |
静默窗口后再 reconcile |
minBytes |
200 |
小于此大小的文件忽略(Logseq 空页常小于 200 B) |
prune |
false |
源文件消失时是否归档存储记录 |
dryRun |
false |
只检测日志,不写 |
limitBytes |
33554432 |
活跃容量上限(32 MiB) |
开启蒸馏示例¶
- id: mnemon-sync-monitor
name: dsh-mnemon-sync-monitor
config:
enabled: true
roots:
- C:\Users\me\vault
distill:
enabled: true
automatic: true
debounceMs: 30000
maxFilesPerRun: 10
maxInsightsPerFile: 4
command: 'node C:\path\to\distill-gateway.mjs'
distillModel: '["workbuddy","hy4free"]'
未设置 distillModel 时表示跟随设置页默认;设为 null 可清除固定模型。
适用场景与注意¶
适合已经在 DSH 里使用 dsh-mnemon、且项目文档来自 Obsidian / Logseq 等本地 Markdown 目录的开发者:希望改笔记后检索层能跟上,而不是重新手动导入快照。
几点事实性限制来自 README:prune: false 时删除源文件不会自动清存储;蒸馏依赖你配置的 command 与模型,不是开箱即用的云端调用;插件 deliberately 不 inject: ['llm'],无 LLM 服务时监视与 root 管理仍可用,模型列表为空。
DSH 生态是「一切皆插件」;SkillHub 目录页 是社区站点,与 DeepSeek / 幻方无官方从属关系。
安全与权限:插件以当前 DSH 进程权限读写你配置的 roots 与 storeDirectory,并可能执行 distill.command。安装前请阅读仓库源码与 MIT 许可证,确认路径与 shell 命令符合你的环境策略。
结尾¶
dsh-mnemon-sync-monitor 解决的是 mnemon Documents 快照与本地知识库脱节的问题:监视、防抖、按 hash 更新,并可选择把变更蒸馏进 Memory Spaces。进一步了解与 issue 见 GitHub 仓库,目录介绍见 SkillHub 插件页。