@aeondave/pi-persona-mind 0.9.3 → 0.9.5

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