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.
- package/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/lib/client.js +353 -347
- package/lib/index.js +129 -46
- package/lib/types/activity.d.ts +2 -18
- package/lib/types/channels.d.ts +1 -4
- package/lib/types/client/MnemonLogo.d.ts +0 -1
- package/lib/types/client/MnemonPackSection.d.ts +1 -2
- package/lib/types/client/MnemonSaveAction.d.ts +1 -2
- package/lib/types/client/MnemonSettingsCard.d.ts +1 -3
- package/lib/types/client/MnemonTurnTail.d.ts +1 -2
- package/lib/types/client/MnemonView.d.ts +1 -3
- package/lib/types/client/MnemonViewAppearance.d.ts +0 -1
- package/lib/types/client/anchor.d.ts +0 -1
- package/lib/types/client/api.d.ts +1 -9
- package/lib/types/client/dsh-compat.d.ts +0 -1
- package/lib/types/client/index.d.ts +0 -1
- package/lib/types/client/locales.d.ts +4 -1
- package/lib/types/client/settings.d.ts +1 -2
- package/lib/types/client/sidebar-entry.d.ts +0 -1
- package/lib/types/client/workspace-controller.d.ts +0 -1
- package/lib/types/client/workspace-mount.d.ts +1 -3
- package/lib/types/commands.d.ts +0 -1
- package/lib/types/config-values.d.ts +0 -1
- package/lib/types/config.d.ts +6 -80
- package/lib/types/contracts.d.ts +2 -60
- package/lib/types/documents.d.ts +2 -79
- package/lib/types/guidance.d.ts +0 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/lifecycle.d.ts +3 -45
- package/lib/types/live-runtime.d.ts +0 -1
- package/lib/types/memory-bodies.d.ts +3 -20
- package/lib/types/pack.d.ts +2 -48
- package/lib/types/process.d.ts +0 -1
- package/lib/types/review-activity.d.ts +2 -16
- package/lib/types/rpc.d.ts +0 -1
- package/lib/types/runner.d.ts +15 -11
- package/lib/types/runtime-memory.d.ts +2 -59
- package/lib/types/service.d.ts +3 -149
- package/lib/types/settings.d.ts +1 -4
- package/lib/types/shared/contracts.d.ts +609 -0
- package/lib/types/storage-scope.d.ts +2 -29
- package/lib/types/subagent.d.ts +2 -15
- package/lib/types/tools.d.ts +0 -1
- package/lib/types/version-updates.d.ts +2 -29
- package/package.json +8 -7
- package/docs/README.md +0 -8
- package/docs/assets/diagrams/en/memory-system-flow.png +0 -0
- package/docs/assets/diagrams/en/project-architecture.svg +0 -182
- package/docs/assets/diagrams/zh-CN/memory-system-flow.png +0 -0
- package/docs/assets/diagrams/zh-CN/project-architecture.svg +0 -182
- package/docs/assets/media/dsh-mnemon-memory-system-demo-poster.jpg +0 -0
- package/docs/assets/media/dsh-mnemon-memory-system-demo.gif +0 -0
- package/docs/assets/media/dsh-mnemon-memory-system-demo.mp4 +0 -0
- package/docs/assets/screenshots/conversation-memory-jump.png +0 -0
- package/docs/assets/screenshots/conversation-save-dialog.png +0 -0
- package/docs/assets/screenshots/conversation-turn-memory.png +0 -0
- package/docs/assets/screenshots/document-create-dialog.png +0 -0
- package/docs/assets/screenshots/documents-markdown.png +0 -0
- package/docs/assets/screenshots/entities-context.png +0 -0
- package/docs/assets/screenshots/memory-content.png +0 -0
- package/docs/assets/screenshots/overview-memory-graph.png +0 -0
- package/docs/assets/screenshots/recall-agent-answer.png +0 -0
- package/docs/assets/screenshots/remember-dialog.png +0 -0
- package/docs/assets/screenshots/runtime-memory-add.png +0 -0
- package/docs/assets/screenshots/runtime-memory.png +0 -0
- package/docs/assets/screenshots/settings-memory-system.png +0 -0
- package/docs/assets/screenshots/status-overview.png +0 -0
- package/docs/assets/screenshots/version-check.png +0 -0
- package/docs/en/README.md +0 -48
- package/docs/en/architecture.md +0 -133
- package/docs/en/configuration.md +0 -234
- package/docs/en/development.md +0 -198
- package/docs/en/getting-started.md +0 -199
- package/docs/en/interfaces.md +0 -181
- package/docs/en/operations.md +0 -173
- package/docs/en/project-overview.md +0 -145
- package/docs/en/roadmap.md +0 -41
- package/docs/en/storage-model.md +0 -185
- package/docs/en/ui-guide.md +0 -156
- package/docs/en/workflows.md +0 -290
- package/docs/zh-CN/README.md +0 -48
- package/docs/zh-CN/architecture.md +0 -133
- package/docs/zh-CN/configuration.md +0 -234
- package/docs/zh-CN/development.md +0 -198
- package/docs/zh-CN/getting-started.md +0 -199
- package/docs/zh-CN/interfaces.md +0 -181
- package/docs/zh-CN/operations.md +0 -173
- package/docs/zh-CN/project-overview.md +0 -145
- package/docs/zh-CN/roadmap.md +0 -41
- package/docs/zh-CN/storage-model.md +0 -185
- package/docs/zh-CN/ui-guide.md +0 -160
- package/docs/zh-CN/workflows.md +0 -290
- package/lib/client.js.map +0 -1
- package/lib/types/activity.d.ts.map +0 -1
- package/lib/types/activity.js +0 -93
- package/lib/types/activity.js.map +0 -1
- package/lib/types/channels.d.ts.map +0 -1
- package/lib/types/channels.js +0 -4
- package/lib/types/channels.js.map +0 -1
- package/lib/types/client/MnemonLogo.d.ts.map +0 -1
- package/lib/types/client/MnemonLogo.js +0 -6
- package/lib/types/client/MnemonLogo.js.map +0 -1
- package/lib/types/client/MnemonPackSection.d.ts.map +0 -1
- package/lib/types/client/MnemonPackSection.js +0 -136
- package/lib/types/client/MnemonPackSection.js.map +0 -1
- package/lib/types/client/MnemonSaveAction.d.ts.map +0 -1
- package/lib/types/client/MnemonSaveAction.js +0 -90
- package/lib/types/client/MnemonSaveAction.js.map +0 -1
- package/lib/types/client/MnemonSettingsCard.d.ts.map +0 -1
- package/lib/types/client/MnemonSettingsCard.js +0 -155
- package/lib/types/client/MnemonSettingsCard.js.map +0 -1
- package/lib/types/client/MnemonTurnTail.d.ts.map +0 -1
- package/lib/types/client/MnemonTurnTail.js +0 -56
- package/lib/types/client/MnemonTurnTail.js.map +0 -1
- package/lib/types/client/MnemonView.d.ts.map +0 -1
- package/lib/types/client/MnemonView.js +0 -1594
- package/lib/types/client/MnemonView.js.map +0 -1
- package/lib/types/client/MnemonViewAppearance.d.ts.map +0 -1
- package/lib/types/client/MnemonViewAppearance.js +0 -67
- package/lib/types/client/MnemonViewAppearance.js.map +0 -1
- package/lib/types/client/anchor.d.ts.map +0 -1
- package/lib/types/client/anchor.js +0 -46
- package/lib/types/client/anchor.js.map +0 -1
- package/lib/types/client/api.d.ts.map +0 -1
- package/lib/types/client/api.js +0 -150
- package/lib/types/client/api.js.map +0 -1
- package/lib/types/client/dsh-compat.d.ts.map +0 -1
- package/lib/types/client/dsh-compat.js +0 -2
- package/lib/types/client/dsh-compat.js.map +0 -1
- package/lib/types/client/index.d.ts.map +0 -1
- package/lib/types/client/index.js +0 -161
- package/lib/types/client/index.js.map +0 -1
- package/lib/types/client/locales.d.ts.map +0 -1
- package/lib/types/client/locales.js +0 -1172
- package/lib/types/client/locales.js.map +0 -1
- package/lib/types/client/settings.d.ts.map +0 -1
- package/lib/types/client/settings.js +0 -70
- package/lib/types/client/settings.js.map +0 -1
- package/lib/types/client/sidebar-entry.d.ts.map +0 -1
- package/lib/types/client/sidebar-entry.js +0 -134
- package/lib/types/client/sidebar-entry.js.map +0 -1
- package/lib/types/client/workspace-controller.d.ts.map +0 -1
- package/lib/types/client/workspace-controller.js +0 -21
- package/lib/types/client/workspace-controller.js.map +0 -1
- package/lib/types/client/workspace-mount.d.ts.map +0 -1
- package/lib/types/client/workspace-mount.js +0 -138
- package/lib/types/client/workspace-mount.js.map +0 -1
- package/lib/types/commands.d.ts.map +0 -1
- package/lib/types/commands.js +0 -104
- package/lib/types/commands.js.map +0 -1
- package/lib/types/config-values.d.ts.map +0 -1
- package/lib/types/config-values.js +0 -4
- package/lib/types/config-values.js.map +0 -1
- package/lib/types/config.d.ts.map +0 -1
- package/lib/types/config.js +0 -127
- package/lib/types/config.js.map +0 -1
- package/lib/types/contracts.d.ts.map +0 -1
- package/lib/types/contracts.js +0 -2
- package/lib/types/contracts.js.map +0 -1
- package/lib/types/documents.d.ts.map +0 -1
- package/lib/types/documents.js +0 -495
- package/lib/types/documents.js.map +0 -1
- package/lib/types/guidance.d.ts.map +0 -1
- package/lib/types/guidance.js +0 -34
- package/lib/types/guidance.js.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/index.js +0 -55
- package/lib/types/index.js.map +0 -1
- package/lib/types/lifecycle.d.ts.map +0 -1
- package/lib/types/lifecycle.js +0 -456
- package/lib/types/lifecycle.js.map +0 -1
- package/lib/types/live-runtime.d.ts.map +0 -1
- package/lib/types/live-runtime.js +0 -146
- package/lib/types/live-runtime.js.map +0 -1
- package/lib/types/memory-bodies.d.ts.map +0 -1
- package/lib/types/memory-bodies.js +0 -186
- package/lib/types/memory-bodies.js.map +0 -1
- package/lib/types/pack.d.ts.map +0 -1
- package/lib/types/pack.js +0 -709
- package/lib/types/pack.js.map +0 -1
- package/lib/types/process.d.ts.map +0 -1
- package/lib/types/process.js +0 -65
- package/lib/types/process.js.map +0 -1
- package/lib/types/review-activity.d.ts.map +0 -1
- package/lib/types/review-activity.js +0 -37
- package/lib/types/review-activity.js.map +0 -1
- package/lib/types/rpc.d.ts.map +0 -1
- package/lib/types/rpc.js +0 -384
- package/lib/types/rpc.js.map +0 -1
- package/lib/types/runner.d.ts.map +0 -1
- package/lib/types/runner.js +0 -198
- package/lib/types/runner.js.map +0 -1
- package/lib/types/runtime-memory.d.ts.map +0 -1
- package/lib/types/runtime-memory.js +0 -415
- package/lib/types/runtime-memory.js.map +0 -1
- package/lib/types/service.d.ts.map +0 -1
- package/lib/types/service.js +0 -512
- package/lib/types/service.js.map +0 -1
- package/lib/types/settings.d.ts.map +0 -1
- package/lib/types/settings.js +0 -103
- package/lib/types/settings.js.map +0 -1
- package/lib/types/storage-scope.d.ts.map +0 -1
- package/lib/types/storage-scope.js +0 -179
- package/lib/types/storage-scope.js.map +0 -1
- package/lib/types/subagent.d.ts.map +0 -1
- package/lib/types/subagent.js +0 -624
- package/lib/types/subagent.js.map +0 -1
- package/lib/types/tools.d.ts.map +0 -1
- package/lib/types/tools.js +0 -341
- package/lib/types/tools.js.map +0 -1
- package/lib/types/version-updates.d.ts.map +0 -1
- package/lib/types/version-updates.js +0 -383
- package/lib/types/version-updates.js.map +0 -1
package/docs/en/workflows.md
DELETED
|
@@ -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.
|
package/docs/zh-CN/README.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# dsh-mnemon 文档中心
|
|
2
|
-
|
|
3
|
-
**简体中文** | [English](../en/README.md) | [项目首页](../../README.zh-CN.md)
|
|
4
|
-
|
|
5
|
-
这里按“你现在要完成什么”组织文档。第一次使用从快速开始进入;需要理解页面时看 UI 指南;只有在部署、集成或开发时才需要进入参考文档。
|
|
6
|
-
|
|
7
|
-
## 新用户路径
|
|
8
|
-
|
|
9
|
-
1. [快速开始](./getting-started.md):安装 Mnemon 与插件,选择存储范围,完成第一次验证。
|
|
10
|
-
2. [Sidebar 与对话交互指南](./ui-guide.md):认识状态、运行时、记忆体、档案和对话内入口。
|
|
11
|
-
3. [项目介绍](./project-overview.md):理解三层模型、跨 Agent 共享边界、读写边界与完整流转。
|
|
12
|
-
|
|
13
|
-
## 按任务查找
|
|
14
|
-
|
|
15
|
-
| 我想要…… | 文档 |
|
|
16
|
-
|---|---|
|
|
17
|
-
| 决定一条信息应放在哪一层 | [存储与三层记忆模型](./storage-model.md) |
|
|
18
|
-
| 让 DSH 与其他 Mnemon-enabled Agent 共享长期记忆 | [项目介绍:跨 Agent 共享边界](./project-overview.md#跨-agent-共享边界) · [配置参考:共享范围](./configuration.md#选择跨-agent-共享范围) |
|
|
19
|
-
| 了解每轮注入、召回、沉淀和归档何时发生 | [生命周期与核心流程](./workflows.md) |
|
|
20
|
-
| 切换 Sidebar / Buildin、全局 / 工作区 / 自定义目录 | [配置参考](./configuration.md) |
|
|
21
|
-
| 理解工作区“查看目录”与 Agent“实际生效目录” | [UI 指南:工作区模式](./ui-guide.md#工作区模式查看与执行分离) |
|
|
22
|
-
| 检查或更新 Mnemon 与 dsh-mnemon | [运维指南:版本检查与更新](./operations.md#版本检查与更新) |
|
|
23
|
-
| 备份、恢复或迁移完整记忆目录 | [运维指南:备份与恢复](./operations.md#备份与恢复) |
|
|
24
|
-
| 排查召回为空、目录未对齐、CLI 或 Provider 问题 | [运维、安全与故障排查](./operations.md#故障排查) |
|
|
25
|
-
| 使用模型工具、`/mnemon` 命令或内部 RPC | [接口参考](./interfaces.md) |
|
|
26
|
-
| 理解 Host、worker、控制面与数据面 | [架构设计](./architecture.md) |
|
|
27
|
-
| 修改代码、截图、测试或发布 | [开发与验证](./development.md) |
|
|
28
|
-
| 查看下一阶段计划 | [Roadmap](./roadmap.md) |
|
|
29
|
-
|
|
30
|
-
## 核心术语
|
|
31
|
-
|
|
32
|
-
| 中文 | 英文 / 代码名 | 含义 |
|
|
33
|
-
|---|---|---|
|
|
34
|
-
| 记忆系统 | Memory System | dsh-mnemon 在 DSH 中的完整入口 |
|
|
35
|
-
| 运行时记忆 | Runtime Memory | 每轮注入的 USER / MEMORY 热记忆 |
|
|
36
|
-
| 档案 | Project Documents | 受管、可检索、保留完整 Markdown 叙事的项目知识 |
|
|
37
|
-
| 记忆体 | Memory Space | 独立、可激活、按需召回的长期 Mnemon Store |
|
|
38
|
-
| 跨 Agent 共享 | Cross-agent memory sharing | 多个 Mnemon-enabled Agent 使用同一根和 Store,共享长期记忆而非完整 DSH 上下文 |
|
|
39
|
-
| 沉淀 | Remember / Distill | 把候选交给受监督子 Agent 判断、查重与写入 |
|
|
40
|
-
| 召回 | Recall | 从已激活记忆体按需取回有界证据 |
|
|
41
|
-
| 归档 | Archive | 先建立冷引用,再把不常用档案迁出 active 层 |
|
|
42
|
-
|
|
43
|
-
## 文档边界
|
|
44
|
-
|
|
45
|
-
- 用户文档以 v0.1.5 的 Sidebar 默认体验为主,同时说明 Buildin 兼容形态。
|
|
46
|
-
- 架构图表达稳定执行边界,不是实时监控面板;实时数量与版本以“状态”页为准。
|
|
47
|
-
- RPC 是 Host 与插件客户端之间的内部协议,不承诺稳定外部 API。
|
|
48
|
-
- 当前没有正式固定的 DSH / Mnemon 版本矩阵;升级前应备份并在隔离目录验证。
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
# 架构设计
|
|
2
|
-
|
|
3
|
-
**简体中文** | [English](../en/architecture.md) | [文档中心](./README.md)
|
|
4
|
-
|
|
5
|
-
## 定位
|
|
6
|
-
|
|
7
|
-
`dsh-mnemon` 是 DSH 与 Mnemon 之间的集成和监督层,不是新的数据库引擎:
|
|
8
|
-
|
|
9
|
-
- DSH 提供主 Agent、生命周期事件、subagent provider、工具、命令、设置和 Web 扩展点;
|
|
10
|
-
- 插件提供三层知识控制面、路由策略、事务屏障和 UI;
|
|
11
|
-
- 本地 `mnemon` CLI 提供命名 Store、SQLite 持久化、四类图、召回、关系和软删除,并形成与其他 Mnemon-enabled Agent 共享长期记忆的数据边界。
|
|
12
|
-
|
|
13
|
-
## 组件图
|
|
14
|
-
|
|
15
|
-
[](../assets/diagrams/zh-CN/project-architecture.svg)
|
|
16
|
-
|
|
17
|
-
图中实线表示确定性数据或控制路径,紫色虚线表示 LLM 监督路径。Runtime Memory 和 Documents 直接使用受管文件;只有 Memory Spaces 通过 `MnemonRunner` 调用本地 Mnemon CLI。点击图片可以查看原始 SVG。
|
|
18
|
-
|
|
19
|
-
因此跨 Agent 互操作只发生在图中的 Memory Spaces:共享的是 Mnemon Store 内的长期记忆与关系,不是 DSH 的会话上下文、Runtime 投影或 Documents 控制面。插件不会把数据主动推送到其他 Agent;参与方通过对齐本地 Mnemon 根和 Store 来共享。
|
|
20
|
-
|
|
21
|
-
## Host 组合根
|
|
22
|
-
|
|
23
|
-
`src/index.ts::apply()` 按以下顺序组装插件:
|
|
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
|
-
Host 声明依赖 `tools`、`settings`、`commands`、`agents` 和 `subagents`。Web client 另外依赖 slots、connection 和 DSH locale 服务。
|
|
40
|
-
|
|
41
|
-
## 主 Agent 与 worker 的双路径
|
|
42
|
-
|
|
43
|
-
同名 `mnemon_*` 工具根据调用者是否为 subagent 分流,防止递归委派:
|
|
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
|
-
长期语义写入、关系、软删除以及记忆体创建/更新/合并采用相同模式。运行时记忆和 Documents 的普通变更先经过 coordinator,但通常由确定性控制层直接提交;只有容量维护或归档需要额外 worker。
|
|
55
|
-
|
|
56
|
-
记忆体目录的物理删除是单独的确定性危险操作:WebUI 必须先展示二次确认,随后经 loopback 写 RPC 调用 Mnemon 原生 `store remove`;只有 CLI 删除成功后才移除目录登记。
|
|
57
|
-
|
|
58
|
-
## 两类子 Agent
|
|
59
|
-
|
|
60
|
-
### `spawn`
|
|
61
|
-
|
|
62
|
-
`spawn` 使用新的隔离上下文。插件为每类任务提供:
|
|
63
|
-
|
|
64
|
-
- 固定 persona;
|
|
65
|
-
- 最小工具白名单;
|
|
66
|
-
- DSH 支持子集内的结构化输出 schema;
|
|
67
|
-
- `maxDepth: 1`;
|
|
68
|
-
- 可取消的 signal 和有界 token 预算。
|
|
69
|
-
|
|
70
|
-
它用于召回、长期语义写入、证据限定问答、热记忆整理和 Document 归档。
|
|
71
|
-
|
|
72
|
-
### `fork`
|
|
73
|
-
|
|
74
|
-
评分后台审查必须使用名为 `fork` 且 `inheritsParentContext=true` 的 provider。它只继承已经完成的父 checkpoint,用于判断是否需要维护热记忆或最多一份项目档案。它不是用户任务的延续,也不会把审查推理注入主对话。
|
|
75
|
-
|
|
76
|
-
当前审查白名单不包含 `mnemon_remember`、`mnemon_forget` 或记忆体维护工具,因此后台审查不会直接修改长期记忆体。
|
|
77
|
-
|
|
78
|
-
## 控制面与数据面
|
|
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 约束”和“Host 硬保证”。例如 MEMORY 归档 worker 被要求覆盖每条已提交热记忆,但 Host 只能硬校验结构化 action、revision 和字节预算;USER 压缩的 source coverage 则由 Host 逐项验证。
|
|
93
|
-
|
|
94
|
-
## Web 边界
|
|
95
|
-
|
|
96
|
-
WebUI 不启动系统进程,也不直接打开 SQLite:
|
|
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
|
-
读通道要求 `trusted-host`,记忆写通道和设置通道要求 `loopback`。`writeEnabled=false` 时 Host 不注册记忆写通道。
|
|
108
|
-
|
|
109
|
-
## 国际化
|
|
110
|
-
|
|
111
|
-
`src/client/locales.ts` 以中文键集定义 `MnemonKey`,英文词典必须满足同一键集合;`src/client/index.ts` 把两套词典注册到 DSH locale。主要 Web 页面和设置卡随 DSH 全局语言即时切换,并复用全局明暗主题。
|
|
112
|
-
|
|
113
|
-
当前命令输出、工具卡标题、持久化的兼容默认记忆体名称和部分后端错误仍是单语,这是 Roadmap 中的已知缺口。
|
|
114
|
-
|
|
115
|
-
## 关键模块
|
|
116
|
-
|
|
117
|
-
| 模块 | 职责 |
|
|
118
|
-
|---|---|
|
|
119
|
-
| `src/index.ts` | Host 组合与注册 |
|
|
120
|
-
| `src/config.ts` | 配置 schema、默认值和解析 |
|
|
121
|
-
| `src/process.ts` | 无 shell 的有界进程执行 |
|
|
122
|
-
| `src/runner.ts` | CLI 发现、参数、序列化和 JSON 解析 |
|
|
123
|
-
| `src/service.ts` | 长期记忆应用门面 |
|
|
124
|
-
| `src/memory-bodies.ts` | Memory Space 目录元数据 |
|
|
125
|
-
| `src/runtime-memory.ts` | 热记忆事实源与投影 |
|
|
126
|
-
| `src/documents.ts` | Documents 控制面 |
|
|
127
|
-
| `src/subagent.ts` | worker 编排与容量事务 |
|
|
128
|
-
| `src/lifecycle.ts` | per-root-Agent 生命周期 |
|
|
129
|
-
| `src/review-activity.ts` | 确定性审查评分 |
|
|
130
|
-
| `src/tools.ts` | 模型工具及 root/worker 分流 |
|
|
131
|
-
| `src/rpc.ts` | Web 读写通道 |
|
|
132
|
-
| `src/storage-scope.ts` | 三种存储范围的只读盘点 |
|
|
133
|
-
| `src/client/*` | Web 工作台、设置和 locale |
|