@aeondave/pi-persona-mind 0.9.4 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -9,7 +9,7 @@ coupled through a versioned local companion handshake to
9
9
  - Typecheck: `npm run typecheck` (`tsc --noEmit`, strict + `exactOptionalPropertyTypes`)
10
10
  - Tests: `npm test` · both: `npm run verify`
11
11
  - Hermetic choke point: `node --import tsx --import ./test/setup/hermetic-env.ts --test test/*.test.ts`
12
- - Installed Pi 1.6.0 qualification: `node --import tsx scripts/qualify-host.mjs <absolute-pi-package-root> <absolute-pi-persona-extension-path> [<absolute-packed-mind-extension-path>]`
12
+ - Installed Pi 1.6.1 qualification: `node --import tsx scripts/qualify-host.mjs <absolute-pi-package-root> <absolute-pi-persona-extension-path> [<absolute-packed-mind-extension-path>]`
13
13
  (isolated profile, offline synthetic provider; no cloud authentication/model-quality claim).
14
14
 
15
15
  ## Conventions
@@ -17,7 +17,7 @@ coupled through a versioned local companion handshake to
17
17
  - User-requested commits use **AeonDave** as both author and committer, retaining the user's configured
18
18
  email. Never add `Co-authored-by` or assistant/bot attribution; do not push unless explicitly requested.
19
19
  - Erasable-syntax-only TS. `src/core/*` is pure (no Pi imports) and unit-tested.
20
- - Target the latest stable Pi only (currently 1.6.0), Node 22.19.0+. Keep host packages and
20
+ - Target the latest stable Pi only (currently 1.6.1), Node 22.19.0+. Keep host packages and
21
21
  typebox as optional peers on `*`, with all four Pi development packages pinned together.
22
22
  No historical-host branches; never bundle a second host runtime. Scope development security
