@yolk_vat-y/dsh-project-memory 0.6.10 → 0.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ ## 0.6.12 (2026-11-09)
2
+
3
+ **兼容**:无新增配置键,无 store 格式变更,`client/` 产物不变;直接覆盖升级即可。
4
+
5
+ - **内部重构**:`isRecord`、ISO 时间比较与消息取文本收敛到 `src/util/value.js` / `src/util/text.js`;12 个工具共用 `TEXT_OUTPUT` 与项目上下文初始化。
6
+ - **切 kind 的字段清理**统一到 `src/util/insight-fields.js`,`save_lesson` 与面板编辑共用同一判据。
7
+ - **时间戳只接受非空字符串**:缺失、非法或非字符串一律按 0 处理(此前数字会走 `Date.parse`)。
8
+
9
+ ## 0.6.11 (2026-11-06)
10
+ **兼容**:`format.json` 仅在成功从旧版 store 迁移时多一个可选的 `migratedFrom: 'legacy'` 标记(旧版本读到会忽略);无新增配置键,无破坏性 store 变更。
11
+
12
+ ### 修复(2026-11-05 审计)
13
+
14
+ - **旧版 store 迁移不再删库**:`entries.json` 有数据、`index.json` 缺失/无 `files` 时,`load()` 保护性跳过后 `save()` 不再补写 `format.json`;成功迁移的标记带 `migratedFrom: 'legacy'`,没有标记的旧 `format.json` 也不会触发清理。
15
+ - **锁回收失败不再同步忙等**:stale 分支补 deadline 与 10ms 等待;只读目录 / Windows 持续占用下 `acquireDirLock()` 按 `timeoutMs` 返回 `null`,不再挂死 `save()` / 退出 flush。
16
+ - **懒索引的 L2 增强不再被覆盖**:`onFileObserved()` 移到 `commitFileUpdates()` 之后(与 `index_repo` / watch 同序);单文件读取后 `enhanced: true` 与类型符号都能落盘。
17
+ - **`global.json` 缺失/不可读不再清空整库**:读不到磁盘文档时保留内存副本重写,不再把“空 doc”当成对端删光。
18
+ - **experience 迁移保留并发写入**:锁内重读的 `insights.json` 作为合并基线,不再用等锁前的快照整份覆盖。
19
+ - **`reinjectItemsAfter` 恢复生效**:条目级冷却到期时绕过块级指纹去重,历史被外部裁剪后能按配置重发。
20
+ - **动作识别覆盖包装器与 npm 前置 flag**:`sudo -E rm`、`nice -n 10 npm publish`、`time -p`、`stdbuf -oL`、`npm --registry/--access/--otp … publish`、`(rm …)` / `{ …; }` / `if …; then …` 都归一成正确 op。
21
+ - **流式检索按词边界计 TF**:`cat` 不再命中 `concatenate`,与 token 化 IDF 同源。
22
+ - **面板删除同步清 `vectors.json`**(与 `forget` 一致);`watch_repo` 回报的 interval 与真实定时器一致(0/负数 clamp 成 1s)。
23
+ - **git 与非 git 扫描口径统一**:深度边界与 `DEFAULT_IGNORE` 只作用于目录段,`git init` 前后语料一致。
24
+ - **增强队列按 store 身份去重**:多项目同名文件不再互相顶掉。
25
+ - **畸形 `task.steps` / `fileMeta` 归一**:不会让绑定会话的整条注入与任务列表一起抛错。
26
+ - **面板记忆列表在 `root` / 绑定任务变化后重取**;编辑 procedure 不再把合成摘要写进 `body`。
27
+ - **空提交不再创建空 store**;`save_lesson` 改 `kind` 时清掉旧 kind 专属字段;`truncate()` 的缺省上限与 `timeAgo()` 的非法时间不再输出 `undefined` / `NaN天前`。
28
+
29
+ **工具描述统一为英文**:12 个工具的描述与参数说明此前中英混排,现全部英文,并写明记忆过时/记错时带 `id` 就地更新。
30
+
31
+ ### 适配 dsh 0.2.2-rc.1
32
+
33
+ **开发依赖对齐新宿主**:`dsh-tools` / `dsh-llm` / 四个 client 包从 `0.2.1-rc.2` 升到 `0.2.2-rc.1`,`@deepseek-ai/cordis` 从 `^4.0.4`(实际装 4.0.5)升到 `^4.1.0` —— 0.2.2 的 client 包 peer 已是 `~4.1.0`,旧依赖下的全绿只证明了 0.2.1 兼容。`package-lock.json` 同步重新生成。
34
+
35
+ **补齐 `apply_patch` 的文件追踪**:该工具只收整段补丁文本,路径写在 `*** Add/Update/Delete File:` 与 `*** Move to:` 行里;TaskBridge 与动作平面现在都从正文提取路径,跨文件补丁不再漏记任务热点。
36
+
1
37
  ## 0.6.10 (2026-11-04)
2
38
 
3
39
  **兼容**:无新增配置键,无 store 格式变更。一处判据变化:`memoryDir` 只接受项目根内的相对路径,越界值(`.`、`..`、含 `..` 段、绝对路径)回落到默认目录并告警一次(此前会静默把 store 放到根上或根外)。
@@ -5,8 +41,7 @@
5
41
  ### 性能
6
42
 
7
43
  - **CJK 分词从「逐字符判断」改成「整段匹配」**:`tokenizeRaw` 此前对整篇文本逐码点调用 `CJK_RANGE.test()` 并累积字符串,纯英文文档也要跑满整篇。现在用一条从 `CJK_RANGE` 派生的正则一次取出所有连续段,再按原有规则结算(段长 1 产单字、≥2 产全部相邻二元组)。**输出逐字节一致**,所以 `TOKENIZER_VERSION` 不动、旧 store 不需要回填;等价性由 `test/tokenizer-equivalence.test.mjs` 差分守住(冻结旧实现当标尺 + 固定输出契约 + 18 个边界串 + 5 个真实文件 + 2000 组固定种子随机拼接 + `stem` 两态)。
8
- - **同会话 A/B**(Node 24.19 / WSL2 / 20 vCPU,同一小时内交替跑、每个版本两遍,引用页缓存已热的那遍):TypeScript 整树(14,528 文件 / 95,316 条目)首次查询的 IDF 重建 **1.44–1.53 s → 0.94–0.96 s**(约 −35%),抽取 9.42–9.51 s → 8.79–8.95 s(−6%),冷索引 10.66 s → 10.00 s(−6%);文档为主的语料(249 文件 / 889 条目)抽取 242–252 ms → 216–219 ms(−13%)、IDF 58–59 ms → 43–44 ms(−26%)。查询 p50 无可测变化(在噪声内)。
9
- - **已知代价**:极端构造输入(CJK 单字与拉丁字母逐字交替,如 `中a文a` 重复)实测 **0.97×**——段长恒为 1 时,正则产出的段数组比逐字累积多一层分配;真实代码与文档里不出现这个密度。README 的性能表是 2026-10-13 的历史测量口径,本轮未重测。
44
+ - **同会话 A/B**:首次查询的 IDF 重建快约 35%,抽取与冷索引快约 6%;查询 p50 在噪声内。极端构造输入(CJK 单字与拉丁字母逐字交替)约 0.97×,真实语料不出现该密度。
10
45
 
11
46
  ### 修复
12
47
 
@@ -24,11 +59,9 @@
24
59
  - `save_lesson` 的 `scope` 描述改为与实现一致:绑定任务时默认 `task`,否则 `project`。
25
60
  - **体检脚本读不到自定义 `memoryDir`**:`skills/project-memory/scripts/pm-digest.mjs` 把 store 目录写死成 `<root>/.dsh-project-memory`,配了自定义 `memoryDir` 的项目只会得到「no memory store」。现在依次按 `--memory-dir <name>` / `DSH_PROJECT_MEMORY_DIR` / 默认名解析;都没命中时在项目根下一层按 `format.json` 标记找唯一候选并标注 `auto-detected`,多个候选不猜、报错点名怎么传参。
26
61
 
27
- **测试**:新增 `test/audit-2026-11-02.test.mjs`(13 项:save_lesson kind 保留、watch/lazy 超限摘旧条目、archive_task 解绑与注入/召回守卫、maxTokens 0 零注入、watch stop/poll 不重建缺失根、str_replace_editor 的 ops/TaskBridge、手工 promote 保留字段与容量、空任务 payload root、空 memoryDir 归一、POSIX 盘符路径丢弃)与 `test/tokenizer-equivalence.test.mjs`(5 项:固定输出契约、18 个边界串、5 个真实语料文件、2000 组固定种子随机拼接、`stem` 两态——全部与冻结的旧实现逐字节比对)与 `test/memorydir-guard.test.mjs`(4 项:空/`.`/`..`/含 `..` 段/绝对路径回落默认目录且不移动 store、嵌套相对目录仍允许、默认告警对同一坏值只发一次、`memoryDir: '.'` 不把 `*` 写进项目根);`test/skill.test.mjs` 补 1 项(自定义 `memoryDir` 的三种解析路径 + 多候选不猜)。`npm test` **956 项 / 57 个文件**全绿、`npm run typecheck` 通过。
28
-
29
62
  ## 0.6.9 (2026-11-02)
