dsh-mnemon 0.1.4 → 0.1.6

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 (215) hide show
  1. package/README.md +19 -5
  2. package/README.zh-CN.md +19 -5
  3. package/cordis.patch.yml +3 -2
  4. package/lib/client.js +380 -348
  5. package/lib/index.js +203 -82
  6. package/lib/types/activity.d.ts +2 -18
  7. package/lib/types/channels.d.ts +1 -4
  8. package/lib/types/client/MnemonLogo.d.ts +0 -1
  9. package/lib/types/client/MnemonPackSection.d.ts +1 -2
  10. package/lib/types/client/MnemonSaveAction.d.ts +1 -2
  11. package/lib/types/client/MnemonSettingsCard.d.ts +1 -3
  12. package/lib/types/client/MnemonTurnTail.d.ts +1 -2
  13. package/lib/types/client/MnemonView.d.ts +1 -3
  14. package/lib/types/client/MnemonViewAppearance.d.ts +0 -1
  15. package/lib/types/client/anchor.d.ts +0 -1
  16. package/lib/types/client/api.d.ts +1 -9
  17. package/lib/types/client/dsh-compat.d.ts +0 -1
  18. package/lib/types/client/index.d.ts +0 -1
  19. package/lib/types/client/locales.d.ts +14 -1
  20. package/lib/types/client/settings.d.ts +1 -2
  21. package/lib/types/client/sidebar-entry.d.ts +0 -1
  22. package/lib/types/client/workspace-controller.d.ts +0 -1
  23. package/lib/types/client/workspace-mount.d.ts +1 -3
  24. package/lib/types/commands.d.ts +0 -1
  25. package/lib/types/config-values.d.ts +0 -1
  26. package/lib/types/config.d.ts +6 -80
  27. package/lib/types/contracts.d.ts +2 -60
  28. package/lib/types/documents.d.ts +2 -79
  29. package/lib/types/guidance.d.ts +0 -1
  30. package/lib/types/index.d.ts +0 -1
  31. package/lib/types/lifecycle.d.ts +3 -45
  32. package/lib/types/live-runtime.d.ts +0 -1
  33. package/lib/types/memory-bodies.d.ts +3 -20
  34. package/lib/types/pack.d.ts +2 -48
  35. package/lib/types/process.d.ts +0 -1
  36. package/lib/types/review-activity.d.ts +2 -16
  37. package/lib/types/rpc.d.ts +0 -1
  38. package/lib/types/runner.d.ts +22 -12
  39. package/lib/types/runtime-memory.d.ts +2 -59
  40. package/lib/types/service.d.ts +3 -149
  41. package/lib/types/settings.d.ts +1 -4
  42. package/lib/types/shared/contracts.d.ts +609 -0
  43. package/lib/types/storage-scope.d.ts +2 -29
  44. package/lib/types/subagent.d.ts +2 -15
  45. package/lib/types/tools.d.ts +0 -1
  46. package/lib/types/version-updates.d.ts +2 -26
  47. package/package.json +8 -7
  48. package/docs/README.md +0 -8
  49. package/docs/assets/diagrams/en/memory-system-flow.png +0 -0
  50. package/docs/assets/diagrams/en/project-architecture.svg +0 -182
  51. package/docs/assets/diagrams/zh-CN/memory-system-flow.png +0 -0
  52. package/docs/assets/diagrams/zh-CN/project-architecture.svg +0 -182
  53. package/docs/assets/media/dsh-mnemon-memory-system-demo-poster.jpg +0 -0
  54. package/docs/assets/media/dsh-mnemon-memory-system-demo.gif +0 -0
  55. package/docs/assets/media/dsh-mnemon-memory-system-demo.mp4 +0 -0
  56. package/docs/assets/screenshots/conversation-memory-jump.png +0 -0
  57. package/docs/assets/screenshots/conversation-save-dialog.png +0 -0
  58. package/docs/assets/screenshots/conversation-turn-memory.png +0 -0
  59. package/docs/assets/screenshots/document-create-dialog.png +0 -0
  60. package/docs/assets/screenshots/documents-markdown.png +0 -0
  61. package/docs/assets/screenshots/entities-context.png +0 -0
  62. package/docs/assets/screenshots/memory-content.png +0 -0
  63. package/docs/assets/screenshots/overview-memory-graph.png +0 -0
  64. package/docs/assets/screenshots/recall-agent-answer.png +0 -0
  65. package/docs/assets/screenshots/remember-dialog.png +0 -0
  66. package/docs/assets/screenshots/runtime-memory-add.png +0 -0
  67. package/docs/assets/screenshots/runtime-memory.png +0 -0
  68. package/docs/assets/screenshots/settings-memory-system.png +0 -0
  69. package/docs/assets/screenshots/status-overview.png +0 -0
  70. package/docs/assets/screenshots/version-check.png +0 -0
  71. package/docs/en/README.md +0 -48
  72. package/docs/en/architecture.md +0 -133
  73. package/docs/en/configuration.md +0 -223
  74. package/docs/en/development.md +0 -198
  75. package/docs/en/getting-started.md +0 -155
  76. package/docs/en/interfaces.md +0 -181
  77. package/docs/en/operations.md +0 -166
  78. package/docs/en/project-overview.md +0 -145
  79. package/docs/en/roadmap.md +0 -41
  80. package/docs/en/storage-model.md +0 -185
  81. package/docs/en/ui-guide.md +0 -156
  82. package/docs/en/workflows.md +0 -290
  83. package/docs/zh-CN/README.md +0 -48
  84. package/docs/zh-CN/architecture.md +0 -133
  85. package/docs/zh-CN/configuration.md +0 -223
  86. package/docs/zh-CN/development.md +0 -198
  87. package/docs/zh-CN/getting-started.md +0 -155
  88. package/docs/zh-CN/interfaces.md +0 -181
  89. package/docs/zh-CN/operations.md +0 -166
  90. package/docs/zh-CN/project-overview.md +0 -145
  91. package/docs/zh-CN/roadmap.md +0 -41
  92. package/docs/zh-CN/storage-model.md +0 -185
  93. package/docs/zh-CN/ui-guide.md +0 -160
  94. package/docs/zh-CN/workflows.md +0 -290
  95. package/lib/client.js.map +0 -1
  96. package/lib/types/activity.d.ts.map +0 -1
  97. package/lib/types/activity.js +0 -93
  98. package/lib/types/activity.js.map +0 -1
  99. package/lib/types/channels.d.ts.map +0 -1
  100. package/lib/types/channels.js +0 -4
  101. package/lib/types/channels.js.map +0 -1
  102. package/lib/types/client/MnemonLogo.d.ts.map +0 -1
  103. package/lib/types/client/MnemonLogo.js +0 -6
  104. package/lib/types/client/MnemonLogo.js.map +0 -1
  105. package/lib/types/client/MnemonPackSection.d.ts.map +0 -1
  106. package/lib/types/client/MnemonPackSection.js +0 -136
  107. package/lib/types/client/MnemonPackSection.js.map +0 -1
  108. package/lib/types/client/MnemonSaveAction.d.ts.map +0 -1
  109. package/lib/types/client/MnemonSaveAction.js +0 -90
  110. package/lib/types/client/MnemonSaveAction.js.map +0 -1
  111. package/lib/types/client/MnemonSettingsCard.d.ts.map +0 -1
  112. package/lib/types/client/MnemonSettingsCard.js +0 -155
  113. package/lib/types/client/MnemonSettingsCard.js.map +0 -1
  114. package/lib/types/client/MnemonTurnTail.d.ts.map +0 -1
  115. package/lib/types/client/MnemonTurnTail.js +0 -56
  116. package/lib/types/client/MnemonTurnTail.js.map +0 -1
  117. package/lib/types/client/MnemonView.d.ts.map +0 -1
  118. package/lib/types/client/MnemonView.js +0 -1585
  119. package/lib/types/client/MnemonView.js.map +0 -1
  120. package/lib/types/client/MnemonViewAppearance.d.ts.map +0 -1
  121. package/lib/types/client/MnemonViewAppearance.js +0 -67
  122. package/lib/types/client/MnemonViewAppearance.js.map +0 -1
  123. package/lib/types/client/anchor.d.ts.map +0 -1
  124. package/lib/types/client/anchor.js +0 -46
  125. package/lib/types/client/anchor.js.map +0 -1
  126. package/lib/types/client/api.d.ts.map +0 -1
  127. package/lib/types/client/api.js +0 -150
  128. package/lib/types/client/api.js.map +0 -1
  129. package/lib/types/client/dsh-compat.d.ts.map +0 -1
  130. package/lib/types/client/dsh-compat.js +0 -2
  131. package/lib/types/client/dsh-compat.js.map +0 -1
  132. package/lib/types/client/index.d.ts.map +0 -1
  133. package/lib/types/client/index.js +0 -161
  134. package/lib/types/client/index.js.map +0 -1
  135. package/lib/types/client/locales.d.ts.map +0 -1
  136. package/lib/types/client/locales.js +0 -1162
  137. package/lib/types/client/locales.js.map +0 -1
  138. package/lib/types/client/settings.d.ts.map +0 -1
  139. package/lib/types/client/settings.js +0 -70
  140. package/lib/types/client/settings.js.map +0 -1
  141. package/lib/types/client/sidebar-entry.d.ts.map +0 -1
  142. package/lib/types/client/sidebar-entry.js +0 -134
  143. package/lib/types/client/sidebar-entry.js.map +0 -1
  144. package/lib/types/client/workspace-controller.d.ts.map +0 -1
  145. package/lib/types/client/workspace-controller.js +0 -21
  146. package/lib/types/client/workspace-controller.js.map +0 -1
  147. package/lib/types/client/workspace-mount.d.ts.map +0 -1
  148. package/lib/types/client/workspace-mount.js +0 -138
  149. package/lib/types/client/workspace-mount.js.map +0 -1
  150. package/lib/types/commands.d.ts.map +0 -1
  151. package/lib/types/commands.js +0 -104
  152. package/lib/types/commands.js.map +0 -1
  153. package/lib/types/config-values.d.ts.map +0 -1
  154. package/lib/types/config-values.js +0 -4
  155. package/lib/types/config-values.js.map +0 -1
  156. package/lib/types/config.d.ts.map +0 -1
  157. package/lib/types/config.js +0 -127
  158. package/lib/types/config.js.map +0 -1
  159. package/lib/types/contracts.d.ts.map +0 -1
  160. package/lib/types/contracts.js +0 -2
  161. package/lib/types/contracts.js.map +0 -1
  162. package/lib/types/documents.d.ts.map +0 -1
  163. package/lib/types/documents.js +0 -495
  164. package/lib/types/documents.js.map +0 -1
  165. package/lib/types/guidance.d.ts.map +0 -1
  166. package/lib/types/guidance.js +0 -34
  167. package/lib/types/guidance.js.map +0 -1
  168. package/lib/types/index.d.ts.map +0 -1
  169. package/lib/types/index.js +0 -55
  170. package/lib/types/index.js.map +0 -1
  171. package/lib/types/lifecycle.d.ts.map +0 -1
  172. package/lib/types/lifecycle.js +0 -456
  173. package/lib/types/lifecycle.js.map +0 -1
  174. package/lib/types/live-runtime.d.ts.map +0 -1
  175. package/lib/types/live-runtime.js +0 -146
  176. package/lib/types/live-runtime.js.map +0 -1
  177. package/lib/types/memory-bodies.d.ts.map +0 -1
  178. package/lib/types/memory-bodies.js +0 -186
  179. package/lib/types/memory-bodies.js.map +0 -1
  180. package/lib/types/pack.d.ts.map +0 -1
  181. package/lib/types/pack.js +0 -709
  182. package/lib/types/pack.js.map +0 -1
  183. package/lib/types/process.d.ts.map +0 -1
  184. package/lib/types/process.js +0 -65
  185. package/lib/types/process.js.map +0 -1
  186. package/lib/types/review-activity.d.ts.map +0 -1
  187. package/lib/types/review-activity.js +0 -37
  188. package/lib/types/review-activity.js.map +0 -1
  189. package/lib/types/rpc.d.ts.map +0 -1
  190. package/lib/types/rpc.js +0 -384
  191. package/lib/types/rpc.js.map +0 -1
  192. package/lib/types/runner.d.ts.map +0 -1
  193. package/lib/types/runner.js +0 -155
  194. package/lib/types/runner.js.map +0 -1
  195. package/lib/types/runtime-memory.d.ts.map +0 -1
  196. package/lib/types/runtime-memory.js +0 -415
  197. package/lib/types/runtime-memory.js.map +0 -1
  198. package/lib/types/service.d.ts.map +0 -1
  199. package/lib/types/service.js +0 -512
  200. package/lib/types/service.js.map +0 -1
  201. package/lib/types/settings.d.ts.map +0 -1
  202. package/lib/types/settings.js +0 -103
  203. package/lib/types/settings.js.map +0 -1
  204. package/lib/types/storage-scope.d.ts.map +0 -1
  205. package/lib/types/storage-scope.js +0 -179
  206. package/lib/types/storage-scope.js.map +0 -1
  207. package/lib/types/subagent.d.ts.map +0 -1
  208. package/lib/types/subagent.js +0 -624
  209. package/lib/types/subagent.js.map +0 -1
  210. package/lib/types/tools.d.ts.map +0 -1
  211. package/lib/types/tools.js +0 -341
  212. package/lib/types/tools.js.map +0 -1
  213. package/lib/types/version-updates.d.ts.map +0 -1
  214. package/lib/types/version-updates.js +0 -377
  215. package/lib/types/version-updates.js.map +0 -1
