@yolk_vat-y/dsh-project-memory 0.6.6 → 0.6.8

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,134 @@
1
+ ## 0.6.8 (2026-10-30)
2
+
3
+ **兼容**:条目上多一个可选的 `mtimeMs`(旧条目缺省时按老行为整读 + 哈希)。无新增配置键,无破坏性 store 变更。懒索引不再对已有记录的文件问 gitignore,新文件仍问。
4
+
5
+ ### 性能:懒索引去掉每文件的固定开销
6
+
7
+ - `planFileIndex`:mtime + size 未变直接返回,不读盘、不哈希。
8
+ - 新增 `refreshMtime()`:内容未变但 mtime 变了(touch / checkout 还原)时记回新 mtime。
9
+ - `indexFile` 拆成规划与落盘两段,新增 `indexObservedBatch()`:一次 flush 每个 store 只 commit 一次。
10
+ - 项目根按目录缓存 5s,但只缓存**由标记推出**的根:会话根兜底是"这一带还没有标记"的推断,不入缓存——`git init` / `npm init` 在子目录里建出项目时,缓存会让文件先落进会话根的 store(真根出现后就多一份重复条目)。无标记目录因此仍按次走一遍祖先(与加缓存前一致)。
11
+ - 新增 `isGitIgnoredBatch()`:一条 `git check-ignore --stdin -z` 判一批;gitignore 判定挪到确认有变化之后。
12
+ - `watch` / `index_repo` / `index_doc` 也记录 `mtimeMs`。
13
+ - 新增 `test/lazy-batch.test.mjs`。
14
+
15
+ **实测**(同会话旧 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)。
16
+
17
+ ### 修复
18
+
19
+ - 构建:产物改为跨平台确定。lightningcss 的 `[hash]` 会把 `filename` 算进类名,此前传的是绝对路径,换台机器构建就整套换类名;现改用相对 POSIX 路径。`.gitattributes` 统一 LF(sourcemap 的 `sourcesContent` 会原样嵌入源文件行尾),CI 增加产物一致性校验。
20
+ - `test/lazy-batch.test.mjs`:不再用 `utimes()` 还原 mtime(Windows 上无法逐位还原),改为直接改写记录里的 mtime。
21
+ - `index_doc`:先 stat 再读正文,记录里的 mtime 不会比内容新。
22
+ - 懒索引的根缓存:会话根兜底不再入缓存(判据是 `findProjectRootWithSource()` 的 `source`,不靠 `root === sessionRoot` 猜)——子目录里 5s 内新建的 `.git` / `package.json` 立刻生效。
23
+
24
+ **测试**:`npm test` **892 项 / 51 个文件**全绿;`npm run typecheck` 通过。新增 `test/lazy-batch.test.mjs`(7 项:mtime 快路径、touch 后回填 mtime、批内一次 save、批量 gitignore 与逐个判定一致、会话根兜底不缓存)。
25
+
26
+ ## 0.6.7 (2026-10-28)
27
+
28
+ **兼容**:无新增配置键,也没有破坏性的 store 变更——条目上只多一个可选的 `explicit` 标记(旧条目缺省即按非显式处理)。一处判据语义变化:原生 Windows 壳现在签 `windows` 而不是 `wsl`,写了 `guard.hosts: ['wsl']` 又想覆盖原生 Windows 命令的条目要改成 `windows`。老 profile 与旧 store 直接升级。
29
+
30
+ ### 修复:Windows 上重启后的残留写锁把写入永久挡死(且默认静默)
31
+
32
+ 锁的"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` 表示不设上限、维持原契约。
33
+
34
+ ### 修复:`when.writes` / `guard.paths` 在 Windows 路径上永不命中
35
+
36
+ 写入期 `normalizeCitationFiles()` 把 `writes` 归成项目相对、`/` 分隔;匹配侧却只比"整串相等"与"basename",于是候选是 `D:\proj\src\a.ts`(工具参数)或 `src\util\fs.js`(模型的常见写法)时,带目录的判据一个都不命中——能命中的只有裸文件名。现在两侧都先把 `\` 归一成 `/`,判据除整串相等外再按**路径分段边界**匹配后缀(`(?:^|/)…$`);`notlib/a.ts` 仍不会被 `lib/a.ts` 命中,`src/*.ts` 这类 glob 对绝对候选也成立。路径 token 抽取(`util/path-token`)同样认两种分隔符并统一输出 `/`,`intentText()` 剥引用时也不再漏掉反斜杠写法。
37
+
38
+ ### 修复:动作面认不出 Windows 命令形态
39
+
40
+ `npm.cmd run bench`、`node scripts\bench.mjs`、`del`/`copy`/`move`/`Set-Content`、`pwsh -Command "git push"`、`cmd /c npm publish`、`"C:\Program Files\nodejs\npm.cmd" publish` 全部退化成兜底 op `shell-run`:`trigger.when.ops` 里的 `run-bench` / `file-delete` / `git-push` / `npm-publish` 因此永不触发,反而落进 `shell-run` 的误召面。现在命令头剥两种分隔符与 `.exe/.cmd/.bat/.com/.ps1`,`pwsh|powershell|cmd` 进外壳递归(认 `-c` / `-command` / `/c`),补一组 Windows 写盘命令,`bench`/`render` 的路径类正则也认 `\`,`2>nul` 不再当成写文件。
41
+
42
+ ### 修复:原生 Windows 壳被标成 `hosts: ['wsl']`
43
+
44
+ `pwsh.exe` / `cmd.exe` 的命令文本被当成 WSL 签名,于是 `guard.hosts: ['wsl']` 的条目在原生 Windows 上会被放行(它本该只在 WSL 里生效)。现在原生壳签 `windows`,只有 `/mnt/c/…` 这类路径才签 `wsl`。**已存条目**若写了 `hosts: ['wsl']` 却想覆盖原生 Windows 命令,需要改成 `windows`;WSL 签名的含义没变。
45
+
46
+ ### 修复:同一个 store 因大小写不同建出两份实例
47
+
48
+ `storeCache` 用 `path.resolve(dir)` 当键:`D:\proj\.dsh-project-memory` 与 `d:\PROJ\.DSH-PROJECT-MEMORY` 在 Windows/macOS 上是同一个目录、字符串却不同,于是并存两个实例——双份内存,且一边未落盘的条目另一边看不见(`load()` 从盘上读)。现在多一层 `storeKey()` 别名表做命中,缓存键本身仍是真实解析路径(告警与诊断输出里的路径不变形),逐出时别名一起删。
49
+
50
+ ### 修复:`git` 子进程在 Windows GUI 宿主里闪控制台窗
51
+
52
+ `execFileSync('git', …)` 没传 `windowsHide: true`。Electron 打包的 dsh 没有控制台时,每次 `index_repo`(`git ls-files`)与 `isGitIgnored()`(`git check-ignore`)都可能闪一个窗口。
53
+
54
+ ### 修复:带 UTF-8 BOM 的 SKILL.md 解析不出 frontmatter
55
+
56
+ 记事本保存的 `SKILL.md` 以 `\uFEFF` 开头,`^---` 匹配不上,frontmatter 整段被忽略,skill 的 name / description 静默回落默认值。现在解析前先剥掉 BOM。
57
+
58
+ ### 修复:`when.writes` 里的 `?` 让整个 pre-step 注入静默失效
59
+
60
+ glob 只支持 `*`,但 `?` 没转义;模式以 `?` 开头(`?.md`)时 `new RegExp('^?…')` 抛 `SyntaxError`,而它在每步的 `collectTriggered` 里,异常被 pre-step 兜住后 trigger + 提示 + 任务卡全部不注入。现在 `?` 按字面量转义。
61
+
62
+ ### 修复:长中文消息在 `intentText` 里回溯爆炸
63
+
64
+ 非 ASCII 文件名的正则用两条 `\S*` 夹字符类;无空格、无 ASCII 点的长中文串(4000 字实测 12s)会把一步 pre-step 卡住。改成按 token 判断,线性。
65
+
66
+ ### 修复:`guard.paths` / `not_paths` 不认人类消息里的写意图
67
+
68
+ `when.writes` 用「已观察写调用 ∪ 人类消息路径」,guard 只看前者:人类说"改 `src/x.js`"时,带 `guard.paths: ['src/x.js']` 的条目永远不放行,`not_paths` 也挡不住。两处现在共用同一份写目标。
69
+
70
+ ### 修复:超大文档先整份读入再拒绝
71
+
72
+ `planFileIndex` 的体积闸门只对代码文件生效,文档的检查在 `extractTextFromFile` 里——那时 `readFileForIndex` 已经把整份文件读进内存(300 MB 实测 +300 MB RSS),watch 每轮重付一次。现在按 size 在读盘前统一判 `OVERSIZE`。
73
+
74
+ ### 修复:显式 `index_doc` 的 .gitignored 文件被下一轮扫描删掉
75
+
76
+ 扫描清单来自 `git ls-files`(不含被忽略的文件),清理把"没扫到"当成"已删除",于是显式索引的文档活不过下一轮 watch / index_repo。现在 `index_doc` 在记录上打 `explicit`;清理时,显式索引且文件仍在盘上的条目跳过,文件真被删了仍会清。
77
+
78
+ ### 修复:非锁原因的写盘失败没反映到状态与退出 flush
79
+
80
+ `save()` / `GlobalStore.commit()` 的写事务只有 `finally`:EISDIR / ENOSPC 等异常直接抛出,`lastSaveOk` 仍为 true,脏 store 也不在退出 flush 的登记表里。现在异常路径置失败标志并登记,故障消失后同一份脏数据会补写。
81
+
82
+ ### 修复:锁文件不可读时 `acquireDirLock` 忙等
83
+
84
+ 锁文件存在但读不出来(EACCES、或该路径是个目录)时,抢锁循环既不 sleep 也不看 deadline,会把事件循环按住直到它变得可读。现在按 10ms 间隔重试,到 deadline 返回 `null`(调用方按"这次没拿到锁"处理)。
85
+
86
+ ### 修复:watch 的 mtime 快照不清理已删除的文件
87
+
88
+ `pollRoot` 只往 `state.snapshot` 里写、从不删,删掉或改名的文件会一直留在里面;文件若以同样的 `mtime:size` 回来,就会被当成"未变"而永远不重建。现在扫全的轮次里同步剪掉本轮没见到的键(截断轮不剪,与 store 的 `unseen` 同一口径)。
89
+
90
+ ### 修复:`npm run bench` 不算 `run-bench`;全局 flag 之后的子命令不识别
91
+
92
+ 只认 `scripts/bench.mjs` 这类带路径的参数,README 里的 `npm run bench` / `npm run bench:peak` 全部漏召(`when.ops: ['run-bench']` 的条目永不触发)。现在 npm script 名本身也算;`pnpm -C x run bench` / `npm --prefix . publish` 这类"全局 flag 在子命令之前"的写法也一样识别。顺带:`bash -lc` / `sh -ec` 的合并短选项也会递归解析。
93
+
94
+ ### 修复:非 Node 项目的 projectTags 缓存永不命中
95
+
96
+ 缓存用 `package.json` 的 mtime 做键,没有这个文件时 `stat` 抛错,于是每次调用都重读 go.mod / Cargo.toml。现在键是三份清单的 mtime(缺失记 `-`),Go / Rust 项目也能命中缓存,清单变化仍会失效。
97
+
98
+ ### 修复:俄语查询在 insight / experience 层被重复词干
99
+
100
+ Snowball 词干不幂等(`память → памя → пам`)。`recallItems()` 先把查询 tokenize 成词干、打分器又 tokenize 一次,导致俄语 lesson / decision / experience 的单字/多字查询大量查不到(doc 层不受影响)。现在 `gatedQueryText()` 用 `tokenizeRaw(..., { stem: false })` 只做过滤,真正的打分器词干一次。回归直接走 `recallItems()` 的 insight 与 experience 两个桶。
101
+
102
+ ### 修复:store 目录 / `.gitignore` 被外部删除后不自愈
103
+
104
+ `_storeDirReady` 缓存把“上次写过”当成“这次还在”,目录被 `git clean -fdx` / 用户清理后锁永远拿不到,写盘一直失败;`_selfIgnoreReady` 同理会把 store 留在 git 可提交状态。现在 dirty save 命中缓存时补一次目录 stat,失配就重建并让 shards / format / ignore 三处状态失效;`acquireDirLock(ensureDir:false)` 也在 `ENOENT` 上补建一次。自我忽略不再缓存“已存在”。
105
+
106
+ ### 修复:向量运行时并发加载 / 目录切换互相 close
107
+
108
+ 新增 `runtimeLoading` 单飞:同一 `(dir, fingerprint)` 的冷启动只 `loadLeanvec()` 一次。换运行时前先清掉引用旧 `lv` 的 indexCache,再 close 旧 fd;索引缓存 key 带上运行时目录,避免用旧闭包服务新目录。并发 injection + 写入去重、或同一模型内容从两个路径加载,都不会再静默退化成空向量。
109
+
110
+ ### 修复:多实例下任务级条目合并丢更新
111
+
112
+ 任务级 insight 的增删/编辑不 bump `task.updatedAt`,按整条任务时间戳选一侧会丢另一边的新增。现在用上次成功落盘时的 insight id 基线做三方合并:新增补写、本地删除不复活、同 id 取 `updatedAt` 新者。整条任务删除的墓碑逻辑不变。
113
+
114
+ ### 修复:watch 异步轮询的定时器重复 / stop 后扫描
115
+
116
+ 异步 `poll()` 期间 `setSessionActive()` 会先排一个定时器,`_tick()` 结束又排一个并覆盖句柄,导致待触发定时器翻倍、`stop()` 只能清掉一个。现在 `_tick()` 只在没有待触发定时器时续排,入口与结束都检查 `_stopped`;`start()` 在轮询中不重复排。
117
+
118
+ ### 修复:旧 source 形状的自注入被当成人类消息
119
+
120
+ `isOwnInjection()` 认迁移前 `{ plugin: 'dsh-project-memory' }` 形状,但 `installCallObserver()` 只判 `source.kind`,于是自己的注入块进入 `humanText`,下一步拿它当 query(自激)。现在 observer 与 `lastUserText()` 共用同一个自注入判据。
121
+
122
+ ### 修复:俄语意图词未归一 ё / 词形
123
+
124
+ `isIntentWord()` 会归一,`matchIntent()` 却拿原文做字面匹配:`ёлка`/`елка`、`миграция`/`миграции` 都不命中。现在两侧先 `normalizeRuWord()` 做词边界精确匹配,未命中再按 Snowball 词干比对词形;`город` 仍不命中 `городской`(词干不同)。
125
+
126
+ ### 修复:global store 退出 flush 计数
127
+
128
+ `GlobalStore.flushPending()` 返回 `commit()` 的 `fn` 返回值(通常 undefined),`flushDirtyStores()` 把已成功落盘的 global store 计成 0。现在显式返回 `lastCommitOk`。
129
+
130
+ **测试**:`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 一致)。
131
+
1
132
  ## 0.6.6 (2026-10-27)
2
133
 
3
134
  **升级注意**:这是一次**行为变更**——注入会变少。没有新增配置键、没有 store 格式变更,老 profile 直接升级。变化只在"什么时候允许全文注入":子代理提示词、其它工具的参数、后台任务 / 子代理通知,以及人类消息里的删除 / 清理 / 渲染 / 基准类词,不再触发全文注入。
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![ci](https://github.com/00080000/dsh-project-memory/actions/workflows/ci.yml/badge.svg)](https://github.com/00080000/dsh-project-memory/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![npm](https://img.shields.io/npm/v/@yolk_vat-y/dsh-project-memory)](https://www.npmjs.com/package/@yolk_vat-y/dsh-project-memory) [![npm downloads](https://img.shields.io/npm/dm/%40yolk_vat-y%2Fdsh-project-memory?style=flat-square&color=orange)](https://www.npmjs.com/package/@yolk_vat-y/dsh-project-memory) [![Listed on dsh-plugin.org](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/00080000/dsh-project-memory) [![Awesome](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
8
8
 
9
9
 
10
- A persistent **project development memory** for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) agents. Built specifically for project development, natively integrated with dsh's task system: task lists and files read during a session are automatically persisted as cross-session task records, with tasks ↔ files linked — workflows can be switched and resumed, no need to re-scope the whole project, solving context loss. Documents (PDF/Markdown/txt) and code symbols are stored separately per workspace; documents are automatically cross-linked to the code symbols they mention. Experience notes (problem → solution) are automatically deduplicated, preventing repeated mistakes. All data is stored per project on disk, survives session compaction and handover; recalls include `path:line` citations for source verification. No native builds, no vector database. A 79 MB local embedding table (`leanvec`) installs and runs by default; without it, recall falls back to pure lexical.
10
+ A persistent **project development memory** for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) agents. Built specifically for project development, natively integrated with dsh's task system: task lists and files read during a session are automatically persisted as cross-session task records, with tasks ↔ files linked — workflows can be switched and resumed, no need to re-scope the whole project, solving context loss. Underneath sits a **hybrid index**: document chunks, code symbols, experience notes and insights each form a layer, scored per layer and merged into one ranking. Documents (PDF/Markdown/txt) and code symbols are stored separately per workspace; documents are automatically cross-linked to the code symbols they mention. Experience notes (problem → solution) are automatically deduplicated, preventing repeated mistakes. Data survives session compaction and handover; recalls include `path:line` citations for source verification.
11
11
 
12
12
  > The plugin keeps a compact project **memory** on disk, with every entry pointing to a concrete file and line — the agent can reorient quickly instead of re-reading the whole project.
13
13
 
@@ -18,14 +18,14 @@ A persistent **project development memory** for [DeepSeek Harness](https://githu
18
18
  - **TaskBridge: cross-session development tasks** — the session's todo list and the files it touches are persisted as per-project task entities, so a workflow can be switched and resumed without re-scoping the project. Associated files stay in recency-weighted order (a read never outranks a written file), so a resumed session sees where to look first. New sessions continue with `list_tasks` → `select_task`. Work delegated to subagents creates no task. On hosts without session events the task tools still work as a plain record list.
19
19
  - **Task panel and editing** — draggable cards show a task's steps and files, and can collapse to a mini-bar or be hidden. Title, steps and status can be edited inline, writing back through the same path as model updates; four visual themes change material, geometry, typeface and density only, and colours follow the host. The panel stays hidden until summoned, syncs in the background on session switch, never reopens itself after a refresh, and a render failure cannot take down the host.
20
20
  - **Document memory** — PDF, Markdown and plain text are chunked and summarized without a model call. Each entry keeps a short summary for injection, a bounded term set for recall, and a citation back to the source.
21
- - **Code symbol memory** — a dependency-free scanner extracts functions, classes, methods, interfaces and type aliases with full signatures across 8 languages. Where `typescript` is installed, an optional second layer adds inferred return types, generics and interface shapes; it runs in the background and never blocks indexing.
22
- - **Automatic, read-time memorization** — a file is memorized the moment the model reads it, so memory is a byproduct of normal work rather than an upfront scan, and files nobody reads are never indexed. A background poll re-memorizes changed files only.
21
+ - **Code symbol memory** — a dependency-free scanner extracts functions, classes, methods, interfaces and type aliases with signatures; covered languages are JavaScript/TypeScript, Python, Go, Rust, C/C++/C#, Java and shell. Where `typescript` is installed, an optional second layer adds inferred return types, generics and interface shapes; it runs in the background and never blocks indexing.
22
+ - **Automatic, read-time memorization** — with lazy indexing (default), a file is memorized the moment the model reads it, so memory grows as a byproduct of normal work rather than an upfront scan. `index_repo` or a watched root can cover the rest of the tree; a background poll only re-indexes files that changed.
23
23
  - **Doc ↔ code cross-linking** — a document that mentions a symbol is surfaced when that symbol is queried. Links are resolved against the current symbol table, so they cannot go stale.
24
24
  - **Hybrid recall** — ranked search over documents, symbols, experience notes and insights, with optional LLM query expansion. The experience/insight layers are re-ordered by cosine when `leanvec` is present — installed by default, absent ⇒ pure lexical. Tuned for CJK: phrase boost, a synonym table, and CJK-aware boundaries for doc↔symbol linking.
25
25
  Russian (Cyrillic) is supported too: word splitting, a stopword list and Snowball stemming, so Russian queries hit Russian notes and take part in dedup.
26
26
  - **Experience notes** — problems → solutions, deduplicated by overlap rather than repeated, bounded by project size, and surfaced both by search and by the same injection path as lessons.
27
27
  - **Tiered insight memory (lessons / decisions / procedures)** — one entity across task, project and global scope. Near-duplicates merge or reinforce, and promotion moves an entry between scopes instead of copying it. Use is recorded, so decay and capacity rank by activity rather than age alone. The panel exposes a per-scope view for reviewing and editing entries. That list is ordered newest-first and loaded incrementally: 30 entries at a time, with the next page prefetched before the reader reaches the bottom and off-screen rows skipped by the renderer, so a large memory stays responsive.
28
- - **Triggered injection** — an insight may carry an authored trigger: only `when` triggers, `guard` narrows it, and `prevents` records what breaks without the entry. Corpus text can never trigger an injection; the statistical channel is gated separately and silent by default. **Evidence is graded by source**: only host facts (structured tool calls, `fs`/`todo` events) and irreversible actions named by the human (commit / publish / release / push / deploy / go public) can inject full text; prose mentions of delete / clean up / render / benchmark only feed the hint channel, and subagent prompts plus notice-shaped messages never count as actions — in one real session they produced 72% of all injected characters.
28
+ - **Triggered injection** — an insight may carry an authored trigger: only `when` triggers, `guard` narrows it, and `prevents` records what breaks without the entry. Corpus text can never trigger an injection; the statistical channel is gated separately and silent by default. **Evidence is graded by source**: only host facts (structured tool calls, `fs`/`todo` events) and irreversible actions named by the human (commit / publish / release / push / deploy / go public) can inject full text; prose mentions of delete / clean up / render / benchmark only feed the hint channel, and subagent prompts plus notice-shaped messages never count as actions.
29
29
  - **Usage is a skill too** — it registers `project-memory` into the host `skills` registry (a directory bundle with `scripts/pm-digest.mjs`, `resourceBase` pointing inside the package). The model loads the query/write workflow on demand instead of carrying it in every prompt; hosts without a `skills` service skip it silently.
30
30
 
31
31
  ## Installation
@@ -44,19 +44,19 @@ The plugin is also published on npm as a scoped package:
44
44
  dsh plugin --profile web add @yolk_vat-y/dsh-project-memory -w
45
45
  ```
46
46
 
47
- Each indexed project has its own store at `<root>/.dsh-project-memory/`. It keeps itself out of git by default — there is nothing to add to your `.gitignore`.
47
+ Each indexed project has its own store at `<root>/.dsh-project-memory/`. It keeps itself out of git by default — there is nothing to add to your `.gitignore`. Global-scope entries are kept outside the project in `~/.config/dsh-project-memory/global.json`; point `insight.globalFile` elsewhere to move it.
48
48
 
49
49
  ## Usage
50
50
 
51
51
  The tools below are **invoked by the agent**, not typed by the user. In the chat, just ask naturally — e.g. "index this project" or "what does the auth module do?" — or simply keep working, and the agent calls the matching tool automatically. By default files are indexed the moment the model reads them, so memory fills in while you work. `watch_repo` keeps explicitly-watched roots fresh in the background; `index_repo` forces a full backfill (unchanged files are skipped).
52
52
 
53
- In a git work tree the corpus is whatever `git ls-files --cached --others --exclude-standard` lists — tracked files plus untracked files that are not ignored — so `.gitignore`, nested rules included, decides what gets remembered. A directory that is not a git work tree falls back to a plain walk (no ignore rules). Lazy indexing applies the same check per file; an explicit `index_doc` always indexes what you point it at.
53
+ In a git work tree the corpus is whatever `git ls-files --cached --others --exclude-standard` lists — tracked files plus untracked files that are not ignored — so `.gitignore`, nested rules included, decides what gets remembered. A directory that is not a git work tree falls back to a plain walk (no ignore rules). Lazy indexing applies the same check when a file first enters the store; a file that is already indexed is refreshed on later reads without asking git again — if `.gitignore` starts excluding it, the `index_repo` / `watch_repo` scan drops it. An explicit `index_doc` bypasses `.gitignore`, but still respects `roots.exclude`, readability and the size limit, and its entry survives later scan passes for as long as the file exists.
54
54
 
55
55
  | Tool | Purpose |
56
56
  |---|---|
57
57
  | `index_doc file_path` | Index one document (PDF/MD/txt): chunk, summarize deterministically, and store with a `path:line` citation. Unchanged files are skipped. |
58
- | `index_repo root` | Index a whole project: documents get deterministic summaries, code files get a token-free symbol table. Incremental and self-healing: the store follows the file listing, so deleted, ignored or moved files are dropped, and documents are cross-linked to symbols. A non-existent or excluded root is rejected before anything is written. |
59
- | `watch_repo root` | Enable automatic refresh: a background poll detects new and changed files and re-indexes only those. Watched roots persist across restarts; a non-existent or excluded root is refused, roots that disappear are dropped rather than re-created. |
58
+ | `index_repo root` | Index a whole project: documents get deterministic summaries, code files get a token-free symbol table. Incremental and self-healing: the store follows the file listing, so deleted, ignored or moved files are dropped (an entry created by an explicit `index_doc` is kept while its file still exists), and documents are cross-linked to symbols. A non-existent or excluded root is rejected before anything is written. |
59
+ | `watch_repo root` | Enable automatic refresh: a background poll detects new and changed files and re-indexes only those. A watched root is recorded in that project's store, so it resumes when dsh starts there; a non-existent or excluded root is refused, roots that disappear are dropped rather than re-created. |
60
60
  | `memory_stats root` | Show what the store contains: totals, last index time, and the per-file list sorted by recency. |
61
61
  | `query_memory query` | Ranked search over documents, symbols, experience and insights, optionally query-expanded by the LLM. `type` selects a layer (`all` / `doc` / `symbol` / `experience` / `insight` / `task`). Returns hits with relative scores, sources or insight ids, and doc→symbol references. |
62
62
  | `list_tasks` | List task records for the project (archived marked). Call first in a new session before continuing work. |
@@ -76,12 +76,12 @@ The design follows four principles:
76
76
 
77
77
  - **Volatility** — context is ephemeral; it is lost when a session is compacted.
78
78
  - **Persistence** — the **memory** is stored on disk and survives compaction and new sessions.
79
- - **Compactness** — one bounded declaration line per symbol, and a ≤300-char summary plus a bounded term set per document chunk. Derived data is never stored: doc→symbol links are computed at read time. Index size depends on symbol density and chunk length, so treat these as measurements of specific corpora (2026-10-13), not guarantees: a code-only frontend app (289 files) lands at **325 bytes/entry ≈ 21% of source**, a symbol-dense TypeScript monorepo (12,634 files / 107 MB of code + 14 MB of docs) at **22% of source for the code layer (549 bytes/entry overall)** and **127% for the document layer**, and a document-heavy workspace (Markdown + PDFs) at **1,401 bytes/entry**.
79
+ - **Compactness** — one bounded declaration line per symbol, and a ≤300-char summary plus a bounded term set per document chunk. Doc→symbol links are not stored; they are computed at read time.
80
80
  - **Verifiability** — **recalls** carry a `path:line` citation where applicable, so the agent can confirm details against the source.
81
81
 
82
- Building the **memory** does not require an upfront scan: files are memorized as the model reads them, so the **memory** grows to cover exactly what has been worked with. Re-reading an unchanged file is a no-op, so the **memory** stays fresh with minimal ongoing overhead.
82
+ With default lazy indexing, building the **memory** does not require an upfront scan: files are memorized as the model reads them, so the **memory** grows to cover what has been worked with; `index_repo` or a watched root can cover the rest. Re-reading an unchanged file is a no-op, so the **memory** stays fresh with minimal ongoing overhead.
83
83
 
84
- The store is per-project and follows the codebase: changed files are re-extracted by content hash, deleted files are removed. Experience notes are `kind: 'experience'` entries in `insights.json` — retrieval-only, so accumulation does not affect context.
84
+ Project- and task-scope memory is stored per project and follows the codebase: changed files are re-extracted by content hash, deleted files are removed. Experience notes are ordinary `kind: 'experience'` entries in `insights.json`: recallable, deduplicated, and eligible for the same gated hint channel as lessons.
85
85
 
86
86
  ## Design
87
87
 
@@ -98,10 +98,12 @@ The store is per-project and follows the codebase: changed files are re-extracte
98
98
  admission-shadow.jsonl one line per step, all scored candidates + features (offline replay)
99
99
  ```
100
100
 
101
+ Global-scope entries are not stored under the project: they live in `insight.globalFile` (default `~/.config/dsh-project-memory/global.json`) so every project sees them.
102
+
101
103
  - **Incremental** — a content hash per file; only changed files are re-extracted.
102
104
  - **Cross-linking** — a returned document chunk resolves the symbols it mentions against the **current** symbol table and appends them as `references`, so a doc indexed before its symbols still links correctly.
103
105
  - **Query expansion** — when enabled, `query_memory` asks the LLM to rewrite the query into several variants (synonyms, EN/CN, identifier guesses) and merges the scores; when off, queries never touch the LLM. Indexing itself is model-free.
104
- - **Consistency** — the fact layer follows the codebase (hash re-extract / remove-on-delete); the experience layer is retrieval-only with supersede and `forget`. Writes take a cross-process directory lock (`.write.lock`) around a short read-modify-write, so two dsh instances can share one project store: shards converge by `indexedAt`, a save that cannot get the lock is deferred and retried (and reported as not persisted), and entries deleted by another process are not resurrected by a stale in-memory snapshot.
106
+ - **Consistency** — the fact layer follows the codebase (hash re-extract / remove-on-delete); experience entries are updated through the same supersede and `forget` paths as other insights. Writes take a cross-process directory lock (`.write.lock`) around a short read-modify-write, so two dsh instances can share one project store: shards converge by `indexedAt`, a save that cannot get the lock is retried and flushed again at exit, failures stay silent by default (`DSH_PROJECT_MEMORY_DEBUG=1` prints one diagnostic line), and entries deleted by another process are not resurrected by a stale in-memory snapshot.
105
107
 
106
108
  ## Architecture (Task Panel)
107
109
 
@@ -130,7 +132,7 @@ The workflow panel is collapsible, adapts to dsh and theme plugin styles, and of
130
132
  | `autoIndexOnFirstUse` | false | full scan of the current working directory on plugin load (opt-in) |
131
133
  | `watch` / `watchInterval` | true / 30 | background refresh; base poll interval in seconds (polls stay quiet while a turn is running — a 5-minute fallback keeps external edits fresh — and one merged scan runs at turn end; idle polls back off up to 2 minutes and reset on any change) |
132
134
  | `maxScanFiles` / `maxScanDepth` | 20000 / 12 | per-scan caps on files and directory depth; a truncated pass is reported and never removes what it did not reach. Cannot be disabled: `0` or any invalid value falls back to the default |
133
- | `allowUnsafeRoots` | false | compatibility switch that releases the **built-in** excluded list for every root decision (including lazy indexing, session audit and TaskBridge). It only applies to the built-in list — `roots.deny` / `roots.exclude` still win; to release a single directory, prefer an exact `roots.allow` entry |
135
+ | `allowUnsafeRoots` | false | releases the **built-in** excluded list for every root decision (including lazy indexing, session audit and TaskBridge). It only applies to the built-in list — `roots.deny` / `roots.exclude` still win; to release a single directory, prefer an exact `roots.allow` entry |
134
136
  | `roots.allow` / `roots.deny` / `roots.exclude` | `[]` / `[]` / `[]` | custom root lists (machine/profile level, CLI and web alike). `allow` / `deny` match the directory itself exactly; `exclude` is a path-boundary prefix and covers the whole subtree (no file under it enters the index). Priority: `exclude` > `deny` > `allow` > built-in list; the filesystem root can never be a root. `~` / `~/...` expansion, non-absolute entries are ignored with a one-time stderr warning, Windows is case-insensitive |
135
137
  | `llmQueryExpansion` / `expansionCount` | false / 6 | expand queries via the LLM before search (off by default to save tokens); max variants |
136
138
  | `tsPath` / `enableTypeScript` | (auto) / true | optional absolute path to a specific `typescript` install; set `enableTypeScript: false` to disable the type-aware layer entirely |
@@ -142,11 +144,10 @@ The workflow panel is collapsible, adapts to dsh and theme plugin styles, and of
142
144
  | `autoContext.maxItemsPerSession` / `autoContext.maxItemCharsPerSession` | 60 / 24000 | **runaway fuse, not a throttle** — a hard per-session ceiling by count and characters; once reached, the item channel stays silent for the rest of the session |
143
145
  | `autoContext.hintMinCoverage` | 0.45 | **absolute** floor for the statistical channel: the IDF-weighted share of the query's information mass the entry covers. A ratio-only threshold cannot tell signal from "best of a bad lot" |
144
146
  | `autoContext.hintMinMatched` / `autoContext.hintMinSupport` | 2 / 0.15 | a hint must share at least this many terms with the query, and at least this share of the query's terms must exist in the corpus at all — otherwise the channel stays silent this round |
145
- | `autoContext.vectorDir` | unset | **optional** semantic layer over the experience/insight layers, on by default via the `leanvec` optionalDependency (79 MB, ≈+130 MB RSS). `off` forces pure lexical; a path or `DSH_LEANVEC_DIR` overrides it. Re-orders only, returned counts unchanged; while it is active only entries that got **no** cosine are still filtered by lexical match count |
147
+ | `autoContext.vectorDir` | unset | **optional** semantic layer over the experience/insight layers, on by default via the `leanvec` optionalDependency (≈85 MB table, ≈+45 MB RSS). `off` forces pure lexical; a path or `DSH_LEANVEC_DIR` overrides it. Re-orders only, returned counts unchanged; while it is active only entries that got **no** cosine are still filtered by lexical match count |
146
148
  | `autoContext.vectorAlpha` | 0.5 | weight of `(1-α)·lexical + α·cosine` in those layers; `0` disables re-ranking only (write-side dedup stays on), `1` (pure vector) measured worse |
147
149
  | `autoContext.vectorDedup` | true | write-side near-duplicate detection (cosine ≥ 0.9 auto-overwrite, ≥ 0.7 near-neighbour hint). Independent of `vectorAlpha`; `false` keeps recall ranking untouched |
148
150
  | `autoContext.vectorItemMin` / `autoContext.vectorSpeakMin` | unset | **experimental** absolute-cosine gates for the hint channel (per-entry floor / channel-level semantic rescue). Uncalibrated — unset means off; see the evidence in `src/auto-inject.js` before enabling |
149
- | `autoContext.legacyScope` | `ignore` | how a legacy `trigger.scope` is treated: `ignore` (default) does not use it as a filter; `filter` applies it as a filter. `npm run selfcheck:triggers` lists entries that still carry a scope |
150
151
  | `autoContext.auditLog` | true | append one JSONL line per **actual** injection to `injection-audit.jsonl` (what / why / dropped / budget); rotates to `.1` past `auditMaxBytes` (`262144`). Silent on I/O errors |
151
152
  | `autoContext.shadowLog` / `autoContext.shadowMaxBytes` | true / 524288 | append one JSONL line **per step** (including steps that injected nothing) to `admission-shadow.jsonl`: scored candidates with their features and the gate that rejected each one — what makes a threshold change answerable offline. Disk only, never in the prompt; rotates keeping one `.1` generation |
152
153
 
@@ -164,11 +165,11 @@ When the root comes from the working directory, the model gets one notice per se
164
165
 
165
166
  - `roots.allow` — allow a directory even when it is on the built-in list, matched exactly. The filesystem root is not eligible.
166
167
  - `roots.deny` — this directory cannot be a root, matched exactly; its subdirectories can still be roots of their own.
167
- - `roots.exclude` — no file in this subtree enters the index, matched by path-boundary prefix (subdirectories included); no new root is inferred inside it either. A complete scan of a parent root skips it and removes previously indexed entries under it.
168
+ - `roots.exclude` — no file in this subtree enters the index, matched by path-boundary prefix (subdirectories included); no new root is inferred inside it either. A complete scan of a parent root skips it and removes entries already indexed under it.
168
169
 
169
170
  `deny` only decides whether the directory itself can be a root: when a parent is already a root, files under a denied child are still indexed by that parent — use `exclude` (or `.gitignore`, which the git-aware scan already honours) to drop the files too. Explicit `index_doc` also respects `exclude` and returns `Not indexed` for a file under it.
170
171
 
171
- Priority is `exclude` > `deny` > `allow` > built-in list. `allowUnsafeRoots: true` remains as a compatibility switch that only releases the built-in list; `deny` / `exclude` still win. The same verdict is shared by explicit tool calls, lazy indexing, watch, the session audit trail and TaskBridge. After adding a `deny` / `exclude` entry, roots already persisted in `watch.json` are dropped on the next startup. Configure under `config:` of `- id: project-memory` (CLI and web alike); the web UI does not expose a dedicated settings page yet.
172
+ Priority is `exclude` > `deny` > `allow` > built-in list. `allowUnsafeRoots: true` only releases the built-in list; `deny` / `exclude` still win. The same verdict is shared by explicit tool calls, lazy indexing, watch, the session audit trail and TaskBridge. Roots refused by the current policy are dropped from `watch.json` on startup. Configure under `config:` of `- id: project-memory` (CLI and web alike); the web UI has no dedicated settings page, so edit the profile.
172
173
 
173
174
  **Scan limits.** One pass covers at most `maxScanFiles` files (20000) and `maxScanDepth` directory levels (12). A truncated pass is reported in the `index_repo` result and logged once per root by the watcher, and it does not remove entries it did not reach. A directory that cannot be read (e.g. `EACCES`) counts as a truncated pass too and is named in the result: a read failure is not a deletion.
174
175
 
@@ -189,7 +190,7 @@ Settings live in the plugin's config object. To change them, add an override ent
189
190
  maxScanFiles: 20000 # per-scan file cap (truncation is reported, never deletes)
190
191
  maxScanDepth: 12 # per-scan directory-depth cap
191
192
  enableTypeScript: true # on: type-aware enhancement when TS is installed (default)
192
- # allowUnsafeRoots: false # compatibility switch: built-in list only; prefer roots.allow below
193
+ # allowUnsafeRoots: false # release the built-in list; prefer roots.allow below
193
194
  # roots: # custom root lists (empty by default)
194
195
  # allow: [/srv/projects/demo] # exact release of a built-in directory (filesystem root excluded)
195
196
  # deny: [/srv/shared] # exact: this directory cannot be a root; children still can
@@ -214,7 +215,7 @@ where `config.yml` contains the same override block.
214
215
 
215
216
  ### Measured on real projects (2026-10-13)
216
217
 
217
- Four corpora, one Linux machine (Node 24.19), each run twice with the **second, warm-cache run** quoted. "Cold index" is a full index pass (walk + hash + extract + commit); "query" runs the shipped scorer over 100 sampled queries; "re-index 1 file" is the watch/lazy hot path.
218
+ Four corpora, one Linux machine (Node 24.19), each run twice with the **second, warm-cache run** quoted. "Cold index" is a full index pass (walk + hash + extract + commit); "query" runs the shipped scorer over 100 sampled queries; "re-index 1 file" is the watch re-index core (read + extract + commit), which excludes the lazy path's root-resolution / `.gitignore` overhead.
218
219
 
219
220
  | Corpus | Files / entries | Cold index | Cold load | Query p50 / p95 | Re-index 1 file | Store content / on disk | Heap after load |
220
221
  |--------|-----------------|-----------|-----------|-----------------|-----------------|------------------------|-----------------|
@@ -223,7 +224,7 @@ Four corpora, one Linux machine (Node 24.19), each run twice with the **second,
223
224
  | TypeScript monorepo, 3,000-file slice | 3,000 / 17,576 | 1.9 s | 70 ms | 9.2 / 18.9 ms | 1.9 ms | 10.9 MB / 18.9 MB | 22.7 MB |
224
225
  | TypeScript monorepo, whole tree | 12,634 / 80,231 | 7.8 s | 278 ms | 40.6 / 74.8 ms | 7.2 ms | 42.0 MB / 75.7 MB | 75.2 MB |
225
226
 
226
- **How it scales.** Re-indexing a changed file costs O(file), not O(corpus) — 0.3–7.2 ms across every corpus above. Cold load (≈22 µs/file), query (≈0.5 µs/entry on the largest corpus) and resident heap (≈1.5 KB/entry once queried) grow linearly with the index, which keeps small and mid-size projects in the single-digit-millisecond range.
227
+ **How it scales.** Re-indexing a changed file costs O(file), not O(corpus) — 0.3–7.2 ms across every corpus above. Cold load (≈22 µs/file), query (≈0.5 µs/entry on the largest corpus) and resident heap (≈1.5 KB/entry once queried) grow linearly with the index, which keeps small and mid-size projects in the single-digit-millisecond range. Re-reading a file that is already indexed costs ≈0.01 ms: it stops after one `stat` plus a cached record lookup, with no read, no hash and no `git check-ignore`.
227
228
 
228
229
  > `read+hash` depends on the OS page cache — 2.3 s cold vs 0.27 s warm on the 12,634-file tree — so the table quotes the warm figure.
229
230
 
@@ -242,17 +243,6 @@ Four corpora, one Linux machine (Node 24.19), each run twice with the **second,
242
243
 
243
244
  > Generated code (~4–5 symbols/file), measured 2026-10-13. Reproduce with `npm run bench:synthetic -- 5000` (`scripts/bench-synthetic.mjs`). Pure indexing overhead, no LLM calls. The first query after a write rebuilds the IDF cache (**141 ms at 40k entries**, 68 ms at 20k, 17 ms at 4k); later queries hit it.
244
245
 
245
- ### Windows / many small files
246
-
247
- On Windows (NTFS) the bottleneck is not CPU but the **number of file operations per write**, and watch's synchronous `stat` loop blocks the event loop. For 400 small files (WSL over NTFS, a pessimistic proxy): first index 8–10 s and a single-file edit p50 ≈ 46 ms; on ext4 the same work takes 60–90 ms and 1 ms. Indexing 3,000 / 10,000 small files peaks at ≈ 85 / 112 MB RSS — **many small files are not the OOM surface**; a single large file is.
248
-
249
- ```bash
250
- npm run bench:edits -- --dir C:\\Temp\\pm-bench # native Windows
251
- node scripts/bench-edits.mjs --dir /mnt/c/Users/Public/pm-bench --files 400
252
- ```
253
-
254
- The script builds its corpus in a temporary directory and deletes it afterwards; it reports first-index cost, edit p50/p90/max and peak RSS.
255
-
256
246
  ### Reproduce it on your own project
257
247
 
258
248
  The measurement ships with the repository **and with the published npm package** (`scripts/` is part of the tarball). It needs **no dsh instance, no network and no model calls**, and never touches your project's own store — results go to a temp directory and are removed afterwards:
@@ -277,16 +267,15 @@ Pass `--queries your-queries.json` to run the labeled-set method (hit@5 / hit@10
277
267
 
278
268
  ## Design tradeoffs
279
269
 
280
- - **A short filesystem lock, not an embedded database** — each save holds an exclusive `.write.lock` only for the read-modify-write (parsing stays outside it), waits at most 2 s for a busy peer and then retries; a busy peer is waited on synchronously for up to 15 s (correctness comes from acquiring the lock, not from background retries); a write that still cannot land is registered for a synchronous flush when the process exits or the plugin is disposed, **without interrupting the user** — memory writes are idempotent and cheap to redo; set `DSH_PROJECT_MEMORY_DEBUG=1` for a one-line diagnostic. The lock carries `pid` / `host` / `token`: a live same-host holder is never preempted, release verifies ownership, and a crashed same-host lock is reclaimed immediately. Two dsh instances can share one store. No WAL, no daemon, no native dependency.
270
+ - **A short filesystem lock, not an embedded database** — each save holds an exclusive `.write.lock` only for the read-modify-write (parsing stays outside it) and waits synchronously for up to 15 s for a busy peer (correctness comes from acquiring the lock, not from background retries); a write that still cannot land is registered for a synchronous flush when the process exits or the plugin is disposed, **without interrupting the user** — memory writes are idempotent and cheap to redo; set `DSH_PROJECT_MEMORY_DEBUG=1` for a one-line diagnostic. The lock carries `pid` / `host` / `token`: a live same-host holder is never preempted, release verifies ownership, and a crashed same-host lock is reclaimed immediately. Two dsh instances can share one store. No WAL, no daemon, no native dependency.
281
271
  - **Watch: compute outside, commit inside** — no lock is held during parsing, and polling with mtime + content hash is used instead of `fs.watch`: it behaves identically on network drives, Docker volumes and WSL, without duplicate-trigger or missed-event failure modes.
282
272
  - **Corrupt shards are quarantined, not repaired** — a shard that fails to parse is renamed and only that file is re-indexed, so there is no WAL or embedded database adding native dependencies, lock contention and failure modes of their own.
283
273
  - **Vectors re-rank, they do not rank** — on a paraphrased-query set, pure vector replacement is worse than BM25 (hit@10 **53% vs 69%**) while weighted fusion helps at small k (hit@3 **53% vs 50%**), so the optional layer only re-orders the experience/insight layers and never gates. Lexical retrieval still answers the queries this plugin targets: on a real project with 29 labelled queries, file-level hit@5 is **96.6%**, and whole-chunk terms raise document term coverage from **27.3% to 100%** with MRR unchanged (**0.958** vs **0.955**).
284
274
  - **Indexing is deterministic and model-free** — a model at index time would make two indexings of one document differ, and a wrong translation at query time means zero recall; rules plus symbol links cover the common cases and work offline.
285
275
  - **Model-facing memory: the agent writes, no human in the loop** — the consumer is the agent, usually headless, so memory that only promotes when someone clicks a card would never promote at all. `draft` is a provenance marker plus an evidence threshold, not an approval queue.
286
276
  - **Full entries returned directly** — entries are already compact, so returning them whole is more verifiable and one round-trip cheaper.
287
- - **`forget` by query is aggressive; use IDs for precision** — experience notes are low-risk, high-volume and retrieval-only, so stale noise hurts more than an over-broad delete. For exact deletion use the ID shown by `query_memory`.
288
- - **TypeScript enhancement is optional, lazy and cached** — it runs in the background, never blocks indexing, and falls back to the regex scanner; its queue is bounded, and any dropped files are reported. The **default lib is not loaded**: inference that depends on global types (`Promise`/`Array`/DOM) degrades to `any`/`unknown`, while explicit annotations are unaffected.
289
- - **Subagent sessions are out of scope**
277
+ - **`forget` by query is aggressive; use IDs for precision** — experience notes are low-risk and high-volume, so stale noise hurts more than an over-broad delete. For exact deletion use the ID shown by `query_memory`.
278
+ - **TypeScript enhancement is optional and lazy** — it runs in the background, never blocks indexing, and falls back to the regex scanner; its queue is bounded and deduplicated by content, and any dropped files are reported. The **default lib is not loaded**: inference that depends on global types (`Promise`/`Array`/DOM) degrades to `any`/`unknown`, while explicit annotations are unaffected.
290
279
 
291
280
  ## Development (for contributors)
292
281
 
@@ -294,7 +283,7 @@ These commands are for **maintaining the plugin code** — regular users do not
294
283
 
295
284
  ```bash
296
285
  npm install
297
- npm test # 835 tests
286
+ npm test # 892 tests
298
287
  npm run eval:injection # synthetic pool P/R: precision 0.93 / recall 1.00, + a 3-scenario hint-only group
299
288
  npm run eval:injection -- --store .dsh-project-memory/insights.json # replay on YOUR store; control group is a hard gate
300
289
  npm run selfcheck:triggers # which entries can still push, which declarations are dead (reads your local store)