30
63
 
31
- **兼容**:无新增配置键,无 store 格式变更(启动时会顺手把 `watch.json` 里大小写重复的根条目合并成一条;文件格式不变)。三个既有键——`watchInterval` / `autoIndexOnFirstUse` / `llmQueryExpansion`——在 `Config` 里标成 `.volatile()`:这是宿主设置表单的准入条件(只有 volatile 字段能被 settings 接口写入),也让它们在运行中原地更新而不重启插件。profile / 命令行的写法完全不变。插件内部读取统一走 `cfgValue()`:volatile 字段在运行时是 ref(`.get()`),直接把 ref 当布尔会读错。升级后**需要重启一次 dsh**——volatile 元数据只在装配期解析。两处**行为变化**:① 扫描与懒索引都跳过隐藏路径(任一段以 `.` 开头,如 `.env` / `.github/**`),显式 `index_doc` 仍可索引(已存在的隐藏路径条目会在下一次完整扫描被清理);② `autoContext.maxTokens: 0` 现在真的零注入(此前被 `|| 400` 顶回默认值)。
64
+ **兼容**:无新增配置键,无 store 格式变更(加载时合并 `watch.json` 里大小写重复的根条目)。三个既有键 `watchInterval` / `autoIndexOnFirstUse` / `llmQueryExpansion` 标为 `.volatile()`,可在插件设置页原地修改;升级后需重启一次 dsh。两处行为变化:① 扫描与懒索引跳过隐藏路径(显式 `index_doc` 仍可索引);② `autoContext.maxTokens: 0` 现在真的零注入。
32
65
 
33
66
  ### 新增:插件页上的可视化设置(web)
34
67
 