@@ -1,41 +0,0 @@
1
- # Roadmap
2
-
3
- [简体中文](../zh-CN/roadmap.md) | **English** | [Documentation Center](./README.md)
4
-
5
- The Roadmap records work beyond the current implementation; it is not a commitment to deliver these capabilities. Data safety, recoverability, and verifiability take priority.
6
-
7
- ## P0: Reliability and Recoverable Scheduling
8
-
9
- - [ ] **Persist background-review watermarks**: save activity signals, the latest processed checkpoint, scoring version, and run state by root session; restore unprocessed activity after restart or resume.
10
- - [ ] **Idempotent checkpoints**: assign a stable identifier to each review input to prevent timeouts, retries, or duplicate hooks from producing duplicate Documents.
11
- - [ ] **Backoff, circuit breaking, and manual retry**: apply bounded backoff after consecutive failures, show the reason on the Status page, and allow explicit recovery.
12
- - [ ] **Deterministic sensitive-data defenses**: add secret/credential pattern detection, size limits, and audit receipts beyond LLM admission.
13
- - [ ] **Automated real-WebUI E2E**: isolate DSH_HOME, storageRoot, workspace, and the port; cover light tasks, score-based review, cancellation, and failures without partial writes.
14
- - [ ] **Correct cold-reference paths**: under every storage scope, write resolvable references that match the actual managed path.
15
-
16
- ## P1: Long-Term Maintenance and Data Operations
17
-
18
- - [ ] **Long-term organization across sessions**: trigger an independent organization process based on time and the number of new sessions instead of reusing per-turn review.
19
- - [ ] **Mnemon GC / forget review**: generate candidates for decay, conflicts, obsolete content, and orphaned relationships, then present evidence before deletion.
20
- - [ ] **Consistent backup and recovery**: provide unified snapshots, checksums, and recovery rehearsals for the registry, multiple databases, Runtime, and Documents.
21
- - [ ] **Repair and rebuild tools**: detect damaged JSON, missing projections, orphaned Documents, missing databases, and registry/disk inconsistencies.
22
- - [ ] **Schema migration**: add explicit upgrade and rollback strategies for Runtime, the Documents index, and the Memory Space registry.
23
- - [ ] **Compatibility matrix**: document and automatically test supported combinations of DSH, the Mnemon CLI, Node, and data formats.
24
- - [ ] **Explicit Documents workspace ownership**: record the source workspace under shared storage scopes or provide a configurable isolation strategy.
25
-
26
- ## P2: Observability, Experience, and Release Engineering
27
-
28
- - [ ] **Background-review history**: show recent scores, checkpoints, waiting/running/failed states, worker receipts, and resulting changes.
29
- - [ ] **Switch to DSH's shared directory picker** (blocked on [dsh-external/issues#603](https://github.com/dsh-external/issues/issues/603)): custom storage temporarily uses a manually entered Host path because remote `browse` deployments cannot invoke the `native` picker; once DSH exposes a reusable directory-picker service for plugins, move to the provider-selected native / browse flow and retain manual entry only as a fallback if needed.
30
- - [ ] **Complete internationalization**: cover commands, tool cards, Host errors, compatibility default metadata, and confirmation copy.
31
- - [ ] **Multi-Memory-Space E2E**: cover automatic space creation, cross-space recall, one-pass migration routing, multiple relationship types, merge, and controlled forget.
32
- - [ ] **Capacity and fault injection**: exercise real USER/MEMORY boundaries, Document LRU, revision conflicts, CLI timeouts, and mid-operation Host restarts.
33
- - [ ] **Documentation consistency checks**: add relative links, external links, bilingual file mirroring, configuration-key matching, and code-block matching to CI.
34
- - [ ] **Release completion**: establish stable versions, a changelog, upgrade/uninstall/data-retention guides, artifact checksums, and a minimum-support policy.
35
-
36
- ## Explicitly Out of Scope
37
-
38
- - A Runtime `daily` target; only `user` and `memory` are currently maintained.
39
- - A proactive notification daemon without explicit delivery semantics; Mnemon remains an on-demand pull system.
40
- - Declaring internal RPC or `MnemonClient` to be a stable public SDK.
41
- - Automatically deleting the source Memory Space database; merge currently preserves the source files.
@@ -1,185 +0,0 @@
1
- # Storage and the Three-Layer Memory Model
2
-
3
- [简体中文](../zh-CN/storage-model.md) | **English** | [Documentation Center](./README.md)
4
-
5
- ## Why Three Layers
6
-
7
- No single storage form can simultaneously be visible on every turn, preserve complete narratives, and support long-term graph-enhanced recall:
8
-
9
- | Question | Corresponding layer | Reason |
10
- |---|---|---|
11
- | What must be known directly on the next turn? | Runtime Memory | Tiny and injected directly into the prompt |
12
- | Which design or procedure needs to be read quickly and in full? | active Documents | Preserves Markdown structure without deep recall |
13
- | Which historical facts and relationships should persist across sessions? | Memory Spaces | Independent databases, graph relationships, and on-demand recall |
14
- | What happens when a long document is rarely used but must remain traceable? | archived Documents | Mnemon retains an index while the cold layer retains the original text |
15
-
16
- Recommended query gradient:
17
-
18
- ```text
19
- current request and repository facts
20
- |
21
- v
22
- Runtime Memory already in prompt
23
- |
24
- v
25
- search active Documents
26
- |
27
- v
28
- recall active Memory Spaces
29
- |
30
- v
31
- follow an exact cold reference when full text is required
32
- ```
33
-
34
- ## Unified Root Directory
35
-
36
- ```text
37
- <storageRoot>/
38
- +-- runtime/
39
- | +-- memories.json
40
- | +-- USER.md
41
- | +-- MEMORY.md
42
- +-- documents/
43
- | +-- index.json
44
- | +-- active/
45
- | +-- archived/
46
- +-- data/
47
- | +-- .dsh-memory-bodies.json
48
- | +-- <memory-space-id>/
49
- | +-- mnemon.db
50
- +-- state/ # reserved; no persistent reviewer yet
51
- ```
52
-
53
- `storageScope` determines the entire root, not just the Mnemon databases. The `workspace` scope resolves an independent `<workspace>/.mnemon` for every registered DSH workspace. The Web inspection target and current-session execution target are independent; only the latter drives agents, tools, and lifecycle hooks. `state/` is currently recognized only by the status inspector; scored review watermarks remain in the running Host's memory.
54
-
55
- ## Runtime Memory
56
-
57
- ### Semantics
58
-
59
- - `target=user`: identity, role, long-term preferences, habits, communication style, and explicit collaboration requirements.
60
- - `target=memory`: projects, environment, decisions, conventions, tool characteristics, and reusable experience.
61
- - `importance=critical|normal|low`: retention priority during maintenance.
62
-
63
- There is currently no `daily` target.
64
-
65
- ### Source of Truth and Projections
66
-
67
- `runtime/memories.json` is the sole source of truth. Each record contains:
68
-
69
- ```text
70
- content
71
- created_at
72
- updated_at
73
- target
74
- importance
75
- ```
76
-
77
- `USER.md` and `MEMORY.md` are deterministic derived files. Each item is normalized to one line, and items are separated by a line containing only `§`; `§` is a reserved character. During startup and prompt assembly, the control layer repairs missing or manually modified projections from the JSON source.
78
-
79
- ### Operations
80
-
81
- - `add` writes an independent new fact; exactly identical content is not added twice.
82
- - `replace` uses a unique substring match on `old_text` to locate and replace an entire item.
83
- - `remove` uses a unique substring to remove an entire item.
84
- - Zero or multiple matches are rejected; no fuzzy mutation is performed.
85
-
86
- ### Capacity
87
-
88
- | Target | Limit | Maintenance method |
89
- |---|---:|---|
90
- | `USER.md` | 4 KiB | A local no-tool worker merges conservatively; content never enters a Memory Space |
91
- | `MEMORY.md` | 10 KiB | A worker archives committed content first, then returns compaction candidates |
92
-
93
- Capacity is measured from the actual UTF-8 bytes of the projection body. A single item is limited to 8 KiB. Automatic capacity maintenance is triggered only by an overflowing `add`; an overflowing `replace` fails directly, and the caller should perform explicit maintenance first.
94
-
95
- ## Project Documents
96
-
97
- ### Purpose
98
-
99
- Documents preserve project knowledge that is more complete than a single memory item but should still be quick to read, such as:
100
-
101
- - architecture designs and rationale;
102
- - evidence-backed investigation findings;
103
- - operating procedures, release checklists, and incident reviews;
104
- - implementation handoffs and long-term maintenance notes.
105
-
106
- User profiles, ordinary conversation, temporary progress, raw large logs, and secrets should not be stored in Documents.
107
-
108
- ### Control Plane
109
-
110
- `documents/index.json` is the metadata source of truth. It manages IDs, titles, descriptions, status, filenames, source paths, sessions, timestamps, revisions, SHA-256 values, sizes, and Memory Space references. Managed Markdown copies include generated frontmatter.
111
-
112
- `sourcePaths`:
113
-
114
- - may point only inside the current session workspace;
115
- - are source references only and are never modified by the plugin;
116
- - are not required to exist by the current implementation;
117
- - may not point into the managed `documents/` directory itself.
118
-
119
- ### Scope
120
-
121
- The physical sharing scope of Documents is determined by `storageScope`:
122
-
123
- - `workspace`: normally isolated with the project;
124
- - `global` / `custom`: multiple workspaces may share the same `documents/index.json`.
125
-
126
- Therefore, “Project Documents” describes the content type and does not guarantee physical isolation by workspace. The current session workspace constrains only `sourcePaths` on new writes.
127
-
128
- ### Capacity and Hot/Cold Tiering
129
-
130
- | Item | Limit |
131
- |---|---:|
132
- | One body | 2 MiB maximum |
133
- | Total active content | 10 MiB maximum, including generated frontmatter |
134
- | Total archived content | Does not count toward the active limit |
135
-
136
- The actual rendered size is calculated before creation or update. If capacity is insufficient, the least recently accessed active Document is selected by `lastAccessedAt` and then `updatedAt`; a Mnemon cold reference is written and verified first, and the original text is moved only if its revision remains unchanged.
137
-
138
- Default search covers only active Documents. Search updates `lastAccessedAt` for matching Documents, so it is read-only with respect to bodies but writes index metadata.
139
-
140
- ## Memory Spaces
141
-
142
- Each Memory Space is a native named Mnemon Store with maintainable metadata added in `.dsh-memory-bodies.json`:
143
-
144
- ```text
145
- id Host-generated stable UUID or discovered compatible Store name
146
- name human-readable name
147
- description routing boundary: what belongs here and when to recall it
148
- active whether it participates in reads
149
- mnemon.db independent data plane
150
- ```
151
-
152
- ### Read and Write Boundaries
153
-
154
- - Recall, graph, content, and entity reads use only active Memory Spaces.
155
- - Reads explicitly targeting an inactive Memory Space are rejected.
156
- - Writes may target any registered Memory Space.
157
- - After a successful write to an inactive target, the plugin activates it automatically.
158
- - Without an explicit target, if the number of active Memory Spaces is not exactly one, the deterministic service requires the caller to choose a target first.
159
-
160
- ### Creation, Discovery, and Merge
161
-
162
- - On creation, the model supplies a name and description; the Host generates the ID.
163
- - An existing `<storageRoot>/data/<store>/mnemon.db` is discovered and registered without moving the database.
164
- - Merge imports source content into the target through Mnemon; the source database remains in place, and by default only the source is marked inactive.
165
- - `forget` is a soft delete by exact ID, not deletion of a database file.
166
-
167
- ### Cross-Agent Visibility
168
-
169
- `mnemon.db` is Mnemon's native data plane, not a private dsh-mnemon format. Another Mnemon-enabled agent can access the same durable memory when it uses the same `storageRoot` and Store. dsh-mnemon also discovers compatible Stores already present on disk; DSH-specific names, descriptions, and activation state remain managed by `.dsh-memory-bodies.json`.
170
-
171
- This sharing does not extend to `runtime/` or `documents/`. Even when those directories sit under the same root, another agent must implement their DSH-specific protocols to understand them. “Shared Mnemon memory” must not be presented as automatic sharing of the complete DSH context.
172
-
173
- ## Four Relationship Types
174
-
175
- The Mnemon long-term layer preserves `temporal`, `semantic`, `causal`, and `entity` relationships. The plugin does not require relationships to be created manually for every memory; they should be created only when they genuinely improve future recall. Overview can aggregate memories, entities, relationships, and space membership across multiple active Memory Spaces.
176
-
177
- ## Data Authority Table
178
-
179
- | Data | Authoritative source | Derived/cache |
180
- |---|---|---|
181
- | Hot memory | `runtime/memories.json` | `USER.md`, `MEMORY.md` |
182
- | Documents | `documents/index.json` + managed Markdown | excerpts, search ranking, status aggregation |
183
- | Memory Space catalog | `data/.dsh-memory-bodies.json` + on-disk Stores | Web status aggregation |
184
- | Long-term memory | Each Store's `mnemon.db` | parsed HTML/DOT graph results |
185
- | Review watermark | Host process memory | status-page snapshot; not yet persisted |
@@ -1,156 +0,0 @@
1
- # Sidebar and Conversation UI Guide
2
-
3
- [简体中文](../zh-CN/ui-guide.md) | **English** | [Documentation hub](./README.md)
4
-
5
- This guide follows the default `sidebar` presentation and a real user path through Memory System. Screenshots come from the v0.1.4 interface and use the Chinese locale; names, counts, and content vary with your data.
6
-
7
- ## Start with the two display modes
8
-
9
- Choose the entry point and storage location under **Settings → Memory System**:
10
-
11
- [![Memory System settings: Sidebar, Buildin, storage, conversation UI, and backup](../assets/screenshots/settings-memory-system.png)](../assets/screenshots/settings-memory-system.png)
12
-
13
- | Mode | Best suited for |
14
- |---|---|
15
- | **Sidebar** (default) | A dedicated workbench opened from the DSH sidebar, visually aligned with official panels such as Task Board and SSH |
16
- | **Buildin** | The original conversation-area tab, preserving the previous layout and visuals for established workflows |
17
-
18
- Both modes share functionality, data, and Host services. Only entry and appearance differ. Saving switches live without a browser refresh or duplicate mounts.
19
-
20
- ## Workbench anatomy
21
-
22
- The Sidebar header always answers three questions: which system is open, which storage-location mode is effective, and whether the Host is connected.
23
-
24
- The body has four primary tabs: **Status, Runtime, Memory Spaces, and Documents**. Memory Spaces adds **Overview, Recall, Content, and Entities** as secondary tabs, with **Remember** as its primary action.
25
-
26
- ## 1. Status: establish that the system is ready
27
-
28
- [![Status summary for versions, Runtime, Memory Spaces, Documents, and storage root](../assets/screenshots/status-overview.png)](../assets/screenshots/status-overview.png)
29
-
30
- Status aggregates:
31
-
32
- - installed Mnemon CLI and dsh-mnemon versions;
33
- - USER / MEMORY Runtime counts;
34
- - active Memory Spaces and durable-memory counts;
35
- - active / archived Document counts;
36
- - the current storage root and concrete Runtime, Documents, and Memory Spaces directories.
37
-
38
- If this page reports a failure, avoid Remember or Archive until you follow [Troubleshooting](./operations.md#troubleshooting).
39
-
40
- ### Check and update versions
41
-
42
- Open the version area for a read-only check:
43
-
44
- [![Check and update Mnemon and dsh-mnemon versions](../assets/screenshots/version-check.png)](../assets/screenshots/version-check.png)
45
-
46
- Checking never installs automatically. Update appears only when a newer release exists and the installation source is supported. After an update, the interface rechecks both components and refreshes Status automatically. Restart `dsh web` after a dsh-mnemon update to load new plugin code.
47
-
48
- ## 2. Runtime: maintain hot memory used every turn
49
-
50
- [![Runtime capacity, scope filters, content filter, and unified list](../assets/screenshots/runtime-memory.png)](../assets/screenshots/runtime-memory.png)
51
-
52
- The top summarizes User Profile (`USER.md`) and Working Memory (`MEMORY.md`); one list below holds both.
53
-
54
- - Filter by All / User Profile / Working Memory.
55
- - Filter by content with the input on the right.
56
- - Chips identify source and importance.
57
- - Edit opens a dialog; Remove enters a destructive flow.
58
- - Long lists expand progressively through “Show N more.”
59
-
60
- ### Add Runtime Memory
61
-
62
- [![Add hot memory dialog with content, category, and importance](../assets/screenshots/runtime-memory-add.png)](../assets/screenshots/runtime-memory-add.png)
63
-
64
- A Runtime item should be compact, independent, and repeatedly useful. Put identity, preferences, and explicit collaboration requirements in User Profile; put project, environment, decision, and tool lessons in Working Memory. Temporary progress and raw logs do not belong here.
65
-
66
- ## 3. Memory Spaces: durable memory and relationships
67
-
68
- ### Overview
69
-
70
- [![Memory Space catalog, activation, and multi-space relationship graph](../assets/screenshots/overview-memory-graph.png)](../assets/screenshots/overview-memory-graph.png)
71
-
72
- Each card leads with its name and routing description, pins read activation at the top right, and keeps statistics plus Edit / Delete in the footer. Activation controls reads only. A write may target an inactive registered space and activates it after success.
73
-
74
- The graph aggregates all active spaces. Layout, dragging, and reset affect browser presentation only and never mutate Mnemon data.
75
-
76
- ### Remember
77
-
78
- [![Remember dialog with candidate and optional advanced constraints](../assets/screenshots/remember-dialog.png)](../assets/screenshots/remember-dialog.png)
79
-
80
- Normally, provide only a candidate. On confirmation, an isolated memory subagent decides whether it qualifies, chooses the narrowest space, deduplicates, distills, and writes. Expand advanced options only when a target space, category, or importance must be constrained explicitly.
81
-
82
- ### Recall
83
-
84
- [![Recall query, category, strategy, raw evidence, and progressive results](../assets/screenshots/recall-agent-answer.png)](../assets/screenshots/recall-agent-answer.png)
85
-
86
- - **Direct recall** returns raw evidence without an answer Agent.
87
- - **Agent query** retrieves the same evidence, then gives it to an evidence-only worker with no Mnemon tools.
88
- - Category and strategy narrow the search.
89
- - Results retain space, category, importance, score, and ID.
90
- - Related traverses the graph; Forget is a destructive semantic action.
91
-
92
- Focused questions are more reliable than broad keywords.
93
-
94
- ### Content and Entities
95
-
96
- | Content | Entities |
97
- |---|---|
98
- | [![Memory content and filters](../assets/screenshots/memory-content.png)](../assets/screenshots/memory-content.png) | [![Entity lookup and related memories](../assets/screenshots/entities-context.png)](../assets/screenshots/entities-context.png) |
99
-
100
- - **Content** browses durable memory without recall side effects and supports text/category filtering, Related, clone-from-item, Copy ID, and Forget.
101
- - **Entities** starts with frequent names, then aggregates related facts, decisions, and context for a selected or entered entity.
102
-
103
- Both expose visible / total counts and progressive loading.
104
-
105
- ## 4. Documents: preserve complete project narratives
106
-
107
- [![Document capacity, progressive directory, and dedicated Markdown reader](../assets/screenshots/documents-markdown.png)](../assets/screenshots/documents-markdown.png)
108
-
109
- Documents are for designs, investigations, procedures, postmortems, and handoffs. The directory loads progressively; the reader keeps title, retrieval description, source, revision, hash, size, and full Markdown. Selecting a Document resets the reader to the top.
110
-
111
- Before active capacity is exhausted, least-recently-used Documents are cold-indexed in Mnemon and then moved to archived storage. A failure or revision conflict preserves the active original.
112
-
113
- ### Create a Document
114
-
115
- [![Create managed Document dialog](../assets/screenshots/document-create-dialog.png)](../assets/screenshots/document-create-dialog.png)
116
-
117
- Title and retrieval description determine future discoverability; source paths preserve provenance; the body retains Markdown structure. Source project files remain read-only—the workbench creates a managed copy.
118
-
119
- ## 5. In-conversation interaction
120
-
121
- ### Turn memory
122
-
123
- [![Expanded Turn memory with recalls, Document search, and exact tool links](../assets/screenshots/conversation-turn-memory.png)](../assets/screenshots/conversation-turn-memory.png)
124
-
125
- The bar appears only on completed turns with memory activity. Expanding lists exact tools; clicking one opens its matching page while retaining the conversation context.
126
-
127
- [![Jump from Turn memory to Memory Space Recall](../assets/screenshots/conversation-memory-jump.png)](../assets/screenshots/conversation-memory-jump.png)
128
-
129
- ### Save to memory
130
-
131
- [![Confirm save to memory and edit the candidate before dispatch](../assets/screenshots/conversation-save-dialog.png)](../assets/screenshots/conversation-save-dialog.png)
132
-
133
- Save to memory sits in the native action strip for finalized assistant replies. Clicking only opens confirmation and reads that reply. Edit or cancel freely; writing starts only after **Confirm and send to memory subagent**.
134
-
135
- ## Workspace mode: separating inspection from execution
136
-
137
- Under `storageScope=workspace`, keep two concepts separate:
138
-
139
- | Concept | Selected by | Affects |
140
- |---|---|---|
141
- | **Inspected workspace** | Workbench header selector | Which `<workspace>/.mnemon` the UI displays and maintains manually |
142
- | **Effective workspace** | Current conversation / Agent cwd | Which root tools, commands, lifecycle hooks, and subagents actually use |
143
-
144
- You may inspect project B while staying in project A's conversation; the Agent still uses A. When they differ, the header explains the mismatch and offers one-click alignment. Agent-backed actions are rejected while misaligned to prevent writes to the wrong project. Switching inspection target unmounts old page state before loading the new root.
145
-
146
- `global` and `custom` resolve to one explicit root and need no alignment layer.
147
-
148
- ## Common interaction rules
149
-
150
- - Solid blue is the primary action; blue outline usually means Edit; red is Remove, Delete, Archive, or Forget; neutral actions are View, Copy, and Cancel.
151
- - Physical destructive operations such as deleting a Memory Space require a dedicated confirmation. Forget is semantic soft deletion and should still be deliberate.
152
- - Saving settings clears stale page state and reloads automatically; no browser refresh is needed.
153
- - Sidebar primary headings remain stable; secondary headings within Memory Spaces scroll naturally.
154
- - Buildin preserves its established layout and visuals. Functional concepts still apply, though control positions differ.
155
-
156
- Next: [Getting Started](./getting-started.md) · [Storage model](./storage-model.md) · [Configuration](./configuration.md) · [Operations](./operations.md)
@@ -1,290 +0,0 @@
1
- # Lifecycle and Core Workflows
2
-
3
- [简体中文](../zh-CN/workflows.md) | **English** | [Documentation Center](./README.md)
4
-
5
- ## Per-Turn Context
6
-
7
- The plugin registers two system prompt sections:
8
-
9
- - `mnemon:routing`: when `routingGuidance=true`, provides concise boundaries for tiered queries;
10
- - `mnemon:runtime-memory`: reads the latest `USER.md` and `MEMORY.md` whenever a prompt is assembled and includes admission rules for saving content.
11
-
12
- Lifecycle hooks do not unconditionally read the Memory Space catalog or run recall at the start of every turn:
13
-
14
- ```text
15
- agent/session-start
16
- -> mark primePending
17
-
18
- agent/pre-step(step=1)
19
- -> cancel pending/running background review for a new turn
20
- -> mark Prime once
21
- -> optionally append one short recall/writeback cue
22
- -> main Agent decides whether to call a memory tool
23
- ```
24
-
25
- Prime only initializes routing state; it does not run asynchronous CLI status queries.
26
-
27
- ## Root Agent Recall
28
-
29
- ```text
30
- Root Agent calls mnemon_recall(query)
31
- |
32
- v
33
- MnemonSubagentCoordinator
34
- |
35
- | spawn + recall persona
36
- | allow: memory_bodies, recall, related
37
- v
38
- Recall worker lists the catalog
39
- |
40
- v
41
- select active Memory Space(s) by name + description
42
- |
43
- v
44
- call mnemon_recall from the worker
45
- |
46
- v
47
- MnemonService searches selected Store(s)
48
- |
49
- v
50
- normalize and attach memoryBodyId / memoryBodyName
51
- |
52
- v
53
- structured output, Host caps results at 12
54
- |
55
- v
56
- Root Agent receives evidence, not the raw routing trace
57
- ```
58
-
59
- If the user has already supplied current facts, or the repository can answer directly, the Agent should not recall merely to “show memory.” When relationship explanations are needed, first use the complete `memoryBodyId + id` returned by recall, then run related.
60
-
61
- ## Web Retrieval and Agent Queries
62
-
63
- The Web “Recall” page follows a different path from model tools:
64
-
65
- ```text
66
- Direct search
67
- -> RPC read channel
68
- -> MnemonService.search directly
69
- -> raw evidence
70
-
71
- Agent search
72
- -> the same deterministic direct search
73
- -> spawn a worker with no Mnemon tools
74
- -> answer only from supplied evidence
75
- -> Host filters citations to actual memoryBodyId/id pairs
76
- ```
77
-
78
- The “Entities” and “Content” pages also read the deterministic service directly and do not start a recall worker. “Content” uses a graph snapshot and does not increment Mnemon recall access counts.
79
-
80
- ## Explicit Long-Term Writes
81
-
82
- The long-term write flow for the root Agent or `/mnemon remember` is:
83
-
84
- ```text
85
- durable candidate
86
- |
87
- v
88
- spawn write worker
89
- |
90
- +-- list Memory Spaces
91
- +-- choose the narrowest suitable scope
92
- +-- recall when duplicate/conflict checking is useful
93
- +-- create a new scope only for a recurring distinct domain
94
- +-- remember / link / forget / merge as requested
95
- v
96
- structured receipt
97
- ```
98
-
99
- The Host generates IDs for new Memory Spaces. A successful write to an inactive target activates it. Merging a source database is non-destructive.
100
-
101
- Runtime `add` / `replace` / `remove` and Document `create` / `update` do not need a model to perform storage I/O; they enter the deterministic control layer through the coordinator. Only capacity maintenance and archiving start dedicated workers.
102
-
103
- ## Runtime add: Normal Path
104
-
105
- ```text
106
- request
107
- -> normalize content
108
- -> acquire in-process queue and file lock
109
- -> reload memories.json
110
- -> validate unique match / duplicate / capacity
111
- -> write temporary JSON and Markdown projections
112
- -> rename projections
113
- -> rename memories.json as the commit marker
114
- -> return compact receipt
115
- ```
116
-
117
- `replace` and `remove` must match exactly one item through `old_text`. Capacity maintenance is triggered automatically only when `add` overflows.
118
-
119
- ## USER.md Capacity Maintenance
120
-
121
- ```text
122
- USER add exceeds 4 KiB
123
- |
124
- v
125
- snapshot revision + committed entries
126
- |
127
- v
128
- spawn no-tool local compactor
129
- |
130
- v
131
- return compacted entries + sourceIndexes
132
- |
133
- v
134
- Host validates:
135
- - every source index appears exactly once
136
- - no duplicate or out-of-range index
137
- - importance is not lowered
138
- - candidate fits the Host byte budget
139
- - revision is still current
140
- |
141
- +-- invalid/conflict -> preserve original data
142
- |
143
- v
144
- deterministic UTF-8 packing
145
- |
146
- v
147
- retry pending add
148
- ```
149
-
150
- The user profile is never sent to Memory Spaces. The worker has no tool permissions.
151
-
152
- ## MEMORY.md Archival and Compaction
153
-
154
- ```text
155
- MEMORY add exceeds 10 KiB
156
- |
157
- v
158
- snapshot revision + committed entries
159
- |
160
- v
161
- spawn archive worker
162
- allow: memory_bodies, recall, remember, body_create
163
- |
164
- v
165
- route semantic clusters and archive or duplicate-check them
166
- |
167
- v
168
- return action + target spaces + compacted candidates
169
- |
170
- v
171
- Host validates structure, action, revision and byte budget
172
- |
173
- +-- failure/conflict -> preserve hot memory
174
- |
175
- v
176
- pack candidates by importance
177
- |
178
- v
179
- retry pending add
180
- ```
181
-
182
- The worker persona requires every committed entry to be represented in long-term storage or verified as a duplicate; this is an LLM-supervised policy. The Host's hard guarantees are structural, revision, and capacity validation, so semantic coverage should not be described as a database-level proof.
183
-
184
- If a revision conflict occurs after a successful long-term write, the hot memory is preserved while the long-term layer may also contain a copy. The plugin prioritizes preventing data loss and does not attempt to roll back a completed Mnemon write across the database and file system.
185
-
186
- ## Document Creation, Update, and Archiving
187
-
188
- ```text
189
- create/update request
190
- |
191
- v
192
- capacityPlan using rendered UTF-8 bytes
193
- |
194
- +----+----+
195
- | |
196
- fits overflow
197
- | |
198
- v v
199
- commit select least-recently-used active Document
200
- |
201
- v
202
- snapshot document + revision
203
- |
204
- v
205
- spawn archive worker
206
- |
207
- v
208
- write/verify concise Mnemon cold reference
209
- with title, summary, planned path, SHA-256
210
- |
211
- +----+----+
212
- | |
213
- failed receipt ok
214
- | |
215
- v v
216
- keep active revision check
217
- |
218
- +----+----+
219
- | |
220
- conflict current
221
- | |
222
- v v
223
- keep active move file to archived
224
- |
225
- v
226
- retry original mutation
227
- ```
228
-
229
- Manual archiving uses the same “index first, move second” path. When the Mnemon index succeeds but a revision conflict occurs, the index is not rolled back, so a safe duplicate reference may remain while the active original text is never lost.
230
-
231
- ## Deterministic Activity Scoring and Background Review
232
-
233
- Completed turns accumulate four signals:
234
-
235
- ```text
236
- score =
237
- min(floor(totalUserCharacters / 50), 3)
238
- + completedTurnCount
239
- + min(floor(completedToolResults / 5), 2)
240
- + toolDiversityScore
241
-
242
- toolDiversityScore:
243
- unique tools < 3 -> 0
244
- unique tools = 3 -> 1
245
- unique tools >= 4 -> 2
246
-
247
- eligible when score >= 5
248
- ```
249
-
250
- Reaching the threshold does not guarantee a write:
251
-
252
- ```text
253
- completed turn
254
- |
255
- v
256
- score >= 5 ? -- no --> retain activity for later turns
257
- |
258
- yes
259
- |
260
- v
261
- wait idleReviewMs (default 30 s)
262
- |
263
- +-- new turn --> cancel timer/worker, retain activity
264
- |
265
- v
266
- confirm Agent is idle and turn/end exists
267
- |
268
- v
269
- fork completed parent checkpoint
270
- |
271
- v
272
- conservative maintenance decision
273
- - at most one hot-memory mutation by persona
274
- - at most one Document create/update by persona
275
- - no direct long-term remember/forget tools
276
- |
277
- +-- completed, including skip -> clear activity
278
- |
279
- +-- failed/aborted ------------> retain activity
280
- ```
281
-
282
- “At most one” is currently enforced by the worker persona, not by a Host mutation counter. Background watermarks are not yet persisted, so a Host restart loses accumulated signals that have not been processed.
283
-
284
- ## How Configuration Switches Interact
285
-
286
- - `recallMode=off`: stops injecting recall cues; explicit `mnemon_recall` remains available.
287
- - `writebackMode=off`: disables writeback cues and scored background review; explicit writes are still governed by `writeEnabled`.
288
- - `lifecycleEnabled=false`: disables lifecycle reminders and review without removing explicit tools or Web entry points.
289
- - `routingGuidance=false`: removes only the additional routing section; the Runtime Memory section remains registered.
290
- - `writeEnabled=false`: removes semantic write tools and write RPC, and rejects write commands; it does not guarantee a read-only file-system mount.