@chenhw7/dsh-memory 0.9.1 → 0.9.2
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.i18n.yaml +2 -2
- package/README.md +70 -20
- package/README.zh.md +70 -20
- package/cordis.patch.yml +11 -4
- package/lib/benchmark/index.d.ts +1 -1
- package/lib/benchmark/index.d.ts.map +1 -1
- package/lib/client/index.js +388 -58
- package/lib/context/index.d.ts +93 -18
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +331 -71
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +72 -11
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +250 -16
- package/lib/context/policy.js.map +1 -1
- package/lib/identity/index.d.ts +74 -0
- package/lib/identity/index.d.ts.map +1 -0
- package/lib/identity/index.js +150 -0
- package/lib/identity/index.js.map +1 -0
- package/lib/identity/seeds.d.ts +52 -0
- package/lib/identity/seeds.d.ts.map +1 -0
- package/lib/identity/seeds.js +130 -0
- package/lib/identity/seeds.js.map +1 -0
- package/lib/identity/settings.d.ts +32 -0
- package/lib/identity/settings.d.ts.map +1 -0
- package/lib/identity/settings.js +33 -0
- package/lib/identity/settings.js.map +1 -0
- package/lib/index.d.ts +53 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +62 -1
- package/lib/index.js.map +1 -1
- package/lib/notes/index.d.ts +5 -2
- package/lib/notes/index.d.ts.map +1 -1
- package/lib/notes/index.js +26 -14
- package/lib/notes/index.js.map +1 -1
- package/lib/notes/render.d.ts +15 -3
- package/lib/notes/render.d.ts.map +1 -1
- package/lib/notes/render.js +110 -27
- package/lib/notes/render.js.map +1 -1
- package/lib/notes/settings.d.ts +27 -14
- package/lib/notes/settings.d.ts.map +1 -1
- package/lib/notes/settings.js +42 -13
- package/lib/notes/settings.js.map +1 -1
- package/lib/remote/index.d.ts +83 -1
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +93 -2
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +29 -1
- package/lib/remote/typert.remote-client.js +19 -0
- package/lib/remote/types.d.ts +1 -1
- package/lib/remote/types.d.ts.map +1 -1
- package/lib/review/extract.d.ts +12 -1
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +72 -2
- package/lib/review/extract.js.map +1 -1
- package/lib/store/identity-util.d.ts +12 -0
- package/lib/store/identity-util.d.ts.map +1 -0
- package/lib/store/identity-util.js +19 -0
- package/lib/store/identity-util.js.map +1 -0
- package/lib/store/index.d.ts +64 -13
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +246 -26
- package/lib/store/index.js.map +1 -1
- package/lib/store/sqlite.d.ts +24 -7
- package/lib/store/sqlite.d.ts.map +1 -1
- package/lib/store/sqlite.js +181 -13
- package/lib/store/sqlite.js.map +1 -1
- package/lib/tool/index.d.ts +4 -11
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +117 -3
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +90 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +5 -1
package/README.i18n.yaml
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
README.md:
|
|
2
|
-
README.zh.md:
|
|
1
|
+
README.md: 2403fb0865e46264e5d643b14057b2331b80227a
|
|
2
|
+
README.zh.md: 8681c39bdc5644af232f5428e34f9c9ce5549bce
|
package/README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-512-dark.webp">
|
|
4
|
+
<img src="assets/logo-512.webp" width="104" alt="Cairn — four stacked stones rising like a trail marker, the top stone blue">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
1
8
|
# Cairn
|
|
2
9
|
|
|
3
10
|
**Cairn** is long-term memory for the [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), packaged as the `@chenhw7/dsh-memory` profile bundle — facts, preferences, corrections, and lessons survive across sessions and restarts.
|
|
@@ -34,16 +41,18 @@ Your dsh agent normally forgets everything when you close a session. This bundle
|
|
|
34
41
|
|
|
35
42
|
- **Persistent memory** — facts, preferences, and conventions stored in a durable KV backend with audit logging.
|
|
36
43
|
- **Three-layer scoping** — `global` (cross-project), `project` (per-repo, auto-detected), and `user` (cross-project profile).
|
|
37
|
-
- **Nine
|
|
44
|
+
- **Nine memory tools + the identity tool** — `memory_search`, `memory_add`, `memory_replace`, `memory_remove`, `memory_list`, `memory_get`, `memory_pin`, `memory_unpin`, `memory_forget`, plus `identity_update` (below).
|
|
45
|
+
- **Identity layer (opt-in)** — the agent's two self-documents, **SOUL.md** (its character) and **USER.md** (its understanding of you), grown *by the agent in conversation* through `identity_update` and injected into every session (`soul` @80 / `user-profile` @81, coexisting with — and yielding to — the deployment persona; explicit conversation instructions always win). Seeded once from built-in Chinese copy, versioned with full history, never decayed. You hold no editor — only governance: a read-only Identity settings section with version history, a two-step **revert** valve (default on, separate from the remote write switch), and markdown export. Extraction never persists identity restatements (prompt rule + mechanical prefilter), and an eval slice + `--identity` axis pin the injection surface (see [TECH_DESIGN §7.10](docs/TECH_DESIGN.md)).
|
|
38
46
|
- **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. Retrieval quality is not vibes: a fixed golden set (35 entries × 35 query sets, English + Chinese) is evaluated in CI — success@5 = 100%, MRR = 0.902 — with injection-cost numbers per prompt mode (see [TECH_DESIGN §7.9](docs/TECH_DESIGN.md)).
|
|
39
47
|
- **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. Admission rules exclude anything the repository already records (code structure, git history, fixed-bug narratives), and model-handwritten date prefixes are stripped so timestamps always come from the program.
|
|
40
48
|
- **Project notes prompt section** — coding conventions and a pitfall log render into every session's system prompt (`project-notes` section). Nothing is written into your repository: memory lives entirely in the host-side store, is managed in the Memory settings UI, and upgrades automatically clean up notes files left by ≤0.5.x installs.
|
|
49
|
+
- **Digest-first injection (default)** — the system prompt carries only frozen guidance; the data rides step-tail messages instead: a one-time `<memory-digest>` inventory of the store (category counts + anchor topic words, re-appended once after compaction) on the session's first step, and per-step `<recalled-memory>` fences when the step's text matches stored entries. The prompt prefix stays byte-stable all session, and nothing resident has to be evicted on re-freeze.
|
|
41
50
|
- **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.
|
|
42
51
|
- **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); entries can also be manually archived from the UI; every write is audited.
|
|
43
|
-
- **Step-level auto recall (
|
|
52
|
+
- **Step-level auto recall (on by default)** — 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. Fence hits refresh an entry's recency clock but never its access count, so query-word luck cannot inflate the eviction signal.
|
|
44
53
|
- **Compaction-aware flush** — when compaction shadows old context, the raw events are scanned for anything worth remembering.
|
|
45
54
|
- **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.
|
|
46
|
-
- **Frontend-configurable** — all settings exposed through
|
|
55
|
+
- **Frontend-configurable** — all settings exposed through five cards in the dsh settings UI, apply live.
|
|
47
56
|
- **Optional human review before write** — flip one setting (`confirmBeforeWrite`) and every extraction *and* tool write becomes a *proposal* in a pending queue (repeated signals accumulate hits and float up); adopting applies it (with your edits), rejecting discards it. The model never self-promotes: a proposed change to an existing entry rewrites nothing until you accept it.
|
|
48
57
|
- **Memory manager UI** — a dedicated "Memory" section in the dsh settings UI with three tabs: Overview (health dashboard), Review (the pending-proposal queue), and Manage — scope and workspace filters, BM25 search, category chips, a lazily loaded entry list, plus full write actions (edit / pin / archive / delete) — in English and Chinese.
|
|
49
58
|
- **Time-window browsing + smart list view** — `memory_list` returns newest-first with `earliest`/`latest`/`hasStale` metadata, accepts `since`/`until` epoch-ms bounds so "what did we learn last week" pages within the window, and suggests widening the filter when a narrowed query comes back empty over a non-empty store.
|
|
@@ -162,17 +171,19 @@ dsh plugin remove --profile web @chenhw7/dsh-memory
|
|
|
162
171
|
|
|
163
172
|
(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.
|
|
164
173
|
|
|
165
|
-
Uninstall does **not** delete your saved memories. They live
|
|
174
|
+
Uninstall does **not** delete your saved memories. They live under dsh's storage area, named by the `memory-store` row's `storage` config: `host-medium` (default) keeps everything in `memory.json`; `sqlite` moves the store into the plugin-owned `memory.db` with a one-time migration (`memory.json` then holds only the migration marker):
|
|
166
175
|
|
|
167
176
|
```sh
|
|
168
177
|
# macOS/Linux
|
|
169
178
|
~/.dsh/storages/memory.json
|
|
179
|
+
~/.dsh/storages/memory.db
|
|
170
180
|
# Windows
|
|
171
181
|
%USERPROFILE%\.dsh\storages\memory.json
|
|
172
|
-
|
|
182
|
+
%USERPROFILE%\.dsh\storages\memory.db
|
|
183
|
+
# or $DSH_HOME/storages/memory.json (or memory.db) if you set DSH_HOME
|
|
173
184
|
```
|
|
174
185
|
|
|
175
|
-
Stop dsh, then delete
|
|
186
|
+
Stop dsh, then delete the file for your backend (under `sqlite`: `memory.db` — leftover `-wal`/`-shm` sidecars are empty and harmless) to wipe all saved memories. Other files in the same directory belong to other features — do not remove the whole directory.
|
|
176
187
|
|
|
177
188
|
## Verify
|
|
178
189
|
|
|
@@ -212,9 +223,12 @@ dsh web
|
|
|
212
223
|
|
|
213
224
|
## Configuration
|
|
214
225
|
|
|
215
|
-
The bundle owns **
|
|
226
|
+
The bundle owns **five settings namespaces** — one per plugin-configuration card (the host's plugins tab dispatches a card only when its slot key names a served settings namespace) — and they all **apply live**: a change takes effect on the next event or call, no restart:
|
|
216
227
|
|
|
217
|
-
- **`memory`** (
|
|
228
|
+
- **`memory`** (card: *Memory*) — injection modes and the memory budgets. Owned by `memory-context`.
|
|
229
|
+
- **`memory-notes`** (card: *Project Notes*) — the project-notes prompt-section switch and budgets. Owned by `memory-context`.
|
|
230
|
+
- **`memory-autorecall`** (card: *Auto Recall*) — the step-level recall fence and the usage-hit signal. Owned by `memory-context`.
|
|
231
|
+
- **`memory-identity`** (card: *Identity*) — the identity layer's switch, budgets, and seed directory. Owned by `memory-context`.
|
|
218
232
|
- **`memory-review`** (card: *Automatic Extraction*) — extraction pipeline, model routing, dedup judge, pitfall streaks, curator pass. Owned by the `memory-review` plugin.
|
|
219
233
|
|
|
220
234
|
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.
|
|
@@ -223,18 +237,43 @@ Every namespace resolves in layers: schema defaults → the composition `config:
|
|
|
223
237
|
|
|
224
238
|
| Setting | Default | Meaning |
|
|
225
239
|
|---|---|---|
|
|
226
|
-
| `memoryMode` | `
|
|
240
|
+
| `memoryMode` | `digest` | `digest`: guidance-only prompt sections; the data rides step-tail messages — a one-time `<memory-digest>` store inventory (counts + topic words) plus per-step `<recalled-memory>` fences. `full`: inject frozen 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`. |
|
|
227
241
|
| `memoryPolicyCustomText` | — | Custom policy text used when `memoryMode` is `custom`. |
|
|
228
242
|
| `memoryCharLimit` | `5000` | Character budget for the frozen per-session memory snapshot injected in `full` mode (`0` = no content). |
|
|
243
|
+
| `memoryDigestCharLimit` | `800` | Character budget for the one-time `<memory-digest>` inventory message in `digest` mode (≈250 tokens; CJK topics run higher). `0` turns the digest message off. |
|
|
229
244
|
| `memoryMaxEntries` | `20` | Entry-count cap for the same frozen snapshot (`0` = no limit). The snapshot ends with a `≈N tokens` estimate so injection cost stays visible. |
|
|
230
245
|
| `maxSearchResults` | `50` | Default cap for `memory_search` / `memory_list` when the call omits `limit`; read live by the tool plugin. `0` = no limit. |
|
|
231
246
|
| `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. |
|
|
247
|
+
|
|
248
|
+
### `memory-notes` namespace
|
|
249
|
+
|
|
250
|
+
| Setting | Default | Meaning |
|
|
251
|
+
|---|---|---|
|
|
232
252
|
| `notesEnabled` | `true` | Inject the project-notes prompt section (conventions + pitfall log) into the system prompt. Entries rendered into the section are excluded from the memory section to avoid double injection. No repo files are written. |
|
|
233
|
-
| `
|
|
234
|
-
| `
|
|
235
|
-
| `
|
|
253
|
+
| `notesConventionsCharLimit` | `1600` | Character budget for the conventions half of the notes section. Entries the budget squeezes out fold into a count line pointing at `memory_search` — never silently dropped. The budget applies at freeze time; live changes take effect at the next session/compaction boundary. |
|
|
254
|
+
| `notesPitfallsCharLimit` | `800` | Character budget for the pitfall-log half of the notes section, so conventions can no longer starve it. Same freeze-time semantics and count-line folding. |
|
|
255
|
+
| `notesMaxEntriesPerFile` | `100` | Max entries selected into the notes section (pinned first, then importance, then recency); the rest fold into count lines. |
|
|
256
|
+
|
|
257
|
+
> **Settings migration**: the 0.9.x combined key `notesCharLimit` still works — when it is the only budget key set, both halves derive from it (conventions 60% / pitfalls 40%); each new key you set wins its own half. Rename the key in `$DSH_HOME/settings.yaml` (or the composition `config:`) to migrate.
|
|
258
|
+
|
|
259
|
+
### `memory-autorecall` namespace
|
|
260
|
+
|
|
261
|
+
| Setting | Default | Meaning |
|
|
262
|
+
|---|---|---|
|
|
263
|
+
| `autoRecallEnabled` | `true` | 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; fence hits stamp recency only, never the access count. |
|
|
236
264
|
| `autoRecallLimit` | `5` | Max entries in one auto-recall fence (min 1). The fence itself is capped at 1200 characters. |
|
|
237
265
|
| `autoRecallMinChars` | `12` | Skip recall when the step's user text is shorter than this many characters (min 1). |
|
|
266
|
+
| `hitSignalEnabled` | `false` | Enable the usage-hit signal: answers echoing injected entries above `hitSignalThreshold` bump `hitCount`; purely a selection signal, never deletion. |
|
|
267
|
+
| `hitSignalThreshold` | `0.25` | IDF-weighted token coverage above which an answer counts as a hit. |
|
|
268
|
+
|
|
269
|
+
### `memory-identity` namespace
|
|
270
|
+
|
|
271
|
+
| Setting | Default | Meaning |
|
|
272
|
+
|---|---|---|
|
|
273
|
+
| `identityEnabled` | `false` | Enable the identity layer: inject `soul` and `user-profile` prompt sections and expose the `identity_update` tool. See [TECH_DESIGN §7.10](docs/TECH_DESIGN.md). |
|
|
274
|
+
| `soulCharLimit` | `2000` | Character budget for the `soul` section (`0` = disabled). |
|
|
275
|
+
| `userCharLimit` | `3000` | Character budget for the `user-profile` section (`0` = disabled). |
|
|
276
|
+
| `identitySeedDir` | `""` | Directory holding custom `SOUL.md` / `USER.md` seeds; empty uses builtin seeds. |
|
|
238
277
|
|
|
239
278
|
### `memory-review` namespace
|
|
240
279
|
|
|
@@ -259,7 +298,7 @@ Every namespace resolves in layers: schema defaults → the composition `config:
|
|
|
259
298
|
|
|
260
299
|
### Setting via composition vs. UI
|
|
261
300
|
|
|
262
|
-
|
|
301
|
+
Every namespace accepts the same keys from both layers. A composition `config:` entry sets the `base`; the UI writes the user layer on top. The four memory-family namespaces share one composition row (`memory-context`'s `config:` carries all their keys), while the user document keeps one section per namespace. For example, to pin `maxSearchResults: 100` as the deployment default while still letting a user override it:
|
|
263
302
|
|
|
264
303
|
```yaml
|
|
265
304
|
memory:
|
|
@@ -276,22 +315,33 @@ memory-review:
|
|
|
276
315
|
extractionModelModel: deepseek-chat
|
|
277
316
|
```
|
|
278
317
|
|
|
279
|
-
Example `$DSH_HOME/settings.yaml` (
|
|
318
|
+
Example `$DSH_HOME/settings.yaml` (all namespaces):
|
|
280
319
|
|
|
281
320
|
```yaml
|
|
282
321
|
memory:
|
|
283
|
-
memoryMode:
|
|
322
|
+
memoryMode: digest
|
|
284
323
|
memoryPolicyCustomText: ""
|
|
285
324
|
memoryCharLimit: 5000
|
|
325
|
+
memoryDigestCharLimit: 800
|
|
286
326
|
memoryMaxEntries: 20
|
|
287
327
|
maxSearchResults: 50
|
|
288
328
|
decayDays: 30
|
|
329
|
+
memory-notes:
|
|
289
330
|
notesEnabled: true
|
|
290
|
-
|
|
331
|
+
notesConventionsCharLimit: 1600
|
|
332
|
+
notesPitfallsCharLimit: 800
|
|
291
333
|
notesMaxEntriesPerFile: 100
|
|
292
|
-
|
|
334
|
+
memory-autorecall:
|
|
335
|
+
autoRecallEnabled: true
|
|
293
336
|
autoRecallLimit: 5
|
|
294
337
|
autoRecallMinChars: 12
|
|
338
|
+
hitSignalEnabled: false
|
|
339
|
+
hitSignalThreshold: 0.25
|
|
340
|
+
memory-identity:
|
|
341
|
+
identityEnabled: false
|
|
342
|
+
soulCharLimit: 2000
|
|
343
|
+
userCharLimit: 3000
|
|
344
|
+
identitySeedDir: ""
|
|
295
345
|
memory-review:
|
|
296
346
|
reviewEnabled: true
|
|
297
347
|
reviewCandidateThreshold: 10
|
|
@@ -344,7 +394,7 @@ The bundle inserts seven rows over `dsh-base`, each pointing at this package's o
|
|
|
344
394
|
| `tool-memory` | `@chenhw7/dsh-memory/tool` | Nine model-facing tools (confirm-mode writes queue as proposals) |
|
|
345
395
|
| `memory-review` | `@chenhw7/dsh-memory/review` | Automatic extraction (projection + failure-streak pitfalls + flush + dedup + janitor + curator + human-review queue) and the `memory-review` settings namespace |
|
|
346
396
|
| `memory-notes` | `@chenhw7/dsh-memory/notes` | Project-notes prompt projection (render conventions/pitfalls into the `project-notes` section; no repo files), registers `ctx.projectNotes`; cleans up ≤0.5.x file-export artifacts on session start |
|
|
347
|
-
| `memory-context` | `@chenhw7/dsh-memory/context` | System-prompt injection (`memory` @
|
|
397
|
+
| `memory-context` | `@chenhw7/dsh-memory/context` | System-prompt injection (`memory` @6000 + `project-notes` @6001, after tool guidance), step-tail messages (one-time digest + per-step recall fence), owns the `memory` settings namespace |
|
|
348
398
|
| `memory-remote` | `@chenhw7/dsh-memory/remote-service` | `@Remote` service behind the settings UI's Memory section (consumed over the `/api` channel) |
|
|
349
399
|
|
|
350
400
|
**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.
|
|
@@ -368,8 +418,8 @@ The bundle inserts seven rows over `dsh-base`, each pointing at this package's o
|
|
|
368
418
|
|
|
369
419
|
- **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.
|
|
370
420
|
- **Extraction quality tracks the session model** — review/flush/curator reuse the session's routed provider/model unless explicitly overridden.
|
|
371
|
-
- **Mid-session extractions stay out of the prompt until the next compaction or session** — the injected
|
|
372
|
-
- **
|
|
421
|
+
- **Mid-session extractions stay out of the prompt until the next compaction or session** — the injected sections are frozen for KV-cache stability; step-level auto recall (on by default) covers per-step freshness instead, and the one-time digest re-appends once after compaction.
|
|
422
|
+
- **Remote management access relies on transport trust plus deployment valves** — any host admitted by the dsh host's `trustedHosts` setting can call read RPCs, but ordinary remote memory writes are denied by default (`remoteWritesEnabled: false`) and are exposed only when explicitly enabled, and `identityRevert` requires its own `identityRevertEnabled` valve (default `true`) on top of the write gate because it restores scanner-approved history rather than accepting arbitrary new content. Keep `trustedHosts` narrow and leave remote writes disabled unless every admitted host is trusted ([threat model](docs/TECH_DESIGN.md)).
|
|
373
423
|
- **dsh is in developer preview** — breaking changes are expected; this bundle's peer dependency ranges track the dsh release line.
|
|
374
424
|
- **Alpha channel (0.1.2-alpha.x) required** — the bundle uses the 0.1.2-alpha settings API (`ctx.settings.installSection`, host-only projection registrations) and declares `^0.1.2-alpha.2` peers. The rc (`next`) line still ships the removed module-level `installSettingsSection` helper and cannot load this bundle; install dsh from the `alpha` dist-tag. The client bundle likewise targets the alpha client packages (`@deepseek-ai/dsh-client-store` / `dsh-client-ui-settings`), which replaced the removed `dsh-client-runtime`.
|
|
375
425
|
|
package/README.zh.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-512-dark.webp">
|
|
4
|
+
<img src="assets/logo-512.webp" width="104" alt="Cairn — 四级石阶叠成路标,顶石为蓝色">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
1
8
|
# Cairn
|
|
2
9
|
|
|
3
10
|
[English](README.md) | **简体中文**
|
|
@@ -31,16 +38,18 @@
|
|
|
31
38
|
|
|
32
39
|
- **持久化记忆** — 将事实、偏好和约定存储在持久的 KV 后端中,带审计日志。
|
|
33
40
|
- **三层作用域** — `global`(跨项目)、`project`(按仓库自动检测)、`user`(跨项目 profile)。
|
|
34
|
-
-
|
|
41
|
+
- **九个记忆工具 + 身份工具** — `memory_search`、`memory_add`、`memory_replace`、`memory_remove`、`memory_list`、`memory_get`、`memory_pin`、`memory_unpin`、`memory_forget`,外加 `identity_update`(见下)。
|
|
42
|
+
- **身份层(opt-in)**——代理的两份自我文档:**SOUL.md**(它的人格)与 **USER.md**(它对你的了解),由代理在对话中经 `identity_update` 自己生长(显式指令始终优先;与部署 persona 共存而非替代),每个会话注入(`soul` @80 / `user-profile` @81)。内置中文种子落一次、全量版本历史、永不衰减。人没有编辑器——只有治理:只读 Identity 设置区 + 版本历史 + 两步**回滚**阀门(默认开,独立于远程写开关)+ markdown 导出。提取永不入库身份复述(提示词规则 + 机械预筛);eval 切片与 `--identity` 轴钉住注入面(见 [TECH_DESIGN §7.10](docs/TECH_DESIGN.zh.md))。
|
|
35
43
|
- **BM25 相关性检索** — 零依赖的 Okapi BM25,CJK 感知分词(Latin 逐词;CJK 一元 + 相邻二元 bigram),固定(pin)条目在同等相关时优先靠前。检索质量不是玄学:固定 golden set(35 条 × 35 组查询,中英混合)在 CI 中实测——success@5 = 100%、MRR = 0.902——并附各注入模式的成本数字(见 [TECH_DESIGN §7.9](docs/TECH_DESIGN.zh.md))。
|
|
36
44
|
- **自动学习** — 投影累加器观察对话中的显式记忆意图、修正语句以及*已验证的失败序列*(同签名连续失败后最终成功),候选足够多时运行 LLM 提取。准入规则排除一切"仓库已记录的内容"(代码结构、git 历史、已修复 bug 的经过),模型手写的日期前缀会被剥离,时间戳永远由程序盖戳。
|
|
37
45
|
- **项目笔记 prompt 段落** — 编码约定与踩坑日志渲染进每次会话的 system prompt(`project-notes` 段)。不向仓库写入任何文件:记忆完全保存在 host 侧存储中,在 Memory 设置 UI 里管理;升级时自动清理 ≤0.5.x 留下的笔记文件。
|
|
46
|
+
- **digest 优先注入(默认)** — system prompt 只承载冻结的指引文本,数据改走消息尾部:会话首步一次性注入 `<memory-digest>` 库存清单(类目计数 + anchors 主题词,压缩后补发一次),每步按相关性追加 `<recalled-memory>` 召回围栏。提示词前缀整会话逐字节稳定,重冻结不再牵连常驻数据。
|
|
38
47
|
- **去重管线** — 两阶段去重(停用词过滤的 Jaccard 预过滤 + 可选 LLM 裁决,合并长度有上限),防止近似重复条目累积;低频 curator pass 会将过长条目改写为简洁单行。
|
|
39
48
|
- **两层记忆生命周期** — 固定重要记忆;过期的 project 作用域条目被移除,而过期的 `global`/`user` 条目做软衰减(从常驻注入面隐藏但仍可搜索,再次召回即解除);条目也可以从界面手动归档;每次写入都有审计。
|
|
40
|
-
-
|
|
49
|
+
- **步级自动召回(默认开)** — 每个 agent step 用该步用户文本对 store 做 BM25 搜索,追加一块带围栏的 `<recalled-memory>` 消息;不触碰 system prompt,保持 KV-cache 前缀稳定。围栏命中只刷新条目的最近召回时间,不计入访问计数——查询词的运气不会污染逐出信号。
|
|
41
50
|
- **压缩时自动落盘** — 当压缩使旧上下文失效时,扫描原始事件并保留值得记住的内容。
|
|
42
51
|
- **安全扫描:写入时 + 读取时** — API Key、Token、提示注入模式和泄露尝试会被阻止写入;漏网内容在重新进入 prompt 的任何位置都会被替换为 `[BLOCKED: …]` 占位符。
|
|
43
|
-
- **前端可配置** — 所有设置通过 dsh
|
|
52
|
+
- **前端可配置** — 所有设置通过 dsh 设置界面的五张卡片暴露,实时生效。
|
|
44
53
|
- **可选的写入前人工确认** — 打开一个开关(`confirmBeforeWrite`)后,自动提取*与*工具调用产生的写入一律先进入待确认队列(同一提议反复出现会累计次数并置顶);采纳才落库(可先编辑),拒绝即丢弃。模型永不自我提升:对既有条目的修改提议在你采纳前不会改动原文。
|
|
45
54
|
- **记忆管理中心** — dsh 设置界面新增独立「记忆」区,三个标签页:概览(健康仪表盘)、待确认(提议队列)、管理——作用域与工作区筛选、BM25 搜索、类别筛选、懒加载条目列表,并带完整写操作(编辑 / 置顶 / 归档 / 删除),中英双语。
|
|
46
55
|
- **时间窗浏览 + 智能列表视图** — `memory_list` 默认按最新在前返回,附带 `earliest`/`latest`/`hasStale` 元数据,支持 `since`/`until` 毫秒时间戳边界(「上周学了什么」这类查询直接在窗口内分页);过滤条件命中 0 条但库非空时,会提示放宽过滤条件。
|
|
@@ -159,17 +168,19 @@ dsh plugin remove --profile web @chenhw7/dsh-memory
|
|
|
159
168
|
|
|
160
169
|
(源码构建的 dsh:在 `deepseek-harness` 目录下执行 `pnpm dsh plugin remove --profile web @chenhw7/dsh-memory`。)这会在 profile 目录里执行 `pnpm remove` 并同步层列表,七个 `memory-*` 行会从组合后的配置中消失——可以用下面的 `--dump-config` 检查确认。
|
|
161
170
|
|
|
162
|
-
卸载**不会**删除你已保存的记忆。它们存放在 dsh
|
|
171
|
+
卸载**不会**删除你已保存的记忆。它们存放在 dsh 存储目录下,具体文件由 `memory-store` 行的 `storage` 配置决定:`host-medium`(默认)全部保存在 `memory.json`;`sqlite` 经一次性迁移把 store 移入插件自有的 `memory.db`(此后 `memory.json` 只保留迁移标记):
|
|
163
172
|
|
|
164
173
|
```sh
|
|
165
174
|
# macOS/Linux
|
|
166
175
|
~/.dsh/storages/memory.json
|
|
176
|
+
~/.dsh/storages/memory.db
|
|
167
177
|
# Windows
|
|
168
178
|
%USERPROFILE%\.dsh\storages\memory.json
|
|
169
|
-
|
|
179
|
+
%USERPROFILE%\.dsh\storages\memory.db
|
|
180
|
+
# 如果设置了 DSH_HOME,则为 $DSH_HOME/storages/memory.json(或 memory.db)
|
|
170
181
|
```
|
|
171
182
|
|
|
172
|
-
先停掉 dsh
|
|
183
|
+
先停掉 dsh,再删除你的后端对应的数据文件(`sqlite` 下为 `memory.db`,残留的 `-wal`/`-shm` 伴生文件为空、无害)即可清空所有已保存的记忆。同一目录下的其他文件属于其他功能,不要删除整个目录。
|
|
173
184
|
|
|
174
185
|
## 验证
|
|
175
186
|
|
|
@@ -209,9 +220,12 @@ dsh web
|
|
|
209
220
|
|
|
210
221
|
## 配置
|
|
211
222
|
|
|
212
|
-
本 bundle
|
|
223
|
+
本 bundle 拥有**五个设置命名空间**——每个插件配置卡片一个(宿主的 Plugins 页签只在卡片 slot key 指向一个已注册 settings namespace 时才分发该卡片),且**全部实时生效**——改动在下一次事件或调用时即生效,无需重启:
|
|
213
224
|
|
|
214
|
-
- **`memory`**(卡片:*Memory
|
|
225
|
+
- **`memory`**(卡片:*Memory*)——注入模式与记忆预算。由 `memory-context` 持有。
|
|
226
|
+
- **`memory-notes`**(卡片:*Project Notes*)——项目笔记 prompt 段开关与预算。由 `memory-context` 持有。
|
|
227
|
+
- **`memory-autorecall`**(卡片:*Auto Recall*)——步级召回围栏与使用命中信号。由 `memory-context` 持有。
|
|
228
|
+
- **`memory-identity`**(卡片:*Identity*)——身份层开关、预算与种子目录。由 `memory-context` 持有。
|
|
215
229
|
- **`memory-review`**(卡片:*Automatic Extraction*)——提取管线、模型路由、去重裁决、失败序列踩坑、curator pass。由 `memory-review` 插件持有。
|
|
216
230
|
|
|
217
231
|
每个命名空间按分层 resolve:schema 默认 → 组合 `config:` 条目(base)→ `$DSH_HOME/settings.yaml` 中的用户文档。用户层缺失的字段继承组合值,因此部署可以固定默认值,用户只覆盖所需部分。当无 settings 服务挂载时(如 headless profile),各插件回退到组合条目,行为与组合配置完全一致。
|
|
@@ -220,18 +234,43 @@ dsh web
|
|
|
220
234
|
|
|
221
235
|
| 设置 | 默认值 | 说明 |
|
|
222
236
|
|---|---|---|
|
|
223
|
-
| `memoryMode` | `
|
|
237
|
+
| `memoryMode` | `digest` | `digest`:提示段落只注入指引,数据走消息尾部——一次性 `<memory-digest>` 库存清单(计数 + 主题词)+ 每步 `<recalled-memory>` 召回围栏;`full`:注入记忆内容 + 指引;`policy-only`:只注入指引,模型按需搜索;`custom`:注入用户自定义策略文本;`off`:不注入;`index`:注入存在性索引(每个条目一行),模型可看见存了什么并路由到 `memory_get`/`memory_search`。 |
|
|
224
238
|
| `memoryPolicyCustomText` | — | 当 `memoryMode` 为 `custom` 时使用的自定义策略文本。 |
|
|
225
239
|
| `memoryCharLimit` | `5000` | 会话内冻结记忆快照注入 `full` 模式时的字符预算(`0` = 不注入内容)。 |
|
|
240
|
+
| `memoryDigestCharLimit` | `800` | `digest` 模式下一次性 `<memory-digest>` 清单消息的字符预算(约 250 token;CJK 主题词更高)。`0` 关闭清单消息。 |
|
|
226
241
|
| `memoryMaxEntries` | `20` | 同一冻结快照的条目数上限(`0` = 无限制)。快照尾部附 `≈N tokens` 估算,注入成本始终可见。 |
|
|
227
242
|
| `maxSearchResults` | `50` | `memory_search` / `memory_list` 在调用未传 `limit` 时的默认返回条数上限,由工具插件实时读取。`0` = 无限制。 |
|
|
228
243
|
| `decayDays` | `30` | N 天内未召回条目的生命周期窗口,由 review 插件的 janitor 实时读取。`0` = 禁用。过期的 `project` 条目被**移除**(硬衰减);过期的 `global`/`user` 条目改为**软衰减**——打上 `stale` 戳,从注入面和笔记文件中隐藏但仍可搜索,再次召回即自动解除。固定(pin)条目始终豁免。 |
|
|
244
|
+
|
|
245
|
+
### `memory-notes` 命名空间
|
|
246
|
+
|
|
247
|
+
| 设置 | 默认值 | 说明 |
|
|
248
|
+
|---|---|---|
|
|
229
249
|
| `notesEnabled` | `true` | 注入项目笔记 prompt 段落(约定 + 踩坑日志)。已渲染进该段落的条目会从 memory 段落中排除,避免重复注入。不写任何仓库文件。 |
|
|
230
|
-
| `
|
|
231
|
-
| `
|
|
232
|
-
| `
|
|
250
|
+
| `notesConventionsCharLimit` | `1600` | 项目笔记「约定」半区的字符预算。预算挤掉的条目折叠为指向 `memory_search` 的计数行,绝不静默丢弃。预算在冻结时应用,实时修改于下一个会话/压缩边界生效。 |
|
|
251
|
+
| `notesPitfallsCharLimit` | `800` | 项目笔记「踩坑」半区的字符预算,约定区不再能把它挤死。同样按冻结时应用、同样折叠计数行。 |
|
|
252
|
+
| `notesMaxEntriesPerFile` | `100` | 选中进项目笔记段落的最大条目数(置顶优先,其次重要性、再新鲜度);其余折叠为计数行。 |
|
|
253
|
+
|
|
254
|
+
> **设置迁移**:0.9.x 的合并键 `notesCharLimit` 仍然生效——当只有它被设置时,两个半区按 60%/40%(约定/踩坑)派生;每设置一个新键即接管对应半区。把 `$DSH_HOME/settings.yaml`(或 composition `config:`)中的键改名即完成迁移。
|
|
255
|
+
|
|
256
|
+
### `memory-autorecall` 命名空间
|
|
257
|
+
|
|
258
|
+
| 设置 | 默认值 | 说明 |
|
|
259
|
+
|---|---|---|
|
|
260
|
+
| `autoRecallEnabled` | `true` | 步级自动召回:每个 agent step 用该步用户文本对 store 做 BM25 搜索,追加一块带围栏的 `<recalled-memory>` 消息。不触碰 system prompt,保持 KV-cache 前缀稳定;围栏命中只刷新最近召回时间,不计入访问计数。 |
|
|
233
261
|
| `autoRecallLimit` | `5` | 单次自动召回围栏内的最大条数(最小 1)。围栏本身上限 1200 字符。 |
|
|
234
262
|
| `autoRecallMinChars` | `12` | 该步用户文本短于该字符数时跳过召回(最小 1)。 |
|
|
263
|
+
| `hitSignalEnabled` | `false` | 启用使用命中信号:回答对注入条目 token 的覆盖超过 `hitSignalThreshold` 时累积 `hitCount`;仅选择信号,不驱动删除。 |
|
|
264
|
+
| `hitSignalThreshold` | `0.25` | 回答对条目 token 的 IDF 加权覆盖率达到该值才记一次命中。 |
|
|
265
|
+
|
|
266
|
+
### `memory-identity` 命名空间
|
|
267
|
+
|
|
268
|
+
| 设置 | 默认值 | 说明 |
|
|
269
|
+
|---|---|---|
|
|
270
|
+
| `identityEnabled` | `false` | 启用身份层:注入 `soul` 与 `user-profile` 段,开放 `identity_update` 工具。详见 [TECH_DESIGN §7.10](docs/TECH_DESIGN.zh.md)。 |
|
|
271
|
+
| `soulCharLimit` | `2000` | `soul` 注入段的字符预算(`0` = 禁用)。 |
|
|
272
|
+
| `userCharLimit` | `3000` | `user-profile` 注入段的字符预算(`0` = 禁用)。 |
|
|
273
|
+
| `identitySeedDir` | `""` | 身份种子覆盖目录(`SOUL.md` / `USER.md`);为空使用内置种子。 |
|
|
235
274
|
|
|
236
275
|
### `memory-review` 命名空间
|
|
237
276
|
|
|
@@ -256,7 +295,7 @@ dsh web
|
|
|
256
295
|
|
|
257
296
|
### 组合配置与 UI 设置
|
|
258
297
|
|
|
259
|
-
|
|
298
|
+
各命名空间均接受来自两个层的相同键。组合 `config:` 条目设置 base;UI 在其上写入用户层。四个 memory 家族命名空间共享一个组合行(`memory-context` 的 `config:` 承载它们全部键),而用户文档为每个命名空间保留独立的 section。例如,要把 `maxSearchResults: 100` 钉为部署默认值(用户仍可覆盖):
|
|
260
299
|
|
|
261
300
|
```yaml
|
|
262
301
|
memory:
|
|
@@ -273,22 +312,33 @@ memory-review:
|
|
|
273
312
|
extractionModelModel: deepseek-chat
|
|
274
313
|
```
|
|
275
314
|
|
|
276
|
-
`$DSH_HOME/settings.yaml`
|
|
315
|
+
`$DSH_HOME/settings.yaml` 示例(全部命名空间):
|
|
277
316
|
|
|
278
317
|
```yaml
|
|
279
318
|
memory:
|
|
280
|
-
memoryMode:
|
|
319
|
+
memoryMode: digest
|
|
281
320
|
memoryPolicyCustomText: ""
|
|
282
321
|
memoryCharLimit: 5000
|
|
322
|
+
memoryDigestCharLimit: 800
|
|
283
323
|
memoryMaxEntries: 20
|
|
284
324
|
maxSearchResults: 50
|
|
285
325
|
decayDays: 30
|
|
326
|
+
memory-notes:
|
|
286
327
|
notesEnabled: true
|
|
287
|
-
|
|
328
|
+
notesConventionsCharLimit: 1600
|
|
329
|
+
notesPitfallsCharLimit: 800
|
|
288
330
|
notesMaxEntriesPerFile: 100
|
|
289
|
-
|
|
331
|
+
memory-autorecall:
|
|
332
|
+
autoRecallEnabled: true
|
|
290
333
|
autoRecallLimit: 5
|
|
291
334
|
autoRecallMinChars: 12
|
|
335
|
+
hitSignalEnabled: false
|
|
336
|
+
hitSignalThreshold: 0.25
|
|
337
|
+
memory-identity:
|
|
338
|
+
identityEnabled: false
|
|
339
|
+
soulCharLimit: 2000
|
|
340
|
+
userCharLimit: 3000
|
|
341
|
+
identitySeedDir: ""
|
|
292
342
|
memory-review:
|
|
293
343
|
reviewEnabled: true
|
|
294
344
|
reviewCandidateThreshold: 10
|
|
@@ -341,7 +391,7 @@ memory:
|
|
|
341
391
|
| `tool-memory` | `@chenhw7/dsh-memory/tool` | 九个模型可用工具(人审模式下写入改为入队) |
|
|
342
392
|
| `memory-review` | `@chenhw7/dsh-memory/review` | 自动提取(投影 + 失败序列踩坑 + flush + 去重 + janitor + curator + 人审队列),持有 `memory-review` 设置命名空间 |
|
|
343
393
|
| `memory-notes` | `@chenhw7/dsh-memory/notes` | 项目笔记 prompt 投影(渲染约定/踩坑进 `project-notes` 段落;0.6 起不写仓库文件),注册 `ctx.projectNotes`;会话创建时清理 ≤0.5.x 的文件导出残留 |
|
|
344
|
-
| `memory-context` | `@chenhw7/dsh-memory/context` | 系统提示注入(`memory` @
|
|
394
|
+
| `memory-context` | `@chenhw7/dsh-memory/context` | 系统提示注入(`memory` @6000 + `project-notes` @6001,位于工具指引之后)、消息尾部注入(一次性清单 + 每步召回围栏),持有 `memory` 设置命名空间 |
|
|
345
395
|
| `memory-remote` | `@chenhw7/dsh-memory/remote-service` | 记忆管理 UI 的 `@Remote` 服务(设置「记忆」区经 `/api` 通道消费) |
|
|
346
396
|
|
|
347
397
|
**存储**:本 bundle **不**插入 `storage-json` / `storage-domain` 行。`dsh-web-app` bundle 已经提供它们(并在 `$DSH_HOME/storages` 下使用正确的根路径)。如果在这里重复插入,会覆盖已有配置(patch 会替换整行,后写覆盖先写)。memory store provider 将 `storageDomain` 服务作为 peer dependency 使用。
|
|
@@ -365,8 +415,8 @@ memory:
|
|
|
365
415
|
|
|
366
416
|
- **无语义/向量检索** — `memory_search` 是对结构化 KV 条目的 BM25 词法排序(Latin 逐词、CJK 一元 + 二元分词),不是 embeddings;不含相同词元的同义表述无法命中。
|
|
367
417
|
- **提取质量跟随会话模型** — review/flush/curator 复用会话当前路由的 provider/model,除非显式覆盖。
|
|
368
|
-
- **会话中途的提取在下次压缩或新会话前不会出现在提示里** —
|
|
369
|
-
-
|
|
418
|
+
- **会话中途的提取在下次压缩或新会话前不会出现在提示里** — 注入段落为 KV-cache 稳定性而冻结;步级自动召回(默认开)提供逐步新鲜度,一次性清单在压缩后补发一次。
|
|
419
|
+
- **远程管理访问同时依赖传输信任与部署开关** — 任何被 dsh 宿主 `trustedHosts` 放行的主机都能调用读取 RPC;普通远程记忆写入默认拒绝(`remoteWritesEnabled: false`),只有显式启用后才开放,且 `identityRevert` 在写开关之上还要求独立的 `identityRevertEnabled` 开关(默认 `true`)——它恢复的是通过 scanner 的历史版本,而非接受任意新内容。应收紧 `trustedHosts`,且除非放行的每台主机都可信,否则保持远程写入关闭(见[威胁模型](docs/TECH_DESIGN.zh.md))。
|
|
370
420
|
- **dsh 仍处于开发者预览阶段** — 可能会有破坏性变更;本 bundle 的 peer dependency 范围跟随 dsh 发布线。
|
|
371
421
|
- **要求 alpha 渠道(0.1.2-alpha.x)** — 本 bundle 使用 0.1.2-alpha 的 settings API(`ctx.settings.installSection`、host-only 投影注册),peer 范围为 `^0.1.2-alpha.2`。rc(`next`)线仍是旧的模块级 `installSettingsSection` helper,无法加载本 bundle;请从 `alpha` dist-tag 安装 dsh。client bundle 同样对齐 alpha 客户端包(`@deepseek-ai/dsh-client-store` / `dsh-client-ui-settings`),它们取代了已移除的 `dsh-client-runtime`。
|
|
372
422
|
|
package/cordis.patch.yml
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# @chenhw7/dsh-memory — long-term memory bundle patch for the DeepSeek Harness.
|
|
2
2
|
#
|
|
3
|
-
# Installs the memory store provider,
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
3
|
+
# Installs the memory store provider, nine model-facing memory tools plus the
|
|
4
|
+
# identity_update agent tool, automatic
|
|
5
|
+
# review + flush extraction, the project-notes prompt projection, the identity
|
|
6
|
+
# layer, and system-prompt context injection as ONE layer over dsh-base. The
|
|
7
|
+
# memory rows point at this
|
|
7
8
|
# package's own export sub-paths; the two storage rows are NOT inserted here
|
|
8
9
|
# because dsh-web-app already provides them (storage-json + storage-domain
|
|
9
10
|
# with the correct root path). For a headless profile that has no storage
|
|
@@ -40,6 +41,12 @@
|
|
|
40
41
|
- id: memory-notes
|
|
41
42
|
name: '@chenhw7/dsh-memory/notes'
|
|
42
43
|
|
|
44
|
+
# Identity layer: seeds and reads the agent's self-documents (SOUL.md /
|
|
45
|
+
# USER.md) from the store's identity tables; memory-context injects them
|
|
46
|
+
# as the `soul` (80) and `user-profile` (81) prompt sections.
|
|
47
|
+
- id: memory-identity
|
|
48
|
+
name: '@chenhw7/dsh-memory/identity'
|
|
49
|
+
|
|
43
50
|
# System-prompt section injection + frontend settings namespace.
|
|
44
51
|
- id: memory-context
|
|
45
52
|
name: '@chenhw7/dsh-memory/context'
|
package/lib/benchmark/index.d.ts
CHANGED
|
@@ -118,7 +118,7 @@ export interface EvalReport {
|
|
|
118
118
|
export declare function evaluateRecall(searcher: Searcher, k?: number): EvalReport;
|
|
119
119
|
/** Standing injection cost of one prompt mode over the fixture store. */
|
|
120
120
|
export interface InjectionCost {
|
|
121
|
-
readonly mode: 'policy-only' | 'index' | 'full';
|
|
121
|
+
readonly mode: 'policy-only' | 'index' | 'full' | 'digest';
|
|
122
122
|
/** Rendered section characters. */
|
|
123
123
|
readonly chars: number;
|
|
124
124
|
/** ≈tokens at the ~4-chars/token heuristic used by readMemorySnapshot. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/benchmark/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,gFAAgF;AAChF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,K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