@@ -55,8 +88,6 @@
55
88
  - **Electron 宿主里 PDF 索引全灭(issue #10)**:pdf.js 只在 `isNodeJS` 为真时兜底 `workerSrc`,而宿主进程是 Electron 且 `process.type !== 'browser'` → 默认值整块跳过,每次解析都抛 `No "GlobalWorkerOptions.workerSrc" specified`。现在 `loadPdfjs()` 在 worker 未配置时用 `import.meta.resolve`(老 Node 退回 `createRequire`)解析 `pdf.worker.mjs` 的 `file://` URL 兜底;显式 `configurePdfjsWorker()` 与 pdf.js 自己的默认值仍优先。原实现里的 `configuredWorkerSrc` 分支因无人调用恒为假,纯 Node 测试里 `isNodeJS` 又恰好为真,所以这个洞从首版起一直没人发现(0.6.3 与 0.6.8 上都能复现),且失败只写一条 W 级日志。
56
89
  - **大小写不同的同一目录不再被登记两次**:`watch_repo` 先以 `D:\proj`、后以 `d:\PROJ` 登记时,`watch.json` 会留两条、watch 每轮扫两遍,而 `watch_repo({watch:false})` 只删得掉其中一条(另一条下次启动复活)。`WatchManager` 与 watchlist 现在按 `storeKey()` 归一(保留第一次出现的写法;加载时顺手把老 store 里的重复条目合并)。
57
90
 
58
- **测试**:新增 `test/pdfjs-host.test.mjs`(2 项:纯 Node 对照组;子进程里把 `process.type` / `process.versions.electron` 改成 Electron 宿主形态后解析 PDF,并断言正文命中——只断言"没抛错"会放过空正文的假成功)。新增 `test/settings-card.test.mjs`(10 项:三个 volatile 键与默认值(并断言其余键不进命名空间)、`cfgValue()` 的 ref/普通值双形状、空路径 `[[]]` 读成"全部重读"、watch 关停/改间隔即重排、整份 `apply()` 在 ref 形状 Config 上装配、槽位注册的 key 与命名空间、默认收起与展开后 3 行、`Button` 以 forwardRef 对象形状参与注册、命名空间未提供与缺 settings 控件两种零注册)。本轮另补 7 项回归:`maxTokens: 0` 零注入、相对 root 按会话 cwd 解析、git / walk 两种扫描的隐藏路径口径一致、懒索引也跳过隐藏路径、畸形任务缺 `files` 的归一、`GlobalStore.markDirty()` 进入退出 flush、watch 根与 watch.json 的大小写归一(2 项)。新增 `test/index-failures.test.mjs`(3 项:账本按根隔离与上限、懒索引失败登记与成功清除、`index_repo` 报出后台失败)。`npm test` **930 项 / 54 个文件**全绿、`npm run typecheck` 通过;`npm run build:client` 后 `client/` 零 diff(CI 也会复核产物与源码一致)。
59
-
60
91
  ## 0.6.8 (2026-10-30)
61
92
 
62
93
  **兼容**:条目上多一个可选的 `mtimeMs`(旧条目缺省时按老行为整读 + 哈希)。无新增配置键,无破坏性 store 变更。懒索引不再对已有记录的文件问 gitignore,新文件仍问。
@@ -71,8 +102,6 @@
71
102
  - `watch` / `index_repo` / `index_doc` 也记录 `mtimeMs`。
72
103
  - 新增 `test/lazy-batch.test.mjs`。
73
104
 
74
- **实测**(同会话旧 vs 新):12k 文件 / 48k 条目的 store、WSL 挂 `/mnt/c`(NTFS 悲观代理)下,重复读 66.0 → 0.9 ms p50、改一个文件后单独索引 96.5 → 32.7 ms p50;本机 ext4(200 文件 git 仓库)重复读 1.4 → 0.007 ms、改文件 1.7 → 0.19 ms。四个真实语料(vue / voice / harness 3k / 全树)同会话 A/B 的冷索引、查询与 watch 内核重索引都在 ±5% 噪声内(小语料冷加载本身抖动大,vue 7–11 ms)。
75
-
76
105
  ### 修复
77
106
 
78
107
  - 构建:产物改为跨平台确定。lightningcss 的 `[hash]` 会把 `filename` 算进类名,此前传的是绝对路径,换台机器构建就整套换类名;现改用相对 POSIX 路径。`.gitattributes` 统一 LF(sourcemap 的 `sourcesContent` 会原样嵌入源文件行尾),CI 增加产物一致性校验。
@@ -80,15 +109,13 @@
80
109
  - `index_doc`:先 stat 再读正文,记录里的 mtime 不会比内容新。
81
110
  - 懒索引的根缓存:会话根兜底不再入缓存(判据是 `findProjectRootWithSource()` 的 `source`,不靠 `root === sessionRoot` 猜)——子目录里 5s 内新建的 `.git` / `package.json` 立刻生效。
82
111
 
83
- **测试**:`npm test` **892 项 / 51 个文件**全绿;`npm run typecheck` 通过。新增 `test/lazy-batch.test.mjs`(7 项:mtime 快路径、touch 后回填 mtime、批内一次 save、批量 gitignore 与逐个判定一致、会话根兜底不缓存)。
84
-
85
112
  ## 0.6.7 (2026-10-28)
86
113
 
87
114
  **兼容**:无新增配置键,也没有破坏性的 store 变更——条目上只多一个可选的 `explicit` 标记(旧条目缺省即按非显式处理)。一处判据语义变化:原生 Windows 壳现在签 `windows` 而不是 `wsl`,写了 `guard.hosts: ['wsl']` 又想覆盖原生 Windows 命令的条目要改成 `windows`。老 profile 与旧 store 直接升级。
88
115
 
89
116
  ### 修复:Windows 上重启后的残留写锁把写入永久挡死(且默认静默)
90
117
 
91
- 锁的"pid 复用"判定只读 `/proc/<pid>`(Linux-only),Windows 上 `processStartMs()` 恒为 `null`;而 `lockIsStale()` 对"同机 + pid 存活"是绝不回收。于是崩在写盘途中、或断电/强杀留下的 `.write.lock`,在重启后一旦旧 pid 被系统服务复用,就永远被当成"活锁":`save()` 每次返回 `false`(`lastSaveOk=false`,但按设计默认不打印),重试 5 次(≈20s)后放弃,退出 flush 也拿不到锁——记忆静默丢失,只能手删 `.write.lock` 或重启 dsh。现在锁内容多一个 `boot`(`Date.now() - os.uptime()*1000`);`at`/`boot` 早于本次开机即判残留。**这条只对同机锁生效**:跨机锁仍只按 mtime 判(网络盘上另一台机器的 `at` 早于本机开机是常态,套用会抢掉真正在写的机器——原作者"宁可等也不能双写"的取舍保留)。另加 `acquireDirLock({ maxHoldMs })` 兜"同一次启动内 pid 被复用":`save()` 传 10 分钟,默认 `0` 表示不设上限、维持原契约。
118
+ Windows 上崩溃/断电留下的 `.write.lock`,在旧 pid 被系统服务复用后会永远被当成“活锁”,`save()` 静默失败。锁内容现在多一个 `boot`,`at`/`boot` 早于本次开机即判残留(只对同机锁生效,跨机锁仍按 mtime 判);另加 `acquireDirLock({ maxHoldMs })` 兜同一次启动内的 pid 复用,`save()` 传 10 分钟。
92
119
 
93
120
  ### 修复:`when.writes` / `guard.paths` 在 Windows 路径上永不命中
94
121
 
@@ -186,8 +213,6 @@ Snowball 词干不幂等(`память → памя → пам`)。`recallIt
186
213
 
187
214
  `GlobalStore.flushPending()` 返回 `commit()` 的 `fn` 返回值(通常 undefined),`flushDirtyStores()` 把已成功落盘的 global store 计成 0。现在显式返回 `lastCommitOk`。
188
215
 
189
- **测试**:`npm test` **885 项 / 50 个文件**全绿;`npm run typecheck` 通过。新增 `test/windows-compat.test.mjs`(11 项:跨开机残留锁、跨机锁不被误伤、`maxHoldMs`、反斜杠/绝对路径的 `writes` 与 `guard`、Windows 命令形态、`hosts`、路径 token、store 缓存键、BOM;判据都在字符串/时间层面,Linux CI 同样能跑,"同实例"那条按 `win32/darwin` 分支断言)与俄语词干固定样例 `test/fixtures/ru-stems.json`(200 个词形,与 snowballstemmer 3.1.1 一致)。
190
-
191
216
  ## 0.6.6 (2026-10-27)
192
217
 
193
218
  **升级注意**:这是一次**行为变更**——注入会变少。没有新增配置键、没有 store 格式变更,老 profile 直接升级。变化只在"什么时候允许全文注入":子代理提示词、其它工具的参数、后台任务 / 子代理通知,以及人类消息里的删除 / 清理 / 渲染 / 基准类词,不再触发全文注入。
@@ -222,14 +247,10 @@ Snowball 词干不幂等(`память → памя → пам`)。`recallIt
222
247
  3. **跨进程删除被复活**。A 加载后持有旧快照,B `forget` 落盘,A 下一次 save 把"磁盘没有但内存有"当成"本地新增"写回——"真删、无撤销"的承诺失效(任务同形;global 层同形)。
223
248
  现在合并规则是:磁盘缺失的条目只有**本进程新建**的才补写,否则视为对方已删、从内存里丢掉。顺带修掉一个更直接的变体:`tasks` 合并从不清理 `_deletedTaskIds`,删任务会在**同一次 save 里**被自己刚读到的磁盘副本写回来。
224
249
 
225
- **测试**:新增 `test/store-lock.test.mjs`(10 条,含两个真子进程的删除复活回归、同步等锁与退出 flush)。`npm test` **835 项 / 48 个文件**全绿。
226
-
227
250
  ### 新增:把用法做成宿主 skill
228
251
 
229
252
  `skills/project-memory/`:`SKILL.md`(唯一事实源,frontmatter 提供 name / description,注册时剥掉)+ `scripts/pm-digest.mjs`(零依赖体检:store 大小、insight / 任务计数、trigger 覆盖、绑定数)。`apply()` 用 `ctx.inject(['skills'], …)` 注册,`resourceBase` 指向包内目录;没有 `skills` 服务的宿主静默跳过。`package.json files` 加 `skills`。
230
253
 
231
- **测试**:`npm test` **825 项 / 48 个文件**全绿;`npm run typecheck` 通过。新增 `test/signal-source.test.mjs`(端到端:通知不算人话 / 回退会话缓存、subagent 参数不产 op、目录名不产 `run-bench`、散文删除只记录)与 `test/skill.test.mjs`。
232
-
233
254
  ### 性能:Windows / NTFS 上大量小文件(不 OOM,但会被"每次 save 的文件操作数"拖慢)
234
255
 
235
256
  **实测**:同一份 400 个小文件,`WSL 挂 /mnt/c`(9p,NTFS 的**悲观**代理)与 ext4 对照:
@@ -296,8 +317,6 @@ Snowball 词干不幂等(`память → памя → пам`)。`recallIt
296
317
 
297
318
  **自愈**:新增 `deny` / `exclude` 后,已经登记在 `watch.json` 里的根会在下次启动时自动摘掉,不需要手删。拒绝文案会说明命中的规则,并指出要改的字段(`- id: project-memory` 的 `config:` 下)。
298
319
 
299
- **测试**:新增 `test/root-policy.test.mjs`,覆盖精确/前缀语义、优先级、`~` 展开、相对路径告警、Windows 大小写、walk/git 两条扫描分支、watch 自愈与各入口的一致性。`npm test` **810 项 / 45 个文件**全绿;`npm run typecheck` 通过。
300
-
301
320
  ## 0.6.4 (2026-10-23)
302
321
 
303
322
  **0.6.3 之后的收口**:11 个提交全部是修复与内部整理,没有新增工具、没有删除配置项。用户能感觉到的变化集中在三处——语料开始跟随 `.gitignore`、几个"设成 0 本该关闭"的旋钮真的关闭了、面板里改一步不再整份回写。**升级前请读第一条与「向量层」那条**。
@@ -428,8 +447,6 @@ Snowball 词干不幂等(`память → памя → пам`)。`recallIt
428
447
 
429
448
  README 双语与 CHANGELOG 里的具体框架名、硬件与机器信息、内部文件名换成中性写法;测试夹具里的内部文件名改成 `notes.md` 这类占位。零运行时行为变化。
430
449
 
431
- **测试**:`npm test` 720 → **756 项 / 44 个文件**(新增 `gitignore-index` / `store-concurrent` / `tool-schema-size`;`insight-store`、`recall`、`recall-vector-fusion`、`vector-index`、`auto-inject`、`client-toolview`、`client-task-sync` 等在既有 `ok` 块内补断言);`npm run typecheck` 通过;`npm run build:client` 重建与提交产物零差异。
432
-
433
450
  ## 0.6.3 (2026-10-20)
434
451
 
435
452
  ### 新增:删除留痕——`forget` 仍真删,但最近 5 条可从 `deleted.json` 找回
@@ -467,12 +484,8 @@ README 双语与 CHANGELOG 里的具体框架名、硬件与机器信息、内
467
484
 
468
485
  `ops.js` 的写盘判据里,重定向一支是 `>>?\s*\S`——它把**丢弃输出**也算成写文件。实测 `ls .agents 2>/dev/null | head` 抽出 `targets=['.agents']`、`cat package.json 2>&1` 抽出 `['package.json']`,而 `ops.targets` 正是 `when.writes` 的匹配面:列目录 / 看文件会误触发一条 `writes:['package.json']` 的教训。现在 `>` / `>>` / `2>` 之后是 `&`(合并 fd)或 `/dev/null`(丢弃)时不算写,`> file`、`2> file`、`1>> file` 照旧算。
469
486
 
470
- **测试**:`npm test` 705 → **720 项 / 41 个文件**(新增 `client-task-sync`;`insight-store` +1、`host-contract` +1、`taskbridge` +1、`root-guards` +8,其余在既有 `ok` 块内补断言),`npm run typecheck` 通过。
471
-
472
487
  ## 0.6.2 (2026-10-17)
473
488
 
474
- `npm test` **705 项 / 40 个文件**;`npm run typecheck` 通过。
475
-
476
489
  ### 兼容:dsh 0.2.1-rc.2
477
490
 
478
491
  - **开发依赖对齐新宿主**:`@deepseek-ai/dsh-tools` / `dsh-llm` / 四个 client 包从 `0.2.0-rc.2` 升到 `0.2.1-rc.2`,`package-lock.json` 重新生成;`client/client.js` 按 0.2.1 的 seed 模块重建。
@@ -488,8 +501,6 @@ README 双语与 CHANGELOG 里的具体框架名、硬件与机器信息、内
488
501
  - **动作后的重放不再超过宿主单页上限**:`reloadWindowRequest()` 返回 `limit = 已加载条数`(客户端注释还写着"正常永远走 PAGE_SIZE=30"),而宿主 `INSIGHT_PAGE_MAX=200` 是**静默**截断;重放又是替换式 `setRows`,于是滚到 500 条再点任意动作,列表被打回 200 条。改法:客户端用 `HOST_PAGE_MAX=200` 夹住 `limit`,载荷回报的 `nextOffset` 让哨兵继续把 200..N 追加回来。`client/client.js` 已同步重建。`test/insight-paging.test.mjs` 加一条交叉断言,把客户端常量与宿主 `INSIGHT_PAGE_MAX` 钉在一起(browser bundle 进不了服务端模块,只能靠测试防漂移)。
489
502
  - **`insight.*` 四个旋钮补进 Schema**:`autoMergeCos` / `autoMergeMargin` / `hintCos` / `maxForgetMatches` 在 `cfgInsight` 里读取、README 与 `types.js` 也写了,却没在 `src/index.js` 的 `Config` 里声明——与 0.5.8 给 `autoContext` 补声明是同一类问题:走 `cordis.patch.yml` 配它们,能不能活到代码取决于宿主是否按 `additionalProperties: false` 校验,但无论哪种,文档与 Schema 已经不一致。新增 `test/config-schema.test.mjs`:凡 `cfgInsight()` 会算出的数值键都必须在 `Config.insight` 声明,且 Schema 默认值等于运行时兜底值。
490
503
 
491
- **测试**:`npm test` 701 → 705 项 / 39 → 40 个文件(新增空根零副作用、客户端上限三条、契约交叉断言、Schema 一致性);`npm run typecheck` 通过。
492
-
493
504
  ### 修改:统一存储——`experience.json` 退休,经验笔记成为 `kind:'experience'` 的 insight
494
505
 
495
506
  **问题**:同一个概念有两个真相源——`experience.json` 服务 `remember`/`forget`/`query_memory`,`insights.json` 里又躺着一份 `source:'migrate'` 的**影子副本**,靠 `visibleInsights` 里一个特判(排除 `kind:'experience' && source:'migrate'`)才不至于在 `## Insights` 与 `## Experience` 里各出现一次。写入、删除、容量、向量索引各维护一套,正是"结构有点乱"的来源。上一版把 `forget` 做成了全层一套,但底下仍然是两套存储。
@@ -505,8 +516,6 @@ README 双语与 CHANGELOG 里的具体框架名、硬件与机器信息、内
505
516
  **升级路径**(至少覆盖 0.5.0,三种真实形态都有测试):只有 `experience.json`、没有 `insights.json` 的 0.4/0.5.0 store;`migratedAt` 已存在但旧文件还在的 0.5.x/0.6.x store;v1/v2 `insights.json`。都能直接加载,导入幂等、不重复。
506
517
  **降级注意**:回到 ≤0.6.x 的老版本后,那些笔记在旧版里查不到——老版本从空的 `store.experience` 出发、又用特判排除 `source:'migrate'` 的影子。**数据没丢**(仍在 `insights.json`),只是旧版本不再展示。
507
518
 
508
- **测试**:新增迁移归档 / 已迁移老 store 也要归档 / 无 insights.json 的旧版形态 3 项;删掉随能力一起消失的用例(经验层容量与动态上限、`store-cache` 的"经验写入"失效探针、run-test 的 `addExperience` 系列),并把 `supersede boundary`(共享前缀不互相顶掉)改到新写路径上继续钉住。707 → 701 项。
509
-
510
519
  ### 修改:`forget` 通吃全层(教训 / 决策 / 流程 / 经验笔记,task / project / global)
511
520
 
512
521
  **问题**:`forget` 只删旧的 `experience.json`(`store.removeExperience`),insight 层**没有删除入口**——模型发现某条记错了、过时了,只能新写一条"本条修正 ins_xxx",于是矛盾的两条长期共存、又都在注入候选里(真实使用里出现过好几对这种"新条目声明修正旧条目"的记录,被修正的那条一直在注入)。写入侧上一版已经能就地改,删除侧一直缺着。
@@ -535,8 +544,6 @@ README 双语与 CHANGELOG 里的具体框架名、硬件与机器信息、内
535
544
 
536
545
  **`save_lesson` 新增 `id`**:给了 id 就是就地更新,只覆盖本次显式传的字段,忽略 `scope`——条目留在原来的层(global → project → 各任务,`findInsightAnywhere` 负责定位)。未知 id **显式失败**,绝不静默新建。带 id 时跳过向量加载(不需要比对)。
537
546
 
538
- **测试**:`test/insight-store.test.mjs` 新增两组(判定矩阵用注入的 fake cosine,不依赖 leanvec)+3 项:0.95 自动覆盖且旧值进 `prev`、0.80 只提示、0.50 不提示、0.95/0.93 领先不足不覆盖、跨层就地更新、未知 id 失败、`prev` 跨层保留,以及工具端到端的 id 更新/写回。
539
-
540
547
  ### 修复:dsh 0.2.1 起 `session.header.cwd` 不再是「当前工作目录」
541
548
 
542
549
  0.2.1 引入 `@deepseek-ai/dsh-working-directory`:`header.cwd` 变成**原始项目身份 / 权限根**,而 `working_directory({cd})` 改的是会话投影里的当前执行目录,**不写回 header**。本插件的根解析(索引 / 检索 / 懒索引 / 审计注入 / 任务桥)此前一律读 `header.cwd`,于是用户 cd 到另一个项目后,记忆仍然读写**原项目**的 store——不报错,只是静默错根。
@@ -557,8 +564,6 @@ README 双语与 CHANGELOG 里的具体框架名、硬件与机器信息、内
557
564
 
558
565
  ## 0.6.1 (2026-10-15)
559
566
 
560
- `npm test` **650 → 675 项 / 36 个文件**;`npm run typecheck` 通过。
561
-
562
567
  ### 修复:物化后的 `searchText` 不在 storeCache 的上界里
563
568
 
564
569
  `residentBoundBytes` 只数 `_textChars`,而 `allEntries()` 物化 `searchText` 时只 bump 物化版本、不补这笔文本量。于是上界停在物化前的水位,门禁据此跳过精确计量与逐出——实测最多到预算的 **2.06 倍**(真实语料 1.07~1.15 倍)。现在物化按文件记进 `_textChars`,与写路径同一套替换语义。
@@ -573,8 +578,6 @@ README 双语与 CHANGELOG 里的具体框架名、硬件与机器信息、内
573
578
 
574
579
  ## 0.6.0 (2026-10-13)
575
580
 
576
- `npm test` **616 → 650 项 / 34 → 36 个文件**;`npm run typecheck` 通过。注入场景集 8 → **13** 个,另加 3 个 hint-only 场景。
577
-
578
581
  ### 新增:可选语义层(只重排经验 / 洞察两层)
579
582
 
580
583
  可选依赖 `leanvec` 随安装默认可用并自动启用(约 79 MB、约 +130 MB RSS);未安装或 `vectorDir: 'off'` 时逐字段退回纯词法。只改这两层排序,返回条数与文档/符号层不变;`vectorAlpha` 默认 `0.5`。
@@ -621,8 +624,6 @@ README 双语与 CHANGELOG 里的具体框架名、硬件与机器信息、内
621
624
 
622
625
  ## 0.5.16 (2026-10-11)
623
626
 
624
- `npm test` **592 → 616 项 / 30 → 34 个文件**;`npm run typecheck` 通过。
625
-
626
627
  ### 性能:`chunkText` 不再对整份正文物化(只对有 section 结构的文档有效)
627
628
 
628
629
  原实现先把整份正文 `split(/\r?\n/)`,再把所有 section 的正文同时留在内存里。现在逐行扫描,
@@ -779,7 +780,6 @@ fiber 里 `provide`):读它不需要 inject 的**唯一**路径是 `ctx.get(
779
780
 
780
781
  ## 0.5.15 (2026-10-06)
781
782
 
782
- `npm test` **563 → 592 项 / 30 个文件**;`npm run eval:injection` 逐项不变
783
783
  (命中 14 / 假阳性 0 / 漏召 0,P/R 1.00/1.00,7 次注入 857 字符)。
784
784
 
785
785
  ### 变更:工具 schema 预算瘦身 —— 每次请求固定开销 -356 token(粗估)
@@ -894,7 +894,6 @@ README(英/中)的测试数此前停在 561,而 `npm test` 实测已是 56
894
894
 
895
895
  ## 0.5.14 (2026-10-02)
896
896
 
897
- `npm test` **540 → 561 项 / 28 → 30 个文件**;`npm run eval:injection` 逐项不变
898
897
  (命中 14 / 假阳性 0 / 漏召 0,P/R 1.00/1.00,7 次注入 857 字符)。
899
898
 
900
899
  ### 修复:`/` 菜单里「工作流」三行点了没反应
@@ -1622,84 +1621,75 @@ git 会读取工作区里任意目录下的 `.gitignore`,`*` 连这个文件
1622
1621
 
1623
1622
  ### Fixed (the README promised a benchmark the npm package did not contain)
1624
1623
 
1625
- - **`scripts/` was missing from `package.json`'s `files` whitelist, so the published tarball shipped a README that told users to run a script it did not include.** `README.md` / `README.zh-CN.md` are inside the package, and their *Performance → Reproduce it on your own project* section (plus the Development block) documents `npm run bench -- /path/to/your/project` and `node scripts/bench.mjs` — but `npm pack` contained only `src/`, `client/`, `cordis.patch.yml` and the three documents: no `scripts/bench.mjs`, no `scripts/bench-synthetic.mjs`. Anyone installing the plugin from npm and following the reproduce instructions found the file absent, which is exactly the "trust the numbers" position that section exists to avoid. `scripts` is now in `files`, so both harnesses ship with the package; they still need no dsh instance, no network and no model calls, since they import only `src/`. Verified with `npm pack --dry-run` (tarball now lists `scripts/bench.mjs`, `scripts/bench-synthetic.mjs`, `scripts/bench-store.mjs`).
1626
- - **`bench/` stays local-only** — it is git-ignored and has never been tracked. It holds the raw measurement logs (`bench/results/`) and the scratch profilers; the synthetic harness it used to contain is `scripts/bench-synthetic.mjs`. Note this is a *packaging* fix only: those harnesses were already on GitHub, so "the README references a script that is not in the repository" was never true for the git remote — it was true only for the npm tarball.
1627
- - **Both READMEs advertised a stale test count.** They still said `280 tests` (the pre-0.5.5 number) while the three unreleased fixes above took the suite to **286**; the figures are now the measured ones (core 180 → 184, host-contract 7 → 9, everything else unchanged).
1624
+ - **npm 包缺 `scripts/`**:`files` 补上 `scripts`,tarball 现在带 `bench.mjs` / `bench-synthetic.mjs` / `bench-store.mjs`,README 的复现命令可用。
1625
+ - `bench/` 保持本地忽略;合成基准移到 `scripts/bench-synthetic.mjs`。
1626
+ - 两份 README 的测试数从 280 更正为实测值。
1628
1627
 
1629
1628
  ### Fixed (silent injection re-sent memory that was already in context)
1630
1629
 
1631
- - **Dedupe was whole-block, so a benign change anywhere re-sent every item.** The only guard was a fingerprint of the whole injected block, and that block changes for reasons that have nothing to do with the memory being new: the resident task card advances, the observed tool-call window slides, and `fitBody` re-truncates the last item whenever the remaining budget shifts. Measured on a real 66-step session: **20 injections carrying 41 item-sends for 9 unique items — 78% of them re-sends**, including the same 1732-char procedure three times and another 1008-char one six times.
1632
- - **Items are now remembered per session** (`sessionId → insightId → { hash, step }`) and an unchanged, already-injected item is filtered out of `buildInjection` **before** budget scheduling, so the budget it used to occupy goes to new items instead. The hash is over the injected body, so editing an insight re-injects it immediately. Only items that actually made it into an appended message are recorded — a budget-dropped item was never seen and must stay eligible. Per-session memory is capped (600 items) like the other session tables.
1633
- - **Why "once per session" is safe as the default:** the host session history is append-only — `agent-loop` has no compaction, and `agent/inbox/spliced` only touches the *pending* inbox. A re-send is therefore pure duplication. `autoContext.reinjectItemsAfter` (default `0`) exists for setups where history is trimmed outside the plugin: `N > 0` allows the same item again once `N` pre-steps have passed (it still has to change the block to be observable, since an identical block is already in history).
1634
- - **Regression:** two handler-level checks drive one session across steps and assert that a task-card advance no longer re-sends the procedure, that a fully unchanged step injects nothing at all, and that `reinjectItemsAfter: 2` re-injects on the third step; plus one schema check for the default. Suite 283 → **286** checks.
1630
+ - **整块去重会把旧条目再发一遍**:改为按会话记住已注入条目(id + 正文 hash),未变的不再进入预算调度。
1631
+ - 只记录真正进入消息的条目;编辑条目会立即重发;每会话上限 600 条。
1632
+ - **为什么默认「每会话一次」安全**:宿主历史只追加,重发是纯重复;`autoContext.reinjectItemsAfter`(默认 0)供外部裁剪历史的场景。
1635
1633
 
1636
1634
  ### Changed (the budget-drop audit is now opt-in — the user's terminal stays clean)
1637
1635
 
1638
- - **`auto-inject` no longer prints `degraded: … insights kept out by budget` unless the operator asks for it.** The line exists so a budget drop can never be *silent*, but the terminal is the **user's** surface, and a drop is **normal priority-based degradation, not a failure**: the resident task card and authored triggers take the 1200-char budget first, and lower-priority hints lose out. On a real host one `dsh web` start printed five such lines (four from a single busy project store, one global), which reads as "the plugin is broken" — exactly the first impression that gets a plugin uninstalled. New `autoContext.budgetLog` selects the level: `off` (**default**, never prints), `once` (at most one line per session, on the first drop), `all` (one line per changed dropped set — the previous behaviour). Accounting itself is unchanged in every mode: the per-session dedupe and the 200-session cap still run, so switching the log on later still reflects the current state. `README.md` / `README.zh-CN.md` document the key in both the `autoContext` row and the `cordis.patch.yml` example.
1639
- - **Regression:** the degraded check now drives two steps of one session (two different dropped sets) and asserts: silent by default, silent for `off`, ≥2 lines for `all`, exactly 1 line for `once`. Three schema checks were added as well — the *resolved default* is `off`, an explicit `budgetLog` survives `Config` and reaches the engine, and an unknown value is rejected — because the last config-default bug in this file was exactly this class (a key the engine reads but the schema does not declare). Suite 280 → **283** checks.
1636
+ - **预算丢弃日志默认关闭**:新增 `autoContext.budgetLog`(`off` 默认 / `once` / `all`),记账逻辑不变。
1640
1637
 
1641
1638
  ### Fixed (the silent-injection hint gate was dead in production)
1642
1639
 
1643
- - **A config schema default pinned the `legacy` hint gate on, making the shipped relative threshold dead code.** `autoContext.relevanceMin` carried `default(0.25)`, so `cfgEngine()` always saw a number and therefore always chose the legacy branch — `normalizedTokenOverlap >= 0.25`, the very judgement PR2 replaced because natural-language messages measure 0.014–0.057 against an insight and can never pass it. The documented default (`signalMinRatio: 0.5`, BM25 relative to the layer's top score) was unreachable in a real host, so only authored triggers could ever inject. The default is removed (the key remains, for explicitly opting back into the old behaviour), and `entryMaxInsights` / `signalMinRatio` / `editedMax` / `skipEchoSelfTodo` are now declared in the schema rather than being read by the engine but absent from it. The test suite could not catch this because every readiness test builds its config object by hand and never goes through `Config`.
1644
- - **Regression:** 4 new checks asserting that the *resolved default* config yields `relevanceMin: null` and `signalMinRatio: 0.5`, that an explicit `relevanceMin` still restores the legacy gate, and that the engine-only keys round-trip through the schema. Suite 276 → **280**.
1640
+ - **相对阈值在生产里是死代码**:`autoContext.relevanceMin` 的 schema 默认值把 `signalMinRatio: 0.5` 挡在门外;现移除默认值,并补齐只读未声明的键。
1645
1641
 
1646
1642
  ### Added (standalone benchmark — `scripts/bench.mjs`)
1647
1643
 
1648
- - **`npm run bench -- <projectPath>` measures the shipped index/query path on a real project, with no dsh instance, no network and no model calls.** It walks the project, builds its store in a temp directory (never the project's own `.dsh-project-memory`), and reports: cold index split into read+hash / extract / commit; cold load measured from a *copied* store (so the in-process store cache cannot fake it); IDF rebuild, cold and hot query latency through the real scorer (p50/p95/max over `--samples`, default 100); single-file hot re-index sampled **evenly across file sizes**; store size and bytes/entry; and whole-chunk `terms` versus the ≤300-char summary. Flags: `--json`, `--no-pdf`, `--keep`, `--max-files` (default 20000), `--queries <labeled-set.json>` (runs the hit@5 / hit@10 / MRR method on your own corpus).
1649
- - **The READMEs now point at it** (`Performance → Reproduce it on your own project`, plus the Development block) instead of asking readers to trust the tables. The labeled-set figures in Design tradeoff #4 are scoped to their internal corpus, with the method shipped; the docs also state the two caveats found while building it — `read+hash` is OS-page-cache sensitive, and real projects score slower than the synthetic corpus.
1650
- - **Retired the local-only harnesses it replaces** (`test/ablation*.mjs`, `test/doc-coverage*.mjs`, `test/gen-queries.mjs`, `test/simulate-agent.mjs`, `test/queries.json`) together with the dead `.gitignore` entries for them and for the August debug scaffolding.
1651
- - **The synthetic harness ships too.** `bench/microbench.mjs` moved to `scripts/bench-synthetic.mjs` (`npm run bench:synthetic -- 5000`), so the synthetic table is reproducible as well; `bench/` itself stays local-only.
1652
- - **Every published number re-measured on 2026-09-14** (Node 24.19): 5k-file cold index 269 ms avg (p50 267), cold load 40 ms, cached query over 20k entries p50 2.6 / p95 5.4 ms, hot single-file re-index p50 2.4 ms, 10k-file cold index 551 ms avg, cold load 90 ms, IDF rebuild 106 ms at 40k entries (57 ms at 20k, 12 ms at 4k), symbol scan 12.9–19.2 µs/file. Table captions now name the environment and the reproduce command; the real-project example quotes the warm-cache run and states the cold-cache first run (787 ms vs 253 ms) instead of hiding it. `README.md`, `README.zh-CN.md` and the local notes were updated together so no two documents quote different numbers.
1644
+ - **新增独立基准**:`npm run bench -- <projectPath>` 在真实项目上测冷索引、冷加载、查询、热重索引与体积,不需要 dsh / 网络 / 模型。
1645
+ - README 指向该脚本与复现命令,并写明页缓存敏感的已知口径。
1646
+ - 删除被它取代的本地 harness 脚本。
1647
+ - 合成基准移到 `scripts/bench-synthetic.mjs`。
1648
+ - 所有公开数字按 2026-09-14 重测,README 与环境、复现命令同步。
1653
1649
 
1654
1650
  ### Docs (README realigned with shipped behaviour)
1655
1651
 
1656
- - **`README.md` / `README.zh-CN.md` re-synced with the code.** Removed claims that documented superseded behaviour: the client-plugin contract version (0.1.2-rc.1 → **0.1.5-rc.1**, bumped in v0.5.3); the auto-created task title rule (v0.5.3 reversed it to **first todo entry → first human message**, and added the subagent exception); and the write path (`O(1) version bump` → only a **dirty** write bumps the version, so the 15 s watch poll cannot clear the IDF cache). `blindSpots` is now described as always empty rather than "empty for newly indexed documents"; the IDF-rebuild note carries its scale; `index_repo` / `watch_repo` document the missing-root guards. De-duplicated two feature bullets that restated each other (document `terms`; L1 regex vs. symbol memory). The Chinese README no longer claims multi-instance writes are safe — it now carries the same in-process-only lock caveat as the English one.
1657
- - **Two design-tradeoff entries corrected.** (a) "Subagent sessions never auto-create tasks" was stated as a feature; it is a deliberate non-goal, so it moved to a new tradeoff **§11 "Subagent sessions are out of scope for now"** ("not designed yet", with the cost stated) and the feature bullet now only points at it. (b) **§6 "Explicit `remember` over implicit learning" was factually wrong**: v0.5 ships `reflection-pipeline.js`, an opt-in LLM path that *does* infer lessons/decisions from the conversation on task switch-away/archive, and promotion runs automatically inside normal writes. §6 is now **"Model-facing memory: the agent writes, and no human has to be in the loop"** and states the actual policy: any scope writable by the agent at any time, promotion deterministic on `sourceTaskIds` corroboration (≥2 → project, ≥ `globalPromoteTasks` → global), and **`draft` described as a provenance label plus a corroboration threshold — not an approval queue** (a draft graduates on corroboration, which is intended; the panel is an optional inspection surface, not a step in the write path).
1652
+ - **README 与实现对齐**:修正客户端契约版本、任务标题规则、写入版本语义与 `blindSpots` 说明,中英文口径统一。
1653
+ - **设计取舍改正**:subagent 不建任务标为 §11 非目标;§6 改为「面向模型:agent 写入,无人工审批队列」。
1658
1654
 
1659
1655
  ### Fixed (console noise: watching the temp dir, PDF warnings, repeat failure logs)
1660
1656
 
1661
- - **The shared temp directory is no longer watchable.** `WatchManager.addRoot()`, `restorePersisted()` and `watch_repo` now refuse a root that is the filesystem root or `os.tmpdir()` (`isUnwatchableRoot()` in `src/util/fs.js`), and a persisted entry for one is self-healed out of the watchlist on the next start. This was the root cause of a real spam loop: reading any file directly under `/tmp` made `findProjectRoot` fall back to `/tmp` as the project root, `src/lazy.js` then auto-registered it as a watch root, and every 15 s poll re-indexed every file left under `/tmp` — including the test suite's deliberately broken `pm-pdf-*/big.pdf` fixtures, which printed `Invalid PDF structure` on every poll and re-created `/tmp/.dsh-project-memory` forever. Subdirectories of the temp dir (a project that genuinely lives there) still work.
1662
- - **pdf.js warnings are silenced** (`verbosity: 0` added to `PDFJS_OPTIONS`). `Warning: Indexing all PDF objects` is pdf.js's own recovery path for a broken or non-linearized PDF. It is not actionable from here, and a failed parse already reports its own error.
1663
- - **A permanently failing file is reported once, not every poll.** `watch` still retries a failed index every interval by design (so a file that gets fixed is picked up), but it now remembers the last reported error per file (`state.failures`) and stays quiet until the message changes or the file indexes successfully.
1664
- - **Tests:** suite 269 → **276** checks: a repeatedly failing file logs once, `watch_repo` / `addRoot` refuse the shared temp dir, the refusal is not persisted, `addRoot` refuses the filesystem root, and `restorePersisted` drops an unwatchable persisted root.
1657
+ - **共享临时目录不再可 watch**:根为文件系统根或 `os.tmpdir()` 一律拒绝,历史条目自愈剔除;临时目录的子目录仍可用。
1658
+ - pdf.js 告警静音(`verbosity: 0`)。
1659
+ - 永久失败的文件每个错误只报一次。
1665
1660
 
1666
1661
  ### Fixed (watch / save hot path)
1667
1662
 
1668
- - **A no-op `save()` no longer rewrites the store.** `commit()` always called `save()`, and `save()` ran `mkdirSync`, bumped `_version` and cleared the IDF cache even when nothing had changed. Since `watch` calls `commit()` for every watched root every 15 s, this (a) wiped the query-side IDF cache on every poll — cancelling the v0.3.4 IDF-reuse optimization whenever `watch` was on — and (b) **re-created the memory directory of any persisted watch root that no longer existed**, so a deleted root came back every 15 s. `save()` now returns before touching the disk unless something is dirty; stale `*.tmp` cleanup still runs unconditionally.
1669
- - **Dead watch roots are dropped instead of re-created.** `WatchManager.addRoot()` now refuses a root that does not exist, `restorePersisted()` removes such roots from the persisted watchlist on startup, and `watch_repo` rejects a non-existent root rather than persisting it.
1670
- - **Tests:** suite 231 → **235** checks. New: `no-op save() keeps the IDF cache` / `dirty save() invalidates the IDF cache`, plus `restorePersisted skips a root that no longer exists`, `a dead root is dropped from the persisted watchlist` and `addRoot refuses a non-existent root`.
1663
+ - **无变化的 `save()` 不再重写 store**:不 mkdir、不 bump 版本、不清 IDF 缓存;不存在的 watch 根不再被每次复活。
1664
+ - 失效 watch 根在启动时从持久清单删除。
1671
1665
 
1672
1666
  ### Fixed (Task Panel / 「隐藏提示信息」开关)
1673
1667
 
1674
- - **The hints toggle now hides every hover tooltip, not just two.** `showHints` was only wired to the step-edit hint and the drag-cancel button; the drag handle, panel-style / view-cycle / minimize / close buttons, card title rename hint, step status tooltip, file-path copy hint, mini-bar hint and the memory-view hints all ignored it — so clicking the button changed almost nothing. Every `title` hint in the panel now honours the switch (the toggle's own tooltip is kept so it stays discoverable).
1675
- - **The preference lives in the UI store and persists.** `showHints` moved from component-local state to `dsh-pm-task-panel-ui` (localStorage, default on), so it survives refreshes and remounts instead of silently resetting to “show”; the button dims and sets `aria-pressed` while hints are off, giving feedback without hovering.
1668
+ - **「隐藏提示信息」覆盖面板全部 tooltip**,状态存进 UI store,刷新后保留;关闭时按钮变暗并设 `aria-pressed`。
1676
1669
 
1677
1670
  ### Fixed (index_repo root validation)
1678
1671
 
1679
- - **`index_repo` no longer builds a store for a root that does not exist.** Both the tool and `autoIndexOnFirstUse` only ran `path.resolve()` first: on Linux/macOS a Windows-style path such as `D:\project\foo` resolved to the relative `<cwd>/D:\project\foo`, and the store's `mkdirSync` then created that literal directory together with its `.dsh-project-memory` (verified: `new ProjectMemoryStore(dir).load().commit(…)` creates every missing parent). `assertIndexRoot()` (`src/util/fs.js`) now rejects a missing or non-directory root before anything is written, and names the Windows-path case in the error message. `index_doc`'s file check and `watch_repo`'s `existsSync` guard are unchanged.
1680
- - **Tests:** `test/doc-index.test.mjs` gains 1 check (suite 7 → 8, total 237 → **238**): a missing root and a Windows-style path are both rejected with zero filesystem side effects.
1672
+ - **`index_repo` 拒绝不存在的根 / Windows 盘符路径**,在建目录前返回错误。
1681
1673
 
1682
1674
  ### Added (unified recall: the insight layer becomes searchable — PR1)
1683
1675
 
1684
- - **`query_memory` now searches insights.** `type: 'insight'` was added, and `type: 'all'` appends an `## Insights (lessons / decisions / procedures)` section. Before this, lessons/decisions/procedures had **no retrieval path at all**: `util/search.js` had no insight ranker and the tool's `type` enum had no insight value, so a lesson could only reach an agent through silent injection. Verified against this repository's own store: the "public face" lesson now returns at score 100 for a natural-language query.
1685
- - **New `src/recall.js` — one retrieval core, ranked per layer.** Every layer gets an adapter to the same entry contract (`title` / `keywords` / `summary` / `terms` / `sourcePath` — the shape `weightedFieldText` already scores), its own top-k, and a layer prior. Cross-layer order is only ever a *hint* (`flat`); it is never spliced into one score, because the doc/symbol streamer and the in-memory BM25 have different scales. `query_memory` routes doc / symbol / experience / insight through this single call, so the experience layer no longer carries its own scoring path inside the tool.
1686
- - **Scope visibility follows the session binding.** `project` / `global` insights are visible to every session; `task`-level insights only to a session bound to that task (`select_task`). Drafts stay out of recall. The v0.4 `experience.json` → `insights.json` migration shadow (`kind: 'experience'`, `source: 'migrate'`) is excluded from the insight layer so a note is not listed once as an insight and again as an experience — convergence the store's own comment had deferred to this PR.
1687
- - **Normative-heading prior.** A doc chunk whose heading matches the multilingual normative set (必须 / 禁止 / 铁律 / rules / must / must not / do not …) is boosted ×1.5 within the doc layer: deterministic, model-free, no new dependency. This is the "「必须遵守」never surfaced" case — `test/recall.test.mjs` first pins today's term-frequency ordering, then asserts the prior flips it.
1688
- - **Invariants held:** indexing still never calls a model (no index-time LLM), recall adds no LLM call (`llmQueryExpansion` remains opt-in, default off), and the plugin still has exactly one runtime dependency.
1689
- - **Tests:** new `test/recall.test.mjs` (8 checks); suite 238 → **246**.
1676
+ - **`query_memory` 支持 insight**(`type: 'insight'`,`all` 追加洞察段)。
1677
+ - **新增 `src/recall.js`**:同一召回核按层适配、各层 top-k 与先验,跨层顺序只作提示。
1678
+ - 任务级 insight 只对绑定会话可见;草稿不进召回;迁移影子条目去重。
1679
+ - 规范标题(必须 / 禁止 / rules / must …)在文档层 ×1.5。
1680
+ - 索引与召回都不新增模型调用。
1690
1681
 
