dsh-mnemon 0.1.5 → 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 (214) hide show
  1. package/README.md +5 -5
  2. package/README.zh-CN.md +5 -5
  3. package/lib/client.js +353 -347
  4. package/lib/index.js +129 -46
  5. package/lib/types/activity.d.ts +2 -18
  6. package/lib/types/channels.d.ts +1 -4
  7. package/lib/types/client/MnemonLogo.d.ts +0 -1
  8. package/lib/types/client/MnemonPackSection.d.ts +1 -2
  9. package/lib/types/client/MnemonSaveAction.d.ts +1 -2
  10. package/lib/types/client/MnemonSettingsCard.d.ts +1 -3
  11. package/lib/types/client/MnemonTurnTail.d.ts +1 -2
  12. package/lib/types/client/MnemonView.d.ts +1 -3
  13. package/lib/types/client/MnemonViewAppearance.d.ts +0 -1
  14. package/lib/types/client/anchor.d.ts +0 -1
  15. package/lib/types/client/api.d.ts +1 -9
  16. package/lib/types/client/dsh-compat.d.ts +0 -1
  17. package/lib/types/client/index.d.ts +0 -1
  18. package/lib/types/client/locales.d.ts +4 -1
  19. package/lib/types/client/settings.d.ts +1 -2
  20. package/lib/types/client/sidebar-entry.d.ts +0 -1
  21. package/lib/types/client/workspace-controller.d.ts +0 -1
  22. package/lib/types/client/workspace-mount.d.ts +1 -3
  23. package/lib/types/commands.d.ts +0 -1
  24. package/lib/types/config-values.d.ts +0 -1
  25. package/lib/types/config.d.ts +6 -80
  26. package/lib/types/contracts.d.ts +2 -60
  27. package/lib/types/documents.d.ts +2 -79
  28. package/lib/types/guidance.d.ts +0 -1
  29. package/lib/types/index.d.ts +0 -1
  30. package/lib/types/lifecycle.d.ts +3 -45
  31. package/lib/types/live-runtime.d.ts +0 -1
  32. package/lib/types/memory-bodies.d.ts +3 -20
  33. package/lib/types/pack.d.ts +2 -48
  34. package/lib/types/process.d.ts +0 -1
  35. package/lib/types/review-activity.d.ts +2 -16
  36. package/lib/types/rpc.d.ts +0 -1
  37. package/lib/types/runner.d.ts +15 -11
  38. package/lib/types/runtime-memory.d.ts +2 -59
  39. package/lib/types/service.d.ts +3 -149
  40. package/lib/types/settings.d.ts +1 -4
  41. package/lib/types/shared/contracts.d.ts +609 -0
  42. package/lib/types/storage-scope.d.ts +2 -29
  43. package/lib/types/subagent.d.ts +2 -15
  44. package/lib/types/tools.d.ts +0 -1
  45. package/lib/types/version-updates.d.ts +2 -29
  46. package/package.json +8 -7
  47. package/docs/README.md +0 -8
  48. package/docs/assets/diagrams/en/memory-system-flow.png +0 -0
  49. package/docs/assets/diagrams/en/project-architecture.svg +0 -182
  50. package/docs/assets/diagrams/zh-CN/memory-system-flow.png +0 -0
  51. package/docs/assets/diagrams/zh-CN/project-architecture.svg +0 -182
  52. package/docs/assets/media/dsh-mnemon-memory-system-demo-poster.jpg +0 -0
  53. package/docs/assets/media/dsh-mnemon-memory-system-demo.gif +0 -0
  54. package/docs/assets/media/dsh-mnemon-memory-system-demo.mp4 +0 -0
  55. package/docs/assets/screenshots/conversation-memory-jump.png +0 -0
  56. package/docs/assets/screenshots/conversation-save-dialog.png +0 -0
  57. package/docs/assets/screenshots/conversation-turn-memory.png +0 -0
  58. package/docs/assets/screenshots/document-create-dialog.png +0 -0
  59. package/docs/assets/screenshots/documents-markdown.png +0 -0
  60. package/docs/assets/screenshots/entities-context.png +0 -0
  61. package/docs/assets/screenshots/memory-content.png +0 -0
  62. package/docs/assets/screenshots/overview-memory-graph.png +0 -0
  63. package/docs/assets/screenshots/recall-agent-answer.png +0 -0
  64. package/docs/assets/screenshots/remember-dialog.png +0 -0
  65. package/docs/assets/screenshots/runtime-memory-add.png +0 -0
  66. package/docs/assets/screenshots/runtime-memory.png +0 -0
  67. package/docs/assets/screenshots/settings-memory-system.png +0 -0
  68. package/docs/assets/screenshots/status-overview.png +0 -0
  69. package/docs/assets/screenshots/version-check.png +0 -0
  70. package/docs/en/README.md +0 -48
  71. package/docs/en/architecture.md +0 -133
  72. package/docs/en/configuration.md +0 -234
  73. package/docs/en/development.md +0 -198
  74. package/docs/en/getting-started.md +0 -199
  75. package/docs/en/interfaces.md +0 -181
  76. package/docs/en/operations.md +0 -173
  77. package/docs/en/project-overview.md +0 -145
  78. package/docs/en/roadmap.md +0 -41
  79. package/docs/en/storage-model.md +0 -185
  80. package/docs/en/ui-guide.md +0 -156
  81. package/docs/en/workflows.md +0 -290
  82. package/docs/zh-CN/README.md +0 -48
  83. package/docs/zh-CN/architecture.md +0 -133
  84. package/docs/zh-CN/configuration.md +0 -234
  85. package/docs/zh-CN/development.md +0 -198
  86. package/docs/zh-CN/getting-started.md +0 -199
  87. package/docs/zh-CN/interfaces.md +0 -181
  88. package/docs/zh-CN/operations.md +0 -173
  89. package/docs/zh-CN/project-overview.md +0 -145
  90. package/docs/zh-CN/roadmap.md +0 -41
  91. package/docs/zh-CN/storage-model.md +0 -185
  92. package/docs/zh-CN/ui-guide.md +0 -160
  93. package/docs/zh-CN/workflows.md +0 -290
  94. package/lib/client.js.map +0 -1
  95. package/lib/types/activity.d.ts.map +0 -1
  96. package/lib/types/activity.js +0 -93
  97. package/lib/types/activity.js.map +0 -1
  98. package/lib/types/channels.d.ts.map +0 -1
  99. package/lib/types/channels.js +0 -4
  100. package/lib/types/channels.js.map +0 -1
  101. package/lib/types/client/MnemonLogo.d.ts.map +0 -1
  102. package/lib/types/client/MnemonLogo.js +0 -6
  103. package/lib/types/client/MnemonLogo.js.map +0 -1
  104. package/lib/types/client/MnemonPackSection.d.ts.map +0 -1
  105. package/lib/types/client/MnemonPackSection.js +0 -136
  106. package/lib/types/client/MnemonPackSection.js.map +0 -1
  107. package/lib/types/client/MnemonSaveAction.d.ts.map +0 -1
  108. package/lib/types/client/MnemonSaveAction.js +0 -90
  109. package/lib/types/client/MnemonSaveAction.js.map +0 -1
  110. package/lib/types/client/MnemonSettingsCard.d.ts.map +0 -1
  111. package/lib/types/client/MnemonSettingsCard.js +0 -155
  112. package/lib/types/client/MnemonSettingsCard.js.map +0 -1
  113. package/lib/types/client/MnemonTurnTail.d.ts.map +0 -1
  114. package/lib/types/client/MnemonTurnTail.js +0 -56
  115. package/lib/types/client/MnemonTurnTail.js.map +0 -1
  116. package/lib/types/client/MnemonView.d.ts.map +0 -1
  117. package/lib/types/client/MnemonView.js +0 -1594
  118. package/lib/types/client/MnemonView.js.map +0 -1
  119. package/lib/types/client/MnemonViewAppearance.d.ts.map +0 -1
  120. package/lib/types/client/MnemonViewAppearance.js +0 -67
  121. package/lib/types/client/MnemonViewAppearance.js.map +0 -1
  122. package/lib/types/client/anchor.d.ts.map +0 -1
  123. package/lib/types/client/anchor.js +0 -46
  124. package/lib/types/client/anchor.js.map +0 -1
  125. package/lib/types/client/api.d.ts.map +0 -1
  126. package/lib/types/client/api.js +0 -150
  127. package/lib/types/client/api.js.map +0 -1
  128. package/lib/types/client/dsh-compat.d.ts.map +0 -1
  129. package/lib/types/client/dsh-compat.js +0 -2
  130. package/lib/types/client/dsh-compat.js.map +0 -1
  131. package/lib/types/client/index.d.ts.map +0 -1
  132. package/lib/types/client/index.js +0 -161
  133. package/lib/types/client/index.js.map +0 -1
  134. package/lib/types/client/locales.d.ts.map +0 -1
  135. package/lib/types/client/locales.js +0 -1172
  136. package/lib/types/client/locales.js.map +0 -1
  137. package/lib/types/client/settings.d.ts.map +0 -1
  138. package/lib/types/client/settings.js +0 -70
  139. package/lib/types/client/settings.js.map +0 -1
  140. package/lib/types/client/sidebar-entry.d.ts.map +0 -1
  141. package/lib/types/client/sidebar-entry.js +0 -134
  142. package/lib/types/client/sidebar-entry.js.map +0 -1
  143. package/lib/types/client/workspace-controller.d.ts.map +0 -1
  144. package/lib/types/client/workspace-controller.js +0 -21
  145. package/lib/types/client/workspace-controller.js.map +0 -1
  146. package/lib/types/client/workspace-mount.d.ts.map +0 -1
  147. package/lib/types/client/workspace-mount.js +0 -138
  148. package/lib/types/client/workspace-mount.js.map +0 -1
  149. package/lib/types/commands.d.ts.map +0 -1
  150. package/lib/types/commands.js +0 -104
  151. package/lib/types/commands.js.map +0 -1
  152. package/lib/types/config-values.d.ts.map +0 -1
  153. package/lib/types/config-values.js +0 -4
  154. package/lib/types/config-values.js.map +0 -1
  155. package/lib/types/config.d.ts.map +0 -1
  156. package/lib/types/config.js +0 -127
  157. package/lib/types/config.js.map +0 -1
  158. package/lib/types/contracts.d.ts.map +0 -1
  159. package/lib/types/contracts.js +0 -2
  160. package/lib/types/contracts.js.map +0 -1
  161. package/lib/types/documents.d.ts.map +0 -1
  162. package/lib/types/documents.js +0 -495
  163. package/lib/types/documents.js.map +0 -1
  164. package/lib/types/guidance.d.ts.map +0 -1
  165. package/lib/types/guidance.js +0 -34
  166. package/lib/types/guidance.js.map +0 -1
  167. package/lib/types/index.d.ts.map +0 -1
  168. package/lib/types/index.js +0 -55
  169. package/lib/types/index.js.map +0 -1
  170. package/lib/types/lifecycle.d.ts.map +0 -1
  171. package/lib/types/lifecycle.js +0 -456
  172. package/lib/types/lifecycle.js.map +0 -1
  173. package/lib/types/live-runtime.d.ts.map +0 -1
  174. package/lib/types/live-runtime.js +0 -146
  175. package/lib/types/live-runtime.js.map +0 -1
  176. package/lib/types/memory-bodies.d.ts.map +0 -1
  177. package/lib/types/memory-bodies.js +0 -186
  178. package/lib/types/memory-bodies.js.map +0 -1
  179. package/lib/types/pack.d.ts.map +0 -1
  180. package/lib/types/pack.js +0 -709
  181. package/lib/types/pack.js.map +0 -1
  182. package/lib/types/process.d.ts.map +0 -1
  183. package/lib/types/process.js +0 -65
  184. package/lib/types/process.js.map +0 -1
  185. package/lib/types/review-activity.d.ts.map +0 -1
  186. package/lib/types/review-activity.js +0 -37
  187. package/lib/types/review-activity.js.map +0 -1
  188. package/lib/types/rpc.d.ts.map +0 -1
  189. package/lib/types/rpc.js +0 -384
  190. package/lib/types/rpc.js.map +0 -1
  191. package/lib/types/runner.d.ts.map +0 -1
  192. package/lib/types/runner.js +0 -198
  193. package/lib/types/runner.js.map +0 -1
  194. package/lib/types/runtime-memory.d.ts.map +0 -1
  195. package/lib/types/runtime-memory.js +0 -415
  196. package/lib/types/runtime-memory.js.map +0 -1
  197. package/lib/types/service.d.ts.map +0 -1
  198. package/lib/types/service.js +0 -512
  199. package/lib/types/service.js.map +0 -1
  200. package/lib/types/settings.d.ts.map +0 -1
  201. package/lib/types/settings.js +0 -103
  202. package/lib/types/settings.js.map +0 -1
  203. package/lib/types/storage-scope.d.ts.map +0 -1
  204. package/lib/types/storage-scope.js +0 -179
  205. package/lib/types/storage-scope.js.map +0 -1
  206. package/lib/types/subagent.d.ts.map +0 -1
  207. package/lib/types/subagent.js +0 -624
  208. package/lib/types/subagent.js.map +0 -1
  209. package/lib/types/tools.d.ts.map +0 -1
  210. package/lib/types/tools.js +0 -341
  211. package/lib/types/tools.js.map +0 -1
  212. package/lib/types/version-updates.d.ts.map +0 -1
  213. package/lib/types/version-updates.js +0 -383
  214. package/lib/types/version-updates.js.map +0 -1
