@chenhw7/dsh-memory 0.1.2 → 0.3.0

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 (75) hide show
  1. package/README.md +115 -109
  2. package/README.zh-CN.md +117 -108
  3. package/cordis.patch.yml +13 -8
  4. package/lib/client/index.js +616 -185
  5. package/lib/context/conflict.d.ts +19 -2
  6. package/lib/context/conflict.d.ts.map +1 -1
  7. package/lib/context/conflict.js +33 -0
  8. package/lib/context/conflict.js.map +1 -1
  9. package/lib/context/index.d.ts +34 -10
  10. package/lib/context/index.d.ts.map +1 -1
  11. package/lib/context/index.js +195 -24
  12. package/lib/context/index.js.map +1 -1
  13. package/lib/context/policy.d.ts +28 -1
  14. package/lib/context/policy.d.ts.map +1 -1
  15. package/lib/context/policy.js +60 -3
  16. package/lib/context/policy.js.map +1 -1
  17. package/lib/index.d.ts +27 -7
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +22 -0
  20. package/lib/index.js.map +1 -1
  21. package/lib/notes/index.d.ts +66 -0
  22. package/lib/notes/index.d.ts.map +1 -0
  23. package/lib/notes/index.js +180 -0
  24. package/lib/notes/index.js.map +1 -0
  25. package/lib/notes/render.d.ts +32 -0
  26. package/lib/notes/render.d.ts.map +1 -0
  27. package/lib/notes/render.js +68 -0
  28. package/lib/notes/render.js.map +1 -0
  29. package/lib/notes/scope.d.ts +35 -0
  30. package/lib/notes/scope.d.ts.map +1 -0
  31. package/lib/notes/scope.js +44 -0
  32. package/lib/notes/scope.js.map +1 -0
  33. package/lib/notes/settings.d.ts +35 -0
  34. package/lib/notes/settings.d.ts.map +1 -0
  35. package/lib/notes/settings.js +36 -0
  36. package/lib/notes/settings.js.map +1 -0
  37. package/lib/notes/writer.d.ts +32 -0
  38. package/lib/notes/writer.d.ts.map +1 -0
  39. package/lib/notes/writer.js +71 -0
  40. package/lib/notes/writer.js.map +1 -0
  41. package/lib/review/accumulator.d.ts +53 -18
  42. package/lib/review/accumulator.d.ts.map +1 -1
  43. package/lib/review/accumulator.js +176 -36
  44. package/lib/review/accumulator.js.map +1 -1
  45. package/lib/review/dedup.d.ts +16 -3
  46. package/lib/review/dedup.d.ts.map +1 -1
  47. package/lib/review/dedup.js +21 -4
  48. package/lib/review/dedup.js.map +1 -1
  49. package/lib/review/extract.d.ts +81 -5
  50. package/lib/review/extract.d.ts.map +1 -1
  51. package/lib/review/extract.js +224 -31
  52. package/lib/review/extract.js.map +1 -1
  53. package/lib/review/index.d.ts +15 -2
  54. package/lib/review/index.d.ts.map +1 -1
  55. package/lib/review/index.js +137 -55
  56. package/lib/review/index.js.map +1 -1
  57. package/lib/scanner.d.ts +15 -0
  58. package/lib/scanner.d.ts.map +1 -1
  59. package/lib/scanner.js +20 -0
  60. package/lib/scanner.js.map +1 -1
  61. package/lib/store/bm25.d.ts +48 -0
  62. package/lib/store/bm25.d.ts.map +1 -0
  63. package/lib/store/bm25.js +115 -0
  64. package/lib/store/bm25.js.map +1 -0
  65. package/lib/store/index.d.ts +26 -3
  66. package/lib/store/index.d.ts.map +1 -1
  67. package/lib/store/index.js +111 -68
  68. package/lib/store/index.js.map +1 -1
  69. package/lib/tool/index.d.ts +3 -1
  70. package/lib/tool/index.d.ts.map +1 -1
  71. package/lib/tool/index.js +52 -9
  72. package/lib/tool/index.js.map +1 -1
  73. package/lib/types.d.ts +17 -1
  74. package/lib/types.d.ts.map +1 -1
  75. package/package.json +35 -30