1691
1682
  ### Added (readiness: triggers for every insight kind, two windows — PR2)
1692
1683
 
1693
- - **`trigger` is no longer procedure-only.** Any lesson / decision / procedure may carry `trigger: { keywords, symbols, actions, paths, scope }`. A hit injects the entry **before the action**, in full, at priority 1 — deterministic, auditable (`reasons[].why`), and independent of wording. `actions` are normalized ids (`git-commit`, `npm-publish`, `go-public`, …) matched by a small lexicon that also reads **human intent** ("提交 / 发包 / 公开"), so the block arrives while the model is still planning instead of after it acted.
1694
- - **Two windows, one matcher.** The pre-emptive window matches the turn's human text; the reactive window matches `tool/call` arguments observed through `session/event`. DSH has no pre-tool interceptor (`tool/call` is appended after the call is decided), so these are the only two honest windows — both feed one `ReadinessContext`.
1695
- - **The hint gate became scale-free.** It used to be `normalizedTokenOverlap(humanMessage, insight) >= 0.25`, normalized by the **larger** token set, so a real message measured 0.014–0.057 and could never fire. It is now the recall core's BM25 plus a **relative** threshold (`autoContext.signalMinRatio`, default `0.5` = at least half of the layer's top score), with zero-score candidates always dropped. The old judgement stays reachable only by explicitly setting `relevanceMin` (undocumented knob; profiles that set it keep the old behaviour).
1696
- - **Budget is a schedule, not a number.** Resident task card → trigger hits (full) → hints (truncated). Every decision is recorded as `reasons` (why injected) or `dropped` (why not), so silence is never the only signal. Procedures still inject **only** through the trigger channel, so a statistical hit cannot bypass `trigger.scope` profile filtering.
1684
+ - **trigger 不再只属于 procedure**:任何 kind 可带 `when`,命中时在下一次动作前全文注入。
1685
+ - 两个匹配窗口(人类消息 / 观察到的 tool/call)共用一套 `ReadinessContext`。
1686
+ - 提示阈值改为相对分数(`signalMinRatio` 0.5),旧 `relevanceMin` 仅显式设置时保留。
1687
+ - 预算按「常驻任务卡 → trigger → hint」调度,决策记进 `reasons` / `dropped`。
1697
1688
  - **Measured against this repository's own store:** the original commit-turn message ("…你顺便提交一下…") now injects the public-face lesson via `hint:relative:1.00`; reworded and relying on an observed `git commit`, only an authored `trigger.actions` reaches it (`trigger:action:git-commit`) — the two channels are complementary, not redundant.