@@ -1,133 +0,0 @@
1
- # Architecture
2
-
3
- [简体中文](../zh-CN/architecture.md) | **English** | [Documentation Center](./README.md)
4
-
5
- ## Positioning
6
-
7
- `dsh-mnemon` is an integration and supervision layer between DSH and Mnemon, not a new database engine:
8
-
9
- - DSH provides the root Agent, lifecycle events, subagent providers, tools, commands, settings, and Web extension points;
10
- - the plugin provides the control plane for three knowledge layers, routing policies, transactional barriers, and UI;
11
- - the local `mnemon` CLI provides named Stores, SQLite persistence, four graph types, recall, relationships, and soft deletion, and defines the durable-data boundary shared with other Mnemon-enabled agents.
12
-
13
- ## Component Diagram
14
-
15
- [![dsh-mnemon runtime architecture](../assets/diagrams/en/project-architecture.svg)](../assets/diagrams/en/project-architecture.svg)
16
-
17
- Solid lines show deterministic data or control paths; purple dashed lines show LLM-supervised paths. Runtime Memory and Documents use managed files directly. Only Memory Spaces call the local Mnemon CLI through `MnemonRunner`. Click the image to open the original SVG.
18
-
19
- Cross-agent interoperability therefore applies only to Memory Spaces in the diagram: agents share durable memories and relations inside Mnemon Stores, not DSH conversation context, Runtime projections, or the Documents control plane. The plugin never pushes data to another agent; participants share by aligning their local Mnemon root and Store.
20
-
21
- ## Host Composition Root
22
-
23
- `src/index.ts::apply()` assembles the plugin in this order:
24
-
25
- ```text
26
- settings.register("mnemon")
27
- -> resolveConfig
28
- -> createRunner
29
- -> MnemonService
30
- -> RuntimeMemoryController
31
- -> DocumentManager
32
- -> StorageScopeInspector
33
- -> MnemonSubagentCoordinator
34
- -> MnemonLifecycle
35
- -> tools / commands / prompt sections
36
- -> register RPC when a Web connection exists
37
- ```
38
-
39
- The Host declares dependencies on `tools`, `settings`, `commands`, `agents`, and `subagents`. The Web client additionally depends on slots, connection, and DSH locale services.
40
-
41
- ## Dual Paths for the Root Agent and Workers
42
-
43
- The same `mnemon_*` tools route calls according to whether the caller is a subagent, preventing recursive delegation:
44
-
45
- ```text
46
- root Agent calls mnemon_recall
47
- -> coordinator starts a bounded recall worker
48
- -> worker calls mnemon_memory_bodies and mnemon_recall
49
- -> tool sees origin=subagent
50
- -> call reaches MnemonService directly
51
- -> structured evidence returns to root Agent
52
- ```
53
-
54
- Long-term semantic writes, relationships, soft deletion, and Memory Space creation, updates, and merges use the same pattern. Ordinary Runtime Memory and Document mutations first pass through the coordinator but are usually committed directly by the deterministic control layer; only capacity maintenance or archiving requires an additional worker.
55
-
56
- Physical Memory Space deletion is a separate deterministic destructive action. The WebUI must show a second confirmation, then invoke native Mnemon `store remove` through the loopback write RPC; the directory registration is removed only after the CLI deletion succeeds.
57
-
58
- ## Two Types of Subagent
59
-
60
- ### `spawn`
61
-
62
- `spawn` uses a new isolated context. For each task type, the plugin supplies:
63
-
64
- - a fixed persona;
65
- - a minimal tool allowlist;
66
- - a structured output schema within the subset supported by DSH;
67
- - `maxDepth: 1`;
68
- - a cancellable signal and bounded token budget.
69
-
70
- It is used for recall, long-term semantic writes, evidence-bound answers, hot-memory maintenance, and Document archiving.
71
-
72
- ### `fork`
73
-
74
- Scored background review requires a provider named `fork` with `inheritsParentContext=true`. It inherits only a completed parent checkpoint and determines whether to maintain hot memory or at most one Project Document. It is not a continuation of the user's task, and it does not inject review reasoning into the main conversation.
75
-
76
- The current review allowlist excludes `mnemon_remember`, `mnemon_forget`, and Memory Space maintenance tools, so background review cannot modify long-term Memory Spaces directly.
77
-
78
- ## Control Plane and Data Plane
79
-
80
- ```text
81
- LLM-owned judgment Host-owned guarantees
82
- ------------------ ---------------------
83
- what is worth keeping input validation
84
- which Memory Space fits path boundary
85
- whether two items are duplicates process timeout/cancel
86
- how to summarize a Document file lock + atomic rename
87
- whether a reusable artifact exists UTF-8 capacity accounting
88
- revision conflict rejection
89
- read/write RPC authority
90
- ```
91
-
92
- Persona constraints must be distinguished from hard Host guarantees. For example, the MEMORY archival worker is instructed to cover every committed hot-memory item, but the Host can strictly validate only the structured action, revision, and byte budget; the Host does validate USER compaction source coverage item by item.
93
-
94
- ## Web Boundary
95
-
96
- The WebUI does not start system processes or open SQLite directly:
97
-
98
- ```text
99
- browser component
100
- -> typed client wrapper
101
- -> DSH RPC authority check
102
- -> Host validation
103
- -> controller / service / bounded worker
104
- -> local CLI or managed files
105
- ```
106
-
107
- Read channels require `trusted-host`; memory write channels and settings channels require `loopback`. When `writeEnabled=false`, the Host does not register memory write channels.
108
-
109
- ## Internationalization
110
-
111
- `src/client/locales.ts` defines `MnemonKey` from the Chinese key set, and the English dictionary must satisfy the same set of keys; `src/client/index.ts` registers both dictionaries with the DSH locale. The main Web pages and settings card switch immediately with the DSH global language and reuse the global light or dark theme.
112
-
113
- Command output, tool-card titles, persisted compatibility-default Memory Space names, and some backend errors are still monolingual. This is a known gap on the Roadmap.
114
-
115
- ## Key Modules
116
-
117
- | Module | Responsibility |
118
- |---|---|
119
- | `src/index.ts` | Host composition and registration |
120
- | `src/config.ts` | Configuration schema, defaults, and resolution |
121
- | `src/process.ts` | Bounded process execution without a shell |
122
- | `src/runner.ts` | CLI discovery, arguments, serialization, and JSON parsing |
123
- | `src/service.ts` | Application facade for long-term memory |
124
- | `src/memory-bodies.ts` | Memory Space catalog metadata |
125
- | `src/runtime-memory.ts` | Hot-memory source of truth and projections |
126
- | `src/documents.ts` | Documents control plane |
127
- | `src/subagent.ts` | Worker orchestration and capacity transactions |
128
- | `src/lifecycle.ts` | Per-root-Agent lifecycle |
129
- | `src/review-activity.ts` | Deterministic review scoring |
130
- | `src/tools.ts` | Model tools and root/worker routing |
131
- | `src/rpc.ts` | Web read/write channels |
132
- | `src/storage-scope.ts` | Read-only inventory of the three storage scopes |
133
- | `src/client/*` | Web workspace, settings, and locale |
@@ -1,234 +0,0 @@
1
- # Configuration Reference
2
-
3
- [简体中文](../zh-CN/configuration.md) | **English** | [Documentation Center](./README.md)
4
-
5
- ## Configuration Location and Activation
6
-
7
- The plugin registers the `mnemon` namespace with the DSH settings service. User configuration is stored in:
8
-
9
- ```text
10
- $DSH_HOME/settings.yaml
11
- ```
12
-
13
- The default is commonly `~/.dsh/settings.yaml`. All current settings are marked `live`; after Save, the Host initializes a candidate runtime graph and then switches to it atomically.
14
-
15
- The Web settings page edits `displayMode`, `storageScope`, and `dataDir`, plus the Turn memory and Save-to-memory switches under `mnemon-ui`. The same page also imports or exports a ZIP for the effective root. Other advanced settings must be changed directly in YAML.
16
-
17
- ## Complete Example
18
-
19
- ```yaml
20
- mnemon:
21
- displayMode: sidebar # sidebar | buildin
22
- storageScope: global # global | workspace | custom
23
- # dataDir: ~/mnemon-data # required for custom
24
- # cliPath: /opt/homebrew/bin/mnemon
25
- # store: legacy-store # compatibility discovery hint, not a regular routing target
26
- timeoutMs: 10000
27
- defaultRecallLimit: 10
28
- routingGuidance: true
29
- lifecycleEnabled: true
30
- recallMode: guided
31
- writebackMode: guided
32
- idleReviewMs: 30000
33
- tabEnabled: true
34
- writeEnabled: true
35
- ```
36
-
37
- ## Options
38
-
39
- | Setting | Default | Range | Implementation Semantics |
40
- |---|---:|---|---|
41
- | `displayMode` | `sidebar` | `sidebar` / `buildin` | `sidebar` mounts the dedicated sidebar workbench; `buildin` restores the native DSH conversation-area tab; saving switches live and never mounts both entries together |
42
- | `storageScope` | `global` | `global` / `workspace` / `custom` | Controls the root for Runtime, Documents, Memory Spaces, and reserved state as one unit |
43
- | `dataDir` | unset | absolute path, `~`, or `~/...` | Required for `custom`; legacy configurations that set only this option automatically resolve to `custom` |
44
- | `cliPath` | auto-discovered | executable path | Explicitly selects the Mnemon CLI |
45
- | `store` | unset | `[A-Za-z0-9][A-Za-z0-9_-]*` | Compatibility discovery/preference hint for legacy Stores; semantic operations are routed through Memory Spaces |
46
- | `timeoutMs` | `10000` | 100–120000 ms | Hard timeout for a single CLI call |
47
- | `defaultRecallLimit` | `10` | 1–50 | Default recall count for the service and UI; individual entry points may impose a lower limit |
48
- | `routingGuidance` | `true` | boolean | Whether to register an additional tiered-routing system section |
49
- | `lifecycleEnabled` | `true` | boolean | Whether to enable the pre-step cue and score-based background review |
50
- | `recallMode` | `guided` | `guided` / `off` | Whether to inject an on-demand recall cue; does not remove explicit recall |
51
- | `writebackMode` | `guided` | `guided` / `off` | Whether to inject the hot-memory cue and enable score-based background review; does not remove explicit writes |
52
- | `idleReviewMs` | `30000` | 5000–600000 ms | Required continuous idle time after the threshold is reached |
53
- | `tabEnabled` | `true` | boolean | Whether to mount the Web entry selected by `displayMode`; Host RPC, commands, and Agent tools remain registered when off |
54
- | `writeEnabled` | `true` | boolean | Whether to expose semantic write tools, write RPC, and write commands |
55
- | `mnemon-ui.turnBar` | `true` | boolean | Turn-tail memory activity bar; on by default, **applies live after saving** |
56
- | `mnemon-ui.saveAction` | `true` | boolean | “Save to memory” icon and confirmation on finalized assistant replies; on by default, **applies live after saving** |
57
-
58
- Both the `mnemon` Host/storage namespace and the `mnemon-ui` browser-presentation namespace apply live. The storage root switches atomically only after the new runtime graph initializes successfully. Legacy `mnemon.conversationInteraction` values remain a migration default, but new saves write only to `mnemon-ui`.
59
-
60
- ## Storage Scopes
61
-
62
- ### `global`
63
-
64
- ```text
65
- MNEMON_DATA_DIR when non-empty
66
- otherwise ~/.mnemon
67
- ```
68
-
69
- Suitable for users who want Runtime, Documents, and Memory Spaces shared across multiple workspaces. Other Mnemon-enabled agents can also share the Mnemon Memory Spaces when they use the same root.
70
-
71
- ### `workspace`
72
-
73
- ```text
74
- Agent / tool / lifecycle: resolve(currentSession.header.cwd, ".mnemon")
75
- Web workbench inspection: resolve(workspaceRegistry.get(selectedWorkspaceId).path, ".mnemon")
76
- ```
77
-
78
- Each DSH workspace owns an independent three-tier memory root. Agents, model tools, commands, and lifecycle hooks route by the current session cwd and are unaffected by the Web workbench's inspection target. The workbench can select only Host-registered workspaces, never an arbitrary path. When inspection and execution differ, the header shows both paths and offers one-click alignment with the current session. Agent-backed actions are rejected while misaligned to prevent writes to the wrong project.
79
-
80
- ### `custom`
81
-
82
- ```yaml
83
- mnemon:
84
- storageScope: custom
85
- dataDir: /absolute/path/to/mnemon-data
86
- ```
87
-
88
- `~` and `~/...` are also allowed. Relative paths are rejected.
89
-
90
- ### Choose a Cross-Agent Sharing Scope
91
-
92
- | Goal | Recommended scope | Notes |
93
- |---|---|---|
94
- | Share durable memory among local agents | `global` | Every participant uses `~/.mnemon` or the same `MNEMON_DATA_DIR` |
95
- | Share one explicit data root | `custom` | Every participant configures the same absolute directory for isolation and backup |
96
- | Share only inside one project | `workspace` | Every participant aligns its Mnemon root to that project's `<workspace>/.mnemon` |
97
-
98
- Only the Mnemon durable tier under `data/<store>/mnemon.db` has native cross-agent interoperability. Runtime, Documents, DSH activation state, and UI metadata remain managed by dsh-mnemon.
99
-
100
- ## CLI Discovery Precedence
101
-
102
- ```text
103
- config.cliPath
104
- -> executable MNEMON_CLI_PATH
105
- -> each PATH directory
106
- -> Windows: GOBIN/mnemon.exe
107
- first GOPATH/bin/mnemon.exe, or ~/go/bin/mnemon.exe
108
- %LOCALAPPDATA%/Programs/mnemon/mnemon.exe
109
- %ProgramFiles%/mnemon/mnemon.exe
110
- -> Unix: ~/.local/bin/mnemon
111
- /opt/homebrew/bin/mnemon
112
- /usr/local/bin/mnemon
113
- /usr/bin/mnemon
114
- ```
115
-
116
- An explicit `cliPath` is accepted as configured; if it is not executable, actual calls return a launch error. Automatically discovered Windows commands must be regular `.exe` files. `.cmd` and `.bat` wrappers are intentionally excluded because process execution does not use a shell.
117
-
118
- ## Compatibility Store Hint Precedence
119
-
120
- ```text
121
- config.store
122
- -> MNEMON_STORE
123
- -> <storageRoot>/active
124
- -> default
125
- ```
126
-
127
- After the Memory Space directory has been established, long-term semantic operations use explicit Memory Space IDs and do not rely on the global active Store for routing.
128
-
129
- ## Provider Requirements
130
-
131
- Regular workers prefer `spawn`. If no provider has that name, another provider with all of the following capabilities can be selected:
132
-
133
- ```text
134
- outputSchema = true
135
- toolFilter = true
136
- persona = true
137
- depthLimit = true
138
- ```
139
-
140
- Background review has no fallback: a compatible provider named `fork` must exist and must have:
141
-
142
- ```text
143
- inheritsParentContext = true
144
- ```
145
-
146
- A missing `fork` does not block deterministic state or regular UI reads, but a subagent failure is recorded when the review threshold is reached.
147
-
148
- ## Read-Only Configuration
149
-
150
- ```yaml
151
- mnemon:
152
- writeEnabled: false
153
- ```
154
-
155
- Effects:
156
-
157
- - Model write tools are not registered;
158
- - `/dsh-mnemon-write` RPC is not registered;
159
- - `/mnemon remember` and `/mnemon forget` are rejected;
160
- - semantic mutations through `MnemonService` are rejected.
161
-
162
- This is feature-level read-only behavior, not a read-only filesystem mode: the Runtime controller may still initialize or repair projections, Document search updates LRU access times, and Mnemon read commands may trigger upstream database migrations. Do not treat `writeEnabled=false` as a safety guarantee for read-only mounts.
163
-
164
- ## Switch Interactions
165
-
166
- ```text
167
- writeEnabled=false
168
- -> overrides all explicit semantic writes
169
-
170
- writebackMode=off
171
- -> no write cue, no scored review
172
- -> explicit writes remain when writeEnabled=true
173
-
174
- recallMode=off
175
- -> no recall cue
176
- -> explicit recall remains
177
-
178
- lifecycleEnabled=false
179
- -> no lifecycle cues or review
180
- -> UI, commands, and explicit tools remain
181
-
182
- routingGuidance=false
183
- -> removes only mnemon:routing
184
- -> runtime-memory prompt section remains
185
- ```
186
-
187
- ## Display Mode and the `tabEnabled` UI Switch
188
-
189
- `displayMode=sidebar` (the default) mounts the “Memory System” sidebar entry and its dedicated center-column workbench with a minimal, logo-free skin aligned with official DSH panels. `displayMode=buildin` instead registers the original DSH `conversation.view` tab and preserves its existing visuals. The modes share the functional workbench while keeping appearance definitions isolated. Saving first disposes the active entry and then mounts the target, so the two modes never appear simultaneously.
190
-
191
- `tabEnabled=false` removes the currently selected Web entry live. Host RPC, commands, and tools remain registered across display-mode and enablement changes so an Agent or command already in progress stays valid.
192
-
193
- ## Profile Patch Overrides
194
-
195
- The bundled `cordis.patch.yml` provides the default config row. A DSH profile configuration with the same ID may replace that row as a whole. Do not add only `cliPath` to a final profile patch: use `MNEMON_CLI_PATH` or the `mnemon.cliPath` user setting instead. When a profile patch must be customized for another reason, retain every key that must remain enabled instead of assuming a deep merge.
196
-
197
- ## Common Configurations
198
-
199
- Workspace isolation:
200
-
201
- ```yaml
202
- mnemon:
203
- storageScope: workspace
204
- ```
205
-
206
- An explicit Windows CLI path:
207
-
208
- ```yaml
209
- mnemon:
210
- cliPath: 'C:\Users\alice\AppData\Local\Programs\mnemon\mnemon.exe'
211
- ```
212
-
213
- A custom data volume and a longer CLI timeout:
214
-
215
- ```yaml
216
- mnemon:
217
- storageScope: custom
218
- dataDir: /Volumes/AgentData/mnemon
219
- timeoutMs: 30000
220
- ```
221
-
222
- Keep explicit tools while disabling lifecycle behavior:
223
-
224
- ```yaml
225
- mnemon:
226
- lifecycleEnabled: false
227
- ```
228
-
229
- Disable only background writeback decisions:
230
-
231
- ```yaml
232
- mnemon:
233
- writebackMode: off
234
- ```
@@ -1,198 +0,0 @@
1
- # Development and Verification
2
-
3
- [简体中文](../zh-CN/development.md) | **English** | [Documentation Center](./README.md)
4
-
5
- ## Environment
6
-
7
- The repository does not declare minimum Node, pnpm, DSH, or Mnemon versions in `package.json`. Use the current DSH development environment and verify compatibility through the full validation chain whenever dependencies are upgraded.
8
-
9
- Install dependencies:
10
-
11
- ```sh
12
- pnpm install
13
- ```
14
-
15
- ## Standard Commands
16
-
17
- ```sh
18
- pnpm run typecheck # tsc --noEmit
19
- pnpm test # vitest run
20
- pnpm run build # declarations + host/client bundles
21
- pnpm run verify # typecheck + test + build
22
- ```
23
-
24
- ## Directory Structure
25
-
26
- ```text
27
- src/
28
- +-- index.ts # Host composition root
29
- +-- config.ts # settings schema
30
- +-- process.ts / runner.ts # local CLI execution
31
- +-- service.ts # durable-memory facade
32
- +-- memory-bodies.ts # Memory Space registry
33
- +-- runtime-memory.ts # hot-memory authority
34
- +-- documents.ts # managed Documents
35
- +-- subagent.ts # bounded workers
36
- +-- lifecycle.ts # root-Agent hooks
37
- +-- review-activity.ts # activity score
38
- +-- tools.ts / commands.ts # model and human interfaces
39
- +-- rpc.ts / settings.ts # Web bridges
40
- +-- storage-scope.ts # storage inventory
41
- +-- client/ # React workspace and locales
42
- tests/ # Vitest suites
43
- lib/ # committed build artifacts
44
- docs/zh-CN/ # Chinese documentation
45
- docs/en/ # English mirror
46
- cordis.patch.yml # DSH profile bundle patch
47
- ```
48
-
49
- ## Build Artifacts
50
-
51
- ```text
52
- tsc -p tsconfig.build.json
53
- -> lib/types/* declarations, maps, intermediate ESM
54
-
55
- tsdown host bundle
56
- -> lib/index.js Node ES2024 ESM
57
-
58
- tsdown client bundle
59
- -> lib/client.js DSH browser module wrapper
60
- -> lib/client.js.map
61
-
62
- lightningcss plugin
63
- -> CSS Modules compiled and injected as scoped <style>
64
- ```
65
-
66
- The Host keeps `cordis` and `schemastery` external. The client keeps React, ReactDOM, the JSX runtime, and Cordis external; all other dependencies are included in the bundle.
67
-
68
- `lib/` is part of the publishing input. After modifying `src/`, rebuild and inspect the generated diff. Do not edit `lib/` manually.
69
-
70
- ## Test Layers
71
-
72
- The existing Vitest suites cover:
73
-
74
- - configuration parsing, CLI discovery, and process serialization;
75
- - Memory Space discovery, activation, routing, and merge;
76
- - recall-payload compatibility and graph parsing;
77
- - Runtime JSON/Markdown consistency, locks, capacity, UTF-8, and revisions;
78
- - Document paths, frontmatter, search, LRU, archiving, and conflicts;
79
- - worker tool isolation, the schema subset, and structured receipts;
80
- - lifecycle cues, scoring, idle debounce, cancellation, and watermark retention;
81
- - RPC authority, read-only behavior, and settings revisions;
82
- - the Web workspace, bilingual copy, and key interactions.
83
-
84
- These are primarily integration tests using temporary directories, fake runners, and a mock Host. They are not equivalent to automated end-to-end tests of the real DSH + Mnemon WebUI.
85
-
86
- ## Real WebUI Verification
87
-
88
- Use an isolated environment before release to avoid contaminating personal memory:
89
-
90
- ```text
91
- temporary DSH_HOME
92
- temporary MNEMON_DATA_DIR or custom storageScope
93
- temporary workspace
94
- independent Web port
95
- local link installation
96
- ```
97
-
98
- Recommended scenarios:
99
-
100
- 1. Empty root: the UI reports no errors and can create the first Memory Space.
101
- 2. Regular conversation: only a short cue appears; recall and writes are not forced.
102
- 3. Historical question: the Agent independently recalls and returns the correct space provenance.
103
- 4. Explicit distillation: the worker deduplicates, selects a scope, and writes content that can be recalled again.
104
- 5. Multiple spaces: reads cover only active spaces; writing to an inactive space activates it automatically afterward.
105
- 6. Runtime: USER / MEMORY add, replace, remove, and projection consistency.
106
- 7. Documents: create, retrieve, update, manually archive, and leave original project files unchanged.
107
- 8. Score-based review: light tasks do not trigger it; after reaching the threshold it waits for idle; a new turn can cancel it while preserving the watermark.
108
- 9. Read-only: write tools, write commands, and write RPC are rejected while reads remain available.
109
- 10. Sidebar: all four primary tabs, four Memory Space secondary tabs, stable headings, filters, and progressive loading work.
110
- 11. Conversation UI: Turn memory appears only for completed turns with activity; links land correctly; canceling Save to memory performs no write.
111
- 12. Settings: Sidebar / Buildin, storage scopes, and both conversation switches apply live without refresh.
112
- 13. ZIP: export can be previewed and merged into an isolated custom root; damaged checksums are rejected.
113
- 14. Versions: checking never installs; link/manual sources offer no unsafe update; successful updates trigger a fresh status check.
114
- 15. Status and browser console: no unhandled errors or warnings.
115
-
116
- Capacity limits, CLI timeouts, revision conflicts, and Host restarts should be verified in a dedicated fault-injection environment.
117
-
118
- ## Maintaining Documentation Visuals
119
-
120
- Public UI screenshots live under `docs/assets/screenshots/`, shared by both language editions. Language-specific architecture diagrams live under `docs/assets/diagrams/zh-CN/` and `docs/assets/diagrams/en/`. When layout, primary copy, or defaults change:
121
-
122
- 1. Use a real DSH Web profile, but first check that the frame contains no token, credential, or private personal data.
123
- 2. Limit capture to inspection, filtering, expansion, and opening dialogs. When showing a write flow, stop before final confirmation.
124
- 3. Replace screenshots with the same responsibility instead of accumulating versioned filenames. Add an asset only for a new user task.
125
- 4. Refresh the README poster, GIF / MP4 demo, and both `ui-guide.md` files.
126
- 5. Confirm PNG / JPEG extensions match actual encoding and that text is readable at original resolution.
127
- 6. Remove unreferenced assets, stale Buildin layouts, and obsolete terminology.
128
- 7. Run link/image checks, then open both READMEs and UI guides manually.
129
-
130
- README demo assets are `docs/assets/media/dsh-mnemon-memory-system-demo.*`. The demo should cover Status, Runtime, Memory Spaces, Documents, and in-conversation confirmation without actually submitting memory, updating components, or changing settings through automation.
131
-
132
- ## Modifying Subagent Schemas
133
-
134
- DSH structured output supports only a compact JSON Schema subset:
135
-
136
- ```text
137
- type, oneOf, properties, required, additionalProperties,
138
- items, enum, const, and annotation keywords
139
- ```
140
-
141
- Do not add unsupported keywords such as `maxItems`. `assertDshOutputSchema()` recursively rejects unknown schema keys before starting a worker; result-count and similar limits are enforced by both the persona and the Host parser.
142
-
143
- ## Modifying Storage Formats
144
-
145
- Runtime, Documents, and the Memory Space registry each have a version field or fixed structure. Changes require:
146
-
147
- 1. Define how the old format is parsed;
148
- 2. add a migration or rejection path;
149
- 3. preserve temporary-file and atomic-rename behavior;
150
- 4. add tests for concurrency and damaged inputs;
151
- 5. update the Chinese and English storage, operations, and Roadmap documents;
152
- 6. verify upgrade and rollback against a copied data root.
153
-
154
- There is currently no formal schema-migration framework, so persistent formats must not change silently.
155
-
156
- ## Maintaining Documentation Internationalization
157
-
158
- `docs/zh-CN` and `docs/en` should contain matching filenames with the same section responsibilities. When changing defaults, workflows, or limitations:
159
-
160
- - update both languages;
161
- - keep commands, configuration keys, paths, and code symbols exactly the same;
162
- - cross-link corresponding language pages with relative paths;
163
- - prefer accessible SVGs with no scripts or external resources for architecture overviews; keep directory trees, commands, formulas, and short protocols as copyable `text` / ASCII;
164
- - keep only summaries in the root READMEs and place details on one authoritative docs page;
165
- - for every user-visible interface change, also inspect `ui-guide.md`, `getting-started.md`, `configuration.md`, and `operations.md`.
166
-
167
- When the Web locale changes, the Chinese key set remains the type source of truth. The English dictionary must satisfy `Record<MnemonKey, string>` and preserve the same placeholders.
168
-
169
- ## Release Checklist
170
-
171
- ```text
172
- [ ] pnpm run verify
173
- [ ] review source and generated lib diffs
174
- [ ] validate package file list includes README.md, README.zh-CN.md, docs/assets, and bilingual docs
175
- [ ] install the built/local bundle into an isolated Web profile
176
- [ ] run real Mnemon CLI and WebUI smoke tests
177
- [ ] verify Chinese and English workspaces
178
- [ ] verify global/workspace/custom paths as applicable
179
- [ ] record tested DSH and Mnemon versions
180
- [ ] back up any data root used for upgrade testing
181
- ```
182
-
183
- `package.json.files` currently publishes `lib`, the patch, both root READMEs, centrally managed documentation visuals, the public bilingual docs, and the License.
184
-
185
- ## Publishing to npm
186
-
187
- After publication, `dsh plugin --profile web add dsh-mnemon` resolves by registry name — the same path as dsh-better-sidebar. Steps:
188
-
189
- ```sh
190
- npm pack --dry-run # inspect the tarball file list (cordis.patch.yml, lib, docs)
191
- pnpm publish --access public # prepublishOnly runs pnpm run verify first
192
- ```
193
-
194
- Credential convention: write NPM_TOKEN only to the user-level `~/.npmrc` (`npm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}" --userconfig ~/.npmrc`) and remove it after publishing. Do **not** commit the credential line to the repository `.npmrc`: pnpm 11 deliberately ignores unexpanded environment-variable credentials in project-level `.npmrc` (with a warning), and that file travels with the repo.
195
-
196
- 2FA note: when the npm account has publish-level two-factor authentication, an interactive `pnpm publish --access public` prompts for the OTP; scripted/CI publishing needs a Classic **Automation** token or a Granular token allowed to bypass 2FA (a plain token from `npm login` cannot publish and fails with 403 Two-factor authentication required).
197
-
198
- Before publishing, check that `package.json` `repository`/`homepage`/`bugs` point at `omdsh-dev/dsh-mnemon` (npm page consistent with GitHub) and that the version has been bumped.