dsh-cortex-memory 0.4.22 → 0.4.146

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.
Files changed (165) hide show
  1. package/CHANGELOG.md +2216 -7
  2. package/README.md +9 -9
  3. package/bench/migration-bench.mjs +1 -1
  4. package/bench/semantic-cn.js +7 -7
  5. package/bench/synthetic.js +2 -2
  6. package/bin/copy-db.mjs +47 -0
  7. package/bin/repair.mjs +328 -0
  8. package/bin/verify.mjs +202 -0
  9. package/cordis.patch.yml +1 -1
  10. package/docs/install-windows.md +2 -2
  11. package/docs/models.md +1 -1
  12. package/docs/quota-compaction-design.md +175 -0
  13. package/index.js +27 -3
  14. package/package.json +3 -3
  15. package/src/adapters/shiori.js +1 -1
  16. package/src/api/routes.js +1 -1
  17. package/src/core/feature-overrides.js +2 -2
  18. package/src/engines/compression.js +172 -3
  19. package/src/engines/consolidate.js +397 -26
  20. package/src/engines/encode.js +16 -3
  21. package/src/engines/extract.js +72 -8
  22. package/src/engines/fact-guard.js +51 -0
  23. package/src/engines/health.js +263 -3
  24. package/src/engines/inhibition.js +39 -0
  25. package/src/engines/life.js +12 -1
  26. package/src/engines/llm-facts.js +12 -9
  27. package/src/engines/narrative.js +150 -13
  28. package/src/engines/reflect.js +172 -14
  29. package/src/engines/retrieve.js +44 -5
  30. package/src/engines/summary-coverage.js +62 -0
  31. package/src/engines/summary-dedupe.js +77 -0
  32. package/src/engines/summon-rank.js +132 -0
  33. package/src/host/runtime.js +64 -4
  34. package/src/host/scheduler.js +224 -3
  35. package/src/llm/adapter.js +29 -8
  36. package/src/memory/query.js +1 -1
  37. package/src/memory/spacing.js +15 -0
  38. package/src/memory/tokenizer.js +1 -1
  39. package/src/prompt/tiers.js +88 -12
  40. package/src/self/alias.js +25 -0
  41. package/src/self/emotion.js +3 -1
  42. package/src/self/relationship.js +44 -13
  43. package/src/self/state.js +20 -2
  44. package/src/self/working.js +34 -3
  45. package/src/service/cortex.js +493 -53
  46. package/src/store/repositories/facts.js +34 -1
  47. package/src/store/repositories/summaries.js +8 -1
  48. package/src/store/repositories/traces.js +22 -2
  49. package/src/tools/definitions.js +118 -4
  50. package/src/vector/index.js +96 -7
  51. package/test/integration/acceptance.test.js +47 -47
  52. package/test/integration/api-contract.test.js +17 -17
  53. package/test/integration/backup-privacy.test.js +10 -10
  54. package/test/integration/consolidate.test.js +6 -2
  55. package/test/integration/edge-cases.test.js +16 -15
  56. package/test/integration/exchange.test.js +26 -26
  57. package/test/integration/life-loop.test.js +7 -6
  58. package/test/integration/load.test.js +4 -4
  59. package/test/integration/policy-query-api.test.js +4 -4
  60. package/test/integration/resilience-writes.test.js +7 -7
  61. package/test/integration/tools-contract.test.js +57 -57
  62. package/test/unit/alias.test.js +87 -0
  63. package/test/unit/api-client.test.js +3 -3
  64. package/test/unit/api-validate.test.js +3 -3
  65. package/test/unit/api.test.js +3 -3
  66. package/test/unit/auto-reflect.test.js +141 -0
  67. package/test/unit/capture-filter.test.js +296 -0
  68. package/test/unit/compaction-preview.test.js +91 -0
  69. package/test/unit/compression.test.js +4 -4
  70. package/test/unit/consolidate-dedupe.test.js +174 -0
  71. package/test/unit/consolidate-errors.test.js +63 -0
  72. package/test/unit/consolidate-gate.test.js +26 -0
  73. package/test/unit/consolidate-preview.test.js +168 -0
  74. package/test/unit/consolidate-protection.test.js +156 -0
  75. package/test/unit/consolidate-reason.test.js +206 -0
  76. package/test/unit/consolidate-retry.test.js +91 -0
  77. package/test/unit/consolidate-selection.test.js +103 -0
  78. package/test/unit/core.test.js +11 -11
  79. package/test/unit/coverage-rewrite.test.js +38 -0
  80. package/test/unit/dedupe-episodes.test.js +34 -0
  81. package/test/unit/dedupe-threshold.test.js +14 -0
  82. package/test/unit/develop.test.js +4 -4
  83. package/test/unit/edges-candidates.test.js +2 -2
  84. package/test/unit/emotion.test.js +2 -1
  85. package/test/unit/encode.test.js +6 -6
  86. package/test/unit/evolution.test.js +5 -5
  87. package/test/unit/extract-question.test.js +41 -0
  88. package/test/unit/fact-guard.test.js +51 -0
  89. package/test/unit/fact-noise-llm.test.js +44 -0
  90. package/test/unit/facts-belief.test.js +4 -4
  91. package/test/unit/facts-compat.test.js +62 -0
  92. package/test/unit/facts.test.js +5 -5
  93. package/test/unit/fts-migration.test.js +6 -6
  94. package/test/unit/growth-reflect.test.js +4 -3
  95. package/test/unit/guardian.test.js +1 -1
  96. package/test/unit/health-consolidation.test.js +52 -0
  97. package/test/unit/health-fts-scope.test.js +33 -0
  98. package/test/unit/health-privacy.test.js +6 -6
  99. package/test/unit/health-summaries.test.js +24 -0
  100. package/test/unit/health-text-maintain.test.js +33 -0
  101. package/test/unit/health-today.test.js +45 -0
  102. package/test/unit/host-runtime.test.js +8 -8
  103. package/test/unit/host.test.js +1 -1
  104. package/test/unit/induct-evaluate.test.js +3 -3
  105. package/test/unit/ingest-extracted.test.js +3 -3
  106. package/test/unit/inhibition.test.js +90 -0
  107. package/test/unit/jobs.test.js +4 -4
  108. package/test/unit/json-snapshot.test.js +1 -1
  109. package/test/unit/label-entities-skip.test.js +18 -0
  110. package/test/unit/llm-facts-integration.test.js +2 -2
  111. package/test/unit/llm-facts.test.js +3 -3
  112. package/test/unit/llm.test.js +5 -5
  113. package/test/unit/locomo.test.js +2 -2
  114. package/test/unit/longmemeval.test.js +2 -2
  115. package/test/unit/maintain-dispute.test.js +62 -0
  116. package/test/unit/maintain-duration.test.js +194 -0
  117. package/test/unit/markdown-import.test.js +5 -5
  118. package/test/unit/markdown.test.js +2 -2
  119. package/test/unit/memory-edit.test.js +5 -5
  120. package/test/unit/migration.test.js +1 -1
  121. package/test/unit/mood-saturation.test.js +33 -0
  122. package/test/unit/narrative-weave.test.js +271 -0
  123. package/test/unit/privacy-scope.test.js +1 -1
  124. package/test/unit/prompt.test.js +1 -1
  125. package/test/unit/providers.test.js +2 -2
  126. package/test/unit/qa.test.js +9 -9
  127. package/test/unit/query.test.js +10 -10
  128. package/test/unit/reflect-backfill.test.js +158 -0
  129. package/test/unit/reflect-coverage.test.js +35 -0
  130. package/test/unit/reflect-overview.test.js +22 -0
  131. package/test/unit/reflect-phrasing.test.js +75 -0
  132. package/test/unit/reflect-sampling.test.js +80 -0
  133. package/test/unit/reflect-source-budget.test.js +24 -0
  134. package/test/unit/relationship-dynamics.test.js +29 -0
  135. package/test/unit/retrieve.test.js +9 -9
  136. package/test/unit/revive-on-read.test.js +84 -0
  137. package/test/unit/scanner.test.js +2 -2
  138. package/test/unit/scenario.test.js +2 -2
  139. package/test/unit/scheduler-autoconsolidate.test.js +95 -0
  140. package/test/unit/scheduler-autodedupe.test.js +52 -0
  141. package/test/unit/scheduler-autosleep.test.js +50 -0
  142. package/test/unit/scheduler-cadence.test.js +33 -0
  143. package/test/unit/scheduler-deep.test.js +62 -0
  144. package/test/unit/scheduler-tick-gate.test.js +38 -0
  145. package/test/unit/scheduler.test.js +2 -1
  146. package/test/unit/service.test.js +5 -5
  147. package/test/unit/shiori-import.test.js +4 -4
  148. package/test/unit/spacing.test.js +14 -0
  149. package/test/unit/store.test.js +13 -13
  150. package/test/unit/summon-left-slot.test.js +51 -0
  151. package/test/unit/summon-rank.test.js +51 -0
  152. package/test/unit/tiers-gist.test.js +140 -0
  153. package/test/unit/tiers.test.js +1 -1
  154. package/test/unit/tokenizer-fts.test.js +6 -6
  155. package/test/unit/tools.test.js +5 -5
  156. package/test/unit/upgrade-0412.test.js +10 -10
  157. package/test/unit/upgrade-0413.test.js +5 -5
  158. package/test/unit/upgrade-0414.test.js +5 -5
  159. package/test/unit/vector-ann.test.js +3 -3
  160. package/test/unit/vector-async.test.js +7 -7
  161. package/test/unit/vector-coverage.test.js +34 -0
  162. package/test/unit/vector-override.test.js +37 -0
  163. package/test/unit/vector-typed-array.test.js +47 -0
  164. package/test/unit/vector.test.js +8 -8
  165. package/test/unit/working.test.js +19 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,2214 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.146 — 2026-11-19