1698
- - **Tests:** new `test/readiness.test.mjs` (10 checks); suite 246 → **256**.
1699
1689
 
1700
1690
  ### Added (write path + measurement: derived triggers, v1→v2, degraded, labeled eval — PR3)
1701
1691
 
1702
- - **Derived triggers are additive and never force-inject.** `deriveTrigger()` builds `{ keywords, actions, paths }` from an entry's own text with the same deterministic lexicon and path scanner the readiness matcher uses (bounded: ≤ 6 / ≤ 4 / ≤ 6), and stores it as `triggerDerived`. It only feeds the entry's search text, so it improves recall; whether an entry is injected **deterministically** is still decided solely by the authored `trigger`. This is the "explicit over implicit" trade-off carried through to injection.
1692
+ - **派生 trigger 只增强召回、不强制注入**;`triggerDerived` 不写正文。
1703
1693
  - **`insights.json` v1 → v2, lazily and idempotently.** On load, entries without `triggerDerived` are back-filled in memory (pure, model-free, no field rewriting); the next commit writes `version: 2`. A second pass is a no-op.
1704
1694
  - **The write path accepts the full trigger.** `normalizeInsight` no longer whitelists `keywords`/`symbols`/`scope` only — it keeps `actions` and `paths` too, and a trigger consisting *only* of `actions`/`paths` is no longer dropped. `save_lesson`'s schema exposes both, and its descriptions now say "any kind", not "procedure".
