dsh-mnemon 0.1.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/LICENSE +21 -0
  2. package/README.en.md +169 -0
  3. package/README.md +169 -0
  4. package/cordis.patch.yml +15 -0
  5. package/docs/README.md +8 -0
  6. package/docs/en/README.md +39 -0
  7. package/docs/en/architecture.md +129 -0
  8. package/docs/en/assets/project-architecture.svg +182 -0
  9. package/docs/en/configuration.md +204 -0
  10. package/docs/en/development.md +178 -0
  11. package/docs/en/getting-started.md +147 -0
  12. package/docs/en/interfaces.md +159 -0
  13. package/docs/en/operations.md +151 -0
  14. package/docs/en/project-overview.md +247 -0
  15. package/docs/en/roadmap.md +41 -0
  16. package/docs/en/storage-model.md +179 -0
  17. package/docs/en/workflows.md +290 -0
  18. package/docs/zh-CN/README.md +39 -0
  19. package/docs/zh-CN/architecture.md +129 -0
  20. package/docs/zh-CN/assets/project-architecture.svg +182 -0
  21. package/docs/zh-CN/assets/screenshots/conversation-recall.png +0 -0
  22. package/docs/zh-CN/assets/screenshots/conversation-writeback.png +0 -0
  23. package/docs/zh-CN/assets/screenshots/documents-markdown.png +0 -0
  24. package/docs/zh-CN/assets/screenshots/entities-context.png +0 -0
  25. package/docs/zh-CN/assets/screenshots/memory-content.png +0 -0
  26. package/docs/zh-CN/assets/screenshots/overview-memory-graph.png +0 -0
  27. package/docs/zh-CN/assets/screenshots/recall-agent-answer.png +0 -0
  28. package/docs/zh-CN/assets/screenshots/runtime-memory.png +0 -0
  29. package/docs/zh-CN/configuration.md +204 -0
  30. package/docs/zh-CN/development.md +178 -0
  31. package/docs/zh-CN/getting-started.md +147 -0
  32. package/docs/zh-CN/interfaces.md +159 -0
  33. package/docs/zh-CN/operations.md +151 -0
  34. package/docs/zh-CN/project-overview.md +247 -0
  35. package/docs/zh-CN/roadmap.md +41 -0
  36. package/docs/zh-CN/storage-model.md +179 -0
  37. package/docs/zh-CN/workflows.md +290 -0
  38. package/lib/client.js +6288 -0
  39. package/lib/client.js.map +1 -0
  40. package/lib/index.js +4453 -0
  41. package/lib/types/client/MnemonLogo.d.ts +7 -0
  42. package/lib/types/client/MnemonLogo.d.ts.map +1 -0
  43. package/lib/types/client/MnemonLogo.js +6 -0
  44. package/lib/types/client/MnemonLogo.js.map +1 -0
  45. package/lib/types/client/MnemonSettingsCard.d.ts +9 -0
  46. package/lib/types/client/MnemonSettingsCard.d.ts.map +1 -0
  47. package/lib/types/client/MnemonSettingsCard.js +109 -0
  48. package/lib/types/client/MnemonSettingsCard.js.map +1 -0
  49. package/lib/types/client/MnemonView.d.ts +11 -0
  50. package/lib/types/client/MnemonView.d.ts.map +1 -0
  51. package/lib/types/client/MnemonView.js +1239 -0
  52. package/lib/types/client/MnemonView.js.map +1 -0
  53. package/lib/types/client/api.d.ts +68 -0
  54. package/lib/types/client/api.d.ts.map +1 -0
  55. package/lib/types/client/api.js +80 -0
  56. package/lib/types/client/api.js.map +1 -0
  57. package/lib/types/client/index.d.ts +4 -0
  58. package/lib/types/client/index.d.ts.map +1 -0
  59. package/lib/types/client/index.js +36 -0
  60. package/lib/types/client/index.js.map +1 -0
  61. package/lib/types/client/locales.d.ts +1054 -0
  62. package/lib/types/client/locales.d.ts.map +1 -0
  63. package/lib/types/client/locales.js +1062 -0
  64. package/lib/types/client/locales.js.map +1 -0
  65. package/lib/types/client/settings.d.ts +17 -0
  66. package/lib/types/client/settings.d.ts.map +1 -0
  67. package/lib/types/client/settings.js +49 -0
  68. package/lib/types/client/settings.js.map +1 -0
  69. package/lib/types/commands.d.ts +6 -0
  70. package/lib/types/commands.d.ts.map +1 -0
  71. package/lib/types/commands.js +100 -0
  72. package/lib/types/commands.js.map +1 -0
  73. package/lib/types/config-values.d.ts +4 -0
  74. package/lib/types/config-values.d.ts.map +1 -0
  75. package/lib/types/config-values.js +4 -0
  76. package/lib/types/config-values.js.map +1 -0
  77. package/lib/types/config.d.ts +49 -0
  78. package/lib/types/config.d.ts.map +1 -0
  79. package/lib/types/config.js +55 -0
  80. package/lib/types/config.js.map +1 -0
  81. package/lib/types/contracts.d.ts +272 -0
  82. package/lib/types/contracts.d.ts.map +1 -0
  83. package/lib/types/contracts.js +2 -0
  84. package/lib/types/contracts.js.map +1 -0
  85. package/lib/types/documents.d.ts +149 -0
  86. package/lib/types/documents.d.ts.map +1 -0
  87. package/lib/types/documents.js +503 -0
  88. package/lib/types/documents.js.map +1 -0
  89. package/lib/types/guidance.d.ts +9 -0
  90. package/lib/types/guidance.d.ts.map +1 -0
  91. package/lib/types/guidance.js +18 -0
  92. package/lib/types/guidance.js.map +1 -0
  93. package/lib/types/index.d.ts +15 -0
  94. package/lib/types/index.d.ts.map +1 -0
  95. package/lib/types/index.js +45 -0
  96. package/lib/types/index.js.map +1 -0
  97. package/lib/types/lifecycle.d.ts +75 -0
  98. package/lib/types/lifecycle.d.ts.map +1 -0
  99. package/lib/types/lifecycle.js +380 -0
  100. package/lib/types/lifecycle.js.map +1 -0
  101. package/lib/types/memory-bodies.d.ts +47 -0
  102. package/lib/types/memory-bodies.d.ts.map +1 -0
  103. package/lib/types/memory-bodies.js +160 -0
  104. package/lib/types/memory-bodies.js.map +1 -0
  105. package/lib/types/process.d.ts +14 -0
  106. package/lib/types/process.d.ts.map +1 -0
  107. package/lib/types/process.js +65 -0
  108. package/lib/types/process.js.map +1 -0
  109. package/lib/types/review-activity.d.ts +33 -0
  110. package/lib/types/review-activity.d.ts.map +1 -0
  111. package/lib/types/review-activity.js +37 -0
  112. package/lib/types/review-activity.js.map +1 -0
  113. package/lib/types/rpc.d.ts +12 -0
  114. package/lib/types/rpc.d.ts.map +1 -0
  115. package/lib/types/rpc.js +225 -0
  116. package/lib/types/rpc.js.map +1 -0
  117. package/lib/types/runner.d.ts +29 -0
  118. package/lib/types/runner.d.ts.map +1 -0
  119. package/lib/types/runner.js +150 -0
  120. package/lib/types/runner.js.map +1 -0
  121. package/lib/types/runtime-memory.d.ts +104 -0
  122. package/lib/types/runtime-memory.d.ts.map +1 -0
  123. package/lib/types/runtime-memory.js +415 -0
  124. package/lib/types/runtime-memory.js.map +1 -0
  125. package/lib/types/service.d.ts +173 -0
  126. package/lib/types/service.d.ts.map +1 -0
  127. package/lib/types/service.js +508 -0
  128. package/lib/types/service.js.map +1 -0
  129. package/lib/types/settings.d.ts +6 -0
  130. package/lib/types/settings.d.ts.map +1 -0
  131. package/lib/types/settings.js +75 -0
  132. package/lib/types/settings.js.map +1 -0
  133. package/lib/types/storage-scope.d.ts +39 -0
  134. package/lib/types/storage-scope.d.ts.map +1 -0
  135. package/lib/types/storage-scope.js +179 -0
  136. package/lib/types/storage-scope.js.map +1 -0
  137. package/lib/types/subagent.d.ts +97 -0
  138. package/lib/types/subagent.d.ts.map +1 -0
  139. package/lib/types/subagent.js +619 -0
  140. package/lib/types/subagent.js.map +1 -0
  141. package/lib/types/tools.d.ts +8 -0
  142. package/lib/types/tools.d.ts.map +1 -0
  143. package/lib/types/tools.js +328 -0
  144. package/lib/types/tools.js.map +1 -0
  145. package/package.json +111 -0