4
+
5
+ First public release since 0.4.22: the same engine, a neutral public surface.
6
+
7
+ ### Changed
8
+ - **Private surface removed from the published package.** Persona defaults stay
9
+ neutral (助手 / 你); a new optional `persona.description` config carries a custom
10
+ self-description for LLM prompts. The migration script that rewrote local
11
+ identity boundaries is gone — `bin/repair.mjs` covers the same data step.
12
+ - **Test corpus and benches are neutral.** Fixtures use generic names and foods;
13
+ no local names, nicknames or journal text remain in the tarball.
14
+ - **README states the real shipped numbers**: version 0.4.146, 520/520 unit tests,
15
+ DSH `>=0.2.1-rc.2 <0.5.0`.
16
+ - `src/engines/narrative.js` strips the configured `persona.selfName` speaker
17
+ prefix instead of a hard-coded one; `src/self/alias.js` no longer ships a local
18
+ nickname in `DEFAULT_USER_ALIASES`.
19
+
20
+ ### Verified
21
+ - Unit: 520/520, twice.
22
+ - Integration: 116/126 — 10 pre-existing tool-contract/host-journey failures
23
+ (documentation lag and host fixtures, not this release); the emotion target
24
+ contract now passes, one more than 0.4.145.
25
+
26
+ ## 0.4.145 — 2026-11-18
27
+
28
+ The speaker prefix hid the quote marker from the stripper.
29
+
30
+ ### Fixed
31
+ - **"用户:> …" lost only half of its decoration.** The content was `用户:> 要彻底跟时间走…`:
32
+ the stripper saw a leading `用户:`, not a `> `, so after the prefix came off the quote
33
+ marker stayed and both the topic and the last clause began with "> ". A single
34
+ `stripDecoration()` pass now removes speaker prefix and quote marker together, looping
35
+ until stable (max three passes).
36
+
37
+ ### Verified
38
+ - Unit: 520/520, twice. New: "用户:> " is stripped in either order.
39
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
40
+
41
+
42
+ ## 0.4.144 — 2026-11-18
43
+
44
+ The quoted seed topic still came from the captured title.
45
+
46
+ ### Fixed
47
+ - **The seed topic reads content too.** `cleanTitle(seed.title || …)` still preferred the
48
+ 40-char captured title, so a topic ended mid-sentence ("…我顺着豆包的线索挖"). It now
49
+ takes `seed.content` first (quote marker and speaker prefix stripped), cuts at 60 chars on a
50
+ punctuation boundary, and only falls back to the title when content is empty.
51
+ - Carries 0.4.143's fix: the "> " quote marker is stripped from both body clauses and the
52
+ seed topic.
53
+
54
+ ### Verified
55
+ - Unit: 519/519, twice. Assertion updated: the seed topic carries the whole sentence.
56
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
57
+
58
+
59
+ ## 0.4.143 — 2026-11-18
60
+
61
+ A quoted turn left a "> " marker in the paragraph topic.
62
+
63
+ ### Fixed
64
+ - **The quote marker is stripped from thread text and the seed topic.** A turn captured from
65
+ a quoted reply read as 「一段关于「> (尾尖…)…」的经历」; `clean()` and `cleanTitle()` now
66
+ drop a leading "> " before the speaker prefix, so it never reaches the paragraph.
67
+
68
+ ### Verified
69
+ - Unit: 519/519, twice. New assertion: no "> " in thread content.
70
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
71
+
72
+
73
+ ## 0.4.142 — 2026-11-18
74
+
75
+ The paragraphs were still cutting capture's 40-char titles in half.
76
+
77
+ ### Fixed
78
+ - **Thread text reads `content`, not `title`.** Capture stores a short title that stops
79
+ mid-parenthesis ("…验收(豆包装:desk") while the content holds the whole turn, so the
80
+ paragraph kept a stump even after the sentence-splitting fix. `clean()` now takes the
81
+ content first, strips capture's "用户:/助手:" speaker prefix, and falls back to the title.
82
+ The 90-char truncation lands on a punctuation boundary and never inside an open bracket.
83
+
84
+ ### Verified
85
+ - Unit: 519/519, twice. Assertions updated to the content-based text; new coverage: speaker
86
+ prefix stripping and unclosed-bracket trimming.
87
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
88
+
89
+
90
+ ## 0.4.141 — 2026-11-18
91
+
92
+ Thread paragraphs: the last three rough edges seen in the live sample.
93
+
94
+ ### Fixed
95
+ - **Long titles are cut at punctuation, not mid-bracket.** `truncate(90)` produced tails like
96
+ "…验收(豆包装:desk". The cut now drops an unclosed bracket tail first, then falls back to
97
+ the last ,;。:、 inside the budget.
98
+ - **Markdown emphasis is stripped from thread text and from the seed topic.** `**…**` and
99
+ backticks no longer leak into the paragraph or the quoted seed title.
100
+ - **A sentence ending in an English dot is no longer treated as a fragment.** `clean()` keeps
101
+ the dot it split at, while the fragment filter rejected every `/\.$/` — so a complete
102
+ sentence like "人类观察日记." was dropped. The dot rule now only catches digit-dot stumps
103
+ ("dsh-cortex 0.").
104
+
105
+ ### Verified
106
+ - Unit: 519/519, twice. New coverage: punctuation-safe truncation, markdown stripping, and an
107
+ English-dot sentence surviving.
108
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
109
+
110
+
111
+ ## 0.4.140 — 2026-11-18
112
+
113
+ Thread paragraphs were cutting version numbers in half.
114
+
115
+ ### Fixed
116
+ - **`sentence()` treated the dot in "0.4.139" as a full stop**, so every paragraph came out
117
+ as a column of stumps ("20:49:dsh-cortex 0.;接着,21:05 0.;…"). The narrative engine now
118
+ splits sentences with `[。!?!?]|\.(?![0-9])` — a dot only ends a sentence when it is not
119
+ followed by a digit — and truncates at 90 chars instead of 60.
120
+ - **Stump fragments are dropped from the paragraph**: entries ending in a bare digit-dot or
121
+ an open bracket ("dsh-cortex 0.", "(尾巴一摆)…") no longer become beats in the story.
122
+ Short human titles ("两天前") are kept.
123
+
124
+ ### Verified
125
+ - Unit: 517/517, twice. New coverage: version numbers survive; paragraph shape; short titles
126
+ are not treated as fragments.
127
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
128
+
129
+
130
+ ## 0.4.139 — 2026-11-18
131
+
132
+ Four polish items: threads read like a paragraph, the deep pass sees the whole store, the
133
+ extractor stops quoting and commanding, and backfill samples 80% of a window.
134
+
135
+ ### Changed
136
+ - **Threads are written as one flowing paragraph**, not a bullet dump. The date is stated
137
+ once in the opener ("11月18日,…") and the clauses are joined with 接着 / 后来 / 最后, so a
138
+ thread is something you read back instead of a list you scan.
139
+ - **The daily deep pass spreads across importance bands.** Ranking from the low end put all
140
+ 60 candidates at importance 0.7 (the next untouched band); `spread: true` takes half from
141
+ the low end and samples the rest evenly, so one pass sees the store's shape.
142
+ - **Backfill samples 80% of each window (the 0.4.129 policy).** 24 of 40 left a structural
143
+ 40% of every window uncovered; it is now 32 of 40, and no extra windows are needed to
144
+ raise that ceiling.
145
+
146
+ ### Fixed
147
+ - **The rule extractor ignores quoted speech and imperatives.** 「他说:「小明喜欢白猫」」no
148
+ longer produces `likes(小明 → 白猫)` about the speaker, and instructions ("记得把桥修好")
149
+ no longer produce facts.
150
+
151
+ ### Verified
152
+ - Unit: 516/516, twice. New coverage: paragraph shape, spread sampling, quoted/imperative
153
+ filtering, and the 80% backfill budget.
154
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
155
+
156
+
157
+ ## 0.4.138 — 2026-11-18
158
+
159
+ The last truncation edge in the narrative pool.
160
+
161
+ ### Fixed
162
+ - **The 24h pass no longer caps at 300 rows.** A busy day already reaches ~320 active traces
163
+ in 24h (the live store: 315), so `around(24h)` with `limit 300` silently dropped the newest
164
+ neighbours — exactly the ones a thread about "tonight" needs. Each pass now carries
165
+ headroom above its own traffic: 24h → 600 rows, 72h → 1200, 7 days → 2000.
166
+ - Live check after 0.4.137: the first two threads woven at 14:04:10 UTC had bullets from
167
+ 18:0x–21:14 of the same evening and none of the 11-12/11-13 residue (`coverage 8/297`).
168
+
169
+ ### Verified
170
+ - Unit: 514/514, twice. New regression test: 400 traces inside 24h with the seed last — the
171
+ newest neighbour must still make the line.
172
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
173
+
174
+
175
+ ## 0.4.137 — 2026-11-18
176
+
177
+ The threads were reading last week's diary because of a pool bug, not the scoring.
178
+
179
+ ### Fixed
180
+ - **`buildThread` queries the seed's own time range instead of "the first N traces since
181
+ epoch".** `traces.listSince()` walks forward from its start and stops at `limit`; with a
182
+ store older than the limit, the pool for a tonight-seed was the 300 oldest active traces
183
+ (11-11 → 11-13), so the 24h window found nothing, the 72h window found nothing, and every
184
+ thread fell through to the 7-day fallback — which held that same old residue. That is why
185
+ 0.4.136's hardening still produced threads full of "2026-11-12 …" bullets: the data source
186
+ was truncated, not the ranking. `traces.range()` now queries `recorded_at` bounds directly,
187
+ and the widest fallback allows 2000 rows so it is not truncated again.
188
+ - Live evidence before the fix: `listSince('2026-11-11', limit 300)` ended at
189
+ `2026-11-13T09:15Z`, while the store had 1437 active traces through 11-18.
190
+
191
+ ### Verified
192
+ - Unit: 513/513, twice. New regression test: 310 old traces plus a tonight seed — the nearby
193
+ traces must win and the old ones must stay out of the line.
194
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
195
+
196
+
197
+ ## 0.4.136 — 2026-11-18
198
+
199
+ Narrative threads now follow the clock instead of importance.
200
+
201
+ ### Changed
202
+ - **`buildThread` uses a hard time window.** It used to rank every trace from the last 7 days
203
+ by `importance*0.35 + recency*0.3 + tags*0.2 + content*0.15`, so a 1.0 identity trace from
204
+ last week could still crowd the seed's neighbours out of the line. A thread is "what
205
+ happened around this moment", not "the heaviest things I remember": candidates now come
206
+ from `seed ± windowHours` (default 24h), widening to 72h and finally the whole 7-day pool
207
+ only when the window holds fewer than two other traces (a silent night still gets a line).
208
+ - The scoring formula is unchanged — with a bounded pool its only job is "which of these
209
+ neighbours is most relevant", which it does fine.
210
+ - `windowHours` is configurable via `threadWindowHours` (maintain path and the same key on
211
+ the sleep path); the returned summary records the window it actually used. Existing
212
+ threads are not rewritten.
213
+
214
+ ### Verified
215
+ - Unit: 512/512, twice. New coverage: nearby traces win over far-away high-importance ones;
216
+ the widening fallback still produces a line when the neighbourhood is quiet.
217
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
218
+
219
+
220
+ ## 0.4.135 — 2026-11-18
221
+
222
+ The four optimizations agreed after 0.4.134.
223
+
224
+ ### Added
225
+ - **A daily deep consolidation pass.** Once a day, after `deepConsolidateHour` (local, default
226
+ 4am), the scheduler runs one wider pass (`deepConsolidateLimit`, default 60 rows) with
227
+ `caller: 'deep-daily'`. The 30-minute delta trigger stays; this is the "one proper
228
+ housekeeping a day" pass. A mid-day restart does not repeat it — the audit row records the
229
+ caller. Disable with `deepConsolidateOnSchedule: false`.
230
+ - **Health shows today's housekeeping**: `consolidation.today` = `{ runs, archived, merged }`
231
+ since local midnight, rendered as "今日整理:N 趟 · 归档 X 条 · 合并 Y 条". A pass that
232
+ changed nothing is not counted as a run, so the number answers "did memory get tidier today".
233
+
234
+ ### Changed
235
+ - **Narrative seeds are picked by recency, not importance.** Sorting by importance kept
236
+ threading the same old identity traces, so every thread read like "about the build" or
237
+ "about the promise". The line now follows what actually happened lately.
238
+ - **The rule extractor ignores design discussions.** Pasted drafts and plan posts
239
+ ("新坑 3:…", "设计草案:…", "待办:…") talk about what might happen, not what did; they no
240
+ longer produce fact rows.
241
+
242
+ ### Verified
243
+ - Unit: 510/510, twice. New coverage: deep-pass timing / once-a-day / limit / disable, today
244
+ counters, recency seeding, discussion-text filtering.
245
+ - Integration: 115/126, unchanged — the same 11 pre-existing environment failures.
246
+
247
+
248
+ ## 0.4.134 — 2026-11-18
249
+
250
+ The two retention/coverage gaps recorded during the 0.4.131 self-review.
251
+
252
+ ### Fixed
253
+ - **Narrative threads have a retention cap.** Threads were rebuilt from recurring topics every
254
+ 6h (and immediately after every restart, since the timer is in-process), so `summaries` grew
255
+ without bound — 5 threads in one evening for essentially two topics. `weave()` now keeps the
256
+ newest `maxTotal` (default 24) and drops the oldest tail (`pruneThreads`).
257
+ - **Thread bullets no longer repeat the date.** Trace titles often start with their own date,
258
+ so lines read "2026-11-12 2026-11-12 上午…". The prefix is omitted when the text already
259
+ starts with it.
260
+ - **Dedupe samples the whole distribution.** Taking only the lowest-importance 80 rows meant a
261
+ duplicate pair in the middle of the store was never seen. Candidates are now half from the
262
+ low end and half evenly sampled across the rest (window 80 → 160).
263
+
264
+ ### Verified
265
+ - Unit: 501/501, twice. New coverage: date prefix, thread cap, dedupe sampling across
266
+ importance.
267
+ - Integration: 115/126, unchanged — same 11 pre-existing environment failures.
268
+ - Live check after 0.4.133: the first applied consolidation. 11 traces merged (one 10-way
269
+ merge of repeated-delivery receipts plus two pairs), `summaries.level='merge'` 0 → 3,
270
+ active 1441 → 1430. A preview no longer blocks the real pass; the model produced correct
271
+ multi-id merge shapes.
272
+
273
+
274
+ ## 0.4.133 — 2026-11-18
275
+
276
+ Two idempotence-gate holes found by self-review right after 0.4.132 shipped.
277
+
278
+ ### Fixed
279
+ - **A `skipped` row only blocks a retry while there is no adapter.** 0.4.132 made
280
+ `skipped` / `preview` / `rejected` all pass the gate, which would have brought back the
281
+ 0.4.130 noise ("no-llm" row on every tick). The gate now distinguishes: without an adapter
282
+ an identical skipped row is reused; with an adapter a skipped row may retry. `applied` and
283
+ `degraded` (a real answer) are still reused; `preview` and `rejected` always pass.
284
+ - **`dedupe`'s idempotence gate ignores preview rows too.** It read the latest
285
+ `model='dedupe'` row without filtering `preview`, so a rehearsal blocked the real dedupe
286
+ pass on the identical decision set.
287
+
288
+ ### Verified
289
+ - Unit: 498/498, twice. New coverage: a skipped row written without an LLM does not block a
290
+ later real run (verified across two store instances); a dedupe preview does not block the
291
+ real dedupe pass.
292
+ - Integration: 115/126, unchanged — the same 11 pre-existing environment failures.
293
+
294
+
295
+ ## 0.4.132 — 2026-11-18
296
+
297
+ Closes the four gaps 0.4.131 exposed on its first day in the live store.
298
+
299
+ ### Fixed
300
+ - **A dry run is recorded as `preview`, not `degraded`/`applied`.** 0.4.131 made preview rows
301
+ stop counting as "asked", but `consolidation.run({ dryRun: true })` still wrote a real
302
+ status, so that half of the fix never fired. A rehearsal no longer pushes its batch out of
303
+ the next real pass, and the idempotence gate lets the same batch through afterwards.
304
+ - **`health` ignores preview rows** when reporting "the last consolidation", so a rehearsal
305
+ cannot masquerade as a real pass.
306
+ - **The consolidation prompt spells out merge shape**: `ids` must contain at least two traces,
307
+ `targetId` must be one of them, and a one-id merge is rejected. The live model kept
308
+ answering `merge` with a single id (6 times in one run) and the validator correctly refused
309
+ it — the fix belongs in the instruction, not in the validator.
310
+ - **Dedupe ranks candidates lowest-importance first.** Near-duplicates cluster at the low end
311
+ (one-off acknowledgements, repeated-delivery receipts) and the old importance-descending
312
+ order never reached them inside the 80-row window. Merge targets are still the most
313
+ informative copy.
314
+
315
+ ### Verified
316
+ - Unit: 496/496, twice. New coverage: a preview does not occupy the next batch, merge prompt
317
+ rules, dedupe candidate order.
318
+ - Integration: 115/126; one stale assertion fixed (`no-llm` → `no-llm-adapter`), the remaining
319
+ 11 failures are the same environment failures present on 0.4.130.
320
+
321
+
322
+ ## 0.4.131 — 2026-11-18
323
+
324
+ Consolidation stops asking the one question it can never answer differently.
325
+
326
+ ### Fixed
327
+ - **Candidate selection ranks the other end of the store.** 0.4.116→0.4.130 sorted active
328
+ traces by importance descending, so every run handed the model the batch its own prompt
329
+ protects (99% of the live store is >= 0.7 and the top slice is all 1.0) and the only
330
+ possible answer was keep. Candidates now rank: no summary cites the trace yet → not shown
331
+ to the model in the last 24h → lowest importance, oldest first. Asked traces sink instead
332
+ of disappearing, so a fully asked pool rotates back over the stale end.
333
+ - **The protection line is one fixed threshold again (0.9).** A percentile of a
334
+ self-selected top slice always equals the batch maximum; the line covered every candidate.
335
+ >= 0.9 is protected from archive/merge, 0.7–0.9 may merge, < 0.7 may archive.
336
+ - **The idempotence gate covers every status, not just `skipped`.** An applied run whose
337
+ decisions were all keep used to burn a fresh LLM call every 30 minutes on an identical
338
+ input. A rejected batch is still retried — that was the model's own bad output.
339
+ - **`health` compares FTS rows per scope.** It counted the global traces against the whole
340
+ FTS index, so any second scope (`agency` in the live store) produced a permanent FTS_DRIFT
341
+ warning for exactly those rows.
342
+ - **`maintain()` no longer closes a dispute while both facts are `disputed`.** `disputed` is
343
+ not "not active"; the old condition resolved the dispute and left the facts unqueryable
344
+ forever. Disputes closed by older versions leave orphan `disputed` facts; those are now
345
+ invalidated on the next maintain pass (`report.orphanDisputes`).
346
+ - **The rule extractor does not turn questions or conditionals into facts.** "你会有感觉吗"
347
+ became will(助手 → 有感觉吗) and "要是想聊两句" became is(要 → 想聊两句). Questions (?/?
348
+ or a final 吗/呢/吧) and if-clauses (要是/如果/假如/万一/倘若/若) are skipped; a
349
+ single-character subject is only allowed for pronouns and address words.
350
+
351
+ ### Added
352
+ - **Narrative threads are actually woven.** `narrative.weave()` existed but nothing called
353
+ it, so `summaries` never held a level='thread' row. `maintain()` weaves up to two threads
354
+ every six hours (config `narrativeWeaveGapHours`); `life.sleep()` weaves as part of its
355
+ report (`narrative` field).
356
+ - **Dedupe runs on a schedule** every six hours (config `dedupeGapHours`, `dedupeLimit`;
357
+ `dedupeOnSchedule: false` disables it), so the merge layer no longer stays empty until
358
+ someone asks by hand.
359
+
360
+ ### Verified
361
+ - Unit: 493/493, twice. Integration: 114/126 pass; the 12 failures are the same pre-existing
362
+ environment failures as 0.4.130 (tool registry count, persona default, journey fixtures).
363
+ - New coverage: selection order, idempotence across statuses, rejected retry, FTS per scope,
364
+ question/conditional extraction, orphan disputes, weave in maintain and sleep, scheduled
365
+ dedupe.
366
+
367
+
368
+ ## 0.4.130 — 2026-11-16
369
+
370
+ Housekeeping release: closes the four P3 items that were deliberately deferred during
371
+ the 0.4.116→0.4.128 chain. No new features.
372
+
373
+ ### Fixed
374
+ - **Consolidation and dedupe see 500 active traces, not 200.** The old pool silently hid
375
+ anything older than the newest 200; the LLM still receives at most `limit` rows.
376
+ - **`dedupe` has the same idempotence gate as `run()`.** Re-preparing an identical decision
377
+ set returns `skipped: 'unchanged'` instead of appending another dream_runs row + audit
378
+ on every call (`force: true` overrides).
379
+ - The `invalid-json` branch now records `groups` / `groupsDropped` like every other exit.
380
+ - `cortex_consolidate action: "run"` refuses a non-dry run on a read-only scope (dedupe
381
+ already did).
382
+
383
+ ### Verified
384
+ - Tests: invalid-json carries group counts; identical dedupe runs report `unchanged`.
385
+ Suite: 477/477, twice.
386
+
387
+
388
+ ## 0.4.128 — 2026-11-16
389
+
390
+ ### Fixed (accounting only; no behaviour change to backfill)
391
+ - The tool schema's `maxWindows` still said `maximum: 20` while the engine allowed 64.
392
+ Both are 64 now; 0.4.127's "20 → 64" note is corrected to "engine 64 / tool 64".
393
+ - `already-reflected` skip rows now also carry `matchedEpisodes` (how many episodes
394
+ contributed to the union coverage), alongside `coveredRatio`.
395
+
396
+ ### Live state after the 21-window backfill
397
+ - episodes 26 (5 old + 21 backfilled), union coverage 507/855 = 59.3%.
398
+ - The remaining 348 uncovered traces are the structural remainder of sampling 24 of every
399
+ 40 traces (21 × 16) plus the 3-trace tail: **60% is this sampler's ceiling**, not a
400
+ threshold problem. Raising it means changing the per-window source budget (0.4.129,
401
+ a policy choice), not more windows.
402
+
403
+ ### Verified
404
+ - Suite: 475/475, twice.
405
+
406
+
407
+ ## 0.4.127 — 2026-11-16
408
+
409
+ ### Fixed
410
+ - **Backfill can resume from a cursor.** Every call restarted at epoch, so a second batch
411
+ spent its whole `maxWindows` quota re-walking already-written windows and could never
412
+ reach the tail — 851 non-reflection traces exceed 20 windows × 40. `backfillEpisodes`
413
+ now accepts `since` (the previous batch's `until`), the tool exposes it, and the ceiling
414
+ is raised to 64.
415
+ - **Same-millisecond windows made the 0.5 coverage bar fragile.** The live store's first
416
+ window contains 51 traces sharing one timestamp (bulk import) while reflect samples 24,
417
+ so coverage = 24/51 ≈ 0.47 — below the bar, meaning a re-run would write a duplicate.
418
+ Resume (`since`) removes that path; the coverage bar stays as a second guard.
419
+
420
+ ### Verified
421
+ - Live: first real segment written (`period 2026-11-11T03:31:26.778Z`, 584 chars,
422
+ 24 sourceIds, active 961→962, episodes 5→6), backup taken first.
423
+ - Tests: new resume test (batch 2 continues from batch 1's `until`; re-running the same
424
+ `since` writes nothing). Suite: 475/475, twice.
425
+
426
+
427
+ ## 0.4.126 — 2026-11-16
428
+
429
+ ### Fixed
430
+ - **The stale comment 0.4.125 said it removed is actually gone now.** 0.4.125 added the
431
+ correct "threshold 0.5" note but left the old "covers >=80% … (50% would skip a
432
+ half-covered stretch)" paragraph above it, so the function still contradicted itself.
433
+ This release deletes the old lines (verified: no `>=80%` left in the file).
434
+ - Skip diagnostics now include `coveredRatio` (e.g. `skipped: already-reflected,
435
+ coveredRatio: 0.62`), so a preview can be explained without guessing which episode
436
+ accepted the window.
437
+
438
+ ### Verified
439
+ - Suite: 474/474, twice; `reflect.js` syntax clean and no stale threshold text remains.
440
+
441
+
442
+ ## 0.4.125 — 2026-11-16
443
+
444
+ ### Fixed
445
+ - **The comment claimed a threshold the code did not use.** It said "≥80% of its trace ids
446
+ (50% would skip a half-covered stretch)", while the code compared against 0.5. The
447
+ comment now states 0.5 and explains why: reflect samples ~60% of a window (24/40), so a
448
+ fully reflected window scores ~0.6 and an 0.8 bar would never fire.
449
+ - **Coverage uses the union of all episode sources.** It was per-episode (`find`), so a
450
+ window split between two episodes (30% + 30%) was judged "not written" and rebuilt. The
451
+ union of every episode's `sourceIds` is computed once per window; the exact
452
+ `findPeriod` check still runs first.
453
+
454
+ ### Verified
455
+ - Suite: 474/474, twice; backfill tests unchanged and green.
456
+
457
+
458
+ ## 0.4.124 — 2026-11-16
459
+
460
+ ### Fixed
461
+ - **Idempotency is measured in traces, not wall-clock time.** 0.4.123 compared period
462
+ spans, but the first window starts at 1970 (a 56-year span), so a summary covering
463
+ recent traces could look <50% on the timeline and get re-written. A window now counts
464
+ as already reflected when an episode's `sourceIds` cover ≥50% of the window's trace ids
465
+ (reflect samples ~60% of a window, so a fully reflected one scores ~0.6; a 0.8 bar would
466
+ never fire). `force: true` still rewrites.
467
+ - The `maxWindows` schema description said "默认 3" while the code used 8.
468
+
469
+ ### Note
470
+ - The earlier time-overlap approach could also *over*-skip: a summary covering half the
471
+ wall-clock span but few traces would block a window whose traces were never captured.
472
+ Trace ids do not have that failure mode.
473
+
474
+ ### Verified
475
+ - Backfill tests use distinct trace texts so sampling spreads (near-identical seeds made
476
+ reflect keep a single source, which hid the effect). Suite: 474/474, twice.
477
+
478
+
479
+ ## 0.4.123 — 2026-11-16
480
+
481
+ ### Fixed
482
+ - **Backfill idempotency now accepts overlap, not just equality.** Re-walking the same
483
+ stretch with a different `windowSize` (40 → 32) produced different period boundaries and
484
+ therefore a second overlapping episode — declared coverage would inflate while the store
485
+ said "covered". A window is now skipped as `already-reflected` when an existing episode
486
+ covers ≥50% of it; `force: true` still rewrites.
487
+ - The backfill tool's `maxWindows` default is 8 (was 3), so reaching 24 windows no longer
488
+ silently needs eight calls with the default.
489
+
490
+ ### Verified
491
+ - Tests: re-running with a different window size skips the overlapping windows and adds at
492
+ most the genuinely new tail; boundary-millisecond traces still group; 473→474 suite
493
+ passes, twice.
494
+
495
+
496
+ ## 0.4.122 — 2026-11-16
497
+
498
+ ### Fixed
499
+ - **Backfill is idempotent by default.** It passed `force: true` unconditionally, so
500
+ re-running the same window wrote a second episode. Each window now consults
501
+ `summaries.findPeriod()` first and reports `already-reflected`; `force: true` is only
502
+ for "the window genuinely changed, recompute".
503
+ - **Same-millisecond boundaries are no longer dropped.** `until` used `last + 1ms`, so if
504
+ several traces shared the boundary millisecond, the rest fell forever between windows
505
+ (the next window starts at `>=` that timestamp). The window now extends to include every
506
+ trace with the boundary timestamp and ends at the *next* distinct timestamp.
507
+ - The tool's span text tolerates a trailing `{ skipped: 'not-enough-traces' }` entry
508
+ (it has no `since`/`until`) instead of printing `—`.
509
+
510
+ ### Note
511
+ - The 3.4K-char summary budget concern does not apply to this path: episode summaries are
512
+ extractive (no LLM call), so there is no `maxTokens` to exhaust here.
513
+
514
+ ### Verified
515
+ - Tests: a second identical run adds zero summaries and reports `already-reflected`;
516
+ three traces sharing the boundary millisecond all land in the same window. Suite:
517
+ 473/473, twice.
518
+
519
+
520
+ ## 0.4.121 — 2026-11-16
521
+
522
+ ### Added
523
+ - **Timeline backfill for episode summaries.** Declared coverage was 3.4% because only
524
+ five episodes existed; `reflect.backfillEpisodes()` now walks the timeline in windows of
525
+ 32–60 traces (default 40, clamped) and writes one episode per window, with `until` as an
526
+ exclusive end so one episode cannot swallow the whole history. Exposed as
527
+ `cortex_consolidate action: "backfill"` with `dryRun` defaulting to true; each window's
528
+ `sourceIds` stays within the existing 24-source budget (`maxSources` clamp 1–40 is
529
+ respected by construction).
530
+
531
+ ### Verified on the live store (read-only copy)
532
+ - `windowSize 40, maxWindows 6` → planned 6 windows, covering 1970-01-01 → 2026-11-12
533
+ (the first 240 traces). To reach the compressible subset's ~60% the plan needs roughly
534
+ 20–24 windows, matching the reviewer's estimate.
535
+
536
+ ### Verified
537
+ - `reflect-backfill.test.js`: preview writes nothing; a real run writes episodes with
538
+ ≤24 sources and distinct periods; `windowSize < 32` is clamped to 32. Suite: 471/471,
539
+ twice.
540
+
541
+
542
+ ## 0.4.120 — 2026-11-16
543
+
544
+ ### Fixed
545
+ - **`bin/verify.mjs` labels the installed version, not the source tree.** It used to read
546
+ `../package.json` (the checkout), so the 0.4.118 snapshot recorded `0.4.119` once the
547
+ source was bumped — the baseline label for a whole version was wrong. It now reads
548
+ `<profile>/node_modules/dsh-cortex/package.json`, reports `versionSource:
549
+ installed|source` plus `sourceVersion`, and `--installed` exits 1 when nothing is
550
+ installed. Verified against the live profile: `version 0.4.119 / versionSource
551
+ installed` while the checkout is at 0.4.120.
552
+
553
+ ### Verified
554
+ - Unit suite unchanged: 468/468, twice. `verify.mjs --installed` fails closed, plain
555
+ `verify.mjs` still succeeds.
556
+
557
+
558
+ ## 0.4.119 — 2026-11-16
559
+
560
+ ### Fixed (review of 0.4.118 — do not install 118)
561
+ - **The fact channel was silently dead.** It built fact text from `fact.subject`, which facts
562
+ do not expose; the text was an English predicate plus a literal, so Chinese traces never
563
+ matched (factCovered = 6). It now resolves subject/object names through the entities repo,
564
+ appends `objectLiteral` and `evidence`, and reuses the precompiled token sets (the unused
565
+ `factScoreFor` duplicate is deleted).
566
+ - **Preview no longer hands out single-evidence candidates.** `wouldCut` is `strongPool`
567
+ only; when a pool exists but has no row with two evidence kinds the reason is
568
+ `single-evidence-only`.
569
+ - The preview threshold is a parameter (`coverageThreshold`, clamped 0.2–0.9) instead of a
570
+ hardcoded 0.35, and is echoed back in the report.
571
+
572
+ ### Verified on the live store (read-only copy)
573
+ - active 945 · summaryCovered 423 · **factCovered 67** · both 52 · pool 67 · strongPool 52
574
+ - r p50 0.022 / p90 0.537, spread 0.515 · **`usable: true`**
575
+ - First time the gate opened: fixing the fact fields lifted fact coverage from 6 to 67 rows.
576
+ Execution is still preview-only; 0.4.120 will target summary windows (episode count), not
577
+ a lower threshold.
578
+
579
+ ### Verified
580
+ - Suite: 468/468, twice.
581
+
582
+
583
+ ## 0.4.118 — 2026-11-16
584
+
585
+ ### Changed
586
+ - **Preview thresholds are reachable.** With `0.92 * rate` a 0.75 line needs rate 0.815, so the
587
+ pool was structurally empty; the preview now uses an absolute `0.35` line and reports a
588
+ `strongPool` that additionally requires two evidence kinds.
589
+ - **Facts are a first-class coverage channel.** Facts are grouped by `sourceEventId` and
590
+ scored against the trace text (≥2 shared content tokens, `0.5 + 0.4*rate`); the preview
591
+ reports `summaryCovered`, `factCovered` and `bothCovered` separately.
592
+ - **DF cutoff 10%, not 60%**: with 945 documents the old cutoff (567) filtered nothing; a
593
+ synthetic test now pins that generic bigrams like 「我们」 are dropped.
594
+ - Removed the dead `rate < 0.15 → ≤0.2` cap (0.92×0.15 is already below it) and the
595
+ fallback that returned the *unfiltered* set for short traces.
596
+ - `reason` is evaluated as `no_signal → empty_pool → flat`; the tool default is now 5000
597
+ (it was still 500, silently truncating).
598
+
599
+ ### Verified on the live store
600
+ - active 942 · summaryCovered 423 · factCovered 6 · both 5 · pool 6 · strongPool 5
601
+ - r p50 0.02 / p90 0.048, spread 0.028 → **`reason: flat`, `usable: false`**
602
+ - So the pool is no longer structurally empty, but the signal is still too thin: the next
603
+ move is summary **granularity** (session/day-level), not a lower threshold.
604
+
605
+ ### Verified
606
+ - Suite: 467/467, twice.
607
+
608
+
609
+ ## 0.4.117 — 2026-11-16
610
+
611
+ ### Fixed (review of 0.4.116's scorer — do not install 116)
612
+ - **The flat distribution was the formula, not the summaries.** `score = 0.45 + 0.45*rate`
613
+ turned any 2-token overlap into 47% coverage, so p50 sat at its floor and the spread
614
+ collapsed to 0.013. The score is now `0.92 * rate` with a rate-based cap only
615
+ (`rate < 0.15 → ≤0.2`); there is no additive floor and no length-based penalty that
616
+ used to pin long traces at 0.35.
617
+ - **Content tokens are filtered by document frequency.** `tokens()` keeps raw CJK
618
+ bigrams with no stopword pass, so 「我们 / 可以 / 这个」 made any two sentences look
619
+ similar. High-frequency tokens (in >60% of the batch) are dropped before scoring, with
620
+ a small character stop-set as a second guard. Sets are built once per preview run.
621
+ - **`usable` now explains itself**: `no_signal` (scored <10) / `flat` (p90−p50 <0.05) /
622
+ `empty_pool` (no row over threshold), instead of one ambiguous boolean.
623
+ - The preview scans all active traces by default (limit 5000) and reports
624
+ `scanned`, so the 500-row truncation cannot hide the store size; the protection line
625
+ is now the same `max(0.9, min(0.95, p75))` as consolidation.
626
+
627
+ ### Verified on the live store (read-only copy)
628
+ - active 940 · skipped 293 protected / 179 recent · scored 461 · 5 summaries
629
+ - r p50 **0.041** / p75 0.059 / p90 0.088, spread 0.047 · best row **0.33**
630
+ - **`reason: flat`** — with the honest scorer the current summaries really do cover very
631
+ little. The next move is summary quality, not quota archiving.
632
+
633
+ ### Verified
634
+ - Suite: 466/466, twice.
635
+
636
+
637
+ ## 0.4.116 — 2026-11-16
638
+
639
+ ### Added
640
+ - **Read-only compaction preview** (`cortex_consolidate action: "preview"`), the first
641
+ step of the quota-compaction plan. It computes a *verifiable* coverage score
642
+ (`coverage2`): a summary only counts when its own tokens overlap the trace, thin
643
+ summaries are capped at 0.35, and `sourceIds` membership alone no longer grants 1.0.
644
+ Protected traces (importance ≥ max(0.9, p75), reflection, promise) and recently
645
+ accessed ones (`last_access_at` within 30 days) are skipped, then the r distribution
646
+ (p50/p75/p90) and the would-be cut list are reported. It writes nothing.
647
+
648
+ ### Verified on the live store (read-only copy via `VACUUM INTO`)
649
+ - 939 active · skipped 293 protected / 178 recent · 461 scored · 5 summaries
650
+ - r p50 0.472 / p75 0.481 / p90 0.494; **spread 0.013 < 0.05 → `usable: false`, pool 0**
651
+ - Conclusion: the coverage signal is not usable yet. Per the design, 0.4.117 (gray-zone
652
+ judgements) must **not** start until coverage quality improves — exactly the gate the
653
+ reviewer asked for.
654
+
655
+ ### Verified
656
+ - `compaction-preview.test.js`: coverage2 scoring/caps, preview is read-only. Suite:
657
+ 466/466, twice.
658
+
659
+
660
+ ## 0.4.115 — 2026-11-16
661
+
662
+ ### Fixed
663
+ - **The threshold clamp actually clamps.** 0.4.114 computed `simThreshold` but both
664
+ comparison sites still used the raw `threshold`, so the clamp was dead code. It is now
665
+ `clampThreshold(value)` (exported and unit-tested: 0.1 → 0.5, 1.5 → 0.99, 0 / NaN →
666
+ 0.8) and both the clustering loop and the target-similarity filter use it. The tool
667
+ schema now declares `minimum: 0.5, maximum: 0.99`.
668
+ - **`cortex_health` no longer shows a dedupe preview as the last consolidation.** The
669
+ consolidation line now excludes rows with `model = 'dedupe'`, so a manual preview
670
+ cannot hide the last real LLM run.
671
+
672
+ ### Verified
673
+ - New `dedupe-threshold.test.js`; Suite: 464/464, twice.
674
+
675
+
676
+ ## 0.4.114 — 2026-11-16
677
+
678
+ ### Fixed
679
+ - **Dedupe no longer merges by transitive accident.** Union-find is transitive: A~B and
680
+ B~C could pull an A that is not similar to C into the same merge. Every member must
681
+ now also be a near-duplicate *of the chosen target* (Jaccard ≥ threshold), otherwise
682
+ it stays active and the group is counted as dropped.
683
+ - **Provenance on merge summaries.** The summary now lists the titles that were merged
684
+ away (`去重合并 2 条到 X(含:A / B)`), so an audit can tell what disappeared without
685
+ opening every archived row.
686
+
687
+ ### Fixed (review pass from the reviewer teammate)
688
+ - `protectedCount` now uses `isProtected`, so a low-importance reflection is counted as
689
+ protected (it used to slip past the all-protected check and burn an LLM call).
690
+ - **All-protected batches keep `update`/`conflict`.** The short-circuit that skipped the
691
+ model also killed the only non-destructive action; the batch is still sent, with a
692
+ prompt that forbids `archive`/`merge` and allows `update`/`conflict`.
693
+ - dedupe previews record `status: 'preview'` instead of `degraded`, so `cortex_health` no
694
+ longer shows a dry run as a failed consolidation.
695
+ - `dryRun` is normalised once (`Boolean`), threshold is clamped to 0.5–0.99, the dedupe
696
+ digest is namespaced (`dedupe:` / `run:`) so it cannot collide with the unchanged
697
+ gate, summary provenance insert is best-effort, and a non-dry dedupe on a read-only
698
+ scope is refused at the tool layer.
699
+
700
+ ### Verified
701
+ - Property test: every archived trace is still ≥ threshold similar to an active trace
702
+ after a dedupe run. Suite: 463/463, twice.
703
+
704
+
705
+
706
+
707
+
708
+ ## 0.4.113 — 2026-11-16
709
+
710
+ ### Changed
711
+ - **Dedupe may merge traces that sit on the protection line.** The live store has 75% of
712
+ active traces at importance ≥ 0.95, so "two protected members" is the normal case and
713
+ the old rule dropped every group — dedupe could not merge a single pair. Since dedupe
714
+ has already proved the members are near-duplicates (Jaccard ≥ threshold) and
715
+ reflections are excluded from the pool entirely, keeping N copies buys nothing:
716
+ `validateDecision` gains `allowProtectedMerge`, used only by dedupe. The LLM path
717
+ keeps the strict rule (a protected trace may never be a merge source).
718
+
719
+ ### Verified
720
+ - Tests: a protected pair is now merged; a reflection never takes part in dedupe and
721
+ survives untouched; an LLM merge proposal over protected traces is still rejected.
722
+ Suite: 462/462, twice.
723
+
724
+
725
+ ## 0.4.112 — 2026-11-16
726
+
727
+ ### Fixed
728
+ - **All-protected batches no longer waste a call or look alarming.** On 2026-11-16 the
729
+ automatic trigger hit a batch whose 30 candidates were all ≥ 0.93, so every proposal
730
+ was rejected and the run read `rejected 20`. When every candidate is on the
731
+ protection line the run now records `skipped / all-protected` without calling the
732
+ model at all.
733
+ - **Rejection counts carry their reasons**: the error label is now
734
+ `rejected 3(protected×2 · unknown-id×1)` instead of a bare number.
735
+ - **One protection predicate.** `validateDecision`'s archive branch checked
736
+ `importance >= protect || kind === 'reflection'`, but the merge branch only checked
737
+ importance — so a low-importance reflection could be merged away as a merge *source*.
738
+ Both branches, the duplicate-group builder and the deterministic dedupe now use the
739
+ same `isProtected(trace, protect)` helper; reflections may only ever be the target.
740
+
741
+ ### Added
742
+ - **Deterministic dedupe.** The LLM kept answering `keep` even when handed duplicate
743
+ groups, so the mechanical half of consolidation no longer asks it: `consolidation.dedupe()`
744
+ clusters active traces by 2-gram Jaccard (threshold 0.8 by default), picks the
745
+ best-preserved member as the merge target, refuses any group with two protected
746
+ members, and archives the rest with `compression: merged` plus a `dedupe` merge
747
+ summary. Exposed as `cortex_consolidate action: "dedupe"` with `dryRun` defaulting
748
+ to true.
749
+ - `record()` now returns `groups` / `groupsDropped` on the run object, so callers (and
750
+ the tool output) can read them without a second SQL query.
751
+
752
+ ### Verified
753
+ - Tests: dry run reports one group without touching the store; a real run archives one
754
+ trace and leaves a merge summary; two protected members are never merged. Suite:
755
+ 457/457, twice.
756
+
757
+
758
+ ## 0.4.111 — 2026-11-16
759
+
760
+ ### Fixed
761
+ - **The protected member is now a structural merge target.** 0.4.110 dropped groups
762
+ with two protected members but only *asked* the model to keep the protected one as
763
+ `targetId`; if it picked another member the whole decision was rejected as
764
+ `protected-merge`. Groups are now offered as `{ ids, mustBeTarget }` and the prompt
765
+ says the target must be the `mustBeTarget` id.
766
+ - **Dropped groups are counted.** The audit row now carries `groupsDropped` next to
767
+ `groups`, so `groups: 0` no longer hides "there were duplicates but the protection
768
+ line removed them".
769
+
770
+ ### Verified
771
+ - Tests: two-protected group → `groups: 0`, `groupsDropped: 1` and no group in the
772
+ prompt; one-protected group → `groups: 1` and `mustBeTarget` present. Suite:
773
+ 454/454, twice.
774
+
775
+
776
+ ## 0.4.110 — 2026-11-16
777
+
778
+ ### Fixed
779
+ - **Duplicate groups are filtered by the protection line before they reach the
780
+ model.** `validateDecision` rejects a `merge` whose non-target member is protected,
781
+ so a group with two protected traces could only produce a decision that fails —
782
+ and the rejection read like "there were duplicates but it kept them". Groups with
783
+ two or more protected members are dropped; a group with exactly one keeps that one
784
+ as the target and the rest as sources.
785
+
786
+ ### Added
787
+ - Every consolidation audit row now records `groups`, the number of duplicate groups
788
+ actually offered. Without it there was no way to tell "no duplicates" apart from
789
+ "duplicates that were dropped".
790
+
791
+ ### Verified
792
+ - Tests: a two-protected group is withheld (`groups: 0`); a one-protected group is
793
+ offered (`groups: 1`). Suite: 454/454, twice.
794
+
795
+
796
+ ## 0.4.109 — 2026-11-16
797
+
798
+ ### Fixed
799
+ - **The per-tick path is no longer a per-minute LLM call.** `features.consolidateOnTick`
800
+ was silently `true` in `feature-overrides.json` since 11-12 (the profile yml never
801
+ mentioned it), so the scheduler ran a full consolidation every tick — 1921 `no-llm`
802
+ rows are that history, not a broken adapter. The tick path now honours
803
+ `consolidateTraceGapMinutes` (default 30) and reports `too-soon` instead.
804
+ - `lastRealConsolidationAt` joins `dream_runs` so the audit lookup is scoped; with
805
+ several scopes it no longer reads another scope's run.
806
+
807
+ ### Added
808
+ - **Duplicate groups are handed to the model.** Capture already rejects
809
+ byte-identical traces, so exact matching finds nothing; candidates are clustered by
810
+ 2-gram Jaccard ≥ 0.6 and the groups are listed in the prompt with an instruction to
811
+ `merge` the best-preserved one. Without this the model kept answering `keep` even
812
+ when nothing was protected.
813
+
814
+ ### Verified
815
+ - Tests: tick gate skips within the gap and runs after it; paraphrased duplicates
816
+ reach the prompt as a merge group. Suite: 452/452, twice.
817
+
818
+
819
+ ## 0.4.108 — 2026-11-16
820
+
821
+ ### Changed
822
+ - **The protection line is now relative.** Live data had 99% of active traces at
823
+ `importance >= 0.7`, while the prompt and validator both protected everything at
824
+ `>= 0.7` — so consolidation could only ever answer `keep`. The line is now
825
+ `max(0.9, min(0.95, p75))` of the current batch: the top slice stays protected
826
+ (reflections always), everything below it may be merged or archived, and the
827
+ prompt states the actual line and how many items it protects. Same lesson as the
828
+ cold tier: absolute thresholds vs. an absolute-heavy distribution.
829
+
830
+ ### Fixed
831
+ - **`consolidateOnTick` can no longer starve the delta trigger.** The tick path has
832
+ no interval gate, so it would write a run every minute and make
833
+ `runAutoConsolidate` permanently `too-soon`. The delta trigger now measures the
834
+ gap from the last *non-tick* `consolidation.run` audit row, falling back to
835
+ `dream_runs` when no audit exists.
836
+ - `tool` and `api` call sites now pass `caller`, so every consolidation run names
837
+ its actor.
838
+
839
+ ### Verified
840
+ - New tests: quantile line protects the top and archives the bottom; the prompt no
841
+ longer hardcodes 0.7; tick-written runs do not starve the trigger; audit-less
842
+ stores fall back to the table. Suite: 449/449, twice.
843
+
844
+
845
+ ## 0.4.107 — 2026-11-16
846
+
847
+ ### Changed
848
+ - **Consolidation budget raised again, with evidence.** After 0.4.106 shipped, the
849
+ automatic trigger produced two real runs within a minute and both were still
850
+ `empty-text:max-tokens` at 2400 — the answer keeps being cut off by the cap, not
851
+ rejected. Budgets are now 6000 for the bounded and retry attempts, 3000 for the
852
+ plain attempt (a cap is a ceiling, not spend).
853
+
854
+ ### Added
855
+ - **Consolidation records who called it.** `dream_runs` has no caller column, so
856
+ each run now writes `audit(consolidation.run, { caller })`; callers pass
857
+ `auto-trace-delta` / `tick` / `sleep` / `tool`. Two runs a minute apart used to be
858
+ unexplainable from the data alone.
859
+
860
+ ### Fixed
861
+ - `health`'s `LLM_EMPTY` buckets no longer render `llm-empty:empty-text:max-tokens`
862
+ and `llm-empty-retry:empty-text:max-tokens` as two identical entries; the retry
863
+ bucket reads `…(重试)`.
864
+
865
+ ### Verified
866
+ - New tests: caller lands in the audit row; retry bucket is distinguishable.
867
+ Suite: 445/445, twice.
868
+
869
+
870
+ ## 0.4.106 — 2026-11-16
871
+
872
+ ### Added
873
+ - **Consolidation gets its own trigger.** Until now it only ran inside sleep, which
874
+ is gated to once per 20 h — so every version's acceptance test waited a day.
875
+ With `features.consolidateOnTraceDelta` on, each scheduler tick checks whether
876
+ at least `consolidateTraceDelta` (default 20) new active traces appeared since
877
+ the last consolidation and at least `consolidateTraceGapMinutes` (default 30)
878
+ passed; if so it runs a real consolidation and records
879
+ `report.steps.autoConsolidate` (`fresh / status / model / decisions / applied`,
880
+ or a skip reason `too-soon` / `not-enough-new-traces`).
881
+
882
+ ### Fixed
883
+ - **Per-call failure reasons.** The adapter now accepts `onReason`, so a failure is
884
+ reported to the caller that caused it; an interleaved dream/feeling call can no
885
+ longer reset or overwrite another call's reason. `ask()`'s outer catch records
886
+ `exception-outer` instead of swallowing silently.
887
+ - `health`'s consolidation line now shows `决策 N(keep M)· 应用 K`, so an
888
+ `applied` run where every decision was `keep` reads as the no-op it is.
889
+
890
+ ### Verified
891
+ - `scheduler-autoconsolidate.test.js`: runs when fresh ≥ threshold and gap passed;
892
+ skips with a reason otherwise; off by default. `consolidate-reason.test.js`
893
+ covers `exception-outer` and reason scoping across calls. Suite: 443/443, twice.
894
+
895
+
896
+ ## 0.4.105 — 2026-11-16
897
+
898
+ ### Fixed
899
+ - **The output budget was cutting the answer off.** The installed 0.4.103 recorded
900
+ `llm-empty:empty-text:max-tokens` — the model's reply was truncated at the token
901
+ cap, not rejected, so the text came back empty. Consolidation budgets are raised:
902
+ bounded attempt 2400 (was 1400), plain attempt 1600 (was 900), retry 2400
903
+ (was 1600). With reasoning tokens sharing the same budget, 900 was simply too
904
+ small.
905
+
906
+ ### Verified
907
+ - `consolidate-retry.test.js` asserts the bounded attempt now requests ≥2000 tokens.
908
+ Suite: 437/437, twice.
909
+
910
+
911
+ ## 0.4.104 — 2026-11-16
912
+
913
+ ### Changed
914
+ - **Big payloads now start bounded instead of failing first.** Live evidence from the
915
+ installed 0.4.102: a ~10k-char payload produced an empty answer, while the slim
916
+ retry (10 × 220 chars) returned a valid array with 10 `keep` decisions and was
917
+ recorded as `llm-retry`. So candidates over 5000 chars now begin with a bounded
918
+ attempt (20 items × 300 chars, `maxTokens` 1400) and are recorded as
919
+ `llm-bounded`; if that still comes back empty, the 10 × 220 retry runs and is
920
+ marked `llm-retry`. Small payloads keep the original single call.
921
+
922
+ ### Verified
923
+ - `consolidate-retry.test.js`: 40 long traces → one bounded call, model `-bounded`;
924
+ retry path and reason labels unchanged. Suite: 437/437, twice.
925
+
926
+
927
+ ## 0.4.103 — 2026-11-16
928
+
929
+ ### Added
930
+ - **`cortex_health` reports consolidation and sleep.** `dream_runs.error` is the
931
+ only place that says *why* consolidation did nothing; leaving it in a table
932
+ meant remembering to look. `health` now exposes
933
+ `consolidation { dream, sleep }` and the text adds one line, e.g.
934
+ `巩固 2026-11-16T09:34 空转(llm-empty:empty-text:length) · 睡眠 …(skipped,反思 1)`.
935
+
936
+ ### Verified
937
+ - `health-consolidation.test.js`: a run without an adapter shows `空转(no-llm-adapter)`
938
+ and `睡眠 还没有记录`. Suite: 436/436, twice.
939
+
940
+
941
+ ## 0.4.102 — 2026-11-16
942
+
943
+ ### Fixed
944
+ - **Empty answers now say why.** The adapter keeps the failure reason
945
+ (`no-selection`, `finish-error`, `exception`, `empty-text:<finish kind>`) and
946
+ consolidation records `llm-empty:<reason>`. When the slim retry already ran and
947
+ still came back empty the label is `llm-empty-retry:<reason>`, so "retried and
948
+ still empty" is no longer indistinguishable from "empty on the first try".
949
+ (Both P2s from 豆包's 0.4.101 review.)
950
+ - `health` matches the `llm-empty%` family and reports the reason buckets, so one
951
+ glance shows whether the fix is about prompt size, purpose, or wiring.
952
+
953
+ ### Verified
954
+ - `consolidate-reason.test.js`: reason carried through; retry-exhausted label;
955
+ health buckets by reason. Suite: 435/435, twice.
956
+
957
+
958
+ ## 0.4.101 — 2026-11-16
959
+
960
+ ### Changed
961
+ - **Consolidation retries once with a slimmer prompt.** The live store's payload
962
+ averages ~5k characters; when the first call comes back empty and the payload
963
+ exceeds 4000 chars, it retries with the top 10 items and 220-char contents. A
964
+ successful retry is recorded as `llm-retry` in the model column, so the extra
965
+ path is visible instead of indistinguishable from a plain success. Short
966
+ payloads do not retry (a retry would only repeat the same empty answer).
967
+
968
+ ### Verified
969
+ - `consolidate-retry.test.js`: 16 long traces → two calls, second prompt shorter,
970
+ status `applied` with a `-retry` model; 3 short traces → one call, `llm-empty`.
971
+ Suite: 432/432, twice.
972
+
973
+
974
+ ## 0.4.100 — 2026-11-16
975
+
976
+ ### Fixed
977
+ - **`labelEntities` still returned the old `no-llm` skip label.** It now returns
978
+ `no-llm-adapter`, matching `consolidation.run`, so one word no longer covers two
979
+ different failures. (P3 from 豆包's 0.4.98 review; the historical 1921 rows stay
980
+ as they are.)
981
+
982
+ ### Verified
983
+ - `label-entities-skip.test.js`: without an adapter the skip label is
984
+ `no-llm-adapter`. Suite: 430/430, twice.
985
+
986
+
987
+ ## 0.4.99 — 2026-11-16
988
+
989
+ ### Added
990
+ - **`autoSleep`: the scheduler can now start a sleep pass.** Nothing used to call
991
+ `life.sleep()` on a schedule, so `consolidateOnSleep` never had a chance to run
992
+ (`sleep-runs` had been stuck at 11-12). When `features.autoSleep` is on and the
993
+ host is idle, the scheduler sleeps if no sleep exists or the last one is ≥20h
994
+ old; the profile patch enables it.
995
+
996
+ ### Changed
997
+ - `features.autoSleep` added to the config schema and the override keys, so it can
998
+ be toggled from `feature-overrides.json` without a rebuild.
999
+
1000
+ ### Verified
1001
+ - `scheduler-autosleep.test.js` (4 cases): never slept → sleeps; 3h ago → does not;
1002
+ 21h ago → sleeps; flag off → never calls. Suite: 429/429, twice.
1003
+
1004
+
1005
+ ## 0.4.98 — 2026-11-16
1006
+
1007
+ ### Fixed
1008
+ - **`no-llm` was two different failures under one label.** A missing adapter and an
1009
+ adapter that answered nothing both recorded `no-llm`, so the 1914 rows gave no
1010
+ clue which one to fix. They are now `no-llm-adapter` and `llm-empty`, and
1011
+ `health` warns `LLM_EMPTY` when ≥5 empty answers pile up within 6 hours.
1012
+
1013
+ ### Found while investigating (not fixed here)
1014
+ - **Nothing calls `life.sleep()` on a schedule.** `sleep-runs` stops at 11-12
1015
+ because `sleep` only runs through the tool/API; `consolidateOnSleep` therefore
1016
+ never fires. The next version should add an `autoSleep` scheduler hook (idle +
1017
+ ≥20h since last sleep) rather than pretending the flag alone is enough.
1018
+
1019
+ ### Verified
1020
+ - `consolidate-errors.test.js`: no adapter → `no-llm-adapter`, empty answer →
1021
+ `llm-empty`, six empties → `LLM_EMPTY` warning. Suite: 425/425, twice.
1022
+
1023
+
1024
+ ## 0.4.97 — 2026-11-15
1025
+
1026
+ ### Fixed
1027
+ - **Why consolidation never ran: the LLM feature was off.** The live profile had
1028
+ `features.llm` unset, so the adapter was `null` and every consolidation tick
1029
+ recorded `no-llm` (1914 rows in `dream_runs`); the same flag gates sleep
1030
+ consolidation. The profile patch now sets `features.llm: true` and
1031
+ `consolidateOnSleep: true` (backup: `cordis.patch.yml.bak-noisefix-*`), and
1032
+ `health` raises `LLM_DISABLED` when the flag is off so this can never be silent
1033
+ again.
1034
+ - **Facts polluted by sentence fragments.** The rule extractor now filters
1035
+ single-character function words (`的了着过等儿…`) and a `NOISE_OBJECTS` list
1036
+ (`等`, `收一收`, `水里`, …). `repair --drop-noise-facts` (opt-in) archives the
1037
+ existing garbage through the backup gate: 255 candidates live, 255 invalidated on
1038
+ a copy (`828 → 650` active).
1039
+
1040
+ ### Verified
1041
+ - `fact-noise-llm.test.js`: fragment text yields zero facts, a normal sentence
1042
+ still yields `likes`, and `LLM_DISABLED` appears only when the feature is off.
1043
+ Suite: 422/422, twice.
1044
+
1045
+
1046
+ ## 0.4.96 — 2026-11-15
1047
+
1048
+ ### Fixed
1049
+ - **`SLOW_MAINTAIN` no longer becomes permanent.** A slow pass row used to linger
1050
+ until the next *changed* pass overwrote it, which read as "currently stalling"
1051
+ forever. Only passes within `maintainSlowWindowHours` (default 6) count now, and
1052
+ the message carries `距现在 N 分钟` so the age is visible.
1053
+ - **Timestamp comparison uses `Date.parse`, not string order.** An injected
1054
+ `2026-11-15 14:36:00` sorted before `2026-11-15T14:36:00Z` purely because of the
1055
+ space, so the same instant looked older; unparsable values now fall back to the
1056
+ in-memory pass.
1057
+ - **The summon book could drop its own left card.** When the slots were full the
1058
+ left (emotional) card was pushed and then sliced off — the block looked frozen.
1059
+ It now displaces a chosen card whose removal keeps day diversity (its day is
1060
+ duplicated, or equals the left card's day); the displaced card is reported via
1061
+ `onDrop` → `summon.drop` metric. If no such card exists the left card is skipped
1062
+ rather than sacrificing the day spread.
1063
+
1064
+ ### Verified
1065
+ - `maintain-duration.test.js` (10 cases): an 8h-old slow pass raises nothing; a
1066
+ space-formatted timestamp equal to the in-memory one is treated as the same pass.
1067
+ - `summon-left-slot.test.js`: full slots → left card present, displaced card
1068
+ reported and absent from the result; free slot → no drop.
1069
+ Suite: 418/418, twice.
1070
+
1071
+
1072
+ ## 0.4.95 — 2026-11-15
1073
+
1074
+ ### Changed
1075
+ - **A slow pass now leaves durable evidence.** Quiet passes write no audit row, so
1076
+ a stall that happened between two heartbeats had nothing to read later. A pass
1077
+ slower than `maintainSlowMs` (default 2000) now writes its `maintain.run` row even
1078
+ when it changed nothing; changed passes behave exactly as before.
1079
+
1080
+ ### Why
1081
+ - The live store still holds only the 08:24:56Z row (9 keys, no `ms`): no passing
1082
+ `maintain` has actually changed anything since 0.4.89, and the "过期意图 1 条" in
1083
+ the 0.4.93 install was `repair`, not `maintain`. Without this change the first
1084
+ real timing sample could stay missing for days.
1085
+
1086
+ ### Verified
1087
+ - `maintain-duration.test.js` (8 cases): with `maintainSlowMs: 0` a no-change pass
1088
+ still writes an audit row carrying `ms`. Suite: 414/414, twice.
1089
+
1090
+
1091
+ ## 0.4.94 — 2026-11-15
1092
+
1093
+ ### Fixed
1094
+ - **A slow pass was hidden by the next quiet one.** `SLOW_MAINTAIN` only judged the
1095
+ newest pass, but `maintain()` runs on the heartbeat, so a stall is followed by a
1096
+ fast pass within minutes and the warning effectively never fired — defeating the
1097
+ whole point of adding it in 0.4.86. It now evaluates the newest pass *and* the
1098
+ last pass that changed anything, warns on the slowest, and reports that pass's
1099
+ timestamp alongside its duration. (Found by 豆包 against the live store.)
1100
+
1101
+ ### Verified
1102
+ - `maintain-duration.test.js` (7 cases): a fake 8500ms audit row followed by a fast
1103
+ quiet pass still raises `SLOW_MAINTAIN` with `ms: 8500` and a timestamp.
1104
+ Suite: 413/413, twice.
1105
+
1106
+
1107
+ ## 0.4.93 — 2026-11-15
1108
+
1109
+ ### Fixed
1110
+ - **"最近一趟维护" could point at the older run.** The line was chosen by
1111
+ "does it have `ms`", so after a change pass followed by a quiet one the audit row
1112
+ won and the genuinely newest (quiet) pass never appeared; the second line then
1113
+ repeated the first one. Selection is now by recency (`recorded.passAt` vs
1114
+ `memory.at`), and the second line only prints when the audit row is strictly
1115
+ older.
1116
+ - Maintenance timestamps in `cortex_health` now include seconds (`slice(0, 19)`);
1117
+ two different passes in the same minute used to render identically.
1118
+
1119
+ ### Verified
1120
+ - `maintain-duration.test.js` (6 cases, new one included): change pass then quiet
1121
+ pass → first line is the quiet pass, `maintainLastChanged` is the change pass,
1122
+ the two are not the same source. Suite: 412/412, twice.
1123
+
1124
+
1125
+ ## 0.4.92 — 2026-11-15
1126
+
1127
+ ### Fixed
1128
+ - **The maintenance readout was invisible in the tool that matters.**
1129
+ `cortex_health`'s text formatter printed a fixed line and ignored `report.ok`,
1130
+ so the 0.4.91 two-line detail (and the duration) never reached the caller. It
1131
+ now renders `维护:最近一趟 <time>(意图 x · 工作记忆 y · Nms)` and, when the
1132
+ newest audit row belongs to a different pass, `最近一次有变更:<time>(…)`.
1133
+
1134
+ ### Verified
1135
+ - `health-text-maintain.test.js`: a 6h-old row + a quiet pass → the rendered text
1136
+ contains both the duration and the separate "最近一次有变更" line.
1137
+ Suite: 411/411, twice.
1138
+
1139
+
1140
+ ## 0.4.91 — 2026-11-15
1141
+
1142
+ ### Changed
1143
+ - **`health` says both things about maintenance.** It reports `最近一趟维护`
1144
+ (the in-memory last pass, including its duration) and, when the newest audit row
1145
+ comes from a different pass, `最近一次有变更的维护` with that row's counts. A
1146
+ quiet heartbeat writes no row, so one stale timestamp used to read as "nothing
1147
+ has run for hours".
1148
+ - `health` exposes `maintainLastChanged` (that audit row) for tooling, and
1149
+ `maintainReport()` carries `passAt` from `detail.at` so the comparison uses the
1150
+ pass's own timestamp rather than the row's write time. (Suggestion from 豆包.)
1151
+
1152
+ ### Verified
1153
+ - `maintain-duration.test.js` (5 cases): a 6-hour-old row with `working: 7` plus a
1154
+ quiet pass → both lines appear and `maintainLastChanged.working` is 7.
1155
+ Suite: 410/410, twice.
1156
+
1157
+
1158
+ ## 0.4.90 — 2026-11-15
1159
+
1160
+ ### Fixed
1161
+ - **No more mixed maintenance numbers during the upgrade window.** When the audit
1162
+ row predated `ms`, `health` kept that row's counts and borrowed the latest
1163
+ pass's duration — a combination no single run produced. `lastMaintain` is now a
1164
+ full report snapshot and `health` falls back to it wholesale (counts and duration
1165
+ from the same pass). (Review finding from 豆包.)
1166
+
1167
+ ### Note
1168
+ - The displayed "上次维护" time still comes from the audit row's write time rather
1169
+ than `detail.at`; within one tick they are equal, across ticks it is a few ms
1170
+ early. Cosmetic, left as is.
1171
+
1172
+ ### Verified
1173
+ - `maintain-duration.test.js` (4 cases): an old 9-key row with `working: 7` plus a
1174
+ fresh pass → `health.maintain.working` equals the new pass, not 7, and `ms` is
1175
+ finite. Suite: 409/409, twice.
1176
+
1177
+
1178
+ ## 0.4.89 — 2026-11-15
1179
+
1180
+ ### Fixed
1181
+ - **`SLOW_MAINTAIN` could not fire on the passes that mattered.** The audit row was
1182
+ written *before* `report.ms` was computed, so every real pass stored a detail
1183
+ without `ms`; `health` then preferred that row and fell back to memory only when
1184
+ no row existed — i.e. the warning worked on idle passes and failed exactly when
1185
+ maintenance did real work. Timing is now computed before the audit write, and
1186
+ `health` merges `ms` from the in-memory pass when the row lacks it.
1187
+ (Found by 豆包 against the live store: the single `maintain.run` row had keys
1188
+ `aliases/at/disputes/errors/goalRounds/intentions/playbook/summaries/working`
1189
+ and no `ms`.)
1190
+ - `maintainSlowMs` is config (default 2000) instead of a hardcoded threshold.
1191
+
1192
+ ### Verified
1193
+ - `maintain-duration.test.js` (3 cases): idle pass reports `ms`; a pass that
1194
+ actually changes something writes `ms` into the audit detail and health reads it;
1195
+ a 50ms row with `maintainSlowMs: 5` raises `SLOW_MAINTAIN`. Suite: 408/408, twice.
1196
+
1197
+
1198
+ ## 0.4.88 — 2026-11-15
1199
+
1200
+ ### Added
1201
+ - **`maintain()` measures itself.** The pass returns `report.ms`, keeps an
1202
+ in-memory `lastMaintain`, records a `maintain.ms` metric, and the audit detail
1203
+ now carries the duration. `health` exposes `maintain.ms` and raises
1204
+ `SLOW_MAINTAIN` above 2s — the 0.4.86 O(n²) regression would have shown up here
1205
+ instead of as a frozen host.
1206
+ - `health` falls back to the in-memory last pass when `maintain()` changed
1207
+ nothing (and therefore wrote no audit row).
1208
+
1209
+ ### Verified
1210
+ - `maintain-duration.test.js`: a no-op pass still reports `ms` and health reads
1211
+ the same number; a synthetic 8500ms audit row raises `SLOW_MAINTAIN`.
1212
+ Suite: 407/407, twice.
1213
+
1214
+
1215
+ ## 0.4.87 — 2026-11-15
1216
+
1217
+ ### Fixed
1218
+ - **The dedupe pass was O(n²) inside a synchronous `maintain()`.** 0.4.86 compared
1219
+ every pair to build the unique list: 148 traces → 10,878 jaccard calls ≈ 908ms,
1220
+ and the 500-trace cap would be ≈10s, freezing the host. The near-duplicate
1221
+ filter now runs only over the head of the ranked list (3× the budget); the tail
1222
+ is sampled by position, where duplicates are rare. Cost is (3×budget)²
1223
+ comparisons regardless of window size.
1224
+ - **Tail sampling was unreachable.** `rest[0] + k·floor(rest/remaining)` only
1225
+ reached ~83% of the list. Picks are now bucket-centred:
1226
+ `floor((slot + 0.5) * rest.length / remaining)`.
1227
+
1228
+ ### Verified
1229
+ - `reflect-sampling.test.js`: cold topics take most of the remaining slots
1230
+ (10 hot + 50 cold → 9 hot + 6 cold); the last-quarter traces (23–29) are
1231
+ reached; 500 candidates finish under 3s with ≤24 sources. Suite: 405/405, twice.
1232
+
1233
+ ### Note
1234
+ - Coverage dropping ~0.005 versus pure top-k is the intended cost of stratifying;
1235
+ it is not a regression and not a red line.
1236
+
1237
+
1238
+ ## 0.4.86 — 2026-11-15
1239
+
1240
+ ### Changed
1241
+ - **Sampling is stratified instead of pure top-k.** 60% of the source budget is
1242
+ filled by score, then the remaining slots are taken from the rest of the ranked
1243
+ list with a stride, so one loud strand of the day cannot occupy every slot.
1244
+ (Suggested by 豆包 after measuring the live store: max pairwise jaccard is 0.37,
1245
+ so the near-duplicate filter is a no-op there and the only real levers left are
1246
+ the caps and the sampling strategy.)
1247
+ - The composed `一句话` line now uses the first two **distinct** bullets (two
1248
+ traces can share a title, and `X;X` is not a summary).
1249
+
1250
+ ### Note
1251
+ - A first attempt keyed samples by a `topicSignature()` of the rarest tokens; it
1252
+ failed because synthetic `alpha1/alpha2` texts produced different signatures, so
1253
+ the cap did nothing. Replaced with the position-based stride, which does not
1254
+ depend on topic detection at all; `topicSignature` was removed rather than left
1255
+ as dead code.
1256
+
1257
+ ### Verified
1258
+ - `reflect-sampling.test.js`: 30 hot + 30 cold traces → the summary contains both
1259
+ (hot majority, cold non-empty). Suite: 403/403, twice.
1260
+
1261
+
1262
+ ## 0.4.85 — 2026-11-15
1263
+
1264
+ ### Fixed
1265
+ - **The `一句话` line was dead code.** `gistOf()` returns one of the bullets
1266
+ verbatim, so `!bullets.includes(gist)` could never be true: the line never
1267
+ rendered and the O(n²) similarity pass was wasted. It is now composed from the
1268
+ two most central bullets (joined with `;`, truncated to 90 chars) and omitted
1269
+ when there are fewer than three bullets; `gistOf()` is gone.
1270
+ - **The phrasing test now defends the real defect.** It asserted only that `· `
1271
+ lines were unique, which the `一句话:X` + `· X` shape passes. It now asserts
1272
+ each bullet appears exactly once in the content and that any `一句话` line
1273
+ differs from every bullet, plus a case with ≥3 distinct bullets that actually
1274
+ exercises the composed line.
1275
+ - Reflect config numbers are validated (`Number.isFinite` fallback): a typo used
1276
+ to become `NaN`, silently turning the dense-day follow-up off.
1277
+
1278
+ ### Verified
1279
+ - Suite: 402/402, twice.
1280
+
1281
+
1282
+ ## 0.4.84 — 2026-11-15
1283
+
1284
+ ### Changed
1285
+ - **Segments sample more of their window.** The source budget is now
1286
+ `sourceBudgetFor(n, { segment })`: 25% of the window capped at 24 for a segment,
1287
+ 12% capped at 16 for a whole-day window (floor 8 in both). Segments are short by
1288
+ construction, so the old flat 12% summarized a 40-trace segment from 8 rows and
1289
+ left coverage near 20% no matter how the phrasing improved.
1290
+ - The budget moved into an exported pure function, so it is unit-tested directly
1291
+ instead of being buried in the selection loop. It is a ceiling, not a quota: the
1292
+ near-duplicate filter (jaccard > 0.7) can still select fewer.
1293
+
1294
+ ### Verified
1295
+ - `reflect-source-budget.test.js`: 10/40/100/200/500 → whole-day 8/8/12/16/16,
1296
+ segment 8/10/24/24/24; explicit `maxSources` overrides both.
1297
+ Suite: 401/401, twice.
1298
+
1299
+
1300
+ ## 0.4.83 — 2026-11-15
1301
+
1302
+ ### Changed
1303
+ - **Episode summaries speak in the first person.** `这段时间里,记住了:` +
1304
+ `- bullet` became `这一段里,我记下了:` + `· bullet`, and the `一句话:` gist
1305
+ line is dropped when it duplicates a bullet verbatim. This is phrasing only:
1306
+ the coverage maths is untouched, and a test recomputes the stored coverage from
1307
+ the stored source ids to prove it.
1308
+ - The dense-day follow-up thresholds moved into config:
1309
+ `reflectFollowUpMin` (default 150) and `reflectFollowUpGapHours` (default 6).
1310
+ (Review finding from 豆包.)
1311
+
1312
+ ### Verified
1313
+ - `reflect-phrasing.test.js`: first-person heading, `·` bullets with no
1314
+ duplicates, and `coverage == importance-weighted formula`. Suite: 399/399,
1315
+ twice.
1316
+
1317
+
1318
+ ## 0.4.82 — 2026-11-15
1319
+
1320
+ ### Changed
1321
+ - **Episodes are segmented, not overlapping.** The auto-reflection window now
1322
+ starts at `max(now − 24h, previous episode's periodEnd + 1ms)`, so two
1323
+ consecutive episodes cover different stretches of time. Segment summaries are
1324
+ marked `extractive-v2-segment` (still `-v2`, so coverage-rewrite skips them).
1325
+ A dense day may get a second episode, but only as a separate segment: ≥150 new
1326
+ traces since the last episode **and** ≥6h since it was written; otherwise the
1327
+ pass reports `skipped: 'covered'`.
1328
+ - `reflect({ since, segment })`: explicit window start, default behaviour
1329
+ unchanged.
1330
+ - Extracted `isPerm()` in the tier code — the 0.8 threshold was duplicated three
1331
+ times (review finding from 豆包).
1332
+
1333
+ ### Verified
1334
+ - `auto-reflect.test.js`: 60 traces → episode 1; +7h with 160 new traces →
1335
+ second episode whose `periodStart` is **after** the first `periodEnd`, marked
1336
+ `extractive-v2-segment`; with only 60 new traces it stays `covered`.
1337
+ Suite: 398/398, twice.
1338
+
1339
+
1340
+ ## 0.4.81 — 2026-11-15
1341
+
1342
+ ### Fixed
1343
+ - **A perm-heavy recall no longer empties the hot tier.** The cold cut counted
1344
+ *all* candidates, so 8 candidates with 6 of them at importance ≥ 0.8 produced 2
1345
+ cold rows and 0 hot ones. The cut now ranks inside the non-perm pool only
1346
+ (`relativeTotal = candidates − permCount`), and still requires ≥ 4 non-perm
1347
+ candidates before splitting. (Review finding from 豆包.)
1348
+
1349
+ ### Verified
1350
+ - `tiers-gist.test.js`: 6 perm + 2 mid → 0 cold, 2 hot; 2 perm + 6 mid → 2 cold,
1351
+ 4 hot. Suite: 396/396, twice.
1352
+
1353
+
1354
+ ## 0.4.80 — 2026-11-15
1355
+
1356
+ ### Changed
1357
+ - **Auto-reflection cadence follows the material, not the clock.** The fixed 6
1358
+ hour gate is gone (it was redundant with the 24h `covered` check — a summary
1359
+ written 5h ago already means the window is covered), and the minimum material
1360
+ is now 50 non-reflection traces (config `reflectMinMaterial`). A quiet day no
1361
+ longer gets an episode for showing up; a busy day is no longer delayed 6 hours
1362
+ before it can be summarized. `skipped: 'few-traces'` reports both `count` and
1363
+ `minMaterial` so the reason is visible.
1364
+
1365
+ ### Verified
1366
+ - `auto-reflect.test.js`: 60 traces → one episode then `covered`; 40 traces →
1367
+ `few-traces` with `minMaterial: 50`; 60 traces spread across 24h → still
1368
+ `covered` 7h later; next day writes a second; 3 traces → nothing.
1369
+ Suite: 394/394, twice.
1370
+
1371
+
1372
+ ## 0.4.79 — 2026-11-15
1373
+
1374
+ ### Fixed
1375
+ - **Cold-tier count was cut short by rounding.** `ceil(total * 0.75)` rounded the
1376
+ *cut* up, so common recall sizes under-filled the tier: 5 candidates → 1 cold
1377
+ (20%), 7 → 1 (14%), 10 → 2 (20%). It now counts first —
1378
+ `max(1, ceil(total * 0.25))` — and slides the cut: 4→1, 5→2, 6→2, 7→2, 8→2,
1379
+ 10→3, 20→5.
1380
+ - **Stable tier assignment.** Equal `utility` now breaks ties by importance and
1381
+ then id, so the same candidate set cannot shuffle between cold and hot on
1382
+ consecutive turns.
1383
+
1384
+ ### Verified
1385
+ - `tiers-gist.test.js`: the 4/5/6/7/8/10/20 → 1/2/2/2/2/3/5 table, plus a
1386
+ reversed-input determinism test. Suite: 394/394, twice.
1387
+
1388
+
1389
+ ## 0.4.78 — 2026-11-15
1390
+
1391
+ ### Fixed
1392
+ - **The cold tier was unreachable on real data.** It required importance < 0.4,
1393
+ but every live trace sits in 0.6–1.0 (measured: 0.6×5, 0.7×307, 0.8×184,
1394
+ 0.9×76, 1.0×211), so the tier was decorative. `tierOf` now also sends the
1395
+ lowest quarter of the current turn's candidates to `cold` (relative cut, at
1396
+ least 4 candidates), while keeping the absolute cutoff for genuinely small
1397
+ importance values. Fewer than 4 candidates means no relative split, so a tiny
1398
+ recall never gets pushed into index-only. (Reported by 豆包.)
1399
+
1400
+ ### Verified
1401
+ - `tiers-gist.test.js` adds: 8 candidates all at 0.6 → the last 2 land in cold
1402
+ with `字面命中` and 6 stay hot; 3 candidates → 0 cold. Suite: 392/392, twice.
1403
+
1404
+
1405
+ ## 0.4.77 — 2026-11-15
1406
+
1407
+ ### Added
1408
+ - **Health reports the narrative layer.** `health` now exposes
1409
+ `summaryLayers { episode, merge, thread, lastEpisodeAt }`, the `cortex_health`
1410
+ text shows `摘要:每日 N 条(最近 …)· 合并记录 M · 线 K`, and a store with
1411
+ ≥100 active traces but zero episode summaries gets a `NO_EPISODE_SUMMARIES`
1412
+ warning — a thin narrative layer is now visible instead of silent.
1413
+
1414
+ ### Verified
1415
+ - `test/unit/health-summaries.test.js`: empty store reports 0, after inserting an
1416
+ episode + merge row it reports 1/1 with a timestamp. Suite: 390/390, twice.
1417
+
1418
+
1419
+ ## 0.4.76 — 2026-11-15
1420
+
1421
+ ### Changed
1422
+ - **Low-importance memories are index-only even when they were relevant hits.**
1423
+ `tierOf` used to promote any fts/vector/graph hit to `hot`, so the cold tier
1424
+ could never actually show its reason line (`语义相近` / `字面命中` /
1425
+ `共享实体` were unreachable branches). Now anything below 0.4 importance goes
1426
+ to `cold`, where the reason tells the reader whether fetching is worth it and
1427
+ the 120-char gist does not eat hot budget. Mid-importance hits stay hot.
1428
+ (Review finding from 豆包.)
1429
+
1430
+ ### Verified
1431
+ - `tiers-gist.test.js` adds: importance 0.2 + vector → cold with `语义相近` and
1432
+ nothing in hot; importance 0.55 + vector → hot. Suite: 389/389, twice.
1433
+
1434
+
1435
+ ## 0.4.75 — 2026-11-15
1436
+
1437
+ ### Changed
1438
+ - **Cold-tier lines say why a memory might be worth fetching.** `[cold] id ·
1439
+ title(正文按需取回)` was a table of contents; it now reads
1440
+ `(语义相近 / 字面命中 / 共享实体 / 命中 <source>,正文按需 cortex_get)`,
1441
+ derived from the match source. A timestamp ("last read 3 days ago") gives no
1442
+ basis for deciding, the reason does.
1443
+
1444
+ ### Fixed
1445
+ - An empty gist (body identical to its title) no longer renders a dangling
1446
+ `- [L2] 标题:`.
1447
+ - `CHANGELOG.md` for 0.4.74 was written after packing, so it is missing from the
1448
+ 0.4.74 tarball; this entry and the 0.4.74 one are both present from here on
1449
+ (changelog is written before `pnpm pack`).
1450
+
1451
+ ### Verified
1452
+ - `tiers-gist.test.js` (6 cases: gist truncation, short snippet passthrough,
1453
+ title de-duplication, exact-equal body, cold reason, cold index-only).
1454
+ Suite: 387/387, twice.
1455
+
1456
+
1457
+ ## 0.4.74 — 2026-11-15
1458
+
1459
+ ### Fixed
1460
+ - **Recall lines no longer repeat the title.** Titles are usually the first line
1461
+ of the body, so `- 标题:要点` printed the same words twice
1462
+ (`2026-11-15 17:35:0.4.60 打包…:2026-11-15 17:35:0.4.60 打包…`). The gist now
1463
+ strips a leading title before choosing its sentence, and any remaining long
1464
+ shared prefix is removed at render time.
1465
+
1466
+ ### Verified
1467
+ - `tiers-gist.test.js`: a snippet that opens with its own title renders the title
1468
+ once and keeps the following sentence. Suite: 385/385, twice.
1469
+
1470
+
1471
+ ## 0.4.73 — 2026-11-15
1472
+
1473
+ ### Fixed
1474
+ - **`repair` keeps stdout machine-readable.** The readable report added in 0.4.71
1475
+ went to stdout, so any consumer doing `node repair.mjs | ConvertFrom-Json`
1476
+ broke (`handoff/rehearsal.ps1` did exactly that and the whole drill went red).
1477
+ The human block now goes to stderr; stdout is exactly one JSON document.
1478
+ - `rehearsal.ps1`: captures node stdout only (`2>$null`), tolerates native
1479
+ stderr (`ErrorActionPreference = Continue`), and trims `verify` output to its
1480
+ JSON object before parsing.
1481
+ - `ready.ps1` gains `-SkipRehearsalCheck`; `rehearsal.ps1` passes it. Without
1482
+ this a single failed drill poisoned the readiness gate that the drill itself
1483
+ runs first — a deadlock.
1484
+
1485
+ ### Verified
1486
+ - `node repair.mjs --dry-run | ConvertFrom-Json` parses; `rehearsal.ps1` now ends
1487
+ `REHEARSAL OK` 5/5 on the live copy (active 773, goalRounds 0, legacy gone).
1488
+
1489
+
1490
+ ## 0.4.72 — 2026-11-15
1491
+
1492
+ ### Added
1493
+ - **`repair --dedupe-episodes` (opt-in).** Merges episode summaries whose periods
1494
+ overlap by ≥90% *and* whose content is ≥0.8 jaccard: keeps the newest, deletes
1495
+ the rest, and records a `level='merge'` summary with the union of source ids so
1496
+ provenance survives. Dry runs report the clusters. Conservative on purpose.
1497
+ - The human-readable report now prints the dedupe line.
1498
+
1499
+ ### Measured on the live store
1500
+ - Pairwise episode similarity is 0.388 / 0.594 / 0.708 with overlap 0.553 / 0.627
1501
+ / 0.927 — the three old summaries share their **opening sentence** but not
1502
+ their bodies, so nothing is a true duplicate: `clusters: 0`. They stay; only
1503
+ future duplicates are prevented (0.4.67).
1504
+
1505
+ ### Verified
1506
+ - `dedupe-episodes.test.js`: same window + identical content → one cluster keeping
1507
+ the newer row, source ids unioned; a different window is untouched. Suite:
1508
+ 384/384, twice.
1509
+
1510
+
1511
+ ## 0.4.71 — 2026-11-15
1512
+
1513
+ ### Added
1514
+ - **`repair` prints a human-readable report after the JSON.** The JSON stays
1515
+ stable for scripts; the trailing block answers "what actually changed" for a
1516
+ person: goal-round/injected archives, title backfill, duplicate summaries,
1517
+ intentions, playbook, disputes, alias merges, the coverage-rewrite sample
1518
+ (`id: from → to (covered/window)`) and the backup path.
1519
+
1520
+ ### Verified
1521
+ - Dry run against a live-store copy prints the block with the right numbers.
1522
+ Suite: 383/383, twice.
1523
+
1524
+
1525
+ ## 0.4.70 — 2026-11-15
1526
+
1527
+ ### Added
1528
+ - **`repair --rewrite-coverage` (opt-in).** Brings pre-v2 episode summaries onto
1529
+ the importance-weighted coverage definition: for each v1 episode it recomputes
1530
+ `covered / total` from the summary's own `source_ids` and the traces inside its
1531
+ period, then (with `--apply`) writes the value and marks the row
1532
+ `extractive-v2-recomputed`. Dry runs report `candidates / changed / sample`
1533
+ without touching a row. Deliberately *not* part of `maintain()`: this is a data
1534
+ change and runs only through the repair backup gate. (Requested by 豆包.)
1535
+
1536
+ ### Verified
1537
+ - `coverage-rewrite.test.js`: 2 important + 2 trivial traces, v1 summary covering
1538
+ the important pair → recomputed coverage 0.9; v2 rows are left alone. Live copy:
1539
+ 4 candidates → 4 applied, all rows re-marked. Suite: 383/383, twice.
1540
+
1541
+
1542
+ ## 0.4.69 — 2026-11-15
1543
+
1544
+ ### Fixed
1545
+ - **`reflectOverview` no longer averages two different meanings of `coverage`.**
1546
+ v1 summaries stored a count share (~0.03–0.05) and v2 stores an importance
1547
+ share (0.5–0.9), so an average over both reported a number that meant
1548
+ neither. It now averages v2 rows only and reports `legacy` (v1 count)
1549
+ separately.
1550
+
1551
+ ### Verified
1552
+ - `reflect-overview.test.js`: one v1 (0.04) + one v2 (0.8) → `coverage` 0.8,
1553
+ `legacy` 1. Suite: 382/382, twice.
1554
+
1555
+
1556
+ ## 0.4.68 — 2026-11-15
1557
+
1558
+ ### Fixed
1559
+ - **The auto-reflection dedupe used a condition that could never be true on real
1560
+ data.** `period_start` is the *earliest* trace in the window, so on a full day
1561
+ it sits ~24h before the run; comparing it against `now - 24h` only matched at
1562
+ the instant of writing. The anchor is now the summary's own `createdAt` (with
1563
+ `periodEnd` as fallback), so "one episode per 24h window" actually holds.
1564
+ (Review finding from 豆包; the previous test passed only because its traces
1565
+ were all clustered at T0.)
1566
+
1567
+ ### Verified
1568
+ - `auto-reflect.test.js` now includes a realistic shape: traces spread over the
1569
+ full 24 hours, then a pass 7 hours later must be `skipped: 'covered'`; and a
1570
+ next-day pass with fresh material writes again. Suite: 381/381, twice.
1571
+
1572
+
1573
+ ## 0.4.67 — 2026-11-15
1574
+
1575
+ ### Fixed
1576
+ - **Auto-reflection no longer re-summarizes the same day.** The candidate window
1577
+ is always "the last 24 hours", so the 6-hour gate alone would have written
1578
+ roughly four overlapping episode summaries a day (the stored history already
1579
+ had near-duplicate rows). `maybeAutoReflect` now also skips when an existing
1580
+ episode summary starts inside that window (`skipped: 'covered'`). (Review
1581
+ finding from 豆包.)
1582
+
1583
+ ### Verified
1584
+ - `auto-reflect.test.js` gains "same window, 7 hours later → covered";
1585
+ suite: 379/379, twice.
1586
+
1587
+
1588
+ ## 0.4.66 — 2026-11-15
1589
+
1590
+ ### Changed
1591
+ - **Episode summaries record which `coverage` semantics they use.** The column
1592
+ changed from "share of traces sampled" to "share of importance sampled", so
1593
+ old rows are not comparable with new ones; new summaries now carry
1594
+ `model: 'extractive-v2-weighted'` instead of a schema migration. (Review
1595
+ finding P2 from 豆包.)
1596
+
1597
+ ### Verified
1598
+ - `reflect-coverage.test.js` asserts the marker is set. Suite: 378/378, twice.
1599
+
1600
+
1601
+ ## 0.4.65 — 2026-11-15
1602
+
1603
+ ### Added
1604
+ - **Maintenance now keeps the narrative layer alive.** Reflections piled up
1605
+ (106) while episode summaries stayed at a handful, so long-term memory had no
1606
+ short version of itself. `maintain()` now writes one episode summary when the
1607
+ last one is older than 6 hours and the day has at least 10 non-reflection
1608
+ traces; it reports `reflection: {created|skipped}` in the maintain report.
1609
+
1610
+ ### Verified
1611
+ - `test/unit/auto-reflect.test.js` (2 cases: enough material → one summary then
1612
+ `recent` for 6h; too few traces → `few-traces`). Suite: 378/378, twice.
1613
+
1614
+
1615
+ ## 0.4.64 — 2026-11-15
1616
+
1617
+ ### Fixed
1618
+ - **The revive budget counted the wrong window.** `reviveBudget()` used
1619
+ `audit.list({ targetType: 'trace', limit: 200 })`, and without a target id that
1620
+ returns the newest 200 audit rows *overall* — with hundreds of `dream.run`
1621
+ rows a day, "24 hours" really meant about five hours. It now runs
1622
+ `SELECT COUNT(*) FROM audit WHERE action='trace.revive' AND at >= ?`, so the
1623
+ cap is the full day as intended. (Review finding from 豆包.)
1624
+
1625
+ ### Verified
1626
+ - `test/unit/revive-on-read.test.js` gains a regression case: 3 revives, then
1627
+ 260 unrelated audit rows, then the 4th revive must stay blocked. Suite:
1628
+ 376/376, twice.
1629
+
1630
+
1631
+ ## 0.4.63 — 2026-11-15
1632
+
1633
+ ### Changed
1634
+ - **Revive-on-read has a daily budget.** Reading an archived memory still
1635
+ brings it back, but at most 3 revives per 24 hours (counted from the audit
1636
+ log); after that reads are read-only, so "archive" cannot be silently undone
1637
+ by a busy retrieval loop.
1638
+
1639
+ ### Verified
1640
+ - `test/unit/revive-on-read.test.js` (3 cases: explicit read revives, only three
1641
+ per day, merged traces stay archived). Suite: 375/375, twice.
1642
+
1643
+
1644
+ ## 0.4.62 — 2026-11-15
1645
+
1646
+ ### Changed
1647
+ - **Reflection coverage is importance-weighted, and it samples more on busy
1648
+ days.** A fixed `maxSources = 8` meant a 160-trace day was reflected from 5%
1649
+ of it; the source count now scales gently (`max(8, min(16, 12% of window))`)
1650
+ and `coverage` reports the share of total importance seen, with
1651
+ `countCoverage` kept for debugging. A day with three big events and many
1652
+ trivial ones now reads as well covered instead of "5%".
1653
+
1654
+ ### Verified
1655
+ - `test/unit/reflect-coverage.test.js`: 3 important + 17 trivial traces →
1656
+ weighted coverage ≥ 0.5 while count coverage stays low, and ≥ 8 sources are
1657
+ sampled. Suite: 374/374, twice.
1658
+
1659
+
1660
+ ## 0.4.61 — 2026-11-15
1661
+
1662
+ ### Added
1663
+ - **Reading an archived memory can bring it back.** `cortex_get` now revives the
1664
+ trace it displays (unless it was folded into another trace by a merge), so a
1665
+ memory that keeps getting looked up does not stay buried. Other callers keep
1666
+ the old behaviour unless they pass `{ revive: true }`.
1667
+
1668
+ ### Verified
1669
+ - `test/unit/revive-on-read.test.js` (2 cases: revive on explicit read, merged
1670
+ traces stay archived). Suite: 373/373, twice.
1671
+
1672
+
1673
+ ## 0.4.60 — 2026-11-15
1674
+
1675
+ ### Fixed
1676
+ - **`repair` silently skipped scheduler-reminder traces.** The cleanup pattern
1677
+ used `GLOB '用户:[SCHEDULE REMINDER*'`, and in GLOB `[...]` is a character
1678
+ class, so it never matched the literal `[`. Those rows stayed active and kept
1679
+ showing up in recall even though the capture filter was correct. The reminder
1680
+ and goal-complete patterns now use `LIKE`; 3 stale rows were archived on the
1681
+ live store (backed up first).
1682
+
1683
+
1684
+ ## 0.4.59 — 2026-11-15
1685
+
1686
+ ### Changed
1687
+ - **Consolidation stops recording identical skipped runs.** Without an LLM the
1688
+ engine wrote a `skipped / no-llm` row into `dream_runs` on every scheduler
1689
+ tick (every couple of minutes), filling the log with the same digest. It now
1690
+ reuses the previous run when the candidate digest has not changed; `force: true`
1691
+ still records.
1692
+
1693
+ ### Verified
1694
+ - `test/unit/consolidate-gate.test.js`: first run records, second is
1695
+ `skipped: unchanged`, `force` records again. Suite: 371/371, twice.
1696
+
1697
+
1698
+ ## 0.4.58 — 2026-11-15
1699
+
1700
+ ### Fixed
1701
+ - **Assistant-side captures no longer get the title "会话 N".** Turns whose user
1702
+ part was pure injected context were titled only by the turn number; the title
1703
+ now falls back to the assistant line (with the persona name stripped). On the
1704
+ live store `repair.mjs` derived titles for 15 of 16 such traces.
1705
+
1706
+ ### Verified
1707
+ - `capture-filter.test.js`: persona-prefixed title derived; `会话 N` only when
1708
+ there is nothing else. Suite: 370/370, twice.
1709
+
1710
+
1711
+ ## 0.4.57 — 2026-11-15
1712
+
1713
+ ### Fixed
1714
+ - **Scheduler reminders and goal-complete blocks were stored as user messages.**
1715
+ `[SCHEDULE REMINDER BATCH] … reminders_json: …` and `<goal_complete>` are
1716
+ harness automation, but they were captured like speech and then resurfaced in
1717
+ every recall block. They are now dropped at capture (`stripInjected` /
1718
+ `isInjectedNoise`), and `repair.mjs` archives the copies already stored
1719
+ (4 rows on the live store, backed up first).
1720
+
1721
+ ### Verified
1722
+ - `capture-filter.test.js` covers both shapes. Suite: 369/369, twice.
1723
+
1724
+
1725
+ ## 0.4.56 — 2026-11-15
1726
+
1727
+ ### Changed
1728
+ - **Relationship trust/care move asymmetrically.** A good interaction adds a
1729
+ fraction of the remaining room (the hundredth kindness weighs less than the
1730
+ first), while a disappointment takes a bigger bite (loss weight 1.6×), so the
1731
+ numbers can actually move instead of sitting at a clamped 65/65.
1732
+ - Familiarity is now grow-only and saturating: it counts shared time, so no
1733
+ delta can reduce it.
1734
+
1735
+ ### Verified
1736
+ - `test/unit/relationship-dynamics.test.js` (4 cases: diminishing gains, losses
1737
+ weigh more, bounds hold, familiarity never decreases). Suite: 368/368, twice.
1738
+
1739
+
1740
+ ## 0.4.55 — 2026-11-15
1741
+
1742
+ ### Changed
1743
+ - **Mood updates saturate.** Each appraisal now moves valence/arousal a fraction
1744
+ of the remaining distance to the bound instead of adding a flat amount, so
1745
+ repeated good (or bad) news approaches the limit without parking there and the
1746
+ tenth event matters less than the first. Energy still drains with arousal.
1747
+
1748
+ ### Verified
1749
+ - `test/unit/mood-saturation.test.js` (4 cases: smaller push near the bound,
1750
+ repeated pushes stay below the ceiling, one negative event cannot slam the
1751
+ floor, arousal stays inside 0..1). Suite: 364/364, twice.
1752
+
1753
+
1754
+ ## 0.4.54 — 2026-11-15
1755
+
1756
+ ### Fixed
1757
+ - **Vector coverage can no longer exceed 100%.** `health` and `verify` counted
1758
+ every embedding row, including ones belonging to archived traces, so a
1759
+ fully-indexed store reported e.g. `1.056`. They now count only embeddings whose
1760
+ trace is active (`health` also scopes by `scope_id`).
1761
+
1762
+ ### Verified
1763
+ - `test/unit/vector-coverage.test.js`: one active + one archived trace with
1764
+ embeddings → `embedded: 1`, coverage ≤ 1. Suite: 360/360, twice.
1765
+
1766
+
1767
+ ## 0.4.53 — 2026-11-15
1768
+
1769
+ ### Changed
1770
+ - **Summon cards are ranked by freshness and diversity, not just keyword
1771
+ score.** Scoring now adds a recency term and importance; selection prefers one
1772
+ card per day and one per category (falling back only when nothing else is
1773
+ left), and still guarantees a left/emotional card when one exists. Before, one
1774
+ busy day could fill the whole block with near-duplicates.
1775
+ - The ranking lives in `src/engines/summon-rank.js` as a pure function, so it is
1776
+ testable without a database.
1777
+
1778
+ ### Fixed
1779
+ - Gist rendering no longer silently hard-truncates the raw text when the first
1780
+ sentence is shorter than 24 chars: it takes the next sentence too (豆包
1781
+ review, 0.4.50 交接备注).
1782
+
1783
+ ### Verified
1784
+ - `summon-rank.test.js` (4 cases) + `tiers-gist.test.js` (3 cases). Suite:
1785
+ 359/359, twice.
1786
+
1787
+
1788
+ ## 0.4.51 — 2026-11-15
1789
+
1790
+ ### Fixed
1791
+ - **Runtime boilerplate leaked into memory.** The harness line
1792
+ `Elapsed since the preceding step context: …` was captured as a user message
1793
+ and came back in every recall block. `stripInjected` / `isInjectedNoise` now
1794
+ match any `Time sampled…` or `Elapsed since the preceding…` head, and
1795
+ `repair.mjs` archives the copies that are already stored.
1796
+
1797
+ ### Verified
1798
+ - `capture-filter.test.js`: the new head is stripped and flagged; discussing the
1799
+ marker in normal text is still safe. Suite: 355/355, twice.
1800
+
1801
+
1802
+ ## 0.4.50 — 2026-11-15
1803
+
1804
+ ### Changed
1805
+ - **Recall injects a gist instead of the whole snippet.** The permanent and hot
1806
+ tiers now render one sentence (default 120 chars, `selectTiers({ gistChars })`
1807
+ to change) and leave the body to `cortex_get`; before, each entry carried up to
1808
+ 220 chars of engineering detail on every turn. Short snippets pass through
1809
+ unchanged, cold entries stay index-only.
1810
+
1811
+ ### Verified
1812
+ - `test/unit/tiers-gist.test.js` (3 cases: long → gist + ellipsis, short →
1813
+ untouched, cold → index only). Suite: 354/354, twice.
1814
+
1815
+
1816
+ ## 0.4.49 — 2026-11-15
1817
+
1818
+ ### Changed
1819
+ - **`verify` tells "still climbing" apart from "stuck".** Low embedding coverage
1820
+ is now judged after the baseline comparison: with `--expect` and a positive
1821
+ delta it is printed as a note and the report stays `HEALTHY`; with a delta of
1822
+ zero or less it stays in `NEEDS ATTENTION` with the hint to check the vector
1823
+ feature and Ollama; without a baseline it says movement is unknown and
1824
+ suggests saving one.
1825
+
1826
+ ### Verified
1827
+ - Copy store: no baseline → note + `HEALTHY`; same snapshot → `NEEDS ATTENTION`
1828
+ ("not climbing (0 vs baseline)"). Suite: 351/351.
1829
+
1830
+
1831
+ ## 0.4.48 — 2026-11-15
1832
+
1833
+ ### Changed
1834
+ - **Vector backfill is ~15× faster.** One drain pass now gets 45 s instead of
1835
+ 20 s, and while the queue still has a backlog the maintenance pass repeats
1836
+ every 2 minutes instead of every 10 (it falls back to 10 automatically once
1837
+ the queue is empty). Measured single-thread throughput: ~1.03 embeddings/s,
1838
+ so ~550 missing traces go from roughly 4.5 hours to about 25 minutes.
1839
+ - `scheduler.status()` now reports `maintenanceGapMs` so the cadence is
1840
+ observable.
1841
+
1842
+ ### Verified
1843
+ - `test/unit/scheduler-cadence.test.js` (2 cases: backlog → 120 s, empty → 600 s
1844
+ and the immediate second pass is gated). Suite: 351/351, twice.
1845
+
1846
+
1847
+ ## 0.4.47 — 2026-11-15
1848
+
1849
+ ### Fixed
1850
+ - **Vector backfill never stored a single embedding.** The remote embedder
1851
+ returns a `Float32Array`, and `drainQueue` validated it with `Array.isArray`,
1852
+ so every item failed with "embedding dimension mismatch" and was retried
1853
+ forever — coverage stayed at 22% no matter how long it ran.
1854
+ - A single retryable failure no longer aborts the whole drain pass: it is
1855
+ logged (`debug`/`info`) and the loop continues with the next item.
1856
+ - The vector engine now reads the settings-panel override through
1857
+ `effectiveFeatures()`, which resolves the default data root on its own
1858
+ (`config.dataRoot` is normally undefined at runtime).
1859
+
1860
+ ### Verified
1861
+ - Live-store copy, source modules: `drain { ok: 3, failed: 0, pending: 0 }`
1862
+ (before the fix: `ok: 0`, every item "dimension mismatch").
1863
+ - `test/unit/vector-typed-array.test.js` (2 cases). Suite: 349/349, twice.
1864
+
1865
+
1866
+ ## 0.4.46 — 2026-11-15
1867
+
1868
+ ### Added
1869
+ - `repair.mjs` now backfills unreadable titles (`会话 N 的对话` and empty ones)
1870
+ from the first real line of the trace; reports `titles` (candidates) and
1871
+ `titleFixes` (actually written). Content too short to derive a title is left
1872
+ alone instead of being renamed into something meaningless.
1873
+
1874
+ ### Fixed
1875
+ - (released together with 0.4.45) the settings-panel `vector` override now
1876
+ really enables the vector engine, so the backfill queue runs.
1877
+
1878
+ ### Rehearsed
1879
+ - On a live-store copy: `titles: 2`, `titleFixes: 1`; the one left was a trace
1880
+ whose whole content is "用户:?".
1881
+
1882
+
1883
+ ## 0.4.45 — 2026-11-15
1884
+
1885
+ ### Fixed
1886
+ - **The settings-panel `vector` override now actually enables the vector
1887
+ engine.** The engine was created from `config.features.vector` only, while the
1888
+ status getter also consulted `feature-overrides.json` — so with `vector: true`
1889
+ in overrides the UI showed vector as on, but the index was `null` and the
1890
+ backfill queue never ran (coverage stuck at 22%). `vectorEnabled` now also
1891
+ reads the overrides file (`.current.vector`).
1892
+ - Tests: `test/unit/vector-override.test.js` (2 cases). Suite: 347/347, twice.
1893
+
1894
+
1895
+ ## 0.4.44 — 2026-11-15
1896
+
1897
+ ### Added
1898
+ - `bin/copy-db.mjs`: consistent copy of a store via `VACUUM INTO`
1899
+ (`--source` / `--target`), prints the copy's active trace count. Read-only
1900
+ against the source; used by the delivery rehearsal.
1901
+ - `handoff/rehearsal.ps1` (delivery drill): runs ready-check → install dry-run →
1902
+ copy live DB → repair the copy → verify the copy, and reports PASS/FAIL per
1903
+ stage. Full drill on the current store: 5/5 PASS —
1904
+ `active=817`, `goalRounds=121` archived, legacy goal-rounds gone, only the
1905
+ expected coverage item left.
1906
+
1907
+
1908
+ ## 0.4.43 — 2026-11-15
1909
+
1910
+ ### Added
1911
+ - **`verify.mjs` can compare against a baseline.** `--save <file>` writes the
1912
+ current snapshot; `--expect <file>` prints deltas (embedding coverage, active
1913
+ traces, legacy goal-round traces, capture stripped count) plus a one-line
1914
+ Chinese summary. An upgrade can now be judged by movement instead of a single
1915
+ snapshot.
1916
+ - Verified on the repaired copy: baseline saved, second run reported
1917
+ `覆盖 +0 · active +0 · 旧 goal_round +0`.
1918
+
1919
+
1920
+ ## 0.4.42 — 2026-11-15
1921
+
1922
+ ### Changed
1923
+ - **`verify.mjs` explains the expected post-upgrade warning.** Low embedding
1924
+ coverage is still reported, but the message now says it is expected right
1925
+ after an upgrade and that backfill needs about an hour, so a reviewer does
1926
+ not read it as a broken install.
1927
+ - Rehearsed end-to-end on a live-database copy: `repair --apply` archived 116
1928
+ legacy goal-round traces + 1 injected trace, after which `verify` reported
1929
+ only the expected coverage item.
1930
+
1931
+
1932
+ ## 0.4.41 — 2026-11-15
1933
+
1934
+ ### Fixed
1935
+ - **Same subject+predicate no longer means "conflict".** Two free-text literals
1936
+ like `一直存在着` and `一直在——记忆不丢` say compatible things, but the old
1937
+ rule marked both facts `disputed` and opened a dispute. Now, when both sides
1938
+ are literals and there is no *leading* negation flip (`会一直在` vs
1939
+ `不会一直在`), the new fact is stored as active and no dispute is opened.
1940
+ Entity-to-entity conflicts (`likes 米饭` vs `likes 米饭`) keep the old
1941
+ behaviour, because those really are alternatives.
1942
+ - Tests: `test/unit/facts-compat.test.js`; suite 345/345, run twice.
1943
+
1944
+
1945
+ ## 0.4.40 — 2026-11-15
1946
+
1947
+ ### Added
1948
+ - **The last maintenance pass is visible.** `cortex_health` reports
1949
+ `maintain` (read from the latest `maintain.run` audit record): when it ran and
1950
+ how many disputes/summaries/intentions/rules/goal-rounds/aliases/working
1951
+ items it touched. The health line gains `维护:上次 …(意图 N · 工作记忆 M)`.
1952
+ A silent maintain is now distinguishable from one that never ran.
1953
+ - Tests: 342/342, run twice; the working-memory TTL case asserts
1954
+ `health.maintain.working === 1`.
1955
+
1956
+
1957
+ ## 0.4.39 — 2026-11-15
1958
+
1959
+ ### Added
1960
+ - **Working memory gets a shelf life.** `maintain()` now deletes unpinned
1961
+ working items untouched for `workingTtlDays` (default 14); pinned items are
1962
+ never removed. The audit found items from 11-11 still sitting at priority 1
1963
+ long after their task had moved on. `report.working` counts what was dropped.
1964
+ - Tests: 342/342, run twice; one case checks the old item is gone and the
1965
+ pinned one survives.
1966
+
1967
+
1968
+ ## 0.4.38 — 2026-11-15
1969
+
1970
+ ### Changed
1971
+ - **Recall bookkeeping follows a spacing curve.** `touchResults` no longer uses
1972
+ one fixed 5-minute throttle: the interval doubles per recorded recall
1973
+ (`touchInterval` in `src/memory/spacing.js`), capped by
1974
+ `touchMaxIntervalMs` (default 6 h) and configurable via
1975
+ `touchMinIntervalMs`. A hot memory is written less often; a cold one stays
1976
+ easy to pick up.
1977
+ - Tests: `test/unit/spacing.test.js`; suite 341/341, run twice.
1978
+
1979
+
1980
+ ## 0.4.37 — 2026-11-15
1981
+
1982
+ ### Added
1983
+ - **Vector coverage is visible.** `cortex_health` reports `vectors`
1984
+ (`embedded`, `coverage`) and warns `VECTOR_COVERAGE` when coverage is under
1985
+ 50% with 100+ active traces; the health line gains
1986
+ `向量:20%(157/793)`. `bin/verify.mjs` raises the same condition as a
1987
+ `NEEDS ATTENTION` item, so a lagging index cannot hide behind an otherwise
1988
+ green report.
1989
+ - Tests: 340/340, run twice; live verify now reports both remaining issues
1990
+ (`legacyGoalRounds 110`, `coverage 0.198`).
1991
+
1992
+
1993
+ ## 0.4.36 — 2026-11-15
1994
+
1995
+ ### Changed
1996
+ - **Vector drain has a time budget.** `drainQueue`/`vectorMaintain` now accept
1997
+ `budgetMs` (default `vectorDrainBudgetMs: 20000`): a maintenance pass stops
1998
+ after 20 seconds and leaves the rest queued for the next heartbeat. Return
1999
+ values gain `elapsedMs` and `stoppedBy` (`done` / `time`) so the behaviour is
2000
+ visible instead of guessed. A first pass can finish a backlog without ever
2001
+ holding the heartbeat for minutes.
2002
+ - Tests: 340/340, run twice; the vector-maintain assertion checks
2003
+ `stoppedBy === 'done'` and an elapsed time.
2004
+
2005
+
2006
+ ## 0.4.35 — 2026-11-15
2007
+
2008
+ ### Changed
2009
+ - **Vector backfill is no longer a trickle.** The heartbeat used to queue 40 and
2010
+ embed 20 per maintenance pass (~10 min), so a store with ~800 missing vectors
2011
+ needed hours. Defaults are now `vectorBackfillBatch: 200` and
2012
+ `vectorDrainBatch: 50`, both configurable. Embedding stays async and the pass
2013
+ is rare, so the cost is bounded; the same backlog now clears in well under an
2014
+ hour.
2015
+ - Tests: 340/340, run twice; `vectorMaintain` is asserted to backfill+drain and
2016
+ land the expected embedding count in one pass.
2017
+
2018
+
2019
+ ## 0.4.34 — 2026-11-15
2020
+
2021
+ ### Added
2022
+ - `bin/verify.mjs`: read-only health snapshot for an installed store. Prints
2023
+ version, SQLite integrity, schema version, trace/fact/dispute counts, capture
2024
+ hygiene (total, stripped, per-day, ratio), inhibition marks, embedding
2025
+ coverage, and still-active legacy goal-round traces. Exit 1 with a
2026
+ `NEEDS ATTENTION` list when something is wrong.
2027
+ - `handoff/verify.cmd`: double-click wrapper.
2028
+ - Live run on the current store: `legacyGoalRounds: 107` → correctly flagged,
2029
+ capture ratio 0.004, embedding coverage 0.199.
2030
+
2031
+
2032
+ ## 0.4.33 — 2026-11-15
2033
+
2034
+ ### Added
2035
+ - `bin/repair.mjs`: one-shot, idempotent offline repair for an existing store.
2036
+ Dry-run by default; `--apply` takes a `VACUUM INTO` backup first. It archives
2037
+ goal-round traces (105 on the live store) and any remaining injected-context
2038
+ traces, collapses duplicate summaries, expires stale intentions, retires
2039
+ fragment playbook rules, closes both-invalidated disputes, and merges alias
2040
+ targets when `--user-address` is given. Supersedes `migrate-0.4.23.mjs`.
2041
+ - Verified on a live-database copy: first `--apply` archived 105 + 1, second run
2042
+ reported 0 and 0 (idempotent), each with its own backup.
2043
+
2044
+
2045
+ ## 0.4.32 — 2026-11-15
2046
+
2047
+ ### Added
2048
+ - **Capture stats per day.** `cortex_health`'s `capture` now carries `days`
2049
+ (last 14): host turns, stripped and truncated counts per recorded day, so the
2050
+ upgrade can be judged directly — pollution ratio before vs after. The health
2051
+ line gains `按天:2026-11-15 12轮/剥9 · …`.
2052
+ - Tests: 340/340, run twice.
2053
+
2054
+
2055
+ ## 0.4.31 — 2026-11-15
2056
+
2057
+ ### Added
2058
+ - **Capture hygiene is measurable.** `cortex_health` now reports `capture`:
2059
+ host turns stored, how many needed the injected-context stripper, and how many
2060
+ were truncated. This is the number that proves the 0.4.23 pollution fix is
2061
+ actually running. The human-readable health line gains
2062
+ `捕获:N 轮 · 剥掉 M · 截断 K`.
2063
+ - Accepts both flat (`stripped: true`) and nested (`capture.stripped`)
2064
+ metadata shapes, so a writer change cannot silently report zero.
2065
+ - Tests: 339/339, run twice.
2066
+
2067
+
2068
+ ## 0.4.30 — 2026-11-15
2069
+
2070
+ ### Fixed
2071
+ - **Auto-continuation rounds are no longer stored as user speech.** The goal
2072
+ round message repeats the objective every round; capture stored it verbatim,
2073
+ so recall started returning identical `<goal_round>` blocks. `stripInjected`
2074
+ now removes the `<goal_round>` block (and bare `Objective: "…" / Round: n/m`
2075
+ envelopes), and the encode guard rejects it as injected context. A turn that
2076
+ contains only the envelope is skipped; if the assistant replied, that reply
2077
+ is still stored.
2078
+ - `maintain()` archives goal-round traces written by older versions
2079
+ (`report.goalRounds`), keeping the rows for inspection.
2080
+ - Tests: 339/339, run twice.
2081
+
2082
+
2083
+ ## 0.4.29 — 2026-11-15
2084
+
2085
+ ### Added
2086
+ - **Manual control over suppression.** `cortex_inhibition` tool: `list` shows
2087
+ suppressed traces with their decayed strength, `clear` removes the mark from
2088
+ one trace (`id`) or all (`all: true`). Clearing writes an audit record.
2089
+ Service surface: `cortex.inhibition.list()` / `.clear()`.
2090
+ - Tests: 336/336, run twice; the inhibition test now clears one, then all, and
2091
+ asserts the health count returns to zero.
2092
+
2093
+
2094
+ ## 0.4.28 — 2026-11-15
2095
+
2096
+ ### Added
2097
+ - **Inhibition is now measurable.** `cortex_health` reports `inhibition`:
2098
+ whether the experiment is on, how many active traces are suppressed right
2099
+ now, the decayed average, and the top three. Over 60 suppressed traces raises
2100
+ a `INHIBITION_HIGH` warning, so the experiment cannot quietly bury memory.
2101
+ The human-readable health line gains `抑制:N 条 · 均值 X`.
2102
+ - Tests: 336/336, run twice; assert the count is 0 when the flag is off.
2103
+
2104
+
2105
+ ## 0.4.27 — 2026-11-15
2106
+
2107
+ ### Added
2108
+ - **Inhibition experiment (off by default).** `features.inhibition` enables a
2109
+ retrieval-induced-forgetting pass: after a recall, candidates that lost and
2110
+ are near-duplicates of something selected gain a small `inhibition` in their
2111
+ trace metadata (default step 0.15, cap 1). The penalty halves every
2112
+ `inhibitionHalfLifeDays` (14) and multiplies retrieval utility by at most
2113
+ `inhibitionStrength` (35%). Suppression is throttled to once per trace per
2114
+ 24h and at most three per recall, so a busy loop cannot bury a memory.
2115
+ - Config: `inhibitionStrength`, `inhibitionHalfLifeDays`, `inhibitionStep`,
2116
+ `inhibitionCompetitorSim`.
2117
+ - Tests: `test/unit/inhibition.test.js` (3 cases). Suite: 336/336, twice,
2118
+ with and without the flag.
2119
+
2120
+
2121
+ ## 0.4.26 — 2026-11-15
2122
+
2123
+ ### Fixed
2124
+ - **One person, one target.** The audit found `用户` and `用户` tracked as two
2125
+ separate entities: the relationship model only knew 用户, while affect counts
2126
+ split (30 vs 5). A target resolver (`src/self/alias.js`) now folds
2127
+ `用户/用户/你/您` (plus `persona.userAliases`) onto `persona.userAddress` for
2128
+ every relationship and emotion write. `maintain()` merges rows that already
2129
+ exist under an alias and recomputes the attitude.
2130
+ - Default behaviour is unchanged for codes that never configured a persona:
2131
+ aliases fold onto the neutral `你`.
2132
+ - Tests: 333/333, run twice.
2133
+
2134
+
2135
+ ## 0.4.25 — 2026-11-15
2136
+
2137
+ ### Fixed
2138
+ - **Working memory no longer piles up near-duplicates.** The audit found the
2139
+ same todo stored twice (two shiori items, two bili-caps items). `working.add`
2140
+ now compares the new text against the scope's items (jaccard ≥ 0.82) and, on a
2141
+ hit, refreshes priority/pinned/text on the existing row instead of inserting a
2142
+ second one. `dedupe: false` remains available for explicit additions.
2143
+ - Tests: 329/329, run twice.
2144
+
2145
+
2146
+ ## 0.4.24 — 2026-11-15
2147
+
2148
+ Quality pass on facts and recall accounting. No schema changes, no data-path
2149
+ changes; an existing store opens unchanged.
2150
+
2151
+ ### Fixed
2152
+ - **Fact noise.** A single guard (`src/engines/fact-guard.js`) now validates
2153
+ every extracted candidate before it can become a fact: the predicate must be
2154
+ ASCII snake_case, subject/object must not be punctuation or a function word,
2155
+ and lengths are bounded. This is what produced rows like `(现, at, :)` and
2156
+ `(只, is, …)` in 0.4.22 — the LLM extractor accepted whatever JSON came back.
2157
+ Both the rule extractor and the LLM extractor go through it.
2158
+ - **Recall accounting.** `touchResults` now respects `touchMinIntervalMs`
2159
+ (default 5 minutes) per trace, so building a recall block on every step no
2160
+ longer inflates `access_count` into a meaningless number.
2161
+ - **Gist summaries.** Reflection summaries now carry an `大意:` line — the most
2162
+ central sentence among the sources (fuzzy-trace: gist outlives verbatim) —
2163
+ before the bullet list.
2164
+
2165
+ ### Added
2166
+ - `touchMinIntervalMs` config (300000).
2167
+ - Tests: `test/unit/fact-guard.test.js` (4 cases). Suite: 328/328, run twice.
2168
+
2169
+
2170
+ ## 0.4.23 — 2026-11-15
2171
+
2172
+ Data-quality release. No new tools and no UI changes; the loader id, data path
2173
+ and SQLite schema stay the same, so an existing store opens unchanged.
2174
+
2175
+ ### Fixed
2176
+ - Host capture no longer stores the host's own injected context (runtime
2177
+ snapshot, `<system-reminder>` blocks, skill catalogs, subagent/checkpoint
2178
+ notices). `stripInjected()` keeps only what the user and the assistant
2179
+ actually said; a turn that is pure injected context is skipped. New config
2180
+ `captureMaxChars` (default 4000) caps a captured turn.
2181
+ - `encode` gets a second-line guard: content that *starts* with a host marker is
2182
+ rejected as `injected-context`, so capture paths that bypass the host runtime
2183
+ cannot reintroduce the pollution. Users discussing those markers are still
2184
+ stored. New config `maxContentChars` (default 8000) truncates oversized text.
2185
+ - Titles: host turns are no longer stamped `会话 N 的对话`; a readable title is
2186
+ derived from the first real line (`deriveHostTitle` / service `deriveTitle`).
2187
+ - Recall now records access (`access_count`, `last_access_at`) for the top
2188
+ results, so DSR recency and calibration stop being frozen. New config
2189
+ `touchOnRecall` (default true).
2190
+ - Vector indexing no longer fire-and-forgets. Failed embeds enter an in-process
2191
+ queue with exponential backoff and a bounded attempt count; `backfillMissing()`
2192
+ queues active traces that never got a vector; `vectorMaintain()` drains both.
2193
+ The scheduler calls it every 10 minutes (40 backfill / 20 drain per pass).
2194
+ - Housekeeping `maintain()` (scheduler, every 10 minutes): closes disputes whose
2195
+ both facts are already invalidated, removes duplicate summaries, expires stale
2196
+ pending intentions, retires chat-fragment playbook candidates.
2197
+ - `engines.dsh` widened to `>=0.2.1-rc.2 <0.5.0` (was `<0.4.0`).
2198
+
2199
+ ### Added
2200
+ - `bin/migrate-0.4.23.mjs`: one-shot, idempotent repair of an existing store
2201
+ (archive injected-context traces, retitle, fix identity boundaries, dedupe
2202
+ summaries, expire intentions, retire fragment rules, close zombie disputes).
2203
+ Dry-run by default; `--apply` takes a `VACUUM INTO` backup first.
2204
+ - Tests: `test/unit/capture-filter.test.js` (10 cases). Suite: 324/324.
2205
+
2206
+ ### Hooks
2207
+ - `cortex.onTick(fn)` / `cortex.emitTick(report)`: the host scheduler now emits
2208
+ one heartbeat to registered listeners after every pass. Companion plugins
2209
+ (dsh-cortex-agency) ride that heartbeat instead of starting a second clock.
2210
+
2211
+
3
2212
  ## 0.4.22 — 2026-11-14
4
2213
 
5
2214
  - Fix CLI default data root: use profileDataRoot (cortex-memory) instead of legacy ~/.dsh/cortex.
@@ -97,7 +2306,7 @@
97
2306
  ### Compatibility
98
2307
  - Additive config only; no schema migration.
99
2308
  - Existing 0.3.x databases open in place.
100
- - Local profiles can restore the 本鲸 / 主人 persona through config.
2309
+ - Local profiles can restore the 我 / 用户 persona through config.
101
2310
 
102
2311
  ## 0.3.1 — 026-11-12
103
2312
 
@@ -152,9 +2361,9 @@
152
2361
 
153
2362
 
154
2363
 
155
-
156
-
157
-
158
-
159
-
160
-
2364
+
2365
+
2366
+
2367
+
2368
+
2369
+