dsh-layers-hippocampus 1.7.0 → 1.7.2

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,9 +1,74 @@
1
- # Changelog
2
-
3
- All notable changes to `dsh-layers-hippocampus` are documented here.
4
- The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
- and the project adheres to [Semantic Versioning](https://semver.org/).
6
-
1
+ # Changelog
2
+
3
+ All notable changes to `dsh-layers-hippocampus` are documented here.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and the project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [1.7.2] — 2026-11-25
8
+
9
+ **设置页结构重构:17 张卡片按用途收进 5 个分组,左侧竖排目录导航;能力与配置一字未改。**
10
+
11
+ - **Changed — 设置页从「一条长滚动」变成「分组 + 目录」**:`ui/client.js` 里 17 个
12
+ `Section` 按用途分成五组——`identity`(身份与行为)、`context`(上下文与注入)、
13
+ `ingest`(摄入与蒸馏)、`retention`(留存与归档)、`space`(空间与存储)。
14
+ 每组由 `SettingsGroup` 渲染(组名 + 一句说明 + 卡片原样),卡片本身**逐字搬进**
15
+ `SettingsIdentityGroup` / `SettingsContextGroup` / `SettingsIngestGroup` /
16
+ `SettingsRetentionGroup` / `SettingsSpaceGroup`,控件、校验、跨字段联动一个字没改。
17
+ - **Changed — 左侧竖排目录**:`SettingsNav` 是**独立滚动的固定栏**——外面的 shell 高度在挂载时量一次
18
+ (`window.innerHeight - shell.top - 24`,`resize` 时重量),目录与卡片各自拥有滚动条,
19
+ 点目录滚卡片、滚卡片目录不动。最初用 `position: sticky` 实现,实际**不生效**:宿主 shell
20
+ 的 overflow 包裹层不是滚动容器,sticky 子元素会随内容一起滚走。滚动高亮改用
21
+ `IntersectionObserver`(`root` 指向卡片滚动容器,`rootMargin: '-8% 0px -70% 0px'`)。
22
+ - **Changed — 表单宽度**:`maxWidth` 720 → 980,目录 148px 固定、内容 `flex: 1 1 460px`,
23
+ 窄屏自动折行(`flexWrap: 'wrap'`)。
24
+ - **保持不变 — 简洁模式**:仍然只显示四组(`identity` / `context` / `retention` / `space`),
25
+ `ingest` 整组不渲染;`hidden: simpleMode` 语义与 `SIMPLE_PATCH_KEYS` 白名单完全照旧。
26
+ - **Tests**:`test/v163.ui.test.js` 新增 `settingsBody()`,把 `MemorySettings` 与五个分组
27
+ 组件体拼起来断言卡片存在/被隐藏,避免结构重构后测试假绿或假红。全量 **555/555**(87 个测试文件)。
28
+
29
+ ## [1.7.1] — 2026-11-24
30
+
31
+ **把注入面从“多给点信息”改成“只给还没过期的信息”:摘要卫生常开,提示标签单向静默,
32
+ 任务模式补一行当前状态。三项都来自一次真实长会话的复盘,不是理论优化。**
33
+
34
+ - **Fixed — 注入摘要里的过期计数(常开,不受模式开关影响)**:交接摘要、L3 人格行、
35
+ `[Active Task]` 都会带上写那一刻的簿记数字(`events 348`、`reviews total 346 due 337`、
36
+ `version 1.6.9`)。它们**写入时是真的,几分钟后就假了**,模型要先读一遍再花 token 纠正。
37
+ 新增 `src/promptHygiene.js`:`stripVolatile()` 只删**簿记子句**(版本号、`key: N`、
38
+ `gen-000131`、ISO 时间戳、`N 条/个/分片`),**刻意不删没有键名的裸数字**——否则
39
+ `854,668 + 256,000 > 1,048,576` 这类教训会被一起删掉;带「是/为/需要/必须/禁止/不要」
40
+ 的句子不按计数量删除。`hygienicSummary()` 再补一个快照时间戳
41
+ (`(snapshot … · counters stripped as stale)`),让读者知道这段文字有多旧。
42
+ 三个注入点(冷启动摘要、人格行、活动任务)全部走同一条路径。
43
+ - **Fixed — 冷启动尾部泄漏摘要事件**:`[Previous Context Tail]` 在缺少 `tailTurns` 时回退到
44
+ 「最近业务事件」,而交接摘要事件本身带 `folded_summary` 标签,于是**摘要被当成一轮对话**
45
+ 再注入一次(连同它的过期计数)。现在排除摘要事件,其余每行也过一遍卫生。
46
+ - **Added — 提示标签的单向静默(任务模式)**:`[Memory Hints]` 过去会一直展示同一个不相关
47
+ 标签,从不换来一次 `recall`(实测 2 次出现、0 次使用)。新增 `src/hintFeedback.js`
48
+ (`state/hint-feedback.json`,schema 1):每个标签记 `shown` / `recalled`;连续
49
+ `context.hintsIdleSilenceAfter`(默认 **8**)次展示且 `recalled === 0` → **永久静默**。
50
+ 单向是关键:静默后即使偶然被 recall 也不会自动复活,只有 `revive()` 或删状态文件才能恢复
51
+ —— 自动复活只会把同一个错误再学一遍。计数只在真的渲染出 hints 时才增加;召回路径
52
+ (`injectRecall`)记录 `recalled`,这是唯一能让标签留下的信号。
53
+ - **Added — `[Task State]` 当前状态行(任务模式)**:记忆回答「去过哪里」,构建/调试会话
54
+ 还需要「现在在哪」。任务模式在 Prompt **最末**注入一行
55
+ (`repo@branch · HEAD <sha7> · window 291k/1048k (host) · maintained 12m ago`):
56
+ HEAD 直接读 `.git/HEAD` + loose ref(**不 spawn git**,5 秒缓存),窗口压力取宿主上报值,
57
+ 硬上限 `context.statePointer.maxChars`(默认 300,超出截断加 `…`)。
58
+ 它排在所有易变段之后,前缀缓存不受影响。
59
+ - **Added — 任务 / 专家模式(`context.mode`)**:`task`(默认)启用上面两项;
60
+ `expert` 保留全部提示、不注入状态行、不咨询提示闭环。设置页「上下文窗口」新增
61
+ 运行模式下拉、静默阈值数字框与状态行开关;`context.mode` 也进了简洁模式白名单
62
+ (同一个开关在两种视图里都必须可改,否则等于骗人)。枚举校验:拼错直接 fail-fast。
63
+ - **Observability**:`capabilities.mode` 与 `capabilities.hints`(`tracked` / `silenced` /
64
+ `silencedTags`)进入 `/stats`;`/memory status` 显示运行模式、提示反馈统计与被静默的标签
65
+ ——「一个标签为什么不再出现」必须能从接口回答,而不是靠猜。
66
+ - **Tests**:`test/v171.mode.test.js`(7 例)锁定模式默认与枚举校验、8 次空手展示后的单向
67
+ 静默且 recall 不复活、静默跨重启持久、有 recall 的标签不被静默、专家模式不咨询闭环也不注入
68
+ 状态行、状态行硬上限与 HEAD 存在且排在最后、卫生剔除簿记却保留 854,668 那组教训数字、
69
+ 快照时间戳格式,以及真实交接下冷启动块既被清洗又保留结论半句。
70
+ 全量 **555/555**(87 个测试文件)。
71
+
7
72
  ## [1.7.0] — 2026-11-24
8
73
 
9
74
  **全链路记忆的第二半:写入侧去重(实体)、检索侧联想(1 跳)、语义侧分层(六维人格)、
@@ -64,1848 +129,1848 @@ and the project adheres to [Semantic Versioning](https://semver.org/).
64
129
  长期 0 次时直接建议 `/memory tools disable`。不新增任何模型请求。
65
130
  - **Tests**:新增 `test/v170.dimensions.test.js`(7 例)。全量 **548/548**(86 个测试文件)。
66
131
 
67
- ## [1.6.9] — 2026-11-22
68
-
69
- **全链路记忆机制:写入时归并、检索时联想、装配时只给指针。**
70
- 在 1.6.8 的「密文不写入」之后,这一版补上另外三处漏点——
71
- **标签会分裂**(`entity:红薯` 与 `entity:烤红薯` 各自成节点)、
72
- **联想靠自觉**(模型不主动 `recall` 就不会碰到相关记忆)、
73
- **上下文靠运气**(同一件事从不跨轮次自动进入 Prompt)。
74
-
75
- - **Added — 本地实体归并(零 Token,写侧)**:新增 `src/entityAlias.js`。`entity:` 标签在
76
- `stage()` 写入前先折名,三条判据按顺序:① 别名字典命中(`state/entity_alias.json`);
77
- ② **子串包含**——已有 `entity:红薯` 时写入 `entity:烤红薯` 直接折向较短的既有词;
78
- ③ **编辑距离**——相似度 ≥0.8 且长度差 ≤2 时归并(收拾拼写错误)。
79
- 折名记录写进事件的 `meta.entity_merged`(`{from,to,reason:'alias'|'substring'|'fuzzy'}`),
80
- `entity` 字段同步规范化。**修掉一个真根因**:`_resolveTags()` 原先用原始 tags 覆盖合并结果,
81
- 导致合并看似生效、实际仍分裂出新标签。
82
- - **Added — 别名字典(`state/entity_alias.json`,schema 1,原子写)**:`EntityAliasStore` 提供
83
- `load/map/list/resolve/learn/status`。索引构建期 `buildIndex()` 通过 `canonicalTag()` 再折一次,
84
- 所以**日志永远不被改写**:所谓「转移旧节点事件、删除空节点」,是索引重建后自然收敛,
85
- 原始记录仍在 `raw/` 与 `log/` 里可查。
86
- - **Added — Dream 学同义词**:`DreamEngine.learnAliases()` 取过去 24h 新增的 `entity:` 词,
87
- 发一个小的 JSON 请求让模型输出 `{"aliases":{"地瓜":"红薯"}}`,经
88
- `sanitiseAliasPairs(pairs, { known })` 过滤后写入字典——**只允许折向已存在的规范词**,
89
- 否则等于让模型凭空造节点。学完置 `markDirty()` + `invalidateAdjacency()`,下轮读取即生效;
90
- 它排在月记与 Dream **之后**,失败只记 `executeDream().entityAliasError`,绝不拖垮蒸馏。
91
- - **Added — 1 跳共现联想(严格 O(1))**:新增 `src/tagGraph.js`。`buildAdjacency()` 把
92
- `state/graph.json` 的共现边折成 `Map<tag,[{tag,weight}]>`(对称、权重降序、每点最多 8 邻居);
93
- `recall()` 命中查询标签后只做一次 `Map.get()` 取最强邻居——**不建队列、不记 visited,没有 BFS/DFS**。
94
- 联想语义条目按 `score × 0.5` 返回并标注 `association:{via,penalty,hops:1}`,
95
- `recall` 结果里的 `associative.{hops,tags,seeds,semantic}` 让「为什么带回了这条」可审计。
96
- `entitySeedsMentioned()` 会把**查询文本里直接出现的 entity 词**当种子,
97
- 所以 `entity:红薯` 不需要用户显式写标签也能触发联想。
98
- - **Added — `maxAssociativeHops` 硬上限 1**:`assertAssociativeHops()` 在 `recall()`、
99
- `_recallLocal()` 与工具入口**最先**执行(空索引也照样校验);`>1` 直接抛
100
- `MEM_E_INVALID_INPUT`(「associative recall is a single O(1) lookup, not a graph walk」);
101
- `0` 可关掉联想。**性能是契约,不是建议。**
102
- - **Added — 时间窗加成**:`policy.retrieval.recentWindowTurns`(默认 50)取最近 N 个事件的时间范围,
103
- 窗口内事件按贴近程度拿 **1.2x–1.5x**(`RECENT_BOOST_MIN/MAX`)。
104
- 因为 `timeBoost` 上限由 1.3 提到 1.5,剪枝上界 `PRUNE_BOUND_FACTOR` 同步 **3.9 → 4.5**
105
- (否则 `salience × 3.9` 不再是硬上界,早停会剪错)。
106
- - **Added — 自动指针注入(`context.autoInjectIndex`)**:默认
107
- `{ enabled: true, everyNTurns: 3, maxPointers: 3, maxChars: 300 }`(也接受布尔简写)。
108
- 插件就绪 / 会话切换即布防,**第一轮就**输出 `[Memory Index]` 段;此后每 N 个 user turn 重新布防。
109
- 行格式 `- [memory <eventId>] <tag> · <title>`——**只有指针,没有正文**,整段硬限 300 字符。
110
- 注入过的 eventId 进 `runtime.injection.ids` 去重池;活跃标签签名没变就不再重复注入。
111
- 这是「模型不会主动 recall 怎么办」的答案:不逼它调用工具,只把索引放到它眼前。
112
- - **Changed — 可配置 / 可观测**:`context.autoInjectIndex.{enabled,everyNTurns,maxPointers,maxChars}`
113
- 四个键进 `EDITABLE_CONFIG_KEYS`;`recall` 结果带 `associative` 与 `recentWindow`;
114
- `memory.status()` 暴露 `entityAliasStatus()` 与 `associativeStatus()`。
115
- - **Tests**:新增 `test/v169.fullchain.test.js`(6 例)——`烤红薯` 因子串包含折进 `红薯`;
116
- Dream 识别 `地瓜 → 红薯` 且重定向到索引、日志未被改写;查 `红薯` 带回 `吃饭` 的联想摘要且仅 1 跳;
117
- 近期记忆得分高于同权重旧记忆;`maxAssociativeHops > 1` 抛错、`0` 关闭;
118
- 首轮即注入指针、同会话不重复、标签未变仍不重复。
119
- 全量 **541/541**(85 个测试文件)。
120
- ## [1.6.8] — 2026-11-20
121
-
122
- **写侧护栏:拒绝高熵密文 / 加密载荷。** raw 日志与 L1 事件日志是本插件承诺「永远保留」
123
- 的两样东西,而密文块恰恰是唯一无法被召回(没有可搜索的子串)、无法被蒸馏(没有可说的
124
- 语义)、也无法被打标的载荷——它只会永久占用保留期与存储预算。这是审计项 A4,自
125
- 1.5.7 起挂着「文档已规划但代码未实现」,本版补上。
126
-
127
- - **Added — `src/entropy.js`**:纯函数检测器,零依赖。
128
- - `shannonEntropy(text)`:香农熵(保留 3 位小数)。
129
- - `detectCiphertext(text, { minRunChars })` → `null` 或
130
- `{ reason: 'pem'|'base64'|'hex', runLength, entropy, at, sample }`。
131
- - 三条判据各自有下限:base64 连续 ≥512 字符且熵 ≥4.5;hex 连续 ≥512 字符且熵 ≥3.5;
132
- PEM 甲壳(`-----BEGIN PGP MESSAGE-----` 等 5 种标记)**即使很短**也拒绝。
133
- - 保守优先:散文、源码、URL、Windows 路径、低熵长串、短 base64 data URI 全部放行。
134
- - **Added — `MEM_E_ENCRYPTED_RAW_REJECTED`**(`src/errors.js`),details 带
135
- `{ reason, runLength, entropy, at }`,调用方不必解析消息文本。
136
- - **Changed — 三条写路径统一护栏**:
137
- - `src/rawStore.js#capture`:在非空校验之后、门槛判定之前检测,**拒绝且零落盘**
138
- (不入队、不刷盘、分片里不会出现该载荷)。
139
- - `src/memory.js#remember`:同规则,且**先于**旧的 base64-media 守卫——对一个密文块,
140
- 叫调用方「改用 media_url」是错误建议,正确诊断是「这是密文」。
141
- - `src/memory.js#captureSessionEvent`:auto-capture 遇到密文时返回
142
- `{ stored: false, skipped: 'encrypted-blob', reason }`,**不作为 capture 失败刷警告**
143
- (会话里粘一段密钥不该让日志被 warn 淹没),其他错误仍照旧上抛。
144
- - **Tests**:新增 `test/v168.encrypted.test.js`(8 例):熵函数基准、7 类正常内容零误判、
145
- base64/hex/PEM 三判据各自的拒绝理由、raw store 拒绝且磁盘无残留、auto-capture 的 skip
146
- 语义、`remember()` 同规则且普通写入不受影响。全量 **541/541**(85 个测试文件)。
132
+ ## [1.6.9] — 2026-11-22
133
+
134
+ **全链路记忆机制:写入时归并、检索时联想、装配时只给指针。**
135
+ 在 1.6.8 的「密文不写入」之后,这一版补上另外三处漏点——
136
+ **标签会分裂**(`entity:红薯` 与 `entity:烤红薯` 各自成节点)、
137
+ **联想靠自觉**(模型不主动 `recall` 就不会碰到相关记忆)、
138
+ **上下文靠运气**(同一件事从不跨轮次自动进入 Prompt)。
139
+
140
+ - **Added — 本地实体归并(零 Token,写侧)**:新增 `src/entityAlias.js`。`entity:` 标签在
141
+ `stage()` 写入前先折名,三条判据按顺序:① 别名字典命中(`state/entity_alias.json`);
142
+ ② **子串包含**——已有 `entity:红薯` 时写入 `entity:烤红薯` 直接折向较短的既有词;
143
+ ③ **编辑距离**——相似度 ≥0.8 且长度差 ≤2 时归并(收拾拼写错误)。
144
+ 折名记录写进事件的 `meta.entity_merged`(`{from,to,reason:'alias'|'substring'|'fuzzy'}`),
145
+ `entity` 字段同步规范化。**修掉一个真根因**:`_resolveTags()` 原先用原始 tags 覆盖合并结果,
146
+ 导致合并看似生效、实际仍分裂出新标签。
147
+ - **Added — 别名字典(`state/entity_alias.json`,schema 1,原子写)**:`EntityAliasStore` 提供
148
+ `load/map/list/resolve/learn/status`。索引构建期 `buildIndex()` 通过 `canonicalTag()` 再折一次,
149
+ 所以**日志永远不被改写**:所谓「转移旧节点事件、删除空节点」,是索引重建后自然收敛,
150
+ 原始记录仍在 `raw/` 与 `log/` 里可查。
151
+ - **Added — Dream 学同义词**:`DreamEngine.learnAliases()` 取过去 24h 新增的 `entity:` 词,
152
+ 发一个小的 JSON 请求让模型输出 `{"aliases":{"地瓜":"红薯"}}`,经
153
+ `sanitiseAliasPairs(pairs, { known })` 过滤后写入字典——**只允许折向已存在的规范词**,
154
+ 否则等于让模型凭空造节点。学完置 `markDirty()` + `invalidateAdjacency()`,下轮读取即生效;
155
+ 它排在月记与 Dream **之后**,失败只记 `executeDream().entityAliasError`,绝不拖垮蒸馏。
156
+ - **Added — 1 跳共现联想(严格 O(1))**:新增 `src/tagGraph.js`。`buildAdjacency()` 把
157
+ `state/graph.json` 的共现边折成 `Map<tag,[{tag,weight}]>`(对称、权重降序、每点最多 8 邻居);
158
+ `recall()` 命中查询标签后只做一次 `Map.get()` 取最强邻居——**不建队列、不记 visited,没有 BFS/DFS**。
159
+ 联想语义条目按 `score × 0.5` 返回并标注 `association:{via,penalty,hops:1}`,
160
+ `recall` 结果里的 `associative.{hops,tags,seeds,semantic}` 让「为什么带回了这条」可审计。
161
+ `entitySeedsMentioned()` 会把**查询文本里直接出现的 entity 词**当种子,
162
+ 所以 `entity:红薯` 不需要用户显式写标签也能触发联想。
163
+ - **Added — `maxAssociativeHops` 硬上限 1**:`assertAssociativeHops()` 在 `recall()`、
164
+ `_recallLocal()` 与工具入口**最先**执行(空索引也照样校验);`>1` 直接抛
165
+ `MEM_E_INVALID_INPUT`(「associative recall is a single O(1) lookup, not a graph walk」);
166
+ `0` 可关掉联想。**性能是契约,不是建议。**
167
+ - **Added — 时间窗加成**:`policy.retrieval.recentWindowTurns`(默认 50)取最近 N 个事件的时间范围,
168
+ 窗口内事件按贴近程度拿 **1.2x–1.5x**(`RECENT_BOOST_MIN/MAX`)。
169
+ 因为 `timeBoost` 上限由 1.3 提到 1.5,剪枝上界 `PRUNE_BOUND_FACTOR` 同步 **3.9 → 4.5**
170
+ (否则 `salience × 3.9` 不再是硬上界,早停会剪错)。
171
+ - **Added — 自动指针注入(`context.autoInjectIndex`)**:默认
172
+ `{ enabled: true, everyNTurns: 3, maxPointers: 3, maxChars: 300 }`(也接受布尔简写)。
173
+ 插件就绪 / 会话切换即布防,**第一轮就**输出 `[Memory Index]` 段;此后每 N 个 user turn 重新布防。
174
+ 行格式 `- [memory <eventId>] <tag> · <title>`——**只有指针,没有正文**,整段硬限 300 字符。
175
+ 注入过的 eventId 进 `runtime.injection.ids` 去重池;活跃标签签名没变就不再重复注入。
176
+ 这是「模型不会主动 recall 怎么办」的答案:不逼它调用工具,只把索引放到它眼前。
177
+ - **Changed — 可配置 / 可观测**:`context.autoInjectIndex.{enabled,everyNTurns,maxPointers,maxChars}`
178
+ 四个键进 `EDITABLE_CONFIG_KEYS`;`recall` 结果带 `associative` 与 `recentWindow`;
179
+ `memory.status()` 暴露 `entityAliasStatus()` 与 `associativeStatus()`。
180
+ - **Tests**:新增 `test/v169.fullchain.test.js`(6 例)——`烤红薯` 因子串包含折进 `红薯`;
181
+ Dream 识别 `地瓜 → 红薯` 且重定向到索引、日志未被改写;查 `红薯` 带回 `吃饭` 的联想摘要且仅 1 跳;
182
+ 近期记忆得分高于同权重旧记忆;`maxAssociativeHops > 1` 抛错、`0` 关闭;
183
+ 首轮即注入指针、同会话不重复、标签未变仍不重复。
184
+ 全量 **541/541**(85 个测试文件)。
185
+ ## [1.6.8] — 2026-11-20
186
+
187
+ **写侧护栏:拒绝高熵密文 / 加密载荷。** raw 日志与 L1 事件日志是本插件承诺「永远保留」
188
+ 的两样东西,而密文块恰恰是唯一无法被召回(没有可搜索的子串)、无法被蒸馏(没有可说的
189
+ 语义)、也无法被打标的载荷——它只会永久占用保留期与存储预算。这是审计项 A4,自
190
+ 1.5.7 起挂着「文档已规划但代码未实现」,本版补上。
191
+
192
+ - **Added — `src/entropy.js`**:纯函数检测器,零依赖。
193
+ - `shannonEntropy(text)`:香农熵(保留 3 位小数)。
194
+ - `detectCiphertext(text, { minRunChars })` → `null` 或
195
+ `{ reason: 'pem'|'base64'|'hex', runLength, entropy, at, sample }`。
196
+ - 三条判据各自有下限:base64 连续 ≥512 字符且熵 ≥4.5;hex 连续 ≥512 字符且熵 ≥3.5;
197
+ PEM 甲壳(`-----BEGIN PGP MESSAGE-----` 等 5 种标记)**即使很短**也拒绝。
198
+ - 保守优先:散文、源码、URL、Windows 路径、低熵长串、短 base64 data URI 全部放行。
199
+ - **Added — `MEM_E_ENCRYPTED_RAW_REJECTED`**(`src/errors.js`),details 带
200
+ `{ reason, runLength, entropy, at }`,调用方不必解析消息文本。
201
+ - **Changed — 三条写路径统一护栏**:
202
+ - `src/rawStore.js#capture`:在非空校验之后、门槛判定之前检测,**拒绝且零落盘**
203
+ (不入队、不刷盘、分片里不会出现该载荷)。
204
+ - `src/memory.js#remember`:同规则,且**先于**旧的 base64-media 守卫——对一个密文块,
205
+ 叫调用方「改用 media_url」是错误建议,正确诊断是「这是密文」。
206
+ - `src/memory.js#captureSessionEvent`:auto-capture 遇到密文时返回
207
+ `{ stored: false, skipped: 'encrypted-blob', reason }`,**不作为 capture 失败刷警告**
208
+ (会话里粘一段密钥不该让日志被 warn 淹没),其他错误仍照旧上抛。
209
+ - **Tests**:新增 `test/v168.encrypted.test.js`(8 例):熵函数基准、7 类正常内容零误判、
210
+ base64/hex/PEM 三判据各自的拒绝理由、raw store 拒绝且磁盘无残留、auto-capture 的 skip
211
+ 语义、`remember()` 同规则且普通写入不受影响。全量 **541/541**(85 个测试文件)。
147
212
  - **Fixed — `/memory maintain` 的计数全是空的**:该命令把 `report.rawArchive.archived`
148
213
  与 `report.rawPrune.removed` 当数字插值,而它们其实是**数组**,于是输出成了
149
214
  `维护完成:;L2 合并 0 组;冷归档 个。`(分段用空数组拼出来就是空串)。现在统一走
150
215
  `count()`(数组取 length、数字取原值),并且只推入有内容的分段;本轮真的什么都没做时
151
216
  明确回答「本轮无变更」。新增回归用例(`test/v165.micokernel.test.js` 第 9 例)锁住
152
217
  「无空分段 + 冷归档必须带数字」。
153
- - **Docs**:`记忆插件-未完成表.md` 从「2026-11-05 待办审计」重写为「当前状态表」——
154
- A1–A21 逐项给出关闭依据,13 项关闭、2 项 superseded、2 项并入 M3/M6、4 项明确不做
155
- (并写明为什么不做),另列仍需外部动作的四项(npm 账号封控等)。
156
-
157
- ## [1.6.7] — 2026-11-17
158
-
159
- **发布链完整性修正 + 索引式提示注入(M1)。1.6.6 在 npm 上的制品(`gitHead 99a07cb`)
160
- 是从一份**旧 checkout** 发布的,只带来 Live Compact 修复,**不含** M3(测试跨包解耦)
161
- 与 M5(错误码边界)。1.6.7 把这两项送往 npm,并让仓库历史与已发布标签不再分叉;
162
- M1 则是本版的主线功能——每轮 Prompt 不再为记忆**正文**付费。**
163
-
164
- - **Added — 外部价格 / 通知接缝(M2)**。`dsh-price-tip` / `dsh-peak-runner` /
165
- `dsh-notify-plugin` 在本机**并不存在**,因此没有「接线真实 API」可做——凭空猜服务名
166
- 等于发明接口。本版只做**可验证的可选接缝**:
167
- - `HostBridge.setNotifier(sink)` + `notify({title,text,kind,at})`:没有 sink 时返回
168
- `{delivered:false, reason:'no-notifier'}` 并只记计数,**绝不发明投递通道、绝不抛错**;
169
- sink 抛错也只记 `sink-error`,不会污染维护流程。
170
- - `index.js` 探测一组**约定键**(`priceTip` / `notifier` / `peakRunner`,或 `notify` / `peak`),
171
- 并接受多种方法形状(`isLowValley|lowValley|isLow|price`、`notify|send|post`、
172
- `isPeak|peak|isHigh`)。外部价格服务优先于内置时间窗;`DSH_DREAM_PRICE` 仍可强制覆盖。
173
- - `capabilities.externalSeams` 报告**哪条接缝真的接上了**(`{wired, source}`),
174
- 所以「没装」是可见事实而不是静默降级。
175
- - 一旦通知接缝可用,「Dream 因高峰被推迟」会通过它播报(内含 `dueAt`);没有接缝时
176
- 这件事仍由持久化队列与 `dream-deferred` 事件表达,行为不变。
177
- - **排队本来就是实装的**:`index.js` 的 `tick()` 在高峰把 LLM 蒸馏写入 `dreamQueue`
178
- 并在谷时唤醒(`reason: 'peak-hour'`),不是丢弃,本次未改动该逻辑。
179
- - **Changed — 多空间开关的语义澄清(M6)**。`features.multiSpace` 默认 `true`,但只有注入了
180
- 能创建空间适配器的 `orchestrator` 服务时才真正生效——以前这个差异是**静默**的:
181
- 用户以为开了多空间,实际在跑单空间。现在新增 `multiSpaceReason()`,返回
182
- `'active'` / `'disabled-by-config'` / `'orchestrator-missing'` 三态,
183
- 通过 `capabilities.multiSpaceReason` + `capabilities.multiSpaceRequested` 与
184
- `panel.spaces.{requested,reason}` 同时暴露,设置页在多空间卡片里直接写明
185
- 「当前被配置关闭:features.multiSpace=false」,不再把「没装适配器」和「你关了它」
186
- 混成一个 `spaces:false`。**开关本身没有改默认值**(改默认会静默改变已部署 profile 的行为),
187
- 改的是可观测性与文档;并有用例锁住「布尔值与理由不可能互相矛盾」。
188
- - **Changed — 索引式提示注入(M1)**。`context.injectMode` 新增两个取值:
189
- - `index`(**新默认**):每个记忆块只注入一行指针
190
- `- [memory <eventId>] 标签 · 标签 · 标题`。正文不进 Prompt,需要细节时用
191
- `memory_recall` 按 eventId / 标签取。`[Memory Blocks]` 标记名保持不变,因此缓存前缀
192
- 语义不变;规则段多一行「这些是索引指针,正文须调 recall」,**只在 index 模式下出现**。
193
- - `full`:沿用旧版渲染(正文前 200 字)与旧版计费(整段正文),一行代码即可回退。
194
- - **窗口计费随渲染形态走**:`ContextEngine.tokensOf()` 在 index 模式下只计指针行,
195
- 在 full 模式下仍计整段正文(旧口径,不动既有调优);调用方**显式传入的 `tokens`
196
- 永远优先**,折叠与驱逐的排序不变。
197
- - `index` 模式下 `tokens()` 的实测差异是数量级的:8,000 字符的正文约 2,000 tokens,
198
- 指针行通常 < 60 tokens。
199
- - `briefing` 块(运营方钉死的策略)**永不降级为指针**,始终整段渲染。
200
- - 可编辑键新增 `context.injectMode`(`index` / `full`,非法值 fail-fast),设置页
201
- 「上下文窗口」卡片新增下拉;简洁模式下同样可见可存。
202
- - **Changed — 测试与兄弟包解耦(M3)**。`test/orchestrator.js` 先按包名 `dsh-layers-orchestrator/src/*`
203
- 解析、失败再退回同级 checkout(`via: 'package' | 'sibling'`);22 个真正依赖多空间的用例改走
204
- `orchestratorTest()`,缺包时注册为 **skipped 并带原因**而不是 import 阶段崩掉整套测试。
205
- `makeMemory()` 的 `multiSpace` 默认值改为 `MULTI_SPACE_AVAILABLE`,杜绝 `new null()`。
206
- 实测:两包在位 **510/510**(skipped 0);单独 checkout 时 **454 pass / 0 fail / 56 skipped**。
207
- - **Changed — 错误码边界(M5)**。`dsh-orchestrator` 内两套命名空间是**故意**并存的:
208
- `MEM_E_*`(从核心搬出去的引擎沿用,客户端 HTTP 映射依赖它)与 `ORCH_E_*`(路由器/去重/联邦/授权)。
209
- 海马体侧新增单一边界 `src/errors.js#fromOrchestratorError()` + `ORCHESTRATOR_CODE_MAP`:
210
- `ORCH_E_CONSENT_*` → `MEM_E_REQUIRE_USER_CONSENT`(三个都映射到同一处,因为修法是去问人而不是重试)、
211
- `ORCH_E_SPACE_INVALID` → `MEM_E_SPACE_INVALID`、`ORCH_E_INVALID_INPUT` → `MEM_E_INVALID_INPUT`、
212
- `ORCH_E_NOT_READY` → `MEM_E_NOT_READY`、`ORCH_E_FEDERATION_CONFLICT` → `MEM_E_FEDERATION_FAILED`;
213
- **未列入的 `ORCH_E_*` 不会被拍平成 `MEM_E_IO`**,原始码保留在 `details.orchestratorCode` 里可审计。
214
- 映射表同步写进 `dsh-orchestrator/README.md` 的「错误码边界」一节。
215
- - **Tests**:新增 `test/v166.errorContract.test.js`(7 例)与 `test/v167.m1.test.js`(9 例:
216
- 默认 index、指针行构成、index 计费 = 渲染行、full 保留旧渲染与旧计费、显式权重优先、
217
- briefing 不降级、标题截断与回退、`injectMode` 校验与可编辑、规则段只在 index 出现、
218
- recall 命中把标签与标题带进窗口且正文尾巴不出现);
219
- `test/v156.features.test.js` 新增 M6 用例(`multiSpaceReason` 三态 + 显式关闭优先于
220
- 缺适配器 + 「布尔值与理由不可能矛盾」的交叉断言);
221
- `test/v167.m2.test.js`(6 例)锁住 M2 接缝:无 sink 时为 `no-notifier` 的记账型空操作、
222
- sink 收到 payload 且被计数、sink 抛错只记 `sink-error` 不外溢、`externalSeams()` 如实报告
223
- 「通知与高峰缺席、价格回退本地时间窗」、注入 `notifier` 服务后被自动发现并可用、
224
- 注入 `priceTip` 后外部价格**优先于**本地时钟窗口。
225
- 全量 **541/541**(85 个测试文件)。
226
-
227
- ## [1.6.6] — 2026-11-16
228
-
229
- **发布修正版:1.6.5 在 npm 上发布的是「每轮请求都裁剪工具结果」的版本——那个把上下文
230
- 从 10% 悄悄缩到 7% 的缺陷没有随任何已发布制品走出去。1.6.6 补上这条修复。**
231
-
232
- > **发布实况(事后核对)**:1.6.6 的 npm 制品 `gitHead 99a07cb` 来自旧 checkout,
233
- > **只含**下面的 Live Compact 修复——M3 与 M5 当时已在主线上、但没有进这个 tarball。
234
- > 那两项随 **1.6.7** 发出。本地 `v1.6.6` tag 已指向 `99a07cb`,与 npm/GitHub 一致;
235
- > `99a07cb` 也已并入 `main` 历史,发布可追溯。
236
- > 1.6.5 同理不可覆盖(`gitHead 28776c7`),其 tag 亦指向该提交。
237
-
238
- - **Fixed — 上下文在每轮请求里被悄悄缩水("从 10% 直接掉到 7%")**。
239
- `guardRequest` 曾在**每一次** `agent/request` 上调用宿主的 `toolResultPruner.pruneSession()`。
240
- 宿主的 `pruneContent()` 用的是**预设预算**(ptc 预设 `thresholdChars: 8192` → 4k 头 + 1k 尾),
241
- 而且它**只在 `compaction-basic` 的 `context-overflow` 分支里**才被调用——我们把「溢出时裁剪」
242
- 变成了「每轮都裁剪」,一次 pass 就能掉约 80k tokens。
243
- 现在 Live Compact **只跑本插件自己的保守策略**(`context.liveCompact`,默认 200,000 字符阈值 /
244
- 4,000 头 / 2,000 尾 / 每请求最多 4 个节点),不再委托宿主 pruner;
245
- 回归用例 `the guard never rewrites an ordinary tool result on a healthy request`
246
- 断言宿主 pruner 在健康请求上**一次都不被调用**。
247
- - **Tests**:`test/v164.windowGuard.test.js` 增加上述回归用例(12 例)。全量 **503/503**(79 个测试文件)。
248
-
249
- ## [1.6.5] — 2026-11-15
250
-
251
- **回归微内核:引擎只负责存储、检索与蒸馏,绝不驱动对话;蒸馏只有一个总调度器;
252
- 面板的全部能力收进 `/memory` 指令集,且不花一分模型 Token。**
253
-
254
- - **Added — `/memory` 指令集(0 Token)**。四条子命令通过宿主的 `commands` 服务注册,
255
- `commands.execute()` 的语义是「parse and execute a known command **without sending it
256
- to the model**」,因此不产生任何模型请求(测试用 `fetch` 计数断言为 0):
257
- - `/memory resume`:拉取上一次交接摘要并**强制重新注入**当前上下文。它绕过「每会话
258
- 每交接批次只注入一次」的去重(`armColdStartNow()` 先删掉该 `session|epoch` 的投递
259
- 记录再布防),所以用户可以随时把摘要拉回来;没有交接时明确回「没有可恢复的交接摘要」。
260
- - `/memory maintain`:立即触发一次后台维护(索引重建 / 月记 / L2 合并 / Dream / 冷归档),
261
- 回报各阶段计数;已在运行时直接拒绝而不是排队。
262
- - `/memory status`:事件数、L3 摘要数、活跃标签列表、会话 token 与窗口来源
263
- (`host`/`config`/`default`)、静默状态、冷启动队列长度。
264
- 这些数字全部取自面板同一份契约(`panel.global.*` + 索引快照的活跃集合),
265
- 不再各自拼字段——早期实现读错了契约,导致整行显示成 `?`。
266
- - `/memory mute` / `/memory unmute`:紧急静默 `[Memory Hints]`。静音时**不消费标签**,
267
- 所以解除后提示会原样回来,而不是被会话级去重池吃掉。
268
- - **Fixed — 月记与 Dream 重复咀嚼同一批日记**。L2.5 月记原本挂在 `maintain()` 上,与
269
- Dream 各走各的调度,同一条 L2 日记可能先被压进月记、再被按标签蒸馏一次。
270
- 现在 **`executeDream()` 是唯一的蒸馏总调度器**:先跑月记(只处理已结束的自然月),
271
- 再让 Dream 处理剩下的材料。被月记吸收的事件 id 记入 `state/months.json` 的
272
- `promoted` 映射(即 `promoted_to_monthly`),`DreamEngine.collectGroups()` 直接跳过,
273
- 并在报告里给出 `skippedPromoted` 计数。
274
- **为什么不写进事件本身**:raw 日志是 append-only 的唯一真相源,永不改写;标记放在
275
- 派生状态里,语义等价且可重建。
276
- - **Added — 原子服务接口 `getLatestHandoffSummary()`**。`ctx.get('hippocampus')
277
- .getLatestHandoffSummary()` 返回 `{ active, state, at, sessionId, summaryEventId,
278
- agentPreset, tailTurns, text, found }`,纯读:不装配 prompt、不消费 marker、不产生副作用。
279
- 外部路由插件想自己决定「什么时候续上、怎么展示」时用它,而不是去解析提示词。
280
- - **Changed — 微内核边界**。引擎半侧(`index.js` + `src/**`)不含任何宿主 UI 或追加模式
281
- 监听:`autoNewSession` 整链已在 1.6.3 删除,本次用测试把这条边界**锁死**——源码扫描
282
- 禁止出现 `uiWorkspace` / `startSession(` / `sessionStorage` / `appendMode` /
283
- `onSlot(` / `slots.register(` / `ctx.slots =`。会话控制交给外部路由插件。
284
- - **Fixed — 上下文在每轮请求里被悄悄缩水(“从 10% 直接掉到 7%”)**。1.6.4 的
285
- `guardRequest` 在**每一次** `agent/request` 上都把宿主 `toolResultPruner.pruneSession()`
286
- 委托执行了一遍。两处都错:
287
- - 宿主用的预算是 **预设自己的**(ptc: `thresholdChars 8192` → 留 4k 头 + 1k 尾),
288
- 于是一次普通的 20 KB 文件读取在下一次请求就被腰斩;
289
- - 宿主自己只在 compaction-basic 的 `context-overflow` 分支里调它
290
- (`this.ctx.get('toolResultPruner')?.pruneSession(agent.session)`),
291
- 「溢出时裁剪」被我们变成了「每一轮都裁剪」。实测一次 pass 可掉 **~80k tokens**。
292
- 现在 Live Compact **只跑我们自己的保守裁剪**:单条 `tool/result` 超过
293
- `context.liveCompact.thresholdChars`(默认 200,000 字符)才指针化,头部 4k / 尾部 2k
294
- 原样保留、中间换成 `deep_raw` 可取回的指针行。健康的对话**永远不会被改写**——
295
- 宿主压缩链路的裁剪仍由宿主在真溢出时负责。
296
- 新增回归用例锁定:请求里即使注入了假 `toolResultPruner`,`pruneSession` 的调用次数也必须为 0,
297
- 且一条 20k 字符的正常结果不产生任何 surface 改写。
298
- - **Tests**:新增 `test/v165.micokernel.test.js`(8 例):`/memory` 注册与全部子命令返回
299
- 纯文本、**网络调用数为 0**、静默真的不注入提示、`resume` 在无交接时明确报错且服务接口
300
- 与它同源、`executeDream()` 先跑月记并把日记标进 `promoted`、`maintain()` 不再产出月记、
301
- 已晋升日记在下一轮仍被排除、以及上面那条「无 UI/追加模式监听」的源码扫描。
302
- `test/flow.test.js` 与 `test/v156.federation.test.js` 的月记断言随调度器迁移改为
303
- `executeDream()`。全量 **502/502**(80 个测试文件)。
304
-
305
- > **发布说明**:1.6.5 发布到 npm 的制品(`gitHead 28776c7`)**不包含**上面那条 Live Compact
306
- > 修复——它是在 1.6.5 发布之后才提交的。该修复进入 **1.6.6**;M3 与 M5 实际进入 **1.6.7**
307
- > (1.6.6 的制品同样来自旧 checkout,只含 Live Compact)。
308
-
309
- ## [1.6.4] — 2026-11-14
310
-
311
- **修复 1M 上下文溢出(`CONTEXT_WINDOW_EXCEEDED`):交接判定的分母、分子与状态机三处
312
- 同时失效,外加单轮超大工具输出没有任何熔断。这是一次独立的安全发版——1.6.3 从未
313
- 发布过,它的全部内容已并入本版。**
314
-
315
- - **Fixed — 分母错源:接入宿主真实模型窗口**。新增 `src/context/windowGuard.js` 的
316
- `resolveWindow()`:**宿主适配器上报的窗口优先**(`llm.resolveModelInfo().context.contextWindow`,
317
- 也接受 `tokenMeter.contextPressure().contextWindow`),`context.nativeTokenLimit` 降级为
318
- 用户覆盖,只在宿主不可用时兜底。`panel.session.windowSource` 暴露本次用的是
319
- `host` / `config` / `default`,事后可审计。此前本机 profile 写的 `8000` 被当成模型窗口,
320
- 模型真实窗口是 **1,048,576**。
321
- - **Fixed — 分子不再靠猜:`used + reserved` 公式**。判定改为
322
- `used_tokens + reserved_completion_tokens >= window × threshold`。
323
- 已用优先取宿主 `tokenMeter` 的测量值(含系统提示、工具 schema、历史重放),
324
- `Math.ceil(字符数 ÷ 4)` 的自估降为下限;`reserved` 取本次请求真实的 `maxTokens`
325
- (默认 256,000)。事故数字 854,668 + 256,000 = 1,110,668 > 1,048,576 现在能直接判出来。
326
- - **Fixed — Fail-Fast 兜底**。新增 `agent/request` 中间件:拿到最终请求配置后重新判定,
327
- **必定放不进窗口的请求在本地就被拦下**,抛 `MEM_E_CONTEXT_EXCEEDED`,details 里带
328
- `usedTokens / reservedTokens / projectedTokens / window / windowSource / ratio`,
329
- 并明确写出 “Nothing was sent to the provider”。宿主缺少 `llm` / `tokenMeter` 服务时
330
- **绝不阻断**(降级为原有行为)。
331
- - **Fixed — 交接状态机死锁(“80% 了却不交接”)**。`checkHandoff()` 里
332
- `if (marker.active) return base;` 会让首次交接后的同一会话**永远**不再交接
333
- (1.6.3 移除自动开新会话后,session id 不再变化,marker 就永久 active)。
334
- 改为 `rehandoffDecision()`:同会话压力再涨 ≥5 个百分点(`pressure-growth`)或投影
335
- ≥95% 硬上限(`near-hard-limit`)时清掉旧 marker 重新蒸馏;不同会话仍走原有消费路径。
336
- - **Added — Live Compact:单轮超大工具输出熔断**。新增 `src/context/liveCompact.js`:
337
- 单个 `tool/result` 的文本超过 `context.liveCompact.thresholdChars`(默认 200,000 字符)时,
338
- 保留头 4,000 / 尾 2,000 字符,中间压成一行指针
339
- (`[[hippocampus:live-compact: removed N chars … (seq=…, call=…, tool=…)]`),
340
- 原文仍可用 `deep_raw` 取回。走宿主 surface 协议
341
- (`append('compaction/prune')` + `append('tool/result', { surfaceOp: { op: 'replace' } })`),
342
- 宿主自带 `toolResultPruner` 时优先委托给它。指针化按 code point 切,不会劈开代理对。
343
- - **Tests**:新增 `test/v164.windowGuard.test.js`(11 例)锁定本次修复:宿主窗口优先于配置覆盖、
344
- 引擎 `windowSource` 可审计、`used + reserved` 判定(含那组真实数字 854,668 + 256,000)、
345
- `nativeState` 优先采用宿主测量值、`rehandoffDecision` 的四种判定、
346
- 超大工具结果的指针化(含代理对不被劈开、`surfaceOp replace` 的实际形状)、
347
- 同会话内 marker 仍 active 时 `checkHandoff` 会续交、以及
348
- `guardRequest` 在「必超限」时抛 `MEM_E_CONTEXT_EXCEEDED` / 在「放得下」时放行 /
349
- 在没有宿主服务时绝不阻断(降级为原有行为)。
350
- 全量 **494/494**(79 个测试文件)。
351
-
352
- ## [1.6.3] — 2026-11-13
353
-
354
- **配置加载器加固:把 1.6.2 的“旧配置启动阻断”事故固化为引擎能力——先迁移、再严格校验、
355
- 必要时安全降级,绝不让 DSH 客户端卡在“正在启动…”。**
356
-
357
- - **Added — 冷启动注入可观测性**:`/stats` 新增 `coldStart{ pending[], injected, lastSessionId }`,
358
- `panel.startup` / `panel.configVersion` / `panel.configWarnings` 与
359
- `CAPABILITIES.startup` 同源(此前 `toMemoryOptions()` 没把迁移结果传给引擎,panel 报
360
- `migrated:false` 而 capabilities 报 `true`)。
361
- - **Fixed — 复习队列只报不消费(积压到 337 条)**:`maintain()` 现在按
362
- `review.consumeBatchSize`(默认 40,上限 200/轮)分批消费到期行,批间
363
- `await setImmediate` 让出主线程;每批一次 `reviews.advanceMany()` 落盘(不是每条一次写),
364
- 并对该批做一次 `reinforce` 权重强化。`review.autoConsume` 可整体关闭。
365
- - **Fixed — 1.6.2 遗留的两个启动/保留缺陷**:旧 profile(`retentionDays: 30` 且没有
366
- `archiveAfterDays`)由 `migrateConfig` 派生 `29` 而不是启动失败;`prune()` 现在也会按
367
- 月清理过期的 `.jsonl.br/.zst/.gz` 冷归档(此前只删明文,归档变相突破保留期)。
368
-
369
- - **Added — 配置 schema 版本与迁移机制**:`src/config.js` 新增
370
- `CONFIG_SCHEMA_VERSION = 3`;配置对象可携带 `configVersion`。加载顺序变为
371
- **`migrateConfig()` → 严格校验**:迁移阶段只做“补值 + 告警”,从不抛错,也绝不覆盖
372
- 用户显式写下的值。缺少 `configVersion` 的旧配置被视为 legacy(`fromVersion: 0`)并
373
- 升级到当前版本。
374
- - 首次落地的迁移规则:`raw.archiveAfterDays` 缺失且
375
- `raw.retentionDays <= 新默认值(90)` 时,派生为 `Math.max(1, retentionDays - 1)`
376
- (即 30 → 29),从而满足 `archiveAfterDays < retentionDays` 的硬约束。
377
- - 每条迁移都写入 `console.warn`(前缀 `hippocampus/config-migration:`)并携带在
378
- `config.warnings` 里,`apply()` 再经 `ctx.logger.warn` 输出一次——**迁移永不被静默**。
379
- - 空配置 `{}` 视为“使用默认值”,不算 legacy,因此内部调用不会产生噪声告警。
380
- - **Added — `strictStartup`(默认 `true`)启动安全网**:显式设为 `false` 时,若严格校验
381
- 抛出 `MEM_E_CONFIG_OUT_OF_RANGE`,引擎会丢弃该越界键、回退到安全值并继续启动,同时
382
- 置 `config.startup.degraded = true`、记录 `degradedReason{code,key,message}`、
383
- 输出 `hippocampus/config-degraded:` 警告,并在 `apply()` 里额外 warn
384
- `STARTED DEGRADED (strictStartup=false)`。
385
- - 降级**只**覆盖越界值:`MEM_E_CONFIG_INVALID_TYPE` / `MEM_E_CONFIG_UNKNOWN_KEY`
386
- 仍然 fail-fast(拼写错误不该被宽容)。
387
- - `strictStartup` 自身必须是布尔值。
388
- - **Added — 启动状态进入可观测面**:`CAPABILITIES.startup` / `CAPABILITIES.configVersion`
389
- 与 `memory_admin action=status` 的 `panel.startup` / `panel.configVersion` /
390
- `panel.configWarnings`。设置页与运维方可以直接看到“这份配置来自哪个 schema 版本、
391
- 是否迁移过、是否降级启动”。
392
- - **Added — 设置页「简洁模式」(纯显示层)**:设置页顶部新增“简洁模式 / 专业模式”切换。
393
- 简洁模式只渲染四块——**身份、上下文窗口、系统级存储位置迁移、原始回合留存(raw)**;
394
- raw 卡内再收敛为三项(`raw.mode`、`raw.maxTotalMb`、`raw.compressionEngine`),
395
- 最小显著度 / 保留期 / 冷压缩阈值 / deep_raw 扫描上限全部隐藏。
396
- - 隐藏是**纯 UI 行为,不碰配置值**:保存时 patch 被过滤为
397
- `SIMPLE_PATCH_KEYS`(9 个可见键),文件里未显示的项保持原值;新装即默认值,
398
- 专业模式下调过的不会被简洁模式覆盖。
399
- - 校验同步收敛:只检查可见数字键,隐藏项的越界值不会阻断保存,Cron 非空检查也跳过。
400
- - 模式偏好存浏览器 `localStorage`(键 `hippocampus:settings-mode`),不进插件配置、
401
- 不影响引擎行为;读写失败一律退回专业模式。
402
- - **Removed — 交接时“自动开启新会话”(`context.autoNewSession*`)**:交接就发生在对话
403
- 中间,宿主会在标记后**继续同一个对话**;客户端再调 `uiWorkspace.startSession()` 只会
404
- 额外弹出一个空对话,在“追加到原对话”的用法下毫无意义还打断体验。因此彻底移除:
405
- - 配置层:`autoNewSession` / `autoNewSessionPoll` / `autoNewSessionIntervalSeconds`
406
- 三个键从 `DEFAULT_CONFIG`、校验、resolved 与 HTTP 可编辑白名单中删除。
407
- - `migrateConfig` 会**静默剥离**旧 profile 残留的这三个键并 warn(否则老用户会撞上
408
- 未知键阻断启动)。
409
- - 可观测面:`CAPABILITIES.autoNewSession` 与 `handoffView().autoNewSession` 删除。
410
- - 客户端:三个设置控件、`startAutoNewSession()` 轮询器与其 `ctx.effect` 注册全部删除;
411
- 设置页不再渲染任何“自动开新会话”开关。
412
- - **Fixed — 新对话拿不到交接摘要与前几轮原话**(2026-11-13 用户报告):
413
- - 根因:冷启动注入是一个**进程级一次性布尔** `coldStartPending`,被**第一个组装
414
- prompt 的 agent** 抢先消费(子代理、标题生成等),用户真正的新对话拿到的是空。
415
- - 改为**按会话幂等**:`runtime.coldStart = { pending: Map, injected: Set, lastSessionId }`,
416
- 以 `session|handoffEpoch` 为键;`noteColdStart()` 在「新 session id 的首个
417
- `session/event`」与「`agent/created`」两处布防(同键复用、已被注入过的直接跳过、
418
- 过期 5 分钟未消费自动丢弃、最多 8 条 pending 有界淘汰),
419
- `promptState(assemblyContext)` 用宿主传给 `systemPrompt.context` 的
420
- `assemblyContext.agent.id` 与当前 session id 做匹配,注入后写入 `injected` 集合并
421
- 有界淘汰(64)。**兄弟 agent 先装配不会再吞掉用户的注入**——这是单槽位实现仍会
422
- 踩的坑:标题生成器或子代理随后布防会覆盖并且消费掉用户的那一条。
423
- - `handoff.json` 标记新增 `tailTurns`:交接蒸馏时把最后 5 轮(role + 文本,每条
424
- ≤400 字,内存环形缓冲 12 条、跨会话自动清空)写进标记;
425
- `[Previous Context Tail]` 优先回放这些**原话**(`- user: …` / `- assistant: …`),
426
- 没有 tailTurns 时才回退到最近业务事件。
427
- - `context.coldStartInjectRecentTurns` 默认由 `false` 改为 **`true`**:只给摘要会让
428
- 新对话接不上具体语境。
429
- - 即使两个开关全关,匹配到的 pending 也会被消费掉,不会遗留到下一次无关会话。
430
- - **可观测**:`/stats` 新增 `coldStart{ pending[], injected, lastSessionId }`(`runtime.coldStartView()`),
431
- 运维方不必读 prompt 就能区分“已布防未装配”与“已注入”。
432
- - **`panel.startup` / `panel.configVersion` / `panel.configWarnings` 与 `capabilities.startup`
433
- 对齐**:此前 `toMemoryOptions()` 没有把迁移结果传给引擎,panel 报的是“未迁移”默认值,
434
- 而 capabilities 报的是真相——同一个进程两处说法不一致,现由 `toMemoryOptions` 一并透传。
435
- - **Fixed — 复习队列只报不消费(积压到 337 条)**:`maintain()` 里
436
- `ReviewSchedule.tick()` 的结果只被写进报告,**从来没有人推进它**,于是新装用户的
437
- `state/reviews.json` 里每条都是 `lastAt: null`、`dueAt` 停在初始间隔,队列只增不减
438
- (现场:`total 346 / due 337`)。两个后果:复习面板永远是“全到期”,且 recall 拿不到
439
- 强化锚点——衰减曲线相当于“写下之后从未被碰过”。
440
- - 现在 `maintain()` 会真正消费到期行:`_consumeDueReviews()` 取出到期 id,
441
- **分批**(默认 30–50 条,`review.consumeBatchSize = 40`)调用批量 `reinforce()`
442
- (权重 1,日志即锚点,不改任何字段),再用 `ReviewSchedule.advanceMany()` 一次性
443
- 推进 `lastAt` / `step` / `dueAt`。
444
- - **性能防线**:每批之间 `await new Promise(setImmediate)` 让出事件循环,HTTP 路由与
445
- prompt 组装不会被一个巨大积压卡住;单次维护总量上限 `review.consumeMaxPerRun = 200`,
446
- 再多就跨多次维护轮次排空(报告里的 `remaining` 说明还剩多少)。
447
- - **一次文件写/批**:新增的 `advanceMany()` 把“逐条 advance = 每条一次读+一次原子写”
448
- 变成“整批一次”,337 条积压不再是 337 次 fsync。
449
- - 开关:`review.autoConsume`(默认 `true`)可关;`review.enabled: false` 时不会消费。
450
- 失败的批次不中断维护(`lastAt` 保持 null,下一轮自然重试),错误写进
451
- `report.reviewConsumeError`。三条新键均进入 HTTP 可编辑白名单。
452
- - **Fixed — 1.6.2 遗留的两个启动/保留缺陷(随 1.6.3 一并锁定)**:
453
- - **旧 profile 启动阻断**:旧配置只写 `raw.retentionDays: 30`、没有 `archiveAfterDays`,
454
- 而 1.6.2 的新默认值是 90,硬校验 `archiveAfterDays < retentionDays` 直接抛错,
455
- `apply()` 失败 → 插件整体不注册 → `/api/hippocampus/*` 全部 404,设置页永远停在
456
- “正在启动…”。现在 `migrateConfig()` 在**未显式配置**且冲突时自适应派生
457
- `Math.max(1, retentionDays - 1)`(30 → 29)并告警;**显式**写下越界值仍然 fail-fast。
458
- - **`.jsonl.br` 冷归档永不清理**:`prune()` 原先只删明文分片,Brotli/Gzip/Zstd 归档
459
- 变成“保留期之外的永久副本”,等于变相突破 `retentionDays`。现在 `prune()` 按
460
- `cutoffMonth` 整月删除过期归档,并同步从 `state/raw-archive.json` 抹掉记录
461
- (返回 `removedArchives`)。
462
- - **Tests**:`test/v163.migration.test.js`(9 例)锁定本次教训——旧配置(仅
463
- `retentionDays: 30`)可启动且 `archiveAfterDays` 派生为 29;显式冲突在
464
- `strictStartup: true` 下阻断、在 `false` 下降级启动;降级不吞类型错误与未知键;
465
- 以及 1.6.2 生产 profile 的原始形状可被完整解析。`test/helpers.js` 的夹具改走同一
466
- 迁移步骤,`test/status.test.js` 的 panel 形状契约同步新增三个字段。
467
- `test/v163.ui.test.js`(5 例)锁定简洁模式契约:`Section` 的 `hidden` 短路、
468
- 14 个专业模式卡片全部带 `hidden: simpleMode`、raw 只剩三项、保存与校验按白名单收敛。
469
- `test/v163.reviewQueue.test.js`(5 例)锁定复习消费契约:到期行被消费且 `step`/`lastAt`
470
- 前进、强化记录数 == 消费数、超出单轮预算的积压跨轮次排空、`autoConsume:false` 不动队列、
471
- 整批只写一次 `reviews.json`。
472
- `test/v156.autoSession.test.js` 重写为「该功能已移除」契约(配置无该键、旧 profile
473
- 迁移剥离、路由/能力面不暴露、客户端无轮询器);
474
- `test/v160.coldStart.test.js` 重写为按会话注入契约(无标记不布防、摘要+尾部各一次、
475
- 兄弟 agent 先装配不吞注入、两个会话各注入一次、**两条 pending 先布防后装配也各得其份**、
476
- 双关不遗留 pending、tailTurns 优先、stats 暴露 coldStart 状态)。
477
- 全量 **483/483**(78 个测试文件)。
478
-
479
- ## [1.6.2] — 2026-11-11
480
-
481
- **补丁版:修复冷数据归档与保留期的时间冲突,并把“打破日志线性增长”的三层机制并入正式记录。**
482
-
483
- - **Fixed — 设置页卡在“正在启动…”并报 `MEM_E_NETWORK: HTTP 404`**(2026-11-13):
484
- 1.6.2 的强校验 `archiveAfterDays < retentionDays` 与**旧 profile**(`raw.retentionDays: 30`、
485
- 从未写过 `archiveAfterDays`)冲突,`apply()` 抛 `MEM_E_CONFIG_OUT_OF_RANGE`,插件根本没加载,
486
- 所有 `/api/hippocampus/*` 路由缺失 → UI 永远 404。现在:
487
- - `archiveAfterDays` **未被显式配置**时按 `retentionDays - 1` 派生,并置
488
- `raw.archiveAfterDaysDerived: true`(旧 profile 可直接启动);
489
- - **显式**给出越界的 `archiveAfterDays` 仍然 fail-fast(配置错误不该被静默原谅)。
490
- - **Fixed — 归档文件不受 retention 约束**:`prune()` 原来只删 `.jsonl` 明文分片,`.jsonl.br`
491
- 归档会永久堆积,等于变相突破保留期。现在整月归档的末日晚于 cutoff 才保留,否则连
492
- `state/raw-archive.json` 记录一起删除,返回 `removedArchives`。
493
-
494
- - **修复冷数据归档时间冲突**:冷归档阈值与 TTL 保留期原本互相挤压(`archiveAfterDays` 与
495
- `retentionDays` 同为 30/90 量级,冷分片常在归档前就被 TTL 删除)。现在默认值上调为
496
- `archiveAfterDays: 90`、`retentionDays: 365`,并保留 fail-fast 校验
497
- (`archiveAfterDays` 必须严格小于 `retentionDays`),同时新增 `raw.coldAccessWindowDays: 90`,
498
- 也就是“近 90 天零访问”才允许归档。
499
- - **实施多档保留策略(含遗忘性保存与全保存)**:raw 层保留谱系落地为
500
- `raw.mode: off | salience | all` ——
501
- `off` 为不保存(遗忘性保存,仅保留 L1 之上的记忆)、`salience` 为默认的高价值保存、
502
- `all` 为全保存(受 `maxTurnKb` / `maxBytesPerDay` / `maxTotalMb` 预算约束);
503
- 另加 `raw.distillPrune`(默认 false):蒸馏产物覆盖第 i 天、且该分片已出
504
- `raw.hotWindowDays` 热窗时,允许物理清理 raw 原文,**必经 Tombstone 防复活**。
505
- L2 继续走同类项合并(`l2Merge`),L3 增加硬熔断 `semantic.maxEntries`(默认 100)+ LRU 淘汰,
506
- 语义层随“事件重要性”而非“对话条数”增长。
507
- - **优化长窗口压缩与高频引用去重**:
508
- - 冷归档默认改用 **Brotli quality 11**(`.jsonl.br`,极限压缩),`gzip`(9) / `zstd` 仍可选,
509
- 全部来自 Node 内置 `node:zlib`,零外部依赖;读取按扩展名流式解压、命中即停。
510
- - 高频重复的超长内容(工具 schema / 系统提示块,≥512 字符且出现 ≥2 次)在建索引时
511
- 只存一份到 `templates.json`,事件侧改为 `contentRef` 引用(`src/index/templates.js`),
512
- 索引加载时还原原文;**日志本体不参与替换**,raw 逐行真相、`deep_raw` 与行级游标不受影响。
513
- - 稀疏行索引(每 64 行采样)继续用于跳过时间窗不重叠的分片并复用 `lineCount`。
514
-
515
- ### 1.6.2 详细变更
516
-
517
- - **Breaking the linear log curve — three layers** (`test/v162.nonlinear.test.js`, 9 cases):
518
- - **Compression layer**: cold classification is now MULTI-dimensional (age >
519
- `raw.archiveAfterDays` **AND** zero access for `raw.coldAccessWindowDays` **AND** no
520
- `pinned` / `status:handoff` / hot-tag record). Defaults move to
521
- `archiveAfterDays=90`, `coldAccessWindowDays=90`, `retentionDays=365`. Cold
522
- archives default to **Brotli quality 11** (`.jsonl.br`, "极限压缩") instead of
523
- gzip; `gzip`/`zstd` stay selectable and all three are Node built-ins.
524
- Recently-read old shards stay PLAINTEXT for O(1) cursor scans.
525
- - **Encoding layer (referential dedup, NOT columnar)**: repeated long content
526
- (tool schemas / system prompt blocks, ≥512 chars, ≥2 occurrences) is stored ONCE
527
- in `templates.json` at the INDEX layer; events carry `contentRef` instead of a
528
- duplicate copy. Index loads resolve refs, so readers always see exact content —
529
- the log itself is untouched (`src/index/templates.js`).
530
- - **Semantic layer**: raw stops being the only home of truth. `raw.distillPrune`
531
- (opt-in) lets `maintain()` physically clean raw shards that are outside
532
- `raw.hotWindowDays` **and** already covered by an L3 summary — always through the
533
- tombstone path, so nothing resurrects. L3 gains a hard capacity breaker
534
- (`semantic.maxEntries`, default 100) with LRU retirement recorded as append-only
535
- `semantic_retire` events.
536
-
537
- ## [1.6.1] — 2026-11-07
538
-
539
- **Version fully un-frozen (user directive 2026-11-07): normal semantic versioning
540
- resumes; 1.6.1 was the release that followed 1.6.0.**
541
-
542
- - **Archive month detail UI**: the panel's raw section now shows `indexedShards` /
543
- `archiveCount` StatCards plus a **collapsible month table** (月份 / 引擎 / 归档大小 /
544
- 归档时间, month-DESC, collapsed by default). `panel.raw` carries `archivedBytes`,
545
- `totalBytes`, `engines:{gzip,zstd}`, `savedBytes`, `compressionRatio` (null when
546
- unmeasured) and `archiveMonths[]` with `at`/`bytesBefore`/`bytesAfter`; older hosts
547
- degrade to “—” instead of breaking the panel.
548
- - **Segment-token audit** (`docs/AUDIT-2026-11-07-segment-token.md`): no P0
549
- same-segment re-injection exists; the six injection surfaces are documented with
550
- their dedup mechanisms. Its two P3 items are now IMPLEMENTED:
551
- - **P3-1** the `[Active Task]` event id also joins the block dedup pool, so one
552
- event can never be injected both as Active Task and as a recall block;
553
- - **P3-2** `[Persona & Traits]` is memoized by the L3 shape (`summaryId` +
554
- `updatedAt` + count); unchanged L3 costs one signature, not a re-render.
555
- - **Raw cold-tier archiving (zero external deps)**: on `maintain()`, daily shards
556
- older than `raw.archiveAfterDays` (default **7**) are merged per calendar month
557
- into one `raw-archive-YYYY-MM.jsonl.gz` via Node's built-in `zlib`, then the
558
- plaintext shard is removed. Archiving runs at most once per month and SKIPS any
559
- shard that is recently read (`state/raw-access.json`), `pinned`,
560
- `status:handoff`, or carries a hot active-set tag. `deep_raw` and hash restore
561
- stream the archive with `createGunzip()` line-by-line (no full read), report
562
- `archiveErrors`/`notes: archive-corrupt:<name>` for a corrupt archive, and keep
563
- plaintext `.jsonl` reads unchanged. `raw.retentionDays` default moves **30 → 90**
564
- and must stay strictly above `archiveAfterDays` (fail-fast otherwise).
565
- - **`/stats` panel: archive + index visualization**: `panel.raw` now reports
566
- `archiveCount`, `archivedBytes`, `totalBytes`, `archiveMonths`, `engines`
567
- (`{gzip,zstd}`), `savedBytes` (sum of bytesBefore−bytesAfter), `compressionRatio`
568
- (null when no measured archive) and `indexedShards`. Each archive records
569
- `bytesBefore`/`bytesAfter` in `state/raw-archive.json`, so the ratio and saved
570
- bytes are real measurements, not estimates. The panel gains two StatCards
571
- (“raw 索引覆盖”, “raw 冷归档”) with graceful “—” for an older host, plus a
572
- collapsible **archive month table** (月份 / 引擎 / 归档大小 / 归档时间, month-DESC,
573
- collapsed by default); `archiveMonths` rows carry `at`/`bytesBefore`/`bytesAfter`.
574
- 4 cases in `test/v161.stats.test.js` + 2 UI contract cases.
575
- - **Sparse line index for raw shards** (performance audit item C): one
576
- `<day>.jsonl.idx.json` per shard, sampled every 64 lines with
577
- `{line, offset, timestamp}` plus `bytes/mtimeMs/lineCount/minTs/maxTs/sorted`.
578
- `deep_raw` uses it to SKIP a shard whose time range cannot overlap the window
579
- (without opening the file) and to reuse `lineCount` for absolute `hit.line`
580
- numbers (no second pass). Built offline by `maintain()` (50 shards/round,
581
- progressive), deleted with its shard by `prune()`, and silently bypassed when
582
- missing, stale (bytes/mtime mismatch), corrupt, or non-monotonic. `stats()`
583
- reports `indexedShards`. 6 cases in `test/v161.rawIndex.test.js`.
584
- - **Compression-engine selection (zero install)**: `raw.compressionEngine`
585
- (`gzip` default | `zstd`) + a settings-page engine picker with an
586
- enable/disable button. Zstd uses Node's BUILT-IN `node:zlib` zstd — nothing is
587
- downloaded and there is no package to uninstall; "停用" switches back to gzip.
588
- Archives are `raw-archive-YYYY-MM.jsonl.gz` / `.jsonl.zst`, dispatch is by
589
- extension, and a legacy gzip archive stays readable after switching to zstd.
590
- When the runtime lacks zstd the config silently falls back to gzip and
591
- `capabilities.compression` reports `{engine, fallback, zstd, node}` for the UI.
592
- - **Raw retention tiers documented**: the raw layer exposes exactly three modes —
593
- `off` (keep nothing), `salience` (default: high-value turns/code/stack/errors only),
594
- `all` (bounded by `maxTurnKb`/`maxBytesPerDay`/`maxTotalMb`) — plus
595
- `retentionDays` (default 90) and `pinned` never pruned. README/ARCHITECTURE now
596
- describe these implemented tiers only.
597
- - **Fixed — settings page rendered blank**: the compression-engine card referenced a
598
- bare `payload` that only exists in other components' scopes; it now uses the local
599
- `statsPayload` and the shared `Select` component (not a fake `type:'select'` on
600
- `Field`). `test/v161.ui.test.js` pins the scope rule so the whole settings page
601
- cannot be taken down by one card again.
602
-
603
- - **Recall bound-based early exit** (performance audit item A): every score is
604
- `salience × decay × tagAffinity(≤3) × lexicalBoost(≤1) × association(≤1) ×
605
- timeBoost(≤1.3) × handoff(≤1)`, so `salience × 3.9` is a hard upper bound.
606
- Candidates are visited salience-DESC and scoring stops as soon as that bound
607
- cannot beat the current k-th score. `pinned` hits bypass the cut, the best-k
608
- window keeps the bound exact (ties still visited), and the result reports
609
- `pruned` + `notes: pruned:<n>`. Complexity unchanged in the worst case
610
- (`O(K log K)` ordering) but the per-candidate decay/similarity work is skipped
611
- for the long low-salience tail.
612
- - Regression: pinned decay stays exactly 1 (bypass path), monthly memos unchanged.
613
- - **456 tests green** (64 files).
614
-
615
- ## [1.6.0] — 2026-11-06
616
-
617
- > Version note: 1.6.0 was the FIRST release after the temporary 1.5.7 freeze; the
618
- > 2026-11-07 directive removed all freeze language and resumed normal versioning.
619
- Cold-start wake-up + user-controlled cold-start injection:
620
-
621
- - **Anti-"customer service" wake-up** (static `memory:policy` prefix): the model is
622
- told it has continuous long-term memory, must not open with "how may I help you",
623
- and should recall the recent topic before replying.
624
- - **`context.coldStartInjectSummary`** (default **true**): on the first prompt
625
- assembly of a brand-new conversation, inject `[Cold-Start Summary]` — the handoff
626
- summary event when present, else the top-3 L3 semantic summaries (≤800 chars).
627
- - **`context.coldStartInjectRecentTurns`** (default **false**): inject
628
- `[Previous Context Tail]` with the last ≤5 business episodes (200 chars each).
629
- - **`[Cold-Start Detected: Active Space=…, Recent Topic=…]`** header when either
630
- switch is on; the block is volatile-tail only (prompt-cache prefix untouched) and
631
- is consumed exactly once per new conversation.
632
- - Both switches off → no historical blocks; the static wake-up policy still ships.
633
- - UI: two independent toggles in the settings page's session group; HTTP-editable.
634
- - **416 tests green** (64 files).
635
-
636
- ## [1.5.7] — 2026-11-04
637
-
638
- > Historical note: 1.5.7 shipped under a temporary version freeze; the 2026-11-07
639
- > directive removed ALL freeze language and resumed normal semantic versioning
640
- > (current version: 1.6.2). The sentence below is the historical 1.5.7 statement.
641
-
642
- **Version freeze (historical, superseded): 1.5.7 was the shipped release.**
643
- This release folds in everything added after the 1.5.6 draft — Orchestrator
644
- federation/dedupe wiring, read-time merge, cross-space recall aggregation (opt-in
645
- `features.crossSpaceRecall`), durable Orchestrator state, the settings-page GitHub
646
- installer, the verified automatic new-conversation handoff (with configurable
647
- once/interval detection), low-valley Dream Phase 2, space deletion, graph
648
- interaction, and the rest of the 1.5.6 section below. Annotations of the form
649
- `v1.5.6:` below record the version in which a feature was introduced; they are
650
- history, not the current version. **411 tests green** (64 files).
651
-
652
- ## [1.5.6] — 2026-11-03
653
-
654
- **`deep_raw` now scans by line cursor: a huge day shard is never loaded whole.**
655
- The black box is read newest-first in fixed chunks; peak memory is one chunk plus
656
- one partial line (test-locked), not the file size. `hit.line` keeps its absolute
657
- 1-based semantics. **411 tests green** (was 303).
658
-
659
- ### Changed — raw scan / restore (zero-dependency, O(chunk) memory)
660
-
661
- - **`readLinesReverse(file, {chunkSize, onBuffer})`** (`src/rawStore.js`): reads a
662
- file backwards in 64 KiB chunks, yielding one line at a time; the trailing
663
- newline does not produce a phantom empty line. `onBuffer` reports the live
664
- buffer size for tests.
665
- - **`deep_raw` scan** rewrote the whole-shard `readFileSync + split` path:
666
- newest-first, one `JSON.parse` per line, line bytes counted as they are read,
667
- hit results collected per shard. `hit.line` is computed from the shard's line
668
- count via ONE extra bounded streaming pass, paid only when that shard produced
669
- a hit (so a miss costs no counting pass).
670
- - **`restoreByHash`** streams forward via `readline`; **`_loadTombstones`** streams
671
- synchronously with a `StringDecoder` (multi-byte boundaries preserved);
672
- **`_hashesFor`** streams asynchronously (so `RawStore.capture()` is now async —
673
- only internal callers exist; the public `captureRaw()` contract is unchanged).
674
- - **Engine-side result ceiling**: `MAX_SCAN_RESULTS = 500` caps one scan even if an
675
- embedder passes `limit: 5000`; `budget.maxHits` is reported, `truncated` is true
676
- when the cap is reached.
677
- - **Observability**: `scanned.peakBufferBytes` exposes the largest buffer the
678
- scanner ever held (proves the memory bound).
679
-
680
- ### Added — stability hardening (same 1.5.6, no extra version bump)
681
-
682
- - **Recall response cap**: `context.maxInjectTokens` (default 4000, 256–100 000,
683
- fail-fast) bounds the JSON one recall returns. `Memory.applyPayloadBudget()`
684
- keeps hits in rank order (the first is always kept), then semantic/temp summaries;
685
- a cut is loud: `truncated: true`, `payload: {maxTokens, estimatedTokens, dropped}`
686
- and a `payload-budget` note. Editable over HTTP and rendered in the settings page
687
- with a tooltip.
688
- - **`Memory.close()` releases resources**: `RawStore.close()` clears the flush timer
689
- and synchronously persists queued turns before the log closes; `Memory.close()`
690
- then detaches the scheduler, clears oversized-tag hints and calls
691
- `IndexManager.release()` to drop the A/B views. Idempotent.
692
- - **Event-loop lag monitoring**: `src/eventLoop.js` (`createLagMonitor`) wraps
693
- `perf_hooks.monitorEventLoopDelay`; `maintain()` yields 50ms between phases and
694
- `IndexManager.rebuild` yields between read/build/catch-up/swap once the measured
695
- max delay crosses 100ms. The report carries
696
- `eventLoop: {maxMs, p99Ms, meanMs, yields, thresholdMs}`. Honest boundary: a
697
- synchronous builder cannot be preempted, so the granularity is phase-level and the
698
- numbers expose an oversized phase.
699
-
700
- ### Added — pre-ingest tagging (same 1.5.6, no extra version bump)
701
-
702
- - **`src/tagging.js` / `extractTags()`**: deterministic anchors derived from content
703
- shape — named error types (`error:typeerror`), Node errno codes
704
- (`error:econnrefused`), fenced-code language (`lang:python`), HTTP status
705
- (`http:500`), file path basename (`file:index.js`) and explicit task statements
706
- (`task:…`). No LLM, no dependencies, stable ordering.
707
- - **Write gate** (`Memory.stage`): model-provided tags always win; only an untagged
708
- write runs the heuristic. Tags are deduplicated and capped by `tagging.maxTags`
709
- (1–5, default 2). Inferred anchors are recorded on `meta.auto_tagged` /
710
- `meta.auto_tags` (provenance, not a silent rewrite of what the caller asserted).
711
- - **raw stays pure**: the black box still receives exactly
712
- `{turn_id, timestamp, role, content}` — the test locks the four-field shape.
713
- - **Miss is a warning**: `MEM_E_AUTO_TAG_MISS` goes to the Host log via
714
- `Memory.setWarnHook` (wired in `index.js`) and increments
715
- `panel.autoTag.misses`; the write proceeds untagged.
716
- - **Config**: `tagging.autoTag` (default true) and `tagging.maxTags` (1–5), both
717
- fail-fast, HTTP-editable and rendered in the settings page.
718
-
719
- ### Added — pinned memory (same 1.5.6, no extra version bump)
720
-
721
- - **`remember({ pinned: true })`**: a lesson/experience that must survive time.
722
- It stores `meta.pinned = true` (provenance included in `content_hash`) and is
723
- refused with **`MEM_E_PINNED_TAG_REQUIRED`** unless the caller supplies at least
724
- one tag — an untriggerable lesson would be dead memory.
725
- - **Never decays**: `projectEpisode` exposes `pinned`; `deriveTagTable` gives a
726
- pinned event `decay = 1`, keeps its tag un-archived, and protected from the
727
- `maxPostingsPerTag` drop; `deriveActiveSet` admits pinned tags regardless of
728
- score or the cap.
729
- - **Ranks first**: recall gives every matching pinned record `decay = 1`, exempts
730
- it from `minScore`, and orders pinned hits ahead of all others
731
- (`pinned-first:N` note).
732
- - **Observability**: `panel.global.pinned` counts pinned records.
733
- - Tool surface: `memory_remember.pinned` (boolean) is documented and passed
734
- through; `bulk_ingest` items accept the same field.
735
-
736
- ### Changed — relevance-first prompt hints (same 1.5.6, no extra version bump)
737
-
738
- - **Global "most active tags" map removed from the prompt.** `runtime.promptState()`
739
- now renders only tags that lexically overlap the CURRENT user turn (max 5), via
740
- `src/utils/memoryHints.js` (`selectRelevantTags` / `renderMemoryHints`).
741
- Internal bookkeeping tags (`status:*`, `month:*`, `context:*`, `active_task`)
742
- are never hinted; no match means the section is simply absent (no padding).
743
- - **Cache-safe placement**: `[Memory Hints]` is rendered AFTER `[Memory Blocks]`,
744
- so a per-turn hint never disturbs the cacheable prefix (rules only).
745
- - **Input source**: prompt assembly receives no message text, so the plugin tracks
746
- the last `user/message` from `session/event` (`runtime.lastUserText`); other
747
- surface events never overwrite it.
748
- - The legacy `renderMemoryMap` / `composePrompt({map})` API remains for callers
749
- and is still unit-tested, but the plugin no longer injects the map.
750
-
751
- ### Added — capability flags & microkernel boundary (same 1.5.6, no extra version bump)
752
-
753
- - **`features.multiSpace` (default true)** and **`features.crossSpaceTransfer`**
754
- (default mirrors multiSpace). Both are fail-fast, HTTP-editable and rendered in
755
- the settings page; turning multiSpace off implies crossSpaceTransfer off, and the
756
- explicit contradictory combination is refused.
757
- - **Strict single-space mode**: with multiSpace off, every routed read/write whose
758
- `targetSpaceId` is not `default` answers **`MEM_E_FEATURE_DISABLED`** (before any
759
- I/O); `createSpace` / `ensureSpace` / `warmup` refuse too, and the `/spaces` route
760
- reports `['default']` with `capabilities.spaces=false` so the client hides
761
- create/selector affordances instead of 404-ing.
762
- - **Tools follow the flags**: `space_transfer` / `transfer_to_global` are neither
763
- registered nor advertised in the prompt section when the capability is off.
764
- - **`Memory.open('/abs/dir')`** is now the single-space form (the Orchestrator owns
765
- the multi-space walk); the options-object form stays supported.
766
- - **`Memory.warmup({targetSpaceId?, dataDir?})`**: lazy, read-only index warm-up for
767
- the UI / Orchestrator — no maintenance, no writes; unknown/relative dataDir fails
768
- fast.
769
-
770
- ### Added — host lifecycle: compensating Dream (same 1.5.6, no extra version bump)
771
-
772
- - **`src/hostBridge.js`** subscribes to the Host's process-local events
773
- `agent/created` and `session/created` (the "session start" signals) through a plain
774
- `{on, off}` bus seam, plus `agent/disposed` for teardown.
775
- - **Compensation rule**: on a session start, if no Dream ran for
776
- `dream.compensateAfterHours` (default 24, 1–720, fail-fast) AND the price window
777
- permits, run exactly ONE compensating Dream through the shared
778
- `runtime.runMaintenance('compensate')` gate — never a second concurrent run, never
779
- a queue.
780
- - **Price is injected, never guessed**: `setPriceProbe(fn)` / `DSH_DREAM_PRICE=low|high`.
781
- Unknown price + an LLM-backed Dream ⇒ skip (`price-unknown`); unknown + local-only
782
- Dream ⇒ allowed. A known peak ⇒ skip (`peak`).
783
- - **Observability**: `runtime.hostStatus()` and `/stats`'s top-level `host` report
784
- `sessionStarts / compensations / skipped / lastSkipReason / dreamDue / lowValley`.
785
- - `enableDream:false` disables compensation; `agent/created`/`session/created` do not
786
- otherwise affect memory writes (raw capture remains on `session/event`).
787
-
788
- ### Added — Dream tunables in the settings page (same 1.5.6, no extra version bump)
789
-
790
- - The **safe** Dream subset is now exposed to `/stats` + `/config` and rendered in
791
- the settings page: `useLlm`, `minGroupSize`, `maxGroupsPerRun`, `maxSummaryChars`,
792
- `maxSourceChars`, `maxEventsPerGroup`, `llmTimeoutMs`, `failureThreshold`,
793
- `cooldownMinutes`, `compensateAfterHours` (all fail-fast validated).
794
- - **Credentials stay private**: `dream.llm.{baseUrl,model,apiKey}` is neither exposed
795
- by the routes nor editable over HTTP nor rendered in the form; it comes only from
796
- the profile or `DSH_DREAM_LLM_*` env. A test asserts the key never appears in the
797
- `/stats` payload.
798
-
799
- ### Added — L2 multi-merge (`merged_into`, same 1.5.6, no extra version bump)
800
-
801
- - **`src/l2Merge.js`** condenses duplicate same-tag L2 episodes into ONE durable
802
- record, offline at the end of `maintain()` (after monthly memos; a failure never
803
- fails maintenance).
804
- - **Pinned and ordinary groups are strictly separated** — pinned merges only with
805
- pinned; ordinary only with ordinary. A pinned merge keeps `pinned: true` and
806
- inherits every tag.
807
- - **Text**: earliest/latest time + deduplicated core text (each source capped), the
808
- whole line capped by `l2Merge.maxSummaryChars` (ASCII ellipsis so identity
809
- canonicalisation cannot make it longer).
810
- - **Federated metadata**: `meta.global_tags` is copied into the merged record's
811
- `meta` and **never becomes a tag**, so it cannot enter the sub-space inverted index;
812
- `projectEpisode` exposes it as `event.globalTags` for the merge layer only.
813
- - **Append-only marking**: sources are recorded as merged in
814
- `state/l2-merge.json` (`mergedSourceIds`); the log is untouched and originals stay
815
- recoverable. A second pass merges nothing (idempotent) and `status().panel.l2Merge`
816
- reports the bookkeeping.
817
- - **Config `l2Merge`**: `enabled` (default true), `minGroupSize` (2–20, default 2),
818
- `maxGroupsPerRun` (1–50, default 5), `maxSummaryChars` (100–2000, default 400);
819
- fail-fast, HTTP-editable and rendered in the settings page.
820
-
821
- ### Added — L3 semantic tag invariant (same 1.5.6, no extra version bump)
822
-
823
- - **`SemanticStore.upsert` is strict**: an L3 summary with zero usable tags is
824
- refused with **`MEM_E_SEMANTIC_TAG_REQUIRED`** — such a summary could never be
825
- reached by tag-driven retrieval (dead knowledge).
826
- - **Offline paths degrade instead of failing**: delete-consolidation and trend
827
- promotion derive tags from content heuristics (`extractTags`) and, if even that
828
- yields nothing, write an explicit provenance anchor (`origin:unlabelled-episode` /
829
- `origin:unlabelled-trend`). Maintenance and the two-phase delete pipeline therefore
830
- never break on historical untagged events.
831
- - **Historical data is read-only degraded**: summaries written before the invariant
832
- remain readable and are marked `degraded: true` in `list()` /
833
- `semanticSummaries()`; nothing is silently rewritten.
834
-
835
- ### Added — working mode survives a handoff (same 1.5.6, no extra version bump)
836
-
837
- - **Handoff marker carries the Host agent preset** (the UI's “工作模式”): the marker
838
- written at rollover now records `agentPreset`, fed by the live adapter through
839
- `memory.setHandoffPresetProvider()`.
840
- - **A new conversation restores it before its first turn**: `agent/created` is a
841
- serial Host event, so the bridge awaits `agentPresets.select(agent, preset)` for
842
- `source === 'startup'` from a different session. `resume`, the marker-owner session
843
- and markers without a preset are never overridden.
844
- - **Never breaks agent creation**: a failed `select` is reported in
845
- `runtime.lastPresetInherit` and the log, then creation proceeds.
846
- - **Tracking**: `agent-preset/selected` updates the mode; tool boundaries and prompt
847
- assembly opportunistically read `agents.currentInitiator()` + `agentPresets
848
- .composedPreset()` and **backfill an older marker** that predates this feature.
849
- - **Observability**: `/stats` exposes `agentPreset` + `presetInherit`, and
850
- `hostStatus().presetSelections` counts observed selections.
851
-
852
- ### Changed — physical split: multi-space engine moved out (same 1.5.6)
853
-
854
- - **`src/spaces/spaceRouter.js` and `src/spaces/transfer.js` are GONE from this
855
- package.** The full multi-space router (per-space FIFO chains, lazy child stores,
856
- `MEM_E_*` validation) and the cross-space transfer engine now live in
857
- `dsh-orchestrator` (`src/spaceRouter.js`, `src/transfer.js`).
858
- - The core compiles only `src/spaces/singleSpace.js`: the `default` space is the
859
- owner handle; every named-space operation answers **`MEM_E_FEATURE_DISABLED`** with
860
- an explicit "install dsh-orchestrator" hint. No silent fallback to `default`.
861
- - **Adapter injection is the wiring seam**: the Host's optional `orchestrator`
862
- service supplies `createSpaceAdapter({owner, dataDir, openChild})` and `transfer`;
863
- `Memory.open({spaces|spacesFactory, transfer})` accepts the same seam for embedders.
864
- Without the service the plugin advertises `capabilities.spaces=false`, registers
865
- only the eight single-space tools, and `/spaces` reports `default` only.
866
- - A profile with `features.multiSpace:true` but no Orchestrator logs a loud warning
867
- and runs the strict single-space core (visible in `/stats.capabilities`), instead
868
- of pretending the capability exists.
869
-
870
- ### Added — first batch: orchestrator service + 3 experience fixes (same 1.5.6)
871
-
872
- - **Orchestrator service registration**: `apply()` now installs a real Host service
873
- (`ctx.provide('orchestrator', …)` inside `ctx.effect`, so unloading removes it).
874
- It exposes `createSpaceAdapter`, `transfer`, `dirFor`, `status`, `federation`,
875
- `dedupe`, `consent` and `router`. The core decides the capability through
876
- `config.multiSpaceActive(config, hasOrchestrator)`.
877
- - **Reserved system tags isolated from display**: `status:*`, `folded-summary` and
878
- `active_task` are filtered out of the knowledge graph (`buildGraph` + defensive
879
- `view`) and the L1.5 tag tree (`rebuildTree` + persisted-tree/ghost filtering).
880
- The inverted index still keeps them (handoff/recall internals need them).
881
- - **`[Active Task]` injection**: prompt assembly prefers the active handoff summary,
882
- otherwise the newest event carrying a `task:` tag, and renders it as an
883
- unconditional top block (`[Active Task]`) once per session.
884
- - **Fallback hints**: `selectRelevantTags` accepts `fallbackTags`; when the current
885
- input has no lexical overlap (e.g. “继续”), the previous turn's matched tags (max 2)
886
- are carried into `[Memory Hints]`.
887
- - **Session-scoped injection dedup**: `runtime.injection` keeps per-session `ids` and
888
- `tags`; hints, `[Active Task]` and recall blocks already injected are filtered on
889
- later turns. SessionStart and rollover reset the pool, so the next session receives
890
- the handoff content again.
891
- - **Space deletion (UI + engine)**: `SpaceRouter.deleteSpace(id, {confirm})` closes
892
- the child handle, evicts its queues/caches and removes the directory (refusing
893
- `default` and requiring `confirm:true`). `Memory.deleteSpace` / `runtime.deleteSpace`
894
- gate the same rules (named space only; `MEM_E_FEATURE_DISABLED` in the strict
895
- single-space core). The HTTP route reuses `POST /spaces` with
896
- `{action:'delete', space_id, confirm:true}`; an **unknown action is a 400** and
897
- never falls through to CREATE. The SpaceSelector renders `🗑 删除空间` only for a
898
- named space AND only when the new **`capabilities.spacesDelete`** handshake is
899
- true — an old/pre-delete host therefore hides the button instead of answering the
900
- misleading “空间已存在”. When `capabilities.spaces` is false the entire space UI
901
- (selector, create/delete, current-space chip) disappears silently.
902
-
903
- ### Added — local low-valley Dream scheduling (same 1.5.6)
904
-
905
- - **No external price plugin required**: `src/priceWindow.js` computes Beijing-time
906
- peak/valley locally (weekday 09–12 / 14–18 peak; lunch, nights and weekends low).
907
- Chinese holidays are NOT modelled (the calendar moves yearly); `DSH_DREAM_PRICE=low|high`
908
- or a Host price probe still override it.
909
- - **The Host bridge gets a default probe** from `isLowValley()`, so a compensating
910
- Dream skips peaks (`reason:'peak'`) and runs locally in the valley.
911
- - **Idle LLM Dream defers instead of spending at peak**: `runtime.tick()` writes a
912
- durable `state/dream-queue.json` (`pending, dueAt, reason:'peak-hour'`), emits
913
- `dream-deferred`, and runs the queued Dream as soon as the valley opens — the queue
914
- survives a restart, so a missed window is not lost.
915
- - **Config `dream.onlyLowValley`** (default true; fail-fast, HTTP-editable, settings
916
- toggle). A local-only Dream (no LLM) is never gated by price.
917
- - `/stats` exposes `dreamWindow` (low/reason/nextLowAt), `dreamQueue` and `dreamTimer`.
918
- - **Phase 2 — wake timer + sleep correction**: `src/dreamTimer.js` arms ONE wake-up
919
- at the queued due time / next valley (injectable timers, `unref`ed). On fire it
920
- re-reads the CLOCK and the WINDOW: a late wake after an OS sleep is reported
921
- (`lateMs`, `catchUp`) and runs; a wake that lands in a peak re-arms for the next
922
- valley instead of spending. Boot arms from the persisted queue, so a queue left by
923
- a previous run catches up with delay 0. Disposal cancels the timer.
924
- `dreamTimer` status (arms/wakes/lateWakes/reschedules/runs) is exposed on `/stats`.
925
-
926
- ### Added — Federation / cross-space dedupe wiring (same 1.5.6)
927
-
928
- - **Federation on write**: after a successful write the engine reports the record's
929
- BUSINESS tags (never `status:*` / `month:*` / `active_task`) to the Orchestrator's
930
- global `FederationMap` with the space id; a tag seen in two spaces becomes ONE
931
- global node listing both. A missing/broken service can never fail the write.
932
- - **Dedupe on monthly memos**: `generateMonthlyMemos()` claims `sha256(content)` in
933
- the Orchestrator's `ContentRegistry` as `monthly:<spaceId>`; a sibling space with
934
- the identical monthly workload skips its copy and reports
935
- `monthly.skipped`/`skippedEntries` (owner traceable). Same-space reruns are
936
- idempotent.
937
- - Services arrive through the existing `orchestrator` adapter extras; spaces carry
938
- their own `spaceId` (`path.basename(childDir)`), the default space is `default`.
939
- - **Read-time merge on recall**: monthly memos now persist `meta.source_event_ids`,
940
- and `projectEpisode` exposes `sourceEventIds`. `Memory.mergeRecallHits()` feeds the
941
- recalled hits through `ContentRegistry.mergeForRead()`: a memo wins over the events
942
- it owns, duplicate `contentHash` collapses monthly-first, and the payload reports
943
- `merge: {space,monthly,droppedOwnedByMonthly,droppedDuplicateContent,total}`. Only
944
- when the Orchestrator dedupe service is present; the pure core payload shape is
945
- unchanged.
946
- - **Cross-space recall aggregation**: `Memory.recallAcrossSpaces()` queries every open
947
- space under its own lock, tags each hit with `spaceId`, and folds the union through
948
- the same `mergeForRead()` (raw hits are requested with `mergeRecall:false` so the
949
- aggregation sees owned events before the memo hides them). It is **opt-in**:
950
- `features.crossSpaceRecall` defaults to **false**, is fail-fast (true without
951
- multiSpace is a contradiction), HTTP-editable and rendered in the settings page.
952
- Only when `crossSpaceRecall:true` does `runtime.recall()` use this path; otherwise
953
- the single-space payload is unchanged (`mode` is never `cross-space`).
954
- `mode:'cross-space'`, `spaces`, `merge` and per-hit `spaceId` are reported.
955
-
956
- ### Tests
957
-
958
- - New `test/v156.rawscan.test.js` (5 cases): newest-first + absolute line number
959
- (5000-line shard), turn-budget truncation without reading the head, engine result
960
- ceiling, `readLinesReverse` peak buffer ≤ chunk + one line over a 20k-line file,
961
- and `restoreByHash` over the streaming path.
962
- - New `test/v156.hardening.test.js` (5 cases): recall payload truncation and
963
- under-budget pass-through, `maxInjectTokens` fail-fast, `close()` resource release
964
- and idempotency, lag monitor yield after a 120ms block, maintenance `eventLoop`.
965
- - New `test/v156.tagging.test.js` (7 cases): extraction matrix, untagged write gets
966
- an anchor and becomes recallable, raw purity (four fields), manual tags win +
967
- dedupe, miss warning + panel counter, `autoTag:false`, config fail-fast.
968
- - New `test/v156.pinned.test.js` (3 cases): pinned without tags refused and no
969
- write, one-year decay still `decay=1` + index/tag flags + pinned-first ranking,
970
- pinned tag stays in the active set after a 400-day maintenance.
971
- - New `test/v156.hints.test.js` (4 cases): selector matrix (match/unrelated/internal/
972
- empty), hint rendering, prompt tail contains only matching tags after the block
973
- marker with a stable prefix, `session/event` user turn tracking.
974
- - New `test/v156.features.test.js` (5 cases): flag fail-fast + implied transfer-off,
975
- strict single-space engine + capabilities/tools absent, transfer-only-off,
976
- defaults unchanged, `Memory.open(string)` + lazy `warmup()`.
977
- - New `test/v156.host.test.js` (6 cases): price normalisation; session start runs one
978
- compensating Dream; unknown price + LLM skipped; peak skipped; not-due / disabled /
979
- in-flight refused; MockHostEnvironment integration through `apply()` + `hostStatus`
980
- surfaced on `/stats`; `dream.compensateAfterHours` fail-fast.
981
- - New `test/v156.dreamui.test.js` (3 cases): safe Dream subset exposed / credentials
982
- absent from the payload; tunables editable over HTTP while `dream.llm.*` is not;
983
- settings page renders the section and offers no credential field.
984
- - New `test/v156.l2merge.test.js` (4 cases): pinned/ordinary strict separation with
985
- global-tag metadata preserved as meta (never a tag); a lone ordinary record is not
986
- dragged into the pinned group; `maxSummaryChars` cap + `enabled:false`; config
987
- fail-fast. Older fixtures disable `l2Merge` so their exact index-count assertions
988
- stay deterministic.
989
- - New `test/v156.l3tag.test.js` (4 cases): strict upsert refusal; delete-consolidation
990
- derives `error:typeerror` / `origin:unlabelled-episode` instead of dead knowledge;
991
- trend promotion derives tags before writing L3; historical untagged summaries are
992
- readable but `degraded`.
993
- - New `test/v156.preset.test.js` (6 cases): marker records the working mode; a new
994
- conversation restores it through `agentPresets.select`; older markers are
995
- backfilled from the live agent; resume / same-session / marker-without-preset never
996
- override; a failed select does not fail creation; `agent-preset/selected` keeps the
997
- tracked mode current.
998
- - New `test/v156.singleSpace.test.js` (3 cases): the core works for `default` and
999
- refuses named read/write/create/ensure/transfer; without the Orchestrator the plugin
1000
- advertises `spaces:false`, registers eight tools and never advertises a dead tool in
1001
- the prompt; injecting the adapter restores ten tools and `spaces:true`.
1002
- - Updated: manifest 1.5.5 → 1.5.6; settings page gains `context.maxInjectTokens`,
1003
- the pre-ingest tagging section, Dream tunables and the L2-merge section; editable
1004
- contract gains `tagging`, `features`, `dream` and `l2Merge`; panel contract gains
1005
- `global.pinned`, `autoTag` and `l2Merge`; `plugin.test` prompt contract now asserts
1006
- relevance hints instead of the removed global map.
1007
- - New `test/v156.firstBatch.test.js` (5 cases): reserved status tags never reach the
1008
- graph/tag tree; `[Active Task]` from the handoff summary and from a `task:` event;
1009
- fallback hints reuse the previous turn's tags; session dedup blocks the second
1010
- injection and resets on a new session.
1011
- - New `test/v156.spaceDelete.test.js` (5 cases): engine deletion with confirm/default/
1012
- missing rules; strict single-space refusal; **`capabilities.spacesDelete` versioned
1013
- handshake** (an old host hides the button, so a delete request can never be
1014
- misread as CREATE); `POST /spaces {action:'delete'}` removes the store and returns
1015
- the refreshed list; unknown actions answer 400 instead of falling through to
1016
- CREATE; the UI source carries the capability guard, the button, the human confirm
1017
- and the default-space guard.
1018
- - **Graph interaction layer** (`test/v156.graph.test.js`, 4 cases): Ctrl/Cmd+drag
1019
- pans the canvas (plain drag still moves a node), Ctrl/Cmd+wheel zooms around the
1020
- cursor via a non-passive native listener (plain wheel keeps page scroll),
1021
- double-click on blank space resets the view, and the frozen initial layout runs
1022
- through `separateOverlaps()` so nodes never start piled on top of each other.
1023
- The header/footer advertise the interaction.
1024
- - New `test/v156.lowValley.test.js` (4 cases): Beijing peak/valley boundaries and
1025
- next-low computation; `dream.onlyLowValley` fail-fast + editable; a peak-hour idle
1026
- Dream is deferred durably and runs at the valley; the Host bridge probe follows the
1027
- window while `DSH_DREAM_PRICE` remains an override.
1028
- - New `test/v156.federation.test.js` (2 cases): business tags federate into one
1029
- global node across spaces while internal tags are skipped; the first space claims a
1030
- cross-space monthly memo and the sibling reports `skipped` with the owner.
1031
- - New `test/v156.lowValley2.test.js` (4 cases): peak wake re-arms (never runs); a
1032
- sleep-delayed wake reports `lateMs`/`catchUp`; a past-due queue in the valley arms
1033
- delay 0; runtime integration: peak deferral -> timer fire -> queue cleared and
1034
- `dreamTimer.runs === 1`.
1035
- - New `test/v156.readMerge.test.js` (2 cases): a recalled monthly memo drops the
1036
- events it owns and reports merge stats; without the dedupe service the recall
1037
- payload is unchanged.
1038
- - New `test/v156.crossSpaceRecall.test.js` (2 cases): a recall returns hits from every
1039
- open space with provenance; a monthly memo hides its owned event even when recorder
1040
- in another space, while the other space still contributes.
1041
- - New `test/v156.crossSpaceRecallFlag.test.js` (3 cases): default false + fail-fast
1042
- (`true` without multiSpace is a contradiction, non-boolean rejected); flag true
1043
- aggregates open spaces; flag false keeps the single-space payload.
1044
- - **Settings-page GitHub installer**: new `POST /api/hippocampus/orchestrator/install`
1045
- (requires `{confirm:true}`) delegates to the Host's
1046
- `pluginManager.installBundle('git+https://github.com/382quaii/dsh-Layers-Orchestrator.git', {enabled:true})`,
1047
- short-circuits when the service is already present, and reports
1048
- `applied | restart-required | manual | failed`. The settings page ships a
1049
- “从 GitHub 安装 dsh-orchestrator” button (human confirm dialog) plus the repo link;
1050
- without `pluginManager` it shows the exact manual steps instead of failing silently.
1051
- - **Automatic new conversation on handoff (verified feasible)**: the Host exposes
1052
- `agents.create/resume` and, decisively, the CLIENT service
1053
- `uiWorkspace.startSession()` — the same action the “+” button uses. A client-half
1054
- controller polls `/stats`, and when `handoff.active && handoff.autoNewSession` it
1055
- calls `uiWorkspace.startSession(undefined, {agentPreset})` once per handoff marker
1056
- (sessionStorage guard, lifecycle-owned interval, capability-guarded no-op on old
1057
- hosts). New config `context.autoNewSession` (default **true**, fail-fast,
1058
- HTTP-editable, settings toggle), plus `context.autoNewSessionPoll`
1059
- (`interval` | `once`, default `interval`) and
1060
- `context.autoNewSessionIntervalSeconds` (5–3600, default 15): the settings page
1061
- now exposes a “按间隔轮询 / 只检查一次” select and an interval slider; the client
1062
- configures its timer from the FIRST stats response (`once` clears the recurring
1063
- timer). The workspace-file handoff scheme is no longer needed and stays documented
1064
- only as a fallback.
1065
- - **Fixed — new-conversation failure `tool "subagent" is already registered`**:
1066
- handoff preset inheritance no longer calls `agentPresets.select()` when the new
1067
- session is ALREADY composed with the marker's preset. A redundant recompose
1068
- re-mounted the preset's `@deepseek-ai/dsh-tool-subagent` row and aborted session
1069
- creation; the skip is recorded as `presetInherit.reason='already-composed'` and
1070
- locked by a regression test in `test/v156.preset.test.js`.
1071
- - **Persona section + generic custom decay (v1.5.7)**:
1072
- - `[Persona & Traits]` is its own prompt section (`name:'persona'`, **order 100**),
1073
- rendering the ≤10 highest-confidence L3 semantic summaries (live store read, not
1074
- the recall cache). The memory block/policy/reflection sections keep 2450/2455/2460.
1075
- - `service.remember()` accepts **`customDecayRate`** (finite, 0 < rate ≤ 10) OR
1076
- **`customHalfLifeDays`** (integer 1–36500), never both. The value is normalised to
1077
- `meta.decay_rate`, projected as `decayRate`, and applied as
1078
- `effectiveHalfLife = policyHalfLife / decayRate` for THAT record only. No
1079
- tag-prefix logic exists anywhere in the engine — an emotion plugin decides the
1080
- semantics by passing the parameter.
1081
- - **Cross-plugin `ctx.provide('hippocampus', service)`** (user decision 2026-11-05:
1082
- in-process service only, NO HTTP write surface): `apiVersion=1`, `ready()`,
1083
- `capabilities()` (declares `l3Traits:10` plus per-method support), `remember()`
1084
- (L2-only; non-L2 layers are redirected with a warning; returns
1085
- `{status,eventId,eventTime,duplicate}`), `recall()`, `runMaintenance(source)`
1086
- (never queues: a running pass answers `MEM_E_MAINTENANCE_RUNNING`; manual passes
1087
- are rate-limited to 30 s while `cron` bypasses), `stats()/handoffView()/
1088
- promptState()` read-only snapshots and `onDispose()` hooks. The service disappears
1089
- with its plugin fiber; later calls answer `MEM_E_SERVICE_DISPOSED`. New codes
1090
- `MEM_E_MAINTENANCE_RUNNING`, `MEM_E_SERVICE_DISPOSED`, `MEM_E_FEDERATION_FAILED`
1091
- are registered append-only (8 cases in `test/v157.service.test.js`).
1092
- - **Durable Orchestrator state**: `<root>/state/orchestrator.json` now persists the
1093
- global federation map and the monthly-memo claims (atomic tmp+rename on every
1094
- mutation); it is loaded before the services become observable, and a corrupt file
1095
- is treated as empty instead of failing activation — a restart no longer forgets
1096
- cross-space dedupe.
1097
- - Full suite: **411 tests / 411 pass / 0 fail**, 64 test files. Orchestrator:
1098
- **31/31** (`service` + `spaces` deletion + `persistence` round-trip/corrupt state).
1099
- **Installed locally**: desktop profile gets a `link:` dependency + an ordered patch
1100
- insert BEFORE the hippocampus entries, so the service exists at activation. Two
1101
- Cordis constraints were fixed on the way: `apply()` must return **undefined**
1102
- (the return value is treated as an effect → `TypeError: Invalid effect`), and the
1103
- service is registered directly with `ctx.provide` (itself an effect). The market
1104
- catalog still does **not** list it: that needs an npm publish / catalog submission.
1105
- - Added `docs/RELEASE-1.5.6.md`: release notes + the exact push/tag/npm/market
1106
- commands that require the operator's credentials (none executed here).
1107
-
1108
- ## [1.5.5] — 2026-11-03
1109
-
1110
- **Offline Dream distillation: an optional LLM pass that can never take Dream down.**
1111
- Same-tag L2 records are distilled into one durable, provenance-carrying record.
1112
- The LLM leg uses **Node's built-in `fetch` only** (charter v2.0 #1: still zero
1113
- dependencies); endpoint / model / key are injected through config or
1114
- `DSH_DREAM_LLM_*` env and are never hard-coded, logged, or returned by HTTP.
1115
- Every failure — no config, network down, timeout, non-JSON — silently degrades to
1116
- the deterministic local merge and records `MEM_E_DREAM_LLM_FALLBACK`. **303 tests
1117
- green** (was 295).
1118
-
1119
- ### Added — Dream LLM distillation (`src/dream.js`, `Memory.executeDream`)
1120
-
1121
- - **Structured output**: the model must answer JSON `{"summary","confidence"}`;
1122
- `summary` is capped at `dream.maxSummaryChars` (default 200). Fenced code,
1123
- non-JSON, missing fields and over-long summaries are all treated as LLM failure.
1124
- - **Zero-dependency transport**: Node's global `fetch` against an
1125
- OpenAI-compatible `/chat/completions`; `Authorization: Bearer` only when a key is
1126
- configured. No SDK, no `node-fetch`, no new `package.json` dependency (test-locked).
1127
- - **Absolute timeout**: `AbortController` + `Promise.race` under
1128
- `dream.llmTimeoutMs` (default 15s); the timer is always cleared in `finally`.
1129
- - **Local fallback**: earliest/latest time + deduplicated core text, capped to
1130
- `maxSummaryChars`. Degradation warns `MEM_E_DREAM_LLM_FALLBACK` and is visible in
1131
- `status().panel.dream.lastFallback`.
1132
- - **Provenance**: the distilled record always carries
1133
- `meta.source_event_ids` (deduped, sorted) and `meta.distilled_by` (`llm|local`);
1134
- a re-run never merges the same source twice (`state/dream.json` bookkeeping).
1135
- - **Circuit breaker**: `failureThreshold` (default 3) consecutive failures open the
1136
- breaker for `cooldownMinutes` (default 60); afterwards a half-open state allows
1137
- exactly one probe — success closes it, failure re-opens. Exposed as
1138
- `panel.dream.circuit`.
1139
- - **Single-flight + serial**: a concurrent `executeDream()` is refused
1140
- (`dream-in-flight`); within one run groups are processed strictly serially, so a
1141
- slow provider can never exhaust connections or accumulate queued work.
1142
- - **Offline only**: `executeDream()` is called exclusively from the `dream` branch
1143
- of the maintenance gate, after `maintain()` converged; the online
1144
- `recall`/`remember` paths never touch the network.
1145
-
1146
- ### Config
1147
-
1148
- - New `dream` group (fail-fast validated): `useLlm`, `minGroupSize` (2–50),
1149
- `maxGroupsPerRun` (1–50), `maxSummaryChars` (40–2000), `maxSourceChars`
1150
- (80–4000), `maxEventsPerGroup` (2–50), `llmTimeoutMs` (500–120000),
1151
- `failureThreshold` (1–20), `cooldownMinutes` (1–1440), and
1152
- `llm.{baseUrl,model,apiKey}`. The `llm` block is deliberately **not** part of the
1153
- UI/HTTP config projection, so a credential can never leak through the panel.
1154
-
1155
- ### Tests
1156
-
1157
- - New `test/v155.dream.test.js` (8 cases): no-config local fallback with full
1158
- provenance; LLM success (URL/header/body/JSON parse); non-JSON degradation;
1159
- fetch timeout degradation; single-flight refusal; circuit open → no fetch →
1160
- half-open single probe → close; `dream` config fail-fast matrix; `package.json`
1161
- dependency red line.
1162
- - Updated: status-panel contract gains `dream`; manifest 1.5.4 → 1.5.5.
1163
- - Full suite: **303 tests / 303 pass / 0 fail**, 41 test files.
1164
-
1165
- ## [1.5.4] — 2026-11-02
1166
-
1167
- **Hotfix: the automatic handoff state machine can no longer wedge a session, and
1168
- recursive handoff summaries are cut off at the source.** Incident: recursive
1169
- `交接摘要` generations inflated the ratio past the native window and a handoff that
1170
- failed could leave the machine stuck, blocking new sessions. **295 tests green**
1171
- (was 286).
1172
-
1173
- ### Fixed — state machine (no deadlock, Fail-Fast with graceful degradation)
1174
-
1175
- - **`checkHandoff()` never rejects**: a distillation error, a timeout (default 5s,
1176
- injectable per call) or a marker-write failure degrade to a `state:"failed"`
1177
- marker carrying `summaryError` and return immediately. The next session starts
1178
- regardless.
1179
- - **New-session transition resets everything**: `observeSessionTokens()` always
1180
- establishes the new session's own baseline, consumes a marker belonging to a
1181
- different session, and **releases `_handoffInFlight`**, so a hung handoff guard
1182
- can never own the next session. A same-key restart (estimate halved after reset)
1183
- is treated as a new baseline too.
1184
- - **Stale marker consumption happens before early returns**, so a fresh session
1185
- cannot inherit "handoff active" forever.
1186
- - **Outer watchdog in `_maybeAutoHandoff()`** in addition to the inner one: even if
1187
- `checkHandoff` itself hangs, the in-flight flag is released in `finally`.
1188
-
1189
- ### Fixed — recursion
1190
-
1191
- - **`_distillHandoffTail()` refuses handoff content** by tag (`status:handoff`) and
1192
- by the `交接摘要` text prefix, in both the live-context path and the indexed
1193
- fallback. Output is hard-capped at 1200 characters; the idempotency key includes
1194
- the timestamp so distinct epochs never collide. (No more summary-of-summary.)
1195
- - **`status:handoff` is internal**: 2% weight in normal recall and excluded from the
1196
- recent-memory list, so real facts always outrank handoff bookkeeping.
1197
-
1198
- ### Added — escape hatches and cleanup
1199
-
1200
- - **`Memory.resetSessionState()` / `memory_admin action=reset_session` /
1201
- `POST /api/hippocampus/session/reset` / settings-page 「强制重置交接状态(逃生舱)」**:
1202
- clears the live token baseline, the in-flight guard and the active marker. It
1203
- rewrites only `state/`; durable memories are untouched.
1204
- - **`Memory.repairHandoffSummaries()` + `scripts/repair-handoff.mjs`
1205
- (`npm run repair-handoff`)**: finds recursive/excess handoff generations
1206
- (recursive = >=2 `交接摘要` markers) and parks them in the two-phase
1207
- `pending_delete` queue. Dry-run by default; `--reset-marker` consumes a stuck
1208
- marker.
1209
- - Panel session status now exposes `handoffState` / `handoffDegraded` /
1210
- `handoffErrorCode`; a degraded handoff is visible in the status bar instead of
1211
- silently locking.
1212
- - New error code **`MEM_E_HANDOFF_FAILED`**.
1213
-
1214
- ### Tests
1215
-
1216
- - New `test/v156.handoff.test.js` (9 tests): recursion refused by tag/prefix and
1217
- fallback path; throwing/hanging distillation degrades without rejecting; new
1218
- session resets ratio and releases the stuck guard; handoff summary ranking and
1219
- list isolation; `resetSessionState` preserves memories; repair dry-run + pending
1220
- delete; admin tool + HTTP escape hatch (route table 8).
1221
- - Route contract 7 → 8, manifest 1.5.4.
1222
- - Full suite: **295 tests / 295 pass / 0 fail**, 40 test files.
1223
-
1224
- ## [1.5.3] — 2026-11-02
1225
-
1226
- **Hotfix: space creation no longer exposes a raw `MEM_E_SPACES: HTTP 404`, and
1227
- invalid/conflicting space names are rejected by the ENGINE with
1228
- `MEM_E_SPACE_INVALID`.** Incident: a new client bundle called
1229
- `/api/hippocampus/spaces` against a host process that predated the route (the same
1230
- process also 404s `/memories`). Fixed on three layers plus a route-drift test.
1231
- **286 tests green** (was 270).
1232
-
1233
- ### Added — release hygiene
1234
-
1235
- - **Benchmark Protocol v1 (`scripts/bench-protocol.mjs`, `npm run bench`)**: the only
1236
- sanctioned way to publish a throughput number. Each measured run gets a fresh
1237
- `os.tmpdir()` store, one discarded same-process warmup precedes 5 measured runs,
1238
- and the report carries MEDIAN + min/max/spread. It makes no speed assertions
1239
- (a shared/AV-scanned machine must report, not fail), so single-run noise cannot
1240
- become an architecture conclusion again. Replaces the deleted single-run
1241
- `scripts/confidence-ab.mjs`.
1242
- - **Multi-space fixed-overhead coverage (`test/v154.release.test.js`)**: N=10
1243
- physical spaces — bounded per-space boot (<500ms median), lazy root boot
1244
- (`spaces.open=[]`, children never eagerly opened), uniform per-space storage
1245
- (max/min ≤1.35), linear total bytes (≤1.3×N), per-space fixed overhead <256KB.
1246
- - **Dead config removal**: `context.minInjectConfidence` is gone end-to-end
1247
- (default/validation/projection, HTTP-editable key,
1248
- `applyConfidence`/`MIN_INJECT_CONFIDENCE` retrieval pass, recall
1249
- `confidence`/`lowConfidence` annotations and low-confidence notes, obsolete A/B
1250
- script). Supplying the old key fails fast with `MEM_E_CONFIG_UNKNOWN_KEY`
1251
- (`details.removedIn = "1.5.3"`), so a profile cannot keep believing it works.
1252
- - Test watchdog default 30s → 60s (the in-process suite boots real stores/spaces and
1253
- legitimately takes ~15–25s; the watchdog now only fires on real hangs).
1254
-
1255
- ### Added — tool schema pruning
1256
-
1257
- - **`tools.disabled` config (default `[]`)**: every registered tool definition costs its
1258
- JSON schema in prompt tokens on EVERY turn (~1.1–1.2k tokens of baseline tax). A
1259
- closed suffix vocabulary (`remember/checkpoint/recall/capture/bulk_ingest/reinforce/forget/space_transfer/transfer_to_global/admin`)
1260
- lets an operator prune low-frequency tools; `remember`/`recall`/`admin` are CORE
1261
- and cannot be disabled. A typo/prefix/full name, a core tool, or a duplicate aborts
1262
- config resolution with **`MEM_E_INVALID_TOOL_NAME`** (fail-fast, never silently
1263
- ignored). The register wrapper skips disabled suffixes AND the `memory` prompt
1264
- section stops advertising them, so the schema prune cannot lie to the model.
1265
- Editable over HTTP (`tools.disabled`) and rendered in the settings page as a
1266
- checkbox catalog with core-不可关闭 / low-frequency tooltips. Takes effect on the
1267
- next host start/reload (tool registration happens at activation).
1268
-
1269
- ### Fixed
1270
-
1271
- - **Route-drift lock**: a new test parses the client `API` constant table and
1272
- proves every path equals the backend `MEMORY_API` value verbatim, and that the
1273
- registered route table contains them all. Adding a route on one side without the
1274
- other now fails CI instead of 404-ing in production.
1275
- - **Capability handshake**: `/stats` (ready AND booting) and `GET /spaces` now carry
1276
- `capabilities: { version, spaces, memories, transferConsent, multiSpace }`.
1277
- The client checks `capabilities.spaces` BEFORE calling `POST /spaces`; if the
1278
- host is older it shows a version hint and disables the action instead of firing a
1279
- request that 404s. `memories` is gated the same way (old host → "当前宿主版本不
1280
- 支持记忆列表", not `MEM_E_MEMORIES`).
1281
- - **Human error copy**: every space-create failure now renders a complete sentence.
1282
- 404 / route-missing / network → `创建失败:底层引擎未响应,请检查版本或联系架构师`;
1283
- invalid name → `创建失败:空间名称无效——需以小写字母/数字开头,只能含 a-z 0-9 . _ -(最长 64)`;
1284
- duplicate → `创建失败:空间「33」已存在,请换一个名称`; reserved → `创建失败:该名称是
1285
- 系统保留名,请换一个`. The `MEM_E_SPACES: HTTP 404` template is gone from the bundle.
1286
- - **`MEM_E_SPACE_INVALID` (400)**: `validateNewSpaceId` + `Memory.createSpace` reject,
1287
- before any directory/JSONL write: empty/whitespace, wrong charset (`Bad`, `bad id!`,
1288
- path separators, `..`, `.`), >64 chars, trailing dot (Windows alias), Windows
1289
- device names (`con`, `nul`, `com1`, …), `default` (always exists), an existing
1290
- space (conflict), and a non-directory path collision. Creation returns `201`,
1291
- conflicts/invalid ids `400 MEM_E_SPACE_INVALID`.
1292
- - Fresh spaces are created from `POST /spaces` with a strict non-idempotent
1293
- `runtime.createSpace`; the lazy `ensureSpace` used by transfer keeps its
1294
- idempotent semantics.
1295
-
1296
- ### Tests
1297
-
1298
- - New `test/v153.spaces.test.js` (7 tests): client↔backend route-path equality
1299
- (the anti-404 lock), a real dispatch through the CLIENT path against the
1300
- registered host route table (handler answers 201, never a router 404),
1301
- invalid/reserved matrix, engine conflict-before-write, HTTP 201/400 + capability
1302
- handshake, human-copy mapper (no raw 404), capability gating for old hosts.
1303
- - Updated: `POST /spaces` assertions 200 → 201 strict creation; manifest 1.5.3.
1304
- - Full suite: **286 tests / 286 pass / 0 fail**, 39 test files (includes
1305
- `v154.release.test.js`).
1306
- - **Note (deployment)**: the live host process observed during the incident still
1307
- 404s `/spaces` and `/memories` — it must be restarted/reloaded for the new routes
1308
- to serve; until then the new client degrades with the version hint above instead
1309
- of a naked 404.
1310
-
1311
- ## [1.5.2] — 2026-11-02
1312
-
1313
- **Architecture correction: physical storage migration vs. business-data transfer
1314
- are now physically decoupled, and the UI has a real global SpaceSelector.** The
1315
- v1.5.0/v1.5.1 UI mixed two unrelated concerns and let the user type
1316
- `target_space_id`/`event_ids` by hand. Fixed and locked by tests. **270 tests
1317
- green** (was 263).
1318
-
1319
- ### Changed — UI (module decoupling)
1320
-
1321
- - **Physical dataDir migration extracted** into `StorageMigratorUI`, a SYSTEM/DATA
1322
- MANAGEMENT section at the bottom of the settings page. It owns only the A/B
1323
- double-buffer state machine: `POST { dataDir }` → `202 state=migrating` → copy →
1324
- verify → swap, old directory kept as a backup. No event ids, no spaces.
1325
- - **Business cross-space transfer removed from the settings form**: the manual
1326
- `event_ids` / `target_space_id` text inputs, the copy/cut buttons and the
1327
- inline confirmation are gone. Business transfer now exists ONLY in the panel's
1328
- regulated flow (below).
1329
- - **Global `SpaceSelector`** in the panel header: a dropdown of the physical spaces
1330
- (friendly labels: 默认空间 / 工作空间 / 私人空间 / 全局空间, unknown ids verbatim)
1331
- with `+ 新建空间` (creates an EMPTY space — never a copy). The selection is
1332
- app-global (`spaceStore` + `space-changed` bus event), so the panel and the
1333
- settings page follow it.
1334
- - **Every UI read follows the selected space**: `useMemoryStats`, `useGraph` and
1335
- `useRecentMemories` append `?space=<id>`; the backend routes `stats`, `graph` and
1336
- `memories` to that physical store. Memory list, graph, L1 log/index counts, L2.5
1337
- quarantine, L3 semantic count, L1.5 tag tree and the session status bar are all
1338
- that space's only — switching spaces cannot blend views or contexts.
1339
- - **Regulated cross-space flow (UI_TASK_3)**: check memories in the current space →
1340
- `移动到…` → dialog step 1 states `即将向 [目标空间] 发起迁移请求` → step 2 is the
1341
- SECOND explicit consent (`二次确认 · 安全红线`, with the cut warning when 剪切) →
1342
- only then is `user_approved: true` sent. Target is a dropdown of known spaces,
1343
- never a free-text id.
1344
- - `h(StorageMigratorUI)` is a separate component, so the two state machines can no
1345
- longer share draft state or validation.
1346
-
1347
- ### Added — backend routing
1348
-
1349
- - **`GET/POST /api/hippocampus/spaces`**: list the router's spaces / create an empty
1350
- one (`space_id`). The selector and `+ 新建空间` use it.
1351
- - **`?space=<id>` on `/api/hippocampus/stats` and `/api/hippocampus/graph`**:
1352
- `runtime.uiPayload(spaceId)` / `runtime.graphPayload(spaceId)` return that space's
1353
- panel/graph via `Memory.status({ targetSpaceId })` and
1354
- `Memory.graphForSpace({ targetSpaceId })`; a new space reports zeros (empty), so a
1355
- switched view is never a fallback to the default store.
1356
- - `Memory.ensureSpace()` (root router) and `runtime.spaceList()`.
1357
- - Panel status `panel.spaces.current` now reports the SELECTED space (was always
1358
- `default`), and `stats`/`graph` responses carry a top-level `spaceId`.
1359
-
1360
- ### Security (unchanged red line, stricter transport)
1361
-
1362
- - The HTTP transfer route no longer fabricates consent: it forwards
1363
- `user_approved` from the request and the ENGINE gate rejects a request that lacks
1364
- it with `MEM_E_REQUIRE_USER_CONSENT`. The UI only sets the flag after step 2. An
1365
- agent tool call and a raw POST that "bypasses the UI" therefore hit the same
1366
- wall.
1367
- - `dataDir` migration Fail-Fast strengthened: `validateMigrationPaths` now also
1368
- rejects an existing non-empty target (`MEM_E_MIGRATION_TARGET_BUSY`) and a
1369
- non-directory target (`MEM_E_MIGRATION_PATH`) synchronously, before a 202/job.
1370
- The old store remains authoritative on any rejection.
1371
-
1372
- ### Tests
1373
-
1374
- - New `test/v152.refactor.test.js` (7 tests): dataDir validation matrix
1375
- (missing/relative/same/inside/root/non-empty/non-dir) + `startMigration`
1376
- fail-fast with the old dir intact; space isolation for stats/graph/memories/
1377
- session/recall with `?space=`; `ensureSpace` empty space + spaces route;
1378
- unauthorized transfer blocked at engine AND HTTP, authorized passes; UI wiring
1379
- (SpaceSelector header mount, checkbox flow, no manual inputs, isolated
1380
- StorageMigratorUI).
1381
- - Updated contract assertions: HTTP routes 6 → 7 (spaces), transfer route requires
1382
- explicit `user_approved`, settings order now context → space/session → system
1383
- storage, cut second-confirmation now lives in the panel dialog, manifest 1.5.2.
1384
- - Full suite: **270 tests, 270 pass, 0 fail**.
1385
-
1386
- ## [1.5.1] — 2026-11-02
1387
-
1388
- **Security patch: cross-space transfer now requires EXPLICIT user consent.** Moving
1389
- memories between spaces is a data-egress action, not a memory optimisation. Two
1390
- independent locks (prompt + engine), plus a human-only UI path. **263 tests green**
1391
- (was 254).
1392
-
1393
- ### Added
1394
-
1395
- - **Prompt red line (`memory:policy`)**: a static `【🚨最高安全红线】` block forbids
1396
- the model from calling `memory_space_transfer` / `memory_transfer_to_global` on
1397
- its own judgement, sympathy, or "better cross-device sharing". The only allowed
1398
- trigger is a direct user command in the current conversation; when unsure the
1399
- model must ask `您需要我把这条信息同步到其他空间吗?`. It also documents the
1400
- `user_approved: true` retry protocol for `MEM_E_REQUIRE_USER_CONSENT` and states
1401
- that the intercept is never a one-off obstacle to bypass.
1402
- - **`memory_transfer_to_global` tool**: copy/move memories from a space into the
1403
- canonical `global` space, with the same privacy screen, raw_turn stripping, fresh
1404
- target ids and consent gate as `memory_space_transfer`. Both tool schemas expose
1405
- `user_approved` and their descriptions carry the security warning.
1406
- - **`context.requireExplicitConsentForTransfer`** (default **true**, validated
1407
- boolean, HTTP-editable and exposed in the settings page): the operator's master
1408
- switch for the engine gate. The settings toggle explains the risk.
1409
- - **`GET /api/hippocampus/memories`** (`limit`, `space`): bounded recent-memory
1410
- projection (`eventId`, `day`, `tags`, `snippet`) used by the panel's per-memory
1411
- detail rows. `Memory.recentMemories()` is read-only and index-snapshot based.
1412
- - **UI per-memory 分享/转移 button**: the panel now lists the 20 most recent
1413
- memories with a human-initiated transfer dialog (target space, copy/cut toggle,
1414
- second confirmation for cut). It calls the transfer route directly — **bypassing
1415
- the model entirely** — and the browser request is the consenting human.
1416
-
1417
- ### Fixed / Security
1418
-
1419
- - `Memory.transferEvents()` now throws
1420
- **`MEM_E_REQUIRE_USER_CONSENT`** with the fixed message
1421
- `[系统拦截] 跨空间传递需要用户明确授权。请向用户确认后再试。` when
1422
- `context.requireExplicitConsentForTransfer` is true and the call does not carry
1423
- `userApproved === true`. The gate runs **before** space ids are validated, before
1424
- any store is opened, before content is read and before any pending-delete record
1425
- is written, so a refused call is provably side-effect free.
1426
- - `POST /api/hippocampus/transfer` is documented and implemented as the **human
1427
- channel**: it marks `userApproved: true` itself (same-origin authenticated
1428
- browser request). The agent half cannot reach HTTP routes, so a UI click needs no
1429
- model involvement and a model call still hits the gate.
1430
- - The consent gate is strict: `userApproved` must be the boolean `true`; the
1431
- config value must be a boolean (a string like `"yes"` fails fast).
1432
-
1433
- ### Tests
1434
-
1435
- - New `test/v151.consent.test.js` (9 tests): default-on config + fail-fast type
1436
- check; engine gate fires before validation/IO (invalid target still answers
1437
- CONSENT, nothing parked, source untouched); agent tool blocked then succeeds only
1438
- with `user_approved: true`; `memory_transfer_to_global` same contract; explicit
1439
- config opt-out; engine-level facade contract; prompt red-line markers; HTTP route
1440
- marks consent; UI 分享/转移 + direct-API contract.
1441
- - Intentional contract growth updates: tools 9 → 10, HTTP routes 5 → 6, v150 UI
1442
- route/transfer assertions extended with `userApproved`, manifest 1.5.1.
1443
- - Full suite: **263 tests, 263 pass, 0 fail**.
1444
-
1445
- ## [1.5.0] — 2026-11-02
1446
-
1447
- Tag-explosion defence, physical multi-space routing, session handoff and the
1448
- cross-space transfer API. The plugin stays deliberately permission-free: the
1449
- complex permission choreography belongs to the future Orchestrator plugin, while
1450
- this engine owns only physical memory. **253 tests green** (was 200).
1451
-
1452
- ### Added — module 1: tag-explosion defence (P0)
1453
-
1454
- - **`index.maxPostingsPerTag` (default 500, 1–100000)**: derives the inverted index
1455
- with a hard physical cap per tag. When a tag exceeds it, the retained pointers are
1456
- chosen by `salience desc -> eventTime desc -> eventId asc` and re-sorted for
1457
- retrieval (`eventTime desc`, then id). `eventCount`, `mass` and `lastSeen` are
1458
- still aggregated over **all** events, so the counts the degradation layer reports
1459
- are honest; only the in-memory posting pointers are dropped (the JSONL log is
1460
- untouched and rebuildable). Tags expose `postingsLimit` / `postingsTruncated` /
1461
- `postingsDropped`; index stats expose `postingsTruncated` / `postingsDropped`.
1462
- - **Recall degradation for oversized tags**: an EXPLICIT query tag holding more than
1463
- 50 memories (`TAG_OVERFLOW_THRESHOLD`) is not expanded into the candidate pool.
1464
- The response carries `oversizedTagHints: [{ tag, total, code:
1465
- 'MEM_E_TAG_OVERFLOW', hint: '[系统提示] 发现关于 [tag] 的记忆共 N 条,数据量过大。
1466
- 请提供更精确的 startTime/endTime 或使用 deep_raw 查阅。', window }]` and the
1467
- course-block fallback is suppressed so the flood cannot re-enter through the back
1468
- door. If the caller insists (a second recall on the same tag), only the **3 most
1469
- recent** summaries are returned (`oversizedRecent: true`,
1470
- `oversized-tag-recent:3`). Graph neighbours of an oversized tag are never woken.
1471
- - **`deep_raw` super-tag gate**: a query touching a tag with more than 500
1472
- associations (`SUPER_TAG_THRESHOLD`) without `start_time`/`end_time` now throws
1473
- **`MEM_E_TIME_RANGE_REQUIRED`** (narrow queries keep the old
1474
- `MEM_E_INVALID_INPUT` contract). One authority decides: the tool no longer
1475
- pre-validates the window.
1476
-
1477
- ### Added — module 2: multi-space routing & session handoff (physical layer)
1478
-
1479
- - **Config** `context.autoSpaceFollow` (false), `context.autoRolloverEnabled`
1480
- (true), `context.autoRolloverThreshold` (0.85, 0.5–0.99),
1481
- `context.nativeTokenLimit` (8000, 512–1000000) — validated fail-fast, editable
1482
- over HTTP and in the UI.
1483
- - **`SpaceRouter`** (`src/spaces/spaceRouter.js`): `targetSpaceId` on
1484
- `remember`/`recall` routes to an isolated physical store
1485
- (`<dataDir>/spaces/<id>`, `default` = the existing store, so every old path is
1486
- byte-identical). One FIFO promise chain **per space**: same-space operations are
1487
- serialised, different spaces run concurrently (a single global lock would
1488
- reintroduce the cross-space stalls spaces exist to remove). Ids become directory
1489
- names, so `^[a-z0-9][a-z0-9._-]{0,63}$` is enforced and a typo fails with
1490
- `MEM_E_INVALID_INPUT` instead of silently writing into the default space.
1491
- `runMany` acquires in sorted order (no ABBA deadlock).
1492
- - **Qwen native fidelity**: `ContextEngine.nativeState()` reports
1493
- `mode: 'native' | 'layered'`; below `nativeTokenLimit` nothing is folded (folding
1494
- is a layered-mode operation), above it the L1.5 layered fold runs. The legacy
1495
- `maxTokens` paging threshold is untouched.
1496
- - **Automatic handoff (转生)**: when the session reaches
1497
- `autoRolloverThreshold x nativeTokenLimit`, the tail is distilled into ONE durable
1498
- L1.5 summary (`status:handoff`), `state/handoff.json` is marked active and the
1499
- `memory-state` prompt appends `[交接标记] … 本插件不能保证一个会话永生不死,只能
1500
- 保证人格不死。`. A new session consumes the marker. Handoffs are idempotent (one
1501
- summary per handoff) and self-trigger from the `session/event` stream and from
1502
- tool boundaries. With `autoRolloverEnabled: false` no marker is written and
1503
- ContextEngine force-evicts at 95% (`reason: 'native-force'`, down to
1504
- `target x nativeTokenLimit`).
1505
- - **Panel/status**: `panel.session` (`mode`, `tokens`, `nativeTokenLimit`,
1506
- `threshold`, `remainingTokens`, `rolloverEnabled`, `handoffActive`, …) and
1507
- `panel.spaces` (`current`, `ids`, `open`) are part of the UI contract.
1508
-
1509
- ### Added — module 3: atomic cross-space transfer
1510
-
1511
- - **`memory_space_transfer` tool** (`event_ids`, `target_space_id`,
1512
- `transfer_mode: 'copy' | 'move'` default copy, optional `source_space_id`) and
1513
- `Memory.transferEvents()`.
1514
- - **Safety rails enforced by the engine, not the caller**: privacy screening aborts
1515
- the whole batch with **`MEM_E_PRIVACY_BLOCKED`** (ID cards, CN phones, bank cards,
1516
- emails, credential assignments, PEM private keys; matched bytes never leave the
1517
- scanner) before any write; `raw_turn` / `rawTurn` / `raw_*` pointers are stripped
1518
- from meta at every depth; the TARGET space regenerates `event_id`s
1519
- (`dedupe:false`, never reuses the source identity) and tags copies
1520
- `transferred:from:<source>` + `transferred:to:<target>`.
1521
- - **State difference**: `copy` leaves the source untouched (`state: 'retained'`);
1522
- `move` parks the source ids in the **two-phase pending_delete queue**
1523
- (`state: 'pending_delete'`, `dueAt`, cancellable with `restore`) only after every
1524
- target write succeeded — never a direct physical delete, and a partial target
1525
- failure leaves the source untouched.
1526
- - **HTTP**: `POST /api/hippocampus/transfer` (same-origin, validated body) for the
1527
- UI migration button.
1528
-
1529
- ### Added — module 4: UI
1530
-
1531
- - **Space panel**: soft-follow toggle (`context.autoSpaceFollow`), auto-rollover
1532
- toggle, trigger-ratio slider, native-window field, single-tag index cap control,
1533
- and a live status bar: `[当前: 原生模式 | 剩余 X Tokens 触发交接]` (also
1534
- `分层折叠` / `已交接` variants).
1535
- - **Migration interaction**: copy/cut (复制/剪切) toggle next to the transfer button;
1536
- choosing 剪切 requires a **second confirmation warning** before any request is
1537
- sent.
1538
- - **Philosophy footer** (bold, bottom of the settings page): **本插件不能保证一个
1539
- 会话永生不死,只能保证人格不死。**
1540
- - **Subtraction**: the tag search box uses the host-native Enter key only — no
1541
- debounce, no timer, no effect. `filterGraphByQuery` is pure and testable; the
1542
- force layout is not re-run by filtering.
1543
-
1544
- ### Changed
1545
-
1546
- - `uiConfig` exposes `index`; `Memory.applyLiveConfig()` projects a validated config
1547
- onto the facade **and every open child space**, including the context engine's
1548
- native/rollover overrides.
1549
- - `Memory` opens child spaces lazily with the same policy input; `close()` closes
1550
- children first; a child failure never blocks the rest.
1551
- - The `memory-state` prompt only gains the handoff block when a marker is active,
1552
- so the cache-stable prefix is unchanged in the common case.
1553
-
1554
- ### Tests
1555
-
1556
- - New files: `v150.index.test.js` (truncation/degradation/super-tag gate),
1557
- `v150.space.test.js` (per-space concurrency, native boundary, forced eviction),
1558
- `v150.transfer.test.js` (copy/move state difference, privacy, raw_turn strip,
1559
- fresh ids), `v150.ui.test.js` (bundle contract, helpers, no debounce, footer,
1560
- transfer route), `v150.lifecycle.test.js` (Qwen mode, threshold handoff, marker
1561
- consumption, `targetSpaceId` isolation, ninth tool surface),
1562
- `v150.config.test.js` (new groups, ranges, HTTP editability).
1563
- - Intentional contract updates in old tests: 8 -> 9 tools, 4 -> 5 routes,
1564
- `panel.session`/`panel.spaces` added to the panel snapshot, manifest 1.5.0.
1565
- - Full suite: **253 tests, 253 pass, 0 fail** (old 200 cases included unchanged).
1566
-
1567
- ## [1.4.3] — 2026-11-02
1568
-
1569
- Two measured blockers from the 2026-11-02 handoff, both fixed and locked by tests.
1570
-
1571
- ### Added
1572
-
1573
- - **`raw.maxScanTurns` config (500–50000, default 5000)**: `deep_raw`'s scan budget
1574
- was a hidden constant and is now a validated, UI-editable knob (`raw.maxScanTurns`).
1575
- - **`stage()` / `commitMany()`**: remember is now a `stage -> commitMany` composition.
1576
- `stage()` validates and builds a record (identity + idempotency, no log/index I/O);
1577
- `commitMany()` performs ONE durable append, ONE ledger checkpoint and ONE index
1578
- delta for a whole batch. `bulkIngest` uses it, so a 50-item chunk is one write
1579
- instead of 50.
1580
- - **`memory-state` prompt is now composed** via `composePrompt`: stable rules →
1581
- `[Memory Map]` (active tags + counts) → `[Memory Blocks]` (the only per-turn
1582
- volatile tail). The old single-line `briefing()` is no longer the prompt body
1583
- (it changed on every write and broke the prefix cache). Full-chain tests lock the
1584
- prefix to be byte-identical before/after a recall injects a block.
1585
- - **`scripts/confidence-ab.mjs`**: local A/B benchmark for `context.minInjectConfidence`
1586
- (100 noise + 10/3 relevant; characters, hits, low-confidence hints, mis-degraded
1587
- relevant memories). Run it with `node scripts/confidence-ab.mjs`.
1588
- - **Crash-restart test**: kills the process inside the 200ms checkpoint window
1589
- (cancelled timer, no `close()`), reopens the same directory, and asserts the fresh
1590
- instance reports `stale` (`unflushed-bytes`), rebuilds the index and can recall the
1591
- unflushed tail.
1592
-
1593
- ### Fixed
1594
-
1595
- - **`injectRecall()` crashed on any L3 semantic hit**: it used `summary.id` while
1596
- `rankSemantic()` returns `summaryId`, so a recall with a distilled summary and
1597
- `context.injectPrompt` failed with `MEM_E_IO: ContextEngine.inject requires an id`.
1598
- Now it uses `summaryId ?? id` and skips invalid summaries. Found by the new
1599
- prompt/tag-tree full-chain test.
1600
- - `logStore.status()` now exposes `unflushedBytes` (shard size minus manifest bytes)
1601
- so an unclean shutdown cannot hide the uncheckpointed tail behind equal counters.
1602
-
1603
- ### Changed
1604
-
1605
- - **`deep_raw` scans NEWEST-FIRST** (per shard, tail to head). The old head-first
1606
- scan burned its whole budget on the oldest 5000 turns of a day file — in a 10k
1607
- shard the newest turn could never be found. A hit beyond the window now returns
1608
- `truncated: true` with a note instead of pretending the turn does not exist.
1609
- - **Buffered log append**: the hot path keeps one append handle without fsync +
1610
- manifest rewrite per record. A 200ms checkpoint (and `close()`, and any
1611
- rewrite/compaction) fsyncs and publishes the manifest; `status().unflushedBytes`
1612
- plus the boot check make a mid-burst crash visible as stale instead of silently
1613
- "up to date".
1614
- - **Identity ledger checkpoint is debounced** (500ms / `close()`): it is a derived
1615
- startup hint rebuilt from the log, so rewriting it per append was pure O(n²) cost.
1616
- - **Index appends are lazy**: `applyRecords` records the delta and marks the view
1617
- dirty; the next `snapshot()` folds it once. N writes cost one index build, and
1618
- read-your-writes still holds because the fold happens on the read path.
1619
- - **Briefing is dirty-driven**: a write marks the prompt-state line stale; the next
1620
- `briefing()` / panel poll rebuilds it once instead of every append.
1621
-
1622
- ### Measured
1623
-
1624
- - Sequential `memory.remember` x1000: **119/s -> 9104/s** (8.4s -> 110ms).
1625
- - 10,000-line raw shard, newest query: **0 hits -> 1 hit** (`deep_raw` now starts at
1626
- the tail; hash restore and redaction regression-guarded).
1627
- - **`deep_raw` tail-scan bias documented**: beyond `raw.maxScanTurns` (default 5000)
1628
- per shard, only the newest N turns are covered; older history needs a larger budget
1629
- or time-window pagination (`end_time` moved backwards). `truncated: true` + notes
1630
- always say so.
1631
- - **Confidence A/B (measured)**: `minInjectConfidence=0.6` cuts the tool payload by
1632
- **49.7%** (10 relevant / 100 noise) and **75.8%** (3 relevant / 100 noise), with
1633
- **0 relevant hits mis-degraded**; the prompt window only shrinks when the top-8
1634
- contains noise (0% vs 59.7% in the two scenarios), so the honest claim is
1635
- "long-tail payload + anti-hallucination", not "always fewer prompt tokens".
1636
- - 197 tests green (was 189); after the prompt/tag-tree full-chain wiring and the
1637
- crash-restart test: **200**.
1638
-
1639
- ## [1.4.2] — 2026-11-01
1640
-
1641
- ### Added
1642
-
1643
- - **L1.5 标签层级树**: hierarchical tags (`tech/frontend/vue3`) now have a
1644
- three-level lifecycle — immortal roots, leaves that die when their reference
1645
- count reaches zero, and mids that enter a grace window when they lose their last
1646
- child. A mid inside that window is a **ghost**: it can be revived by a new leaf,
1647
- and it is what the UI's history view shows. The tree is a **derived cache**
1648
- (`state/tag-tree.json`) built by `maintain()` from the converged index; the
1649
- previous cache is carried forward (`refCount = 0`, orphans dropped) so the
1650
- lifecycle is observable across maintenance runs. Deleting the file loses only
1651
- ghost history.
1652
- - **Bounded prune queue**: dead leaves are queued and consumed one
1653
- `tagTree.pruneBatchSize` batch per maintenance run; the remaining queue is
1654
- persisted in the same atomic write, so a 10k-leaf storm drains across runs
1655
- instead of causing a maintenance storm.
1656
- - **Anti-hallucination recall degradation**: a `memory_recall` hit reached only
1657
- through a fading mid is **removed from `hits` entirely** (body, snippet and score
1658
- never reach the model or the prompt window) and replaced by one metadata hint per
1659
- mid: path, count, remaining grace days and the exact `deep_raw` time window. A
1660
- query that names a fading mid with no live episode returns a `count: 0` hint
1661
- instead of silence.
1662
- - **`panel.tagTree`**: node/root/mid/leaf/ghost/queue counts for the Web panel, and
1663
- `GET /api/hippocampus/graph` now returns `tagTree.ghosts` in the same response as
1664
- the cached graph.
1665
- - **UI**: `tagTree.*` sliders with numeric boxes and hover tooltips in the settings
1666
- section; ghost nodes rendered in the force graph as translucent dashed circles
1667
- hanging under their parent root, with a `仅活跃 / 历史全貌` toggle that cross-fades
1668
- them via CSS opacity (the force layout does not re-run when toggling).
1669
- - **Config `tagTree` group** (fail-fast, editable over HTTP and in the UI):
1670
- `midHalfLifeMultiplier` (1–10), `midGracePeriodDays` (7–180),
1671
- `pruneBatchSize` (10–500), `leafDecayFloor` (0–1). `midHalfLifeMultiplier` is the
1672
- only source of the mid half-life — no silent hard-coded lifetime.
1673
-
1674
- ### Changed
1675
-
1676
- - `maintain()` now rebuilds/prunes/persists the tag tree after the index
1677
- generation converges; a tag-tree failure is reported as `report.tagTreeError`
1678
- and can never fail maintenance or block recall.
1679
- - `applyConfig` now projects the validated config onto the running `Memory` facade,
1680
- so live UI edits (raw limits, tagTree lifetimes, …) actually reach the running
1681
- objects instead of waiting for a reload.
1682
- - `pruneBatch` re-derives decay against the pass's `now` (a frozen build-time score
1683
- made grace windows meaningless), rejects `O(mids × nodes)` rescans, and keeps
1684
- parent child counts truthful when a mid dies.
1685
-
1686
- ## [1.4.1] — 2026-11-01
1687
-
1688
- ### Added
1689
-
1690
- - **Prompt discipline (soft interception)**: a static `memory:policy` section tells
1691
- the model to prefer `memory_recall` for history/files/system facts, and to treat
1692
- a `[Slimmed]` response as an invitation to answer from the summary unless the
1693
- `recovery_hash` must be dereferenced.
1694
- - **Own-tool output slimming**: `memory_recall`/`memory_admin` responses over the
1695
- budget (default 2000 tokens) are captured to raw first, then returned as
1696
- `{slimmed, summary, topics, key_entities, recovery_hash, hint}`; the hint points
1697
- at `memory_recall(mode="deep_raw", hash=…)`, which restores the exact payload.
1698
- - **Retrieval confidence**: hits below `context.minInjectConfidence` (default 0.6)
1699
- carry a short hint instead of their full body, plus a `low-confidence-hints:N` note.
1700
- - **Write flood guard**: writes above 80% of `storageBudgetMb` throw
1701
- `MEM_E_WRITE_FLOOD`; `memory.bulkIngest` chunks 50 items per await and ships as
1702
- `memory_bulk_ingest`.
1703
- - **raw.captureRatio** (0 | 0.5 | 1): deterministic sampling by content hash;
1704
- ratio 0 disables capture and `deep_raw` returns an explicit warning.
1705
-
1706
- ### Changed
1707
-
1708
- - `memory_recall` gains `hash` (exact raw restore) and confidence fields; deep_raw
1709
- results honour the token budget before returning.
1710
- - `promptLayout` composes stable rules → memory map → `[Memory Blocks]` tail.
1711
-
1712
- ## [1.4.0] — 2026-10-31
1713
-
1714
- ### Added
1715
-
1716
- - **Raw-turn forensics (`memory_capture`, `memory_recall mode:"deep_raw"`)**: a
1717
- separate day-sharded JSONL store (`raw/`) that is never indexed, never loaded at
1718
- boot, and never touched by normal recall. Gated by `raw.mode` (default
1719
- `salience`: high-salience, code, stack traces, tool output, or `force`), deduped
1720
- by content hash, secret-redacted, and capped by `maxTurnKb` (head+tail
1721
- truncation), `maxBytesPerDay`, `maxTotalMb`, and `retentionDays` (pruned by
1722
- maintenance; code shards keep 90 days). `deep_raw` scans newest→oldest under a
1723
- byte/turn budget and reports `truncated: true` instead of pretending it saw
1724
- everything.
1725
- - **Spaced repetition**: engine-owned schedule (`1,2,4,7,15,30` days) persisted in
1726
- `state/reviews.json`; `maintain()` reconciles due items and `reinforce` advances
1727
- the step. Exposed as `memory_admin action="reviews"`.
1728
- - **Two-phase delete**: `forget` parks the event for `delete.graceHours`
1729
- (default 24) in `pending_deletes`; `restore` cancels it, and `maintain()`
1730
- promotes expired requests into the 4-phase pipeline. Unknown ids now fail
1731
- immediately, before parking.
1732
- - **UI data-dir migration**: `dataDir` is editable in the settings page. Saving it
1733
- takes `.migration.lock`, returns HTTP 202 with `state=migrating`, copies with
1734
- `fs.promises.cp` in the background, verifies `recordCount` on both sides, and
1735
- only then switches and reloads the store. A mismatch removes the target and
1736
- keeps the old store authoritative; the source is never deleted.
1737
- - New config groups: `raw.*`, `delete.graceHours`, `review.enabled`,
1738
- `migration.timeoutMs` (all fail-fast validators, UI tooltips included).
1739
- - **Raw-turn black box (minimal schema)**: each line is exactly
1740
- `{turn_id, timestamp, role, content}` — no tags, salience, decay, event ids,
1741
- graph links, session ids or metadata. Addressing is by `(day file, line number)`;
1742
- append-only keeps lines stable (the one lawful line-pointer exception).
1743
- Writes are queued and flushed in batches (10 records / 1s), never sync.
1744
- - **Read-side redaction**: the shard keeps 100% plaintext (forensic integrity);
1745
- secrets are redacted when `deep_raw` returns snippets, before any text reaches a
1746
- model prompt. README states local storage is plaintext.
1747
- - **Tombstones**: a committed purge appends `raw_tombstone {hash, timestamp}`;
1748
- scans skip tombstoned content hashes (no resurrection).
1749
- - **deep_raw constraints**: `start_time` and `end_time` are mandatory (missing →
1750
- `MEM_E_INVALID_INPUT`), results are capped by `raw.maxResultTokens` (default
1751
- 1000) and carry the truncation notice when cut.
1752
- - **TTL**: maintenance deletes whole day files strictly older than
1753
- `today - raw.retentionDays`; today's shard is never touched. Raw bytes are
1754
- surfaced as `panel.storage.rawBytes` and counted in the dashboard ring.
1755
- - **Automatic raw capture**: the plugin subscribes to `dsh-session`'s
1756
- `session/event` and stores every user/assistant surface message verbatim
1757
- (`raw.autoCapture: true`). The Host-injected `Current runtime context.` block is
1758
- stripped out of `content` and kept (truncated) in `metadata.runtimeContext`, so
1759
- `deep_raw` stays signal-clean. Tool output is opt-in (`raw.captureTools: false`),
1760
- **except failed tool results** (`isError`), which are always captured as
1761
- `kind: "error"`. Budgets, dedupe and retention still apply.
1762
-
1763
- ### Changed
1764
-
1765
- - Panel adds `raw`, `reviews`, and `pendingDeletes`; the settings page renders a
1766
- migration progress card while `state=migrating`.
1767
- - `Memory._scheduler` cron now reads `runtime.config` per tick, so a hot config
1768
- update changes the schedule without a restart.
1769
-
1770
- ## [1.3.1] — 2026-10-30
1771
-
1772
- ### Fixed
1773
-
1774
- - **Cold-start 404 (root cause)**: `webServer` is provided by the web-app row, which
1775
- activates *after* this plugin's `apply()`. The old code called
1776
- `ctx.get('webServer')` once and silently skipped registration when it was
1777
- absent — every cold start had no routes, while a warm reload worked. Route
1778
- registration now lives in `ctx.inject(['webServer'], child => …)`, so the child
1779
- fiber activates the moment the service appears and the routes are always
1780
- mounted. Verified live (404 → 200) and covered by a deferred-inject test.
1781
- - **Front-end death spiral**: a bodiless 404 used to be synthesized into a JSON
1782
- error, which the old retry counter treated as a protocol failure and gave up
1783
- after six attempts. `getJson` now keeps "no JSON" distinct, and the pure
1784
- `decideRetry` policy retries bodiless 404s with exponential backoff (capped at
1785
- 5s) for up to 10 minutes before surfacing `MEM_E_BOOT_TIMEOUT` with a manual
1786
- reconnect button.
1787
- - **Diagnostics**: `apply()` prints `[Hippocampus] Route registered at <iso>
1788
- (<paths>) phase=<phase>` when the routes are mounted, and
1789
- `[Hippocampus] Route registration FAILED: <reason>` if the service never
1790
- provides one.
1791
-
1792
- ## [1.3.0] — 2026-10-30
1793
-
1794
- ### Added
1795
-
1796
- - **Context folding (推币机)**: blocks evicted from the context window are no longer
1797
- dropped. A light rule folds the most recent batch into one `folded_summary`
1798
- episode tagged `status:folded` — extracting names, task statements and core
1799
- conclusions — and writes it back to the L1 log.
1800
- - **Graph association (在线联想)**: when a query touches a tag, retrieval reads the
1801
- cached graph and pulls that tag's three strongest neighbours into the candidate
1802
- pool with an explicit `penalty: 0.5`; such hits are marked `association.via` and
1803
- can never outrank a direct hit.
1804
- - **Monthly memos (月记)**: `maintain()` condenses a finished natural month into one
1805
- `status:monthly` episode. Memos do not decay (`decay = 1`) and are pulled in
1806
- first for fuzzy historical queries ("上个月", "2023-10", "去年" …).
1807
-
1808
- ### Changed
1809
-
1810
- - HTTP routes are now registered **before** tools, prompts and scheduling inside
1811
- `apply()`, so a page that wins the boot race hits a live handler answering
1812
- `state=pending` instead of a 404. The Host-side assumption is documented in the
1813
- code: `apply()` awaits nothing, and route service is expected once it returns.
1814
-
1815
- ## [1.2.0] — 2026-10-30
1816
-
1817
- ### Added
1818
-
1819
- - **`memory_checkpoint`** (`task_id`, `progress`, `updated_at`): exactly one active
1820
- heavy task. A new checkpoint demotes the previous one, one not refreshed for
1821
- seven days is demoted by `maintain()`, and `memory_admin action="active_task"`
1822
- reads it straight from the index — the active-set cap of 200 does not apply.
1823
- - **Multimodal pointers**: `memory_remember` accepts `media_url` (absolute path or
1824
- http(s) URL) plus `media_type` (`image|video|document|audio`). Inline base64 in
1825
- `content` is rejected with `MEM_E_INVALID_MEDIA` from 256 consecutive base64
1826
- characters; 200 characters is still ordinary text.
1827
- - **`decay.halfLifeDays`** (default 30, 7–365) and **`activeSet.cap`** (default 200,
1828
- 100–1000): both declared in `DEFAULT_CONFIG`, validated fail-fast by
1829
- `resolveConfig`, projected into `policy`, and editable from the settings page.
1830
- - **State handshake**: every route response now carries `state`
1831
- (`pending|in_progress|ready|failed`), and the UI retries on `state` rather than
1832
- on the HTTP status. A bodiless 404 during boot is treated as `pending` for a
1833
- 120s grace window (the routes are only mounted once the Host runs `apply()`).
1834
-
1835
- ### Changed
1836
-
1837
- - Writes before READY are refused loudly: `POST /api/hippocampus/config` answers
1838
- `409` with `MEM_E_NOT_READY` and the current state; tools already answered
1839
- `MEM_E_NOT_READY`, and their error details now include `state` and `retryable`.
1840
- - The settings page covers the full editable surface (18 keys), with the documented
1841
- hints for `storageBudgetMb`, `context.maxTokens`, `decay.halfLifeDays` and
1842
- `activeSet.cap`; saving before READY is disabled in the UI and rejected by the API.
1843
-
1844
- ## [1.1.0] — 2026-10-29
1845
-
1846
- ### Added
1847
-
1848
- - **Graph dragging**: nodes are movable with pointer events. The dragged node is
1849
- pinned for the duration, coordinates are mutated in a ref and painted straight
1850
- to the DOM (no `setState` per frame), and release unpins it and runs a short
1851
- alpha relaxation over its 1-hop neighbourhood. A pointer travel under 4px is
1852
- still a click, so selecting a label can never move the node by accident.
1853
- - **`storageBudgetMb`** (integer, default 50, range 10–1000): the storage ring's
1854
- budget is now configurable instead of hard-coded, and the ring recomputes the
1855
- moment the value is saved.
1856
- - **Full settings UI**: every editable config key is in the settings section —
1857
- switches for booleans, bounded number inputs, a select for
1858
- `identity.eventTimePolicy`, and a text field for the maintenance cron. Saving
1859
- posts one dotted-path patch through the same fail-fast validator as startup;
1860
- a rejected value shows a red banner with the `MEM_E_CONFIG_*` code and nothing
1861
- is applied. A successful save broadcasts `config-changed` so the panel
1862
- refetches stats and graph immediately.
1863
-
1864
- ### Fixed
1865
-
1866
- - Dotted config paths deeper than one level (`identity.eventTimePolicy`,
1867
- `retrieval.topK`) now nest correctly instead of producing a literal key.
1868
-
1869
- ## [1.0.0] — 2026-10-29
1870
-
1871
- First public release. The package was previously developed under the working
1872
- names `@local/dsh-memory` / `Layers-Hippocampus`; the data directory is
1873
- unchanged and legacy folders are migrated automatically.
1874
-
1875
- ### Added
1876
-
1877
- - **Layers**: append-only event log, rebuildable tag index (A/B generations),
1878
- day diaries, independent semantic layer, L2.5 trend quarantine with promotion
1879
- and burst detection.
1880
- - **Identity discipline**: canonical `content_hash`, `event_id =
1881
- hash(content_hash + event_time + occurrence_index)`, separate idempotency
1882
- index, tombstones that survive log compaction.
1883
- - **Context paging**: token budget, eviction thresholds, cumulative saved-token
1884
- accounting persisted in `state/context.json`.
1885
- - **Maintenance**: one gate for cron and Dream (`runtime.runMaintenance`), no
1886
- queueing and no backfill; a missed window is skipped, not replayed.
1887
- - **Config fail-fast**: `enableDream`, `dreamIdleMinutes`, `enableReflection`,
1888
- `graphMaxEdges` (100–2000, default 500), cron, context and temp ranges are
1889
- validated by `resolveConfig`; HTTP hot updates go through the same validator.
1890
- - **Async startup state machine** `pending → in_progress → ready | failed`, with
1891
- `POST /api/hippocampus/retry` and a UI retry banner.
1892
- - **Offline knowledge graph**: built at the end of `maintain()` from the index
1893
- (log minus tombstones), per-node Top-N neighbours, global weight order, cached
1894
- at `state/graph.json`, hard cap 2000 edges.
1895
- - **Web UI**: sidebar icon, main panel (SVG storage ring, stats, force-directed
1896
- graph with progressive reveal), and a settings section.
1897
- - **HTTP API** (same-origin, behind the Host's browser auth):
1898
- `GET /api/hippocampus/stats`, `GET|POST /api/hippocampus/config`,
1899
- `GET /api/hippocampus/graph`, `POST /api/hippocampus/retry`.
1900
- - **Tests**: 106 in-process cases (Node `node:test`) covering identity,
1901
- retrieval, L2.5, maintenance, migration, routes, graph and the client bundle
1902
- contract.
1903
-
1904
- ### Security
1905
-
1906
- - The UI never receives credentials and never calls agent tools; every number is
1907
- read through the Host's authenticated JSON routes.
1908
- - The graph route returns at most `graphMaxEdges` edges from a cached file — no
1909
- query language, no path input.
1910
-
1911
- [1.0.0]: https://github.com/382quaii/dsh-Layers-Hippocampus/releases/tag/v1.0.0
218
+ - **Docs**:`记忆插件-未完成表.md` 从「2026-11-05 待办审计」重写为「当前状态表」——
219
+ A1–A21 逐项给出关闭依据,13 项关闭、2 项 superseded、2 项并入 M3/M6、4 项明确不做
220
+ (并写明为什么不做),另列仍需外部动作的四项(npm 账号封控等)。
221
+
222
+ ## [1.6.7] — 2026-11-17
223
+
224
+ **发布链完整性修正 + 索引式提示注入(M1)。1.6.6 在 npm 上的制品(`gitHead 99a07cb`)
225
+ 是从一份**旧 checkout** 发布的,只带来 Live Compact 修复,**不含** M3(测试跨包解耦)
226
+ 与 M5(错误码边界)。1.6.7 把这两项送往 npm,并让仓库历史与已发布标签不再分叉;
227
+ M1 则是本版的主线功能——每轮 Prompt 不再为记忆**正文**付费。**
228
+
229
+ - **Added — 外部价格 / 通知接缝(M2)**。`dsh-price-tip` / `dsh-peak-runner` /
230
+ `dsh-notify-plugin` 在本机**并不存在**,因此没有「接线真实 API」可做——凭空猜服务名
231
+ 等于发明接口。本版只做**可验证的可选接缝**:
232
+ - `HostBridge.setNotifier(sink)` + `notify({title,text,kind,at})`:没有 sink 时返回
233
+ `{delivered:false, reason:'no-notifier'}` 并只记计数,**绝不发明投递通道、绝不抛错**;
234
+ sink 抛错也只记 `sink-error`,不会污染维护流程。
235
+ - `index.js` 探测一组**约定键**(`priceTip` / `notifier` / `peakRunner`,或 `notify` / `peak`),
236
+ 并接受多种方法形状(`isLowValley|lowValley|isLow|price`、`notify|send|post`、
237
+ `isPeak|peak|isHigh`)。外部价格服务优先于内置时间窗;`DSH_DREAM_PRICE` 仍可强制覆盖。
238
+ - `capabilities.externalSeams` 报告**哪条接缝真的接上了**(`{wired, source}`),
239
+ 所以「没装」是可见事实而不是静默降级。
240
+ - 一旦通知接缝可用,「Dream 因高峰被推迟」会通过它播报(内含 `dueAt`);没有接缝时
241
+ 这件事仍由持久化队列与 `dream-deferred` 事件表达,行为不变。
242
+ - **排队本来就是实装的**:`index.js` 的 `tick()` 在高峰把 LLM 蒸馏写入 `dreamQueue`
243
+ 并在谷时唤醒(`reason: 'peak-hour'`),不是丢弃,本次未改动该逻辑。
244
+ - **Changed — 多空间开关的语义澄清(M6)**。`features.multiSpace` 默认 `true`,但只有注入了
245
+ 能创建空间适配器的 `orchestrator` 服务时才真正生效——以前这个差异是**静默**的:
246
+ 用户以为开了多空间,实际在跑单空间。现在新增 `multiSpaceReason()`,返回
247
+ `'active'` / `'disabled-by-config'` / `'orchestrator-missing'` 三态,
248
+ 通过 `capabilities.multiSpaceReason` + `capabilities.multiSpaceRequested` 与
249
+ `panel.spaces.{requested,reason}` 同时暴露,设置页在多空间卡片里直接写明
250
+ 「当前被配置关闭:features.multiSpace=false」,不再把「没装适配器」和「你关了它」
251
+ 混成一个 `spaces:false`。**开关本身没有改默认值**(改默认会静默改变已部署 profile 的行为),
252
+ 改的是可观测性与文档;并有用例锁住「布尔值与理由不可能互相矛盾」。
253
+ - **Changed — 索引式提示注入(M1)**。`context.injectMode` 新增两个取值:
254
+ - `index`(**新默认**):每个记忆块只注入一行指针
255
+ `- [memory <eventId>] 标签 · 标签 · 标题`。正文不进 Prompt,需要细节时用
256
+ `memory_recall` 按 eventId / 标签取。`[Memory Blocks]` 标记名保持不变,因此缓存前缀
257
+ 语义不变;规则段多一行「这些是索引指针,正文须调 recall」,**只在 index 模式下出现**。
258
+ - `full`:沿用旧版渲染(正文前 200 字)与旧版计费(整段正文),一行代码即可回退。
259
+ - **窗口计费随渲染形态走**:`ContextEngine.tokensOf()` 在 index 模式下只计指针行,
260
+ 在 full 模式下仍计整段正文(旧口径,不动既有调优);调用方**显式传入的 `tokens`
261
+ 永远优先**,折叠与驱逐的排序不变。
262
+ - `index` 模式下 `tokens()` 的实测差异是数量级的:8,000 字符的正文约 2,000 tokens,
263
+ 指针行通常 < 60 tokens。
264
+ - `briefing` 块(运营方钉死的策略)**永不降级为指针**,始终整段渲染。
265
+ - 可编辑键新增 `context.injectMode`(`index` / `full`,非法值 fail-fast),设置页
266
+ 「上下文窗口」卡片新增下拉;简洁模式下同样可见可存。
267
+ - **Changed — 测试与兄弟包解耦(M3)**。`test/orchestrator.js` 先按包名 `dsh-layers-orchestrator/src/*`
268
+ 解析、失败再退回同级 checkout(`via: 'package' | 'sibling'`);22 个真正依赖多空间的用例改走
269
+ `orchestratorTest()`,缺包时注册为 **skipped 并带原因**而不是 import 阶段崩掉整套测试。
270
+ `makeMemory()` 的 `multiSpace` 默认值改为 `MULTI_SPACE_AVAILABLE`,杜绝 `new null()`。
271
+ 实测:两包在位 **510/510**(skipped 0);单独 checkout 时 **454 pass / 0 fail / 56 skipped**。
272
+ - **Changed — 错误码边界(M5)**。`dsh-orchestrator` 内两套命名空间是**故意**并存的:
273
+ `MEM_E_*`(从核心搬出去的引擎沿用,客户端 HTTP 映射依赖它)与 `ORCH_E_*`(路由器/去重/联邦/授权)。
274
+ 海马体侧新增单一边界 `src/errors.js#fromOrchestratorError()` + `ORCHESTRATOR_CODE_MAP`:
275
+ `ORCH_E_CONSENT_*` → `MEM_E_REQUIRE_USER_CONSENT`(三个都映射到同一处,因为修法是去问人而不是重试)、
276
+ `ORCH_E_SPACE_INVALID` → `MEM_E_SPACE_INVALID`、`ORCH_E_INVALID_INPUT` → `MEM_E_INVALID_INPUT`、
277
+ `ORCH_E_NOT_READY` → `MEM_E_NOT_READY`、`ORCH_E_FEDERATION_CONFLICT` → `MEM_E_FEDERATION_FAILED`;
278
+ **未列入的 `ORCH_E_*` 不会被拍平成 `MEM_E_IO`**,原始码保留在 `details.orchestratorCode` 里可审计。
279
+ 映射表同步写进 `dsh-orchestrator/README.md` 的「错误码边界」一节。
280
+ - **Tests**:新增 `test/v166.errorContract.test.js`(7 例)与 `test/v167.m1.test.js`(9 例:
281
+ 默认 index、指针行构成、index 计费 = 渲染行、full 保留旧渲染与旧计费、显式权重优先、
282
+ briefing 不降级、标题截断与回退、`injectMode` 校验与可编辑、规则段只在 index 出现、
283
+ recall 命中把标签与标题带进窗口且正文尾巴不出现);
284
+ `test/v156.features.test.js` 新增 M6 用例(`multiSpaceReason` 三态 + 显式关闭优先于
285
+ 缺适配器 + 「布尔值与理由不可能矛盾」的交叉断言);
286
+ `test/v167.m2.test.js`(6 例)锁住 M2 接缝:无 sink 时为 `no-notifier` 的记账型空操作、
287
+ sink 收到 payload 且被计数、sink 抛错只记 `sink-error` 不外溢、`externalSeams()` 如实报告
288
+ 「通知与高峰缺席、价格回退本地时间窗」、注入 `notifier` 服务后被自动发现并可用、
289
+ 注入 `priceTip` 后外部价格**优先于**本地时钟窗口。
290
+ 全量 **541/541**(85 个测试文件)。
291
+
292
+ ## [1.6.6] — 2026-11-16
293
+
294
+ **发布修正版:1.6.5 在 npm 上发布的是「每轮请求都裁剪工具结果」的版本——那个把上下文
295
+ 从 10% 悄悄缩到 7% 的缺陷没有随任何已发布制品走出去。1.6.6 补上这条修复。**
296
+
297
+ > **发布实况(事后核对)**:1.6.6 的 npm 制品 `gitHead 99a07cb` 来自旧 checkout,
298
+ > **只含**下面的 Live Compact 修复——M3 与 M5 当时已在主线上、但没有进这个 tarball。
299
+ > 那两项随 **1.6.7** 发出。本地 `v1.6.6` tag 已指向 `99a07cb`,与 npm/GitHub 一致;
300
+ > `99a07cb` 也已并入 `main` 历史,发布可追溯。
301
+ > 1.6.5 同理不可覆盖(`gitHead 28776c7`),其 tag 亦指向该提交。
302
+
303
+ - **Fixed — 上下文在每轮请求里被悄悄缩水("从 10% 直接掉到 7%")**。
304
+ `guardRequest` 曾在**每一次** `agent/request` 上调用宿主的 `toolResultPruner.pruneSession()`。
305
+ 宿主的 `pruneContent()` 用的是**预设预算**(ptc 预设 `thresholdChars: 8192` → 4k 头 + 1k 尾),
306
+ 而且它**只在 `compaction-basic` 的 `context-overflow` 分支里**才被调用——我们把「溢出时裁剪」
307
+ 变成了「每轮都裁剪」,一次 pass 就能掉约 80k tokens。
308
+ 现在 Live Compact **只跑本插件自己的保守策略**(`context.liveCompact`,默认 200,000 字符阈值 /
309
+ 4,000 头 / 2,000 尾 / 每请求最多 4 个节点),不再委托宿主 pruner;
310
+ 回归用例 `the guard never rewrites an ordinary tool result on a healthy request`
311
+ 断言宿主 pruner 在健康请求上**一次都不被调用**。
312
+ - **Tests**:`test/v164.windowGuard.test.js` 增加上述回归用例(12 例)。全量 **503/503**(79 个测试文件)。
313
+
314
+ ## [1.6.5] — 2026-11-15
315
+
316
+ **回归微内核:引擎只负责存储、检索与蒸馏,绝不驱动对话;蒸馏只有一个总调度器;
317
+ 面板的全部能力收进 `/memory` 指令集,且不花一分模型 Token。**
318
+
319
+ - **Added — `/memory` 指令集(0 Token)**。四条子命令通过宿主的 `commands` 服务注册,
320
+ `commands.execute()` 的语义是「parse and execute a known command **without sending it
321
+ to the model**」,因此不产生任何模型请求(测试用 `fetch` 计数断言为 0):
322
+ - `/memory resume`:拉取上一次交接摘要并**强制重新注入**当前上下文。它绕过「每会话
323
+ 每交接批次只注入一次」的去重(`armColdStartNow()` 先删掉该 `session|epoch` 的投递
324
+ 记录再布防),所以用户可以随时把摘要拉回来;没有交接时明确回「没有可恢复的交接摘要」。
325
+ - `/memory maintain`:立即触发一次后台维护(索引重建 / 月记 / L2 合并 / Dream / 冷归档),
326
+ 回报各阶段计数;已在运行时直接拒绝而不是排队。
327
+ - `/memory status`:事件数、L3 摘要数、活跃标签列表、会话 token 与窗口来源
328
+ (`host`/`config`/`default`)、静默状态、冷启动队列长度。
329
+ 这些数字全部取自面板同一份契约(`panel.global.*` + 索引快照的活跃集合),
330
+ 不再各自拼字段——早期实现读错了契约,导致整行显示成 `?`。
331
+ - `/memory mute` / `/memory unmute`:紧急静默 `[Memory Hints]`。静音时**不消费标签**,
332
+ 所以解除后提示会原样回来,而不是被会话级去重池吃掉。
333
+ - **Fixed — 月记与 Dream 重复咀嚼同一批日记**。L2.5 月记原本挂在 `maintain()` 上,与
334
+ Dream 各走各的调度,同一条 L2 日记可能先被压进月记、再被按标签蒸馏一次。
335
+ 现在 **`executeDream()` 是唯一的蒸馏总调度器**:先跑月记(只处理已结束的自然月),
336
+ 再让 Dream 处理剩下的材料。被月记吸收的事件 id 记入 `state/months.json` 的
337
+ `promoted` 映射(即 `promoted_to_monthly`),`DreamEngine.collectGroups()` 直接跳过,
338
+ 并在报告里给出 `skippedPromoted` 计数。
339
+ **为什么不写进事件本身**:raw 日志是 append-only 的唯一真相源,永不改写;标记放在
340
+ 派生状态里,语义等价且可重建。
341
+ - **Added — 原子服务接口 `getLatestHandoffSummary()`**。`ctx.get('hippocampus')
342
+ .getLatestHandoffSummary()` 返回 `{ active, state, at, sessionId, summaryEventId,
343
+ agentPreset, tailTurns, text, found }`,纯读:不装配 prompt、不消费 marker、不产生副作用。
344
+ 外部路由插件想自己决定「什么时候续上、怎么展示」时用它,而不是去解析提示词。
345
+ - **Changed — 微内核边界**。引擎半侧(`index.js` + `src/**`)不含任何宿主 UI 或追加模式
346
+ 监听:`autoNewSession` 整链已在 1.6.3 删除,本次用测试把这条边界**锁死**——源码扫描
347
+ 禁止出现 `uiWorkspace` / `startSession(` / `sessionStorage` / `appendMode` /
348
+ `onSlot(` / `slots.register(` / `ctx.slots =`。会话控制交给外部路由插件。
349
+ - **Fixed — 上下文在每轮请求里被悄悄缩水(“从 10% 直接掉到 7%”)**。1.6.4 的
350
+ `guardRequest` 在**每一次** `agent/request` 上都把宿主 `toolResultPruner.pruneSession()`
351
+ 委托执行了一遍。两处都错:
352
+ - 宿主用的预算是 **预设自己的**(ptc: `thresholdChars 8192` → 留 4k 头 + 1k 尾),
353
+ 于是一次普通的 20 KB 文件读取在下一次请求就被腰斩;
354
+ - 宿主自己只在 compaction-basic 的 `context-overflow` 分支里调它
355
+ (`this.ctx.get('toolResultPruner')?.pruneSession(agent.session)`),
356
+ 「溢出时裁剪」被我们变成了「每一轮都裁剪」。实测一次 pass 可掉 **~80k tokens**。
357
+ 现在 Live Compact **只跑我们自己的保守裁剪**:单条 `tool/result` 超过
358
+ `context.liveCompact.thresholdChars`(默认 200,000 字符)才指针化,头部 4k / 尾部 2k
359
+ 原样保留、中间换成 `deep_raw` 可取回的指针行。健康的对话**永远不会被改写**——
360
+ 宿主压缩链路的裁剪仍由宿主在真溢出时负责。
361
+ 新增回归用例锁定:请求里即使注入了假 `toolResultPruner`,`pruneSession` 的调用次数也必须为 0,
362
+ 且一条 20k 字符的正常结果不产生任何 surface 改写。
363
+ - **Tests**:新增 `test/v165.micokernel.test.js`(8 例):`/memory` 注册与全部子命令返回
364
+ 纯文本、**网络调用数为 0**、静默真的不注入提示、`resume` 在无交接时明确报错且服务接口
365
+ 与它同源、`executeDream()` 先跑月记并把日记标进 `promoted`、`maintain()` 不再产出月记、
366
+ 已晋升日记在下一轮仍被排除、以及上面那条「无 UI/追加模式监听」的源码扫描。
367
+ `test/flow.test.js` 与 `test/v156.federation.test.js` 的月记断言随调度器迁移改为
368
+ `executeDream()`。全量 **502/502**(80 个测试文件)。
369
+
370
+ > **发布说明**:1.6.5 发布到 npm 的制品(`gitHead 28776c7`)**不包含**上面那条 Live Compact
371
+ > 修复——它是在 1.6.5 发布之后才提交的。该修复进入 **1.6.6**;M3 与 M5 实际进入 **1.6.7**
372
+ > (1.6.6 的制品同样来自旧 checkout,只含 Live Compact)。
373
+
374
+ ## [1.6.4] — 2026-11-14
375
+
376
+ **修复 1M 上下文溢出(`CONTEXT_WINDOW_EXCEEDED`):交接判定的分母、分子与状态机三处
377
+ 同时失效,外加单轮超大工具输出没有任何熔断。这是一次独立的安全发版——1.6.3 从未
378
+ 发布过,它的全部内容已并入本版。**
379
+
380
+ - **Fixed — 分母错源:接入宿主真实模型窗口**。新增 `src/context/windowGuard.js` 的
381
+ `resolveWindow()`:**宿主适配器上报的窗口优先**(`llm.resolveModelInfo().context.contextWindow`,
382
+ 也接受 `tokenMeter.contextPressure().contextWindow`),`context.nativeTokenLimit` 降级为
383
+ 用户覆盖,只在宿主不可用时兜底。`panel.session.windowSource` 暴露本次用的是
384
+ `host` / `config` / `default`,事后可审计。此前本机 profile 写的 `8000` 被当成模型窗口,
385
+ 模型真实窗口是 **1,048,576**。
386
+ - **Fixed — 分子不再靠猜:`used + reserved` 公式**。判定改为
387
+ `used_tokens + reserved_completion_tokens >= window × threshold`。
388
+ 已用优先取宿主 `tokenMeter` 的测量值(含系统提示、工具 schema、历史重放),
389
+ `Math.ceil(字符数 ÷ 4)` 的自估降为下限;`reserved` 取本次请求真实的 `maxTokens`
390
+ (默认 256,000)。事故数字 854,668 + 256,000 = 1,110,668 > 1,048,576 现在能直接判出来。
391
+ - **Fixed — Fail-Fast 兜底**。新增 `agent/request` 中间件:拿到最终请求配置后重新判定,
392
+ **必定放不进窗口的请求在本地就被拦下**,抛 `MEM_E_CONTEXT_EXCEEDED`,details 里带
393
+ `usedTokens / reservedTokens / projectedTokens / window / windowSource / ratio`,
394
+ 并明确写出 “Nothing was sent to the provider”。宿主缺少 `llm` / `tokenMeter` 服务时
395
+ **绝不阻断**(降级为原有行为)。
396
+ - **Fixed — 交接状态机死锁(“80% 了却不交接”)**。`checkHandoff()` 里
397
+ `if (marker.active) return base;` 会让首次交接后的同一会话**永远**不再交接
398
+ (1.6.3 移除自动开新会话后,session id 不再变化,marker 就永久 active)。
399
+ 改为 `rehandoffDecision()`:同会话压力再涨 ≥5 个百分点(`pressure-growth`)或投影
400
+ ≥95% 硬上限(`near-hard-limit`)时清掉旧 marker 重新蒸馏;不同会话仍走原有消费路径。
401
+ - **Added — Live Compact:单轮超大工具输出熔断**。新增 `src/context/liveCompact.js`:
402
+ 单个 `tool/result` 的文本超过 `context.liveCompact.thresholdChars`(默认 200,000 字符)时,
403
+ 保留头 4,000 / 尾 2,000 字符,中间压成一行指针
404
+ (`[[hippocampus:live-compact: removed N chars … (seq=…, call=…, tool=…)]`),
405
+ 原文仍可用 `deep_raw` 取回。走宿主 surface 协议
406
+ (`append('compaction/prune')` + `append('tool/result', { surfaceOp: { op: 'replace' } })`),
407
+ 宿主自带 `toolResultPruner` 时优先委托给它。指针化按 code point 切,不会劈开代理对。
408
+ - **Tests**:新增 `test/v164.windowGuard.test.js`(11 例)锁定本次修复:宿主窗口优先于配置覆盖、
409
+ 引擎 `windowSource` 可审计、`used + reserved` 判定(含那组真实数字 854,668 + 256,000)、
410
+ `nativeState` 优先采用宿主测量值、`rehandoffDecision` 的四种判定、
411
+ 超大工具结果的指针化(含代理对不被劈开、`surfaceOp replace` 的实际形状)、
412
+ 同会话内 marker 仍 active 时 `checkHandoff` 会续交、以及
413
+ `guardRequest` 在「必超限」时抛 `MEM_E_CONTEXT_EXCEEDED` / 在「放得下」时放行 /
414
+ 在没有宿主服务时绝不阻断(降级为原有行为)。
415
+ 全量 **494/494**(79 个测试文件)。
416
+
417
+ ## [1.6.3] — 2026-11-13
418
+
419
+ **配置加载器加固:把 1.6.2 的“旧配置启动阻断”事故固化为引擎能力——先迁移、再严格校验、
420
+ 必要时安全降级,绝不让 DSH 客户端卡在“正在启动…”。**
421
+
422
+ - **Added — 冷启动注入可观测性**:`/stats` 新增 `coldStart{ pending[], injected, lastSessionId }`,
423
+ `panel.startup` / `panel.configVersion` / `panel.configWarnings` 与
424
+ `CAPABILITIES.startup` 同源(此前 `toMemoryOptions()` 没把迁移结果传给引擎,panel 报
425
+ `migrated:false` 而 capabilities 报 `true`)。
426
+ - **Fixed — 复习队列只报不消费(积压到 337 条)**:`maintain()` 现在按
427
+ `review.consumeBatchSize`(默认 40,上限 200/轮)分批消费到期行,批间
428
+ `await setImmediate` 让出主线程;每批一次 `reviews.advanceMany()` 落盘(不是每条一次写),
429
+ 并对该批做一次 `reinforce` 权重强化。`review.autoConsume` 可整体关闭。
430
+ - **Fixed — 1.6.2 遗留的两个启动/保留缺陷**:旧 profile(`retentionDays: 30` 且没有
431
+ `archiveAfterDays`)由 `migrateConfig` 派生 `29` 而不是启动失败;`prune()` 现在也会按
432
+ 月清理过期的 `.jsonl.br/.zst/.gz` 冷归档(此前只删明文,归档变相突破保留期)。
433
+
434
+ - **Added — 配置 schema 版本与迁移机制**:`src/config.js` 新增
435
+ `CONFIG_SCHEMA_VERSION = 3`;配置对象可携带 `configVersion`。加载顺序变为
436
+ **`migrateConfig()` → 严格校验**:迁移阶段只做“补值 + 告警”,从不抛错,也绝不覆盖
437
+ 用户显式写下的值。缺少 `configVersion` 的旧配置被视为 legacy(`fromVersion: 0`)并
438
+ 升级到当前版本。
439
+ - 首次落地的迁移规则:`raw.archiveAfterDays` 缺失且
440
+ `raw.retentionDays <= 新默认值(90)` 时,派生为 `Math.max(1, retentionDays - 1)`
441
+ (即 30 → 29),从而满足 `archiveAfterDays < retentionDays` 的硬约束。
442
+ - 每条迁移都写入 `console.warn`(前缀 `hippocampus/config-migration:`)并携带在
443
+ `config.warnings` 里,`apply()` 再经 `ctx.logger.warn` 输出一次——**迁移永不被静默**。
444
+ - 空配置 `{}` 视为“使用默认值”,不算 legacy,因此内部调用不会产生噪声告警。
445
+ - **Added — `strictStartup`(默认 `true`)启动安全网**:显式设为 `false` 时,若严格校验
446
+ 抛出 `MEM_E_CONFIG_OUT_OF_RANGE`,引擎会丢弃该越界键、回退到安全值并继续启动,同时
447
+ 置 `config.startup.degraded = true`、记录 `degradedReason{code,key,message}`、
448
+ 输出 `hippocampus/config-degraded:` 警告,并在 `apply()` 里额外 warn
449
+ `STARTED DEGRADED (strictStartup=false)`。
450
+ - 降级**只**覆盖越界值:`MEM_E_CONFIG_INVALID_TYPE` / `MEM_E_CONFIG_UNKNOWN_KEY`
451
+ 仍然 fail-fast(拼写错误不该被宽容)。
452
+ - `strictStartup` 自身必须是布尔值。
453
+ - **Added — 启动状态进入可观测面**:`CAPABILITIES.startup` / `CAPABILITIES.configVersion`
454
+ 与 `memory_admin action=status` 的 `panel.startup` / `panel.configVersion` /
455
+ `panel.configWarnings`。设置页与运维方可以直接看到“这份配置来自哪个 schema 版本、
456
+ 是否迁移过、是否降级启动”。
457
+ - **Added — 设置页「简洁模式」(纯显示层)**:设置页顶部新增“简洁模式 / 专业模式”切换。
458
+ 简洁模式只渲染四块——**身份、上下文窗口、系统级存储位置迁移、原始回合留存(raw)**;
459
+ raw 卡内再收敛为三项(`raw.mode`、`raw.maxTotalMb`、`raw.compressionEngine`),
460
+ 最小显著度 / 保留期 / 冷压缩阈值 / deep_raw 扫描上限全部隐藏。
461
+ - 隐藏是**纯 UI 行为,不碰配置值**:保存时 patch 被过滤为
462
+ `SIMPLE_PATCH_KEYS`(9 个可见键),文件里未显示的项保持原值;新装即默认值,
463
+ 专业模式下调过的不会被简洁模式覆盖。
464
+ - 校验同步收敛:只检查可见数字键,隐藏项的越界值不会阻断保存,Cron 非空检查也跳过。
465
+ - 模式偏好存浏览器 `localStorage`(键 `hippocampus:settings-mode`),不进插件配置、
466
+ 不影响引擎行为;读写失败一律退回专业模式。
467
+ - **Removed — 交接时“自动开启新会话”(`context.autoNewSession*`)**:交接就发生在对话
468
+ 中间,宿主会在标记后**继续同一个对话**;客户端再调 `uiWorkspace.startSession()` 只会
469
+ 额外弹出一个空对话,在“追加到原对话”的用法下毫无意义还打断体验。因此彻底移除:
470
+ - 配置层:`autoNewSession` / `autoNewSessionPoll` / `autoNewSessionIntervalSeconds`
471
+ 三个键从 `DEFAULT_CONFIG`、校验、resolved 与 HTTP 可编辑白名单中删除。
472
+ - `migrateConfig` 会**静默剥离**旧 profile 残留的这三个键并 warn(否则老用户会撞上
473
+ 未知键阻断启动)。
474
+ - 可观测面:`CAPABILITIES.autoNewSession` 与 `handoffView().autoNewSession` 删除。
475
+ - 客户端:三个设置控件、`startAutoNewSession()` 轮询器与其 `ctx.effect` 注册全部删除;
476
+ 设置页不再渲染任何“自动开新会话”开关。
477
+ - **Fixed — 新对话拿不到交接摘要与前几轮原话**(2026-11-13 用户报告):
478
+ - 根因:冷启动注入是一个**进程级一次性布尔** `coldStartPending`,被**第一个组装
479
+ prompt 的 agent** 抢先消费(子代理、标题生成等),用户真正的新对话拿到的是空。
480
+ - 改为**按会话幂等**:`runtime.coldStart = { pending: Map, injected: Set, lastSessionId }`,
481
+ 以 `session|handoffEpoch` 为键;`noteColdStart()` 在「新 session id 的首个
482
+ `session/event`」与「`agent/created`」两处布防(同键复用、已被注入过的直接跳过、
483
+ 过期 5 分钟未消费自动丢弃、最多 8 条 pending 有界淘汰),
484
+ `promptState(assemblyContext)` 用宿主传给 `systemPrompt.context` 的
485
+ `assemblyContext.agent.id` 与当前 session id 做匹配,注入后写入 `injected` 集合并
486
+ 有界淘汰(64)。**兄弟 agent 先装配不会再吞掉用户的注入**——这是单槽位实现仍会
487
+ 踩的坑:标题生成器或子代理随后布防会覆盖并且消费掉用户的那一条。
488
+ - `handoff.json` 标记新增 `tailTurns`:交接蒸馏时把最后 5 轮(role + 文本,每条
489
+ ≤400 字,内存环形缓冲 12 条、跨会话自动清空)写进标记;
490
+ `[Previous Context Tail]` 优先回放这些**原话**(`- user: …` / `- assistant: …`),
491
+ 没有 tailTurns 时才回退到最近业务事件。
492
+ - `context.coldStartInjectRecentTurns` 默认由 `false` 改为 **`true`**:只给摘要会让
493
+ 新对话接不上具体语境。
494
+ - 即使两个开关全关,匹配到的 pending 也会被消费掉,不会遗留到下一次无关会话。
495
+ - **可观测**:`/stats` 新增 `coldStart{ pending[], injected, lastSessionId }`(`runtime.coldStartView()`),
496
+ 运维方不必读 prompt 就能区分“已布防未装配”与“已注入”。
497
+ - **`panel.startup` / `panel.configVersion` / `panel.configWarnings` 与 `capabilities.startup`
498
+ 对齐**:此前 `toMemoryOptions()` 没有把迁移结果传给引擎,panel 报的是“未迁移”默认值,
499
+ 而 capabilities 报的是真相——同一个进程两处说法不一致,现由 `toMemoryOptions` 一并透传。
500
+ - **Fixed — 复习队列只报不消费(积压到 337 条)**:`maintain()` 里
501
+ `ReviewSchedule.tick()` 的结果只被写进报告,**从来没有人推进它**,于是新装用户的
502
+ `state/reviews.json` 里每条都是 `lastAt: null`、`dueAt` 停在初始间隔,队列只增不减
503
+ (现场:`total 346 / due 337`)。两个后果:复习面板永远是“全到期”,且 recall 拿不到
504
+ 强化锚点——衰减曲线相当于“写下之后从未被碰过”。
505
+ - 现在 `maintain()` 会真正消费到期行:`_consumeDueReviews()` 取出到期 id,
506
+ **分批**(默认 30–50 条,`review.consumeBatchSize = 40`)调用批量 `reinforce()`
507
+ (权重 1,日志即锚点,不改任何字段),再用 `ReviewSchedule.advanceMany()` 一次性
508
+ 推进 `lastAt` / `step` / `dueAt`。
509
+ - **性能防线**:每批之间 `await new Promise(setImmediate)` 让出事件循环,HTTP 路由与
510
+ prompt 组装不会被一个巨大积压卡住;单次维护总量上限 `review.consumeMaxPerRun = 200`,
511
+ 再多就跨多次维护轮次排空(报告里的 `remaining` 说明还剩多少)。
512
+ - **一次文件写/批**:新增的 `advanceMany()` 把“逐条 advance = 每条一次读+一次原子写”
513
+ 变成“整批一次”,337 条积压不再是 337 次 fsync。
514
+ - 开关:`review.autoConsume`(默认 `true`)可关;`review.enabled: false` 时不会消费。
515
+ 失败的批次不中断维护(`lastAt` 保持 null,下一轮自然重试),错误写进
516
+ `report.reviewConsumeError`。三条新键均进入 HTTP 可编辑白名单。
517
+ - **Fixed — 1.6.2 遗留的两个启动/保留缺陷(随 1.6.3 一并锁定)**:
518
+ - **旧 profile 启动阻断**:旧配置只写 `raw.retentionDays: 30`、没有 `archiveAfterDays`,
519
+ 而 1.6.2 的新默认值是 90,硬校验 `archiveAfterDays < retentionDays` 直接抛错,
520
+ `apply()` 失败 → 插件整体不注册 → `/api/hippocampus/*` 全部 404,设置页永远停在
521
+ “正在启动…”。现在 `migrateConfig()` 在**未显式配置**且冲突时自适应派生
522
+ `Math.max(1, retentionDays - 1)`(30 → 29)并告警;**显式**写下越界值仍然 fail-fast。
523
+ - **`.jsonl.br` 冷归档永不清理**:`prune()` 原先只删明文分片,Brotli/Gzip/Zstd 归档
524
+ 变成“保留期之外的永久副本”,等于变相突破 `retentionDays`。现在 `prune()` 按
525
+ `cutoffMonth` 整月删除过期归档,并同步从 `state/raw-archive.json` 抹掉记录
526
+ (返回 `removedArchives`)。
527
+ - **Tests**:`test/v163.migration.test.js`(9 例)锁定本次教训——旧配置(仅
528
+ `retentionDays: 30`)可启动且 `archiveAfterDays` 派生为 29;显式冲突在
529
+ `strictStartup: true` 下阻断、在 `false` 下降级启动;降级不吞类型错误与未知键;
530
+ 以及 1.6.2 生产 profile 的原始形状可被完整解析。`test/helpers.js` 的夹具改走同一
531
+ 迁移步骤,`test/status.test.js` 的 panel 形状契约同步新增三个字段。
532
+ `test/v163.ui.test.js`(5 例)锁定简洁模式契约:`Section` 的 `hidden` 短路、
533
+ 14 个专业模式卡片全部带 `hidden: simpleMode`、raw 只剩三项、保存与校验按白名单收敛。
534
+ `test/v163.reviewQueue.test.js`(5 例)锁定复习消费契约:到期行被消费且 `step`/`lastAt`
535
+ 前进、强化记录数 == 消费数、超出单轮预算的积压跨轮次排空、`autoConsume:false` 不动队列、
536
+ 整批只写一次 `reviews.json`。
537
+ `test/v156.autoSession.test.js` 重写为「该功能已移除」契约(配置无该键、旧 profile
538
+ 迁移剥离、路由/能力面不暴露、客户端无轮询器);
539
+ `test/v160.coldStart.test.js` 重写为按会话注入契约(无标记不布防、摘要+尾部各一次、
540
+ 兄弟 agent 先装配不吞注入、两个会话各注入一次、**两条 pending 先布防后装配也各得其份**、
541
+ 双关不遗留 pending、tailTurns 优先、stats 暴露 coldStart 状态)。
542
+ 全量 **483/483**(78 个测试文件)。
543
+
544
+ ## [1.6.2] — 2026-11-11
545
+
546
+ **补丁版:修复冷数据归档与保留期的时间冲突,并把“打破日志线性增长”的三层机制并入正式记录。**
547
+
548
+ - **Fixed — 设置页卡在“正在启动…”并报 `MEM_E_NETWORK: HTTP 404`**(2026-11-13):
549
+ 1.6.2 的强校验 `archiveAfterDays < retentionDays` 与**旧 profile**(`raw.retentionDays: 30`、
550
+ 从未写过 `archiveAfterDays`)冲突,`apply()` 抛 `MEM_E_CONFIG_OUT_OF_RANGE`,插件根本没加载,
551
+ 所有 `/api/hippocampus/*` 路由缺失 → UI 永远 404。现在:
552
+ - `archiveAfterDays` **未被显式配置**时按 `retentionDays - 1` 派生,并置
553
+ `raw.archiveAfterDaysDerived: true`(旧 profile 可直接启动);
554
+ - **显式**给出越界的 `archiveAfterDays` 仍然 fail-fast(配置错误不该被静默原谅)。
555
+ - **Fixed — 归档文件不受 retention 约束**:`prune()` 原来只删 `.jsonl` 明文分片,`.jsonl.br`
556
+ 归档会永久堆积,等于变相突破保留期。现在整月归档的末日晚于 cutoff 才保留,否则连
557
+ `state/raw-archive.json` 记录一起删除,返回 `removedArchives`。
558
+
559
+ - **修复冷数据归档时间冲突**:冷归档阈值与 TTL 保留期原本互相挤压(`archiveAfterDays` 与
560
+ `retentionDays` 同为 30/90 量级,冷分片常在归档前就被 TTL 删除)。现在默认值上调为
561
+ `archiveAfterDays: 90`、`retentionDays: 365`,并保留 fail-fast 校验
562
+ (`archiveAfterDays` 必须严格小于 `retentionDays`),同时新增 `raw.coldAccessWindowDays: 90`,
563
+ 也就是“近 90 天零访问”才允许归档。
564
+ - **实施多档保留策略(含遗忘性保存与全保存)**:raw 层保留谱系落地为
565
+ `raw.mode: off | salience | all` ——
566
+ `off` 为不保存(遗忘性保存,仅保留 L1 之上的记忆)、`salience` 为默认的高价值保存、
567
+ `all` 为全保存(受 `maxTurnKb` / `maxBytesPerDay` / `maxTotalMb` 预算约束);
568
+ 另加 `raw.distillPrune`(默认 false):蒸馏产物覆盖第 i 天、且该分片已出
569
+ `raw.hotWindowDays` 热窗时,允许物理清理 raw 原文,**必经 Tombstone 防复活**。
570
+ L2 继续走同类项合并(`l2Merge`),L3 增加硬熔断 `semantic.maxEntries`(默认 100)+ LRU 淘汰,
571
+ 语义层随“事件重要性”而非“对话条数”增长。
572
+ - **优化长窗口压缩与高频引用去重**:
573
+ - 冷归档默认改用 **Brotli quality 11**(`.jsonl.br`,极限压缩),`gzip`(9) / `zstd` 仍可选,
574
+ 全部来自 Node 内置 `node:zlib`,零外部依赖;读取按扩展名流式解压、命中即停。
575
+ - 高频重复的超长内容(工具 schema / 系统提示块,≥512 字符且出现 ≥2 次)在建索引时
576
+ 只存一份到 `templates.json`,事件侧改为 `contentRef` 引用(`src/index/templates.js`),
577
+ 索引加载时还原原文;**日志本体不参与替换**,raw 逐行真相、`deep_raw` 与行级游标不受影响。
578
+ - 稀疏行索引(每 64 行采样)继续用于跳过时间窗不重叠的分片并复用 `lineCount`。
579
+
580
+ ### 1.6.2 详细变更
581
+
582
+ - **Breaking the linear log curve — three layers** (`test/v162.nonlinear.test.js`, 9 cases):
583
+ - **Compression layer**: cold classification is now MULTI-dimensional (age >
584
+ `raw.archiveAfterDays` **AND** zero access for `raw.coldAccessWindowDays` **AND** no
585
+ `pinned` / `status:handoff` / hot-tag record). Defaults move to
586
+ `archiveAfterDays=90`, `coldAccessWindowDays=90`, `retentionDays=365`. Cold
587
+ archives default to **Brotli quality 11** (`.jsonl.br`, "极限压缩") instead of
588
+ gzip; `gzip`/`zstd` stay selectable and all three are Node built-ins.
589
+ Recently-read old shards stay PLAINTEXT for O(1) cursor scans.
590
+ - **Encoding layer (referential dedup, NOT columnar)**: repeated long content
591
+ (tool schemas / system prompt blocks, ≥512 chars, ≥2 occurrences) is stored ONCE
592
+ in `templates.json` at the INDEX layer; events carry `contentRef` instead of a
593
+ duplicate copy. Index loads resolve refs, so readers always see exact content —
594
+ the log itself is untouched (`src/index/templates.js`).
595
+ - **Semantic layer**: raw stops being the only home of truth. `raw.distillPrune`
596
+ (opt-in) lets `maintain()` physically clean raw shards that are outside
597
+ `raw.hotWindowDays` **and** already covered by an L3 summary — always through the
598
+ tombstone path, so nothing resurrects. L3 gains a hard capacity breaker
599
+ (`semantic.maxEntries`, default 100) with LRU retirement recorded as append-only
600
+ `semantic_retire` events.
601
+
602
+ ## [1.6.1] — 2026-11-07
603
+
604
+ **Version fully un-frozen (user directive 2026-11-07): normal semantic versioning
605
+ resumes; 1.6.1 was the release that followed 1.6.0.**
606
+
607
+ - **Archive month detail UI**: the panel's raw section now shows `indexedShards` /
608
+ `archiveCount` StatCards plus a **collapsible month table** (月份 / 引擎 / 归档大小 /
609
+ 归档时间, month-DESC, collapsed by default). `panel.raw` carries `archivedBytes`,
610
+ `totalBytes`, `engines:{gzip,zstd}`, `savedBytes`, `compressionRatio` (null when
611
+ unmeasured) and `archiveMonths[]` with `at`/`bytesBefore`/`bytesAfter`; older hosts
612
+ degrade to “—” instead of breaking the panel.
613
+ - **Segment-token audit** (`docs/AUDIT-2026-11-07-segment-token.md`): no P0
614
+ same-segment re-injection exists; the six injection surfaces are documented with
615
+ their dedup mechanisms. Its two P3 items are now IMPLEMENTED:
616
+ - **P3-1** the `[Active Task]` event id also joins the block dedup pool, so one
617
+ event can never be injected both as Active Task and as a recall block;
618
+ - **P3-2** `[Persona & Traits]` is memoized by the L3 shape (`summaryId` +
619
+ `updatedAt` + count); unchanged L3 costs one signature, not a re-render.
620
+ - **Raw cold-tier archiving (zero external deps)**: on `maintain()`, daily shards
621
+ older than `raw.archiveAfterDays` (default **7**) are merged per calendar month
622
+ into one `raw-archive-YYYY-MM.jsonl.gz` via Node's built-in `zlib`, then the
623
+ plaintext shard is removed. Archiving runs at most once per month and SKIPS any
624
+ shard that is recently read (`state/raw-access.json`), `pinned`,
625
+ `status:handoff`, or carries a hot active-set tag. `deep_raw` and hash restore
626
+ stream the archive with `createGunzip()` line-by-line (no full read), report
627
+ `archiveErrors`/`notes: archive-corrupt:<name>` for a corrupt archive, and keep
628
+ plaintext `.jsonl` reads unchanged. `raw.retentionDays` default moves **30 → 90**
629
+ and must stay strictly above `archiveAfterDays` (fail-fast otherwise).
630
+ - **`/stats` panel: archive + index visualization**: `panel.raw` now reports
631
+ `archiveCount`, `archivedBytes`, `totalBytes`, `archiveMonths`, `engines`
632
+ (`{gzip,zstd}`), `savedBytes` (sum of bytesBefore−bytesAfter), `compressionRatio`
633
+ (null when no measured archive) and `indexedShards`. Each archive records
634
+ `bytesBefore`/`bytesAfter` in `state/raw-archive.json`, so the ratio and saved
635
+ bytes are real measurements, not estimates. The panel gains two StatCards
636
+ (“raw 索引覆盖”, “raw 冷归档”) with graceful “—” for an older host, plus a
637
+ collapsible **archive month table** (月份 / 引擎 / 归档大小 / 归档时间, month-DESC,
638
+ collapsed by default); `archiveMonths` rows carry `at`/`bytesBefore`/`bytesAfter`.
639
+ 4 cases in `test/v161.stats.test.js` + 2 UI contract cases.
640
+ - **Sparse line index for raw shards** (performance audit item C): one
641
+ `<day>.jsonl.idx.json` per shard, sampled every 64 lines with
642
+ `{line, offset, timestamp}` plus `bytes/mtimeMs/lineCount/minTs/maxTs/sorted`.
643
+ `deep_raw` uses it to SKIP a shard whose time range cannot overlap the window
644
+ (without opening the file) and to reuse `lineCount` for absolute `hit.line`
645
+ numbers (no second pass). Built offline by `maintain()` (50 shards/round,
646
+ progressive), deleted with its shard by `prune()`, and silently bypassed when
647
+ missing, stale (bytes/mtime mismatch), corrupt, or non-monotonic. `stats()`
648
+ reports `indexedShards`. 6 cases in `test/v161.rawIndex.test.js`.
649
+ - **Compression-engine selection (zero install)**: `raw.compressionEngine`
650
+ (`gzip` default | `zstd`) + a settings-page engine picker with an
651
+ enable/disable button. Zstd uses Node's BUILT-IN `node:zlib` zstd — nothing is
652
+ downloaded and there is no package to uninstall; "停用" switches back to gzip.
653
+ Archives are `raw-archive-YYYY-MM.jsonl.gz` / `.jsonl.zst`, dispatch is by
654
+ extension, and a legacy gzip archive stays readable after switching to zstd.
655
+ When the runtime lacks zstd the config silently falls back to gzip and
656
+ `capabilities.compression` reports `{engine, fallback, zstd, node}` for the UI.
657
+ - **Raw retention tiers documented**: the raw layer exposes exactly three modes —
658
+ `off` (keep nothing), `salience` (default: high-value turns/code/stack/errors only),
659
+ `all` (bounded by `maxTurnKb`/`maxBytesPerDay`/`maxTotalMb`) — plus
660
+ `retentionDays` (default 90) and `pinned` never pruned. README/ARCHITECTURE now
661
+ describe these implemented tiers only.
662
+ - **Fixed — settings page rendered blank**: the compression-engine card referenced a
663
+ bare `payload` that only exists in other components' scopes; it now uses the local
664
+ `statsPayload` and the shared `Select` component (not a fake `type:'select'` on
665
+ `Field`). `test/v161.ui.test.js` pins the scope rule so the whole settings page
666
+ cannot be taken down by one card again.
667
+
668
+ - **Recall bound-based early exit** (performance audit item A): every score is
669
+ `salience × decay × tagAffinity(≤3) × lexicalBoost(≤1) × association(≤1) ×
670
+ timeBoost(≤1.3) × handoff(≤1)`, so `salience × 3.9` is a hard upper bound.
671
+ Candidates are visited salience-DESC and scoring stops as soon as that bound
672
+ cannot beat the current k-th score. `pinned` hits bypass the cut, the best-k
673
+ window keeps the bound exact (ties still visited), and the result reports
674
+ `pruned` + `notes: pruned:<n>`. Complexity unchanged in the worst case
675
+ (`O(K log K)` ordering) but the per-candidate decay/similarity work is skipped
676
+ for the long low-salience tail.
677
+ - Regression: pinned decay stays exactly 1 (bypass path), monthly memos unchanged.
678
+ - **456 tests green** (64 files).
679
+
680
+ ## [1.6.0] — 2026-11-06
681
+
682
+ > Version note: 1.6.0 was the FIRST release after the temporary 1.5.7 freeze; the
683
+ > 2026-11-07 directive removed all freeze language and resumed normal versioning.
684
+ Cold-start wake-up + user-controlled cold-start injection:
685
+
686
+ - **Anti-"customer service" wake-up** (static `memory:policy` prefix): the model is
687
+ told it has continuous long-term memory, must not open with "how may I help you",
688
+ and should recall the recent topic before replying.
689
+ - **`context.coldStartInjectSummary`** (default **true**): on the first prompt
690
+ assembly of a brand-new conversation, inject `[Cold-Start Summary]` — the handoff
691
+ summary event when present, else the top-3 L3 semantic summaries (≤800 chars).
692
+ - **`context.coldStartInjectRecentTurns`** (default **false**): inject
693
+ `[Previous Context Tail]` with the last ≤5 business episodes (200 chars each).
694
+ - **`[Cold-Start Detected: Active Space=…, Recent Topic=…]`** header when either
695
+ switch is on; the block is volatile-tail only (prompt-cache prefix untouched) and
696
+ is consumed exactly once per new conversation.
697
+ - Both switches off → no historical blocks; the static wake-up policy still ships.
698
+ - UI: two independent toggles in the settings page's session group; HTTP-editable.
699
+ - **416 tests green** (64 files).
700
+
701
+ ## [1.5.7] — 2026-11-04
702
+
703
+ > Historical note: 1.5.7 shipped under a temporary version freeze; the 2026-11-07
704
+ > directive removed ALL freeze language and resumed normal semantic versioning
705
+ > (current version: 1.6.2). The sentence below is the historical 1.5.7 statement.
706
+
707
+ **Version freeze (historical, superseded): 1.5.7 was the shipped release.**
708
+ This release folds in everything added after the 1.5.6 draft — Orchestrator
709
+ federation/dedupe wiring, read-time merge, cross-space recall aggregation (opt-in
710
+ `features.crossSpaceRecall`), durable Orchestrator state, the settings-page GitHub
711
+ installer, the verified automatic new-conversation handoff (with configurable
712
+ once/interval detection), low-valley Dream Phase 2, space deletion, graph
713
+ interaction, and the rest of the 1.5.6 section below. Annotations of the form
714
+ `v1.5.6:` below record the version in which a feature was introduced; they are
715
+ history, not the current version. **411 tests green** (64 files).
716
+
717
+ ## [1.5.6] — 2026-11-03
718
+
719
+ **`deep_raw` now scans by line cursor: a huge day shard is never loaded whole.**
720
+ The black box is read newest-first in fixed chunks; peak memory is one chunk plus
721
+ one partial line (test-locked), not the file size. `hit.line` keeps its absolute
722
+ 1-based semantics. **411 tests green** (was 303).
723
+
724
+ ### Changed — raw scan / restore (zero-dependency, O(chunk) memory)
725
+
726
+ - **`readLinesReverse(file, {chunkSize, onBuffer})`** (`src/rawStore.js`): reads a
727
+ file backwards in 64 KiB chunks, yielding one line at a time; the trailing
728
+ newline does not produce a phantom empty line. `onBuffer` reports the live
729
+ buffer size for tests.
730
+ - **`deep_raw` scan** rewrote the whole-shard `readFileSync + split` path:
731
+ newest-first, one `JSON.parse` per line, line bytes counted as they are read,
732
+ hit results collected per shard. `hit.line` is computed from the shard's line
733
+ count via ONE extra bounded streaming pass, paid only when that shard produced
734
+ a hit (so a miss costs no counting pass).
735
+ - **`restoreByHash`** streams forward via `readline`; **`_loadTombstones`** streams
736
+ synchronously with a `StringDecoder` (multi-byte boundaries preserved);
737
+ **`_hashesFor`** streams asynchronously (so `RawStore.capture()` is now async —
738
+ only internal callers exist; the public `captureRaw()` contract is unchanged).
739
+ - **Engine-side result ceiling**: `MAX_SCAN_RESULTS = 500` caps one scan even if an
740
+ embedder passes `limit: 5000`; `budget.maxHits` is reported, `truncated` is true
741
+ when the cap is reached.
742
+ - **Observability**: `scanned.peakBufferBytes` exposes the largest buffer the
743
+ scanner ever held (proves the memory bound).
744
+
745
+ ### Added — stability hardening (same 1.5.6, no extra version bump)
746
+
747
+ - **Recall response cap**: `context.maxInjectTokens` (default 4000, 256–100 000,
748
+ fail-fast) bounds the JSON one recall returns. `Memory.applyPayloadBudget()`
749
+ keeps hits in rank order (the first is always kept), then semantic/temp summaries;
750
+ a cut is loud: `truncated: true`, `payload: {maxTokens, estimatedTokens, dropped}`
751
+ and a `payload-budget` note. Editable over HTTP and rendered in the settings page
752
+ with a tooltip.
753
+ - **`Memory.close()` releases resources**: `RawStore.close()` clears the flush timer
754
+ and synchronously persists queued turns before the log closes; `Memory.close()`
755
+ then detaches the scheduler, clears oversized-tag hints and calls
756
+ `IndexManager.release()` to drop the A/B views. Idempotent.
757
+ - **Event-loop lag monitoring**: `src/eventLoop.js` (`createLagMonitor`) wraps
758
+ `perf_hooks.monitorEventLoopDelay`; `maintain()` yields 50ms between phases and
759
+ `IndexManager.rebuild` yields between read/build/catch-up/swap once the measured
760
+ max delay crosses 100ms. The report carries
761
+ `eventLoop: {maxMs, p99Ms, meanMs, yields, thresholdMs}`. Honest boundary: a
762
+ synchronous builder cannot be preempted, so the granularity is phase-level and the
763
+ numbers expose an oversized phase.
764
+
765
+ ### Added — pre-ingest tagging (same 1.5.6, no extra version bump)
766
+
767
+ - **`src/tagging.js` / `extractTags()`**: deterministic anchors derived from content
768
+ shape — named error types (`error:typeerror`), Node errno codes
769
+ (`error:econnrefused`), fenced-code language (`lang:python`), HTTP status
770
+ (`http:500`), file path basename (`file:index.js`) and explicit task statements
771
+ (`task:…`). No LLM, no dependencies, stable ordering.
772
+ - **Write gate** (`Memory.stage`): model-provided tags always win; only an untagged
773
+ write runs the heuristic. Tags are deduplicated and capped by `tagging.maxTags`
774
+ (1–5, default 2). Inferred anchors are recorded on `meta.auto_tagged` /
775
+ `meta.auto_tags` (provenance, not a silent rewrite of what the caller asserted).
776
+ - **raw stays pure**: the black box still receives exactly
777
+ `{turn_id, timestamp, role, content}` — the test locks the four-field shape.
778
+ - **Miss is a warning**: `MEM_E_AUTO_TAG_MISS` goes to the Host log via
779
+ `Memory.setWarnHook` (wired in `index.js`) and increments
780
+ `panel.autoTag.misses`; the write proceeds untagged.
781
+ - **Config**: `tagging.autoTag` (default true) and `tagging.maxTags` (1–5), both
782
+ fail-fast, HTTP-editable and rendered in the settings page.
783
+
784
+ ### Added — pinned memory (same 1.5.6, no extra version bump)
785
+
786
+ - **`remember({ pinned: true })`**: a lesson/experience that must survive time.
787
+ It stores `meta.pinned = true` (provenance included in `content_hash`) and is
788
+ refused with **`MEM_E_PINNED_TAG_REQUIRED`** unless the caller supplies at least
789
+ one tag — an untriggerable lesson would be dead memory.
790
+ - **Never decays**: `projectEpisode` exposes `pinned`; `deriveTagTable` gives a
791
+ pinned event `decay = 1`, keeps its tag un-archived, and protected from the
792
+ `maxPostingsPerTag` drop; `deriveActiveSet` admits pinned tags regardless of
793
+ score or the cap.
794
+ - **Ranks first**: recall gives every matching pinned record `decay = 1`, exempts
795
+ it from `minScore`, and orders pinned hits ahead of all others
796
+ (`pinned-first:N` note).
797
+ - **Observability**: `panel.global.pinned` counts pinned records.
798
+ - Tool surface: `memory_remember.pinned` (boolean) is documented and passed
799
+ through; `bulk_ingest` items accept the same field.
800
+
801
+ ### Changed — relevance-first prompt hints (same 1.5.6, no extra version bump)
802
+
803
+ - **Global "most active tags" map removed from the prompt.** `runtime.promptState()`
804
+ now renders only tags that lexically overlap the CURRENT user turn (max 5), via
805
+ `src/utils/memoryHints.js` (`selectRelevantTags` / `renderMemoryHints`).
806
+ Internal bookkeeping tags (`status:*`, `month:*`, `context:*`, `active_task`)
807
+ are never hinted; no match means the section is simply absent (no padding).
808
+ - **Cache-safe placement**: `[Memory Hints]` is rendered AFTER `[Memory Blocks]`,
809
+ so a per-turn hint never disturbs the cacheable prefix (rules only).
810
+ - **Input source**: prompt assembly receives no message text, so the plugin tracks
811
+ the last `user/message` from `session/event` (`runtime.lastUserText`); other
812
+ surface events never overwrite it.
813
+ - The legacy `renderMemoryMap` / `composePrompt({map})` API remains for callers
814
+ and is still unit-tested, but the plugin no longer injects the map.
815
+
816
+ ### Added — capability flags & microkernel boundary (same 1.5.6, no extra version bump)
817
+
818
+ - **`features.multiSpace` (default true)** and **`features.crossSpaceTransfer`**
819
+ (default mirrors multiSpace). Both are fail-fast, HTTP-editable and rendered in
820
+ the settings page; turning multiSpace off implies crossSpaceTransfer off, and the
821
+ explicit contradictory combination is refused.
822
+ - **Strict single-space mode**: with multiSpace off, every routed read/write whose
823
+ `targetSpaceId` is not `default` answers **`MEM_E_FEATURE_DISABLED`** (before any
824
+ I/O); `createSpace` / `ensureSpace` / `warmup` refuse too, and the `/spaces` route
825
+ reports `['default']` with `capabilities.spaces=false` so the client hides
826
+ create/selector affordances instead of 404-ing.
827
+ - **Tools follow the flags**: `space_transfer` / `transfer_to_global` are neither
828
+ registered nor advertised in the prompt section when the capability is off.
829
+ - **`Memory.open('/abs/dir')`** is now the single-space form (the Orchestrator owns
830
+ the multi-space walk); the options-object form stays supported.
831
+ - **`Memory.warmup({targetSpaceId?, dataDir?})`**: lazy, read-only index warm-up for
832
+ the UI / Orchestrator — no maintenance, no writes; unknown/relative dataDir fails
833
+ fast.
834
+
835
+ ### Added — host lifecycle: compensating Dream (same 1.5.6, no extra version bump)
836
+
837
+ - **`src/hostBridge.js`** subscribes to the Host's process-local events
838
+ `agent/created` and `session/created` (the "session start" signals) through a plain
839
+ `{on, off}` bus seam, plus `agent/disposed` for teardown.
840
+ - **Compensation rule**: on a session start, if no Dream ran for
841
+ `dream.compensateAfterHours` (default 24, 1–720, fail-fast) AND the price window
842
+ permits, run exactly ONE compensating Dream through the shared
843
+ `runtime.runMaintenance('compensate')` gate — never a second concurrent run, never
844
+ a queue.
845
+ - **Price is injected, never guessed**: `setPriceProbe(fn)` / `DSH_DREAM_PRICE=low|high`.
846
+ Unknown price + an LLM-backed Dream ⇒ skip (`price-unknown`); unknown + local-only
847
+ Dream ⇒ allowed. A known peak ⇒ skip (`peak`).
848
+ - **Observability**: `runtime.hostStatus()` and `/stats`'s top-level `host` report
849
+ `sessionStarts / compensations / skipped / lastSkipReason / dreamDue / lowValley`.
850
+ - `enableDream:false` disables compensation; `agent/created`/`session/created` do not
851
+ otherwise affect memory writes (raw capture remains on `session/event`).
852
+
853
+ ### Added — Dream tunables in the settings page (same 1.5.6, no extra version bump)
854
+
855
+ - The **safe** Dream subset is now exposed to `/stats` + `/config` and rendered in
856
+ the settings page: `useLlm`, `minGroupSize`, `maxGroupsPerRun`, `maxSummaryChars`,
857
+ `maxSourceChars`, `maxEventsPerGroup`, `llmTimeoutMs`, `failureThreshold`,
858
+ `cooldownMinutes`, `compensateAfterHours` (all fail-fast validated).
859
+ - **Credentials stay private**: `dream.llm.{baseUrl,model,apiKey}` is neither exposed
860
+ by the routes nor editable over HTTP nor rendered in the form; it comes only from
861
+ the profile or `DSH_DREAM_LLM_*` env. A test asserts the key never appears in the
862
+ `/stats` payload.
863
+
864
+ ### Added — L2 multi-merge (`merged_into`, same 1.5.6, no extra version bump)
865
+
866
+ - **`src/l2Merge.js`** condenses duplicate same-tag L2 episodes into ONE durable
867
+ record, offline at the end of `maintain()` (after monthly memos; a failure never
868
+ fails maintenance).
869
+ - **Pinned and ordinary groups are strictly separated** — pinned merges only with
870
+ pinned; ordinary only with ordinary. A pinned merge keeps `pinned: true` and
871
+ inherits every tag.
872
+ - **Text**: earliest/latest time + deduplicated core text (each source capped), the
873
+ whole line capped by `l2Merge.maxSummaryChars` (ASCII ellipsis so identity
874
+ canonicalisation cannot make it longer).
875
+ - **Federated metadata**: `meta.global_tags` is copied into the merged record's
876
+ `meta` and **never becomes a tag**, so it cannot enter the sub-space inverted index;
877
+ `projectEpisode` exposes it as `event.globalTags` for the merge layer only.
878
+ - **Append-only marking**: sources are recorded as merged in
879
+ `state/l2-merge.json` (`mergedSourceIds`); the log is untouched and originals stay
880
+ recoverable. A second pass merges nothing (idempotent) and `status().panel.l2Merge`
881
+ reports the bookkeeping.
882
+ - **Config `l2Merge`**: `enabled` (default true), `minGroupSize` (2–20, default 2),
883
+ `maxGroupsPerRun` (1–50, default 5), `maxSummaryChars` (100–2000, default 400);
884
+ fail-fast, HTTP-editable and rendered in the settings page.
885
+
886
+ ### Added — L3 semantic tag invariant (same 1.5.6, no extra version bump)
887
+
888
+ - **`SemanticStore.upsert` is strict**: an L3 summary with zero usable tags is
889
+ refused with **`MEM_E_SEMANTIC_TAG_REQUIRED`** — such a summary could never be
890
+ reached by tag-driven retrieval (dead knowledge).
891
+ - **Offline paths degrade instead of failing**: delete-consolidation and trend
892
+ promotion derive tags from content heuristics (`extractTags`) and, if even that
893
+ yields nothing, write an explicit provenance anchor (`origin:unlabelled-episode` /
894
+ `origin:unlabelled-trend`). Maintenance and the two-phase delete pipeline therefore
895
+ never break on historical untagged events.
896
+ - **Historical data is read-only degraded**: summaries written before the invariant
897
+ remain readable and are marked `degraded: true` in `list()` /
898
+ `semanticSummaries()`; nothing is silently rewritten.
899
+
900
+ ### Added — working mode survives a handoff (same 1.5.6, no extra version bump)
901
+
902
+ - **Handoff marker carries the Host agent preset** (the UI's “工作模式”): the marker
903
+ written at rollover now records `agentPreset`, fed by the live adapter through
904
+ `memory.setHandoffPresetProvider()`.
905
+ - **A new conversation restores it before its first turn**: `agent/created` is a
906
+ serial Host event, so the bridge awaits `agentPresets.select(agent, preset)` for
907
+ `source === 'startup'` from a different session. `resume`, the marker-owner session
908
+ and markers without a preset are never overridden.
909
+ - **Never breaks agent creation**: a failed `select` is reported in
910
+ `runtime.lastPresetInherit` and the log, then creation proceeds.
911
+ - **Tracking**: `agent-preset/selected` updates the mode; tool boundaries and prompt
912
+ assembly opportunistically read `agents.currentInitiator()` + `agentPresets
913
+ .composedPreset()` and **backfill an older marker** that predates this feature.
914
+ - **Observability**: `/stats` exposes `agentPreset` + `presetInherit`, and
915
+ `hostStatus().presetSelections` counts observed selections.
916
+
917
+ ### Changed — physical split: multi-space engine moved out (same 1.5.6)
918
+
919
+ - **`src/spaces/spaceRouter.js` and `src/spaces/transfer.js` are GONE from this
920
+ package.** The full multi-space router (per-space FIFO chains, lazy child stores,
921
+ `MEM_E_*` validation) and the cross-space transfer engine now live in
922
+ `dsh-orchestrator` (`src/spaceRouter.js`, `src/transfer.js`).
923
+ - The core compiles only `src/spaces/singleSpace.js`: the `default` space is the
924
+ owner handle; every named-space operation answers **`MEM_E_FEATURE_DISABLED`** with
925
+ an explicit "install dsh-orchestrator" hint. No silent fallback to `default`.
926
+ - **Adapter injection is the wiring seam**: the Host's optional `orchestrator`
927
+ service supplies `createSpaceAdapter({owner, dataDir, openChild})` and `transfer`;
928
+ `Memory.open({spaces|spacesFactory, transfer})` accepts the same seam for embedders.
929
+ Without the service the plugin advertises `capabilities.spaces=false`, registers
930
+ only the eight single-space tools, and `/spaces` reports `default` only.
931
+ - A profile with `features.multiSpace:true` but no Orchestrator logs a loud warning
932
+ and runs the strict single-space core (visible in `/stats.capabilities`), instead
933
+ of pretending the capability exists.
934
+
935
+ ### Added — first batch: orchestrator service + 3 experience fixes (same 1.5.6)
936
+
937
+ - **Orchestrator service registration**: `apply()` now installs a real Host service
938
+ (`ctx.provide('orchestrator', …)` inside `ctx.effect`, so unloading removes it).
939
+ It exposes `createSpaceAdapter`, `transfer`, `dirFor`, `status`, `federation`,
940
+ `dedupe`, `consent` and `router`. The core decides the capability through
941
+ `config.multiSpaceActive(config, hasOrchestrator)`.
942
+ - **Reserved system tags isolated from display**: `status:*`, `folded-summary` and
943
+ `active_task` are filtered out of the knowledge graph (`buildGraph` + defensive
944
+ `view`) and the L1.5 tag tree (`rebuildTree` + persisted-tree/ghost filtering).
945
+ The inverted index still keeps them (handoff/recall internals need them).
946
+ - **`[Active Task]` injection**: prompt assembly prefers the active handoff summary,
947
+ otherwise the newest event carrying a `task:` tag, and renders it as an
948
+ unconditional top block (`[Active Task]`) once per session.
949
+ - **Fallback hints**: `selectRelevantTags` accepts `fallbackTags`; when the current
950
+ input has no lexical overlap (e.g. “继续”), the previous turn's matched tags (max 2)
951
+ are carried into `[Memory Hints]`.
952
+ - **Session-scoped injection dedup**: `runtime.injection` keeps per-session `ids` and
953
+ `tags`; hints, `[Active Task]` and recall blocks already injected are filtered on
954
+ later turns. SessionStart and rollover reset the pool, so the next session receives
955
+ the handoff content again.
956
+ - **Space deletion (UI + engine)**: `SpaceRouter.deleteSpace(id, {confirm})` closes
957
+ the child handle, evicts its queues/caches and removes the directory (refusing
958
+ `default` and requiring `confirm:true`). `Memory.deleteSpace` / `runtime.deleteSpace`
959
+ gate the same rules (named space only; `MEM_E_FEATURE_DISABLED` in the strict
960
+ single-space core). The HTTP route reuses `POST /spaces` with
961
+ `{action:'delete', space_id, confirm:true}`; an **unknown action is a 400** and
962
+ never falls through to CREATE. The SpaceSelector renders `🗑 删除空间` only for a
963
+ named space AND only when the new **`capabilities.spacesDelete`** handshake is
964
+ true — an old/pre-delete host therefore hides the button instead of answering the
965
+ misleading “空间已存在”. When `capabilities.spaces` is false the entire space UI
966
+ (selector, create/delete, current-space chip) disappears silently.
967
+
968
+ ### Added — local low-valley Dream scheduling (same 1.5.6)
969
+
970
+ - **No external price plugin required**: `src/priceWindow.js` computes Beijing-time
971
+ peak/valley locally (weekday 09–12 / 14–18 peak; lunch, nights and weekends low).
972
+ Chinese holidays are NOT modelled (the calendar moves yearly); `DSH_DREAM_PRICE=low|high`
973
+ or a Host price probe still override it.
974
+ - **The Host bridge gets a default probe** from `isLowValley()`, so a compensating
975
+ Dream skips peaks (`reason:'peak'`) and runs locally in the valley.
976
+ - **Idle LLM Dream defers instead of spending at peak**: `runtime.tick()` writes a
977
+ durable `state/dream-queue.json` (`pending, dueAt, reason:'peak-hour'`), emits
978
+ `dream-deferred`, and runs the queued Dream as soon as the valley opens — the queue
979
+ survives a restart, so a missed window is not lost.
980
+ - **Config `dream.onlyLowValley`** (default true; fail-fast, HTTP-editable, settings
981
+ toggle). A local-only Dream (no LLM) is never gated by price.
982
+ - `/stats` exposes `dreamWindow` (low/reason/nextLowAt), `dreamQueue` and `dreamTimer`.
983
+ - **Phase 2 — wake timer + sleep correction**: `src/dreamTimer.js` arms ONE wake-up
984
+ at the queued due time / next valley (injectable timers, `unref`ed). On fire it
985
+ re-reads the CLOCK and the WINDOW: a late wake after an OS sleep is reported
986
+ (`lateMs`, `catchUp`) and runs; a wake that lands in a peak re-arms for the next
987
+ valley instead of spending. Boot arms from the persisted queue, so a queue left by
988
+ a previous run catches up with delay 0. Disposal cancels the timer.
989
+ `dreamTimer` status (arms/wakes/lateWakes/reschedules/runs) is exposed on `/stats`.
990
+
991
+ ### Added — Federation / cross-space dedupe wiring (same 1.5.6)
992
+
993
+ - **Federation on write**: after a successful write the engine reports the record's
994
+ BUSINESS tags (never `status:*` / `month:*` / `active_task`) to the Orchestrator's
995
+ global `FederationMap` with the space id; a tag seen in two spaces becomes ONE
996
+ global node listing both. A missing/broken service can never fail the write.
997
+ - **Dedupe on monthly memos**: `generateMonthlyMemos()` claims `sha256(content)` in
998
+ the Orchestrator's `ContentRegistry` as `monthly:<spaceId>`; a sibling space with
999
+ the identical monthly workload skips its copy and reports
1000
+ `monthly.skipped`/`skippedEntries` (owner traceable). Same-space reruns are
1001
+ idempotent.
1002
+ - Services arrive through the existing `orchestrator` adapter extras; spaces carry
1003
+ their own `spaceId` (`path.basename(childDir)`), the default space is `default`.
1004
+ - **Read-time merge on recall**: monthly memos now persist `meta.source_event_ids`,
1005
+ and `projectEpisode` exposes `sourceEventIds`. `Memory.mergeRecallHits()` feeds the
1006
+ recalled hits through `ContentRegistry.mergeForRead()`: a memo wins over the events
1007
+ it owns, duplicate `contentHash` collapses monthly-first, and the payload reports
1008
+ `merge: {space,monthly,droppedOwnedByMonthly,droppedDuplicateContent,total}`. Only
1009
+ when the Orchestrator dedupe service is present; the pure core payload shape is
1010
+ unchanged.
1011
+ - **Cross-space recall aggregation**: `Memory.recallAcrossSpaces()` queries every open
1012
+ space under its own lock, tags each hit with `spaceId`, and folds the union through
1013
+ the same `mergeForRead()` (raw hits are requested with `mergeRecall:false` so the
1014
+ aggregation sees owned events before the memo hides them). It is **opt-in**:
1015
+ `features.crossSpaceRecall` defaults to **false**, is fail-fast (true without
1016
+ multiSpace is a contradiction), HTTP-editable and rendered in the settings page.
1017
+ Only when `crossSpaceRecall:true` does `runtime.recall()` use this path; otherwise
1018
+ the single-space payload is unchanged (`mode` is never `cross-space`).
1019
+ `mode:'cross-space'`, `spaces`, `merge` and per-hit `spaceId` are reported.
1020
+
1021
+ ### Tests
1022
+
1023
+ - New `test/v156.rawscan.test.js` (5 cases): newest-first + absolute line number
1024
+ (5000-line shard), turn-budget truncation without reading the head, engine result
1025
+ ceiling, `readLinesReverse` peak buffer ≤ chunk + one line over a 20k-line file,
1026
+ and `restoreByHash` over the streaming path.
1027
+ - New `test/v156.hardening.test.js` (5 cases): recall payload truncation and
1028
+ under-budget pass-through, `maxInjectTokens` fail-fast, `close()` resource release
1029
+ and idempotency, lag monitor yield after a 120ms block, maintenance `eventLoop`.
1030
+ - New `test/v156.tagging.test.js` (7 cases): extraction matrix, untagged write gets
1031
+ an anchor and becomes recallable, raw purity (four fields), manual tags win +
1032
+ dedupe, miss warning + panel counter, `autoTag:false`, config fail-fast.
1033
+ - New `test/v156.pinned.test.js` (3 cases): pinned without tags refused and no
1034
+ write, one-year decay still `decay=1` + index/tag flags + pinned-first ranking,
1035
+ pinned tag stays in the active set after a 400-day maintenance.
1036
+ - New `test/v156.hints.test.js` (4 cases): selector matrix (match/unrelated/internal/
1037
+ empty), hint rendering, prompt tail contains only matching tags after the block
1038
+ marker with a stable prefix, `session/event` user turn tracking.
1039
+ - New `test/v156.features.test.js` (5 cases): flag fail-fast + implied transfer-off,
1040
+ strict single-space engine + capabilities/tools absent, transfer-only-off,
1041
+ defaults unchanged, `Memory.open(string)` + lazy `warmup()`.
1042
+ - New `test/v156.host.test.js` (6 cases): price normalisation; session start runs one
1043
+ compensating Dream; unknown price + LLM skipped; peak skipped; not-due / disabled /
1044
+ in-flight refused; MockHostEnvironment integration through `apply()` + `hostStatus`
1045
+ surfaced on `/stats`; `dream.compensateAfterHours` fail-fast.
1046
+ - New `test/v156.dreamui.test.js` (3 cases): safe Dream subset exposed / credentials
1047
+ absent from the payload; tunables editable over HTTP while `dream.llm.*` is not;
1048
+ settings page renders the section and offers no credential field.
1049
+ - New `test/v156.l2merge.test.js` (4 cases): pinned/ordinary strict separation with
1050
+ global-tag metadata preserved as meta (never a tag); a lone ordinary record is not
1051
+ dragged into the pinned group; `maxSummaryChars` cap + `enabled:false`; config
1052
+ fail-fast. Older fixtures disable `l2Merge` so their exact index-count assertions
1053
+ stay deterministic.
1054
+ - New `test/v156.l3tag.test.js` (4 cases): strict upsert refusal; delete-consolidation
1055
+ derives `error:typeerror` / `origin:unlabelled-episode` instead of dead knowledge;
1056
+ trend promotion derives tags before writing L3; historical untagged summaries are
1057
+ readable but `degraded`.
1058
+ - New `test/v156.preset.test.js` (6 cases): marker records the working mode; a new
1059
+ conversation restores it through `agentPresets.select`; older markers are
1060
+ backfilled from the live agent; resume / same-session / marker-without-preset never
1061
+ override; a failed select does not fail creation; `agent-preset/selected` keeps the
1062
+ tracked mode current.
1063
+ - New `test/v156.singleSpace.test.js` (3 cases): the core works for `default` and
1064
+ refuses named read/write/create/ensure/transfer; without the Orchestrator the plugin
1065
+ advertises `spaces:false`, registers eight tools and never advertises a dead tool in
1066
+ the prompt; injecting the adapter restores ten tools and `spaces:true`.
1067
+ - Updated: manifest 1.5.5 → 1.5.6; settings page gains `context.maxInjectTokens`,
1068
+ the pre-ingest tagging section, Dream tunables and the L2-merge section; editable
1069
+ contract gains `tagging`, `features`, `dream` and `l2Merge`; panel contract gains
1070
+ `global.pinned`, `autoTag` and `l2Merge`; `plugin.test` prompt contract now asserts
1071
+ relevance hints instead of the removed global map.
1072
+ - New `test/v156.firstBatch.test.js` (5 cases): reserved status tags never reach the
1073
+ graph/tag tree; `[Active Task]` from the handoff summary and from a `task:` event;
1074
+ fallback hints reuse the previous turn's tags; session dedup blocks the second
1075
+ injection and resets on a new session.
1076
+ - New `test/v156.spaceDelete.test.js` (5 cases): engine deletion with confirm/default/
1077
+ missing rules; strict single-space refusal; **`capabilities.spacesDelete` versioned
1078
+ handshake** (an old host hides the button, so a delete request can never be
1079
+ misread as CREATE); `POST /spaces {action:'delete'}` removes the store and returns
1080
+ the refreshed list; unknown actions answer 400 instead of falling through to
1081
+ CREATE; the UI source carries the capability guard, the button, the human confirm
1082
+ and the default-space guard.
1083
+ - **Graph interaction layer** (`test/v156.graph.test.js`, 4 cases): Ctrl/Cmd+drag
1084
+ pans the canvas (plain drag still moves a node), Ctrl/Cmd+wheel zooms around the
1085
+ cursor via a non-passive native listener (plain wheel keeps page scroll),
1086
+ double-click on blank space resets the view, and the frozen initial layout runs
1087
+ through `separateOverlaps()` so nodes never start piled on top of each other.
1088
+ The header/footer advertise the interaction.
1089
+ - New `test/v156.lowValley.test.js` (4 cases): Beijing peak/valley boundaries and
1090
+ next-low computation; `dream.onlyLowValley` fail-fast + editable; a peak-hour idle
1091
+ Dream is deferred durably and runs at the valley; the Host bridge probe follows the
1092
+ window while `DSH_DREAM_PRICE` remains an override.
1093
+ - New `test/v156.federation.test.js` (2 cases): business tags federate into one
1094
+ global node across spaces while internal tags are skipped; the first space claims a
1095
+ cross-space monthly memo and the sibling reports `skipped` with the owner.
1096
+ - New `test/v156.lowValley2.test.js` (4 cases): peak wake re-arms (never runs); a
1097
+ sleep-delayed wake reports `lateMs`/`catchUp`; a past-due queue in the valley arms
1098
+ delay 0; runtime integration: peak deferral -> timer fire -> queue cleared and
1099
+ `dreamTimer.runs === 1`.
1100
+ - New `test/v156.readMerge.test.js` (2 cases): a recalled monthly memo drops the
1101
+ events it owns and reports merge stats; without the dedupe service the recall
1102
+ payload is unchanged.
1103
+ - New `test/v156.crossSpaceRecall.test.js` (2 cases): a recall returns hits from every
1104
+ open space with provenance; a monthly memo hides its owned event even when recorder
1105
+ in another space, while the other space still contributes.
1106
+ - New `test/v156.crossSpaceRecallFlag.test.js` (3 cases): default false + fail-fast
1107
+ (`true` without multiSpace is a contradiction, non-boolean rejected); flag true
1108
+ aggregates open spaces; flag false keeps the single-space payload.
1109
+ - **Settings-page GitHub installer**: new `POST /api/hippocampus/orchestrator/install`
1110
+ (requires `{confirm:true}`) delegates to the Host's
1111
+ `pluginManager.installBundle('git+https://github.com/382quaii/dsh-Layers-Orchestrator.git', {enabled:true})`,
1112
+ short-circuits when the service is already present, and reports
1113
+ `applied | restart-required | manual | failed`. The settings page ships a
1114
+ “从 GitHub 安装 dsh-orchestrator” button (human confirm dialog) plus the repo link;
1115
+ without `pluginManager` it shows the exact manual steps instead of failing silently.
1116
+ - **Automatic new conversation on handoff (verified feasible)**: the Host exposes
1117
+ `agents.create/resume` and, decisively, the CLIENT service
1118
+ `uiWorkspace.startSession()` — the same action the “+” button uses. A client-half
1119
+ controller polls `/stats`, and when `handoff.active && handoff.autoNewSession` it
1120
+ calls `uiWorkspace.startSession(undefined, {agentPreset})` once per handoff marker
1121
+ (sessionStorage guard, lifecycle-owned interval, capability-guarded no-op on old
1122
+ hosts). New config `context.autoNewSession` (default **true**, fail-fast,
1123
+ HTTP-editable, settings toggle), plus `context.autoNewSessionPoll`
1124
+ (`interval` | `once`, default `interval`) and
1125
+ `context.autoNewSessionIntervalSeconds` (5–3600, default 15): the settings page
1126
+ now exposes a “按间隔轮询 / 只检查一次” select and an interval slider; the client
1127
+ configures its timer from the FIRST stats response (`once` clears the recurring
1128
+ timer). The workspace-file handoff scheme is no longer needed and stays documented
1129
+ only as a fallback.
1130
+ - **Fixed — new-conversation failure `tool "subagent" is already registered`**:
1131
+ handoff preset inheritance no longer calls `agentPresets.select()` when the new
1132
+ session is ALREADY composed with the marker's preset. A redundant recompose
1133
+ re-mounted the preset's `@deepseek-ai/dsh-tool-subagent` row and aborted session
1134
+ creation; the skip is recorded as `presetInherit.reason='already-composed'` and
1135
+ locked by a regression test in `test/v156.preset.test.js`.
1136
+ - **Persona section + generic custom decay (v1.5.7)**:
1137
+ - `[Persona & Traits]` is its own prompt section (`name:'persona'`, **order 100**),
1138
+ rendering the ≤10 highest-confidence L3 semantic summaries (live store read, not
1139
+ the recall cache). The memory block/policy/reflection sections keep 2450/2455/2460.
1140
+ - `service.remember()` accepts **`customDecayRate`** (finite, 0 < rate ≤ 10) OR
1141
+ **`customHalfLifeDays`** (integer 1–36500), never both. The value is normalised to
1142
+ `meta.decay_rate`, projected as `decayRate`, and applied as
1143
+ `effectiveHalfLife = policyHalfLife / decayRate` for THAT record only. No
1144
+ tag-prefix logic exists anywhere in the engine — an emotion plugin decides the
1145
+ semantics by passing the parameter.
1146
+ - **Cross-plugin `ctx.provide('hippocampus', service)`** (user decision 2026-11-05:
1147
+ in-process service only, NO HTTP write surface): `apiVersion=1`, `ready()`,
1148
+ `capabilities()` (declares `l3Traits:10` plus per-method support), `remember()`
1149
+ (L2-only; non-L2 layers are redirected with a warning; returns
1150
+ `{status,eventId,eventTime,duplicate}`), `recall()`, `runMaintenance(source)`
1151
+ (never queues: a running pass answers `MEM_E_MAINTENANCE_RUNNING`; manual passes
1152
+ are rate-limited to 30 s while `cron` bypasses), `stats()/handoffView()/
1153
+ promptState()` read-only snapshots and `onDispose()` hooks. The service disappears
1154
+ with its plugin fiber; later calls answer `MEM_E_SERVICE_DISPOSED`. New codes
1155
+ `MEM_E_MAINTENANCE_RUNNING`, `MEM_E_SERVICE_DISPOSED`, `MEM_E_FEDERATION_FAILED`
1156
+ are registered append-only (8 cases in `test/v157.service.test.js`).
1157
+ - **Durable Orchestrator state**: `<root>/state/orchestrator.json` now persists the
1158
+ global federation map and the monthly-memo claims (atomic tmp+rename on every
1159
+ mutation); it is loaded before the services become observable, and a corrupt file
1160
+ is treated as empty instead of failing activation — a restart no longer forgets
1161
+ cross-space dedupe.
1162
+ - Full suite: **411 tests / 411 pass / 0 fail**, 64 test files. Orchestrator:
1163
+ **31/31** (`service` + `spaces` deletion + `persistence` round-trip/corrupt state).
1164
+ **Installed locally**: desktop profile gets a `link:` dependency + an ordered patch
1165
+ insert BEFORE the hippocampus entries, so the service exists at activation. Two
1166
+ Cordis constraints were fixed on the way: `apply()` must return **undefined**
1167
+ (the return value is treated as an effect → `TypeError: Invalid effect`), and the
1168
+ service is registered directly with `ctx.provide` (itself an effect). The market
1169
+ catalog still does **not** list it: that needs an npm publish / catalog submission.
1170
+ - Added `docs/RELEASE-1.5.6.md`: release notes + the exact push/tag/npm/market
1171
+ commands that require the operator's credentials (none executed here).
1172
+
1173
+ ## [1.5.5] — 2026-11-03
1174
+
1175
+ **Offline Dream distillation: an optional LLM pass that can never take Dream down.**
1176
+ Same-tag L2 records are distilled into one durable, provenance-carrying record.
1177
+ The LLM leg uses **Node's built-in `fetch` only** (charter v2.0 #1: still zero
1178
+ dependencies); endpoint / model / key are injected through config or
1179
+ `DSH_DREAM_LLM_*` env and are never hard-coded, logged, or returned by HTTP.
1180
+ Every failure — no config, network down, timeout, non-JSON — silently degrades to
1181
+ the deterministic local merge and records `MEM_E_DREAM_LLM_FALLBACK`. **303 tests
1182
+ green** (was 295).
1183
+
1184
+ ### Added — Dream LLM distillation (`src/dream.js`, `Memory.executeDream`)
1185
+
1186
+ - **Structured output**: the model must answer JSON `{"summary","confidence"}`;
1187
+ `summary` is capped at `dream.maxSummaryChars` (default 200). Fenced code,
1188
+ non-JSON, missing fields and over-long summaries are all treated as LLM failure.
1189
+ - **Zero-dependency transport**: Node's global `fetch` against an
1190
+ OpenAI-compatible `/chat/completions`; `Authorization: Bearer` only when a key is
1191
+ configured. No SDK, no `node-fetch`, no new `package.json` dependency (test-locked).
1192
+ - **Absolute timeout**: `AbortController` + `Promise.race` under
1193
+ `dream.llmTimeoutMs` (default 15s); the timer is always cleared in `finally`.
1194
+ - **Local fallback**: earliest/latest time + deduplicated core text, capped to
1195
+ `maxSummaryChars`. Degradation warns `MEM_E_DREAM_LLM_FALLBACK` and is visible in
1196
+ `status().panel.dream.lastFallback`.
1197
+ - **Provenance**: the distilled record always carries
1198
+ `meta.source_event_ids` (deduped, sorted) and `meta.distilled_by` (`llm|local`);
1199
+ a re-run never merges the same source twice (`state/dream.json` bookkeeping).
1200
+ - **Circuit breaker**: `failureThreshold` (default 3) consecutive failures open the
1201
+ breaker for `cooldownMinutes` (default 60); afterwards a half-open state allows
1202
+ exactly one probe — success closes it, failure re-opens. Exposed as
1203
+ `panel.dream.circuit`.
1204
+ - **Single-flight + serial**: a concurrent `executeDream()` is refused
1205
+ (`dream-in-flight`); within one run groups are processed strictly serially, so a
1206
+ slow provider can never exhaust connections or accumulate queued work.
1207
+ - **Offline only**: `executeDream()` is called exclusively from the `dream` branch
1208
+ of the maintenance gate, after `maintain()` converged; the online
1209
+ `recall`/`remember` paths never touch the network.
1210
+
1211
+ ### Config
1212
+
1213
+ - New `dream` group (fail-fast validated): `useLlm`, `minGroupSize` (2–50),
1214
+ `maxGroupsPerRun` (1–50), `maxSummaryChars` (40–2000), `maxSourceChars`
1215
+ (80–4000), `maxEventsPerGroup` (2–50), `llmTimeoutMs` (500–120000),
1216
+ `failureThreshold` (1–20), `cooldownMinutes` (1–1440), and
1217
+ `llm.{baseUrl,model,apiKey}`. The `llm` block is deliberately **not** part of the
1218
+ UI/HTTP config projection, so a credential can never leak through the panel.
1219
+
1220
+ ### Tests
1221
+
1222
+ - New `test/v155.dream.test.js` (8 cases): no-config local fallback with full
1223
+ provenance; LLM success (URL/header/body/JSON parse); non-JSON degradation;
1224
+ fetch timeout degradation; single-flight refusal; circuit open → no fetch →
1225
+ half-open single probe → close; `dream` config fail-fast matrix; `package.json`
1226
+ dependency red line.
1227
+ - Updated: status-panel contract gains `dream`; manifest 1.5.4 → 1.5.5.
1228
+ - Full suite: **303 tests / 303 pass / 0 fail**, 41 test files.
1229
+
1230
+ ## [1.5.4] — 2026-11-02
1231
+
1232
+ **Hotfix: the automatic handoff state machine can no longer wedge a session, and
1233
+ recursive handoff summaries are cut off at the source.** Incident: recursive
1234
+ `交接摘要` generations inflated the ratio past the native window and a handoff that
1235
+ failed could leave the machine stuck, blocking new sessions. **295 tests green**
1236
+ (was 286).
1237
+
1238
+ ### Fixed — state machine (no deadlock, Fail-Fast with graceful degradation)
1239
+
1240
+ - **`checkHandoff()` never rejects**: a distillation error, a timeout (default 5s,
1241
+ injectable per call) or a marker-write failure degrade to a `state:"failed"`
1242
+ marker carrying `summaryError` and return immediately. The next session starts
1243
+ regardless.
1244
+ - **New-session transition resets everything**: `observeSessionTokens()` always
1245
+ establishes the new session's own baseline, consumes a marker belonging to a
1246
+ different session, and **releases `_handoffInFlight`**, so a hung handoff guard
1247
+ can never own the next session. A same-key restart (estimate halved after reset)
1248
+ is treated as a new baseline too.
1249
+ - **Stale marker consumption happens before early returns**, so a fresh session
1250
+ cannot inherit "handoff active" forever.
1251
+ - **Outer watchdog in `_maybeAutoHandoff()`** in addition to the inner one: even if
1252
+ `checkHandoff` itself hangs, the in-flight flag is released in `finally`.
1253
+
1254
+ ### Fixed — recursion
1255
+
1256
+ - **`_distillHandoffTail()` refuses handoff content** by tag (`status:handoff`) and
1257
+ by the `交接摘要` text prefix, in both the live-context path and the indexed
1258
+ fallback. Output is hard-capped at 1200 characters; the idempotency key includes
1259
+ the timestamp so distinct epochs never collide. (No more summary-of-summary.)
1260
+ - **`status:handoff` is internal**: 2% weight in normal recall and excluded from the
1261
+ recent-memory list, so real facts always outrank handoff bookkeeping.
1262
+
1263
+ ### Added — escape hatches and cleanup
1264
+
1265
+ - **`Memory.resetSessionState()` / `memory_admin action=reset_session` /
1266
+ `POST /api/hippocampus/session/reset` / settings-page 「强制重置交接状态(逃生舱)」**:
1267
+ clears the live token baseline, the in-flight guard and the active marker. It
1268
+ rewrites only `state/`; durable memories are untouched.
1269
+ - **`Memory.repairHandoffSummaries()` + `scripts/repair-handoff.mjs`
1270
+ (`npm run repair-handoff`)**: finds recursive/excess handoff generations
1271
+ (recursive = >=2 `交接摘要` markers) and parks them in the two-phase
1272
+ `pending_delete` queue. Dry-run by default; `--reset-marker` consumes a stuck
1273
+ marker.
1274
+ - Panel session status now exposes `handoffState` / `handoffDegraded` /
1275
+ `handoffErrorCode`; a degraded handoff is visible in the status bar instead of
1276
+ silently locking.
1277
+ - New error code **`MEM_E_HANDOFF_FAILED`**.
1278
+
1279
+ ### Tests
1280
+
1281
+ - New `test/v156.handoff.test.js` (9 tests): recursion refused by tag/prefix and
1282
+ fallback path; throwing/hanging distillation degrades without rejecting; new
1283
+ session resets ratio and releases the stuck guard; handoff summary ranking and
1284
+ list isolation; `resetSessionState` preserves memories; repair dry-run + pending
1285
+ delete; admin tool + HTTP escape hatch (route table 8).
1286
+ - Route contract 7 → 8, manifest 1.5.4.
1287
+ - Full suite: **295 tests / 295 pass / 0 fail**, 40 test files.
1288
+
1289
+ ## [1.5.3] — 2026-11-02
1290
+
1291
+ **Hotfix: space creation no longer exposes a raw `MEM_E_SPACES: HTTP 404`, and
1292
+ invalid/conflicting space names are rejected by the ENGINE with
1293
+ `MEM_E_SPACE_INVALID`.** Incident: a new client bundle called
1294
+ `/api/hippocampus/spaces` against a host process that predated the route (the same
1295
+ process also 404s `/memories`). Fixed on three layers plus a route-drift test.
1296
+ **286 tests green** (was 270).
1297
+
1298
+ ### Added — release hygiene
1299
+
1300
+ - **Benchmark Protocol v1 (`scripts/bench-protocol.mjs`, `npm run bench`)**: the only
1301
+ sanctioned way to publish a throughput number. Each measured run gets a fresh
1302
+ `os.tmpdir()` store, one discarded same-process warmup precedes 5 measured runs,
1303
+ and the report carries MEDIAN + min/max/spread. It makes no speed assertions
1304
+ (a shared/AV-scanned machine must report, not fail), so single-run noise cannot
1305
+ become an architecture conclusion again. Replaces the deleted single-run
1306
+ `scripts/confidence-ab.mjs`.
1307
+ - **Multi-space fixed-overhead coverage (`test/v154.release.test.js`)**: N=10
1308
+ physical spaces — bounded per-space boot (<500ms median), lazy root boot
1309
+ (`spaces.open=[]`, children never eagerly opened), uniform per-space storage
1310
+ (max/min ≤1.35), linear total bytes (≤1.3×N), per-space fixed overhead <256KB.
1311
+ - **Dead config removal**: `context.minInjectConfidence` is gone end-to-end
1312
+ (default/validation/projection, HTTP-editable key,
1313
+ `applyConfidence`/`MIN_INJECT_CONFIDENCE` retrieval pass, recall
1314
+ `confidence`/`lowConfidence` annotations and low-confidence notes, obsolete A/B
1315
+ script). Supplying the old key fails fast with `MEM_E_CONFIG_UNKNOWN_KEY`
1316
+ (`details.removedIn = "1.5.3"`), so a profile cannot keep believing it works.
1317
+ - Test watchdog default 30s → 60s (the in-process suite boots real stores/spaces and
1318
+ legitimately takes ~15–25s; the watchdog now only fires on real hangs).
1319
+
1320
+ ### Added — tool schema pruning
1321
+
1322
+ - **`tools.disabled` config (default `[]`)**: every registered tool definition costs its
1323
+ JSON schema in prompt tokens on EVERY turn (~1.1–1.2k tokens of baseline tax). A
1324
+ closed suffix vocabulary (`remember/checkpoint/recall/capture/bulk_ingest/reinforce/forget/space_transfer/transfer_to_global/admin`)
1325
+ lets an operator prune low-frequency tools; `remember`/`recall`/`admin` are CORE
1326
+ and cannot be disabled. A typo/prefix/full name, a core tool, or a duplicate aborts
1327
+ config resolution with **`MEM_E_INVALID_TOOL_NAME`** (fail-fast, never silently
1328
+ ignored). The register wrapper skips disabled suffixes AND the `memory` prompt
1329
+ section stops advertising them, so the schema prune cannot lie to the model.
1330
+ Editable over HTTP (`tools.disabled`) and rendered in the settings page as a
1331
+ checkbox catalog with core-不可关闭 / low-frequency tooltips. Takes effect on the
1332
+ next host start/reload (tool registration happens at activation).
1333
+
1334
+ ### Fixed
1335
+
1336
+ - **Route-drift lock**: a new test parses the client `API` constant table and
1337
+ proves every path equals the backend `MEMORY_API` value verbatim, and that the
1338
+ registered route table contains them all. Adding a route on one side without the
1339
+ other now fails CI instead of 404-ing in production.
1340
+ - **Capability handshake**: `/stats` (ready AND booting) and `GET /spaces` now carry
1341
+ `capabilities: { version, spaces, memories, transferConsent, multiSpace }`.
1342
+ The client checks `capabilities.spaces` BEFORE calling `POST /spaces`; if the
1343
+ host is older it shows a version hint and disables the action instead of firing a
1344
+ request that 404s. `memories` is gated the same way (old host → "当前宿主版本不
1345
+ 支持记忆列表", not `MEM_E_MEMORIES`).
1346
+ - **Human error copy**: every space-create failure now renders a complete sentence.
1347
+ 404 / route-missing / network → `创建失败:底层引擎未响应,请检查版本或联系架构师`;
1348
+ invalid name → `创建失败:空间名称无效——需以小写字母/数字开头,只能含 a-z 0-9 . _ -(最长 64)`;
1349
+ duplicate → `创建失败:空间「33」已存在,请换一个名称`; reserved → `创建失败:该名称是
1350
+ 系统保留名,请换一个`. The `MEM_E_SPACES: HTTP 404` template is gone from the bundle.
1351
+ - **`MEM_E_SPACE_INVALID` (400)**: `validateNewSpaceId` + `Memory.createSpace` reject,
1352
+ before any directory/JSONL write: empty/whitespace, wrong charset (`Bad`, `bad id!`,
1353
+ path separators, `..`, `.`), >64 chars, trailing dot (Windows alias), Windows
1354
+ device names (`con`, `nul`, `com1`, …), `default` (always exists), an existing
1355
+ space (conflict), and a non-directory path collision. Creation returns `201`,
1356
+ conflicts/invalid ids `400 MEM_E_SPACE_INVALID`.
1357
+ - Fresh spaces are created from `POST /spaces` with a strict non-idempotent
1358
+ `runtime.createSpace`; the lazy `ensureSpace` used by transfer keeps its
1359
+ idempotent semantics.
1360
+
1361
+ ### Tests
1362
+
1363
+ - New `test/v153.spaces.test.js` (7 tests): client↔backend route-path equality
1364
+ (the anti-404 lock), a real dispatch through the CLIENT path against the
1365
+ registered host route table (handler answers 201, never a router 404),
1366
+ invalid/reserved matrix, engine conflict-before-write, HTTP 201/400 + capability
1367
+ handshake, human-copy mapper (no raw 404), capability gating for old hosts.
1368
+ - Updated: `POST /spaces` assertions 200 → 201 strict creation; manifest 1.5.3.
1369
+ - Full suite: **286 tests / 286 pass / 0 fail**, 39 test files (includes
1370
+ `v154.release.test.js`).
1371
+ - **Note (deployment)**: the live host process observed during the incident still
1372
+ 404s `/spaces` and `/memories` — it must be restarted/reloaded for the new routes
1373
+ to serve; until then the new client degrades with the version hint above instead
1374
+ of a naked 404.
1375
+
1376
+ ## [1.5.2] — 2026-11-02
1377
+
1378
+ **Architecture correction: physical storage migration vs. business-data transfer
1379
+ are now physically decoupled, and the UI has a real global SpaceSelector.** The
1380
+ v1.5.0/v1.5.1 UI mixed two unrelated concerns and let the user type
1381
+ `target_space_id`/`event_ids` by hand. Fixed and locked by tests. **270 tests
1382
+ green** (was 263).
1383
+
1384
+ ### Changed — UI (module decoupling)
1385
+
1386
+ - **Physical dataDir migration extracted** into `StorageMigratorUI`, a SYSTEM/DATA
1387
+ MANAGEMENT section at the bottom of the settings page. It owns only the A/B
1388
+ double-buffer state machine: `POST { dataDir }` → `202 state=migrating` → copy →
1389
+ verify → swap, old directory kept as a backup. No event ids, no spaces.
1390
+ - **Business cross-space transfer removed from the settings form**: the manual
1391
+ `event_ids` / `target_space_id` text inputs, the copy/cut buttons and the
1392
+ inline confirmation are gone. Business transfer now exists ONLY in the panel's
1393
+ regulated flow (below).
1394
+ - **Global `SpaceSelector`** in the panel header: a dropdown of the physical spaces
1395
+ (friendly labels: 默认空间 / 工作空间 / 私人空间 / 全局空间, unknown ids verbatim)
1396
+ with `+ 新建空间` (creates an EMPTY space — never a copy). The selection is
1397
+ app-global (`spaceStore` + `space-changed` bus event), so the panel and the
1398
+ settings page follow it.
1399
+ - **Every UI read follows the selected space**: `useMemoryStats`, `useGraph` and
1400
+ `useRecentMemories` append `?space=<id>`; the backend routes `stats`, `graph` and
1401
+ `memories` to that physical store. Memory list, graph, L1 log/index counts, L2.5
1402
+ quarantine, L3 semantic count, L1.5 tag tree and the session status bar are all
1403
+ that space's only — switching spaces cannot blend views or contexts.
1404
+ - **Regulated cross-space flow (UI_TASK_3)**: check memories in the current space →
1405
+ `移动到…` → dialog step 1 states `即将向 [目标空间] 发起迁移请求` → step 2 is the
1406
+ SECOND explicit consent (`二次确认 · 安全红线`, with the cut warning when 剪切) →
1407
+ only then is `user_approved: true` sent. Target is a dropdown of known spaces,
1408
+ never a free-text id.
1409
+ - `h(StorageMigratorUI)` is a separate component, so the two state machines can no
1410
+ longer share draft state or validation.
1411
+
1412
+ ### Added — backend routing
1413
+
1414
+ - **`GET/POST /api/hippocampus/spaces`**: list the router's spaces / create an empty
1415
+ one (`space_id`). The selector and `+ 新建空间` use it.
1416
+ - **`?space=<id>` on `/api/hippocampus/stats` and `/api/hippocampus/graph`**:
1417
+ `runtime.uiPayload(spaceId)` / `runtime.graphPayload(spaceId)` return that space's
1418
+ panel/graph via `Memory.status({ targetSpaceId })` and
1419
+ `Memory.graphForSpace({ targetSpaceId })`; a new space reports zeros (empty), so a
1420
+ switched view is never a fallback to the default store.
1421
+ - `Memory.ensureSpace()` (root router) and `runtime.spaceList()`.
1422
+ - Panel status `panel.spaces.current` now reports the SELECTED space (was always
1423
+ `default`), and `stats`/`graph` responses carry a top-level `spaceId`.
1424
+
1425
+ ### Security (unchanged red line, stricter transport)
1426
+
1427
+ - The HTTP transfer route no longer fabricates consent: it forwards
1428
+ `user_approved` from the request and the ENGINE gate rejects a request that lacks
1429
+ it with `MEM_E_REQUIRE_USER_CONSENT`. The UI only sets the flag after step 2. An
1430
+ agent tool call and a raw POST that "bypasses the UI" therefore hit the same
1431
+ wall.
1432
+ - `dataDir` migration Fail-Fast strengthened: `validateMigrationPaths` now also
1433
+ rejects an existing non-empty target (`MEM_E_MIGRATION_TARGET_BUSY`) and a
1434
+ non-directory target (`MEM_E_MIGRATION_PATH`) synchronously, before a 202/job.
1435
+ The old store remains authoritative on any rejection.
1436
+
1437
+ ### Tests
1438
+
1439
+ - New `test/v152.refactor.test.js` (7 tests): dataDir validation matrix
1440
+ (missing/relative/same/inside/root/non-empty/non-dir) + `startMigration`
1441
+ fail-fast with the old dir intact; space isolation for stats/graph/memories/
1442
+ session/recall with `?space=`; `ensureSpace` empty space + spaces route;
1443
+ unauthorized transfer blocked at engine AND HTTP, authorized passes; UI wiring
1444
+ (SpaceSelector header mount, checkbox flow, no manual inputs, isolated
1445
+ StorageMigratorUI).
1446
+ - Updated contract assertions: HTTP routes 6 → 7 (spaces), transfer route requires
1447
+ explicit `user_approved`, settings order now context → space/session → system
1448
+ storage, cut second-confirmation now lives in the panel dialog, manifest 1.5.2.
1449
+ - Full suite: **270 tests, 270 pass, 0 fail**.
1450
+
1451
+ ## [1.5.1] — 2026-11-02
1452
+
1453
+ **Security patch: cross-space transfer now requires EXPLICIT user consent.** Moving
1454
+ memories between spaces is a data-egress action, not a memory optimisation. Two
1455
+ independent locks (prompt + engine), plus a human-only UI path. **263 tests green**
1456
+ (was 254).
1457
+
1458
+ ### Added
1459
+
1460
+ - **Prompt red line (`memory:policy`)**: a static `【🚨最高安全红线】` block forbids
1461
+ the model from calling `memory_space_transfer` / `memory_transfer_to_global` on
1462
+ its own judgement, sympathy, or "better cross-device sharing". The only allowed
1463
+ trigger is a direct user command in the current conversation; when unsure the
1464
+ model must ask `您需要我把这条信息同步到其他空间吗?`. It also documents the
1465
+ `user_approved: true` retry protocol for `MEM_E_REQUIRE_USER_CONSENT` and states
1466
+ that the intercept is never a one-off obstacle to bypass.
1467
+ - **`memory_transfer_to_global` tool**: copy/move memories from a space into the
1468
+ canonical `global` space, with the same privacy screen, raw_turn stripping, fresh
1469
+ target ids and consent gate as `memory_space_transfer`. Both tool schemas expose
1470
+ `user_approved` and their descriptions carry the security warning.
1471
+ - **`context.requireExplicitConsentForTransfer`** (default **true**, validated
1472
+ boolean, HTTP-editable and exposed in the settings page): the operator's master
1473
+ switch for the engine gate. The settings toggle explains the risk.
1474
+ - **`GET /api/hippocampus/memories`** (`limit`, `space`): bounded recent-memory
1475
+ projection (`eventId`, `day`, `tags`, `snippet`) used by the panel's per-memory
1476
+ detail rows. `Memory.recentMemories()` is read-only and index-snapshot based.
1477
+ - **UI per-memory 分享/转移 button**: the panel now lists the 20 most recent
1478
+ memories with a human-initiated transfer dialog (target space, copy/cut toggle,
1479
+ second confirmation for cut). It calls the transfer route directly — **bypassing
1480
+ the model entirely** — and the browser request is the consenting human.
1481
+
1482
+ ### Fixed / Security
1483
+
1484
+ - `Memory.transferEvents()` now throws
1485
+ **`MEM_E_REQUIRE_USER_CONSENT`** with the fixed message
1486
+ `[系统拦截] 跨空间传递需要用户明确授权。请向用户确认后再试。` when
1487
+ `context.requireExplicitConsentForTransfer` is true and the call does not carry
1488
+ `userApproved === true`. The gate runs **before** space ids are validated, before
1489
+ any store is opened, before content is read and before any pending-delete record
1490
+ is written, so a refused call is provably side-effect free.
1491
+ - `POST /api/hippocampus/transfer` is documented and implemented as the **human
1492
+ channel**: it marks `userApproved: true` itself (same-origin authenticated
1493
+ browser request). The agent half cannot reach HTTP routes, so a UI click needs no
1494
+ model involvement and a model call still hits the gate.
1495
+ - The consent gate is strict: `userApproved` must be the boolean `true`; the
1496
+ config value must be a boolean (a string like `"yes"` fails fast).
1497
+
1498
+ ### Tests
1499
+
1500
+ - New `test/v151.consent.test.js` (9 tests): default-on config + fail-fast type
1501
+ check; engine gate fires before validation/IO (invalid target still answers
1502
+ CONSENT, nothing parked, source untouched); agent tool blocked then succeeds only
1503
+ with `user_approved: true`; `memory_transfer_to_global` same contract; explicit
1504
+ config opt-out; engine-level facade contract; prompt red-line markers; HTTP route
1505
+ marks consent; UI 分享/转移 + direct-API contract.
1506
+ - Intentional contract growth updates: tools 9 → 10, HTTP routes 5 → 6, v150 UI
1507
+ route/transfer assertions extended with `userApproved`, manifest 1.5.1.
1508
+ - Full suite: **263 tests, 263 pass, 0 fail**.
1509
+
1510
+ ## [1.5.0] — 2026-11-02
1511
+
1512
+ Tag-explosion defence, physical multi-space routing, session handoff and the
1513
+ cross-space transfer API. The plugin stays deliberately permission-free: the
1514
+ complex permission choreography belongs to the future Orchestrator plugin, while
1515
+ this engine owns only physical memory. **253 tests green** (was 200).
1516
+
1517
+ ### Added — module 1: tag-explosion defence (P0)
1518
+
1519
+ - **`index.maxPostingsPerTag` (default 500, 1–100000)**: derives the inverted index
1520
+ with a hard physical cap per tag. When a tag exceeds it, the retained pointers are
1521
+ chosen by `salience desc -> eventTime desc -> eventId asc` and re-sorted for
1522
+ retrieval (`eventTime desc`, then id). `eventCount`, `mass` and `lastSeen` are
1523
+ still aggregated over **all** events, so the counts the degradation layer reports
1524
+ are honest; only the in-memory posting pointers are dropped (the JSONL log is
1525
+ untouched and rebuildable). Tags expose `postingsLimit` / `postingsTruncated` /
1526
+ `postingsDropped`; index stats expose `postingsTruncated` / `postingsDropped`.
1527
+ - **Recall degradation for oversized tags**: an EXPLICIT query tag holding more than
1528
+ 50 memories (`TAG_OVERFLOW_THRESHOLD`) is not expanded into the candidate pool.
1529
+ The response carries `oversizedTagHints: [{ tag, total, code:
1530
+ 'MEM_E_TAG_OVERFLOW', hint: '[系统提示] 发现关于 [tag] 的记忆共 N 条,数据量过大。
1531
+ 请提供更精确的 startTime/endTime 或使用 deep_raw 查阅。', window }]` and the
1532
+ course-block fallback is suppressed so the flood cannot re-enter through the back
1533
+ door. If the caller insists (a second recall on the same tag), only the **3 most
1534
+ recent** summaries are returned (`oversizedRecent: true`,
1535
+ `oversized-tag-recent:3`). Graph neighbours of an oversized tag are never woken.
1536
+ - **`deep_raw` super-tag gate**: a query touching a tag with more than 500
1537
+ associations (`SUPER_TAG_THRESHOLD`) without `start_time`/`end_time` now throws
1538
+ **`MEM_E_TIME_RANGE_REQUIRED`** (narrow queries keep the old
1539
+ `MEM_E_INVALID_INPUT` contract). One authority decides: the tool no longer
1540
+ pre-validates the window.
1541
+
1542
+ ### Added — module 2: multi-space routing & session handoff (physical layer)
1543
+
1544
+ - **Config** `context.autoSpaceFollow` (false), `context.autoRolloverEnabled`
1545
+ (true), `context.autoRolloverThreshold` (0.85, 0.5–0.99),
1546
+ `context.nativeTokenLimit` (8000, 512–1000000) — validated fail-fast, editable
1547
+ over HTTP and in the UI.
1548
+ - **`SpaceRouter`** (`src/spaces/spaceRouter.js`): `targetSpaceId` on
1549
+ `remember`/`recall` routes to an isolated physical store
1550
+ (`<dataDir>/spaces/<id>`, `default` = the existing store, so every old path is
1551
+ byte-identical). One FIFO promise chain **per space**: same-space operations are
1552
+ serialised, different spaces run concurrently (a single global lock would
1553
+ reintroduce the cross-space stalls spaces exist to remove). Ids become directory
1554
+ names, so `^[a-z0-9][a-z0-9._-]{0,63}$` is enforced and a typo fails with
1555
+ `MEM_E_INVALID_INPUT` instead of silently writing into the default space.
1556
+ `runMany` acquires in sorted order (no ABBA deadlock).
1557
+ - **Qwen native fidelity**: `ContextEngine.nativeState()` reports
1558
+ `mode: 'native' | 'layered'`; below `nativeTokenLimit` nothing is folded (folding
1559
+ is a layered-mode operation), above it the L1.5 layered fold runs. The legacy
1560
+ `maxTokens` paging threshold is untouched.
1561
+ - **Automatic handoff (转生)**: when the session reaches
1562
+ `autoRolloverThreshold x nativeTokenLimit`, the tail is distilled into ONE durable
1563
+ L1.5 summary (`status:handoff`), `state/handoff.json` is marked active and the
1564
+ `memory-state` prompt appends `[交接标记] … 本插件不能保证一个会话永生不死,只能
1565
+ 保证人格不死。`. A new session consumes the marker. Handoffs are idempotent (one
1566
+ summary per handoff) and self-trigger from the `session/event` stream and from
1567
+ tool boundaries. With `autoRolloverEnabled: false` no marker is written and
1568
+ ContextEngine force-evicts at 95% (`reason: 'native-force'`, down to
1569
+ `target x nativeTokenLimit`).
1570
+ - **Panel/status**: `panel.session` (`mode`, `tokens`, `nativeTokenLimit`,
1571
+ `threshold`, `remainingTokens`, `rolloverEnabled`, `handoffActive`, …) and
1572
+ `panel.spaces` (`current`, `ids`, `open`) are part of the UI contract.
1573
+
1574
+ ### Added — module 3: atomic cross-space transfer
1575
+
1576
+ - **`memory_space_transfer` tool** (`event_ids`, `target_space_id`,
1577
+ `transfer_mode: 'copy' | 'move'` default copy, optional `source_space_id`) and
1578
+ `Memory.transferEvents()`.
1579
+ - **Safety rails enforced by the engine, not the caller**: privacy screening aborts
1580
+ the whole batch with **`MEM_E_PRIVACY_BLOCKED`** (ID cards, CN phones, bank cards,
1581
+ emails, credential assignments, PEM private keys; matched bytes never leave the
1582
+ scanner) before any write; `raw_turn` / `rawTurn` / `raw_*` pointers are stripped
1583
+ from meta at every depth; the TARGET space regenerates `event_id`s
1584
+ (`dedupe:false`, never reuses the source identity) and tags copies
1585
+ `transferred:from:<source>` + `transferred:to:<target>`.
1586
+ - **State difference**: `copy` leaves the source untouched (`state: 'retained'`);
1587
+ `move` parks the source ids in the **two-phase pending_delete queue**
1588
+ (`state: 'pending_delete'`, `dueAt`, cancellable with `restore`) only after every
1589
+ target write succeeded — never a direct physical delete, and a partial target
1590
+ failure leaves the source untouched.
1591
+ - **HTTP**: `POST /api/hippocampus/transfer` (same-origin, validated body) for the
1592
+ UI migration button.
1593
+
1594
+ ### Added — module 4: UI
1595
+
1596
+ - **Space panel**: soft-follow toggle (`context.autoSpaceFollow`), auto-rollover
1597
+ toggle, trigger-ratio slider, native-window field, single-tag index cap control,
1598
+ and a live status bar: `[当前: 原生模式 | 剩余 X Tokens 触发交接]` (also
1599
+ `分层折叠` / `已交接` variants).
1600
+ - **Migration interaction**: copy/cut (复制/剪切) toggle next to the transfer button;
1601
+ choosing 剪切 requires a **second confirmation warning** before any request is
1602
+ sent.
1603
+ - **Philosophy footer** (bold, bottom of the settings page): **本插件不能保证一个
1604
+ 会话永生不死,只能保证人格不死。**
1605
+ - **Subtraction**: the tag search box uses the host-native Enter key only — no
1606
+ debounce, no timer, no effect. `filterGraphByQuery` is pure and testable; the
1607
+ force layout is not re-run by filtering.
1608
+
1609
+ ### Changed
1610
+
1611
+ - `uiConfig` exposes `index`; `Memory.applyLiveConfig()` projects a validated config
1612
+ onto the facade **and every open child space**, including the context engine's
1613
+ native/rollover overrides.
1614
+ - `Memory` opens child spaces lazily with the same policy input; `close()` closes
1615
+ children first; a child failure never blocks the rest.
1616
+ - The `memory-state` prompt only gains the handoff block when a marker is active,
1617
+ so the cache-stable prefix is unchanged in the common case.
1618
+
1619
+ ### Tests
1620
+
1621
+ - New files: `v150.index.test.js` (truncation/degradation/super-tag gate),
1622
+ `v150.space.test.js` (per-space concurrency, native boundary, forced eviction),
1623
+ `v150.transfer.test.js` (copy/move state difference, privacy, raw_turn strip,
1624
+ fresh ids), `v150.ui.test.js` (bundle contract, helpers, no debounce, footer,
1625
+ transfer route), `v150.lifecycle.test.js` (Qwen mode, threshold handoff, marker
1626
+ consumption, `targetSpaceId` isolation, ninth tool surface),
1627
+ `v150.config.test.js` (new groups, ranges, HTTP editability).
1628
+ - Intentional contract updates in old tests: 8 -> 9 tools, 4 -> 5 routes,
1629
+ `panel.session`/`panel.spaces` added to the panel snapshot, manifest 1.5.0.
1630
+ - Full suite: **253 tests, 253 pass, 0 fail** (old 200 cases included unchanged).
1631
+
1632
+ ## [1.4.3] — 2026-11-02
1633
+
1634
+ Two measured blockers from the 2026-11-02 handoff, both fixed and locked by tests.
1635
+
1636
+ ### Added
1637
+
1638
+ - **`raw.maxScanTurns` config (500–50000, default 5000)**: `deep_raw`'s scan budget
1639
+ was a hidden constant and is now a validated, UI-editable knob (`raw.maxScanTurns`).
1640
+ - **`stage()` / `commitMany()`**: remember is now a `stage -> commitMany` composition.
1641
+ `stage()` validates and builds a record (identity + idempotency, no log/index I/O);
1642
+ `commitMany()` performs ONE durable append, ONE ledger checkpoint and ONE index
1643
+ delta for a whole batch. `bulkIngest` uses it, so a 50-item chunk is one write
1644
+ instead of 50.
1645
+ - **`memory-state` prompt is now composed** via `composePrompt`: stable rules →
1646
+ `[Memory Map]` (active tags + counts) → `[Memory Blocks]` (the only per-turn
1647
+ volatile tail). The old single-line `briefing()` is no longer the prompt body
1648
+ (it changed on every write and broke the prefix cache). Full-chain tests lock the
1649
+ prefix to be byte-identical before/after a recall injects a block.
1650
+ - **`scripts/confidence-ab.mjs`**: local A/B benchmark for `context.minInjectConfidence`
1651
+ (100 noise + 10/3 relevant; characters, hits, low-confidence hints, mis-degraded
1652
+ relevant memories). Run it with `node scripts/confidence-ab.mjs`.
1653
+ - **Crash-restart test**: kills the process inside the 200ms checkpoint window
1654
+ (cancelled timer, no `close()`), reopens the same directory, and asserts the fresh
1655
+ instance reports `stale` (`unflushed-bytes`), rebuilds the index and can recall the
1656
+ unflushed tail.
1657
+
1658
+ ### Fixed
1659
+
1660
+ - **`injectRecall()` crashed on any L3 semantic hit**: it used `summary.id` while
1661
+ `rankSemantic()` returns `summaryId`, so a recall with a distilled summary and
1662
+ `context.injectPrompt` failed with `MEM_E_IO: ContextEngine.inject requires an id`.
1663
+ Now it uses `summaryId ?? id` and skips invalid summaries. Found by the new
1664
+ prompt/tag-tree full-chain test.
1665
+ - `logStore.status()` now exposes `unflushedBytes` (shard size minus manifest bytes)
1666
+ so an unclean shutdown cannot hide the uncheckpointed tail behind equal counters.
1667
+
1668
+ ### Changed
1669
+
1670
+ - **`deep_raw` scans NEWEST-FIRST** (per shard, tail to head). The old head-first
1671
+ scan burned its whole budget on the oldest 5000 turns of a day file — in a 10k
1672
+ shard the newest turn could never be found. A hit beyond the window now returns
1673
+ `truncated: true` with a note instead of pretending the turn does not exist.
1674
+ - **Buffered log append**: the hot path keeps one append handle without fsync +
1675
+ manifest rewrite per record. A 200ms checkpoint (and `close()`, and any
1676
+ rewrite/compaction) fsyncs and publishes the manifest; `status().unflushedBytes`
1677
+ plus the boot check make a mid-burst crash visible as stale instead of silently
1678
+ "up to date".
1679
+ - **Identity ledger checkpoint is debounced** (500ms / `close()`): it is a derived
1680
+ startup hint rebuilt from the log, so rewriting it per append was pure O(n²) cost.
1681
+ - **Index appends are lazy**: `applyRecords` records the delta and marks the view
1682
+ dirty; the next `snapshot()` folds it once. N writes cost one index build, and
1683
+ read-your-writes still holds because the fold happens on the read path.
1684
+ - **Briefing is dirty-driven**: a write marks the prompt-state line stale; the next
1685
+ `briefing()` / panel poll rebuilds it once instead of every append.
1686
+
1687
+ ### Measured
1688
+
1689
+ - Sequential `memory.remember` x1000: **119/s -> 9104/s** (8.4s -> 110ms).
1690
+ - 10,000-line raw shard, newest query: **0 hits -> 1 hit** (`deep_raw` now starts at
1691
+ the tail; hash restore and redaction regression-guarded).
1692
+ - **`deep_raw` tail-scan bias documented**: beyond `raw.maxScanTurns` (default 5000)
1693
+ per shard, only the newest N turns are covered; older history needs a larger budget
1694
+ or time-window pagination (`end_time` moved backwards). `truncated: true` + notes
1695
+ always say so.
1696
+ - **Confidence A/B (measured)**: `minInjectConfidence=0.6` cuts the tool payload by
1697
+ **49.7%** (10 relevant / 100 noise) and **75.8%** (3 relevant / 100 noise), with
1698
+ **0 relevant hits mis-degraded**; the prompt window only shrinks when the top-8
1699
+ contains noise (0% vs 59.7% in the two scenarios), so the honest claim is
1700
+ "long-tail payload + anti-hallucination", not "always fewer prompt tokens".
1701
+ - 197 tests green (was 189); after the prompt/tag-tree full-chain wiring and the
1702
+ crash-restart test: **200**.
1703
+
1704
+ ## [1.4.2] — 2026-11-01
1705
+
1706
+ ### Added
1707
+
1708
+ - **L1.5 标签层级树**: hierarchical tags (`tech/frontend/vue3`) now have a
1709
+ three-level lifecycle — immortal roots, leaves that die when their reference
1710
+ count reaches zero, and mids that enter a grace window when they lose their last
1711
+ child. A mid inside that window is a **ghost**: it can be revived by a new leaf,
1712
+ and it is what the UI's history view shows. The tree is a **derived cache**
1713
+ (`state/tag-tree.json`) built by `maintain()` from the converged index; the
1714
+ previous cache is carried forward (`refCount = 0`, orphans dropped) so the
1715
+ lifecycle is observable across maintenance runs. Deleting the file loses only
1716
+ ghost history.
1717
+ - **Bounded prune queue**: dead leaves are queued and consumed one
1718
+ `tagTree.pruneBatchSize` batch per maintenance run; the remaining queue is
1719
+ persisted in the same atomic write, so a 10k-leaf storm drains across runs
1720
+ instead of causing a maintenance storm.
1721
+ - **Anti-hallucination recall degradation**: a `memory_recall` hit reached only
1722
+ through a fading mid is **removed from `hits` entirely** (body, snippet and score
1723
+ never reach the model or the prompt window) and replaced by one metadata hint per
1724
+ mid: path, count, remaining grace days and the exact `deep_raw` time window. A
1725
+ query that names a fading mid with no live episode returns a `count: 0` hint
1726
+ instead of silence.
1727
+ - **`panel.tagTree`**: node/root/mid/leaf/ghost/queue counts for the Web panel, and
1728
+ `GET /api/hippocampus/graph` now returns `tagTree.ghosts` in the same response as
1729
+ the cached graph.
1730
+ - **UI**: `tagTree.*` sliders with numeric boxes and hover tooltips in the settings
1731
+ section; ghost nodes rendered in the force graph as translucent dashed circles
1732
+ hanging under their parent root, with a `仅活跃 / 历史全貌` toggle that cross-fades
1733
+ them via CSS opacity (the force layout does not re-run when toggling).
1734
+ - **Config `tagTree` group** (fail-fast, editable over HTTP and in the UI):
1735
+ `midHalfLifeMultiplier` (1–10), `midGracePeriodDays` (7–180),
1736
+ `pruneBatchSize` (10–500), `leafDecayFloor` (0–1). `midHalfLifeMultiplier` is the
1737
+ only source of the mid half-life — no silent hard-coded lifetime.
1738
+
1739
+ ### Changed
1740
+
1741
+ - `maintain()` now rebuilds/prunes/persists the tag tree after the index
1742
+ generation converges; a tag-tree failure is reported as `report.tagTreeError`
1743
+ and can never fail maintenance or block recall.
1744
+ - `applyConfig` now projects the validated config onto the running `Memory` facade,
1745
+ so live UI edits (raw limits, tagTree lifetimes, …) actually reach the running
1746
+ objects instead of waiting for a reload.
1747
+ - `pruneBatch` re-derives decay against the pass's `now` (a frozen build-time score
1748
+ made grace windows meaningless), rejects `O(mids × nodes)` rescans, and keeps
1749
+ parent child counts truthful when a mid dies.
1750
+
1751
+ ## [1.4.1] — 2026-11-01
1752
+
1753
+ ### Added
1754
+
1755
+ - **Prompt discipline (soft interception)**: a static `memory:policy` section tells
1756
+ the model to prefer `memory_recall` for history/files/system facts, and to treat
1757
+ a `[Slimmed]` response as an invitation to answer from the summary unless the
1758
+ `recovery_hash` must be dereferenced.
1759
+ - **Own-tool output slimming**: `memory_recall`/`memory_admin` responses over the
1760
+ budget (default 2000 tokens) are captured to raw first, then returned as
1761
+ `{slimmed, summary, topics, key_entities, recovery_hash, hint}`; the hint points
1762
+ at `memory_recall(mode="deep_raw", hash=…)`, which restores the exact payload.
1763
+ - **Retrieval confidence**: hits below `context.minInjectConfidence` (default 0.6)
1764
+ carry a short hint instead of their full body, plus a `low-confidence-hints:N` note.
1765
+ - **Write flood guard**: writes above 80% of `storageBudgetMb` throw
1766
+ `MEM_E_WRITE_FLOOD`; `memory.bulkIngest` chunks 50 items per await and ships as
1767
+ `memory_bulk_ingest`.
1768
+ - **raw.captureRatio** (0 | 0.5 | 1): deterministic sampling by content hash;
1769
+ ratio 0 disables capture and `deep_raw` returns an explicit warning.
1770
+
1771
+ ### Changed
1772
+
1773
+ - `memory_recall` gains `hash` (exact raw restore) and confidence fields; deep_raw
1774
+ results honour the token budget before returning.
1775
+ - `promptLayout` composes stable rules → memory map → `[Memory Blocks]` tail.
1776
+
1777
+ ## [1.4.0] — 2026-10-31
1778
+
1779
+ ### Added
1780
+
1781
+ - **Raw-turn forensics (`memory_capture`, `memory_recall mode:"deep_raw"`)**: a
1782
+ separate day-sharded JSONL store (`raw/`) that is never indexed, never loaded at
1783
+ boot, and never touched by normal recall. Gated by `raw.mode` (default
1784
+ `salience`: high-salience, code, stack traces, tool output, or `force`), deduped
1785
+ by content hash, secret-redacted, and capped by `maxTurnKb` (head+tail
1786
+ truncation), `maxBytesPerDay`, `maxTotalMb`, and `retentionDays` (pruned by
1787
+ maintenance; code shards keep 90 days). `deep_raw` scans newest→oldest under a
1788
+ byte/turn budget and reports `truncated: true` instead of pretending it saw
1789
+ everything.
1790
+ - **Spaced repetition**: engine-owned schedule (`1,2,4,7,15,30` days) persisted in
1791
+ `state/reviews.json`; `maintain()` reconciles due items and `reinforce` advances
1792
+ the step. Exposed as `memory_admin action="reviews"`.
1793
+ - **Two-phase delete**: `forget` parks the event for `delete.graceHours`
1794
+ (default 24) in `pending_deletes`; `restore` cancels it, and `maintain()`
1795
+ promotes expired requests into the 4-phase pipeline. Unknown ids now fail
1796
+ immediately, before parking.
1797
+ - **UI data-dir migration**: `dataDir` is editable in the settings page. Saving it
1798
+ takes `.migration.lock`, returns HTTP 202 with `state=migrating`, copies with
1799
+ `fs.promises.cp` in the background, verifies `recordCount` on both sides, and
1800
+ only then switches and reloads the store. A mismatch removes the target and
1801
+ keeps the old store authoritative; the source is never deleted.
1802
+ - New config groups: `raw.*`, `delete.graceHours`, `review.enabled`,
1803
+ `migration.timeoutMs` (all fail-fast validators, UI tooltips included).
1804
+ - **Raw-turn black box (minimal schema)**: each line is exactly
1805
+ `{turn_id, timestamp, role, content}` — no tags, salience, decay, event ids,
1806
+ graph links, session ids or metadata. Addressing is by `(day file, line number)`;
1807
+ append-only keeps lines stable (the one lawful line-pointer exception).
1808
+ Writes are queued and flushed in batches (10 records / 1s), never sync.
1809
+ - **Read-side redaction**: the shard keeps 100% plaintext (forensic integrity);
1810
+ secrets are redacted when `deep_raw` returns snippets, before any text reaches a
1811
+ model prompt. README states local storage is plaintext.
1812
+ - **Tombstones**: a committed purge appends `raw_tombstone {hash, timestamp}`;
1813
+ scans skip tombstoned content hashes (no resurrection).
1814
+ - **deep_raw constraints**: `start_time` and `end_time` are mandatory (missing →
1815
+ `MEM_E_INVALID_INPUT`), results are capped by `raw.maxResultTokens` (default
1816
+ 1000) and carry the truncation notice when cut.
1817
+ - **TTL**: maintenance deletes whole day files strictly older than
1818
+ `today - raw.retentionDays`; today's shard is never touched. Raw bytes are
1819
+ surfaced as `panel.storage.rawBytes` and counted in the dashboard ring.
1820
+ - **Automatic raw capture**: the plugin subscribes to `dsh-session`'s
1821
+ `session/event` and stores every user/assistant surface message verbatim
1822
+ (`raw.autoCapture: true`). The Host-injected `Current runtime context.` block is
1823
+ stripped out of `content` and kept (truncated) in `metadata.runtimeContext`, so
1824
+ `deep_raw` stays signal-clean. Tool output is opt-in (`raw.captureTools: false`),
1825
+ **except failed tool results** (`isError`), which are always captured as
1826
+ `kind: "error"`. Budgets, dedupe and retention still apply.
1827
+
1828
+ ### Changed
1829
+
1830
+ - Panel adds `raw`, `reviews`, and `pendingDeletes`; the settings page renders a
1831
+ migration progress card while `state=migrating`.
1832
+ - `Memory._scheduler` cron now reads `runtime.config` per tick, so a hot config
1833
+ update changes the schedule without a restart.
1834
+
1835
+ ## [1.3.1] — 2026-10-30
1836
+
1837
+ ### Fixed
1838
+
1839
+ - **Cold-start 404 (root cause)**: `webServer` is provided by the web-app row, which
1840
+ activates *after* this plugin's `apply()`. The old code called
1841
+ `ctx.get('webServer')` once and silently skipped registration when it was
1842
+ absent — every cold start had no routes, while a warm reload worked. Route
1843
+ registration now lives in `ctx.inject(['webServer'], child => …)`, so the child
1844
+ fiber activates the moment the service appears and the routes are always
1845
+ mounted. Verified live (404 → 200) and covered by a deferred-inject test.
1846
+ - **Front-end death spiral**: a bodiless 404 used to be synthesized into a JSON
1847
+ error, which the old retry counter treated as a protocol failure and gave up
1848
+ after six attempts. `getJson` now keeps "no JSON" distinct, and the pure
1849
+ `decideRetry` policy retries bodiless 404s with exponential backoff (capped at
1850
+ 5s) for up to 10 minutes before surfacing `MEM_E_BOOT_TIMEOUT` with a manual
1851
+ reconnect button.
1852
+ - **Diagnostics**: `apply()` prints `[Hippocampus] Route registered at <iso>
1853
+ (<paths>) phase=<phase>` when the routes are mounted, and
1854
+ `[Hippocampus] Route registration FAILED: <reason>` if the service never
1855
+ provides one.
1856
+
1857
+ ## [1.3.0] — 2026-10-30
1858
+
1859
+ ### Added
1860
+
1861
+ - **Context folding (推币机)**: blocks evicted from the context window are no longer
1862
+ dropped. A light rule folds the most recent batch into one `folded_summary`
1863
+ episode tagged `status:folded` — extracting names, task statements and core
1864
+ conclusions — and writes it back to the L1 log.
1865
+ - **Graph association (在线联想)**: when a query touches a tag, retrieval reads the
1866
+ cached graph and pulls that tag's three strongest neighbours into the candidate
1867
+ pool with an explicit `penalty: 0.5`; such hits are marked `association.via` and
1868
+ can never outrank a direct hit.
1869
+ - **Monthly memos (月记)**: `maintain()` condenses a finished natural month into one
1870
+ `status:monthly` episode. Memos do not decay (`decay = 1`) and are pulled in
1871
+ first for fuzzy historical queries ("上个月", "2023-10", "去年" …).
1872
+
1873
+ ### Changed
1874
+
1875
+ - HTTP routes are now registered **before** tools, prompts and scheduling inside
1876
+ `apply()`, so a page that wins the boot race hits a live handler answering
1877
+ `state=pending` instead of a 404. The Host-side assumption is documented in the
1878
+ code: `apply()` awaits nothing, and route service is expected once it returns.
1879
+
1880
+ ## [1.2.0] — 2026-10-30
1881
+
1882
+ ### Added
1883
+
1884
+ - **`memory_checkpoint`** (`task_id`, `progress`, `updated_at`): exactly one active
1885
+ heavy task. A new checkpoint demotes the previous one, one not refreshed for
1886
+ seven days is demoted by `maintain()`, and `memory_admin action="active_task"`
1887
+ reads it straight from the index — the active-set cap of 200 does not apply.
1888
+ - **Multimodal pointers**: `memory_remember` accepts `media_url` (absolute path or
1889
+ http(s) URL) plus `media_type` (`image|video|document|audio`). Inline base64 in
1890
+ `content` is rejected with `MEM_E_INVALID_MEDIA` from 256 consecutive base64
1891
+ characters; 200 characters is still ordinary text.
1892
+ - **`decay.halfLifeDays`** (default 30, 7–365) and **`activeSet.cap`** (default 200,
1893
+ 100–1000): both declared in `DEFAULT_CONFIG`, validated fail-fast by
1894
+ `resolveConfig`, projected into `policy`, and editable from the settings page.
1895
+ - **State handshake**: every route response now carries `state`
1896
+ (`pending|in_progress|ready|failed`), and the UI retries on `state` rather than
1897
+ on the HTTP status. A bodiless 404 during boot is treated as `pending` for a
1898
+ 120s grace window (the routes are only mounted once the Host runs `apply()`).
1899
+
1900
+ ### Changed
1901
+
1902
+ - Writes before READY are refused loudly: `POST /api/hippocampus/config` answers
1903
+ `409` with `MEM_E_NOT_READY` and the current state; tools already answered
1904
+ `MEM_E_NOT_READY`, and their error details now include `state` and `retryable`.
1905
+ - The settings page covers the full editable surface (18 keys), with the documented
1906
+ hints for `storageBudgetMb`, `context.maxTokens`, `decay.halfLifeDays` and
1907
+ `activeSet.cap`; saving before READY is disabled in the UI and rejected by the API.
1908
+
1909
+ ## [1.1.0] — 2026-10-29
1910
+
1911
+ ### Added
1912
+
1913
+ - **Graph dragging**: nodes are movable with pointer events. The dragged node is
1914
+ pinned for the duration, coordinates are mutated in a ref and painted straight
1915
+ to the DOM (no `setState` per frame), and release unpins it and runs a short
1916
+ alpha relaxation over its 1-hop neighbourhood. A pointer travel under 4px is
1917
+ still a click, so selecting a label can never move the node by accident.
1918
+ - **`storageBudgetMb`** (integer, default 50, range 10–1000): the storage ring's
1919
+ budget is now configurable instead of hard-coded, and the ring recomputes the
1920
+ moment the value is saved.
1921
+ - **Full settings UI**: every editable config key is in the settings section —
1922
+ switches for booleans, bounded number inputs, a select for
1923
+ `identity.eventTimePolicy`, and a text field for the maintenance cron. Saving
1924
+ posts one dotted-path patch through the same fail-fast validator as startup;
1925
+ a rejected value shows a red banner with the `MEM_E_CONFIG_*` code and nothing
1926
+ is applied. A successful save broadcasts `config-changed` so the panel
1927
+ refetches stats and graph immediately.
1928
+
1929
+ ### Fixed
1930
+
1931
+ - Dotted config paths deeper than one level (`identity.eventTimePolicy`,
1932
+ `retrieval.topK`) now nest correctly instead of producing a literal key.
1933
+
1934
+ ## [1.0.0] — 2026-10-29
1935
+
1936
+ First public release. The package was previously developed under the working
1937
+ names `@local/dsh-memory` / `Layers-Hippocampus`; the data directory is
1938
+ unchanged and legacy folders are migrated automatically.
1939
+
1940
+ ### Added
1941
+
1942
+ - **Layers**: append-only event log, rebuildable tag index (A/B generations),
1943
+ day diaries, independent semantic layer, L2.5 trend quarantine with promotion
1944
+ and burst detection.
1945
+ - **Identity discipline**: canonical `content_hash`, `event_id =
1946
+ hash(content_hash + event_time + occurrence_index)`, separate idempotency
1947
+ index, tombstones that survive log compaction.
1948
+ - **Context paging**: token budget, eviction thresholds, cumulative saved-token
1949
+ accounting persisted in `state/context.json`.
1950
+ - **Maintenance**: one gate for cron and Dream (`runtime.runMaintenance`), no
1951
+ queueing and no backfill; a missed window is skipped, not replayed.
1952
+ - **Config fail-fast**: `enableDream`, `dreamIdleMinutes`, `enableReflection`,
1953
+ `graphMaxEdges` (100–2000, default 500), cron, context and temp ranges are
1954
+ validated by `resolveConfig`; HTTP hot updates go through the same validator.
1955
+ - **Async startup state machine** `pending → in_progress → ready | failed`, with
1956
+ `POST /api/hippocampus/retry` and a UI retry banner.
1957
+ - **Offline knowledge graph**: built at the end of `maintain()` from the index
1958
+ (log minus tombstones), per-node Top-N neighbours, global weight order, cached
1959
+ at `state/graph.json`, hard cap 2000 edges.
1960
+ - **Web UI**: sidebar icon, main panel (SVG storage ring, stats, force-directed
1961
+ graph with progressive reveal), and a settings section.
1962
+ - **HTTP API** (same-origin, behind the Host's browser auth):
1963
+ `GET /api/hippocampus/stats`, `GET|POST /api/hippocampus/config`,
1964
+ `GET /api/hippocampus/graph`, `POST /api/hippocampus/retry`.
1965
+ - **Tests**: 106 in-process cases (Node `node:test`) covering identity,
1966
+ retrieval, L2.5, maintenance, migration, routes, graph and the client bundle
1967
+ contract.
1968
+
1969
+ ### Security
1970
+
1971
+ - The UI never receives credentials and never calls agent tools; every number is
1972
+ read through the Host's authenticated JSON routes.
1973
+ - The graph route returns at most `graphMaxEdges` edges from a cached file — no
1974
+ query language, no path input.
1975
+
1976
+ [1.0.0]: https://github.com/382quaii/dsh-Layers-Hippocampus/releases/tag/v1.0.0