dsh-memory-bond 0.3.0-beta.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/CHANGELOG.md +6 -7
  2. package/README.md +125 -91
  3. package/README.zh-CN.md +122 -92
  4. package/SECURITY.md +29 -0
  5. package/dist/audit.js +155 -80
  6. package/dist/automatic.js +10 -2
  7. package/dist/client.js +2035 -0
  8. package/dist/command-scope.js +4 -4
  9. package/dist/commands.js +15 -9
  10. package/dist/consolidation-store.js +87 -20
  11. package/dist/consolidation.js +2 -6
  12. package/dist/domain.js +8 -4
  13. package/dist/encoder.js +46 -5
  14. package/dist/file-import-store.js +120 -0
  15. package/dist/file-import.js +265 -0
  16. package/dist/foreground-attempts.js +91 -0
  17. package/dist/guidance.js +133 -92
  18. package/dist/host.js +13 -0
  19. package/dist/index-policy.js +91 -48
  20. package/dist/index.js +102 -40
  21. package/dist/knowledge-hooks.js +70 -27
  22. package/dist/knowledge.js +2 -3
  23. package/dist/maintenance-store.js +38 -4
  24. package/dist/maintenance.js +29 -5
  25. package/dist/personal.js +37 -0
  26. package/dist/policy.js +45 -47
  27. package/dist/prompt-copy.js +93 -0
  28. package/dist/proposal-receipts.js +70 -0
  29. package/dist/proposal-review.js +656 -0
  30. package/dist/propose-contract.js +32 -36
  31. package/dist/question-answers.js +86 -29
  32. package/dist/retrieval.js +25 -8
  33. package/dist/scope-narrowing.js +49 -0
  34. package/dist/search-index.js +93 -13
  35. package/dist/semantic.js +69 -207
  36. package/dist/service.js +633 -204
  37. package/dist/sharing.js +7 -13
  38. package/dist/sources.js +28 -3
  39. package/dist/store.js +432 -96
  40. package/dist/tool-experience.js +87 -0
  41. package/dist/turn-review-store.js +83 -16
  42. package/dist/turn-review.js +155 -59
  43. package/dist/ui.js +128 -26
  44. package/dist/vector-index.js +69 -33
  45. package/docs/architecture.zh-CN.md +52 -0
  46. package/docs/benchmark.zh-CN.md +60 -0
  47. package/docs/benchmarks/repository-tasks.json +5355 -0
  48. package/docs/images/bond-memory-principle-en.svg +644 -0
  49. package/docs/images/bond-memory-principle-zh.svg +644 -0
  50. package/docs/images/bond-memory-principle.drawio +644 -0
  51. package/docs/images/memory-settings-en.png +0 -0
  52. package/docs/images/memory-settings-zh.png +0 -0
  53. package/docs/images/memory-turn-recalled-en.png +0 -0
  54. package/docs/images/memory-turn-recalled-zh.png +0 -0
  55. package/docs/images/memory-turn-saved-en.png +0 -0
  56. package/docs/images/memory-turn-saved-zh.png +0 -0
  57. package/docs/media/memory-bond-name-en.gif +0 -0
  58. package/docs/media/memory-bond-name-en.mp4 +0 -0
  59. package/docs/media/memory-bond-name-zh.gif +0 -0
  60. package/docs/media/memory-bond-name-zh.mp4 +0 -0
  61. package/locale/detail.en.md +5 -1
  62. package/locale/detail.zh.md +5 -1
  63. package/locale/en.json +338 -0
  64. package/locale/zh.json +338 -0
  65. package/native/embeddings/NOTICE.md +2 -2
  66. package/package.json +39 -19
  67. package/scripts/benchmark-bond.mjs +72 -0
  68. package/scripts/benchmark-conditions.mjs +144 -0
  69. package/scripts/benchmark-example.mjs +37 -0
  70. package/scripts/benchmark-scale.mjs +119 -0
  71. package/scripts/benchmark-scenarios.mjs +57 -0
  72. package/scripts/benchmark-tasks.mjs +244 -0
  73. package/src/audit.ts +144 -85
  74. package/src/automatic.ts +12 -2
  75. package/src/command-scope.ts +4 -4
  76. package/src/commands.ts +12 -8
  77. package/src/consolidation-store.ts +80 -18
  78. package/src/consolidation.ts +2 -6
  79. package/src/domain.ts +9 -4
  80. package/src/encoder.ts +46 -6
  81. package/src/file-import-store.ts +139 -0
  82. package/src/file-import.ts +256 -0
  83. package/src/foreground-attempts.ts +97 -0
  84. package/src/guidance.ts +138 -102
  85. package/src/host.ts +22 -2
  86. package/src/index-policy.ts +93 -46
  87. package/src/index.ts +87 -43
  88. package/src/knowledge-hooks.ts +71 -29
  89. package/src/knowledge.ts +2 -3
  90. package/src/maintenance-store.ts +37 -4
  91. package/src/maintenance.ts +25 -5
  92. package/src/personal.ts +36 -0
  93. package/src/policy.ts +55 -52
  94. package/src/prompt-copy.ts +99 -0
  95. package/src/proposal-receipts.ts +59 -0
  96. package/src/proposal-review.ts +614 -0
  97. package/src/propose-contract.ts +31 -35
  98. package/src/question-answers.ts +99 -29
  99. package/src/retrieval.ts +26 -9
  100. package/src/scope-narrowing.ts +58 -0
  101. package/src/search-index.ts +94 -14
  102. package/src/semantic.ts +67 -188
  103. package/src/service.ts +595 -210
  104. package/src/sharing.ts +7 -14
  105. package/src/sources.ts +26 -4
  106. package/src/store.ts +434 -97
  107. package/src/tool-experience.ts +93 -0
  108. package/src/turn-review-store.ts +86 -15
  109. package/src/turn-review.ts +142 -60
  110. package/src/ui.ts +122 -27
  111. package/src/vector-index.ts +57 -29
  112. package/client/index.js +0 -1186
  113. package/design/dsh-memory-plugin-design.md +0 -46
  114. package/design/dsh-memory-plugin-evaluation.md +0 -135
  115. package/design/evaluations/locomo-conv-26-2026-12-03.json +0 -252
  116. package/design/evaluations/locomo-conv-26-paired-2026-12-03.json +0 -549
  117. package/design/evaluations/locomo-conv-26-write-replay-2026-12-03.json +0 -289
  118. package/design/evaluations/project-memory-tasks-2026-12-03.json +0 -1059
  119. package/design/memory-lifecycle-consolidation.excalidraw +0 -1212
  120. package/design/memory-lifecycle-consolidation.mobile.excalidraw +0 -1083
  121. package/design/memory-lifecycle-consolidation.mobile.svg +0 -2
  122. package/design/memory-lifecycle-consolidation.mobile.zh-CN.excalidraw +0 -1083
  123. package/design/memory-lifecycle-consolidation.mobile.zh-CN.svg +0 -94
  124. package/design/memory-lifecycle-consolidation.svg +0 -2
  125. package/design/memory-lifecycle-consolidation.zh-CN.excalidraw +0 -1212
  126. package/design/memory-lifecycle-consolidation.zh-CN.svg +0 -94
  127. package/design/memory-lifecycle.excalidraw +0 -2105
  128. package/design/memory-lifecycle.mobile.excalidraw +0 -1896
  129. package/design/memory-lifecycle.mobile.svg +0 -95
  130. package/design/memory-lifecycle.mobile.zh-CN.excalidraw +0 -1896
  131. package/design/memory-lifecycle.mobile.zh-CN.svg +0 -97
  132. package/design/memory-lifecycle.svg +0 -95
  133. package/design/memory-lifecycle.zh-CN.excalidraw +0 -2105
  134. package/design/memory-lifecycle.zh-CN.svg +0 -97
  135. package/native/embeddings/LICENSE +0 -21
  136. package/native/embeddings/en/model.onnx +0 -4
  137. package/native/embeddings/en/vocab.txt +0 -30522
  138. package/native/embeddings/runtime/LICENSE +0 -21
  139. package/native/embeddings/runtime/ThirdPartyNotices.txt +0 -6156
  140. package/native/embeddings/runtime/ort-wasm-simd-threaded.mjs +0 -70
  141. package/native/embeddings/runtime/ort-wasm-simd-threaded.wasm +0 -0
  142. package/native/embeddings/runtime/ort.wasm.min.mjs +0 -7
  143. package/native/embeddings/worker.mjs +0 -97
  144. package/native/embeddings/zh/model.onnx +0 -0
  145. package/native/embeddings/zh/vocab.txt +0 -21128
