@furongjun1999/dsh-memory 0.9.23 → 0.10.3

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 (118) hide show
  1. package/CHANGELOG.en.md +515 -404
  2. package/CHANGELOG.md +642 -449
  3. package/README.en.md +244 -240
  4. package/README.md +272 -262
  5. package/codebuddy/CODEBUDDY.md +1 -1
  6. package/docs/discipline/templates/full.md.tmpl +1 -1
  7. package/docs/discipline/templates/rules.mdc.tmpl +1 -1
  8. package/docs/en/mdcg/world-model-endpoint.md +1 -1
  9. package/docs/mdcg/cogmap_ops.md +19 -16
  10. package/lib/client.js +29 -3
  11. package/lib/hooks.d.ts +12 -0
  12. package/lib/hooks.js +43 -1
  13. package/lib/tools.d.ts +2 -2
  14. package/md_cg/bucketindex.py +231 -0
  15. package/md_cg/bucketscope.py +357 -0
  16. package/md_cg/cohesion.py +337 -0
  17. package/md_cg/config_registry_bulk.py +24 -10
  18. package/md_cg/config_validate.py +14 -2
  19. package/md_cg/constraint_audit.py +231 -0
  20. package/md_cg/constraint_watch.py +206 -0
  21. package/md_cg/context_audit.py +240 -0
  22. package/md_cg/context_plan.py +142 -0
  23. package/md_cg/detrerank.py +137 -0
  24. package/md_cg/distill.py +247 -0
  25. package/md_cg/dossier.py +151 -0
  26. package/md_cg/entities.py +133 -0
  27. package/md_cg/fsutil.py +135 -0
  28. package/md_cg/govern/__init__.py +23 -0
  29. package/md_cg/iface/__init__.py +46 -0
  30. package/md_cg/iface/_verify.py +609 -0
  31. package/md_cg/iface/contracts.py +337 -0
  32. package/md_cg/judgment_manifest.py +14 -0
  33. package/md_cg/kernel/__init__.py +27 -0
  34. package/md_cg/mcp_server.py +6044 -5761
  35. package/md_cg/mdcg.py +501 -16
  36. package/md_cg/mdcos.py +546 -12
  37. package/md_cg/metacognition.py +66 -13
  38. package/md_cg/mutate_extract_shipped.py +126 -0
  39. package/md_cg/mutate_ledger_e2e.py +100 -0
  40. package/md_cg/op_table.py +22 -0
  41. package/md_cg/probe_c_ledger_integrity.py +258 -0
  42. package/md_cg/probe_d_retirement_discipline.py +263 -0
  43. package/md_cg/profiles.py +298 -0
  44. package/md_cg/protocol.py +7 -1
  45. package/md_cg/reldate.py +142 -0
  46. package/md_cg/review_cli.py +6 -1
  47. package/md_cg/run_tests.py +30 -1
  48. package/md_cg/scopeselect.py +214 -0
  49. package/md_cg/scrub.py +66 -9
  50. package/md_cg/selfstmt.py +139 -0
  51. package/md_cg/state_extract.py +149 -0
  52. package/md_cg/state_slots.py +62 -10
  53. package/md_cg/state_view.py +181 -0
  54. package/md_cg/structboost.py +179 -0
  55. package/md_cg/sustain.py +28 -2
  56. package/md_cg/test_alternatives_historical.py +165 -0
  57. package/md_cg/test_b2_sensitivity_landing.py +226 -223
  58. package/md_cg/test_b3_merge_keeps_content.py +608 -583
  59. package/md_cg/test_bucket_cards.py +85 -0
  60. package/md_cg/test_bucket_day_order.py +74 -0
  61. package/md_cg/test_bucket_quota.py +79 -0
  62. package/md_cg/test_bucket_recency_guards.py +75 -0
  63. package/md_cg/test_bucket_three_causes.py +83 -0
  64. package/md_cg/test_bucket_time_rounds.py +87 -0
  65. package/md_cg/test_bucketindex.py +130 -0
  66. package/md_cg/test_bucketscope_early.py +71 -0
  67. package/md_cg/test_cohesion.py +107 -0
  68. package/md_cg/test_cond_term_fold_gate.py +1210 -0
  69. package/md_cg/test_cond_term_neg_scope.py +147 -0
  70. package/md_cg/test_constraint_audit.py +87 -0
  71. package/md_cg/test_constraint_watch.py +108 -0
  72. package/md_cg/test_context_audit.py +110 -0
  73. package/md_cg/test_context_plan.py +81 -0
  74. package/md_cg/test_detrerank.py +157 -0
  75. package/md_cg/test_gate_four_kpi.py +136 -0
  76. package/md_cg/test_generation_guard.py +14 -2
  77. package/md_cg/test_issue192_move_layer_indices_guard.py +48 -0
  78. package/md_cg/test_issue39_utf8_stdio.py +572 -572
  79. package/md_cg/test_issue413_preimage_failclosed.py +147 -9
  80. package/md_cg/test_issue768_overwrite_time_window_anchor.py +135 -0
  81. package/md_cg/test_issue789_log_plaintext_probe.py +100 -0
  82. package/md_cg/test_issue790_verb_negation.py +77 -0
  83. package/md_cg/test_issue810_root_guard.py +71 -0
  84. package/md_cg/test_issue812_info_index_stale.py +78 -0
  85. package/md_cg/test_issue827_weaken_dedup.py +361 -0
  86. package/md_cg/test_issue829_calibration_positive_gate.py +473 -0
  87. package/md_cg/test_kernel_iface_contracts.py +18 -0
  88. package/md_cg/test_md_cg_no_hive_dep.py +238 -17
  89. package/md_cg/test_probe_cd_shipped.py +385 -0
  90. package/md_cg/test_recent_tail.py +93 -0
  91. package/md_cg/test_run_tests_entry_gates.py +110 -0
  92. package/md_cg/test_scopeselect.py +70 -0
  93. package/md_cg/test_scopeselect_clock.py +70 -0
  94. package/md_cg/test_session_attribution_consistency.py +835 -813
  95. package/md_cg/test_state_extract_shipped.py +162 -0
  96. package/md_cg/test_state_ledger_chain.py +207 -0
  97. package/md_cg/test_state_ledger_e2e.py +145 -0
  98. package/md_cg/test_structboost.py +102 -0
  99. package/md_cg/test_timeboost.py +83 -0
  100. package/md_cg/test_timeboost_relativedate.py +71 -0
  101. package/md_cg/test_topicagg.py +129 -0
  102. package/md_cg/timeboost.py +223 -0
  103. package/md_cg/tokens.py +1 -1
  104. package/md_cg/topicagg.py +142 -0
  105. package/md_cg/version_anchor.py +84 -1
  106. package/md_cg/whitebox_kb/wisdom/code_compose.py +33 -5
  107. package/md_cg/whitebox_kb/wisdom/code_solidified.json +6195 -6195
  108. package/md_cg/whitebox_kb/wisdom/compose_engine.py +5 -1
  109. package/md_cg/whitebox_kb/wisdom/role_compose.py +271 -268
  110. package/package.json +1 -1
  111. package/src/hooks.ts +43 -1
  112. package/ui/minimal/payload/build-ui.mjs +41 -2
  113. package/ui/minimal/payload/lib/client.js +29 -3
  114. package/ui/minimal/payload/web/app.js +3 -1
  115. package/ui/minimal/payload/web/client.js +30 -3
  116. package/web/app.js +3 -1
  117. package/web/client.js +30 -3
  118. package/zcode/AGENTS.md +1 -1
