@aeondave/pi-persona-mind 0.9.2 → 0.9.3
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/AGENTS.md +131 -123
- package/CHANGELOG.md +224 -205
- package/README.md +169 -145
- package/docs/DESIGN.md +533 -475
- package/docs/MEMORY-RESEARCH.md +25 -1
- package/package.json +90 -90
- package/src/core/handoff-store.ts +70 -0
- package/src/core/handoff.ts +70 -0
- package/src/core/host-compat.ts +2 -2
- package/src/core/memory.ts +7 -0
- package/src/core/optimize-history.ts +48 -6
- package/src/core/optimize-service.ts +18 -24
- package/src/core/retrieval.ts +70 -22
- package/src/core/service.ts +69 -27
- package/src/extension/handoff.ts +23 -0
- package/src/extension/mind-command.ts +449 -404
- package/src/index.ts +14 -3
- package/src/tools/memory-handoff.ts +30 -0
- package/src/tools/memory-history.ts +46 -0
- package/src/tools/memory-optimize.ts +121 -133
- package/src/tools/memory.ts +466 -427
package/docs/DESIGN.md
CHANGED
|
@@ -1,475 +1,533 @@
|
|
|
1
|
-
# pi-persona-mind — current design
|
|
2
|
-
|
|
3
|
-
This is the binding implementation contract. Release history belongs in [CHANGELOG](../CHANGELOG.md);
|
|
4
|
-
the user workflow is in [README](../README.md). Local design rationale and evaluation boundaries are in
|
|
5
|
-
[MEMORY-RESEARCH](MEMORY-RESEARCH.md).
|
|
6
|
-
|
|
7
|
-
## Host and module boundaries
|
|
8
|
-
|
|
9
|
-
This design contract describes the current development tree; released changes are recorded separately
|
|
10
|
-
in CHANGELOG.md.
|
|
11
|
-
|
|
12
|
-
Target the latest stable Pi only, currently 1.
|
|
13
|
-
are pinned together; runtime host/typebox packages remain optional wildcard peers. No second host
|
|
14
|
-
runtime or historical hook-shape adapter is bundled. A development-only security override does not
|
|
15
|
-
patch an installed host.
|
|
16
|
-
|
|
17
|
-
Mind requires a loaded compatible pi-persona through its versioned local companion handshake.
|
|
18
|
-
Missing/incompatible presence leaves tools inactive and suppresses capture, storage/import,
|
|
19
|
-
injection and reminders. A settings file or installed npm package is not proof of an active
|
|
20
|
-
companion. Mind 0.9.
|
|
21
|
-
peer declares that requirement without auto-installing or activating another extension.
|
|
22
|
-
|
|
23
|
-
The node-only core has no Pi imports. The factory wires native Pi hooks, tools, scope, scheduling
|
|
24
|
-
and lifecycle owners. Session persistence uses Pi's public SessionManager and appendEntry contracts.
|
|
25
|
-
Command parsing/presentation lives outside the factory. Important seams:
|
|
26
|
-
|
|
27
|
-
| Module | Responsibility |
|
|
28
|
-
|---|---|
|
|
29
|
-
| core/service.ts | Scope-bound memory/backlog operations, mutation ordering |
|
|
30
|
-
| core/store.ts | Atomic writes, exclusive ownership, recovery, strict snapshots and CAS |
|
|
31
|
-
| core/memory.ts, backlog.ts | Validated facts, shared persisted-content guard and deferred-work state |
|
|
32
|
-
| core/scope.ts, mind-settings.ts | Project identity, safe paths and canonical Mind preferences |
|
|
33
|
-
| extension/persona-dependency.ts | Loaded capability and actual memory-owner contracts |
|
|
34
|
-
| core/migrate.ts | Bounded, non-destructive import of previous memory layouts |
|
|
35
|
-
| core/session-memory.ts, session-memory.ts | Session event validation/replay and native owner adapter |
|
|
36
|
-
| core/optimize.ts, optimize-service.ts | Pure consolidation rules and short-lived staged plans |
|
|
37
|
-
| core/optimize-history.ts | Bounded durable before images and conflict-checked undo |
|
|
38
|
-
| core/
|
|
39
|
-
| core/
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- **
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
the
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
session/
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
not
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
injection
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
1
|
+
# pi-persona-mind — current design
|
|
2
|
+
|
|
3
|
+
This is the binding implementation contract. Release history belongs in [CHANGELOG](../CHANGELOG.md);
|
|
4
|
+
the user workflow is in [README](../README.md). Local design rationale and evaluation boundaries are in
|
|
5
|
+
[MEMORY-RESEARCH](MEMORY-RESEARCH.md).
|
|
6
|
+
|
|
7
|
+
## Host and module boundaries
|
|
8
|
+
|
|
9
|
+
This design contract describes the current development tree; released changes are recorded separately
|
|
10
|
+
in CHANGELOG.md.
|
|
11
|
+
|
|
12
|
+
Target the latest stable Pi only, currently 1.6.0, and Node >=22.19. All four development Pi packages
|
|
13
|
+
are pinned together; runtime host/typebox packages remain optional wildcard peers. No second host
|
|
14
|
+
runtime or historical hook-shape adapter is bundled. A development-only security override does not
|
|
15
|
+
patch an installed host.
|
|
16
|
+
|
|
17
|
+
Mind requires a loaded compatible pi-persona through its versioned local companion handshake.
|
|
18
|
+
Missing/incompatible presence leaves tools inactive and suppresses capture, storage/import,
|
|
19
|
+
injection and reminders. A settings file or installed npm package is not proof of an active
|
|
20
|
+
companion. Mind 0.9.3 requires Persona 1.18.1 or later for these paired contracts. Its optional npm
|
|
21
|
+
peer declares that requirement without auto-installing or activating another extension.
|
|
22
|
+
|
|
23
|
+
The node-only core has no Pi imports. The factory wires native Pi hooks, tools, scope, scheduling
|
|
24
|
+
and lifecycle owners. Session persistence uses Pi's public SessionManager and appendEntry contracts.
|
|
25
|
+
Command parsing/presentation lives outside the factory. Important seams:
|
|
26
|
+
|
|
27
|
+
| Module | Responsibility |
|
|
28
|
+
|---|---|
|
|
29
|
+
| core/service.ts | Scope-bound memory/backlog operations, mutation ordering |
|
|
30
|
+
| core/store.ts | Atomic writes, exclusive ownership, recovery, strict snapshots and CAS |
|
|
31
|
+
| core/memory.ts, backlog.ts | Validated facts, shared persisted-content guard and deferred-work state |
|
|
32
|
+
| core/scope.ts, mind-settings.ts | Project identity, safe paths and canonical Mind preferences |
|
|
33
|
+
| extension/persona-dependency.ts | Loaded capability and actual memory-owner contracts |
|
|
34
|
+
| core/migrate.ts | Bounded, non-destructive import of previous memory layouts |
|
|
35
|
+
| core/session-memory.ts, session-memory.ts | Session event validation/replay and native owner adapter |
|
|
36
|
+
| core/optimize.ts, optimize-service.ts | Pure consolidation rules and short-lived staged plans |
|
|
37
|
+
| core/optimize-history.ts | Bounded durable before images and conflict-checked undo |
|
|
38
|
+
| core/handoff.ts, handoff-store.ts | Explicit scoped handoff snapshots, revision checks and bounded persistence |
|
|
39
|
+
| core/retrieval.ts, context-budget.ts | Explainable task ranking and shared context estimate |
|
|
40
|
+
| core/memory-read.ts | Full explicit retrieval without clipped discovery or recovery writes |
|
|
41
|
+
| tools/memory.ts, memory-optimize.ts | Model-facing action validation and result formatting |
|
|
42
|
+
| extension/mind-command.ts | One command handler for persona-mind and mind |
|
|
43
|
+
| ui/ | Sanitized compact cards, full expansion and native custom-entry renderers |
|
|
44
|
+
|
|
45
|
+
## Four lifetimes
|
|
46
|
+
|
|
47
|
+
- **Durable facts:** persona-private LTM, explicit shared LTM and repository-scoped project LTM.
|
|
48
|
+
Never expire automatically. Project facts remain repository-bound across persona changes.
|
|
49
|
+
- **Working project facts:** STM with persona attribution; 48-hour default TTL. Project injection can include
|
|
50
|
+
other personas' observations, but optimizer mutations require the current persona's ownership.
|
|
51
|
+
- **Session notes:** native custom entries on the active branch, including source session identity.
|
|
52
|
+
- **Deferred intent:** project backlog, open/taken/done/dropped. Default expiry is 48 hours; a later
|
|
53
|
+
reminder extends it. A repeated take is idempotent; re-add does not reopen completed work.
|
|
54
|
+
|
|
55
|
+
LTM/STM facts have content identity based on kind, text and sorted tags; provenance is excluded.
|
|
56
|
+
Exact re-recording updates identical normalized content (not semantic equivalence). lastSeenAt tracks recording/promotion, not
|
|
57
|
+
recall frequency. Read operations do not boost ranking or reset expiry. `term` alone selects lifetime:
|
|
58
|
+
`kind: objective` is not automatically promoted, so a short objective remains expiring project context
|
|
59
|
+
and a session objective remains on that active native session branch.
|
|
60
|
+
|
|
61
|
+
Exact re-recording preserves existing `source`, `derivedFrom` and `supersedes` when no replacement
|
|
62
|
+
metadata is supplied; nonempty replacement metadata updates the corresponding value. In `remember`,
|
|
63
|
+
an empty source or empty `derivedFrom` list is treated as omitted, not as a request to clear provenance.
|
|
64
|
+
`remember` supersession retires an active row in its selected destination tier. A target found only
|
|
65
|
+
in another tier is refused before writing; moving a fact and replacing one are separate operations.
|
|
66
|
+
derivedFrom stores bounded IDs. Optimizer before images provide
|
|
67
|
+
bounded recoverability; ordinary supersession/forget are not a temporal database or unlimited undo.
|
|
68
|
+
Every long-term `remember` requires an explicit destination: project LTM, persona LTM, or shared LTM;
|
|
69
|
+
there is no implicit persona destination. Short-term memory remains project-scoped by default. Promotion
|
|
70
|
+
defaults to project LTM and requires an owned live STM source; persona/shared promotion destinations
|
|
71
|
+
must be explicit. A scope value selects API routing intent; it is not authenticated user consent. Use
|
|
72
|
+
session for task-specific or uncertain choices (models, strategies, task constraints), project for
|
|
73
|
+
stable repository facts, persona for facts intended across all projects of the same persona, and shared
|
|
74
|
+
only for facts truly intended across personas. Existing persona facts are never reassigned to guessed projects. Promotion removes
|
|
75
|
+
only its exact source row; equal-text observations from another owner retain their provenance.
|
|
76
|
+
|
|
77
|
+
## Scope and companion integration
|
|
78
|
+
|
|
79
|
+
The active persona comes only from pi-persona:memory-owner:v1, a synchronous query bound to the
|
|
80
|
+
native session ID. Its response identifies the loaded provider, readiness and actual persona (or
|
|
81
|
+
null for no persona). pi-persona:memory-owner-changed:v1 broadcasts readiness and selection changes.
|
|
82
|
+
Before Persona finishes startup, Mind returns without memory IO; it must not await a later extension's
|
|
83
|
+
session_start. Missing, ambiguous or stale owners refuse access. Saved selection and CLI flags are
|
|
84
|
+
not substitutes for the runtime owner, including when Persona persistence is disabled.
|
|
85
|
+
|
|
86
|
+
Mind capture/nudge preferences are session snapshots from canonical
|
|
87
|
+
<agentDir>/persona/settings.json. The retired state.json and PI_PERSONA_STATE_FILE are not runtime
|
|
88
|
+
sources; Persona owns its settings migration. Contribute effective Mind preferences through
|
|
89
|
+
pi-persona:settings:collect:v1; never edit companion settings or start another service.
|
|
90
|
+
|
|
91
|
+
Use the canonical project path and collision-safe persona scope names. Reserved shared/default
|
|
92
|
+
names, lossy Unicode conversions and Windows device names must not merge unrelated personas.
|
|
93
|
+
Home is not a project: skip project injection and reminders there.
|
|
94
|
+
|
|
95
|
+
A delegated leg is sampled at factory activation through PI_PERSONA_LEG / PI_PERSONA_CHILD.
|
|
96
|
+
PI_PERSONA_DISABLE alone does not designate a worker. Workers get lean objective/LTM injection,
|
|
97
|
+
no project/session notes, no memory/backlog tools and no reminders. Both Persona engines freeze the
|
|
98
|
+
launching persona. In-process workers receive it through their own extension bus; child processes
|
|
99
|
+
receive a scrubbed spawn-local payload. A later parent selection cannot move a worker's memory scope.
|
|
100
|
+
|
|
101
|
+
Intercom/Exocom and worker output stay foreign reference material, not automatic capture requests.
|
|
102
|
+
Only the reserved pi-persona-deferred-input custom type replays direct user input. This is a
|
|
103
|
+
trusted-extension convention, not authentication against other code running in the same process.
|
|
104
|
+
Do not read Persona's private result archive. The supervisor explicitly retrieves a report through
|
|
105
|
+
Intercom before curating a fact. A saved ref remains an opaque source string, not a cross-session grant.
|
|
106
|
+
|
|
107
|
+
## Session notes
|
|
108
|
+
|
|
109
|
+
Version-1 save/forget events live under pi-persona-mind-session-note. Reads replay only the active
|
|
110
|
+
branch; all session events count toward the lifetime budget. Branching/forking follows native Pi
|
|
111
|
+
history; new sessions do not inherit notes. Forked notes preserve originSessionId. A forget appends
|
|
112
|
+
a branch-local tombstone and does not erase previous transcript bytes.
|
|
113
|
+
|
|
114
|
+
Limits: 64 active notes, 8,000 text characters per note, 1,000 source characters, 256 lifetime events,
|
|
115
|
+
512 KiB encoded event data. Unknown versions, unsafe history or exceeded bounds fail closed.
|
|
116
|
+
Admission and replay both scan content. No append occurs after owner revocation; owner identity
|
|
117
|
+
includes the native manager, session ID and file. No asynchronous gap separates validation and append.
|
|
118
|
+
|
|
119
|
+
Receipts distinguish session storage from memory-only storage; Pi controls disk flushing.
|
|
120
|
+
Injection is reference data, escaped and bounded to a 600-token planning estimate (UTF-8 bytes / 3)
|
|
121
|
+
with excerpts of at most 700 characters. It shares the total memory budget. Current task matching
|
|
122
|
+
precedes recency, with objective priority. Omitted entries and clipping are disclosed. Explicit read returns the whole note.
|
|
123
|
+
An in-memory session is not advertised as restart-durable.
|
|
124
|
+
|
|
125
|
+
## Cross-session handoffs
|
|
126
|
+
|
|
127
|
+
`memory { action: "handoff", handoff: { operation: "save", goal, completed, pending, nextStep,
|
|
128
|
+
references } }` stores an explicit snapshot. `completed`, `pending` and `references` are arrays of
|
|
129
|
+
strings. `list` discovers metadata; `read` with `id` returns the snapshot. `complete` requires `id`,
|
|
130
|
+
the latest `revision` and a `resolution`; `forget` requires `id` and `revision`. These actions share
|
|
131
|
+
the existing memory tool, not another tool or model service. `/mind handoff list`,
|
|
132
|
+
`/mind handoff show <id>`, `/mind handoff complete <id> <revision> <resolution>` and
|
|
133
|
+
`/mind handoff forget <id> <revision>` provide operator access.
|
|
134
|
+
|
|
135
|
+
Handoffs belong to the actual project and active persona, with the native source session/branch
|
|
136
|
+
and cwd recorded as provenance. A later independent session may explicitly read the same owner's
|
|
137
|
+
handoff. Home sessions and delegated workers cannot access this surface. The live owner is checked
|
|
138
|
+
before IO, after reads and under the write lock; branch/session changes revoke pending operations.
|
|
139
|
+
Stored content is untrusted, scanned and fenced. References remain literal strings, never automatic
|
|
140
|
+
file reads or tool instructions.
|
|
141
|
+
|
|
142
|
+
One `<STM store>.handoffs.json` sidecar holds up to 32 entries / 128 KiB, shared by personas with
|
|
143
|
+
owner-filtered access. Each record, including metadata, is limited to 16 KiB; the normal store backup
|
|
144
|
+
also applies. Listing uses 160-character goal previews and a 40 KiB formatted-output bound. Explicit
|
|
145
|
+
full reads are bounded to 100 KiB after JSON escaping; neither path silently truncates stored records.
|
|
146
|
+
There is no TTL or automatic eviction: at quota, a new save fails until explicit forgetting frees
|
|
147
|
+
space. Completion increments the revision and records a resolution; earlier pending work remains
|
|
148
|
+
historical. It does not verify tests, execute pending tasks or claim a restored worker session.
|
|
149
|
+
Handoffs never join active fact recall, injection, consolidation or session-note replay.
|
|
150
|
+
`/mind reset` clears working memory and backlog only; handoffs require explicit `forget` by ID and
|
|
151
|
+
revision. This preserves a handoff intended for a later session during routine workspace cleanup.
|
|
152
|
+
|
|
153
|
+
## Replacement history
|
|
154
|
+
|
|
155
|
+
An ordinary `remember` with `supersedes` that retires an existing fact writes a before/after receipt
|
|
156
|
+
through the same write-ahead/CAS helper and bounded store used by consolidation. `origin: replacement`
|
|
157
|
+
distinguishes it from `optimization`; it has no invented plan ID or model-generated reason. If the
|
|
158
|
+
destination already contains the resulting fact, its prior metadata is retained as well. Plain saves,
|
|
159
|
+
exact re-recording, self-supersession and missing-source lineage do not create receipt noise.
|
|
160
|
+
|
|
161
|
+
`memory { action: "history", target: "project-long" }` and `/mind history project-long` list compact
|
|
162
|
+
metadata. For detail, provide `receiptId` and an explicit target; `offset` pages 12,000 UTF-16 units
|
|
163
|
+
of serialized before/after JSON. `/mind history show <receiptId> <target> [offset]` is the command
|
|
164
|
+
equivalent. Targets are `project` (working memory), `project-long`, `persona` and `shared`; listing
|
|
165
|
+
defaults to `project`. `/mind optimize history` uses the same compact discovery view.
|
|
166
|
+
|
|
167
|
+
Only the modifying persona can inspect its receipts, with persisted-content scanning on reads.
|
|
168
|
+
Historical values remain outside active recall and injection. Ordinary replacement receipts are
|
|
169
|
+
read-only: optimizer undo refuses them. Consolidation receipts retain their guarded undo path.
|
|
170
|
+
Retention and interrupted-write behavior are the same for both origins, as described below.
|
|
171
|
+
`/mind reset` does not delete these receipts; history follows its own bounded retention policy.
|
|
172
|
+
Ordinary saves and replacements recheck the accepting session/branch/persona at admission and under
|
|
173
|
+
the store lock. A source or replacement that expires while awaiting commit is refused. Revocation
|
|
174
|
+
after a completed write reports possible persistence in the original scope without exposing stale
|
|
175
|
+
record content or claiming rollback.
|
|
176
|
+
|
|
177
|
+
## Explicit consolidation
|
|
178
|
+
|
|
179
|
+
Bare `/mind optimize` (and `/mind optimize all`) launches one bounded real Persona-hosted LLM review for each currently allowed nonshared target, sequentially, at most three workers; home allows only persona. A named `/mind optimize project|project-long|persona` remains one target. Each worker uses the exact session model and existing worker admission, prompt, strict JSON validation, provenance, preview, CAS apply and durable receipt pipeline. Explicit requests bypass automatic dirty/token/cooldown/auto-off gates but honor current owner, idle/busy, single-flight and safety checks. The command returns after scheduler acceptance, before store inspection or worker admission; the default toast lists allowed targets and says one bounded window per tier will run sequentially. Completion is displayed as ordinary target-qualified Mind result cards, without a separate activity row. Each tier inspects only one bounded page/window; no-input results show target-local counts, page coverage and a typed reason (invalid input, empty/exhausted page, no safe/owned facts, a single short fact, or insufficient full-record budget), followed by the explicit statement that no worker started and no memory changed. An empty page is not a claim that the whole target is empty. A completed worker returning no operations is a reviewed no-op, not a skipped tier. Skipped tiers and reviewed no-ops allow the batch to continue; cancellation, owner change, failed/refused/uncertain workers or writes stop later tiers. A terminal explicit batch report names the accepting/current target and, when any remain, prominently lists the exact tiers not yet examined; earlier skipped, reviewed, or applied tiers are not called unreviewed. Stale lifecycle work emits no report. Worker refusal/failure diagnostics include run ID, model/thinking, and a retained result reference when available, but never echo malformed worker output or source records; the reference lets the operator inspect the archived result. Strict parent parsing and source/provenance validation remain unchanged. Persona 1.17.6 can make one bounded retry after syntactically invalid JSON, within the same tracked worker and original deadline. Mind still validates the returned proposal independently; its v1 companion contract does not require this optional retry. Reports are target-qualified in batch mode. Interrupted/stale work cannot apply, emit stale reports or schedule a manual retry. Shared is explicitly refused for LLM review and points to `/mind optimize inspect shared` plus manual review. Read-only inspection is `/mind optimize inspect [target]`; inspect/history defaults are unchanged.
|
|
180
|
+
|
|
181
|
+
The manual workflow is inspect → stage exact replacements → apply plan ID. An omitted replacement tag
|
|
182
|
+
list inherits the normalized union from selected sources; an explicit empty list clears tags. Lexical
|
|
183
|
+
rules never approve semantic changes. Learned decay rates, recall counters and age-based LTM deletion
|
|
184
|
+
remain outside the contract.
|
|
185
|
+
|
|
186
|
+
Inspection reads a strict store snapshot without recovery/quarantine writes. It returns at most 100
|
|
187
|
+
safe entries (20 by default), an exact raw-byte fingerprint, omission counts and at most 12 lexical
|
|
188
|
+
candidate pairs. Similarity is advisory: negation can preserve nearly all words while reversing meaning.
|
|
189
|
+
Inspection exposes offset/matched/nextOffset so old facts remain reachable in bounded pages;
|
|
190
|
+
fingerprint changes invalidate a paginated inspection's snapshot. Pairs compare one page only.
|
|
191
|
+
The foreground agent must inspect full text and current evidence before proposing replacements.
|
|
192
|
+
|
|
193
|
+
Each plan affects one store: `project` STM, `project-long` durable repository memory, persona LTM,
|
|
194
|
+
or shared LTM. Both project tiers require the current persona's ownership. One source rewrites a fact;
|
|
195
|
+
multiple sources consolidate facts. Explicit deletion remains memory forget. Operations specify exact
|
|
196
|
+
persisted source IDs; ambiguous/overlapping IDs, unsafe content, mixed ownership, replacement collisions,
|
|
197
|
+
expired sources, malformed stores and provenance overflow refuse the plan.
|
|
198
|
+
|
|
199
|
+
A replacement keeps earliest recording time, all bounded source origins and lineage. Project replacements
|
|
200
|
+
keep the earliest source expiry; consolidation cannot revive or extend stale working context.
|
|
201
|
+
Unselected entries are preserved. No capacity-enforcing truncation is allowed.
|
|
202
|
+
|
|
203
|
+
At most four plans per session/scope owner, ten-minute lifetime. Preview is immutable to callers.
|
|
204
|
+
Invalidation during an asynchronous preview read also refuses that preview; it cannot stage a new
|
|
205
|
+
plan belonging to the invalidated owner after the read returns.
|
|
206
|
+
Apply rechecks raw-byte fingerprint, lifetime, source expiry and owner invalidation under the store lock
|
|
207
|
+
and Mind's mutation lock. Even a same-sequence external file replacement invalidates the fingerprint.
|
|
208
|
+
Concurrent apply cannot commit twice. Session/scope changes and native branch navigation discard plans;
|
|
209
|
+
appending ordinary turn entries does not invalidate an owner. Applying never spawns a model.
|
|
210
|
+
|
|
211
|
+
Before replacement, persist a scoped before/after receipt to `<store>.optimize-history.json`, under
|
|
212
|
+
its transaction lock and the memory mutation lock. Maximum 32 receipts / 2 MiB per target, plus the
|
|
213
|
+
standard backup. Evict settled receipts only; refuse the replacement if unresolved prepared receipts
|
|
214
|
+
or the new receipt exceed capacity. A generic IO failure may occur after the memory rename, so its
|
|
215
|
+
receipt remains prepared with outcome uncertainty. Known pre-write conflicts/lifecycle refusals are
|
|
216
|
+
rejected. Finalization failure after a successful memory commit returns success with a warning.
|
|
217
|
+
|
|
218
|
+
History/undo survive optimizer recreation. History is bounded, owner-filtered and scanner-filtered.
|
|
219
|
+
Undo restores only exact affected facts, preserving unrelated current records; it refuses changed
|
|
220
|
+
replacements, source collisions, expired facts and owner revocation. Check the lifecycle generation
|
|
221
|
+
inside the store mutation callback. An ambiguous interrupted receipt is never presumed applied or
|
|
222
|
+
discarded; unresolved IO failures can require manual recovery. This is consolidation recovery,
|
|
223
|
+
not rollback of arbitrary user edits or a claim of semantic correctness.
|
|
224
|
+
|
|
225
|
+
These are authorization mechanics, not truth verification: an explicit memory tool call has the same
|
|
226
|
+
mutation authority as existing remember/forget. The LLM chooses the destination by meaning and context;
|
|
227
|
+
users need not provide API scope names or a literal “global” keyword, and no new per-save confirmation
|
|
228
|
+
loop is imposed. Truly portable preferences remain eligible for persona/shared memory. Background
|
|
229
|
+
review eligibility does not restrict ordinary model-facing saves, updates or staged curation. The
|
|
230
|
+
runtime does not silently invent operator approval.
|
|
231
|
+
The full proposal is reviewable before application; no additional mandatory confirmation loop is added.
|
|
232
|
+
|
|
233
|
+
## Automatic semantic review
|
|
234
|
+
|
|
235
|
+
The user-authorized automatic path uses the same validation and fingerprint-checked mutation boundary.
|
|
236
|
+
It is session-scoped, on by default unless `PI_PERSONA_MIND_OPTIMIZE=off`; `/mind optimize auto
|
|
237
|
+
[status|on|off]` reads or changes that session's setting. Off cancels running review and clears queued
|
|
238
|
+
targets/retry permissions; saves while off do not queue work. On waits for the next successful save.
|
|
239
|
+
Doctor reports the scheduler's current status. No persistent preference is silently written.
|
|
240
|
+
|
|
241
|
+
A successful remember/promotion marks its eligible tier dirty. The first eligible burst needs no
|
|
242
|
+
token minimum. Later attempts require dirty memories and 1,000,000 main-session input tokens since
|
|
243
|
+
the preceding actual launch, including an explicit review; output, cache read/write and worker tokens are excluded. Usage alone
|
|
244
|
+
cannot dirty a tier. Rapid additions coalesce, and dirty tiers left after a review wait for the same
|
|
245
|
+
token gate rather than launching in a cleanup loop. Token counters restart at zero on activation;
|
|
246
|
+
the native session's attempt records preserve whether the first attempt already happened.
|
|
247
|
+
Requests coalesce for two seconds after native `agent_settled`, while idle and without queued work.
|
|
248
|
+
Actual worker attempts have a five-minute cooldown and only one may be in flight per Mind instance.
|
|
249
|
+
Explicit commands bypass automatic admission gates but record their actual launches and settled
|
|
250
|
+
digests. They never receive automatic retry permission when interrupted. Failed attempt persistence
|
|
251
|
+
cancels and joins the admitted worker before releasing the active slot.
|
|
252
|
+
Separate started/settled receipts preserve the attempt target and cooldown without treating an
|
|
253
|
+
interrupted review as completed. Restore considers only the latest attempt for each target, so an
|
|
254
|
+
older interrupted input cannot reappear after its changed-input retry has settled. A semantic digest
|
|
255
|
+
skips unchanged settled inputs, including terminal refusals. Only a retry of the interrupted attempt
|
|
256
|
+
bypasses the token gate; it still requires a later native settled event and cooldown. Cancellation
|
|
257
|
+
alone never rearms it. Unexpected current-owner failures persist terminal suppression without advancing
|
|
258
|
+
the page cursor; a warning asks for inspection when an apply may have completed. If persistence itself
|
|
259
|
+
fails, durable retry suppression cannot be guaranteed and the failure remains visible.
|
|
260
|
+
Incoming input, `agent_start`, native branch navigation, off,
|
|
261
|
+
session/persona/workspace changes and shutdown cancel and invalidate pending plans. Native branch
|
|
262
|
+
navigation preserves session identity but interrupts the old consolidation generation: its worker cannot
|
|
263
|
+
apply or report on the new branch. Explicit work never earns an automatic retry; automatic work retains
|
|
264
|
+
the documented later-settled/cooldown retry policy through a fresh worker, not reuse of an old proposal. Delegated legs
|
|
265
|
+
do not recursively schedule automatic workers. Shared memories are excluded.
|
|
266
|
+
|
|
267
|
+
Persona hosts a real asynchronous Mind worker, visible in its standard agent view. The exact current
|
|
268
|
+
session model is the only allowed selection: no alternate provider/model or fallback. The worker has
|
|
269
|
+
no arbitrary tools, a 180-second deadline, and at most 12 full source records within 24,000 JSON
|
|
270
|
+
characters, with explicit IDs and provenance. Selection reserves the newest eligible record and
|
|
271
|
+
rotates bounded windows within a page and across older pages. Progress is session/scope-local and
|
|
272
|
+
advances only for completed reviews or explicitly ineligible/already-reviewed sets; cancelled work
|
|
273
|
+
does not count as reviewed. Byte-excluded records remain eligible on later passes. Coverage requires
|
|
274
|
+
further admitted triggers, never an unbounded autonomous sweep. Its output is strict JSON with at most four replacement
|
|
275
|
+
operations and at most 12 source IDs per operation, never direct storage writes. Automatic application
|
|
276
|
+
requires at least two compatible supplied source IDs in every operation. A proposal containing a
|
|
277
|
+
single-record rewrite is not staged or applied automatically; the completed attempt is settled without
|
|
278
|
+
an automatic retry loop. Single-record correction remains available through explicit workflows. A
|
|
279
|
+
selected automatic window with no same-kind pair starts no worker and consumes no actual-attempt
|
|
280
|
+
allowance. A merge count alone still does not establish semantic truth; conflicting conclusions must
|
|
281
|
+
not be adjudicated by the background reviewer.
|
|
282
|
+
|
|
283
|
+
The parent rejects malformed, unsafe, unattributed, stale or foreign-owner changes and applies accepted
|
|
284
|
+
replacements through the existing plan/CAS boundary. Kind does not change lifetime: consolidating
|
|
285
|
+
owned short-term objectives stays in project STM and preserves the earliest expiry. Unrelated rows
|
|
286
|
+
survive, and semantic deletion by age is not introduced.
|
|
287
|
+
|
|
288
|
+
Before apply, the complete automatic proposal is appended to an unrendered native audit entry; append
|
|
289
|
+
failure still prevents application. Durable store before images and guarded undo remain unchanged.
|
|
290
|
+
An actual automatic change produces one lowercase `mind` information toast using the scheduler's
|
|
291
|
+
existing structured target and summary, without adding a routine transcript result card.
|
|
292
|
+
Automatic no-ops settle silently while retaining attempt/digest/status evidence. Failures, refusals and
|
|
293
|
+
uncertain receipt finalization remain visible with an important warning. Explicit/manual reports keep
|
|
294
|
+
their detailed cards. The unrendered proposal audit preserves worker/model/effort and result reference;
|
|
295
|
+
`/mind optimize history <target>` exposes durable changes and undo provenance. The real worker's
|
|
296
|
+
normal Persona row uses lowercase `mind` and terminates through the same tracked lifecycle.
|
|
297
|
+
No semantic-quality guarantee or invented token savings follows from execution.
|
|
298
|
+
|
|
299
|
+
## Durable files and recovery
|
|
300
|
+
|
|
301
|
+
Under <agentDir>/persona-mind/:
|
|
302
|
+
|
|
303
|
+
- memory/ltm/<persona>.json and memory/ltm/_shared.json
|
|
304
|
+
- memory/project/<project>.json
|
|
305
|
+
- memory/stm/<project>.json
|
|
306
|
+
- backlog/<project>.json
|
|
307
|
+
|
|
308
|
+
Stores carry version, sequence, updatedAt and entries. Mutations use same-directory temporary writes,
|
|
309
|
+
fsync, atomic rename, exclusive lockfiles and ownership checks. Directory fsync is best-effort on
|
|
310
|
+
Windows. A live/foreign/malformed lock holder is never stolen merely for being old. Corruption is
|
|
311
|
+
recovered or quarantined with diagnostics, never silently treated as an empty valid store.
|
|
312
|
+
Backup recovery re-reads the live file after acquiring its exclusive lock: a writer that committed
|
|
313
|
+
while recovery waited takes precedence over the previously observed backup. Recovery never overwrites
|
|
314
|
+
that new live state or replaces a healthy backup with the damaged/missing state it is repairing.
|
|
315
|
+
Windows sharing conflicts during recovery-gate acquisition return to the existing bounded lock
|
|
316
|
+
wait; they never authorize entering the protected callback or deleting another recovery gate.
|
|
317
|
+
Ordinary memory stores default to 10,000 entries and 4 MiB; writes over capacity fail without truncating
|
|
318
|
+
existing facts. Backlog terminal retention and optimizer history have their own bounds. Retrieval and
|
|
319
|
+
injection remain bounded independently of archive size.
|
|
320
|
+
Third-party attribution and license notices are retained in [LICENSE](../LICENSE).
|
|
321
|
+
|
|
322
|
+
Multi-store memory decisions serialize through one profile-wide memory transaction lock, anchored
|
|
323
|
+
beside shared LTM. A project-only lock is insufficient: persona/shared facts are visible across
|
|
324
|
+
projects, and another Pi could otherwise invalidate an ambiguity check before deletion. Lock order
|
|
325
|
+
is memory transaction → target history transaction → individual store; backlog remains independently
|
|
326
|
+
serialized. This is local same-profile coordination, not cross-host replication. Exocom scope aliases
|
|
327
|
+
do not change Mind's actual workspace identity or import another Pi's memory. Intercom/Exocom reports
|
|
328
|
+
remain untrusted material for explicit supervisor curation.
|
|
329
|
+
|
|
330
|
+
Ordinary recovery and migrations preserve user data. Imports scan bounded historical layouts,
|
|
331
|
+
deduplicate by semantic identity and reconcile the later record; originals are not removed.
|
|
332
|
+
A background import is bounded per turn and may finish after the turn continues. Incomplete import
|
|
333
|
+
means imported facts may not yet be available; it does not by itself prove corruption.
|
|
334
|
+
While import is pending, startup/injection defer disk expiry cleanup instead of waiting again on
|
|
335
|
+
the import's transaction lock. Read-time expiry filtering stays active; a later ordinary turn resumes
|
|
336
|
+
disk cleanup. Progress is informational, shown once per import and cleared when the import settles.
|
|
337
|
+
|
|
338
|
+
Expiry cleanup operates on the current entries under the mutation lock. Never compute a retained
|
|
339
|
+
backlog snapshot before acquiring the write lock: a concurrent add would otherwise be erased.
|
|
340
|
+
Promotion writes LTM before removing STM, so interruption leaves a duplicate rather than data loss.
|
|
341
|
+
Promotion rechecks persisted source text, tags, origin and persona through the same content guard
|
|
342
|
+
used by full reads, consolidation and undo. An unsafe out-of-band record stays in its original tier;
|
|
343
|
+
it is not copied to durable/shared memory or removed from working memory.
|
|
344
|
+
Backlog cleanup retains active items and bounded terminal history.
|
|
345
|
+
|
|
346
|
+
## Capture, injection and UI
|
|
347
|
+
|
|
348
|
+
Persona exposes pi-persona:companion:v1 as a synchronous local capability query. Exactly one
|
|
349
|
+
valid loaded provider is required; disabled, absent, ambiguous or incompatible responses refuse
|
|
350
|
+
Mind access. Tools remain guarded even through programmatic executeTool. Real delegated legs
|
|
351
|
+
receive memory capability for lean injection, not write tools or activity publishing.
|
|
352
|
+
|
|
353
|
+
Local explicit optimization publishes pi-persona:activity:v1 only for actual inspect/stage/apply work. The closed
|
|
354
|
+
payload contains session identity, activity identity, phase, state and target, never memory text,
|
|
355
|
+
paths, model or token claims. Persona projects it as a Mind activity row, separate from agents and
|
|
356
|
+
wake sources. It cannot be steered, stopped as a worker, counted as an agent or exported as agent
|
|
357
|
+
telemetry. Pending proposals are staged, not running. Native owner and scope changes suppress
|
|
358
|
+
late events; terminal rows have bounded retention. This is cooperative UI, not task authority.
|
|
359
|
+
|
|
360
|
+
In AUTO mode, strong direct-user persistence cues may be captured deterministically before the model
|
|
361
|
+
starts, but every such capture is provisional and writes only a native active-branch session note—never
|
|
362
|
+
external project/persona/shared memory, migration destinations, or optimizer dirty state. This includes
|
|
363
|
+
“remember”, “from now on”, and explicitly durable/permanent wording. The receipt says session-only, says
|
|
364
|
+
no durable store was written, and invites a separate deliberate scoped memory call if broader retention
|
|
365
|
+
matches actual user intent; it does not forbid deliberate durable curation. A session append failure
|
|
366
|
+
has no durable fallback. Prompt mode remains nudge-only and off disables detection/capture. Quoted,
|
|
367
|
+
fenced, peer, worker, extension-follow-up and unattributed content are not direct-user capture input.
|
|
368
|
+
Leading negation such as “Never remember that …” is not stripped into a positive capture request.
|
|
369
|
+
Decision extraction also rejects negation in a premise it would discard before `:`. Negative wording
|
|
370
|
+
inside an affirmative fact (“Remember that I never …” or “We decided …: never …”) remains valid.
|
|
371
|
+
No-cue input skips migration waits. Lifecycle/current-input/owner generations prevent stale capture
|
|
372
|
+
notices; accepted notes stay with the original native owner and are never copied to a replacement session.
|
|
373
|
+
Asynchronous status reads use that same owner guard: results and failures from a previous owner
|
|
374
|
+
cannot replace the current owner's counts or display a stale storage warning after shutdown.
|
|
375
|
+
|
|
376
|
+
Normal injection uses entry caps (8 persona/shared LTM, 4 project LTM, 5 STM, 6 backlog), plus a
|
|
377
|
+
combined 2,400-token planning estimate across all memory blocks, including session notes (up to 600),
|
|
378
|
+
wrappers and omission notices. The estimate is UTF-8 bytes / 3, not a provider tokenizer or billing
|
|
379
|
+
guarantee. Whole excerpts are admitted, with bounded objective/invariant priority; they never bypass
|
|
380
|
+
the cap. Full reads are
|
|
381
|
+
explicit; no whole worker report is inserted as a memory merely because it exists. Scanner checks
|
|
382
|
+
run on admission and resurfacing, including new full-read source/tags. Scanning/fencing mitigates
|
|
383
|
+
unsafe content but cannot prove semantic truth or provide a security boundary against same-process code.
|
|
384
|
+
|
|
385
|
+
Nested report provenance follows Pi parentToolCallId, never guessed ID syntax. Only a visible relayed
|
|
386
|
+
blocked report from delegate/council/flow can suggest backlog capture. Discarded nested reports do not.
|
|
387
|
+
Bound and clear relay state at settlement.
|
|
388
|
+
|
|
389
|
+
Wakes are display-only appendEntry plus a short toast, never sendUserMessage/triggerTurn. Acknowledged
|
|
390
|
+
due reminders are not replayed. Newly due reminders are armed immediately and cancel on closure.
|
|
391
|
+
Keep pending/delivered deadline identity across maintenance re-arms. Persistence acknowledges only
|
|
392
|
+
the exact `(id, dueAtEpochMs)` shown to the user, compared under the backlog write lock; an old
|
|
393
|
+
acknowledgement cannot consume a concurrent renewal. It clears that deadline, not the backlog item.
|
|
394
|
+
|
|
395
|
+
Standalone cards use Persona's single `createCardFrame` implementation through the synchronous local
|
|
396
|
+
`pi-persona:card-frame:v1` presentation query. Mind mirrors the small structural contract and queries
|
|
397
|
+
at each renderer invocation, without hard-importing an optional package or caching a factory across
|
|
398
|
+
reload. Missing, incompatible, ambiguous or throwing providers use a minimal sanitized full-text
|
|
399
|
+
history fallback, not a second styled card engine. This port conveys no memory, scheduling or
|
|
400
|
+
security authority. Presentation models carry title, semantic state, full body, width-aware preview,
|
|
401
|
+
optional metadata and Markdown; the frame owns theme, truncation, expansion and padding. Custom-entry
|
|
402
|
+
renderers pass their original stable entry object as optional `CardFrameContext.expansionKey`; the
|
|
403
|
+
shared frame owns any click/keyboard synchronization, keyed weakly without retaining entry text. A
|
|
404
|
+
missing key is presentation-only (native tool renderers retain their host-owned interaction shell).
|
|
405
|
+
|
|
406
|
+
Entry cards read the current public `pi.getSettings().outputPad` (native 0/1, default 1) because entry
|
|
407
|
+
render options omit it, and use host-provided expand hints. Native memory/backlog tool results retain
|
|
408
|
+
Pi's shell and receive no duplicate padding or standalone frame. Saved-memory receipts use a compact
|
|
409
|
+
summary with an expand hint; expansion reveals the original receipt, including its addressable ID,
|
|
410
|
+
without rewriting the tool payload or repeating the call title. A session read is not a save receipt. Optimization previews must retain their
|
|
411
|
+
selected-window qualification and never imply every record was reviewed; expansion retains worker,
|
|
412
|
+
model/effort and terminal-reference provenance. Commands retain reports in custom-entry history;
|
|
413
|
+
warnings/toasts stay short and are not duplicate durable cards. Display callbacks must still belong
|
|
414
|
+
to their accepting session and scope after asynchronous reads.
|
|
415
|
+
|
|
416
|
+
## Read-only memory inspector
|
|
417
|
+
|
|
418
|
+
F10 and `/mind browse [memories|context|timeline]` open one native TUI inspector; `/mind timeline`
|
|
419
|
+
selects its timeline tab. Existing bare `/mind` and `/mind session` reports remain unchanged. RPC,
|
|
420
|
+
print and JSON modes do not open custom TUI. Delegated legs do not receive the shortcut or browse
|
|
421
|
+
access. Entry points require compatible Persona and the actual current native session owner.
|
|
422
|
+
|
|
423
|
+
F10 obtains Persona's stateless frame through the synchronous local
|
|
424
|
+
`pi-persona:inspector-frame:v1` query when opening. Both inspectors use the same width, row
|
|
425
|
+
allocation, gutters and theme `border` role. Mind mirrors only the structural service contract,
|
|
426
|
+
not a second painter; if the service is unavailable, opening reports a compatible-Persona/reload
|
|
427
|
+
diagnostic while memory operations remain unchanged. Selection, tabs, sources, data admission and
|
|
428
|
+
lifecycle remain Mind-owned. Page movement uses the actual rendered list/detail/source/help
|
|
429
|
+
capacity, and narrow layouts shorten controls before hiding the selected record. The native search
|
|
430
|
+
Input receives focus only during search.
|
|
431
|
+
|
|
432
|
+
The inspector is a query/view layer, not a new memory engine. Its explicit `a` action launcher closes
|
|
433
|
+
the overlay before opening native action/approval dialogs. Consolidation calls the existing bounded
|
|
434
|
+
explicit optimizer for the chosen nonshared scope; the launcher does not create a second merge path.
|
|
435
|
+
Knowledge review is a separate proposal workflow described below. Browsing alone remains read-only. Durable browsing reuses strict optimizer
|
|
436
|
+
inspection (including safe/owned admission and pagination); opening it never repairs, migrates, saves,
|
|
437
|
+
schedules, or starts a model call. Session browsing reuses native note replay. Home suppresses project
|
|
438
|
+
scopes. Searches are literal browsing filters, not a replacement for the runtime retrieval ranker.
|
|
439
|
+
|
|
440
|
+
Source metadata (`source`, `derivedFrom`, `supersedes`) remains literal, never an instruction to open
|
|
441
|
+
paths, URLs or private worker archives. Successful explicit `memory remember` results carry a versioned
|
|
442
|
+
native `recording` descriptor with the accepting persona, repository identity and target. A recording
|
|
443
|
+
link requires an exact matching successful tool call/result, current fact content and scope identity
|
|
444
|
+
within the bounded active branch. Old receipts without that attribution cannot establish such a link.
|
|
445
|
+
Session-note links refer to validated native save events. These are recording provenance, not evidence
|
|
446
|
+
that the assertion is true, nor automatic citations of a preceding user message. No store schema,
|
|
447
|
+
retention policy, cross-session access grant or independent transcript archive is introduced.
|
|
448
|
+
|
|
449
|
+
The timeline is an on-demand view of at most 2,000 newest native active-branch entries, with 40 results
|
|
450
|
+
per page and explicit older-entry omissions. It includes user/assistant text and validated session-note
|
|
451
|
+
save/forget events, never reasoning, image bytes, arbitrary custom reports or tool-result bodies.
|
|
452
|
+
Message details are bounded to 32,000 characters with clipping disclosed. Search counts describe only
|
|
453
|
+
that bounded window, not the user's complete conversation history. Tombstones remain historical events.
|
|
454
|
+
|
|
455
|
+
Context inspection holds only the last block prepared by Mind in memory, including session notes,
|
|
456
|
+
capture hints and omission notices. It never reconstructs a supposedly historical selection from today's
|
|
457
|
+
stores, and never claims to observe the provider payload. The existing UTF-8-bytes/3 planning estimator
|
|
458
|
+
and injection policy remain unchanged. A new process has no prior prepared-context snapshot.
|
|
459
|
+
|
|
460
|
+
Native session/branch changes, owner revocation and persona/project changes clear that snapshot and
|
|
461
|
+
abort the open inspector. Every asynchronous page read checks the accepting owner before and after IO;
|
|
462
|
+
revoked results cannot repaint a different owner. UI content is sanitized, width-bounded and navigable
|
|
463
|
+
without executing links or sending model messages. The user can explicitly refresh the view.
|
|
464
|
+
|
|
465
|
+
## Evidence-grounded knowledge review
|
|
466
|
+
|
|
467
|
+
`/mind review [project|project-long|persona]` and F10's action menu run an explicit knowledge review.
|
|
468
|
+
The default is durable project memory (persona at home). F10 can review a selected fact or a bounded
|
|
469
|
+
scope window. Session/shared are not model-review write targets. The current Persona companion protocol
|
|
470
|
+
admits only the exact active session model/thinking level; Mind does not infer a better model from names,
|
|
471
|
+
change providers, or silently choose a fallback. The real visible `mind` worker still has no tools.
|
|
472
|
+
|
|
473
|
+
The parent inspects safe, owned facts and admits at most six complete records within 12,000 JSON
|
|
474
|
+
characters. The user explicitly selects up to six repository-relative text files. Trusted-workspace,
|
|
475
|
+
containment, symlink, regular-file, size, secret and content checks gate reads; no recursive search,
|
|
476
|
+
source-string path resolution, network access or private worker archive is used. Native user-role text
|
|
477
|
+
is sampled only from a bounded active-branch window. A stored user role is not authenticated human
|
|
478
|
+
intent: quotations, hypotheticals and programmatic messages must be critically assessed. Evidence
|
|
479
|
+
snapshots carry IDs, labels, excerpts, hashes and coverage; omissions cannot establish absence.
|
|
480
|
+
|
|
481
|
+
The task requires one classified finding per supplied fact: supported, proposed correction, conflict,
|
|
482
|
+
insufficient evidence, or proposed retirement. The parent rejects unknown records/citations, duplicate
|
|
483
|
+
findings, malformed fields and unsafe replacement text. Corrective operations preserve kind and scope;
|
|
484
|
+
source lineage and bounded evidence references survive consolidation. These checks establish attribution
|
|
485
|
+
and structural validity, not factual truth. Local repository evidence must not turn a repository-specific
|
|
486
|
+
rule into a universal persona preference; age and latest mention alone are not obsolescence evidence.
|
|
487
|
+
|
|
488
|
+
There is NO automatic application. A complete native proposal report shows reasons, cited evidence,
|
|
489
|
+
coverage and before/after corrections. `/mind review show` reopens it; `/mind review apply` displays it
|
|
490
|
+
and asks for explicit approval. The staged plan lives in a dedicated optimizer instance, not the generic
|
|
491
|
+
memory-tool plan cache, so `/mind optimize apply` cannot bypass evidence validation. Approval reacquires
|
|
492
|
+
maintenance admission, checks evidence freshness and applies through the same CAS/history/undo boundary.
|
|
493
|
+
A synchronous parent evidence guard runs again inside the guarded store callback. This verifies source
|
|
494
|
+
state at the check, not a transaction locking arbitrary repository files against external writers.
|
|
495
|
+
|
|
496
|
+
Retirement is deliberately recommendation-only: the reviewer cannot delete a standalone memory.
|
|
497
|
+
A deliberate scoped `memory forget` remains available for a separately judged retirement, with its
|
|
498
|
+
existing semantics (not consolidation undo). No delete-shaped optimizer plan, new durable schema or
|
|
499
|
+
unbounded history is introduced. `/mind review discard` cancels/discards pending work; an applied change
|
|
500
|
+
requires the ordinary history/undo workflow.
|
|
501
|
+
|
|
502
|
+
A parent review reservation prevents automatic and explicit consolidation from overlapping collection
|
|
503
|
+
or worker execution. Only actual review launches reset automatic usage/cooldown accounting and persist
|
|
504
|
+
explicit attempt markers; interruptions never create an automatic retry entitlement. Staging releases
|
|
505
|
+
the worker reservation rather than holding it while waiting for a human. Apply must acquire a new one;
|
|
506
|
+
concurrent writes or expired plans are refused. New input, agent/model/branch changes, owner revocation
|
|
507
|
+
and shutdown cancel workers/dialogs and invalidate pending review plans. Shutdown joins admitted apply
|
|
508
|
+
work through approval, guarded persistence, receipt finalization and lease cleanup. Revocation blocks new
|
|
509
|
+
admission and guarded writes, but does not roll back an already committed replacement or relabel it as
|
|
510
|
+
cancelled; its finalization is still awaited and stale completion UI is suppressed. Completion uses display-only
|
|
511
|
+
native entries/toasts and never triggers a supervisor turn.
|
|
512
|
+
|
|
513
|
+
## Verification boundaries
|
|
514
|
+
|
|
515
|
+
The source-checkout `eval:memory` command reports individual paired sentinel ranks and actual bounded
|
|
516
|
+
injection outcomes, retaining historical queries and corruption/removed-fact negative controls.
|
|
517
|
+
Token diagnostics compare the unchanged UTF-8-bytes/3 estimate to pinned published reference vectors,
|
|
518
|
+
with exact input/token-ID hashes and source provenance. All inputs use the same calculation: no
|
|
519
|
+
language detector, language-specific factor, local tokenizer execution or runtime network request.
|
|
520
|
+
The reference encoding is not the current model's billing counter, and eight curated vectors do not
|
|
521
|
+
establish broad language coverage or justify automatic budget tuning. The runtime budget is unchanged.
|
|
522
|
+
|
|
523
|
+
Tests isolate PI_PERSONA_* and a throwaway PI_AGENT_DIR, use the actual Pi 1.6.0 SDK/tool pipeline and
|
|
524
|
+
offline providers, and join session_shutdown before SDK disposal. Native session tests cover persisted
|
|
525
|
+
reopen, branch/fork, in-memory behavior and owner revocation. Store tests cover lost writes, stale plans,
|
|
526
|
+
invalid inputs and concurrent apply. Installed-host/package qualification complements source tests.
|
|
527
|
+
|
|
528
|
+
The [post-release source audit](https://github.com/AeonDave/pi-persona-mind/blob/main/docs/reviews/2026-11-12-post-release-audit.md)
|
|
529
|
+
records the qualified snapshots, large-store checks, concurrent-writer stress tests and real-provider
|
|
530
|
+
smokes, with their evidence and platform limits.
|
|
531
|
+
|
|
532
|
+
Passing these checks proves tested behavior, not perfect memory, semantic compression quality, external
|
|
533
|
+
provider authentication or every operating system. CI provides separate Windows/Linux/macOS evidence.
|