package/CHANGELOG.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.0-beta.0 · 2026-12-03
3
+ ## 1.0.0 (2026-12-04)
4
4
 
5
- - The npm package is now `dsh-memory-bond`. Install with `dsh plugin --profile desktop add dsh-memory-bond@beta`. Each profile starts with a fresh database under `memory-bond/`. If it has an earlier keeper plugin, remove the old package before adding Bond.
6
- - The Memory settings entry and the plugin card now share the same heavier-weight icon, which inherits the current theme color.
7
- - Saved agreements retain their ID across corrections. You can check the original wording, see which revision reached a conversation, and withdraw the agreement. First-save checks now cover explicit ownership, project scope, conditions, negation and one-time requests.
8
- - Eligible user text can be reviewed after the foreground model exhausts its output budget. End-of-turn recovery observes the profile’s existing limits and skips portions already handled.
9
- - When standing agreements exceed the prompt budget, the current task can bring relevant older agreements into view. Search accepts Chinese and English wording in the same call and stops offering repeated searches when every accessible scope is empty.
5
+ Install `dsh-memory-bond` from npm using the DSH plugin manager. The core package includes local storage and keyword search. The source checkout also contains optional English and Chinese semantic search models. [npm package](https://www.npmjs.com/package/dsh-memory-bond/v/1.0.0)
10
6
 
11
- The package includes local models and the runtime for offline embeddings. [Installation and host compatibility](README.md#install-the-public-beta) · [中文安装说明](README.zh-CN.md#安装公开-beta)
7
+ - Save project agreements and profile-wide preferences with revisions and source evidence. Inspect, correct or withdraw them in Settings.
8
+ - Recall applicable agreements in the prompt or search on demand. Keyword search runs locally, with optional English and Chinese models for semantic search.
9
+ - Inspect chat receipts, review proposed imports from project instruction files, and manage records with `/project-memory`.
10
+ - Review suggested memories in **Settings → Memory**. Chat shows a shortcut for suggestions from that conversation. File imports go straight to settings and skip Markdown index links and standalone rationale paragraphs.
package/README.md CHANGED
@@ -1,148 +1,182 @@
1
- # DSH Memory Bond
1
+ <p align="center">
2
+ <img src="./client/memory-icon.svg" width="88" height="88" alt="DSH Memory Bond logo">
3
+ </p>
4
+ <h1 align="center">DSH Memory Bond</h1>
5
+ <p align="center"><strong>A local memory plugin for DeepSeek Harness.</strong></p>
6
+ <p align="center"><a href="./README.zh-CN.md">简体中文</a> · <a href="#quick-install">Quick install</a> · <a href="#try-it-across-two-projects">Try it across two projects</a> · <a href="#features">Features</a> · <a href="#faq">FAQ</a> · <a href="#repository-task-benchmark">Benchmark</a></p>
2
7
 
3
- English · [简体中文](https://app.unpkg.com/dsh-memory-bond@0.3.0-beta.0/files/README.zh-CN.md)
8
+ In one project, tell the assistant “Please call me Alex.” Switch to another project and ask “What should you call me?” It answers “Alex.” Open the receipt beneath the reply to see the preference the model received.
4
9
 
5
- DSH Memory Bond carries your agreements into new DeepSeek Harness chats. Each profile keeps one local SQLite database. Global preferences can follow you across projects, while project rules apply only to matching checkouts. **Recall has three layers.** A chat gets applicable rules in its prompt, can look up details for the task, and can check the original wording when you ask for a source. Optional background consolidation checks for possible duplicates while a project chat is idle.
10
+ [![The assistant recalls Alex in a different project. Opening the memory receipt shows which preference reached the model.](./docs/media/memory-bond-name-en.gif)](./docs/media/memory-bond-name-en.mp4)
6
11
 
7
- [Install](#install-the-public-beta) · [Quick start](#try-it-across-two-chats) · [How memory works](#how-memory-works) · [Assistant tools](#tools-and-controls) · [Evaluation results](#evaluation-results) · [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
12
+ [Watch the full walkthrough](./docs/media/memory-bond-name-en.mp4). Recorded in DSH Web with Memory Bond 1.0.0 and a scripted local assistant. The plugin saves the preference and generates the receipt during the recording.
8
13
 
9
- ## Install the public beta
14
+ You can check what the assistant remembered, see the words it came from, and change or withdraw it. Optional duplicate checks run when a project chat is idle. They are off by default, and you decide which entries to keep.
10
15
 
11
- Open DSH Desktop once to initialize its profile, quit the app, then run the following command and restart DSH. For Web, replace `desktop` with `web`.
16
+ <a id="install"></a>
17
+
18
+ ## Quick install
19
+
20
+ Install `dsh-memory-bond` from the public npm registry. The core package includes local storage and keyword search. Memory Bond 1.0.0 supports DSH `>=0.2.2-rc.3 <0.3.0-0`. [npm package](https://www.npmjs.com/package/dsh-memory-bond) · [Changelog](./CHANGELOG.md)
21
+
22
+ **DSH Desktop**
23
+
24
+ 1. In the sidebar, open **Plugins → Add plugin**.
25
+ 2. Select the public npm registry and enter `dsh-memory-bond` in **Package name or address**.
26
+ 3. Click **Install**, then **Enable now**. Restart DSH if prompted.
27
+
28
+ **Command line**
29
+
30
+ For Desktop, open DSH once to initialize the profile, then quit the app completely. Run the command below and reopen DSH. For DSH Web, use `web` in place of `desktop` and restart the Web host.
12
31
 
13
32
  ```sh
14
- dsh plugin --profile desktop add dsh-memory-bond@beta
33
+ dsh plugin --profile desktop add dsh-memory-bond --registry=https://registry.npmjs.org
15
34
  ```
16
35
 
17
- This release is `0.3.0-beta.0`. Replace `@beta` with `@0.3.0-beta.0` to pin it. On macOS, if the CLI is outside your `PATH`, use `"/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh"`. The table lists the hosts verified for this release. [Public npm package](https://www.npmjs.com/package/dsh-memory-bond)
36
+ <a id="try-it-in-two-chats"></a>
18
37
 
19
- | Environment | Verified version |
20
- | --- | --- |
21
- | macOS DSH Desktop host | `0.2.2-rc.5` |
22
- | Standalone DSH CLI on macOS (tested on Node.js 24.15.0, host requires ≥24.9.0) | `0.2.2-rc.3`, `0.2.2-rc.4` |
38
+ ## Try it across two projects
23
39
 
24
- Bond starts with a fresh `memory-bond/` data directory in each profile. If the same profile already has `dsh-memory-keeper`, quit DSH and remove that package with `dsh plugin --profile desktop remove dsh-memory-keeper` before adding Bond. The previous package’s data stays in its original directory.
40
+ 1. In your first project, tell the assistant “Please call me Alex.” Expand **Memory receipts for this turn** beneath its reply to see the saved preference.
41
+ 2. Switch to a different project in the same DSH profile. Start a chat there and ask “What should you call me?” The assistant can use the name you gave it in the first project.
42
+ 3. Open the receipt beneath the new reply, then expand the name preference. **Full text delivered** shows that the model received that memory for this answer.
25
43
 
26
- ## Try it across two chats
44
+ If the first chat has no saved entry, run `/project-memory status` and check that `memoryEnabled` is `true`. The turn receipt also shows the reason for an unsuccessful save attempt.
27
45
 
28
- 1. Restart DSH and open a writable chat in a Git repository. Say **“For this project, always start release notes with user-visible changes and put dependency updates last.”** Look for the save receipt under the message.
29
- 2. Start a **new chat in the same repository**. Say **“Draft release notes. We fixed the login loop and updated the HTTP library.”** Check which change leads.
30
- 3. Open **Settings → Memory** (设置 → 记忆), select the project, and inspect the entry. You can see its current version, check its source, change when it is used, or withdraw it.
46
+ <details>
47
+ <summary>See how a project remembers its release-note format</summary>
31
48
 
32
- **Which command runs after you correct a project rule?** In the host test, both Make targets exist. Each task starts a fresh chat with the same request to run the integration checks. The user messages below are translated from the Chinese fixture.
49
+ These screenshots use a local scripted assistant in DSH Web. The first chat records the save.
33
50
 
34
- | User message or action | Version received by the new chat | Target recorded by the Makefile |
35
- | --- | --- | --- |
36
- | “Use make river-suite for this project's integration checks from now on.” | Revision 1 in the first request | `make river-suite` |
37
- | “Correction: use make lake-suite for this project's integration checks from now on.” | Revision 2 of the same agreement | `make lake-suite` |
38
- | Switch the agreement to on-demand recall | Revision 3 retrieved before execution | `make lake-suite` |
39
- | Withdraw the agreement and give `make check` as the fallback for this task | The withdrawn version is absent | `make check` |
51
+ <img src="./docs/images/memory-turn-saved-en.png" width="751" alt="The first chat’s receipt shows the saved project convention for release notes.">
40
52
 
41
- From a source checkout, run `npm run verify:tasks` to reproduce the sequence. It checks the original user events, the versions included in model requests, and the targets recorded by the Makefile. [Host verification and results (Chinese)](https://app.unpkg.com/dsh-memory-bond@0.3.0-beta.0/files/design/dsh-memory-plugin-evaluation.md)
53
+ In the new chat, **Full text delivered** shows that the model received the convention while drafting the notes.
42
54
 
43
- <picture>
44
- <source media="(max-width: 600px)" srcset="https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle.mobile.svg">
45
- <img src="https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle.svg" alt="One local SQLite database per profile holds global and project memory. Layer 1 puts applicable rules in the prompt, such as the corrected just integration command at revision 2. Layer 2 retrieves current conclusions, conditions and exceptions on demand. Layer 3 checks an excerpt and its verification status when the user asks for a source. Optional consolidation checks roughly hourly while a project chat stays idle.">
46
- </picture>
55
+ <img src="./docs/images/memory-turn-recalled-en.png" width="751" alt="The new chat’s receipt shows the full text of the release-note convention reached the model.">
47
56
 
48
- [Full-size diagram](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle.svg) · Excalidraw sources ([desktop](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle.excalidraw) / [mobile](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle.mobile.excalidraw)) · [Cross-session test results (Chinese)](https://app.unpkg.com/dsh-memory-bond@0.3.0-beta.0/files/design/dsh-memory-plugin-evaluation.md)
57
+ </details>
49
58
 
50
- ## How memory works
59
+ ## Features
51
60
 
52
- **Saving a memory.** The assistant proposes a fact, preference or rule with a quote from the user. The plugin locates that quote in the session and checks write access, scope and repository constraints. A repeated agreement can reuse the same revision. An explicit correction to a uniquely identified entry keeps its ID and advances its version. For a test command, that means a fresh chat can receive the corrected command with its applicable conditions.
61
+ - **Remember across conversations.** Save a preferred name for every project in your DSH profile, or keep a writing convention in just one project. [Memory scopes](./docs/architecture.zh-CN.md)
62
+ - **Keep memories up to date.** Correct an entry in chat or in Settings. The correction gets a new version under the same ID. If a global agreement belongs in just this project, say so in the next turn of the same chat. You can also withdraw a convention. [Revisions](./src/store.ts) · [Scope corrections](./src/scope-narrowing.ts)
63
+ - **See where a memory came from.** Inspect the retained quote, reopen the original chat when available, and expand a reply’s receipt to see which version reached each model request. The receipt distinguishes a lookup hint, delivery of the full text, an explicit citation and a matching Bash command. [Request audit](./src/audit.ts)
64
+ - **Review possible duplicates.** Turn on **Cross-session review** in **Settings → Memory** to compare similar entries from different chats in a project. You can keep both or withdraw one. [Duplicate checks](./src/consolidation.ts)
65
+ - **Keep project rules relevant.** Bond checks the current worktree’s paths, branch, Make or Just targets and repository instructions. A missing target flags a rule for review in that worktree. [Applicability checks](./src/policy.ts)
66
+ - **Move conventions between project memory and repository files.** In a writable project chat, enter `/project-memory import all` to scan `AGENTS.md`, `CLAUDE.md` and Claude Code project memory. Open **Settings → Memory** to review the import suggestions and choose **Remember** or **Ignore**. You can also export a saved project convention to your worktree and include the change in a pull request.
53
67
 
54
- **The task determines which layer to read.** When the prompt already contains the applicable command, the assistant can use it directly.
68
+ <details>
69
+ <summary>Choose an import source or preview and apply an export</summary>
55
70
 
56
- | Recall layer | When it is used and what reaches the assistant |
57
- | --- | --- |
58
- | 1 · Prompt index | When DSH builds a model request, a ranked index supplies applicable standing rules with their actions, conditions, exceptions and versions. The default budget is **16 lines and 2,048 UTF-8 bytes**. |
59
- | 2 · On-demand details | The assistant can read a current conclusion by ID or search by subject, topic, keywords, or similar wording. It can submit Chinese and English versions of a query in one call. SQLite FTS5 and each language’s BGE model run locally. Sensitive entries and on-demand facts stay out of the standing index. |
60
- | 3 · Source verification | When you ask where a rule came from, a separate lookup can verify a project quote against one original session event. It distinguishes verified words, a retained excerpt, user-confirmed wording and a receipt with no quote. You can erase the excerpt and keep the conclusion. |
71
+ - **Choose a source.** Enter `/project-memory import agents` for the root `AGENTS.md`, `/project-memory import claude` for `CLAUDE.md` and `.claude/CLAUDE.md`, or `/project-memory import claude-memory` for Claude Code’s memory for this project.
72
+ - **Preview an export.** Enter `/project-memory status`, find the project entry’s `id` and `rev`, and combine them as `ID@revision`. Enter `/project-memory export agents <ID@revision>` to see the proposed changes to `AGENTS.md`. For a runbook with an observed successful verification, enter `/project-memory export skill <ID@revision> release-check` to preview `.dsh/skills/release-check/SKILL.md`. Replace the angle-bracketed placeholder with the actual reference.
73
+ - **Write the file.** Check the returned `diff`, then copy and run the full command in the `apply` field in the same chat. The preview is valid for 30 minutes. [File import](./src/file-import.ts) · [Export implementation](./src/sharing.ts)
74
+
75
+ </details>
61
76
 
62
- **Scope determines where a memory travels.** A global preference, such as how you write deadlines, can follow you across projects in the same profile. A project's test command belongs to that repository. Linked Git worktrees share project memory, with path, branch and repository instructions checked for applicability. The settings panel can also show whether a particular revision actually reached the model in the selected session.
77
+ <img src="./docs/images/memory-settings-en.png" width="564" alt="Settings → Memory shows two global preferences and the project’s release-note convention expanded to show the original quote and conversation link.">
63
78
 
64
- ## What runs in the background?
79
+ ## How it works
65
80
 
66
- **Periodic cross-session consolidation is off by default.** Once enabled, the first check is scheduled when a writable main chat in the project completes a turn and goes idle. Checks repeat roughly once an hour while the chat stays idle. Starting another turn in that chat pauses the schedule and cancels any comparison in progress.
81
+ Bond stores each memory in your DSH profile’s SQLite database with a version and a source reference. A chat can receive a standing rule in its prompt (L1), look up a memory when it needs the details (L2), or check the retained quote when someone asks for the source (L3). Each serves a different need.
67
82
 
68
- <picture>
69
- <source media="(max-width: 600px)" srcset="https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle-consolidation.mobile.svg">
70
- <img src="https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle-consolidation.svg" alt="Once enabled, consolidation checks after a completed project turn, repeats about hourly while idle, and pauses for a new turn. SQLite scans existing entries in batches, then matches new or revised entries against older ones. An empty check makes zero model calls. For an eligible pair, the model compares two summaries. If it flags a duplicate, the user chooses which records to keep.">
71
- </picture>
83
+ ![Bond reviews a release-note convention and saves it in local SQLite with its revision and source. A later chat can use the rule, look up details or check the original quote.](./docs/images/bond-memory-principle-en.svg)
72
84
 
73
- [Full-size diagram](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle-consolidation.svg) · Excalidraw sources ([desktop](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle-consolidation.excalidraw) / [mobile](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/memory-lifecycle-consolidation.mobile.excalidraw))
85
+ [Full-size diagram](./docs/images/bond-memory-principle-en.svg) · [Editable draw.io source](./docs/images/bond-memory-principle.drawio) · [Architecture and configuration (Chinese)](./docs/architecture.zh-CN.md)
74
86
 
75
- | Job | What it does | Default and cost |
87
+ <details>
88
+ <summary>One command, two Git worktrees — inspect both replies and reproduce them locally</summary>
89
+
90
+ The project first used `make verify` for integration checks. A correction changed the command to `make integration` in revision 2, shared by both worktrees. We removed the `integration` target from the Makefile in `release` alone, then opened a fresh chat in each worktree. On DSH `0.2.2-rc.5`, an offline scripted assistant received the same prompt in both chats, “Run the integration checks for this change.”
91
+
92
+ | Where to look | `main` · target present | `release` · target removed |
76
93
  | --- | --- | --- |
77
- | End-of-turn review | When a writable main chat completes a turn or reaches its output limit, review eligible user excerpts the assistant has yet to handle. For a correction, check the exact revision before saving. | Up to **20 batches per profile per UTC day**, using the session’s model. Set `turnReviewBudget: 0` to turn this off. |
78
- | Cross-session consolidation | SQLite scans existing entries in batches and saves its position. It then matches new and revised entries against older entries about the same subject from other chats in the same project. | A check with no eligible pair makes zero model calls. The model compares at most **one pair per project per hour**. |
79
- | Historical review | Recheck a project proposal already present in an older session and prepare a review card when its user quote can be verified. | Automatic review is **off** (`historyBudget: 0`). It reuses recorded proposals locally. |
80
- | Search indexing | Update local embeddings as entries change. Keyword search works while the vector index is building. | Runs locally on the CPU using the bundled models and WebAssembly runtime. |
94
+ | `/project-memory status` | Revision 2 is applicable | The same revision appears under `needs_review` |
95
+ | **Memory receipts for this turn** below the reply | Both model requests received the full text of revision 2. The first also records a matching execution. | The assistant searched once. No delivery of this revision was recorded. |
96
+ | Bash tool and marker file | `make integration` ran once and exited with code 0 | No Bash call was attempted |
97
+
98
+ From the source checkout with DSH, Git and Make installed, run the following commands. The demo uses a temporary repository and an isolated DSH profile. It prints both source quotes, the worktree checks and the per-request receipts.
81
99
 
82
- With memory enabled, use the **跨会话整理** switch under **Settings → Memory** to turn consolidation on or off. Turning memory off pauses consolidation and disables its switch. Turning memory back on restores your previous choice. The model sees the candidate pair’s topics, conclusions and conditions, including relevant paths and exceptions. Source quotes, transcripts and sensitive entries are excluded. **You decide whether to keep both entries or keep one and withdraw the other.**
100
+ ```sh
101
+ npm run build
102
+ npm run verify:dsh -- --worktrees
103
+ ```
83
104
 
84
- ## Tools and controls
105
+ </details>
85
106
 
86
- DSH exposes five tools to the assistant while memory is enabled.
107
+ ## FAQ
87
108
 
88
- | Tool | Purpose |
89
- | --- | --- |
90
- | `project_memory_propose` | Propose a scoped memory or correction grounded in the user’s words. |
91
- | `project_memory_search` | Find current records in the visible scope by ID, subject and topic, keywords, or semantic similarity. |
92
- | `project_memory_read` | Read the current conclusion, conditions, exceptions and revision. |
93
- | `project_memory_source` | Look up the retained wording and its verification status when the user asks for the source. |
94
- | `project_memory_ticket` | Open a short-lived ticket offered by DSH for a matching project fact, reference or runbook. |
109
+ **Do I need another API key or database service?** Bond uses the model already configured in DSH and creates a local SQLite database in your profile.
95
110
 
96
- For direct control, open **Settings → Memory** or run `/project-memory help` in a client that supports slash commands. Use `/project-memory status` to inspect records and `/project-memory search release notes` to find an entry. Project commands also support file-backed facts, runbooks, command guards, backups, and a preview before exporting an agreement to `AGENTS.md` or a verified runbook to a skill.
111
+ **What leaves my machine?** Search and optional embedding inference run locally. Your DSH model provider receives the memories included in a chat request. To review a save, it can also receive your message, the proposed wording, relevant memories and applicable project instructions. By default, end-of-turn review can send eligible excerpts and related non-sensitive memories even if you did not ask to save anything. Set `turnReviewBudget` to `0` to turn off that review. Duplicate checks send the two candidates’ summaries and conditions. The local database and its managed backups are unencrypted. [Security and privacy](./SECURITY.md)
97
112
 
98
- ## Storage and configuration
113
+ **Which chats share a memory?** Global memories are available across projects in the same profile. Project memories follow the Git repository, including its linked worktrees. Separate clones have separate project memories. For a folder outside Git, configure `nonGitRoots`. [Project identity](./src/domain.ts)
99
114
 
100
- The default desktop database is `~/.dsh/profiles/desktop/memory-bond/memory.sqlite`. Each profile has its own `memory-bond/` directory, including managed backups in `backups/projects.sqlite`. The plugin uses the runtime’s built-in SQLite and stores the database as an ordinary, unencrypted file. DSH manages the original chat history separately.
115
+ **Can I see, change or turn off memory?** Open **Settings → Memory** to inspect sources, edit or withdraw an entry. Turn off **Enable memory** to stop the assistant from saving and using memories. Existing records stay available for you to manage. In chat, `/project-memory help` lists the commands.
101
116
 
102
- Search and embedding computation run on your machine. Your configured DSH model provider receives entries included in a model request, eligible excerpts used for end-of-turn review, and candidate summaries when you enable consolidation. You can pause assistant saving and recall from **Settings → Memory** and still manage existing records.
117
+ **What do the optional models add?** Keyword search matches terms. A local model can also find related wording, including when you phrase the same question differently. You can add either language or both. [Set up model packs](#optional-language-models)
103
118
 
104
- Set plugin options in the profile’s `cordis.patch.yml`. For example, this keeps foreground saving and turns off the extra end-of-turn model calls.
119
+ | Installed | What you can use |
120
+ | --- | --- |
121
+ | Core package | Local storage and keyword search |
122
+ | Core + English model | Also searches English entries by meaning |
123
+ | Core + Chinese model | Also searches Chinese entries by meaning |
105
124
 
106
- ```yaml
107
- - id: dsh-memory-bond
108
- config:
109
- turnReviewBudget: 0
110
- ```
125
+ **What does “once per hour” cover?** With cross-session review enabled, Bond looks for similar entries when a writable project chat goes idle after a completed turn. Per project, it sends at most one pair to the session model per hour for comparison. Chat requests and memory-write reviews have their own model calls. [Background review](./src/consolidation.ts)
126
+
127
+ <a id="benchmark-results"></a>
111
128
 
112
- Other options include `maxRows` and `maxTokens` for the index budget, `nonGitRoots` for explicit project directories, and `historyDays` for retaining superseded or withdrawn content (default **90 days**). By default, spare index space can hold up to two pointers to older agreements whose terms match the current task. Set `overflowHints: false` to disable pointers or `true` to also allow unmatched candidates.
129
+ ## Repository task benchmark
113
130
 
114
- ## Evaluation results
131
+ A scripted assistant tried 34 repository tasks with five phrasings each on DSH `0.2.2-rc.5`. Each task started in a fresh chat. When the script selected a Make target, DSH’s Bash tool ran it and the benchmark checked the marker it wrote. In 15 of the 170 tasks per configuration, the correct action was to skip execution.
115
132
 
116
- ### LoCoMo cross-session QA
133
+ | Retrieval mode | Correct (including correct skips) | Wrong command | Missed execution |
134
+ | --- | ---: | ---: | ---: |
135
+ | Core package · keyword search | 120/170 (70.6%) | 28 | 22 |
136
+ | Core + English and Chinese models · hybrid search | 137/170 (80.6%) | 32 | 1 |
117
137
 
118
- **On the same 20 questions, enabling memory in a fresh chat raised mean F1 from 0.0 to 27.1 out of 100.** The plugin improved the score on 12 questions and tied on eight. Single-hop fact recall rose from 0.0 to 52.6. We used one LoCoMo conversation, `conv-26`, with five questions each for single-hop, multi-hop, temporal and open-domain reasoning. All three conditions used `deepseek-flash`, a fresh chat per question, the same short-answer instruction and the official token F1 scorer.
138
+ Adding both models yielded 17 more correct outcomes (**+10 percentage points**). Missed executions fell from 22 to 1, and wrong commands rose from 28 to 32. The benchmark measures retrieval and execution with a fixed selection policy. How often a live model follows a convention needs a separate evaluation. [Per-task results](./docs/benchmarks/repository-tasks.json) · [Method and reproduction (Chinese)](./docs/benchmark.zh-CN.md)
119
139
 
120
- | Information available in the fresh chat | Mean F1 | QA model requests | QA input tokens | Estimated QA cost |
121
- | --- | ---: | ---: | ---: | ---: |
122
- | Plugin off, question only | 0.0 | 92 | 577,993 | CNY 0.22 |
123
- | Plugin on, access to 118 saved memories | **27.1** | 54 | 1,031,787 | CNY 0.61 |
124
- | Plugin off, all 19 session transcripts supplied with each question | 41.6 | 20 | 452,779 | CNY 0.12 |
140
+ ## Advanced setup and development
125
141
 
126
- For example, when asked how often Melanie took her kids to the beach, the question-only baseline answered `Unknown`. With the plugin enabled, the memory saved from session 10 ranked second in search. The model answered “Once or twice a year” for full credit. The full-transcript run also answered correctly. This conversation fits in the model’s context window, and supplying it in full gave the best overall score and the lowest QA cost in this run.
142
+ ### Install from source
127
143
 
128
- The comparison ran on December 3, 2026. Each ingestion prompt explicitly asked the assistant to save reusable facts. Fourteen sessions saved memories and five reached the output limit before saving. All three conditions blocked tools for reading files and searching the web. In the question-only condition, the model tried other tools on all 20 questions, adding model requests as it processed the denials. Costs use the measured cache usage and DeepSeek’s peak rates at the time. The one-time ingestion cost was about CNY 1.87, bringing the plugin condition to **CNY 2.48** for ingestion and QA together. An earlier pilot explicitly prompted the model to use project memory and scored 29.3. [Paired answers and usage](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/evaluations/locomo-conv-26-paired-2026-12-03.json) · [Earlier pilot](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/evaluations/locomo-conv-26-2026-12-03.json) · [LoCoMo dataset](https://github.com/snap-research/locomo) · [Setup and run details (Chinese)](https://app.unpkg.com/dsh-memory-bond@0.3.0-beta.0/files/design/dsh-memory-plugin-evaluation.md)
144
+ Use Node.js **22.18 or later**. Run the following in Bash or Zsh from the repository root, then restart DSH. For Desktop, open the app once and quit it before installing. [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
129
145
 
130
146
  ```sh
131
- npm run eval:locomo -- --upstream ../locomo --compare
147
+ npm ci
148
+ npm pack
149
+ dsh plugin --profile desktop add --offline "$PWD/dsh-memory-bond-1.0.0.tgz"
132
150
  ```
133
151
 
134
- ### How we test recall
152
+ ### Optional language models
153
+
154
+ You can add models to the core package you already installed. Download and extract the matching source archive if you don’t have a checkout. It contains both models and their shared ONNX runtime. [Download the 1.0.0 source (.zip)](https://github.com/PersistentJZH/dsh-memory-bond/archive/f3bb0f3eea696b300066640631209046057e675e.zip)
135
155
 
136
- In the latest DeepSeek run, the commands recorded by the Makefile and the response to the unrelated task matched expectations in all eight cases. Seven finished within nine model requests. After withdrawal the assistant searched once, ran `make check`, and finished. In the on-demand case it retrieved revision 3 and ran `make lake-suite`, then continued to inspect the repository until it reached the request limit. Total requests across the eight cases went from 44 to 39 in one run per version. [Per-task results](https://cdn.jsdelivr.net/npm/dsh-memory-bond@0.3.0-beta.0/design/evaluations/project-memory-tasks-2026-12-03.json) · [Evaluation methods and limits (Chinese)](https://app.unpkg.com/dsh-memory-bond@0.3.0-beta.0/files/design/dsh-memory-plugin-evaluation.md)
156
+ From the extracted folder or checkout, run `npm ci` with Node.js 22.18 or later. Quit DSH and run the line for each language you want, using the same profile as the core package.
137
157
 
138
158
  ```sh
139
- npm test # Build and run the local tests
140
- npm run verify:tasks # Isolated DSH host with a scripted model
141
- npm run verify:tasks -- --live # Real model, using configured DeepSeek credentials
159
+ dsh plugin --profile desktop add --offline "link:$PWD/native/embeddings/en"
160
+ dsh plugin --profile desktop add --offline "link:$PWD/native/embeddings/zh"
142
161
  ```
143
162
 
144
- The host checks use the installed macOS DSH app. You can also run `npm run verify:web` and `npm run verify:desktop` to exercise the settings and chat receipts in isolated profiles.
163
+ Keep the checkout and its dependencies in place. Restart DSH and run `/project-memory status`. The `embeddingLanguages` list shows the detected languages and is empty with the core alone. Bond indexes existing memories in the background.
164
+
165
+ <details>
166
+ <summary>Installation troubleshooting</summary>
167
+
168
+ - If macOS cannot find `dsh`, run `export PATH="/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin:$PATH"` in the same terminal, then retry.
169
+ - Bond creates databases with SQLite schema version 4. If startup reports `unsupported_schema`, keep your existing profile and its data, and install in a fresh DSH profile.
170
+
171
+ </details>
172
+
173
+ From the checkout, run `npm test` for the test suite and `npm run verify:models` for the keyword-only, single-model and dual-model packaging checks.
174
+
175
+ <details>
176
+ <summary>Related DSH memory plugins</summary>
177
+
178
+ dsh-loci provides evidence quotes and a compact index of verified entries. RestRegular/dsh-memory provides local hybrid search and distinguishes selection from delivery. dsh-auto-memory logs injections and tracks lookups. Bond focuses on debugging a reply in a particular checkout by connecting worktree-specific validation with the exact revisions a request received. [dsh-loci](https://github.com/Awenforever/dsh-loci) · [RestRegular/dsh-memory](https://github.com/RestRegular/dsh-memory#诊断与审计) · [dsh-auto-memory](https://github.com/AskTheWay/dsh-auto-memory)
145
179
 
146
- ## License
180
+ </details>
147
181
 
148
- The plugin is MIT-licensed. The bundled embedding models and inference runtime include their own notices. [MIT license](https://app.unpkg.com/dsh-memory-bond@0.3.0-beta.0/files/LICENSE) · [Model and runtime notices](https://app.unpkg.com/dsh-memory-bond@0.3.0-beta.0/files/native/embeddings/NOTICE.md)
182
+ [MIT license](./LICENSE) · [Model and runtime notices](./native/embeddings/NOTICE.md)