@aeondave/pi-persona-mind 0.8.6 → 0.8.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.7](https://github.com/AeonDave/pi-persona-mind/releases/tag/v0.8.7) - 2026-10-27
4
+
5
+ - Interrupted explicit optimization batches identify the tiers not yet reviewed. Worker failures
6
+ and invalid proposals retain the worker's model/effort and terminal-report reference without
7
+ echoing malformed model output. Invalid proposals never reach application.
8
+ - Setup failures report that no tier was reviewed; cleanup failures cannot overwrite completed
9
+ results or retain the active-work slot. Migration-warning tests wait for background completion,
10
+ and the live smoke checks proposal order, confirmed application counts and durable undo receipts;
11
+ refused or uncertain writes cannot pass as successful application.
12
+
3
13
  ## [0.8.6](https://github.com/AeonDave/pi-persona-mind/releases/tag/v0.8.6) - 2026-10-26
4
14
 
5
15
  - Allow bare `/mind optimize` and `/mind optimize all` to review one bounded window per currently
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <h1 align="center">pi-persona-mind</h1>
2
2
 
3
3
  <p align="center">
4
- <img src="https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.8.6/assets/banner.png" alt="pi-persona-mind — durable memory for Pi">
4
+ <img src="https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.8.7/assets/banner.png" alt="pi-persona-mind — durable memory for Pi">
5
5
  </p>
6
6
 
7
7
  [![CI](https://github.com/AeonDave/pi-persona-mind/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/AeonDave/pi-persona-mind/actions/workflows/test.yml) [![npm version](https://img.shields.io/npm/v/@aeondave/pi-persona-mind?logo=npm)](https://www.npmjs.com/package/@aeondave/pi-persona-mind) [![License](https://img.shields.io/github/license/AeonDave/pi-persona-mind)](LICENSE)
package/docs/DESIGN.md CHANGED
@@ -6,7 +6,7 @@ the user workflow is in [README](../README.md). Evidence behind consolidation de
6
6
 
7
7
  ## Host and module boundaries
8
8
 
9
- This design contract describes release 0.8.6.
9
+ This design contract describes release 0.8.7.
10
10
 
11
11
  Target the latest stable Pi only, currently 1.4.0, and Node >=22.19. All four development Pi packages
12
12
  are pinned together; runtime host/typebox packages remain optional wildcard peers. No second host
@@ -16,7 +16,7 @@ patch an installed host.
16
16
  Mind requires a loaded compatible pi-persona through its versioned local companion handshake.
17
17
  Missing/incompatible presence leaves tools inactive and suppresses capture, storage/import,
18
18
  injection and reminders. A settings file or installed npm package is not proof of an active
19
- companion. Mind 0.8.6 requires Persona 1.17.5 or later for these paired contracts. Its optional npm
19
+ companion. Mind 0.8.7 requires Persona 1.17.5 or later for these paired contracts. Its optional npm
20
20
  peer declares that requirement without auto-installing or activating another extension.
21
21
 
22
22
  The node-only core has no Pi imports. The factory wires native Pi hooks, tools, scope, scheduling
@@ -111,7 +111,7 @@ An in-memory session is not advertised as restart-durable.
111
111
 
112
112
  ## Explicit consolidation
113
113
 
114
- 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. 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.
114
+ 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.
115
115
 
116
116
  The manual workflow is inspect → stage exact replacements → apply plan ID. An omitted replacement tag
117
117
  list inherits the normalized union from selected sources; an explicit empty list clears tags. Lexical
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeondave/pi-persona-mind",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Local memory for Pi with pi-persona — durable project and persona facts, session notes, bounded retrieval, and supervised automatic consolidation.",
@@ -57,7 +57,7 @@
57
57
  }
58
58
  },
59
59
  "pi": {
60
- "image": "https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.8.6/assets/banner.png",
60
+ "image": "https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.8.7/assets/banner.png",
61
61
  "extensions": [
62
62
  "./src/index.ts"
63
63
  ]
@@ -152,18 +152,29 @@ export class AutoOptimizeScheduler {
152
152
  const disabledGeneration = this.disabledGeneration;
153
153
  const current = () => generation === this.generation && (explicit || this.enabled) && this.safeIdle(owner) && this.safeCurrent(owner);
154
154
  const mayRetry = () => !explicit && this.enabled && this.disabledGeneration === disabledGeneration && this.safeCurrent(owner);
155
- const optimizer = owner.optimizer();
155
+ const targets = explicit ? explicitTargets ?? [] : [...this.pending];
156
+ let optimizer: Optimizer;
157
+ try { optimizer = owner.optimizer(); } catch (error) {
158
+ if (!explicit) throw error;
159
+ if (!current()) return;
160
+ this.last = "optimizer setup failed; no worker started, no memory changed";
161
+ const body = `${qualifyTargets ? "Batch stopped; not reviewed" : "Target not reviewed"}: ${targets.join(", ")}.\nBounded review could not start: ${this.last}. See /mind doctor.`;
162
+ try { owner.report(qualifyTargets ? `Mind optimization result — ${targets[0]}` : "Mind optimization result", body); } catch { /* owner reporting is best-effort */ }
163
+ return;
164
+ }
156
165
  const running: NonNullable<AutoOptimizeScheduler["running"]> = { optimizer, explicit };
157
166
  let attemptRecorded = false;
158
167
  let unsettledTarget: Target | undefined;
159
168
  let nextCursor: CoverageCursor | undefined;
160
169
  let retryRequiresSettled = false;
161
170
  let activeTarget: Target | undefined;
162
- const targets = explicit ? explicitTargets ?? [] : [...this.pending];
163
- const report = (target: Target, title: string, body: string, summary?: string): boolean => {
171
+ const report = (target: Target, title: string, body: string, summary?: string, stopped = false): boolean => {
164
172
  if (!current()) return false;
173
+ const remaining = stopped && qualifyTargets ? targets.slice(targets.indexOf(target) + 1) : [];
174
+ const stoppedLine = remaining.length ? `Batch stopped; not reviewed: ${remaining.join(", ")}.\n` : "";
175
+ const outcome = `${summary ?? body.split("\n", 1)[0] ?? "review result"}${remaining.length ? ` · not reviewed: ${remaining.join(", ")}` : ""}`;
165
176
  const qualifiedBody = qualifyTargets && !body.startsWith("Target:")
166
- ? `Target: ${target} — ${summary ?? body.split("\n", 1)[0] ?? "review result"}\n${body}`
177
+ ? `Target: ${target} — ${outcome}\n${stoppedLine}${body}`
167
178
  : body;
168
179
  owner.report(qualifyTargets ? `${title} — ${target}` : title, qualifiedBody);
169
180
  return true;
@@ -189,7 +200,7 @@ export class AutoOptimizeScheduler {
189
200
  else {
190
201
  if (mayRetry()) this.pending.add(target);
191
202
  this.last = explicit ? "store changed during bounded inspection; the selected window was not reviewed" : "store changed during bounded inspection; waiting for the next settled event";
192
- if (explicit) report(target, "Mind optimization result", `Bounded review stopped before worker admission: ${this.last}.`, "inspection snapshot changed; no worker started");
203
+ if (explicit) report(target, "Mind optimization result", `Bounded review stopped before worker admission: ${this.last}.`, "inspection snapshot changed; no worker started", true);
193
204
  return;
194
205
  }
195
206
  }
@@ -199,7 +210,7 @@ export class AutoOptimizeScheduler {
199
210
  return;
200
211
  }
201
212
  this.last = "store inspection failed; see /mind doctor";
202
- if (explicit) report(target, "Mind optimization result", `Bounded review could not inspect this record window: ${this.last}.`, "inspection failed; no worker started");
213
+ if (explicit) report(target, "Mind optimization result", `Bounded review could not inspect this record window: ${this.last}.`, "inspection failed; no worker started", true);
203
214
  if (explicit) return;
204
215
  continue;
205
216
  }
@@ -211,13 +222,13 @@ export class AutoOptimizeScheduler {
211
222
  }
212
223
  if (!inspection.ok) {
213
224
  this.last = "store inspection refused; see /mind doctor";
214
- if (explicit) report(target, "Mind optimization result", `Bounded review stopped before worker admission: ${this.last}.`, "inspection refused; no worker started");
225
+ if (explicit) report(target, "Mind optimization result", `Bounded review stopped before worker admission: ${this.last}.`, "inspection refused; no worker started", true);
215
226
  if (explicit) return;
216
227
  continue;
217
228
  }
218
229
  if (inspection.target !== target) {
219
230
  this.last = "store inspection returned a different tier; no worker started";
220
- if (explicit) report(target, "Mind optimization result", `Bounded review stopped before worker admission: ${this.last}.`, "inspection returned the wrong target; no worker started");
231
+ if (explicit) report(target, "Mind optimization result", `Bounded review stopped before worker admission: ${this.last}.`, "inspection returned the wrong target; no worker started", true);
221
232
  if (explicit) return;
222
233
  continue;
223
234
  }
@@ -244,7 +255,7 @@ export class AutoOptimizeScheduler {
244
255
  if (!worker.ok) {
245
256
  if (!explicit) this.pending.add(target);
246
257
  this.last = worker.reason;
247
- if (explicit) report(target, "Mind optimization result", `Bounded review was not admitted: ${worker.reason}. No memory changed.`, "worker admission refused; no memory changed");
258
+ if (explicit) report(target, "Mind optimization result", `Bounded review was not admitted: ${worker.reason}. No memory changed.`, "worker admission refused; no memory changed", true);
248
259
  return;
249
260
  }
250
261
  const attemptAt = this.now();
@@ -279,21 +290,21 @@ export class AutoOptimizeScheduler {
279
290
  }
280
291
  unsettledTarget = undefined;
281
292
  this.last = explicit ? "explicit review stopped; memory unchanged" : "review interrupted; waiting for the next settled event";
282
- if (explicit) report(target, "Mind optimization result", this.last, "worker stopped; memory unchanged");
293
+ if (explicit) report(target, "Mind optimization result", this.last, "worker stopped; memory unchanged", true);
283
294
  return;
284
295
  }
296
+ const provenance = `Worker ${worker.runId} · ${worker.model} · ${worker.thinking}${result.resultRef ? `\nTerminal report: ${result.resultRef}` : ""}`;
285
297
  if (!result.ok) {
286
298
  settle(); this.last = "worker failed; memory unchanged";
287
- report(target, explicit ? "Mind optimization result" : "Mind automatic optimization", `Bounded review · ${this.last}${result.error ? `: ${result.error}` : ""}`, "worker failed; memory unchanged");
299
+ report(target, explicit ? "Mind optimization result" : "Mind automatic optimization", `Bounded review · ${this.last}${result.error ? `: ${result.error}` : ""}\n${provenance}`, "worker failed; memory unchanged", explicit);
288
300
  return;
289
301
  }
290
302
  const parsed = parseAutoProposal(result.output, input);
291
303
  if (!parsed.ok) {
292
304
  settle(); this.last = "proposal refused; memory unchanged";
293
- report(target, explicit ? "Mind optimization result" : "Mind automatic optimization", `Bounded review · ${this.last}: ${parsed.reason}`, "proposal refused; memory unchanged");
305
+ report(target, explicit ? "Mind optimization result" : "Mind automatic optimization", `Bounded review · ${this.last}: ${parsed.reason}\n${provenance}`, "proposal refused; memory unchanged", explicit);
294
306
  return;
295
307
  }
296
- const provenance = `Worker ${worker.runId} · ${worker.model} · ${worker.thinking}${result.resultRef ? `\nTerminal report: ${result.resultRef}` : ""}`;
297
308
  if (!parsed.operations.length) {
298
309
  settle(); this.last = "bounded review found no safe consolidation in this record set";
299
310
  report(target, explicit ? "Mind optimization result" : "Mind automatic optimization", `Bounded coverage: one selected record window; ${this.last}.\n${provenance}`, "reviewed no-op; no safe consolidation in this window");
@@ -305,11 +316,11 @@ export class AutoOptimizeScheduler {
305
316
  if (!current()) return;
306
317
  if (!plan.ok) {
307
318
  settle(); this.last = "store or proposal changed; nothing applied";
308
- report(target, explicit ? "Mind optimization result" : "Mind automatic optimization", `Bounded coverage: one selected record window; ${this.last}: ${plan.reason}\n${provenance}`, "proposal refused or stale; nothing applied");
319
+ report(target, explicit ? "Mind optimization result" : "Mind automatic optimization", `Bounded coverage: one selected record window; ${this.last}: ${plan.reason}\n${provenance}`, "proposal refused or stale; nothing applied", explicit);
309
320
  return;
310
321
  }
311
322
  if (!report(target, explicit ? "Mind optimization proposal" : "Mind automatic proposal", `${provenance}\n${formatAutoPlan(plan)}\n${explicit ? "Validated apply pending" : "Automatic apply pending"}; it proceeds only while this owner and snapshot remain current.`, "proposal staged; validated apply pending")) return;
312
- if (!current()) { optimizer.invalidate(); return; }
323
+ if (!current()) return;
313
324
  const applied = await optimizer.apply(plan.planId);
314
325
  if (!current()) return;
315
326
  settle();
@@ -321,15 +332,15 @@ export class AutoOptimizeScheduler {
321
332
  const resultSummary = applied.ok
322
333
  ? `${applied.changed} replacement${applied.changed === 1 ? "" : "s"} applied${applied.warning ? "; receipt finalization warning" : ""}`
323
334
  : `not applied: ${applied.reason}`;
324
- if (!report(target, explicit ? "Mind optimization result" : "Mind automatic result", `Bounded coverage: one selected record window; ${this.last}\n${provenance}${receipt}${warning}`, resultSummary)) return;
335
+ if (!report(target, explicit ? "Mind optimization result" : "Mind automatic result", `Bounded coverage: one selected record window; ${this.last}\n${provenance}${receipt}${warning}`, resultSummary, explicit && (!applied.ok || Boolean(applied.warning)))) return;
325
336
  if (!applied.ok || applied.warning || !explicit) return;
326
337
  }
327
338
  } catch (error) {
328
339
  if (!explicit) throw error;
329
340
  this.last = "explicit review failed unexpectedly; inspect current memory before retrying because apply may have completed";
330
- if (activeTarget && current()) report(activeTarget, "Mind optimization result", `Bounded review failed unexpectedly; ${this.last}.`, "review failed unexpectedly; inspect current memory before retrying");
341
+ if (activeTarget && current()) report(activeTarget, "Mind optimization result", `Bounded review failed unexpectedly; ${this.last}.`, "review failed unexpectedly; inspect current memory before retrying", true);
331
342
  } finally {
332
- optimizer.invalidate();
343
+ try { optimizer.invalidate(); } catch { /* Run-local plan cleanup cannot change completed review/apply results. */ }
333
344
  if (this.running === running) this.running = undefined;
334
345
  if (unsettledTarget !== undefined && !current() && mayRetry()) {
335
346
  this.pending.add(unsettledTarget);