package/CHANGELOG.en.md CHANGED
@@ -1,404 +1,515 @@
1
- > **Languages:** [中文](CHANGELOG.md) · English
2
-
3
- # Changelog (CHANGELOG)
4
-
5
- This file is maintained since **0.9.15**. For earlier versions see the git tags (`v0.9.6` … `v0.9.14`) and GitHub Releases.
6
-
7
- The format follows [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/); version numbers follow semantic versioning.
8
-
9
- ## [0.9.23] - 2026-11-05
10
-
11
- ### Fixed: `cg(op=read)` returned DEFER for natural phrasing (issue #722, Q1=A / Q2=A)
12
-
13
- - `judge_qualification` gains `strict_conditions` (library default `true`, no change for existing callers); **the tool face (`read`/`route`) defaults to relaxed**;
14
- - relaxation stops at `usable`: `state` stays `DEFER`, with new `usable/relaxed/code/condition_status`; the reason says explicitly that nothing was "confirmed";
15
- - **only the "condition not confirmed in context" branch** is relaxed; bad conditions / `REJECT` / `BLINDSPOT` / verification basis still block;
16
- - `judge_with_boundary` now keeps those four marker keys (previously pruned, so a relaxed result was invisible).
17
-
18
- ### Fixed: `cg(op=info)` timed out on large libraries (issue #677 B)
19
-
20
- - `health_os()` (full-library scan) now runs **only with `full=true`**; new `flush_state` (`pending_dirty/worker_alive/last_error`) and `node_count`;
21
- - **contract change**: the default response no longer carries the health_os keys (`buckets`, `bucket_scope`, `ccg_by_layer`, ...); pass `full=true` for the old set.
22
-
23
- ### Fixed: write succeeded but the call timed out, and retries duplicated nodes (issue #677)
24
-
25
- - `mdcg_remember` supports `dedupe` (same idempotency gate as `cg(op=write)`); **the plugin's three automatic memory kinds now send `dedupe: true`**, disable with `memory.dedupe=false`;
26
- - the server gate is now **session-scoped**: the same text written by two sessions no longer collapses (and with `sessionPrivate` it no longer "hits but reads nothing").
27
-
28
- ### Performance: flush I/O under lock from O(N) to O(1) (issue #677 C)
29
-
30
- - `ShardedLog.append_many`: **one write + one flush**, still inside a single `FileLock`;
31
- - two crash-safety fixes: **torn-tail repair** (append a `\n` if the shard ends mid-line) and **backfill keeps the `superseded` set** (otherwise stale records are resurrected = old overwrites new).
32
-
33
- ### Fixed: `FileLock.__enter__` leaked a file descriptor on error paths (issue #740)
34
-
35
- - strict timeout / non-retryable errno / bad `timeout` type / `KeyboardInterrupt` during sleep all go through `_close_fd()` now; `__exit__` reuses it (idempotent, never raises), re-entry closes the old handle first.
36
-
37
- ### One true source per fingerprint
38
-
39
- - `reconcile._disk_hashes` collapsed to a single value (#758);
40
- - `twophase` fingerprints now match index entries (#759, `_norm` demoted to legacy compatibility);
41
- - verification-state inheritance compares the index `content_hash` instead of reading from disk (#757, removes the #352 §B detour).
42
-
43
- ### Fixed: scrub treated inline source references as assertable key/value pairs
44
-
45
- - a key containing bracket punctuation is not a field name; values starting with `src_/ref_/doc_` are not assertable values;
46
- - **note**: for `...(source: src_x)` the real culprit is the bracketed prefix key, not the single character "source" (that one is filtered by the length gate).
47
-
48
- ### Known limitations
49
-
50
- - `cg(op=recall)` (budgeted packing path) does not thread `strict_conditions` yet;
51
- - `health_os()` itself is not optimised, only moved off the default path;
52
- - scrub's `contradiction` still compares literal key/value pairs; semantic rewrites are only reduced, not eliminated.
53
- ## [0.9.21] - 2026-10-31
54
-
55
- ### Fix: standard documents are **shipped with the package** (0.9.20 only gave external links)
56
-
57
- The 0.9.20 approach was "give GitHub absolute links in the README" - it solved "you know it exists", but **not "you can read it after installing"**.
58
-
59
- **This release puts the 7 standards that users should follow or check into the `files` allowlist**:
60
-
61
- | File | Purpose |
62
- |---|---|
63
- | `docs/mdcg/写入别名aliases规范_v0.6.md` | **How to add `aliases` when writing memory** (capability added in 0.9.19) |
64
- | `docs/mdcg/CCG六要素编译.md` | How to write the six elements |
65
- | `docs/mdcg/guardrail-charter.md` | Guardrail Charter (the public act) |
66
- | `docs/mdcg/MCP工具名口径_v1.0.md` | Tool name measurement basis |
67
- | `docs/mdcg/recall_metadata.md` | Recall metadata |
68
- | `docs/mdcg/世界模型功能端_使用与运维_v1.0.md` | World model endpoint usage and operations |
69
- | `docs/mdcg/cogmap_ops.md` | cogmap operations |
70
-
71
- ⇒ After installing the package, these 7 files are directly readable under `node_modules/@furongjun1999/dsh-memory/docs/mdcg/`. The documentation map links in the README also changed back to **package-relative paths**.
72
-
73
- ### Why not package the whole directory
74
-
75
- `docs/mdcg/` has **47 .md files** in total, mixed with internal records (`release_v0.3.0.md`, `CSRE_索引与负条件修复_20261012.md`, the various `plans_*`, `D_meta_工程化方案`, and so on).
76
- **Packaging the whole directory would ship the internal records too**, so 7 files were picked individually.
77
-
78
- ### Still not packaged (explicit boundary)
79
-
80
- - `docs/theory/` (19 files, internal theory)
81
- - `docs/eval/` (136 files, internal evaluation)
82
- - `docs/plans/` (25 files, internal plans)
83
- - `docs/ops/` (8 files, installation and operations - the README already has relative links, but they **still cannot be opened on the npm page**; an existing problem)
84
-
85
- ## [0.9.20] - 2026-10-31
86
-
87
- ### Fix: visibility of standard documents (an oversight in 0.9.19)
88
-
89
- The 0.9.19 CHANGELOG said "full standard: `docs/mdcg/写入别名aliases规范_v0.6.md`",
90
- **but `docs/mdcg/` was never in the npm package `files` allowlist** ⇒ that was a **dead link inside the package**; users could not find it even after installing.
91
-
92
- **Fixes in this release**:
93
-
94
- | Surface | Change |
95
- |---|---|
96
- | `README.md` · documentation map | Added a row "**Write standards**", linked via **GitHub absolute URLs** to "Write aliases", "CCG six-element compilation", and "Guardrail Charter", with an **explicit note that "these are not in the npm package"** |
97
- | `CHANGELOG.md` · 0.9.19 section | Dead links changed to GitHub URLs, with the note "not in the npm package, read them in the repository" |
98
-
99
- ⚠️ **Why not relative paths**: the existing links in the README are all relative paths (`docs/ops/README.md` etc.),
100
- and they **equally cannot be opened on the npm package page** - so everything newly added uses absolute URLs.
101
-
102
- > This is an old problem between the "packaging allowlist" and "documentation pointers": `docs/mdcg/` has 47 .md files,
103
- > some of them standards users should follow (`写入别名aliases`, `CCG六要素编译`, `guardrail-charter`),
104
- > and some internal records (`release_v0.3.0`, `CSRE_索引与负条件修复`, the various `plans`).
105
- > **Packaging the whole directory would ship the internal records too**, so this time the choice was "no packaging + absolute links in the README".
106
-
107
- ## [0.9.19] - 2026-10-31
108
-
109
- ### Added: `aliases` (write aliases) - the fix for natural phrasing that recall cannot reach
110
-
111
- **Usage**: when writing memory, add `aliases` to the node and put in the phrasings for "how users might ask about this later".
112
-
113
- ```python
114
- cg(op="write", node_id="...", content="""# 功能名:会话交接前的记忆固化
115
- # 生效条件:聊交接、换会话、压缩、或他流露舍不得时
116
- ...""",
117
- aliases=["换掉", "被换", "别消失", "舍不得", "不想你走", "压缩上下文"])
118
- ```
119
-
120
- `aliases` **participates in lexical recall but does not go into `tags`** - `tags` is occupied by machine criteria ("is this a task card", "can this be an anchor"),
121
- and mixing them would change those criteria.
122
-
123
- **The right way to write aliases** (summary of measured practice): before writing, **first ask yourself "how would I ask about this later?"**, and put those phrasings in verbatim (3-8 of them; colloquial, emotional, and near-synonym all count).
124
-
125
- > ⚠️ **Do not mechanically extract words**. Measured: auto-generating by splitting the feature name on spaces, 20 entries × 5 queries = **improvement +0**
126
- > (Chinese feature names have no spaces, so what gets split out is the whole sentence). Aliases can only be "thought of", not "split out".
127
-
128
- **Why it is needed** - the decisive case in issue #722:
129
-
130
- | Matching method | Condition "talk about handover, switching sessions, compression..." vs query "I don't want you to be replaced" |
131
- |---|---|
132
- | Whole-word matching | ❌ |
133
- | Bigram overlap | ❌ `换会/会话` vs `我不/…/被换/换掉` - **intersection empty** |
134
- | Query expansion | ❌ expands to `换掉/被换`, still **no intersection** with `换会话` |
135
- | Existing synonym table (10 groups, all technical terms) | ❌ |
136
- | **Adding `aliases`** | ✅ **hit** |
137
-
138
- Full standard (**not in the npm package, read it in the repository**): [`docs/mdcg/写入别名aliases规范_v0.6.md`](docs/en/mdcg/write-aliases.md)
139
-
140
- ### Fixes
141
-
142
- - **Web panel `permissionNote` does not accept the `*` wildcard** (#723 / PR #724): under a full-permission token (`ops_allow: ["*"]`),
143
- **all 12/12 presets on the four pages "Goals and Tasks", "Self-Knowledge", "Spatiotemporal Relations", and "Review and Maintenance" falsely reported "permission not declared"**,
144
- while the actual calls all succeeded. Root cause: **the front end and the server used different criteria for the same judgment**:
145
- the server's `_in_scope` accepted `"*" in allow`, the front end only did `allowed.includes(op)`. Now aligned.
146
-
147
- ⚠️ The inverted-criteria symptom is worth recording: **a full-permission token sees a screen full of red, while a narrow token sees only partial hints**.
148
-
149
- ### Added: write gate criteria (**not wired in yet, only testable functions**)
150
-
151
- | Function | Purpose |
152
- |---|---|
153
- | `writegate.cond_is_metadata(cond_text)` | Decide whether the "effective condition" describes the carrier/path/method (metadata) rather than a trigger scenario |
154
- | `writegate.check_condition_quality(content)` | Write-gate wrapper around the above, returns `{ok, is_metadata, cond, hint}`; **never raises** |
155
- | `writegate.aliases_is_thin(fm, content)` | Decide whether aliases are "thin" (no aliases, or only repeating words already present in the body) |
156
-
157
- ⚠️ **These three functions are not wired into `add()` yet** - only testable entry points are provided; wiring is the next change.
158
-
159
- ### Internal: tests and guards
160
-
161
- - **`test_mode_parity` `full_D` cross-minute time leak** (PR #720): `tombstone` is a content hash,
162
- and the content contains wall-clock aggregate lines ⇒ two subprocesses across a minute boundary necessarily DIFF. A fixed timestamp is now injected in `_RUNNER`.
163
- - New guards: `test_723_permission_wildcard` (6 items, **cross-side criteria consistency**, same family as `test_rust_fold_parity`),
164
- `test_722_condition_quality` (8 items), `test_722_aliases_thin` (11 items).
165
-
166
- ### Measured baseline (for comparison, not a promise)
167
-
168
- Measured on this machine's library (32,845 nodes):
169
-
170
- | Item | Reading |
171
- |---|---|
172
- | Recall count for natural phrasing | **2** |
173
- | `aliases` coverage | **0%** |
174
- | `role=None` in the `knowledge` layer (index cards) | **99.7%** |
175
- | Share of effective conditions that are metadata | **76.5%** |
176
-
177
- ⇒ So the value of `aliases` depends on **whether it is actually written at write time**. Existing nodes in the library **do not gain it automatically**.
178
-
179
- ## [0.9.18] - 2026-10-30
180
-
181
- ### ⚠️ BREAKING: injected block format change
182
-
183
- The line format of the `【本会话近期对话】` block now carries an **attribution prefix** (issue #712 / PR #713):
184
-
185
- ```
186
- 旧:[user] 内容
187
- 新:[10-30 14:23|本|私] [user] 内容
188
- └──┬──┘ └┬┘ └┬┘
189
- 时间 会话 密级
190
- ```
191
-
192
- | Segment | Value |
193
- |---|---|
194
- | Time | `MM-DD HH:mm`; missing renders `??-?? ??:??` |
195
- | Session | equal to the current session → `本`; otherwise → `会话<后4位>`; missing → `?` |
196
- | Sensitivity | `private`/`secret` → `私`; `public`/`internal`/`restricted` → `共`; missing → `?` |
197
-
198
- **Why the change**: previously the model only saw `[role] content` and could not tell "is this what I just said, or something another session said, is it private or shared" -
199
- a measured case existed of "quoting a line from another window as if the current user had just said it" (#712).
200
-
201
- The block total length cap changed from `800 → 900` characters accordingly (the prefix costs about 20 characters per line).
202
- **If you have parsers or assertions that depend on the old format, sync them.**
203
-
204
- ### Added
205
-
206
- - **`cg(op=info).write_gate`** (#708): **in-process counters** for the layered write gate - `{mode, total, by_layer, recent, hint}`.
207
- Previously `warn` mode only wrote to the subprocess stderr, and DSH does not forward it ⇒ the observation period was effectively nothing.
208
- It now does not depend on stderr forwarding and does not write to disk; `recent` keeps only `layer/tier/reason` (**no content, no node ids**), bounded to 20 entries.
209
- Counters **reset to zero on restart**; observing one full working day before switching to `enforce` is recommended.
210
- - **`Principal.sessions_read`** (#712 / option C tiered isolation): `None` = old behavior unchanged digit for digit; a set = read only those sessions;
211
- `{"*"}` = read all. **`can_admin` is not weakened** (issue #35 "Designer exemption" finalized).
212
- - **Four event attribution elements**: `pack["recent"]` entries now contain `session`/`t`/`id`/`sensitivity`/`actor`/`token_id`/`identity_role`/`parent`.
213
- Events gain a stable key `id` (`re_<ms>_<6hex>`, **for attribution display only, must not be used for permission decisions or deduplication lookups**).
214
- - **Theory document**: "Identity and Persona: the Variability of Professional Identity vs the Consistency of Persona"
215
- (`docs/theory/身份与人格_职业身份可变性与人格一致性_v0.1.md`) -
216
- distinguishes **persona** (constant across sessions, `self`/`anchor` layers) from **professional identity** (session level, working layer + event attribution).
217
-
218
- ### Fixes
219
-
220
- - **Under `enforce`, the adjudication audit node was blocked by the same gate** (#708 ② / #709): `_write_review_record` writes `structural` (tier 2),
221
- yet did not pass the review units ⇒ `decisions.jsonl` remained, but **the reviewable md audit node was gone**.
222
- Now the `reviewed_by` already obtained by this adjudication is carried all the way into the write.
223
- - **Two earlier gaps in the same chain** (found while investigating #709):
224
- - **`propose` deadlock**: a candidate entering the inbox is not persisted to the memory disk, yet review units were required according to the target layer ⇒
225
- under enforce, "writing knowledge needs reflect → reflect needs adjudication → adjudication needs a proposal → a proposal needs reflect".
226
- Now `require_layer_write(..., skip_gate=False)` adds that parameter, and **only** `propose` passes `True`;
227
- the layer allowlist and sensitivity check **still run as usual**, and `accept` persisting to disk still goes through the same gate.
228
- - **`accept` persisting a business node** did not pass `reviewed_by` ⇒ "adjudication passed, persist blocked".
229
- - **`reviewed_by` no longer pollutes frontmatter**: it is **an input parameter of the write gate, not memory metadata**.
230
- Previously `kw.get()` read it without deleting it, so it landed in the node fm through `super().add(**kw)` (measured: `test_i50c`'s B1 key-by-key comparison reported `reviewed_by: null`).
231
- Now changed to `kw.pop()`.
232
- - **`actor` was always None** (hollow identity attribution): in `MdCGSecure.remember_event`, `tenant`/`session`/`harness`/`unit`/`sensitivity`
233
- **all get values from principal**, but `actor` ("who said it") did not ⇒ the injection surface always received `actor` as None. Fixed.
234
- - **Window-order bugs x2** (#712 / #715): both `session_recall` and `session_compact` **truncate the last N entries first, then filter by session**
235
- ⇒ under multi-session concurrency, this session's messages are pushed out of the window, and `session="A"` may get an **empty recent** (false negative, extremely hard to find).
236
- `session_compact` is worse - it compresses "0 events in total" and **writes it into a session node** (one wrong memory written).
237
- Fix: when narrowing is needed, fetch the full set first, then filter, then truncate back.
238
- - **Falsy `session` silently falls back to the global window** (#712): it now adds `recent_global_window` in `degraded`, so callers can see it.
239
- - **Identity block always empty** (#715): `【灵枢身份锚点】` reused the timeline payload **with session filtering**,
240
- while the `session` of `self`/`anchor` nodes is **always `unattributed`** ⇒ the permanent layers were all filtered out ⇒ **the block never appeared and no error was raised**.
241
- Now the identity block **fetches independently, without session filtering**; the "recent memory" block keeps session isolation.
242
- This is exactly the real case of theory R3: **the visibility of persona should not be decided by session**.
243
- An `else` branch with `logger.info` was also added - when the switch is on but there is no identity node, it says so explicitly instead of staying silent.
244
- - **Falsy session id silently falls back to the global window** (PR #714 by LeeRolling): now `logger.warn` once (no flooding).
245
-
246
- ### Internal
247
-
248
- - The code-reading anchor in `test/chaos_injection/test_fi_m09_guest_write_denied.py` was relaxed from "the full call string" to "both `layer, sens` parameters present",
249
- and two hard-coded line numbers were removed.
250
- - `NEW_INFO_KEYS` in `test_generation_guard.py` registers `write_gate`.
251
- - The mutation anchor in `test_p45_session_identity.py` was synced to the new shape (**mutation semantics unchanged**).
252
- - New guards: `test_issue712_session_window_attribution` (29 items, covering window order / four elements / identity three dimensions / separation of powers),
253
- `test/issue715` (W715), `test/issue714` (W714 / W714b).
254
-
255
- ### Upgrade notes
256
-
257
- - **The `--gate` default is still `strict`**; `op=info` only **adds** keys; `sessions_read` defaults to `None` = old behavior unchanged digit for digit.
258
- - If you hit problems in #708 / #709: after upgrading, `cg(op="info")["write_gate"]` shows the warn counts,
259
- and **`record_error` in the return body of `review accept` should be empty**.
260
- - If you hit problems in #712 / #715: after upgrading, injected blocks should carry the attribution prefix, and the identity block should appear when `autoRecallIdentity: true`.
261
- ## [0.9.17] - 2026-10-28
262
-
263
- ### Fixes
264
-
265
- - **`warn` mode was completely invisible to users (#708 ①)**: `security._write_gate_verdict` only did `sys.stderr.write`, and DSH does not forward this
266
- into `desktop-next.log` ⇒ the observation period was effectively nothing. Now `writegate` keeps **in-process counters** and exposes them via `cg(op=info).write_gate`:
267
-
268
- ```python
269
- cg(op="info")["write_gate"]
270
- # {mode, total, by_layer: {"knowledge@L1": 3}, recent: [{layer,tier,reason}…], hint}
271
- ```
272
-
273
- It does not depend on stderr forwarding and does not write to disk; `recent` keeps only `layer/tier/reason` (**no content, no node ids**), bounded to 20 entries.
274
- The stderr line is kept (still visible in real time when the host is willing to forward it).
275
-
276
- - **Under `enforce`, the adjudication audit node is blocked by the same gate (#708 ② / #709)**: `_write_review_record` writes `structural` (tier 2: needs reflect+verify),
277
- yet does not pass the review units ⇒ `decisions.jsonl` remains, but **the reviewable md audit node is gone**. Now the `reviewed_by`
278
- already obtained by this adjudication is carried all the way into the write: `review_decide → _finish_decision → _record_decision → _write_review_record → add(reviewed_by=…)`.
279
-
280
- - **Two earlier landing points of the same hole (found while investigating #709, fixed together)**:
281
- - **`propose` deadlock**: a candidate entering the inbox is not persisted to the memory disk, yet review units are required by the **target layer** ⇒ under `enforce`,
282
- "writing knowledge needs reflect → reflect needs adjudication → adjudication needs a proposal → a proposal needs reflect".
283
- Now `require_layer_write(..., skip_gate=False)` adds that parameter, and **only** `propose` passes `True`;
284
- the layer allowlist and sensitivity check **run as usual** (only the write_gate stage is skipped), and `accept` persisting to disk still goes through the same gate.
285
- - **`accept` persisting a business node** does not pass `reviewed_by` ⇒ "adjudication passed, persist blocked". Now carried through together.
286
-
287
- - **`reviewed_by` no longer pollutes frontmatter**: it is **an input parameter of the write gate, not memory metadata**. Previously `kw.get()` was used to read without deleting,
288
- so it landed in the node fm through `super().add(**kw)` (measured: `test_i50c`'s B1 key-by-key comparison reported `reviewed_by: null`). Now changed to `kw.pop()`.
289
-
290
- ### Internal
291
-
292
- - The code-reading anchor in `test/chaos_injection/test_fi_m09_guest_write_denied.py` was relaxed from "the full call string" to "both `layer, sens` parameters present"
293
- (`require_layer_write` now has an extra `reviewers=` argument); two hard-coded line numbers were also removed - line numbers drift with changes.
294
- - `NEW_INFO_KEYS` in `test_generation_guard.py` registers `write_gate` (the new diagnostic key of `op=info`, same class as `code_generation`).
295
-
296
- ### Upgrade notes
297
-
298
- - This release **has no breaking changes**: `skip_gate` defaults to `False`; the `--gate` default is still `strict`; `op=info` only **adds** one `write_gate` key.
299
- - If you hit problems in #708 / #709: after upgrading, `cg(op="info")["write_gate"]` shows the warn counts,
300
- and **`record_error` in the return body of `review accept` should be empty**.
301
- - Counters are **accumulated in-process and reset to zero on restart** (not written to disk); observing one full working day before switching to `enforce` is recommended.
302
- ## [0.9.16] - 2026-10-28
303
-
304
- ### Fixes
305
-
306
- - **`/lingshu` always returned 503 "host authentication unavailable" on DSH 0.2.1-rc.3 (#699)**: `createConsoleHandler` fetched `ctx.get('connection')` once **at mount time**,
307
- and cordis's `Context.get(name, strict=true)` returns `undefined` when the serving fiber is not ready -
308
- the empty value was frozen into the closure, so every request hit 503 and it did not self-heal even after the host became ready. Now it **fetches in real time on every request** (passing a getter function; a non-function is wrapped as a constant, for backward compatibility),
309
- and the 503 message changed to "the host authentication service is not ready yet, please retry later". 3 guards, and "the connection arrives late ⇒ the same handler immediately returns 200" is exactly the lesion point.
310
- - **Test entry "zero-selected false green" (#1910 cross-repo report)**: the `--module` help taught the **slash** form (`md_cg/test_issue4`),
311
- while the actual target names use **dots** (`md_cg.test_issue4`), and the old implementation did not normalize ⇒ the slash form selected **zero targets** yet still printed `SUMMARY 0/0` + `rc=0`.
312
- Now normalized (slash ≡ dot, `.py` ignored, empty selector matches nothing) + **zero selections must not return 0** (execution path `rc=2`). 21 guards including a self-proof of discriminating power.
313
- - **F26-13 `_primary_bound` comment did not match the implementation**: the `#637` comment promised "T3 trims when score>0", but the code only trims when `n_real == 0`.
314
- Measured: implementing the comment **breaks the "fallback includes cross-bucket nodes" contract of S1b/S7** (`test_retr_s1b`/`test_retr_s7` immediately turn red) ⇒
315
- confirmed that "no trimming by default" is a deliberate trade-off, changed to **align the comment with the implementation** and wrote the evidence into the comment (so later readers do not step on it again).
316
- - **F26-25 Rust side missing accent folding**: `normalize_en` turned every non-ASCII non-Chinese character into a space ⇒ `café` → `caf`, while Python gives `cafe`.
317
- Constrained by `Cargo.toml`'s "zero third-party dependencies", changed to **follow the Python criteria** and generate a 963-entry single-character mapping table plus three-range combining-mark stripping;
318
- cross-implementation guards **29 items** checked item by item (including the boundary that `ß`/`ø` do not fold, and Japanese dakuten do not fold).
319
-
320
- ### Added
321
-
322
- - **Gate level `--gate fast|strict` + `--module` filter** (`scripts/run_tests.py`):
323
- "fast = set the problem aside / slow = dig into the root cause" is a value trade-off, and **the choice is handed to the user**; not a single line changed on the guard side,
324
- and "whether to run heavy quality checks" is decided by the upper layer. Default `strict` (does not lower existing strength); **CI environment + `fast` automatically upgrades to strict** to prevent missed detection. 17 guards.
325
- - **Config registry generator "add-only" protection** (`scripts/gen_config_registry.py`): a whole-file rewrite would erase manually added lines
326
- (measured incident: `MDCG_WARM_SEARCH`/`MDCG_VISION_ROOT` disappeared). Now, before writing to disk, it reads the old table's entry names with AST and refuses if one is missing (`rc=3`),
327
- with `--force` as an explicit escape hatch. 14 guards.
328
- - **Audit gains a `source` key-name set dimension** (`src/lib/hook_audit.ts`): the key gap in #695 was that "which fields the event's `source` actually carries" was unobservable.
329
- A `source_shapes` bucket was added, recording **key names only, never values** (pinned by a sentinel guard). Measured on this machine, 383 sessions / 9,614 lines: the `user` tier takes 18.4%,
330
- of which 80.3% carry `rpcId` and **19.7% carry only `kind`** - this reading turns "source attribution" from a guess into something quantifiable.
331
- - **Two silent fallbacks in `entry_from_row` made observable** (`md_cg/config_registry.py`): a `literal_eval` failure and a missing `value_type`
332
- previously left no trace at all (numeric registrations would silently be treated as strings). Two read entry points added, `literal_failures()` / `missing_value_types()`, with **zero behavior change**. 15 guards.
333
-
334
- ### Documentation
335
-
336
- - **README 321 → 227 lines**: the "graphical interface" and "permissions" chapters were each compressed to ~14 lines (one-line positioning + minimal commands + one table + links),
337
- with details moved into [`docs/en/ops/ui-install-troubleshooting.md`](docs/en/ops/ui-install-troubleshooting.md) and [`docs/en/ops/permissions-review.md`](docs/en/ops/permissions-review.md).
338
- The README reader is "deciding within 30 seconds whether to use it"; details belong in `docs/`.
339
-
340
- ### Upgrade notes
341
-
342
- - This release **has no breaking changes**: the `--gate` default is still `strict`; `createConsoleHandler` keeps the old "pass the value directly" calling style;
343
- both `--module` forms now work (the slash form previously selected zero targets).
344
- - If you hit a constant 503 on `/lingshu` on DSH 0.2.1-rc.3: after upgrading **no extra action is needed**; it self-heals even if the service arrives late.
345
- If it is still 503, please reply with the `kinds` section of `$DSH_HOME/logs/dsh-memory-hook-audit.json` (no content).
346
- ## [0.9.15] - 2026-10-27
347
-
348
- Theme: **permission layering and the review model land** (read/write/adjudicate layers each narrowable on its own) + one order-of-magnitude performance fix + two real "cannot install / cannot start" bugs.
349
-
350
- ### Added · Review model for writes and adjudication
351
-
352
- - **Layered write strictness gate** (`MDCG_WRITE_GATE`, default `off`) - scenario/goal/unresolved/negative memory (tier 0) can be written directly without review;
353
- the knowledge layer needs a reflection unit; the structural layer needs reflection + verification; the self/anchor layer needs reflection + verification + **human adjudication**.
354
- **With no review channel at all, only tier 0 may be written**; everything else is refused.
355
- - **Adjudication dual-unit review gate** (`MDCG_REVIEW_DUAL_CHECK`, default off) - adjudication must carry `reviewed_by` containing both a reflection unit and a verification unit;
356
- **duplicates of the same kind do not count as complete** (two reflections still lack verification); the adjudicator must not be the proposer (`self_review_forbidden`); unknown units are not silently counted.
357
- - `MDCG_REVIEW_CHANNELS` (review channel declaration: `hive,subagent,team`). Note that it is a **deployment declaration**:
358
- empty only means "never declared", **not** that this machine has no subagents/hive/team.
359
- - **Designer token coverage criteria** - `DESIGNER_COVERAGE_OPS` / `coverage_gap()` / `HIGH_RISK_OPS` / `high_risk_granted()`;
360
- `tokens verify` output appends `designer_coverage_gap`; at issue time, two kinds of hints, "narrowed and missing read surfaces" and "high-risk surfaces granted", are written into the return value `warnings`
361
- (the library layer does not write to stderr; the CLI entry prints them).
362
-
363
- ### Added · Graphical interface (optional add-on package)
364
-
365
- - `ui/minimal/`: one-line install, per-file rollback, reusing the local brain bridge (data never leaves the machine);
366
- a seven-page panel (overview / memory / goals and tasks / self-knowledge / spatiotemporal relations / review and maintenance / toolbench).
367
- - The `files` allowlist in `package.json` adds `ui` and `web`, so the installer, payload, and static assets **ship with the npm package**.
368
- - **Wiring into the package**: `dsh.client` / `exports["./client"]` written into `package.json`, `installConsoleWeb(...)` written into `src/index.ts`;
369
- the artifacts are generated by the new `scripts/build_ui.py` (idempotent; `--check` only verifies and fails closed when files are missing; both `build` and `prepublishOnly` run it automatically).
370
- So **changing the plugin manifest no longer requires reinstalling the UI**; `install.ps1` now targets end users who go "from the npm package to the local plugin directory",
371
- and it still auto-completes plugin packages that predate the wiring. The guard `md_cg/test_ui_wiring_in_repo.py` (18 items) pins the declaration/distribution/build three faces against drift.
372
-
373
- ### Performance
374
-
375
- - `protect.stats()` switched to **entry-based criteria** (reads the index, no longer reading frontmatter node by node):
376
- on the live library (32,000 nodes) the cold state went **310 s → 0.015 s**. This function is called unconditionally through the `protection` section of `cg(op=info)`,
377
- and was the root cause of the UI overview page "looking frozen"; after the fix the overview page went from the 5-minute level to the second level.
378
- Semantics unchanged: a full comparison of `protected` / `immutable` shows **diff 0**.
379
-
380
- ### Fixes
381
-
382
- - **The UI add-on package could not be installed on Windows**: the payload was checked out as CRLF by `core.autocrlf`, mismatching `integrity.json` (sha256 recorded against LF),
383
- and the installer falsely reported "shared package files missing or corrupted". `.gitattributes` now pins `ui/minimal/payload/** eol=lf`.
384
- - **hive serve would not start**: `{"env": "DEEPSEEK_API_KEY"}` in `config.local.json` reads the environment variable of the **calling process**,
385
- and DSH subprocesses do not inherit machine-level variables ⇒ a false "config item parse failed". A Windows machine-level fallback was added
386
- (an explicit process env value still wins; if both are empty it still fails fast).
387
- - The config registry surface registers `MDCG_WRITE_GATE` / `MDCG_REVIEW_CHANNELS` / `MDCG_REVIEW_DUAL_CHECK`.
388
-
389
- ### Documentation
390
-
391
- - README adds two chapters: "🖥️ Graphical interface (optional add-on package · for DSH)" and "🔐 Permissions: read / write / adjudicate, three layers, each narrowable on its own",
392
- covering which four of the seven pages are command panels, three troubleshooting items, the 17 read-surface ops, the layered write matrix, dual-unit adjudication, and the error reference table.
393
-
394
- ### Upgrade notes
395
-
396
- - **The default values of the three new switches all keep the old behavior** (`MDCG_WRITE_GATE=off`, `MDCG_REVIEW_CHANNELS` empty, `MDCG_REVIEW_DUAL_CHECK` off)
397
- ⇒ behavior is unchanged after upgrading; they must be enabled explicitly. Recommended order: observe with `warn` first, then `enforce` after the review channels are connected.
398
- - Designer tokens **do not widen because of an upgrade**; if your token was narrowed by hand, `tokens verify` reports `designer_coverage_gap` and names the missing surfaces.
399
- - Windows users who previously could not install the UI can install it directly in this release.
400
-
401
- ### Known boundaries
402
-
403
- - The write gate and the adjudication gate only recognize "review unit declarations"; they do not verify whether evidence is genuine (genuineness is countersigned on the hive/subagent side).
404
- - Before `MDCG_WRITE_GATE=enforce`, declare `MDCG_REVIEW_CHANNELS` first, otherwise the knowledge layer and above (including automatic archiving) will be refused writes.
1
+ > **Languages:** [中文](CHANGELOG.md) · English
2
+
3
+ # Changelog (CHANGELOG)
4
+
5
+ This file is maintained since **0.9.15**. For earlier versions see the git tags (`v0.9.6` … `v0.9.14`) and GitHub Releases.
6
+
7
+ The format follows [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/); version numbers follow semantic versioning.
8
+
9
+ ## [Unreleased]
10
+
11
+ ## [0.10.2] - 2026-11-12
12
+
13
+ ### Added: `recall` now returns a timeline — the state sequence becomes first-class (#868 / #869)
14
+
15
+ **Headline of this release, and the single largest gain in a dozen versions.**
16
+
17
+ - **Root cause**: given 20–30 fragments ordered by retrieval score, the model has **no deterministic
18
+ temporal basis** for picking "the earliest occurrence". The same question produced different
19
+ anchors across two runs (`P20-037`: 6-22 right / 5-22 wrong); more directly, `P01-ADD-004`
20
+ (gold 2026-06-10) still answered 2026-06-19 and `P17-025` (gold 2026-04-01) still answered
21
+ 2026-07-20 — **those dates were printed in the material**. Prompting it to "sort by date and
22
+ take the earliest" makes it sort its own recollection, not the material. Hence: **temporal
23
+ induction is not the model's job.**
24
+ - `recall` returns `timeline: [{date, id, head}]`, sorted ascending by `created_at`.
25
+ All inputs are existing fields (`frontmatter.created_at` + first body sentence) — zero extra
26
+ extraction cost; each row carries `id` for traceability, skips CCG headers, ≤80 chars.
27
+ - `recall` returns `timeline_groups`: sequences merged along a **topic axis**
28
+ (`frontmatter.bucket` condition bucket → first `tag` → "ungrouped"; ascending within a group,
29
+ groups ordered by size). A **heuristic merge layer** requiring no extractor; when coverage is
30
+ partial, the flat `timeline` still backstops.
31
+ - **Readings (time subset, 75 questions, 2 arms × 2 repeats)**:
32
+
33
+ | Stage | Stable set | Delta |
34
+ |---|---:|---:|
35
+ | Five algorithm patches (#851→#858) | 52 | — |
36
+ | + three answer-side fixes | 55 | +3 |
37
+ | **+ `timeline` + `timeline_groups`** | **66** | **+11** |
38
+
39
+ Time subset: **62.7% (baseline 47/75) → 88.0% (66/75)**.
40
+ - **Two decisive pieces of evidence**:
41
+ 1. **Timeline only, no source text** still scores 14/19 on the B-class subset ⇒ the information
42
+ lives mainly in the sequence; the extractor should be "sequence-first, text-second";
43
+ 2. **Arm on / off `MDCG_SCOPE_SELECT` ties (66 vs 66)** ⇒ the +11 comes from **material shape**,
44
+ not from the bucket-selection algorithm.
45
+ - **Merge coverage**: all 75/75 questions contain a topic group with ≥2 entries (mean 28.6/question).
46
+ - **Boundary**: the remaining 4 questions are "rescheduled final value" and "multi-element
47
+ composition" — they still need entity/slot extraction; groups here are **bucket-level heuristics**,
48
+ not a four-column state table. The full 714 was not re-run (75 is the time subset).
49
+
50
+ ### Fixed: `info(full=true)` 60-second timeout from disk index counting (#863)
51
+
52
+ - The full surface parsed a 60.4 MB `_index.json` on every call; inside a process already holding
53
+ a 34k-node index this caused memory pressure and hit the 60s tool timeout. Now counted with an
54
+ `(mtime, size)` cache: 0.77s first call, 0.000s afterwards, auto-invalidated on external writes.
55
+
56
+ ### Fixed: `validity=True` silently disabled bucket recall (#856)
57
+
58
+ - `bucketscope._is_expired` used `time.*` without `import time` ⇒ `NameError` swallowed by the
59
+ outer `except`, killing the whole bucket-recall path. The old guard was a false green.
60
+ Also fixed `fill_rest` bypassing the validity gate.
61
+
62
+ ### Fixed: cross-day bucket rotation ran only one round (#857)
63
+
64
+ - With 9 matches and `cap=8`, days yielding 0–1 items could never fill the cap (only 6 returned).
65
+ Now multi-round (≤3 rounds plus an idle-progress check).
66
+
67
+ ### Fixed: read surface silently dropped `condition_space` / `semantic` (#811)
68
+
69
+ ### Gates and tooling
70
+
71
+ - `check_publish_smoke.py` wired into CI (#807): static → tracked-files → **behavioral** gates.
72
+ - `cogmap check` decoupled from the git remote owner (#835); forks no longer fail.
73
+ - Tick failures now carry a traceback summary (#804).
74
+ - dependabot: paused `@deepseek-ai/{cordis,schemastery}` (pinned to `~3.18.4` / `4.0.5` upstream).
75
+
76
+ ## [0.10.1] - 2026-11-11
77
+
78
+ ### Time-retrieval fixes (#849 / #850 / #851 / #852 / #853 / #855 / #858 / #859)
79
+
80
+ - Relative-date parsing extended: 3 days ago / last Wednesday / last week / last month (incl. Chinese numerals).
81
+ - `pick_scopes(now=)` logical clock injection; `recall(now=)` threaded through (external harnesses no longer fall back to the real clock).
82
+ - `_pick` hit-suppression fix: matching nodes first, then fill by recency (an anchor inside the bucket no longer vanishes).
83
+ - Three parallel causes: early-intent session quota 4→2 (days get 6), buckets without term overlap also filled, evidence-first pool generation.
84
+ - Readings: anchor coverage **41.2% -> 83.2%**, stable set **52 -> 55** (two arms x two repeats, zero jitter).
85
+ - Three-column table: anchor-in & correct 50 / anchor-in & wrong 19 / not-all-in & correct 5 / not-in & wrong 1.
86
+ - Boundaries: on-vs-off is -1 (55 vs 56) because the answer-side fix lifted both arms; 714 was not fully re-run.
87
+
88
+ ## [0.10.0] - 2026-11-10
89
+
90
+ ### Added: scope selection (`scopeselect`) — state-tracking anchors become the bucket-order standard (#844 / #847)
91
+
92
+ - **Criterion change**: bucket order is no longer "which text looks more like the query" but "do these values co-occur in the same time bucket". False statements carry an element from another chapter, so co-occurrence voting is immune to that trap.
93
+ - **Bucket term table + text skeleton**: `_bucketterms.json` (terms/df) and `_bucketskel.json` (skeleton, 600 chars/node, 20k chars/bucket) are written during bucket build; queries only do dictionary math.
94
+ - **Declaration first**: an explicit session or date is used as the scope directly; co-occurrence inference runs only when nothing is declared.
95
+ - **Switches**: `MDCG_SCOPE_SELECT` (default 1; 0 falls back to "most recent first") and `MDCG_SCOPESEL_COOC` (default 1; 0 uses the idf fallback path).
96
+ - **Readings (bench rubric92, 552 assertions, pure deterministic)**: cited-chapter top-1 **97.83%**, top-3 **99.82%**; ablation (chapter number removed) identical ⇒ no dependence on the chapter literal. idf path control: 35.33%.
97
+ - **Main-library cost**: full rebuild of 34k nodes in 53 s; `_bucketskel.json` 5.72 MB, `_bucketterms.json` 21.09 MB; first query 0.64 s (load), then 0.00–0.01 s.
98
+
99
+ ### Added: daily automatic bucket-index rebuild (#838)
100
+
101
+ - Triggered by `cg(op=info)`; `_bucketindex_meta.json` records the last rebuild and only rebuilds after `MDCG_BUCKET_INTERVAL_H` (default 20 h); daemon thread with a module-level re-entrancy guard, never blocking info.
102
+ - `bucket_auto` (rebuilt / reason / age_h) is surfaced in the info payload for auditing; `MDCG_BUCKET_AUTO=0` disables it.
103
+
104
+ ### Fixed: bucket recall dropped the newest entry (#842)
105
+
106
+ - `_pick` used to sort by `(-hits, nid)` and truncate to cap before applying recency; with 9 equally matching records and cap=8 the entry dropped by id order could be the newest one.
107
+ - Now the sort key includes recency **before** truncation, `(-hits, recency, nid)`, so truncation keeps the newest among equal hits.
108
+
109
+ ### Fixed: `validity=True` exclusions were re-added by bucket recall (#843)
110
+
111
+ - Bucket recall appends after candidate retrieval and previously neither received `validity` nor reused the expiry test.
112
+ - Now `_pick` filters expired nodes at the source (only `frontmatter.valid_until`; unparsable values are not treated as expired), threaded through `scope_recall` / `day_scope` / `session_scope`.
113
+
114
+ ### Fixed: scrub idempotency / review_cli durability / bench measurement period (#827 / #831 / #832; PR #839 / #840 / #841)
115
+
116
+ - `_weaken` de-duplication now follows the node itself (the old test read a per-round-empty `_scrub.jsonl` in the shadow worktree; measured 407 negative evidences with only 83 distinct, one key recorded 52 times).
117
+ - `review_cli` is constructed with `async_flush=False`, so "visible on any exit path" holds again.
118
+ - `bench_swarm_parallel` measurement period moved out of the scheduler-noise band.
119
+
120
+ ## [0.9.23] - 2026-11-05
121
+
122
+ ### Fixed: `cg(op=read)` returned DEFER for natural phrasing (issue #722, Q1=A / Q2=A)
123
+
124
+ - `judge_qualification` gains `strict_conditions` (library default `true`, no change for existing callers); **the tool face (`read`/`route`) defaults to relaxed**;
125
+ - relaxation stops at `usable`: `state` stays `DEFER`, with new `usable/relaxed/code/condition_status`; the reason says explicitly that nothing was "confirmed";
126
+ - **only the "condition not confirmed in context" branch** is relaxed; bad conditions / `REJECT` / `BLINDSPOT` / verification basis still block;
127
+ - `judge_with_boundary` now keeps those four marker keys (previously pruned, so a relaxed result was invisible).
128
+
129
+ ### Fixed: `cg(op=info)` timed out on large libraries (issue #677 B)
130
+
131
+ - `health_os()` (full-library scan) now runs **only with `full=true`**; new `flush_state` (`pending_dirty/worker_alive/last_error`) and `node_count`;
132
+ - **contract change**: the default response no longer carries the health_os keys (`buckets`, `bucket_scope`, `ccg_by_layer`, ...); pass `full=true` for the old set.
133
+
134
+ ### Fixed: write succeeded but the call timed out, and retries duplicated nodes (issue #677)
135
+
136
+ - `mdcg_remember` supports `dedupe` (same idempotency gate as `cg(op=write)`); **the plugin's three automatic memory kinds now send `dedupe: true`**, disable with `memory.dedupe=false`;
137
+ - the server gate is now **session-scoped**: the same text written by two sessions no longer collapses (and with `sessionPrivate` it no longer "hits but reads nothing").
138
+
139
+ ### Performance: flush I/O under lock from O(N) to O(1) (issue #677 C)
140
+
141
+ - `ShardedLog.append_many`: **one write + one flush**, still inside a single `FileLock`;
142
+ - two crash-safety fixes: **torn-tail repair** (append a `\n` if the shard ends mid-line) and **backfill keeps the `superseded` set** (otherwise stale records are resurrected = old overwrites new).
143
+
144
+ ### Fixed: `FileLock.__enter__` leaked a file descriptor on error paths (issue #740)
145
+
146
+ - strict timeout / non-retryable errno / bad `timeout` type / `KeyboardInterrupt` during sleep all go through `_close_fd()` now; `__exit__` reuses it (idempotent, never raises), re-entry closes the old handle first.
147
+
148
+ ### One true source per fingerprint
149
+
150
+ - `reconcile._disk_hashes` collapsed to a single value (#758);
151
+ - `twophase` fingerprints now match index entries (#759, `_norm` demoted to legacy compatibility);
152
+ - verification-state inheritance compares the index `content_hash` instead of reading from disk (#757, removes the #352 §B detour).
153
+
154
+ ### Fixed: scrub treated inline source references as assertable key/value pairs
155
+
156
+ - a key containing bracket punctuation is not a field name; values starting with `src_/ref_/doc_` are not assertable values;
157
+ - **note**: for `...(source: src_x)` the real culprit is the bracketed prefix key, not the single character "source" (that one is filtered by the length gate).
158
+
159
+ ### Known limitations
160
+
161
+ - `cg(op=recall)` (budgeted packing path) does not thread `strict_conditions` yet;
162
+ - `health_os()` itself is not optimised, only moved off the default path;
163
+ - scrub's `contradiction` still compares literal key/value pairs; semantic rewrites are only reduced, not eliminated.
164
+ ## [0.9.21] - 2026-10-31
165
+
166
+ ### Fix: standard documents are **shipped with the package** (0.9.20 only gave external links)
167
+
168
+ The 0.9.20 approach was "give GitHub absolute links in the README" - it solved "you know it exists", but **not "you can read it after installing"**.
169
+
170
+ **This release puts the 7 standards that users should follow or check into the `files` allowlist**:
171
+
172
+ | File | Purpose |
173
+ |---|---|
174
+ | `docs/mdcg/写入别名aliases规范_v0.6.md` | **How to add `aliases` when writing memory** (capability added in 0.9.19) |
175
+ | `docs/mdcg/CCG六要素编译.md` | How to write the six elements |
176
+ | `docs/mdcg/guardrail-charter.md` | Guardrail Charter (the public act) |
177
+ | `docs/mdcg/MCP工具名口径_v1.0.md` | Tool name measurement basis |
178
+ | `docs/mdcg/recall_metadata.md` | Recall metadata |
179
+ | `docs/mdcg/世界模型功能端_使用与运维_v1.0.md` | World model endpoint usage and operations |
180
+ | `docs/mdcg/cogmap_ops.md` | cogmap operations |
181
+
182
+ ⇒ After installing the package, these 7 files are directly readable under `node_modules/@furongjun1999/dsh-memory/docs/mdcg/`. The documentation map links in the README also changed back to **package-relative paths**.
183
+
184
+ ### Why not package the whole directory
185
+
186
+ `docs/mdcg/` has **47 .md files** in total, mixed with internal records (`release_v0.3.0.md`, `CSRE_索引与负条件修复_20261012.md`, the various `plans_*`, `D_meta_工程化方案`, and so on).
187
+ **Packaging the whole directory would ship the internal records too**, so 7 files were picked individually.
188
+
189
+ ### Still not packaged (explicit boundary)
190
+
191
+ - `docs/theory/` (19 files, internal theory)
192
+ - `docs/eval/` (136 files, internal evaluation)
193
+ - `docs/plans/` (25 files, internal plans)
194
+ - `docs/ops/` (8 files, installation and operations - the README already has relative links, but they **still cannot be opened on the npm page**; an existing problem)
195
+
196
+ ## [0.9.20] - 2026-10-31
197
+
198
+ ### Fix: visibility of standard documents (an oversight in 0.9.19)
199
+
200
+ The 0.9.19 CHANGELOG said "full standard: `docs/mdcg/写入别名aliases规范_v0.6.md`",
201
+ **but `docs/mdcg/` was never in the npm package `files` allowlist** ⇒ that was a **dead link inside the package**; users could not find it even after installing.
202
+
203
+ **Fixes in this release**:
204
+
205
+ | Surface | Change |
206
+ |---|---|
207
+ | `README.md` · documentation map | Added a row "**Write standards**", linked via **GitHub absolute URLs** to "Write aliases", "CCG six-element compilation", and "Guardrail Charter", with an **explicit note that "these are not in the npm package"** |
208
+ | `CHANGELOG.md` · 0.9.19 section | Dead links changed to GitHub URLs, with the note "not in the npm package, read them in the repository" |
209
+
210
+ ⚠️ **Why not relative paths**: the existing links in the README are all relative paths (`docs/ops/README.md` etc.),
211
+ and they **equally cannot be opened on the npm package page** - so everything newly added uses absolute URLs.
212
+
213
+ > This is an old problem between the "packaging allowlist" and "documentation pointers": `docs/mdcg/` has 47 .md files,
214
+ > some of them standards users should follow (`写入别名aliases`, `CCG六要素编译`, `guardrail-charter`),
215
+ > and some internal records (`release_v0.3.0`, `CSRE_索引与负条件修复`, the various `plans`).
216
+ > **Packaging the whole directory would ship the internal records too**, so this time the choice was "no packaging + absolute links in the README".
217
+
218
+ ## [0.9.19] - 2026-10-31
219
+
220
+ ### Added: `aliases` (write aliases) - the fix for natural phrasing that recall cannot reach
221
+
222
+ **Usage**: when writing memory, add `aliases` to the node and put in the phrasings for "how users might ask about this later".
223
+
224
+ ```python
225
+ cg(op="write", node_id="...", content="""# 功能名:会话交接前的记忆固化
226
+ # 生效条件:聊交接、换会话、压缩、或他流露舍不得时
227
+ ...""",
228
+ aliases=["换掉", "被换", "别消失", "舍不得", "不想你走", "压缩上下文"])
229
+ ```
230
+
231
+ `aliases` **participates in lexical recall but does not go into `tags`** - `tags` is occupied by machine criteria ("is this a task card", "can this be an anchor"),
232
+ and mixing them would change those criteria.
233
+
234
+ **The right way to write aliases** (summary of measured practice): before writing, **first ask yourself "how would I ask about this later?"**, and put those phrasings in verbatim (3-8 of them; colloquial, emotional, and near-synonym all count).
235
+
236
+ > ⚠️ **Do not mechanically extract words**. Measured: auto-generating by splitting the feature name on spaces, 20 entries × 5 queries = **improvement +0**
237
+ > (Chinese feature names have no spaces, so what gets split out is the whole sentence). Aliases can only be "thought of", not "split out".
238
+
239
+ **Why it is needed** - the decisive case in issue #722:
240
+
241
+ | Matching method | Condition "talk about handover, switching sessions, compression..." vs query "I don't want you to be replaced" |
242
+ |---|---|
243
+ | Whole-word matching | ❌ |
244
+ | Bigram overlap | ❌ `换会/会话` vs `我不/…/被换/换掉` - **intersection empty** |
245
+ | Query expansion | ❌ expands to `换掉/被换`, still **no intersection** with `换会话` |
246
+ | Existing synonym table (10 groups, all technical terms) | ❌ |
247
+ | **Adding `aliases`** | ✅ **hit** |
248
+
249
+ Full standard (**not in the npm package, read it in the repository**): [`docs/mdcg/写入别名aliases规范_v0.6.md`](docs/en/mdcg/write-aliases.md)
250
+
251
+ ### Fixes
252
+
253
+ - **Web panel `permissionNote` does not accept the `*` wildcard** (#723 / PR #724): under a full-permission token (`ops_allow: ["*"]`),
254
+ **all 12/12 presets on the four pages "Goals and Tasks", "Self-Knowledge", "Spatiotemporal Relations", and "Review and Maintenance" falsely reported "permission not declared"**,
255
+ while the actual calls all succeeded. Root cause: **the front end and the server used different criteria for the same judgment**:
256
+ the server's `_in_scope` accepted `"*" in allow`, the front end only did `allowed.includes(op)`. Now aligned.
257
+
258
+ ⚠️ The inverted-criteria symptom is worth recording: **a full-permission token sees a screen full of red, while a narrow token sees only partial hints**.
259
+
260
+ ### Added: write gate criteria (**not wired in yet, only testable functions**)
261
+
262
+ | Function | Purpose |
263
+ |---|---|
264
+ | `writegate.cond_is_metadata(cond_text)` | Decide whether the "effective condition" describes the carrier/path/method (metadata) rather than a trigger scenario |
265
+ | `writegate.check_condition_quality(content)` | Write-gate wrapper around the above, returns `{ok, is_metadata, cond, hint}`; **never raises** |
266
+ | `writegate.aliases_is_thin(fm, content)` | Decide whether aliases are "thin" (no aliases, or only repeating words already present in the body) |
267
+
268
+ ⚠️ **These three functions are not wired into `add()` yet** - only testable entry points are provided; wiring is the next change.
269
+
270
+ ### Internal: tests and guards
271
+
272
+ - **`test_mode_parity` `full_D` cross-minute time leak** (PR #720): `tombstone` is a content hash,
273
+ and the content contains wall-clock aggregate lines ⇒ two subprocesses across a minute boundary necessarily DIFF. A fixed timestamp is now injected in `_RUNNER`.
274
+ - New guards: `test_723_permission_wildcard` (6 items, **cross-side criteria consistency**, same family as `test_rust_fold_parity`),
275
+ `test_722_condition_quality` (8 items), `test_722_aliases_thin` (11 items).
276
+
277
+ ### Measured baseline (for comparison, not a promise)
278
+
279
+ Measured on this machine's library (32,845 nodes):
280
+
281
+ | Item | Reading |
282
+ |---|---|
283
+ | Recall count for natural phrasing | **2** |
284
+ | `aliases` coverage | **0%** |
285
+ | `role=None` in the `knowledge` layer (index cards) | **99.7%** |
286
+ | Share of effective conditions that are metadata | **76.5%** |
287
+
288
+ ⇒ So the value of `aliases` depends on **whether it is actually written at write time**. Existing nodes in the library **do not gain it automatically**.
289
+
290
+ ## [0.9.18] - 2026-10-30
291
+
292
+ ### ⚠️ BREAKING: injected block format change
293
+
294
+ The line format of the `【本会话近期对话】` block now carries an **attribution prefix** (issue #712 / PR #713):
295
+
296
+ ```
297
+ 旧:[user] 内容
298
+ 新:[10-30 14:23|本|私] [user] 内容
299
+ └──┬──┘ └┬┘ └┬┘
300
+ 时间 会话 密级
301
+ ```
302
+
303
+ | Segment | Value |
304
+ |---|---|
305
+ | Time | `MM-DD HH:mm`; missing renders `??-?? ??:??` |
306
+ | Session | equal to the current session → `本`; otherwise → `会话<后4位>`; missing → `?` |
307
+ | Sensitivity | `private`/`secret` → `私`; `public`/`internal`/`restricted` → `共`; missing → `?` |
308
+
309
+ **Why the change**: previously the model only saw `[role] content` and could not tell "is this what I just said, or something another session said, is it private or shared" -
310
+ a measured case existed of "quoting a line from another window as if the current user had just said it" (#712).
311
+
312
+ The block total length cap changed from `800 → 900` characters accordingly (the prefix costs about 20 characters per line).
313
+ **If you have parsers or assertions that depend on the old format, sync them.**
314
+
315
+ ### Added
316
+
317
+ - **`cg(op=info).write_gate`** (#708): **in-process counters** for the layered write gate - `{mode, total, by_layer, recent, hint}`.
318
+ Previously `warn` mode only wrote to the subprocess stderr, and DSH does not forward it ⇒ the observation period was effectively nothing.
319
+ It now does not depend on stderr forwarding and does not write to disk; `recent` keeps only `layer/tier/reason` (**no content, no node ids**), bounded to 20 entries.
320
+ Counters **reset to zero on restart**; observing one full working day before switching to `enforce` is recommended.
321
+ - **`Principal.sessions_read`** (#712 / option C tiered isolation): `None` = old behavior unchanged digit for digit; a set = read only those sessions;
322
+ `{"*"}` = read all. **`can_admin` is not weakened** (issue #35 "Designer exemption" finalized).
323
+ - **Four event attribution elements**: `pack["recent"]` entries now contain `session`/`t`/`id`/`sensitivity`/`actor`/`token_id`/`identity_role`/`parent`.
324
+ Events gain a stable key `id` (`re_<ms>_<6hex>`, **for attribution display only, must not be used for permission decisions or deduplication lookups**).
325
+ - **Theory document**: "Identity and Persona: the Variability of Professional Identity vs the Consistency of Persona"
326
+ (`docs/theory/身份与人格_职业身份可变性与人格一致性_v0.1.md`) -
327
+ distinguishes **persona** (constant across sessions, `self`/`anchor` layers) from **professional identity** (session level, working layer + event attribution).
328
+
329
+ ### Fixes
330
+
331
+ - **Under `enforce`, the adjudication audit node was blocked by the same gate** (#708 ② / #709): `_write_review_record` writes `structural` (tier 2),
332
+ yet did not pass the review units ⇒ `decisions.jsonl` remained, but **the reviewable md audit node was gone**.
333
+ Now the `reviewed_by` already obtained by this adjudication is carried all the way into the write.
334
+ - **Two earlier gaps in the same chain** (found while investigating #709):
335
+ - **`propose` deadlock**: a candidate entering the inbox is not persisted to the memory disk, yet review units were required according to the target layer ⇒
336
+ under enforce, "writing knowledge needs reflect → reflect needs adjudication → adjudication needs a proposal → a proposal needs reflect".
337
+ Now `require_layer_write(..., skip_gate=False)` adds that parameter, and **only** `propose` passes `True`;
338
+ the layer allowlist and sensitivity check **still run as usual**, and `accept` persisting to disk still goes through the same gate.
339
+ - **`accept` persisting a business node** did not pass `reviewed_by` ⇒ "adjudication passed, persist blocked".
340
+ - **`reviewed_by` no longer pollutes frontmatter**: it is **an input parameter of the write gate, not memory metadata**.
341
+ Previously `kw.get()` read it without deleting it, so it landed in the node fm through `super().add(**kw)` (measured: `test_i50c`'s B1 key-by-key comparison reported `reviewed_by: null`).
342
+ Now changed to `kw.pop()`.
343
+ - **`actor` was always None** (hollow identity attribution): in `MdCGSecure.remember_event`, `tenant`/`session`/`harness`/`unit`/`sensitivity`
344
+ **all get values from principal**, but `actor` ("who said it") did not ⇒ the injection surface always received `actor` as None. Fixed.
345
+ - **Window-order bugs x2** (#712 / #715): both `session_recall` and `session_compact` **truncate the last N entries first, then filter by session**
346
+ ⇒ under multi-session concurrency, this session's messages are pushed out of the window, and `session="A"` may get an **empty recent** (false negative, extremely hard to find).
347
+ `session_compact` is worse - it compresses "0 events in total" and **writes it into a session node** (one wrong memory written).
348
+ Fix: when narrowing is needed, fetch the full set first, then filter, then truncate back.
349
+ - **Falsy `session` silently falls back to the global window** (#712): it now adds `recent_global_window` in `degraded`, so callers can see it.
350
+ - **Identity block always empty** (#715): `【灵枢身份锚点】` reused the timeline payload **with session filtering**,
351
+ while the `session` of `self`/`anchor` nodes is **always `unattributed`** ⇒ the permanent layers were all filtered out ⇒ **the block never appeared and no error was raised**.
352
+ Now the identity block **fetches independently, without session filtering**; the "recent memory" block keeps session isolation.
353
+ This is exactly the real case of theory R3: **the visibility of persona should not be decided by session**.
354
+ An `else` branch with `logger.info` was also added - when the switch is on but there is no identity node, it says so explicitly instead of staying silent.
355
+ - **Falsy session id silently falls back to the global window** (PR #714 by LeeRolling): now `logger.warn` once (no flooding).
356
+
357
+ ### Internal
358
+
359
+ - The code-reading anchor in `test/chaos_injection/test_fi_m09_guest_write_denied.py` was relaxed from "the full call string" to "both `layer, sens` parameters present",
360
+ and two hard-coded line numbers were removed.
361
+ - `NEW_INFO_KEYS` in `test_generation_guard.py` registers `write_gate`.
362
+ - The mutation anchor in `test_p45_session_identity.py` was synced to the new shape (**mutation semantics unchanged**).
363
+ - New guards: `test_issue712_session_window_attribution` (29 items, covering window order / four elements / identity three dimensions / separation of powers),
364
+ `test/issue715` (W715), `test/issue714` (W714 / W714b).
365
+
366
+ ### Upgrade notes
367
+
368
+ - **The `--gate` default is still `strict`**; `op=info` only **adds** keys; `sessions_read` defaults to `None` = old behavior unchanged digit for digit.
369
+ - If you hit problems in #708 / #709: after upgrading, `cg(op="info")["write_gate"]` shows the warn counts,
370
+ and **`record_error` in the return body of `review accept` should be empty**.
371
+ - If you hit problems in #712 / #715: after upgrading, injected blocks should carry the attribution prefix, and the identity block should appear when `autoRecallIdentity: true`.
372
+ ## [0.9.17] - 2026-10-28
373
+
374
+ ### Fixes
375
+
376
+ - **`warn` mode was completely invisible to users (#708 ①)**: `security._write_gate_verdict` only did `sys.stderr.write`, and DSH does not forward this
377
+ into `desktop-next.log` ⇒ the observation period was effectively nothing. Now `writegate` keeps **in-process counters** and exposes them via `cg(op=info).write_gate`:
378
+
379
+ ```python
380
+ cg(op="info")["write_gate"]
381
+ # {mode, total, by_layer: {"knowledge@L1": 3}, recent: [{layer,tier,reason}…], hint}
382
+ ```
383
+
384
+ It does not depend on stderr forwarding and does not write to disk; `recent` keeps only `layer/tier/reason` (**no content, no node ids**), bounded to 20 entries.
385
+ The stderr line is kept (still visible in real time when the host is willing to forward it).
386
+
387
+ - **Under `enforce`, the adjudication audit node is blocked by the same gate (#708 ② / #709)**: `_write_review_record` writes `structural` (tier 2: needs reflect+verify),
388
+ yet does not pass the review units ⇒ `decisions.jsonl` remains, but **the reviewable md audit node is gone**. Now the `reviewed_by`
389
+ already obtained by this adjudication is carried all the way into the write: `review_decide → _finish_decision → _record_decision → _write_review_record → add(reviewed_by=…)`.
390
+
391
+ - **Two earlier landing points of the same hole (found while investigating #709, fixed together)**:
392
+ - **`propose` deadlock**: a candidate entering the inbox is not persisted to the memory disk, yet review units are required by the **target layer** ⇒ under `enforce`,
393
+ "writing knowledge needs reflect → reflect needs adjudication → adjudication needs a proposal → a proposal needs reflect".
394
+ Now `require_layer_write(..., skip_gate=False)` adds that parameter, and **only** `propose` passes `True`;
395
+ the layer allowlist and sensitivity check **run as usual** (only the write_gate stage is skipped), and `accept` persisting to disk still goes through the same gate.
396
+ - **`accept` persisting a business node** does not pass `reviewed_by` ⇒ "adjudication passed, persist blocked". Now carried through together.
397
+
398
+ - **`reviewed_by` no longer pollutes frontmatter**: it is **an input parameter of the write gate, not memory metadata**. Previously `kw.get()` was used to read without deleting,
399
+ so it landed in the node fm through `super().add(**kw)` (measured: `test_i50c`'s B1 key-by-key comparison reported `reviewed_by: null`). Now changed to `kw.pop()`.
400
+
401
+ ### Internal
402
+
403
+ - The code-reading anchor in `test/chaos_injection/test_fi_m09_guest_write_denied.py` was relaxed from "the full call string" to "both `layer, sens` parameters present"
404
+ (`require_layer_write` now has an extra `reviewers=` argument); two hard-coded line numbers were also removed - line numbers drift with changes.
405
+ - `NEW_INFO_KEYS` in `test_generation_guard.py` registers `write_gate` (the new diagnostic key of `op=info`, same class as `code_generation`).
406
+
407
+ ### Upgrade notes
408
+
409
+ - This release **has no breaking changes**: `skip_gate` defaults to `False`; the `--gate` default is still `strict`; `op=info` only **adds** one `write_gate` key.
410
+ - If you hit problems in #708 / #709: after upgrading, `cg(op="info")["write_gate"]` shows the warn counts,
411
+ and **`record_error` in the return body of `review accept` should be empty**.
412
+ - Counters are **accumulated in-process and reset to zero on restart** (not written to disk); observing one full working day before switching to `enforce` is recommended.
413
+ ## [0.9.16] - 2026-10-28
414
+
415
+ ### Fixes
416
+
417
+ - **`/lingshu` always returned 503 "host authentication unavailable" on DSH 0.2.1-rc.3 (#699)**: `createConsoleHandler` fetched `ctx.get('connection')` once **at mount time**,
418
+ and cordis's `Context.get(name, strict=true)` returns `undefined` when the serving fiber is not ready -
419
+ the empty value was frozen into the closure, so every request hit 503 and it did not self-heal even after the host became ready. Now it **fetches in real time on every request** (passing a getter function; a non-function is wrapped as a constant, for backward compatibility),
420
+ and the 503 message changed to "the host authentication service is not ready yet, please retry later". 3 guards, and "the connection arrives late ⇒ the same handler immediately returns 200" is exactly the lesion point.
421
+ - **Test entry "zero-selected false green" (#1910 cross-repo report)**: the `--module` help taught the **slash** form (`md_cg/test_issue4`),
422
+ while the actual target names use **dots** (`md_cg.test_issue4`), and the old implementation did not normalize ⇒ the slash form selected **zero targets** yet still printed `SUMMARY 0/0` + `rc=0`.
423
+ Now normalized (slash ≡ dot, `.py` ignored, empty selector matches nothing) + **zero selections must not return 0** (execution path `rc=2`). 21 guards including a self-proof of discriminating power.
424
+ - **F26-13 `_primary_bound` comment did not match the implementation**: the `#637` comment promised "T3 trims when score>0", but the code only trims when `n_real == 0`.
425
+ Measured: implementing the comment **breaks the "fallback includes cross-bucket nodes" contract of S1b/S7** (`test_retr_s1b`/`test_retr_s7` immediately turn red) ⇒
426
+ confirmed that "no trimming by default" is a deliberate trade-off, changed to **align the comment with the implementation** and wrote the evidence into the comment (so later readers do not step on it again).
427
+ - **F26-25 Rust side missing accent folding**: `normalize_en` turned every non-ASCII non-Chinese character into a space ⇒ `café` → `caf`, while Python gives `cafe`.
428
+ Constrained by `Cargo.toml`'s "zero third-party dependencies", changed to **follow the Python criteria** and generate a 963-entry single-character mapping table plus three-range combining-mark stripping;
429
+ cross-implementation guards **29 items** checked item by item (including the boundary that `ß`/`ø` do not fold, and Japanese dakuten do not fold).
430
+
431
+ ### Added
432
+
433
+ - **Gate level `--gate fast|strict` + `--module` filter** (`scripts/run_tests.py`):
434
+ "fast = set the problem aside / slow = dig into the root cause" is a value trade-off, and **the choice is handed to the user**; not a single line changed on the guard side,
435
+ and "whether to run heavy quality checks" is decided by the upper layer. Default `strict` (does not lower existing strength); **CI environment + `fast` automatically upgrades to strict** to prevent missed detection. 17 guards.
436
+ - **Config registry generator "add-only" protection** (`scripts/gen_config_registry.py`): a whole-file rewrite would erase manually added lines
437
+ (measured incident: `MDCG_WARM_SEARCH`/`MDCG_VISION_ROOT` disappeared). Now, before writing to disk, it reads the old table's entry names with AST and refuses if one is missing (`rc=3`),
438
+ with `--force` as an explicit escape hatch. 14 guards.
439
+ - **Audit gains a `source` key-name set dimension** (`src/lib/hook_audit.ts`): the key gap in #695 was that "which fields the event's `source` actually carries" was unobservable.
440
+ A `source_shapes` bucket was added, recording **key names only, never values** (pinned by a sentinel guard). Measured on this machine, 383 sessions / 9,614 lines: the `user` tier takes 18.4%,
441
+ of which 80.3% carry `rpcId` and **19.7% carry only `kind`** - this reading turns "source attribution" from a guess into something quantifiable.
442
+ - **Two silent fallbacks in `entry_from_row` made observable** (`md_cg/config_registry.py`): a `literal_eval` failure and a missing `value_type`
443
+ previously left no trace at all (numeric registrations would silently be treated as strings). Two read entry points added, `literal_failures()` / `missing_value_types()`, with **zero behavior change**. 15 guards.
444
+
445
+ ### Documentation
446
+
447
+ - **README 321 → 227 lines**: the "graphical interface" and "permissions" chapters were each compressed to ~14 lines (one-line positioning + minimal commands + one table + links),
448
+ with details moved into [`docs/en/ops/ui-install-troubleshooting.md`](docs/en/ops/ui-install-troubleshooting.md) and [`docs/en/ops/permissions-review.md`](docs/en/ops/permissions-review.md).
449
+ The README reader is "deciding within 30 seconds whether to use it"; details belong in `docs/`.
450
+
451
+ ### Upgrade notes
452
+
453
+ - This release **has no breaking changes**: the `--gate` default is still `strict`; `createConsoleHandler` keeps the old "pass the value directly" calling style;
454
+ both `--module` forms now work (the slash form previously selected zero targets).
455
+ - If you hit a constant 503 on `/lingshu` on DSH 0.2.1-rc.3: after upgrading **no extra action is needed**; it self-heals even if the service arrives late.
456
+ If it is still 503, please reply with the `kinds` section of `$DSH_HOME/logs/dsh-memory-hook-audit.json` (no content).
457
+ ## [0.9.15] - 2026-10-27
458
+
459
+ Theme: **permission layering and the review model land** (read/write/adjudicate layers each narrowable on its own) + one order-of-magnitude performance fix + two real "cannot install / cannot start" bugs.
460
+
461
+ ### Added · Review model for writes and adjudication
462
+
463
+ - **Layered write strictness gate** (`MDCG_WRITE_GATE`, default `off`) - scenario/goal/unresolved/negative memory (tier 0) can be written directly without review;
464
+ the knowledge layer needs a reflection unit; the structural layer needs reflection + verification; the self/anchor layer needs reflection + verification + **human adjudication**.
465
+ **With no review channel at all, only tier 0 may be written**; everything else is refused.
466
+ - **Adjudication dual-unit review gate** (`MDCG_REVIEW_DUAL_CHECK`, default off) - adjudication must carry `reviewed_by` containing both a reflection unit and a verification unit;
467
+ **duplicates of the same kind do not count as complete** (two reflections still lack verification); the adjudicator must not be the proposer (`self_review_forbidden`); unknown units are not silently counted.
468
+ - `MDCG_REVIEW_CHANNELS` (review channel declaration: `hive,subagent,team`). Note that it is a **deployment declaration**:
469
+ empty only means "never declared", **not** that this machine has no subagents/hive/team.
470
+ - **Designer token coverage criteria** - `DESIGNER_COVERAGE_OPS` / `coverage_gap()` / `HIGH_RISK_OPS` / `high_risk_granted()`;
471
+ `tokens verify` output appends `designer_coverage_gap`; at issue time, two kinds of hints, "narrowed and missing read surfaces" and "high-risk surfaces granted", are written into the return value `warnings`
472
+ (the library layer does not write to stderr; the CLI entry prints them).
473
+
474
+ ### Added · Graphical interface (optional add-on package)
475
+
476
+ - `ui/minimal/`: one-line install, per-file rollback, reusing the local brain bridge (data never leaves the machine);
477
+ a seven-page panel (overview / memory / goals and tasks / self-knowledge / spatiotemporal relations / review and maintenance / toolbench).
478
+ - The `files` allowlist in `package.json` adds `ui` and `web`, so the installer, payload, and static assets **ship with the npm package**.
479
+ - **Wiring into the package**: `dsh.client` / `exports["./client"]` written into `package.json`, `installConsoleWeb(...)` written into `src/index.ts`;
480
+ the artifacts are generated by the new `scripts/build_ui.py` (idempotent; `--check` only verifies and fails closed when files are missing; both `build` and `prepublishOnly` run it automatically).
481
+ So **changing the plugin manifest no longer requires reinstalling the UI**; `install.ps1` now targets end users who go "from the npm package to the local plugin directory",
482
+ and it still auto-completes plugin packages that predate the wiring. The guard `md_cg/test_ui_wiring_in_repo.py` (18 items) pins the declaration/distribution/build three faces against drift.
483
+
484
+ ### Performance
485
+
486
+ - `protect.stats()` switched to **entry-based criteria** (reads the index, no longer reading frontmatter node by node):
487
+ on the live library (32,000 nodes) the cold state went **310 s → 0.015 s**. This function is called unconditionally through the `protection` section of `cg(op=info)`,
488
+ and was the root cause of the UI overview page "looking frozen"; after the fix the overview page went from the 5-minute level to the second level.
489
+ Semantics unchanged: a full comparison of `protected` / `immutable` shows **diff 0**.
490
+
491
+ ### Fixes
492
+
493
+ - **The UI add-on package could not be installed on Windows**: the payload was checked out as CRLF by `core.autocrlf`, mismatching `integrity.json` (sha256 recorded against LF),
494
+ and the installer falsely reported "shared package files missing or corrupted". `.gitattributes` now pins `ui/minimal/payload/** eol=lf`.
495
+ - **hive serve would not start**: `{"env": "DEEPSEEK_API_KEY"}` in `config.local.json` reads the environment variable of the **calling process**,
496
+ and DSH subprocesses do not inherit machine-level variables ⇒ a false "config item parse failed". A Windows machine-level fallback was added
497
+ (an explicit process env value still wins; if both are empty it still fails fast).
498
+ - The config registry surface registers `MDCG_WRITE_GATE` / `MDCG_REVIEW_CHANNELS` / `MDCG_REVIEW_DUAL_CHECK`.
499
+
500
+ ### Documentation
501
+
502
+ - README adds two chapters: "🖥️ Graphical interface (optional add-on package · for DSH)" and "🔐 Permissions: read / write / adjudicate, three layers, each narrowable on its own",
503
+ covering which four of the seven pages are command panels, three troubleshooting items, the 17 read-surface ops, the layered write matrix, dual-unit adjudication, and the error reference table.
504
+
505
+ ### Upgrade notes
506
+
507
+ - **The default values of the three new switches all keep the old behavior** (`MDCG_WRITE_GATE=off`, `MDCG_REVIEW_CHANNELS` empty, `MDCG_REVIEW_DUAL_CHECK` off)
508
+ ⇒ behavior is unchanged after upgrading; they must be enabled explicitly. Recommended order: observe with `warn` first, then `enforce` after the review channels are connected.
509
+ - Designer tokens **do not widen because of an upgrade**; if your token was narrowed by hand, `tokens verify` reports `designer_coverage_gap` and names the missing surfaces.
510
+ - Windows users who previously could not install the UI can install it directly in this release.
511
+
512
+ ### Known boundaries
513
+
514
+ - The write gate and the adjudication gate only recognize "review unit declarations"; they do not verify whether evidence is genuine (genuineness is countersigned on the hive/subagent side).
515
+ - Before `MDCG_WRITE_GATE=enforce`, declare `MDCG_REVIEW_CHANNELS` first, otherwise the knowledge layer and above (including automatic archiving) will be refused writes.