1705
1695
  - **Silence is not the only signal.** When the budget keeps entries out, `installAutoInject` logs one `degraded` record per session and drop-set (`… kept out by budget — id(reason), …`) instead of silently shrinking the injection.
@@ -1713,7 +1703,6 @@ git 会读取工作区里任意目录下的 `.gitignore`,`*` 连这个文件
1713
1703
  | 0.70 | 1.00 | 1.00 |
1714
1704
 
1715
1705
  The shipped default sits in the safe zone with margin, and 0.20 visibly admits weak matches — so the number is justified by data rather than chosen by feel. The table is the **9-case** set measured after the hint-precision fix below (the `0.20` figure was 0.86 on the earlier 8-case set; adding "缩写巧合(PR)不得命中" turns one more row into a genuine weak match, `7/9 = 0.78`). It lives under `test/` (CI-enforced, shipped) rather than the git-ignored `bench/`, deliberately: a threshold that only exists on one machine is not a threshold.
1716
- - **Tests:** new `test/insight-derive.test.mjs` (6 checks) and `test/readiness-eval.test.mjs` (4 checks, including the sweep table); suite 256 → **266**.
1717
1706
 
1718
1707
  ### Fixed (readiness hint precision: query source, acronym noise, stub truncation)
1719
1708
 
