@chenhw7/dsh-memory 0.1.3 → 0.4.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.
- package/README.md +102 -120
- package/README.zh-CN.md +104 -119
- package/cordis.patch.yml +13 -8
- package/lib/client/index.js +1591 -195
- package/lib/context/conflict.d.ts +19 -2
- package/lib/context/conflict.d.ts.map +1 -1
- package/lib/context/conflict.js +33 -0
- package/lib/context/conflict.js.map +1 -1
- package/lib/context/index.d.ts +34 -10
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +195 -24
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +28 -1
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +60 -3
- package/lib/context/policy.js.map +1 -1
- package/lib/index.d.ts +27 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +22 -0
- package/lib/index.js.map +1 -1
- package/lib/notes/index.d.ts +66 -0
- package/lib/notes/index.d.ts.map +1 -0
- package/lib/notes/index.js +180 -0
- package/lib/notes/index.js.map +1 -0
- package/lib/notes/render.d.ts +32 -0
- package/lib/notes/render.d.ts.map +1 -0
- package/lib/notes/render.js +68 -0
- package/lib/notes/render.js.map +1 -0
- package/lib/notes/scope.d.ts +35 -0
- package/lib/notes/scope.d.ts.map +1 -0
- package/lib/notes/scope.js +44 -0
- package/lib/notes/scope.js.map +1 -0
- package/lib/notes/settings.d.ts +35 -0
- package/lib/notes/settings.d.ts.map +1 -0
- package/lib/notes/settings.js +36 -0
- package/lib/notes/settings.js.map +1 -0
- package/lib/notes/writer.d.ts +32 -0
- package/lib/notes/writer.d.ts.map +1 -0
- package/lib/notes/writer.js +71 -0
- package/lib/notes/writer.js.map +1 -0
- package/lib/remote/index.d.ts +31 -4
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +44 -7
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +7 -2
- package/lib/remote/typert.remote-client.js +8 -2
- package/lib/review/accumulator.d.ts +53 -18
- package/lib/review/accumulator.d.ts.map +1 -1
- package/lib/review/accumulator.js +176 -36
- package/lib/review/accumulator.js.map +1 -1
- package/lib/review/dedup.d.ts +16 -3
- package/lib/review/dedup.d.ts.map +1 -1
- package/lib/review/dedup.js +21 -4
- package/lib/review/dedup.js.map +1 -1
- package/lib/review/extract.d.ts +81 -5
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +224 -31
- package/lib/review/extract.js.map +1 -1
- package/lib/review/index.d.ts +15 -2
- package/lib/review/index.d.ts.map +1 -1
- package/lib/review/index.js +137 -55
- package/lib/review/index.js.map +1 -1
- package/lib/scanner.d.ts +15 -0
- package/lib/scanner.d.ts.map +1 -1
- package/lib/scanner.js +20 -0
- package/lib/scanner.js.map +1 -1
- package/lib/store/bm25.d.ts +48 -0
- package/lib/store/bm25.d.ts.map +1 -0
- package/lib/store/bm25.js +115 -0
- package/lib/store/bm25.js.map +1 -0
- package/lib/store/index.d.ts +26 -3
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +111 -68
- package/lib/store/index.js.map +1 -1
- package/lib/tool/index.d.ts +3 -1
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +52 -9
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +17 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +44 -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)
|
|
@@ -26,12 +26,16 @@ Your dsh agent normally forgets everything when you close a session. This bundle
|
|
|
26
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
28
|
- **Eight model-facing tools** — `memory_search`, `memory_add`, `memory_replace`, `memory_remove`, `memory_list`, `memory_get`, `memory_pin`, `memory_unpin`.
|
|
29
|
-
- **
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
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.
|
|
32
35
|
- **Compaction-aware flush** — when compaction shadows old context, the raw events are scanned for anything worth remembering.
|
|
33
|
-
- **Security scanning** — API keys, tokens, prompt-injection patterns, and exfiltration attempts are blocked from being saved.
|
|
34
|
-
- **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.
|
|
38
|
+
- **Memory manager UI (read-only, phase 1)** — a dedicated "Memory" section in the dsh settings UI browses the entire web-profile store: health dashboard, scope and workspace filters, BM25 search, category chips, remote paging, and soft-decay markers — in English and Chinese.
|
|
35
39
|
|
|
36
40
|
## Install
|
|
37
41
|
|
|
@@ -79,56 +83,12 @@ With a source checkout, run it from the `deepseek-harness` directory instead:
|
|
|
79
83
|
pnpm dsh plugin add --profile web @chenhw7/dsh-memory
|
|
80
84
|
```
|
|
81
85
|
|
|
82
|
-
To pin a version
|
|
86
|
+
To pin a specific version:
|
|
83
87
|
|
|
84
88
|
```sh
|
|
85
|
-
dsh plugin add --profile web @chenhw7/dsh-memory@0.
|
|
89
|
+
dsh plugin add --profile web @chenhw7/dsh-memory@0.4.0
|
|
86
90
|
```
|
|
87
91
|
|
|
88
|
-
### From GitHub (bleeding edge)
|
|
89
|
-
|
|
90
|
-
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**:
|
|
91
|
-
|
|
92
|
-
**Step 1: run the install once.** It will stop with:
|
|
93
|
-
|
|
94
|
-
```sh
|
|
95
|
-
dsh plugin add --profile web https://github.com/chenhw7/dsh-memory
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
```text
|
|
99
|
-
[ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED] ... The git-hosted package "@chenhw7/dsh-memory@0.1.2"
|
|
100
|
-
needs to execute build scripts but is not in the "allowBuilds" allowlist.
|
|
101
|
-
...
|
|
102
|
-
allowBuilds:
|
|
103
|
-
@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<commit>: true
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**Step 2: allow the exact key pnpm printed.** Edit the profile's `pnpm-workspace.yaml`:
|
|
107
|
-
|
|
108
|
-
```sh
|
|
109
|
-
# Windows: %USERPROFILE%\.dsh\profiles\web\pnpm-workspace.yaml
|
|
110
|
-
# macOS/Linux: ~/.dsh/profiles/web/pnpm-workspace.yaml
|
|
111
|
-
# Or $DSH_HOME/profiles/web/pnpm-workspace.yaml if you set DSH_HOME
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
and add the key from the error message (merge with existing content):
|
|
115
|
-
|
|
116
|
-
```yaml
|
|
117
|
-
allowBuilds:
|
|
118
|
-
"@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<the commit pnpm printed>": true
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Some pnpm versions use the older list form instead:
|
|
122
|
-
|
|
123
|
-
```yaml
|
|
124
|
-
onlyBuiltDependencies:
|
|
125
|
-
- "@chenhw7/dsh-memory"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
If your pnpm names that field, use that form. Then re-run the `dsh plugin add` command.
|
|
129
|
-
|
|
130
|
-
> **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.
|
|
131
|
-
|
|
132
92
|
### From a local checkout
|
|
133
93
|
|
|
134
94
|
If you want to hack on the plugin, clone and build it first, then install from the local path:
|
|
@@ -149,8 +109,24 @@ If you'd rather not install from the npm registry, pack a tarball from a checkou
|
|
|
149
109
|
```sh
|
|
150
110
|
cd dsh-memory
|
|
151
111
|
npm install && npm run build
|
|
152
|
-
npm pack # produces chenhw7-dsh-memory-0.
|
|
153
|
-
dsh plugin add --profile web ./chenhw7-dsh-memory-0.
|
|
112
|
+
npm pack # produces chenhw7-dsh-memory-0.4.0.tgz
|
|
113
|
+
dsh plugin add --profile web ./chenhw7-dsh-memory-0.4.0.tgz
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Update
|
|
117
|
+
|
|
118
|
+
`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.
|
|
119
|
+
|
|
120
|
+
To update to the latest published version:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
dsh plugin --profile web update @chenhw7/dsh-memory
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
With a source checkout:
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
pnpm dsh plugin --profile web update @chenhw7/dsh-memory
|
|
154
130
|
```
|
|
155
131
|
|
|
156
132
|
## Uninstall
|
|
@@ -161,7 +137,7 @@ Remove the plugin from a profile:
|
|
|
161
137
|
dsh plugin remove --profile web @chenhw7/dsh-memory
|
|
162
138
|
```
|
|
163
139
|
|
|
164
|
-
(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
|
|
140
|
+
(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.
|
|
165
141
|
|
|
166
142
|
Uninstall does **not** delete your saved memories. They live in one file under dsh's storage area:
|
|
167
143
|
|
|
@@ -177,7 +153,7 @@ Stop dsh, then delete that file to wipe all saved memories. Other files in the s
|
|
|
177
153
|
|
|
178
154
|
## Verify
|
|
179
155
|
|
|
180
|
-
After install, confirm the
|
|
156
|
+
After install, confirm the seven memory rows are in the composed profile tree:
|
|
181
157
|
|
|
182
158
|
```sh
|
|
183
159
|
# Windows
|
|
@@ -186,7 +162,7 @@ dsh --profile web --dump-config | findstr memory
|
|
|
186
162
|
dsh --profile web --dump-config | grep memory
|
|
187
163
|
```
|
|
188
164
|
|
|
189
|
-
You should see
|
|
165
|
+
You should see seven rows pointing at `@chenhw7/dsh-memory/*`:
|
|
190
166
|
|
|
191
167
|
```
|
|
192
168
|
- id: memory-root
|
|
@@ -197,6 +173,8 @@ You should see six rows pointing at `@chenhw7/dsh-memory/*`:
|
|
|
197
173
|
name: '@chenhw7/dsh-memory/tool'
|
|
198
174
|
- id: memory-review
|
|
199
175
|
name: '@chenhw7/dsh-memory/review'
|
|
176
|
+
- id: memory-notes
|
|
177
|
+
name: '@chenhw7/dsh-memory/notes'
|
|
200
178
|
- id: memory-context
|
|
201
179
|
name: '@chenhw7/dsh-memory/context'
|
|
202
180
|
- id: memory-remote
|
|
@@ -209,100 +187,103 @@ Then start dsh and check the settings UI shows the `memory` namespace:
|
|
|
209
187
|
dsh web
|
|
210
188
|
```
|
|
211
189
|
|
|
212
|
-
##
|
|
213
|
-
|
|
214
|
-
### `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED`
|
|
215
|
-
|
|
216
|
-
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.)
|
|
217
|
-
|
|
218
|
-
```text
|
|
219
|
-
[ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED] Failed to prepare git-hosted package ...
|
|
220
|
-
The git-hosted package "@chenhw7/dsh-memory@0.1.2" needs to execute build scripts but is not in the "allowBuilds" allowlist.
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
It means pnpm has not been told to allow this package's `prepare` build script.
|
|
224
|
-
|
|
225
|
-
**Fix:**
|
|
226
|
-
|
|
227
|
-
1. Open the profile's `pnpm-workspace.yaml` (see paths above).
|
|
228
|
-
2. Add the exact `allowBuilds` entry from the error message. It will look like:
|
|
229
|
-
|
|
230
|
-
```yaml
|
|
231
|
-
allowBuilds:
|
|
232
|
-
"@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<commit>": true
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
3. Run the `dsh plugin add` command again.
|
|
190
|
+
## Configuration
|
|
236
191
|
|
|
237
|
-
|
|
192
|
+
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:
|
|
238
193
|
|
|
194
|
+
- **`memory`** (cards: *Memory*, *Project Notes*, *Auto Recall*) — injection modes, budgets, lifecycle, notes export, auto recall. Owned by `memory-context`.
|
|
195
|
+
- **`memory-review`** (card: *Automatic Extraction*) — extraction pipeline, model routing, dedup judge, pitfall streaks, curator pass. Owned by the `memory-review` plugin.
|
|
239
196
|
|
|
240
|
-
|
|
197
|
+
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.
|
|
241
198
|
|
|
242
|
-
|
|
199
|
+
### `memory` namespace
|
|
243
200
|
|
|
244
201
|
| Setting | Default | Meaning |
|
|
245
202
|
|---|---|---|
|
|
246
203
|
| `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`. |
|
|
247
204
|
| `memoryPolicyCustomText` | — | Custom policy text used when `memoryMode` is `custom`. |
|
|
248
|
-
| `
|
|
249
|
-
| `
|
|
250
|
-
| `
|
|
251
|
-
| `
|
|
252
|
-
| `
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
205
|
+
| `memoryCharLimit` | `5000` | Character budget for the frozen per-session memory snapshot injected in `full` mode (`0` = no content). |
|
|
206
|
+
| `maxSearchResults` | `50` | Default cap for `memory_search` / `memory_list` when the call omits `limit`; read live by the tool plugin. `0` = no limit. |
|
|
207
|
+
| `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. |
|
|
208
|
+
| `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. |
|
|
209
|
+
| `notesDir` | `docs/agent-memory` | Repo-relative directory holding the generated `CONVENTIONS.md` / `PITFALLS.md`. |
|
|
210
|
+
| `notesCharLimit` | `4000` | Character budget for the injected `project-notes` prompt section. |
|
|
211
|
+
| `notesAgentsPointer` | `true` | Maintain the managed pointer block in the repo's `AGENTS.md`. |
|
|
212
|
+
| `notesMaxEntriesPerFile` | `100` | Max entries per generated notes file (newest kept). |
|
|
213
|
+
| `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. |
|
|
214
|
+
| `autoRecallLimit` | `5` | Max entries in one auto-recall fence (min 1). The fence itself is capped at 1200 characters. |
|
|
215
|
+
| `autoRecallMinChars` | `12` | Skip recall when the step's user text is shorter than this many characters (min 1). |
|
|
216
|
+
|
|
217
|
+
### `memory-review` namespace
|
|
257
218
|
|
|
258
219
|
| Setting | Default | Meaning |
|
|
259
220
|
|---|---|---|
|
|
260
|
-
| `
|
|
261
|
-
| `
|
|
262
|
-
| `
|
|
221
|
+
| `reviewEnabled` | `true` | Enable automatic periodic review extraction. |
|
|
222
|
+
| `reviewCandidateThreshold` | `10` | Unprocessed candidate signals that trigger one extraction drain (min 1). |
|
|
223
|
+
| `flushOnCompaction` | `true` | Extract memories from shadowed events after compaction. |
|
|
224
|
+
| `flushOnDispose` | `true` | Extract remaining context when a session is disposed (5 s cap). |
|
|
225
|
+
| `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). |
|
|
226
|
+
| `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. |
|
|
227
|
+
| `extractionBudget` | `20` | LLM-call charges per session, shared across review drains, both flushes, and curator passes. `0` = unlimited. |
|
|
263
228
|
| `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). |
|
|
264
|
-
| `
|
|
265
|
-
|
|
266
|
-
|
|
229
|
+
| `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. |
|
|
230
|
+
| `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). |
|
|
231
|
+
| `curatorEveryNSessions` | `20` | Run the curator pass every N session creations. |
|
|
232
|
+
| `curatorMaxEntries` | `5` | Max entries selected per curation pass (longest first). |
|
|
233
|
+
| `curatorMinChars` | `400` | Only entries at least this long are selected for re-summarization. |
|
|
267
234
|
|
|
268
|
-
|
|
235
|
+
> 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.
|
|
269
236
|
|
|
270
|
-
|
|
271
|
-
|---|---|---|
|
|
272
|
-
| `maxSearchResults` | `50` | Maximum number of entries returned by `memory_search`. `0` = no limit. |
|
|
237
|
+
### Setting via composition vs. UI
|
|
273
238
|
|
|
274
|
-
|
|
239
|
+
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:
|
|
275
240
|
|
|
276
241
|
```yaml
|
|
277
|
-
|
|
242
|
+
memory:
|
|
278
243
|
config:
|
|
279
244
|
maxSearchResults: 100
|
|
280
245
|
```
|
|
281
246
|
|
|
282
|
-
By default, extraction and
|
|
283
|
-
|
|
284
|
-
Example composition config for a dedicated extraction model:
|
|
247
|
+
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):
|
|
285
248
|
|
|
286
249
|
```yaml
|
|
287
250
|
memory-review:
|
|
288
251
|
config:
|
|
289
252
|
extractionModelProvider: deepseek
|
|
290
253
|
extractionModelModel: deepseek-chat
|
|
291
|
-
extractionBudget: 20
|
|
292
|
-
judgeEnabled: true
|
|
293
254
|
```
|
|
294
255
|
|
|
295
|
-
Example `$DSH_HOME/settings.yaml` (
|
|
256
|
+
Example `$DSH_HOME/settings.yaml` (both namespaces):
|
|
296
257
|
|
|
297
258
|
```yaml
|
|
298
259
|
memory:
|
|
299
260
|
memoryMode: policy-only
|
|
300
261
|
memoryPolicyCustomText: ""
|
|
262
|
+
memoryCharLimit: 5000
|
|
263
|
+
maxSearchResults: 50
|
|
264
|
+
decayDays: 30
|
|
265
|
+
notesEnabled: true
|
|
266
|
+
notesDir: docs/agent-memory
|
|
267
|
+
notesCharLimit: 4000
|
|
268
|
+
notesAgentsPointer: true
|
|
269
|
+
notesMaxEntriesPerFile: 100
|
|
270
|
+
autoRecallEnabled: false
|
|
271
|
+
autoRecallLimit: 5
|
|
272
|
+
autoRecallMinChars: 12
|
|
273
|
+
memory-review:
|
|
301
274
|
reviewEnabled: true
|
|
302
275
|
reviewCandidateThreshold: 10
|
|
303
276
|
flushOnCompaction: true
|
|
304
277
|
flushOnDispose: true
|
|
305
|
-
|
|
278
|
+
extractionModelProvider: ""
|
|
279
|
+
extractionModelModel: ""
|
|
280
|
+
extractionBudget: 20
|
|
281
|
+
judgeEnabled: true
|
|
282
|
+
pitfallStreakThreshold: 2
|
|
283
|
+
curatorEnabled: true
|
|
284
|
+
curatorEveryNSessions: 20
|
|
285
|
+
curatorMaxEntries: 5
|
|
286
|
+
curatorMinChars: 400
|
|
306
287
|
```
|
|
307
288
|
|
|
308
289
|
`memoryPolicyCustomText` is optional and only used when `memoryMode` is `custom`.
|
|
@@ -331,16 +312,17 @@ memory:
|
|
|
331
312
|
|
|
332
313
|
## Architecture
|
|
333
314
|
|
|
334
|
-
The bundle inserts
|
|
315
|
+
The bundle inserts seven rows over `dsh-base`, each pointing at this package's own export sub-path:
|
|
335
316
|
|
|
336
317
|
| Row | Export | Role |
|
|
337
318
|
|---|---|---|
|
|
338
319
|
| `memory-root` | `@chenhw7/dsh-memory` | No-op root entry for client-module scanner discovery |
|
|
339
|
-
| `memory-store` | `@chenhw7/dsh-memory/store` | Opens the `memory` domain, registers `ctx.memory` |
|
|
320
|
+
| `memory-store` | `@chenhw7/dsh-memory/store` | Opens the `memory` domain, registers `ctx.memory` (BM25 search + two-tier decay) |
|
|
340
321
|
| `tool-memory` | `@chenhw7/dsh-memory/tool` | Eight model-facing tools |
|
|
341
|
-
| `memory-review` | `@chenhw7/dsh-memory/review` | Automatic extraction (projection + flush + dedup + janitor) |
|
|
342
|
-
| `memory-
|
|
343
|
-
| `memory-
|
|
322
|
+
| `memory-review` | `@chenhw7/dsh-memory/review` | Automatic extraction (projection + failure-streak pitfalls + flush + dedup + janitor + curator) and the `memory-review` settings namespace |
|
|
323
|
+
| `memory-notes` | `@chenhw7/dsh-memory/notes` | Project-notes export (render conventions/pitfalls + atomic write + AGENTS.md pointer), registers `ctx.projectNotes` |
|
|
324
|
+
| `memory-context` | `@chenhw7/dsh-memory/context` | System-prompt injection (`memory` @90 + `project-notes` @91), step-level auto recall, owns the `memory` settings namespace |
|
|
325
|
+
| `memory-remote` | `@chenhw7/dsh-memory/remote-service` | `@Remote` service behind the settings UI's Memory section (consumed over the `/api` channel) |
|
|
344
326
|
|
|
345
327
|
**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.
|
|
346
328
|
|
|
@@ -361,9 +343,9 @@ The bundle inserts six rows over `dsh-base`, each pointing at this package's own
|
|
|
361
343
|
|
|
362
344
|
## Known Limitations
|
|
363
345
|
|
|
364
|
-
- **No semantic/vector retrieval** — `memory_search` is
|
|
365
|
-
- **Extraction quality tracks the session model** — review/flush reuse the session's routed provider/model.
|
|
366
|
-
- **
|
|
346
|
+
- **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.
|
|
347
|
+
- **Extraction quality tracks the session model** — review/flush/curator reuse the session's routed provider/model unless explicitly overridden.
|
|
348
|
+
- **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.
|
|
367
349
|
- **dsh is in developer preview** — breaking changes are expected; this bundle's peer dependency ranges track the dsh release line.
|
|
368
350
|
|
|
369
351
|
## License
|