23
23
  overrides to their affected parent/version and remove them when that graph no longer needs them.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.6](https://github.com/AeonDave/pi-persona-mind/releases/tag/v0.9.6) - 2026-11-27
4
+
5
+ - Delegated workers can receive their selected skills and Mind memory together. Previously Mind
6
+ could cause Persona to reject the delegation before the worker's first model call.
7
+ - Mind now requires Pi 1.6.1. Its memory, backlog and delegated-worker integration are tested
8
+ against that host.
9
+
10
+ ## [0.9.5](https://github.com/AeonDave/pi-persona-mind/releases/tag/v0.9.5) - 2026-11-25
11
+
12
+ - Saved Persona workers rank lean memory by the launch task and show relative ages as of the
13
+ launch turn. They still load current durable memory for Persona to check against the saved
14
+ worker contract.
15
+
3
16
  ## [0.9.4](https://github.com/AeonDave/pi-persona-mind/releases/tag/v0.9.4) - 2026-11-23
4
17
 
5
18
  - A memory replacement or consolidation refused before anything was written (a full store, a lock
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.9.4/assets/banner.png" alt="pi-persona-mind — durable memory for Pi">
4
+ <img src="https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.9.6/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)
@@ -28,7 +28,7 @@ knowledge reviews use the current session model and incur model usage.
28
28
 
29
29
  ## Quick start
30
30
 
31
- Mind 0.9.4 requires **Pi 1.6.0**, **Node.js 22.19.0+**, and
31
+ Mind 0.9.6 requires **Pi 1.6.1**, **Node.js 22.19.0+**, and
32
32
  [**pi-persona 1.18.1+**](https://github.com/AeonDave/pi-persona) loaded in the same instance.
33
33
 
34
34
  ```bash
@@ -76,7 +76,8 @@ or `shared` destination. Strong direct-user cues may be captured automatically,
76
76
  Broader retention requires a separate deliberate `memory` call with an explicit durable scope.
77
77
 
78
78
  Reminders notify you while Pi is open; they do not wake the model. Delegated workers receive a lean
79
- memory selection, without session notes or memory/backlog write tools. Home-directory sessions skip
79
+ memory selection alongside any skills assigned with `delegate`. Session notes and memory/backlog
80
+ write tools stay with the supervisor. Home-directory sessions skip
80
81
  project injection and reminders. See [lifetimes and scope](docs/DESIGN.md#four-lifetimes) and
81
82
  [session notes](docs/DESIGN.md#session-notes) for persistence, branch-local forgetting and expiry.
82
83
 
package/docs/DESIGN.md CHANGED
@@ -9,7 +9,7 @@ the user workflow is in [README](../README.md). Local design rationale and evalu
9
9
  This design contract describes the current development tree; released changes are recorded separately
10
10
  in CHANGELOG.md.
11
11
 
12
- Target the latest stable Pi only, currently 1.6.0, and Node >=22.19. All four development Pi packages
12
+ Target the latest stable Pi only, currently 1.6.1, and Node >=22.19. All four development Pi packages
13
13
  are pinned together; runtime host/typebox packages remain optional wildcard peers. No second host
14
14
  runtime or historical hook-shape adapter is bundled. A development-only security override does not
15
15
  patch an installed host.
@@ -17,7 +17,7 @@ patch an installed host.
17
17
  Mind requires a loaded compatible pi-persona through its versioned local companion handshake.
18
18
  Missing/incompatible presence leaves tools inactive and suppresses capture, storage/import,
19
19
  injection and reminders. A settings file or installed npm package is not proof of an active
20
- companion. Mind 0.9.4 requires Persona 1.18.1 or later for these paired contracts. Its optional npm
20
+ companion. Mind 0.9.6 requires Persona 1.18.1 or later for these paired contracts. Its optional npm
21
21
  peer declares that requirement without auto-installing or activating another extension.
22
22
 
23
23
  The node-only core has no Pi imports. The factory wires native Pi hooks, tools, scope, scheduling
@@ -97,6 +97,16 @@ PI_PERSONA_DISABLE alone does not designate a worker. Workers get lean objective
97
97
  no project/session notes, no memory/backlog tools and no reminders. Both Persona engines freeze the
98
98
  launching persona. In-process workers receive it through their own extension bus; child processes
99
99
  receive a scrubbed spawn-local payload. A later parent selection cannot move a worker's memory scope.
100
+ Mind appends worker memory through Pi's prompt options. Persona can preload the selected skill
101
+ bodies in Pi's skills section and verify both inputs when the worker resumes. Pi records the
102
+ worker's memory excerpts in its native system messages when the worker transcript is saved.
103
+ For a persisted worker with one valid Persona v1 contract on the active branch, lean memory ranking
104
+ uses the first user turn after that contract. Labels such as `today` and `1d` in the worker's lean
105
+ memory refer to that launch turn's timestamp. Mind reads current durable memory for each turn, and
106
+ Persona checks the resulting prompt against the saved contract.
107
+
108
+ After upgrading from 0.9.5, a worker saved with memory in a full-prompt override can report
109
+ `prompt configuration` on resume. Start a fresh delegation with the same brief and skills in that case.
100
110
 
101
111
  Intercom/Exocom and worker output stay foreign reference material, not automatic capture requests.
102
112
  Only the reserved pi-persona-deferred-input custom type replays direct user input. This is a
@@ -550,7 +560,7 @@ language detector, language-specific factor, local tokenizer execution or runtim
550
560
  The reference encoding is not the current model's billing counter, and eight curated vectors do not
551
561
  establish broad language coverage or justify automatic budget tuning. The runtime budget is unchanged.
552
562
 
553
- Tests isolate PI_PERSONA_* and a throwaway PI_AGENT_DIR, use the actual Pi 1.6.0 SDK/tool pipeline and
563
+ Tests isolate PI_PERSONA_* and a throwaway PI_AGENT_DIR, use the actual Pi 1.6.1 SDK/tool pipeline and
554
564
  offline providers, and join session_shutdown before SDK disposal. Native session tests cover persisted
555
565
  reopen, branch/fork, in-memory behavior and owner revocation. Store tests cover lost writes, stale plans,
556
566
  invalid inputs and concurrent apply. Installed-host/package qualification complements source tests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeondave/pi-persona-mind",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
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.",
@@ -52,13 +52,14 @@
52
52
  "verify": "npm run typecheck && npm test"
53
53
  },
54
54
  "pi": {
55
- "image": "https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.9.4/assets/banner.png",
55
+ "image": "https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.9.6/assets/banner.png",
56
56
  "extensions": [
57
57
  "./src/index.ts"
58
58
  ]
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@aeondave/pi-persona": ">=1.18.1",
62
+ "@earendil-works/pi-ai": "*",
62
63
  "@earendil-works/pi-coding-agent": "*",
63
64
  "@earendil-works/pi-tui": "*",
64
65
  "typebox": "*"
@@ -67,6 +68,9 @@
67
68
  "@aeondave/pi-persona": {
68
69
  "optional": true
69
70
  },
71
+ "@earendil-works/pi-ai": {
72
+ "optional": true
73
+ },
70
74
  "@earendil-works/pi-coding-agent": {
71
75
  "optional": true
72
76
  },
@@ -78,10 +82,10 @@
78
82
  }
79
83
  },
80
84
  "devDependencies": {
81
- "@earendil-works/pi-agent-core": "1.6.0",
82
- "@earendil-works/pi-ai": "1.6.0",
83
- "@earendil-works/pi-coding-agent": "1.6.0",
84
- "@earendil-works/pi-tui": "1.6.0",
85
+ "@earendil-works/pi-agent-core": "1.6.1",
86
+ "@earendil-works/pi-ai": "1.6.1",
87
+ "@earendil-works/pi-coding-agent": "1.6.1",
88
+ "@earendil-works/pi-tui": "1.6.1",
85
89
  "@types/node": "^22.0.0",
86
90
  "tsx": "^4.19.0",
87
91
  "typebox": "*",
@@ -1,5 +1,6 @@
1
1
  /** The extension targets current Pi only; this is a floor check, not a compatibility layer. */
2
- export const MIN_PI_VERSION = "1.6.0";
2
+ export const MIN_PI_VERSION = "1.6.1";
3
+ const minimum = MIN_PI_VERSION.split(".").map(Number);
3
4
 
4
5
  export function isSupportedPiVersion(version: string): boolean {
5
6
  const parsed = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(version);
@@ -7,7 +8,6 @@ export function isSupportedPiVersion(version: string): boolean {
7
8
  const parts = parsed.slice(1, 4).map(Number);
8
9
  if (parts.some((part) => !Number.isSafeInteger(part))) return false;
9
10
  const current = parts as [number, number, number];
10
- const minimum = [1, 6, 0] as const;
11
11
  for (let i = 0; i < minimum.length; i++) {
12
12
  if (current[i]! > minimum[i]!) return true;
13
13
  if (current[i]! < minimum[i]!) return false;
@@ -691,7 +691,7 @@ export class MindService {
691
691
  * persona, so it inherits who the persona IS but not the supervisor's project state or deferred
692
692
  * intent. (The caller also withholds the write tools + wakes from a leg — see index.ts.)
693
693
  */
694
- async buildInjection(opts: { lean?: boolean; query?: string; fixedBlocks?: readonly string[]; cleanup?: boolean } = {}): Promise<string> {
694
+ async buildInjection(opts: { lean?: boolean; query?: string; fixedBlocks?: readonly string[]; cleanup?: boolean; leanReferenceTime?: number } = {}): Promise<string> {
695
695
  // Workers inherit a read-only lean block; they must not mutate the supervisor's stores.
696
696
  // A background import may own the profile lock while awaiting another store writer. Reads
697
697
  // already filter expiry; defer disk hygiene until a later turn rather than joining that import.
@@ -701,7 +701,7 @@ export class MindService {
701
701
  if (opts.lean || this.scope.homeWorkspace) {
702
702
  const ltm = this.safeMemories(await this.longMemories(), "long-term");
703
703
  if (opts.lean) {
704
- return renderMind({ persona: this.scope.persona, ltm, stm: [], backlog: [], now, lean: true, ...context, ...(this.budget ? { budget: this.budget } : {}) });
704
+ return renderMind({ persona: this.scope.persona, ltm, stm: [], backlog: [], now: opts.leanReferenceTime ?? now, lean: true, ...context, ...(this.budget ? { budget: this.budget } : {}) });
705
705
  }
706
706
  return renderMind({ persona: this.scope.persona, ltm, stm: [], backlog: [], now, ...context, ...(this.budget ? { budget: this.budget } : {}) });
707
707
  }
@@ -0,0 +1,28 @@
1
+ import { contentText } from "@earendil-works/pi-ai";
2
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
3
+
4
+ const WORKER_CONTRACT_ENTRY = "pi-persona-worker-contract";
5
+
6
+ /** The launch task and time of a Persona v1 continuation, from the current native branch. */
7
+ export function workerMemoryAnchor(manager: ExtensionContext["sessionManager"]): { query: string; timestamp: number } | undefined {
8
+ try {
9
+ if (!manager.getSessionFile()) return undefined;
10
+ const branch = manager.getBranch();
11
+ const contracts = branch.filter((entry) => entry.type === "custom" && entry.customType === WORKER_CONTRACT_ENTRY);
12
+ const contract = contracts[0];
13
+ if (contracts.length !== 1 || contract?.type !== "custom") return undefined;
14
+ const data: unknown = contract.data;
15
+ if (!data || typeof data !== "object" || !("version" in data) || data.version !== 1
16
+ || !("sha256" in data) || typeof data.sha256 !== "string" || !/^[0-9a-f]{64}$/.test(data.sha256)) return undefined;
17
+
18
+ for (const entry of branch.slice(branch.indexOf(contract) + 1)) {
19
+ if (entry.type === "message" && entry.message.role === "user") {
20
+ const { content, timestamp } = entry.message;
21
+ if (!Number.isSafeInteger(timestamp) || timestamp <= 0 || timestamp > Date.now()) return undefined;
22
+ const query = contentText(content);
23
+ return query.trim() ? { query, timestamp } : undefined;
24
+ }
25
+ }
26
+ } catch { /* Ordinary per-turn ranking still applies when the branch is unreadable. */ }
27
+ return undefined;
28
+ }
package/src/index.ts CHANGED
@@ -46,6 +46,7 @@ import { MIND_RESULT_ENTRY_TYPE, registerMindResultRenderer } from "./ui/mind-re
46
46
  import { parsePersonaMemoryOwner, PERSONA_MEMORY_OWNER_CHANGED, personaGuardedTools, queryPersonaDependency, queryPersonaMemoryOwner } from "./extension/persona-dependency.ts";
47
47
  import { createMindActivityRunner } from "./extension/activity.ts";
48
48
  import { installAutoOptimize } from "./extension/auto-optimize-session.ts";
49
+ import { workerMemoryAnchor } from "./extension/worker-memory-anchor.ts";
49
50
 
50
51
  const STATUS_KEY = "pi-persona-mind";
51
52
  /** Display-only transcript card for a due backlog wake. Never sent to the model; never starts a turn. */
@@ -1096,7 +1097,14 @@ export function createExtension(pi: ExtensionAPI, opts: ExtensionOptions = {}):
1096
1097
  const sessionBlock = isDelegatedLeg ? "" : sessionMemory.injection(ctx, { query, maxTokens: 600 });
1097
1098
  try {
1098
1099
  // A worker inherits the LEAN mind (north-star + identity only); the supervisor gets it all.
1099
- block = await withDeadline(getMind(ctx).buildInjection({ lean: isDelegatedLeg, cleanup: !backgroundMigrationPending, query, fixedBlocks: [sessionBlock, cueHint].filter(Boolean).map((text) => `${text}\n\n`) }), INJECT_DEADLINE_MS, "", () => {
1100
+ const memoryAnchor = isDelegatedLeg ? workerMemoryAnchor(ctx.sessionManager) : undefined;
1101
+ block = await withDeadline(getMind(ctx).buildInjection({
1102
+ lean: isDelegatedLeg,
1103
+ cleanup: !backgroundMigrationPending,
1104
+ query: memoryAnchor?.query ?? query,
1105
+ fixedBlocks: [sessionBlock, cueHint].filter(Boolean).map((text) => `${text}\n\n`),
1106
+ ...(memoryAnchor ? { leanReferenceTime: memoryAnchor.timestamp } : {}),
1107
+ }), INJECT_DEADLINE_MS, "", () => {
1100
1108
  if (ownerCurrent()) surfaceWarning(ctx, `memory injection exceeded ${INJECT_DEADLINE_MS}ms and was skipped for this turn`);
1101
1109
  });
1102
1110
  } catch (err) {
@@ -1113,8 +1121,18 @@ export function createExtension(pi: ExtensionAPI, opts: ExtensionOptions = {}):
1113
1121
  }
1114
1122
  const injected = [block, sessionBlock, cueHint].filter(Boolean).join("\n\n");
1115
1123
  if (!isDelegatedLeg) inspector.recordContext(ctx, injected, inspectorCurrent);
1116
- if (injected) return { systemPrompt: `${event.systemPrompt}\n\n${injected}` };
1117
- return;
1124
+ if (!injected) return;
1125
+ // Full supervisor memory stays request-local. A prior opaque worker prompt also owns
1126
+ // the whole request; keep it opaque so Persona can enforce its selected-skills guard.
1127
+ if (!isDelegatedLeg || event.systemPromptOptions.forceSystemPrompt !== undefined) {
1128
+ return { systemPrompt: `${event.systemPrompt}\n\n${injected}` };
1129
+ }
1130
+ // Pi gives a nonempty sections.addendum precedence over appendSystemPrompt. Preserve that
1131
+ // effective content in the field Persona fingerprints, leaving the skills section live.
1132
+ const options = event.systemPromptOptions;
1133
+ const prior = options.sections.addendum || options.appendSystemPrompt;
1134
+ options.appendSystemPrompt = prior ? `${prior}\n\n${injected}` : injected;
1135
+ if (options.sections.addendum) options.sections.addendum = options.appendSystemPrompt;
1118
1136
  });
1119
1137
 
1120
1138
  // The SYNC delegation path: a `delegate`/`council` tool_result whose report carries a BLOCKED/UNKNOWN