@@ -1721,7 +1710,6 @@ git 会读取工作区里任意目录下的 `.gitignore`,`*` 连这个文件
1721
1710
  - **A 1–2 character latin token is no longer hint evidence.** Measured on this repository's own store, the message "PR 干嘛…" put an unrelated "automatic security PR" lesson at the top of the insight layer on the strength of the acronym `PR` alone, i.e. `relative:1.00`. `hintQueryText()` drops *standalone* 1–2 character latin tokens; path-shaped tokens are preserved so `src/util/fs.js` still contributes `src`/`util`. Authored triggers are untouched: deterministic matching stays literal.
1722
1711
  - **No stub truncations.** A body that cannot fit its channel's useful minimum (trigger 48 chars, hint 120 chars) is dropped and recorded instead of emitting `- [ins_…] procedure ` — a fragment that costs tokens and conveys nothing.
1723
1712
  - **Eval set grew to 9 cases** (added "缩写巧合(PR)不得命中"). The shipped `signalMinRatio 0.5` still scores `precision 1.00 / recall 1.00`; the `0.20` column now shows two *genuine* weak matches (`h-weak`, and `a-pr` on 检查), which is precisely the evidence that 0.5 — not 0.2 — is the right shipped point. Measured after the fix on the real store, the same message yields `[trigger:重启, hint:提交]` instead of `[trigger:重启, hint:PR, hint:提交]`.
1724
- - **Tests:** `test/readiness.test.mjs` 10 → 13 checks; suite 266 → **269**.
1725
1713
 
1726
1714
  ## 0.5.4 (2026-09-12)
1727
1715
 
@@ -1734,14 +1722,12 @@ git 会读取工作区里任意目录下的 `.gitignore`,`*` 连这个文件
1734
1722
  - **Existing stores are back-filled automatically.** `index_repo`, `watch` and `lazy` treat a doc record whose entries lack `terms` as needing re-extraction even when the content hash is unchanged (`docEntriesNeedBackfill`), so the coverage fix reaches stores indexed before 0.5.4 without a manual `reindex: true`. It is a one-shot pass: once entries carry `terms`, the hash skip resumes.