@@ -0,0 +1,147 @@
1
+ # Getting Started
2
+
3
+ [简体中文](../zh-CN/getting-started.md) | **English** | [Documentation Center](./README.md)
4
+
5
+ ## 1. Prerequisites
6
+
7
+ You need:
8
+
9
+ - a DSH Web profile that can start successfully;
10
+ - a locally executable `mnemon` CLI;
11
+ - a DSH subagent provider available for bounded subtasks.
12
+
13
+ The exact provider requirements are:
14
+
15
+ ```text
16
+ regular semantic operations
17
+ -> prefer provider named "spawn"
18
+ -> may fall back to another compatible provider
19
+
20
+ scored background review
21
+ -> requires provider named "fork"
22
+ -> inheritsParentContext = true
23
+
24
+ both paths require
25
+ -> outputSchema
26
+ -> toolFilter
27
+ -> persona
28
+ -> depthLimit
29
+ ```
30
+
31
+ The plugin does not declare a fixed minimum-version matrix for DSH and Mnemon in its code. Before upgrading, run the verification steps on this page against an isolated data directory.
32
+
33
+ ## 2. Install Mnemon
34
+
35
+ On macOS, the recommended installation method is Homebrew Cask:
36
+
37
+ ```sh
38
+ brew install --cask mnemon-dev/tap/mnemon
39
+ ```
40
+
41
+ On macOS or Linux, you can also install it with Go:
42
+
43
+ ```sh
44
+ go install github.com/mnemon-dev/mnemon@latest
45
+ ```
46
+
47
+ Verify the binary:
48
+
49
+ ```sh
50
+ mnemon --version
51
+ ```
52
+
53
+ To inspect an upstream Store directly, you can also run `mnemon status`. This command opens the effective Store and may initialize default data or run migrations; do not treat it as a completely side-effect-free installation probe.
54
+
55
+ If DSH cannot find it on `PATH`, set `MNEMON_CLI_PATH` or configure an absolute path in `mnemon.cliPath`.
56
+
57
+ ## 3. Install the Plugin
58
+
59
+ Install it into the Web profile:
60
+
61
+ ```sh
62
+ dsh plugin --profile web add dsh-mnemon
63
+ ```
64
+
65
+ Pre-release builds not yet published to npm can be installed from git:
66
+
67
+ ```sh
68
+ dsh plugin --profile web add "github:omdsh-dev/dsh-mnemon"
69
+ ```
70
+
71
+ For a local development checkout:
72
+
73
+ ```sh
74
+ dsh plugin --profile web add "link:/absolute/path/to/dsh-mnemon"
75
+ ```
76
+
77
+ The plugin package's `cordis.patch.yml` mounts the Host plugin; the Web client bundle registers the session workspace and plugin settings card.
78
+
79
+ ## 4. Choose a Storage Scope
80
+
81
+ Start the DSH Web profile:
82
+
83
+ ```sh
84
+ dsh --profile web
85
+ ```
86
+
87
+ Under “Settings -> Plugin Configuration -> Mnemon,” choose:
88
+
89
+ | Scope | Root directory | Best suited for |
90
+ |---|---|---|
91
+ | `global` | `MNEMON_DATA_DIR` or `~/.mnemon` | Sharing one memory set across multiple workspaces |
92
+ | `workspace` | `.mnemon` under the DSH Host startup directory | Project isolation |
93
+ | `custom` | `dataDir` | An explicit disk, mounted volume, or dedicated data directory |
94
+
95
+ Settings are written to `$DSH_HOME/settings.yaml` and take effect after restarting DSH. Switching scopes does not move existing data; to preserve it, stop all writes first and manually copy the entire old root directory.
96
+
97
+ ## 5. Create Your First Memory Space
98
+
99
+ Open the “Memory System” tab in any session:
100
+
101
+ 1. Open the “Memory Spaces” page.
102
+ 2. Create a narrowly scoped Memory Space, such as “Project Decisions.”
103
+ 3. Its description should explain what belongs there and which tasks should recall it.
104
+ 4. Enable its read toggle, or let the plugin activate it automatically after the first write.
105
+
106
+ An empty Memory Space may remain inactive by default. Activation controls only the read scope; writes may target any registered Memory Space, and a successful write automatically activates the target.
107
+
108
+ ## 6. Verify the Complete Path
109
+
110
+ First inspect deterministic status:
111
+
112
+ ```text
113
+ /mnemon status
114
+ ```
115
+
116
+ Then submit a stable, self-contained item that will remain useful in the future on the “Distill” page. The worker selects a Memory Space, checks for duplicates, and returns a structured receipt. Then verify recall:
117
+
118
+ ```text
119
+ /mnemon recall <a focused query that should match the new item>
120
+ ```
121
+
122
+ Finally, check that:
123
+
124
+ - the “Memory Spaces” page shows the active Memory Space and graph;
125
+ - “Content” shows the new item and its Memory Space;
126
+ - CLI, runtime memory, Memory Space catalog, and subagent status are all healthy under “Status”;
127
+ - the recall result includes a complete `memoryBodyId` and memory ID.
128
+
129
+ ## 7. Recommended First Real Conversation
130
+
131
+ Choose a question that genuinely depends on a historical decision instead of instructing the model to invoke memory tools unconditionally. The expected flow is:
132
+
133
+ ```text
134
+ user asks a history-dependent question
135
+ -> pre-step adds a short optional cue
136
+ -> main Agent decides whether history matters
137
+ -> recall worker selects active Memory Spaces
138
+ -> only useful evidence returns to the main Agent
139
+ ```
140
+
141
+ Ordinary conversation should not force recall. The current request, existing source files, and live tool results should take precedence over historical content.
142
+
143
+ ## 8. Next Steps
144
+
145
+ - Read the [storage model](./storage-model.md) before choosing `storageScope`.
146
+ - Read the [configuration reference](./configuration.md) to configure read-only mode or disable lifecycle cues.
147
+ - Read the [operations guide](./operations.md) to establish backup and pre-upgrade verification procedures.
@@ -0,0 +1,159 @@
1
+ # WebUI, Tools, Commands, and RPC
2
+
3
+ [简体中文](../zh-CN/interfaces.md) | **English** | [Documentation Center](./README.md)
4
+
5
+ ## Web Workspace
6
+
7
+ The main Web interface follows DSH's global language and light/dark theme. The top navigation is split into three divider-separated groups: “Status” stands alone; “Runtime, Memory Spaces, Documents” cover the three storage tiers; “Distill, Recall, Entities, Content” are the read/write tools. The “Status” page opens by default.
8
+
9
+ | Page | Purpose | Call Boundary |
10
+ |---|---|---|
11
+ | Status | Diagnostics for the CLI, runtime hot memory, storage scope, Memory Spaces, Documents, lifecycle, and workers | Aggregated reads |
12
+ | Runtime | Inspect and maintain USER / MEMORY hot memory and capacity | Regular mutations are deterministic; capacity maintenance may start a worker |
13
+ | Memory Spaces | Memory Space directory, activation switches and metadata editing, a live multi-space graph, and node inspection | Deterministic RPC reads; switches and metadata edits use write RPC |
14
+ | Documents | Search, read, create, update, and archive Documents | Search/edit operations use the control layer; archiving starts a worker |
15
+ | Distill | Let a memory worker select scope, deduplicate, and write; supports advanced constraints | `spawn` semantic write |
16
+ | Recall | Direct smart / keyword / basic retrieval; optional evidence-bounded Agent answers | Direct service reads; Agent answers use a worker with no tools |
17
+ | Entities | Frequent entities and entity-related context | Direct service reads |
18
+ | Content | Browse active Memory Spaces without recall side effects, copy or clone content, or soft-delete it | Graph reads; deletion uses a worker |
19
+
20
+ The graph synchronizes every 15 seconds and can also be refreshed manually. Natural layout, uniform reset, dragging, and keyboard adjustments affect only client-side presentation and do not modify Mnemon data.
21
+
22
+ ## Model Tools
23
+
24
+ ### Read-Only Tools
25
+
26
+ | Tool | Purpose | Root Agent Path |
27
+ |---|---|---|
28
+ | `mnemon_memory_bodies` | Read the Memory Space directory and statistics | Direct service |
29
+ | `mnemon_recall` | Recall from one or more active spaces | `spawn` recall worker |
30
+ | `mnemon_related` | Traverse relationships from a known ID | `spawn` related worker; the root path always requests two hops |
31
+ | `mnemon_status` | Aggregate CLI, configuration, and active-space status | Direct service |
32
+ | `mnemon_document_search` | Deterministically search managed Documents | Direct Documents control layer |
33
+
34
+ Here, “read-only” means that managed bodies and long-term semantic content are not modified. After a hit, `mnemon_document_search` still updates `lastAccessedAt` and rewrites the Document index for LRU ordering.
35
+
36
+ ### Tools Available When `writeEnabled=true`
37
+
38
+ | Tool | Purpose | Root Agent Path |
39
+ |---|---|---|
40
+ | `mnemon_runtime_memory` | `add` / `replace` / `remove` hot memory | Deterministic control layer; a worker is used when add overflows |
41
+ | `mnemon_document_manage` | Create, update, or archive a Document | Create/update are deterministic; archive uses a worker |
42
+ | `mnemon_remember` | Distill one insight into long-term memory | `spawn` write worker |
43
+ | `mnemon_link` | Create a typed relationship | `spawn` write worker |
44
+ | `mnemon_forget` | Soft-delete by exact ID | `spawn` write worker |
45
+ | `mnemon_memory_body_create` | Create an independent Memory Space | `spawn` write worker |
46
+ | `mnemon_memory_body_update` | Update name, description, or active state | `spawn` write worker |
47
+ | `mnemon_memory_body_merge` | Perform a non-destructive import merge | `spawn` write worker |
48
+
49
+ When a worker calls a tool with the same name, the call goes directly to the service layer and is not delegated again.
50
+
51
+ ## Tool Admission Guidelines
52
+
53
+ - Hot memory: explicit user preferences, stable project conventions, environment facts, and frequently useful lessons.
54
+ - Document: designs, investigations, procedures, or handoffs with complete structure and rationale.
55
+ - Long-term Memory Space: stable insights that explicitly need to persist across tasks or benefit from graph relationships and deep recall.
56
+ - Skip: questions, guesses, temporary progress, completion logs, raw output, secrets, and repository facts that are easy to rediscover.
57
+
58
+ `mnemon_forget` is a destructive semantic operation. It should run only when the user explicitly requests it or when content has been verified as incorrect or obsolete.
59
+
60
+ ## `/mnemon` Commands
61
+
62
+ ```text
63
+ /mnemon
64
+ /mnemon status
65
+ /mnemon recall <query>
66
+ /mnemon related <full memory ID>
67
+ /mnemon remember <content>
68
+ /mnemon forget <exact ID>
69
+ ```
70
+
71
+ - An empty `/mnemon` is equivalent to `status`.
72
+ - `status` is a deterministic read and does not start a model.
73
+ - `recall`, `related`, `remember`, and `forget` use the live Agent containing the command as the worker parent.
74
+ - Command recall returns at most 10 results.
75
+ - The `forget` argument must be one exact ID containing no spaces.
76
+ - Current command help and results are primarily in Chinese and do not yet follow the Web locale.
77
+
78
+ ## RPC Channels
79
+
80
+ RPC is the internal bridge between the DSH Host and this plugin's Web client. It is not a promised stable external HTTP API.
81
+
82
+ ### Read Channel
83
+
84
+ ```text
85
+ channel: /dsh-mnemon-read
86
+ authority: trusted-host
87
+ ```
88
+
89
+ | Endpoint | Behavior |
90
+ |---|---|
91
+ | `runtime-memory` | Runtime snapshot |
92
+ | `status` | Aggregated service, lifecycle, Documents, and storage-scope status |
93
+ | `documents` | Document directory snapshot |
94
+ | `document` | Read one Document |
95
+ | `document-search` | Deterministic search; hits update LRU metadata |
96
+ | `graph` | Aggregated graph of active Memory Spaces |
97
+ | `bodies` | Memory Space directory |
98
+ | `list` | Content list |
99
+ | `entities` | Entity statistics or entity-related context |
100
+ | `search` | Direct Mnemon retrieval |
101
+ | `agent-search` | Evidence-bounded answer after direct retrieval |
102
+ | `related` | Direct relationship traversal |
103
+
104
+ ### Write Channel
105
+
106
+ ```text
107
+ channel: /dsh-mnemon-write
108
+ authority: loopback
109
+ ```
110
+
111
+ | Endpoint | Behavior |
112
+ |---|---|
113
+ | `runtime-memory` | Hot-memory mutation |
114
+ | `supervise` | Submit a Tab candidate to a memory worker |
115
+ | `document` | create / update / archive |
116
+ | `remember` | Semantic write with optional advanced constraints |
117
+ | `link` | Create a relationship |
118
+ | `forget` | Soft-delete |
119
+ | `body-create` | Create a Memory Space |
120
+ | `body-update` | Update metadata or active state |
121
+
122
+ The entire write channel is not registered when `writeEnabled=false`.
123
+
124
+ ### Settings Channel
125
+
126
+ ```text
127
+ channel: /dsh-mnemon-settings
128
+ authority: loopback
129
+ endpoints: get, mutate
130
+ ```
131
+
132
+ Mutations use the settings revision to prevent overwriting concurrent edits.
133
+
134
+ ## npm Exports
135
+
136
+ The root package exposes Host-side composition and core classes:
137
+
138
+ ```text
139
+ apply
140
+ Config / resolveConfig
141
+ createRunner
142
+ MnemonService
143
+ RuntimeMemoryController
144
+ DocumentManager
145
+ StorageScopeInspector
146
+ MnemonSubagentCoordinator
147
+ MnemonLifecycle
148
+ ```
149
+
150
+ `dsh-mnemon/client` provides `apply` and `inject` for the DSH client bundle. `MnemonClient` and the RPC endpoints are currently internal implementations and should not be treated as a stable public SDK.
151
+
152
+ ## Internationalization Scope
153
+
154
+ The Web dictionaries keep Chinese and English keys in one-to-one correspondence. Brand names, tool names, and configuration keys are not translated. Surfaces that are not yet fully internationalized include:
155
+
156
+ - `/mnemon` command output;
157
+ - model-tool card titles;
158
+ - some Host validation and diagnostic errors;
159
+ - default names and descriptions written during legacy Store compatibility discovery.
@@ -0,0 +1,151 @@
1
+ # Operations, Security, and Troubleshooting
2
+
3
+ [简体中文](../zh-CN/operations.md) | **English** | [Documentation Center](./README.md)
4
+
5
+ ## Health Checks
6
+
7
+ Check the binary first, then the plugin's aggregated status:
8
+
9
+ ```sh
10
+ command -v mnemon
11
+ mnemon --version
12
+ ```
13
+
14
+ ```text
15
+ /mnemon status
16
+ ```
17
+
18
+ `mnemon status` opens the effective Store, so the upstream CLI may initialize default data or run migrations. It is not a completely side-effect-free read probe. The plugin's Status page also checks active Memory Spaces, Documents, lifecycle state, and subagent counts.
19
+
20
+ ## Security Boundaries
21
+
22
+ ### Process
23
+
24
+ - `spawn(command, args, { shell: false })`; shell commands are never concatenated.
25
+ - stdout + stderr have a combined default limit of 2 MiB.
26
+ - Every CLI call is governed by `timeoutMs` and an AbortSignal.
27
+ - On timeout or cancellation, the process first receives `SIGTERM`, then `SIGKILL` if it has not exited after 1.5 seconds.
28
+ - CLI calls within one `MnemonRunner` are serialized to avoid SQLite lock conflicts from concurrent migrations in the same process.
29
+
30
+ The serial queue does not replace coordination across DSH processes. When multiple Hosts access the same Mnemon Store concurrently, they still rely on Mnemon/SQLite's own concurrency semantics.
31
+
32
+ ### Files
33
+
34
+ - Runtime and Documents both use an in-process queue and a cross-instance lock file.
35
+ - Lock acquisition waits up to 5 seconds by default; a lock is considered stale only after 30 seconds.
36
+ - Writes use temporary files and rename.
37
+ - Runtime uses a revision to prevent stale compaction from overwriting concurrent changes.
38
+ - Document archiving uses a numeric revision to prevent moving active source text that has since been updated.
39
+ - `sourcePaths` cannot escape the initiating session's workspace or point into the managed Documents directory.
40
+
41
+ ### Web
42
+
43
+ - Read RPC: `trusted-host`.
44
+ - Memory write RPC: `loopback`.
45
+ - Settings RPC: `loopback`.
46
+ - The WebUI neither reads SQLite directly nor starts processes.
47
+
48
+ ### Model
49
+
50
+ - Workers use a persona, a tool allowlist, structured output, and `maxDepth: 1`.
51
+ - User queries, candidate content, Document bodies, and historical memories are all treated as untrusted data.
52
+ - The evidence-answer worker has no Mnemon tools and can use only the hits supplied by the Host.
53
+
54
+ These boundaries are not a secret scanner. There is currently no deterministic credential/secret detection. Do not submit keys, tokens, private keys, or raw sensitive logs to hot memory, Documents, or Memory Spaces.
55
+
56
+ ## Backup
57
+
58
+ All three tiers share `storageRoot`. A consistent backup should cover the entire root, not just `mnemon.db`:
59
+
60
+ ```text
61
+ <storageRoot>/runtime
62
+ <storageRoot>/documents
63
+ <storageRoot>/data
64
+ <storageRoot>/state # when present
65
+ ```
66
+
67
+ Recommended procedure:
68
+
69
+ 1. Stop the DSH Host and any other process writing to the same root.
70
+ 2. Record the current plugin, DSH, and `mnemon --version` versions.
71
+ 3. Copy the entire root to a new timestamped directory.
72
+ 4. Generate a file inventory or checksums for the backup.
73
+ 5. Complete a recovery rehearsal in an isolated path before relying on the backup.
74
+
75
+ The project currently has no built-in consistent snapshot, export, or recovery command. Copying while the system is running may capture an inconsistent state across files.
76
+
77
+ ## Recovery
78
+
79
+ 1. Stop every DSH/Mnemon process using the target root.
80
+ 2. Preserve a second copy of the existing root; do not overwrite the only copy of the data.
81
+ 3. Restore the complete backup to a new directory.
82
+ 4. First point `storageScope=custom` at the new directory.
83
+ 5. Start the system and inspect the Runtime projections, Document index, Memory Space directory, and recall.
84
+ 6. After verification, decide whether to replace the original root.
85
+
86
+ If `USER.md` / `MEMORY.md` is damaged, the control layer can repair it from a valid `memories.json`. There is no general automatic repair flow for damaged JSON, the Document index, or SQLite.
87
+
88
+ ## Changing Storage Scope
89
+
90
+ The plugin does not migrate data automatically:
91
+
92
+ ```text
93
+ old scope -- change setting + restart --> new empty or existing scope
94
+
95
+ no implicit copy
96
+ no implicit merge
97
+ no implicit delete
98
+ ```
99
+
100
+ When migration is required, stop writes and copy the complete root. Two roots cannot be merged by overwriting directories because JSON indexes, the registry, and multiple databases may conflict. Design an explicit merge procedure against backups instead.
101
+
102
+ ## Troubleshooting
103
+
104
+ | Symptom | Check and Resolution |
105
+ |---|---|
106
+ | Mnemon is unavailable | Run `command -v mnemon` and `mnemon --version`; set `MNEMON_CLI_PATH` or `cliPath`, then restart |
107
+ | Status is healthy but recall is empty | Check that a Memory Space is active, inspect the current `storageScope` and DSH launch cwd, and make sure the query is focused enough |
108
+ | `memoryBodyId is required...` | The active count is not exactly 1; have the worker or caller select a target explicitly |
109
+ | `memory body is not active for reading` | Activate the target in Overview; writing to an inactive space is allowed, but reading is not |
110
+ | Subagent provider error | Regular tasks require the full isolation capabilities; background review additionally requires `fork + inheritsParentContext` |
111
+ | Settings have no effect after saving | All options take effect after restart |
112
+ | Custom directory is rejected | Use an absolute path, `~`, or `~/...` |
113
+ | Document has no workspace | The session must correspond to a live root Agent and include cwd in its session header |
114
+ | Source path is rejected | The path must stay within the session workspace and must not reference the managed Documents directory |
115
+ | Runtime replace exceeds capacity | Shorten the replacement or organize it explicitly first; current automatic maintenance handles only add overflow |
116
+ | CLI timeout | Increase `timeoutMs`; status and graph exports for large Stores may take longer than 10 seconds |
117
+ | Lock timeout | Check whether another instance is writing; do not delete a lock that still belongs to a live process |
118
+ | Invalid JSON / unexpected viz | The CLI output protocol may be incompatible; validate the version against an isolated root and do not continue writing production data |
119
+ | A remote page can read but not write | Write RPC enforces loopback by design |
120
+ | `tabEnabled=false` still shows the Tab | The setting currently stops only Host data RPC and does not remove the client slot |
121
+ | Local link does not reflect source | Run `pnpm run build`, then restart the DSH profile |
122
+
123
+ ## Known Limitations
124
+
125
+ ### Feature Read-Only Is Not Disk Read-Only
126
+
127
+ `writeEnabled=false` disables semantic mutations, but startup may still create or repair Runtime files, Document search updates `lastAccessedAt`, and Mnemon reads may trigger upstream migrations. Do not assume it can operate without writes on a genuinely read-only filesystem.
128
+
129
+ ### Shared Scope of Documents
130
+
131
+ `global` and `custom` may cause multiple workspaces to share one Document index; records do not have a separate workspace-ownership field. `sourcePaths` are validated against the initiating session's cwd only when written.
132
+
133
+ ### Cold-Reference Paths
134
+
135
+ The current archive-worker prompt uses `.mnemon/documents/archived/<filename>` as its planned reference. Under global/custom scope, the actual file is at `<storageRoot>/documents/archived/<filename>`. When locating the original, use `documents/index.json` or the `relativePath` shown in the UI as the source of truth. This path-expression difference remains to be fixed.
136
+
137
+ ### Cross-System Transactions
138
+
139
+ “Index first, move second” protects the active source text but is not a rollback-capable distributed transaction across Mnemon SQLite and the filesystem. If a revision conflict occurs after indexing succeeds, the index may retain a duplicate reference; the plugin chooses to preserve data instead of rolling back a completed long-term write.
140
+
141
+ ### Background Watermarks
142
+
143
+ Scores, the latest checkpoint, and retry state are not persisted. Restarting the Host clears activity that has not yet been processed. Failure backoff, circuit breaking, and a manual retry entry point are not yet implemented either.
144
+
145
+ ### Version Matrix
146
+
147
+ The project does not yet declare a formal DSH/Mnemon support matrix or schema-migration policy. Back up first and validate against an isolated root before upgrading.
148
+
149
+ ### Internationalization
150
+
151
+ The main Web workspace is bilingual in Chinese and English, but commands, tool cards, compatibility default metadata, and some error messages are not yet fully internationalized.