@chenhw7/dsh-memory 0.1.3 → 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.
- package/README.md +101 -120
- package/README.zh-CN.md +103 -119
- package/cordis.patch.yml +13 -8
- package/lib/client/index.js +616 -185
- 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/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 +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)
|
|
@@ -26,12 +26,15 @@ 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.
|
|
35
38
|
|
|
36
39
|
## Install
|
|
37
40
|
|
|
@@ -79,56 +82,12 @@ With a source checkout, run it from the `deepseek-harness` directory instead:
|
|
|
79
82
|
pnpm dsh plugin add --profile web @chenhw7/dsh-memory
|
|
80
83
|
```
|
|
81
84
|
|
|
82
|
-
To pin a version
|
|
85
|
+
To pin a specific version:
|
|
83
86
|
|
|
84
87
|
```sh
|
|
85
|
-
dsh plugin add --profile web @chenhw7/dsh-memory@0.
|
|
88
|
+
dsh plugin add --profile web @chenhw7/dsh-memory@0.3.0
|
|
86
89
|
```
|
|
87
90
|
|
|
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
91
|
### From a local checkout
|
|
133
92
|
|
|
134
93
|
If you want to hack on the plugin, clone and build it first, then install from the local path:
|
|
@@ -149,8 +108,24 @@ If you'd rather not install from the npm registry, pack a tarball from a checkou
|
|
|
149
108
|
```sh
|
|
150
109
|
cd dsh-memory
|
|
151
110
|
npm install && npm run build
|
|
152
|
-
npm pack # produces chenhw7-dsh-memory-0.
|
|
153
|
-
dsh plugin add --profile web ./chenhw7-dsh-memory-0.
|
|
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
|
|
154
129
|
```
|
|
155
130
|
|
|
156
131
|
## Uninstall
|
|
@@ -161,7 +136,7 @@ Remove the plugin from a profile:
|
|
|
161
136
|
dsh plugin remove --profile web @chenhw7/dsh-memory
|
|
162
137
|
```
|
|
163
138
|
|
|
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
|
|
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.
|
|
165
140
|
|
|
166
141
|
Uninstall does **not** delete your saved memories. They live in one file under dsh's storage area:
|
|
167
142
|
|
|
@@ -177,7 +152,7 @@ Stop dsh, then delete that file to wipe all saved memories. Other files in the s
|
|
|
177
152
|
|
|
178
153
|
## Verify
|
|
179
154
|
|
|
180
|
-
After install, confirm the
|
|
155
|
+
After install, confirm the seven memory rows are in the composed profile tree:
|
|
181
156
|
|
|
182
157
|
```sh
|
|
183
158
|
# Windows
|
|
@@ -186,7 +161,7 @@ dsh --profile web --dump-config | findstr memory
|
|
|
186
161
|
dsh --profile web --dump-config | grep memory
|
|
187
162
|
```
|
|
188
163
|
|
|
189
|
-
You should see
|
|
164
|
+
You should see seven rows pointing at `@chenhw7/dsh-memory/*`:
|
|
190
165
|
|
|
191
166
|
```
|
|
192
167
|
- id: memory-root
|
|
@@ -197,6 +172,8 @@ You should see six rows pointing at `@chenhw7/dsh-memory/*`:
|
|
|
197
172
|
name: '@chenhw7/dsh-memory/tool'
|
|
198
173
|
- id: memory-review
|
|
199
174
|
name: '@chenhw7/dsh-memory/review'
|
|
175
|
+
- id: memory-notes
|
|
176
|
+
name: '@chenhw7/dsh-memory/notes'
|
|
200
177
|
- id: memory-context
|
|
201
178
|
name: '@chenhw7/dsh-memory/context'
|
|
202
179
|
- id: memory-remote
|
|
@@ -209,100 +186,103 @@ Then start dsh and check the settings UI shows the `memory` namespace:
|
|
|
209
186
|
dsh web
|
|
210
187
|
```
|
|
211
188
|
|
|
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.
|
|
189
|
+
## Configuration
|
|
236
190
|
|
|
237
|
-
|
|
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:
|
|
238
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.
|
|
239
195
|
|
|
240
|
-
|
|
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.
|
|
241
197
|
|
|
242
|
-
|
|
198
|
+
### `memory` namespace
|
|
243
199
|
|
|
244
200
|
| Setting | Default | Meaning |
|
|
245
201
|
|---|---|---|
|
|
246
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`. |
|
|
247
203
|
| `memoryPolicyCustomText` | — | Custom policy text used when `memoryMode` is `custom`. |
|
|
248
|
-
| `
|
|
249
|
-
| `
|
|
250
|
-
| `
|
|
251
|
-
| `
|
|
252
|
-
| `
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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
|
|
257
217
|
|
|
258
218
|
| Setting | Default | Meaning |
|
|
259
219
|
|---|---|---|
|
|
260
|
-
| `
|
|
261
|
-
| `
|
|
262
|
-
| `
|
|
220
|
+
| `reviewEnabled` | `true` | Enable automatic periodic review extraction. |
|
|
221
|
+
| `reviewCandidateThreshold` | `10` | Unprocessed candidate signals that trigger one extraction drain (min 1). |
|
|
222
|
+
| `flushOnCompaction` | `true` | Extract memories from shadowed events after compaction. |
|
|
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. |
|
|
263
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). |
|
|
264
|
-
| `
|
|
265
|
-
|
|
266
|
-
|
|
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. |
|
|
267
233
|
|
|
268
|
-
|
|
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.
|
|
269
235
|
|
|
270
|
-
|
|
271
|
-
|---|---|---|
|
|
272
|
-
| `maxSearchResults` | `50` | Maximum number of entries returned by `memory_search`. `0` = no limit. |
|
|
236
|
+
### Setting via composition vs. UI
|
|
273
237
|
|
|
274
|
-
|
|
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:
|
|
275
239
|
|
|
276
240
|
```yaml
|
|
277
|
-
|
|
241
|
+
memory:
|
|
278
242
|
config:
|
|
279
243
|
maxSearchResults: 100
|
|
280
244
|
```
|
|
281
245
|
|
|
282
|
-
By default, extraction and
|
|
283
|
-
|
|
284
|
-
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):
|
|
285
247
|
|
|
286
248
|
```yaml
|
|
287
249
|
memory-review:
|
|
288
250
|
config:
|
|
289
251
|
extractionModelProvider: deepseek
|
|
290
252
|
extractionModelModel: deepseek-chat
|
|
291
|
-
extractionBudget: 20
|
|
292
|
-
judgeEnabled: true
|
|
293
253
|
```
|
|
294
254
|
|
|
295
|
-
Example `$DSH_HOME/settings.yaml` (
|
|
255
|
+
Example `$DSH_HOME/settings.yaml` (both namespaces):
|
|
296
256
|
|
|
297
257
|
```yaml
|
|
298
258
|
memory:
|
|
299
259
|
memoryMode: policy-only
|
|
300
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:
|
|
301
273
|
reviewEnabled: true
|
|
302
274
|
reviewCandidateThreshold: 10
|
|
303
275
|
flushOnCompaction: true
|
|
304
276
|
flushOnDispose: true
|
|
305
|
-
|
|
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
|
|
306
286
|
```
|
|
307
287
|
|
|
308
288
|
`memoryPolicyCustomText` is optional and only used when `memoryMode` is `custom`.
|
|
@@ -331,16 +311,17 @@ memory:
|
|
|
331
311
|
|
|
332
312
|
## Architecture
|
|
333
313
|
|
|
334
|
-
The bundle inserts
|
|
314
|
+
The bundle inserts seven rows over `dsh-base`, each pointing at this package's own export sub-path:
|
|
335
315
|
|
|
336
316
|
| Row | Export | Role |
|
|
337
317
|
|---|---|---|
|
|
338
318
|
| `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` |
|
|
319
|
+
| `memory-store` | `@chenhw7/dsh-memory/store` | Opens the `memory` domain, registers `ctx.memory` (BM25 search + two-tier decay) |
|
|
340
320
|
| `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-
|
|
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 |
|
|
344
325
|
|
|
345
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.
|
|
346
327
|
|
|
@@ -361,9 +342,9 @@ The bundle inserts six rows over `dsh-base`, each pointing at this package's own
|
|
|
361
342
|
|
|
362
343
|
## Known Limitations
|
|
363
344
|
|
|
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
|
-
- **
|
|
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.
|
|
367
348
|
- **dsh is in developer preview** — breaking changes are expected; this bundle's peer dependency ranges track the dsh release line.
|
|
368
349
|
|
|
369
350
|
## License
|