1735
1723
  - **Rule-based keywords** (`extractKeywords`: title-weighted top terms) replace the previous placeholder 5–10 keywords, so `keywords` is deterministic and reproducible. Bilingual keyword expansion and self-reported blind spots are intentionally **not** produced at index time: the `blindSpots` field and its rendering are retained for compatibility, but new entries leave it empty.
1736
1724
  - **Recall-time opt-in LLM is routed explicitly and visibly.** `config.llmQueryExpansion` (default off) and `reflection.enabled` (default off) are the only remaining model calls, and both are recall-time and opt-in. They resolve `provider`/`model` through `src/llm-route.js` (config override → session `requestHeader().config` → agent options → last-seen `request/header` route). When no route is available or a call fails, search falls back explicitly and records a one-time `degraded` entry rather than failing silently.
1737
- - **Tests:** `test/doc-index.test.mjs` (new) pins summary ≤300 / terms covering past char 300 / BM25 hitting a post-300 term / zero model calls at index time even with a routed `exec` / deterministic bounded `extractTerms` / the automatic back-fill. `test/llm-route.test.mjs` covers the recall-time routing contract. `test/run-test.mjs` asserts watch indexing makes **zero** model calls and that doc entries are structural.
1738
1725
 
1739
1726
  ### Changed (injection semantics + signals)
1740
1727
 
1741
1728
  - **The injected block now declares `form: 'snapshot'`, not `'notice'`.** The autocontext block is current state that a later injection supersedes; `notice` means "a one-off account of something that just happened", so the old declaration was semantically wrong for both the transcript UI and the model. The channel is untouched (still appended through `agent/pre-step` as a plugin `user/message`). The host's `ContextFormed` is a discriminated union (`packages/llm/llm/src/message.ts:81-96`), so `snapshot` carries `sections: [{ name, text }]` and must **not** carry `notice`'s `summary`; the section is named `project-memory` and its `text` is exactly the assembled block.
1742
1729
  - **Per-file `reads` / `writes` counters are now collected.** `task.fileMeta[rel]` gained `reads` and `writes` alongside the retained `n` (which stays the read+write total for old tasks). This is **collect-only**: `hotSortFiles`, the resident "editing now" list and the dedupe fingerprint still read only `lastWriteAt` / `lastReadAt`, so no ordering or injection behaviour changes. It starts collecting the one signal a full-index memory plugin cannot observe — what the model actually read.
1743
1730
  - **`query_memory` memory rows carry a status placeholder.** Each doc/symbol row now prints `- status: <value>`, defaulting to `exact` for every entry (the vocabulary is `exact | needs-verify | re-verified | refreshed | demoted`). No state machine is implemented yet; this is a forward-compatible output contract so real values can land later without changing the rendering again.
1744
- - **Tests:** suite 227 → **231** checks. `test/host-contract.test.mjs` now drives a real injection and pins the source shape (`form: 'snapshot'`, `sections[0].name`, no `summary`); `test/taskbridge.test.mjs` pins `reads`/`writes`/`n`; `test/run-test.mjs` pins the `status` placeholder on doc and symbol rows.
1745
1731
 
1746
1732
  ### Files
1747
1733
  - src/doc-index.js (new), src/doc-pipeline.js, src/llm.js, src/llm-route.js (new), src/util/text.js, src/util/search.js, src/link.js, src/index.js, src/watch.js, src/lazy.js, src/reflection-pipeline.js, src/auto-inject.js, src/setup/taskbridge.js, src/tools/index-doc.js, src/tools/index-repo.js, src/tools/query-memory.js, src/tools/task-tools.js, src/commands/task-actions.js, test/doc-index.test.mjs (new), test/llm-route.test.mjs, test/host-contract.test.mjs, test/taskbridge.test.mjs, test/run-test.mjs, test/reflection-pipeline.test.mjs, package.json, CHANGELOG.md
@@ -1828,7 +1814,6 @@ git 会读取工作区里任意目录下的 `.gitignore`,`*` 连这个文件
1828
1814
  ### Files
1829
1815
  - src/similarity.js, src/insight-store.js, src/global-seed.js, src/types.js, src/tools/lesson-tools.js, src/reflection-pipeline.js, src/auto-inject.js, src/project-profile.js, src/commands/insight-actions.js, src/client/MemoryView.tsx
1830
1816
  - Changed: src/store.js, src/index.js, src/tools/task-tools.js, src/commands/tasks.js, src/commands/task-actions.js, src/client/{TaskPanel,TaskComponents,task-data-store,locales}.ts(x), TaskPanel.module.css, package.json
1831
- - Tests: insight-store 11 / reflection-pipeline 5 / auto-inject 9 / insight-actions 7 (total 209, exit 0)
1832
1817
 
1833
1818
  ### Notes
1834
1819
  - Design rationale, deviations (non-destructive migration; reflection triggers subset; auto-inject host verification) and the live-verification checklist live in the internal design notes.
@@ -1896,8 +1881,6 @@ git 会读取工作区里任意目录下的 `.gitignore`,`*` 连这个文件
1896
1881
  - TaskBridge 测试增至 11 项(新增反向接管、空写语义等);既有 166 项全绿
1897
1882
  - 清理:移除废弃 client 包依赖与死代码,样式收敛到 dsw token
1898
1883
 
1899
-
1900
-
1901
1884
  ## 0.4.1 (2026-09-03)
1902
1885
 
1903
1886
  ### TS 6.x 兼容
@@ -2092,4 +2075,4 @@ git 会读取工作区里任意目录下的 `.gitignore`,`*` 连这个文件
2092
2075
  - 初始版本:文档(PDF/Markdown/txt)与代码符号的持久化项目记忆
2093
2076
  - 读取时索引(lazy indexing)、增量刷新、watch 后台保鲜
2094
2077
  - BM25 检索(含 CJK 查询扩展)与经验笔记(remember/forget)
2095
- - dump 反射转储自动过滤、并发写串行化
2078
+ - dump 反射转储自动过滤、并发写串行化
package/README.md CHANGED
@@ -285,7 +285,7 @@ These commands are for **maintaining the plugin code** — regular users do not
285
285
 
286
286
  ```bash
287
287
  npm install
288
- npm test # 956 tests
288
+ npm test # 982 tests
289
289
  npm run eval:injection # synthetic pool P/R: precision 0.93 / recall 1.00, + a 3-scenario hint-only group
290
290
  npm run eval:injection -- --store .dsh-project-memory/insights.json # replay on YOUR store; control group is a hard gate
291
291
  npm run selfcheck:triggers # which entries can still push, which declarations are dead (reads your local store)
package/README.zh-CN.md CHANGED
@@ -283,7 +283,7 @@ node scripts/bench.mjs /你的/项目路径 [--json] [--samples 100] [--no-pdf]
283
283
 
284
284
  ```bash
285
285
  npm install
286
- npm test # 956 项测试
286
+ npm test # 982 项测试
287
287
  npm run eval:injection # 合成池 P/R:精确率 0.93 / 召回率 1.00,另有 3 个 hint-only 场景
288
288
  npm run eval:injection -- --store .dsh-project-memory/insights.json # 用你自己的 store 重放;对照组是硬闸门
289
289
  npm run selfcheck:triggers # 哪些条目还推得动、哪些声明是死的(读你本地的 store)
package/client/client.js CHANGED
@@ -1883,7 +1883,12 @@ window.__ModuleLoader__.load({
1883
1883
  return;
1884
1884
  }
1885
1885
  loadRef.current(0, 30, false);
1886
- }, [scope, sessionId]);
1886
+ }, [
1887
+ scope,
1888
+ sessionId,
1889
+ root,
1890
+ boundTaskId
1891
+ ]);
1887
1892
  (0, react.useEffect)(() => {
1888
1893
  if (nextOffset === null || typeof IntersectionObserver === "undefined") return;
1889
1894
  const sentinel = sentinelRef.current;
@@ -1918,7 +1923,7 @@ window.__ModuleLoader__.load({
1918
1923
  }
1919
1924
  };
1920
1925
  const rowToForm = (row) => {
1921
- const main = row.kind === "lesson" ? row.fix : row.kind === "experience" ? row.solution : row.kind === "decision" ? row.reason : row.body;
1926
+ const main = row.kind === "lesson" ? row.fix : row.kind === "experience" ? row.solution : row.kind === "decision" ? row.reason : row.kind === "procedure" ? "" : row.body;
1922
1927
  const body = main && main !== row.title ? main : "";
1923
1928
  return {
1924
1929
  title: row.title || "",
@@ -1977,7 +1982,7 @@ window.__ModuleLoader__.load({
1977
1982
  if (form.kind === "lesson") fields.pattern = title;
1978
1983
  if (form.kind === "decision") fields.choice = title;
1979
1984
  if (form.kind === "experience") fields.problem = title;
1980
- if (form.body.trim()) {
1985
+ if (form.kind !== "procedure" && form.body.trim()) {
1981
1986
  if (form.kind === "lesson") fields.fix = form.body.trim();
1982
1987
  else if (form.kind === "decision") fields.reason = form.body.trim();
1983
1988
  else if (form.kind === "experience") fields.solution = form.body.trim();