package/README.md CHANGED
@@ -10,9 +10,9 @@ This is a **self-contained single package** (not a multi-package workspace). It
10
10
 
11
11
  - [Features](#features)
12
12
  - [Install](#install)
13
+ - [Update](#update)
13
14
  - [Uninstall](#uninstall)
14
15
  - [Verify](#verify)
15
- - [Troubleshooting](#troubleshooting)
16
16
  - [Configuration](#configuration)
17
17
  - [Architecture](#architecture)
18
18
  - [Known Limitations](#known-limitations)
@@ -23,13 +23,18 @@ This is a **self-contained single package** (not a multi-package workspace). It
23
23
 
24
24
  Your dsh agent normally forgets everything when you close a session. This bundle fixes that:
25
25
 
26
- - **Persistent memory** — facts, preferences, and conventions stored in a durable KV backend.
26
+ - **Persistent memory** — facts, preferences, and conventions stored in a durable KV backend with audit logging.
27
27
  - **Three-layer scoping** — `global` (cross-project), `project` (per-repo, auto-detected), and `user` (cross-project profile).
28
- - **Six model-facing tools** — `memory_search`, `memory_add`, `memory_replace`, `memory_remove`, `memory_list`, `memory_get`.
29
- - **Automatic learning** — a projection accumulator watches the conversation and extracts candidate memories via lightweight rules, then runs an LLM extraction when enough candidates accumulate.
28
+ - **Eight model-facing tools** — `memory_search`, `memory_add`, `memory_replace`, `memory_remove`, `memory_list`, `memory_get`, `memory_pin`, `memory_unpin`.
29
+ - **BM25 relevance search** — dependency-free Okapi BM25 over CJK-aware tokenization (Latin word tokens; CJK unigrams + bigrams), pinned entries surfaced ahead of equal-relevance matches.
30
+ - **Automatic learning** — a projection accumulator watches the conversation for explicit remember-intent, corrections, and *verified failure streaks* (repeated same-signature tool failures resolved by a success), then runs LLM extraction when enough candidates accumulate.
31
+ - **In-repo project notes** — coding conventions and a pitfall log render into your repo (`docs/agent-memory/` by default) as git-manageable markdown, inject into every session's system prompt, and stay discoverable via a managed `AGENTS.md` pointer.
32
+ - **Dedup pipeline** — two-stage deduplication (stop-word-filtered Jaccard prefilter + optional LLM judge with bounded merges) prevents near-duplicate accumulation; a low-frequency curator pass re-summarizes oversized entries.
33
+ - **Two-tier memory lifecycle** — pin important memories; overdue project-scoped entries are removed while overdue `global`/`user` entries are soft-decayed (hidden from standing injections, still searchable, un-stamped on recall); every write is audited.
34
+ - **Step-level auto recall (opt-in)** — on each agent step, a BM25 search keyed on the step's user text appends a fenced `<recalled-memory>` message without touching the system prompt, keeping the KV-cache prefix stable.
30
35
  - **Compaction-aware flush** — when compaction shadows old context, the raw events are scanned for anything worth remembering.
31
- - **Security scanning** — API keys, tokens, prompt-injection patterns, and exfiltration attempts are blocked from being saved.
32
- - **Frontend-configurable** — all settings exposed through the dsh settings UI, apply live.
36
+ - **Security scanning, write *and* load time** — API keys, tokens, prompt-injection patterns, and exfiltration attempts are blocked from being saved; anything that slips through is redacted (`[BLOCKED: …]`) wherever it would re-enter a prompt.
37
+ - **Frontend-configurable** — all settings exposed through four cards in the dsh settings UI, apply live.
33
38
 
34
39
  ## Install
35
40
 
@@ -77,56 +82,12 @@ With a source checkout, run it from the `deepseek-harness` directory instead:
77
82
  pnpm dsh plugin add --profile web @chenhw7/dsh-memory
78
83
  ```
79
84
 
80
- To pin a version instead of `latest`:
85
+ To pin a specific version:
81
86
 
82
87
  ```sh
83
- dsh plugin add --profile web @chenhw7/dsh-memory@0.1.1
88
+ dsh plugin add --profile web @chenhw7/dsh-memory@0.3.0
84
89
  ```
85
90
 
86
- ### From GitHub (bleeding edge)
87
-
88
- Use this only to test a commit that is newer than the latest npm release. pnpm blocks a git dependency's `prepare` (build) script until you explicitly allow it, so a profile without an `allowBuilds` entry needs **two runs**:
89
-
90
- **Step 1: run the install once.** It will stop with:
91
-
92
- ```sh
93
- dsh plugin add --profile web https://github.com/chenhw7/dsh-memory
94
- ```
95
-
96
- ```text
97
- [ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED] ... The git-hosted package "@chenhw7/dsh-memory@0.1.1"
98
- needs to execute build scripts but is not in the "allowBuilds" allowlist.
99
- ...
100
- allowBuilds:
101
- @chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<commit>: true
102
- ```
103
-
104
- **Step 2: allow the exact key pnpm printed.** Edit the profile's `pnpm-workspace.yaml`:
105
-
106
- ```sh
107
- # Windows: %USERPROFILE%\.dsh\profiles\web\pnpm-workspace.yaml
108
- # macOS/Linux: ~/.dsh/profiles/web/pnpm-workspace.yaml
109
- # Or $DSH_HOME/profiles/web/pnpm-workspace.yaml if you set DSH_HOME
110
- ```
111
-
112
- and add the key from the error message (merge with existing content):
113
-
114
- ```yaml
115
- allowBuilds:
116
- "@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<the commit pnpm printed>": true
117
- ```
118
-
119
- Some pnpm versions use the older list form instead:
120
-
121
- ```yaml
122
- onlyBuiltDependencies:
123
- - "@chenhw7/dsh-memory"
124
- ```
125
-
126
- If your pnpm names that field, use that form. Then re-run the `dsh plugin add` command.
127
-
128
- > **Copy the key from pnpm's error, not from an old copy of this README.** The key includes the resolved commit, so it changes every time you install from a newer commit. This entry grants permission for the package's `prepare` script (`npm run build`) to run on your machine at install time — only allow packages whose source you trust. For a reproducible install, pin a commit (`dsh plugin add --profile web https://github.com/chenhw7/dsh-memory/archive/<commit>.tar.gz`) and allow the key pnpm prints for that pin.
129
-
130
91
  ### From a local checkout
131
92
 
132
93
  If you want to hack on the plugin, clone and build it first, then install from the local path:
@@ -147,8 +108,24 @@ If you'd rather not install from the npm registry, pack a tarball from a checkou
147
108
  ```sh
148
109
  cd dsh-memory
149
110
  npm install && npm run build
150
- npm pack # produces chenhw7-dsh-memory-0.1.1.tgz
151
- dsh plugin add --profile web ./chenhw7-dsh-memory-0.1.1.tgz
111
+ npm pack # produces chenhw7-dsh-memory-0.3.0.tgz
112
+ dsh plugin add --profile web ./chenhw7-dsh-memory-0.3.0.tgz
113
+ ```
114
+
115
+ ## Update
116
+
117
+ `dsh plugin add` always installs the latest version from npm on a **fresh** profile. But once a version is installed, running `dsh plugin add` again will **not** update it — pnpm sees the existing version range (e.g. `^0.2.0`) is already satisfied by the latest (e.g. `0.2.1`) and skips the update.
118
+
119
+ To update to the latest published version:
120
+
121
+ ```sh
122
+ dsh plugin --profile web update @chenhw7/dsh-memory
123
+ ```
124
+
125
+ With a source checkout:
126
+
127
+ ```sh
128
+ pnpm dsh plugin --profile web update @chenhw7/dsh-memory
152
129
  ```
153
130
 
154
131
  ## Uninstall
@@ -159,7 +136,7 @@ Remove the plugin from a profile:
159
136
  dsh plugin remove --profile web @chenhw7/dsh-memory
160
137
  ```
161
138
 
162
- (with a source checkout: `pnpm dsh plugin remove --profile web @chenhw7/dsh-memory` from the `deepseek-harness` directory). This runs `pnpm remove` in the profile directory and reconciles the layer list, so the four `memory-*` rows disappear from the composed config — you can confirm with the `--dump-config` check below.
139
+ (with a source checkout: `pnpm dsh plugin remove --profile web @chenhw7/dsh-memory` from the `deepseek-harness` directory). This runs `pnpm remove` in the profile directory and reconciles the layer list, so the seven `memory-*` rows disappear from the composed config — you can confirm with the `--dump-config` check below.
163
140
 
164
141
  Uninstall does **not** delete your saved memories. They live in one file under dsh's storage area:
165
142
 
@@ -175,7 +152,7 @@ Stop dsh, then delete that file to wipe all saved memories. Other files in the s
175
152
 
176
153
  ## Verify
177
154
 
178
- After install, confirm the four memory rows are in the composed profile tree:
155
+ After install, confirm the seven memory rows are in the composed profile tree:
179
156
 
180
157
  ```sh
181
158
  # Windows
@@ -184,17 +161,23 @@ dsh --profile web --dump-config | findstr memory
184
161
  dsh --profile web --dump-config | grep memory
185
162
  ```
186
163
 
187
- You should see four rows pointing at `@chenhw7/dsh-memory/*`:
164
+ You should see seven rows pointing at `@chenhw7/dsh-memory/*`:
188
165
 
189
166
  ```
167
+ - id: memory-root
168
+ name: '@chenhw7/dsh-memory'
190
169
  - id: memory-store
191
170
  name: '@chenhw7/dsh-memory/store'
192
171
  - id: tool-memory
193
172
  name: '@chenhw7/dsh-memory/tool'
194
173
  - id: memory-review
195
174
  name: '@chenhw7/dsh-memory/review'
175
+ - id: memory-notes
176
+ name: '@chenhw7/dsh-memory/notes'
196
177
  - id: memory-context
197
178
  name: '@chenhw7/dsh-memory/context'
179
+ - id: memory-remote
180
+ name: '@chenhw7/dsh-memory/remote-service'
198
181
  ```
199
182
 
200
183
  Then start dsh and check the settings UI shows the `memory` namespace:
@@ -203,83 +186,103 @@ Then start dsh and check the settings UI shows the `memory` namespace:
203
186
  dsh web
204
187
  ```
205
188
 
206
- ## Troubleshooting
207
-
208
- ### `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED`
209
-
210
- If a **git-hosted** install (`dsh plugin add ... https://github.com/...`) fails with an error like: (npm installs of `@chenhw7/dsh-memory` never trigger this.)
211
-
212
- ```text
213
- [ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED] Failed to prepare git-hosted package ...
214
- The git-hosted package "@chenhw7/dsh-memory@0.1.1" needs to execute build scripts but is not in the "allowBuilds" allowlist.
215
- ```
216
-
217
- It means pnpm has not been told to allow this package's `prepare` build script.
218
-
219
- **Fix:**
220
-
221
- 1. Open the profile's `pnpm-workspace.yaml` (see paths above).
222
- 2. Add the exact `allowBuilds` entry from the error message. It will look like:
223
-
224
- ```yaml
225
- allowBuilds:
226
- "@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<commit>": true
227
- ```
228
-
229
- 3. Run the `dsh plugin add` command again.
189
+ ## Configuration
230
190
 
231
- > If you update `dsh-memory` to a newer commit, the URL in the error may change. Update the `allowBuilds` key to the new URL, or keep the install pinned to the commit already allowed.
191
+ The bundle owns **two settings namespaces**, shown as four cards in Settings → Plugins → Plugin configuration and **applied live** — a change takes effect on the next event or call, no restart:
232
192
 
193
+ - **`memory`** (cards: *Memory*, *Project Notes*, *Auto Recall*) — injection modes, budgets, lifecycle, notes export, auto recall. Owned by `memory-context`.
194
+ - **`memory-review`** (card: *Automatic Extraction*) — extraction pipeline, model routing, dedup judge, pitfall streaks, curator pass. Owned by the `memory-review` plugin.
233
195
 
234
- ## Configuration
196
+ Every namespace resolves in layers: schema defaults → the composition `config:` entry (the `base`) → the user document in `$DSH_HOME/settings.yaml`. A field absent from the user layer inherits the composition value, so a deployment can pin a default and users override only what they need. With no settings service mounted (e.g. a headless profile), each plugin falls back to its composition entry exactly as composed.
235
197
 
236
- All settings are editable from the dsh frontend settings page (the `memory` namespace) and apply live. They persist in `$DSH_HOME/settings.yaml`.
198
+ ### `memory` namespace
237
199
 
238
200
  | Setting | Default | Meaning |
239
201
  |---|---|---|
240
202
  | `memoryMode` | `policy-only` | `full`: inject memory content + guidance. `policy-only`: inject guidance only, model searches on demand. `custom`: inject user-defined policy text. `off`: no injection. `index`: inject an existence index (one line per entry) so the model can see what is stored and route to `memory_get`/`memory_search`. |
241
203
  | `memoryPolicyCustomText` | — | Custom policy text used when `memoryMode` is `custom`. |
204
+ | `memoryCharLimit` | `5000` | Character budget for the frozen per-session memory snapshot injected in `full` mode (`0` = no content). |
205
+ | `maxSearchResults` | `50` | Default cap for `memory_search` / `memory_list` when the call omits `limit`; read live by the tool plugin. `0` = no limit. |
206
+ | `decayDays` | `30` | Lifecycle window for entries not recalled within N days; read live by the review plugin's janitor. `0` = disabled. Overdue `project` entries are **removed** (hard decay); overdue `global`/`user` entries are instead **soft-decayed** — stamped `stale`, hidden from injection surfaces and notes files, still searchable, un-stamped automatically once recalled. Pinned entries are always exempt. |
207
+ | `notesEnabled` | `true` | Export project notes (conventions + pitfall log) into the repo and inject them into the system prompt. Entries rendered into the notes files are excluded from the memory section to avoid double injection. |
208
+ | `notesDir` | `docs/agent-memory` | Repo-relative directory holding the generated `CONVENTIONS.md` / `PITFALLS.md`. |
209
+ | `notesCharLimit` | `4000` | Character budget for the injected `project-notes` prompt section. |
210
+ | `notesAgentsPointer` | `true` | Maintain the managed pointer block in the repo's `AGENTS.md`. |
211
+ | `notesMaxEntriesPerFile` | `100` | Max entries per generated notes file (newest kept). |
212
+ | `autoRecallEnabled` | `false` | Step-level auto recall: on every agent step, run a BM25 search over the store keyed on the step's user text and append a fenced `<recalled-memory>` message. The system prompt is untouched, so the KV-cache prefix stays stable. |
213
+ | `autoRecallLimit` | `5` | Max entries in one auto-recall fence (min 1). The fence itself is capped at 1200 characters. |
214
+ | `autoRecallMinChars` | `12` | Skip recall when the step's user text is shorter than this many characters (min 1). |
215
+
216
+ ### `memory-review` namespace
217
+
218
+ | Setting | Default | Meaning |
219
+ |---|---|---|
242
220
  | `reviewEnabled` | `true` | Enable automatic periodic review extraction. |
243
- | `reviewCandidateThreshold` | `10` | Number of candidate messages before an LLM extraction runs. |
221
+ | `reviewCandidateThreshold` | `10` | Unprocessed candidate signals that trigger one extraction drain (min 1). |
244
222
  | `flushOnCompaction` | `true` | Extract memories from shadowed events after compaction. |
245
- | `flushOnDispose` | `true` | Extract remaining context when a session is disposed. |
246
- | `memoryCharLimit` | `5000` | Per-scope character limit for injected memory content. |
223
+ | `flushOnDispose` | `true` | Extract remaining context when a session is disposed (5 s cap). |
224
+ | `extractionModelProvider` | `""` (session route) | Override the LLM provider for extraction/judge/curator calls. Empty = use the session's conversational model (the default — extraction reuses the same model the user is chatting with, no extra keys or billing channel). |
225
+ | `extractionModelModel` | `""` (session route) | Override the model name for extraction/judge/curator calls. Empty = use the session's conversational model. Set both fields to route extraction to a cheaper/faster model. |
226
+ | `extractionBudget` | `20` | LLM-call charges per session, shared across review drains, both flushes, and curator passes. `0` = unlimited. |
227
+ | `judgeEnabled` | `true` | Run the LLM dedup judge on prefilter hits. When `false`, prefilter hits merge directly (cheaper, but may false-merge same-template different-topic pairs). |
228
+ | `pitfallStreakThreshold` | `2` | Consecutive same-signature tool failures that must occur (and then be resolved by a success) before one structured pitfall candidate is emitted for extraction into the notes files. One-shot failures are not extracted. |
229
+ | `curatorEnabled` | `true` | Low-frequency curator pass: every `curatorEveryNSessions` session creations, the longest oversized entries are rewritten into concise one-liners by the extraction model (budget-gated). |
230
+ | `curatorEveryNSessions` | `20` | Run the curator pass every N session creations. |
231
+ | `curatorMaxEntries` | `5` | Max entries selected per curation pass (longest first). |
232
+ | `curatorMinChars` | `400` | Only entries at least this long are selected for re-summarization. |
247
233
 
248
- ### Extraction & Dedup Settings
234
+ > There is deliberately **no separate `tool-memory` settings namespace**: the tool plugin reads `maxSearchResults` live from the `memory` namespace above. Its composition `config.maxSearchResults` only serves as the fallback base when no settings service is mounted.
249
235
 
250
- These settings control the automatic extraction pipeline and the dedup judge. They live in the `memory-review` plugin config (set via the composition layer, not the `memory` settings namespace):
236
+ ### Setting via composition vs. UI
251
237
 
252
- | Setting | Default | Meaning |
253
- |---|---|---|
254
- | `extractionModelProvider` | `""` (session route) | Override the LLM provider for extraction/judge calls. Empty = use the session's conversational model (the default — extraction reuses the same model the user is chatting with, no extra keys or billing channel). |
255
- | `extractionModelModel` | `""` (session route) | Override the model name for extraction/judge calls. Empty = use the session's conversational model. Set both fields to route extraction to a cheaper/faster model. |
256
- | `extractionBudget` | `20` | Max extraction + judge calls per session. `0` = unlimited. |
257
- | `judgeEnabled` | `true` | Run the LLM dedup judge on prefilter hits. When `false`, prefilter hits merge directly (cheaper, but may false-merge same-template different-topic pairs). |
238
+ Both namespaces accept the same keys from both layers. A composition `config:` entry sets the `base`; the UI writes the user layer on top. For example, to pin `maxSearchResults: 100` as the deployment default while still letting a user override it:
258
239
 
259
- By default, extraction and the dedup judge use the **same model the user is chatting with** — the session's provider/model route. To run them on a dedicated cheaper model, set `extractionModelProvider` and `extractionModelModel` in the review plugin's composition config.
240
+ ```yaml
241
+ memory:
242
+ config:
243
+ maxSearchResults: 100
244
+ ```
260
245
 
261
- Example composition config for a dedicated extraction model:
246
+ By default, extraction, judging, and curation use the **same model the user is chatting with** — the session's provider/model route. To run them on a dedicated cheaper model, set `extractionModelProvider` and `extractionModelModel` (in the composition config or the UI — the UI offers dropdowns fed by the host model catalog):
262
247
 
263
248
  ```yaml
264
249
  memory-review:
265
250
  config:
266
251
  extractionModelProvider: deepseek
267
252
  extractionModelModel: deepseek-chat
268
- extractionBudget: 20
269
- judgeEnabled: true
270
253
  ```
271
254
 
272
- Example `$DSH_HOME/settings.yaml` (memory namespace):
255
+ Example `$DSH_HOME/settings.yaml` (both namespaces):
273
256
 
274
257
  ```yaml
275
258
  memory:
276
259
  memoryMode: policy-only
277
260
  memoryPolicyCustomText: ""
261
+ memoryCharLimit: 5000
262
+ maxSearchResults: 50
263
+ decayDays: 30
264
+ notesEnabled: true
265
+ notesDir: docs/agent-memory
266
+ notesCharLimit: 4000
267
+ notesAgentsPointer: true
268
+ notesMaxEntriesPerFile: 100
269
+ autoRecallEnabled: false
270
+ autoRecallLimit: 5
271
+ autoRecallMinChars: 12
272
+ memory-review:
278
273
  reviewEnabled: true
279
274
  reviewCandidateThreshold: 10
280
275
  flushOnCompaction: true
281
276
  flushOnDispose: true
282
- memoryCharLimit: 5000
277
+ extractionModelProvider: ""
278
+ extractionModelModel: ""
279
+ extractionBudget: 20
280
+ judgeEnabled: true
281
+ pitfallStreakThreshold: 2
282
+ curatorEnabled: true
283
+ curatorEveryNSessions: 20
284
+ curatorMaxEntries: 5
285
+ curatorMinChars: 400
283
286
  ```
284
287
 
285
288
  `memoryPolicyCustomText` is optional and only used when `memoryMode` is `custom`.
@@ -308,14 +311,17 @@ memory:
308
311
 
309
312
  ## Architecture
310
313
 
311
- The bundle inserts four rows over `dsh-base`, each pointing at this package's own export sub-path:
314
+ The bundle inserts seven rows over `dsh-base`, each pointing at this package's own export sub-path:
312
315
 
313
316
  | Row | Export | Role |
314
317
  |---|---|---|
315
- | `memory-store` | `@chenhw7/dsh-memory/store` | Opens the `memory` domain, registers `ctx.memory` |
316
- | `tool-memory` | `@chenhw7/dsh-memory/tool` | Six model-facing tools |
317
- | `memory-review` | `@chenhw7/dsh-memory/review` | Automatic extraction (projection + flush) |
318
- | `memory-context` | `@chenhw7/dsh-memory/context` | System-prompt injection + settings namespace |
318
+ | `memory-root` | `@chenhw7/dsh-memory` | No-op root entry for client-module scanner discovery |
319
+ | `memory-store` | `@chenhw7/dsh-memory/store` | Opens the `memory` domain, registers `ctx.memory` (BM25 search + two-tier decay) |
320
+ | `tool-memory` | `@chenhw7/dsh-memory/tool` | Eight model-facing tools |
321
+ | `memory-review` | `@chenhw7/dsh-memory/review` | Automatic extraction (projection + failure-streak pitfalls + flush + dedup + janitor + curator) and the `memory-review` settings namespace |
322
+ | `memory-notes` | `@chenhw7/dsh-memory/notes` | Project-notes export (render conventions/pitfalls + atomic write + AGENTS.md pointer), registers `ctx.projectNotes` |
323
+ | `memory-context` | `@chenhw7/dsh-memory/context` | System-prompt injection (`memory` @90 + `project-notes` @91), step-level auto recall, owns the `memory` settings namespace |
324
+ | `memory-remote` | `@chenhw7/dsh-memory/remote-service` | `@Remote` service for a future memory management UI |
319
325
 
320
326
  **Storage**: this bundle does **not** insert `storage-json` / `storage-domain` rows. The `dsh-web-app` bundle already provides them (with the correct root path under `$DSH_HOME/storages`). Inserting them here would clobber that config (patches replace whole rows, last-write-wins). The memory store provider consumes the `storageDomain` service as a peer dependency.
321
327
 
@@ -336,9 +342,9 @@ The bundle inserts four rows over `dsh-base`, each pointing at this package's ow
336
342
 
337
343
  ## Known Limitations
338
344
 
339
- - **No semantic/vector retrieval** — `memory_search` is substring matching over structured KV entries, not embeddings.
340
- - **Extraction quality tracks the session model** — review/flush reuse the session's routed provider/model.
341
- - **git install needs a build allowance** — pnpm blocks the git dependency's `prepare` script until you allow it in the profile's `pnpm-workspace.yaml` (two-step procedure above). The npm install path avoids this entirely.
345
+ - **No semantic/vector retrieval** — `memory_search` is BM25 lexical ranking over structured KV entries (Latin word tokens, CJK unigrams + bigrams), not embeddings; synonyms that share no tokens will not match.
346
+ - **Extraction quality tracks the session model** — review/flush/curator reuse the session's routed provider/model unless explicitly overridden.
347
+ - **Mid-session extractions stay out of the prompt until the next compaction or session** — the injected snapshot is frozen for KV-cache stability; step-level auto recall (opt-in) covers per-step freshness instead.
342
348
  - **dsh is in developer preview** — breaking changes are expected; this bundle's peer dependency ranges track the dsh release line.
343
349
 
344
350
  ## License