instar 1.3.343 → 1.3.345

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.
Files changed (147) hide show
  1. package/dist/commands/init.d.ts +4 -4
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/commands/reflect.d.ts.map +1 -1
  5. package/dist/commands/reflect.js +7 -0
  6. package/dist/commands/reflect.js.map +1 -1
  7. package/dist/commands/server.d.ts.map +1 -1
  8. package/dist/commands/server.js +126 -8
  9. package/dist/commands/server.js.map +1 -1
  10. package/dist/commands/setup.d.ts +1 -1
  11. package/dist/commands/setup.d.ts.map +1 -1
  12. package/dist/commands/setup.js.map +1 -1
  13. package/dist/core/Config.d.ts +12 -3
  14. package/dist/core/Config.d.ts.map +1 -1
  15. package/dist/core/Config.js +40 -6
  16. package/dist/core/Config.js.map +1 -1
  17. package/dist/core/FrameworkSessionStore.d.ts +1 -1
  18. package/dist/core/FrameworkSessionStore.d.ts.map +1 -1
  19. package/dist/core/PiCliIntelligenceProvider.d.ts +52 -0
  20. package/dist/core/PiCliIntelligenceProvider.d.ts.map +1 -0
  21. package/dist/core/PiCliIntelligenceProvider.js +71 -0
  22. package/dist/core/PiCliIntelligenceProvider.js.map +1 -0
  23. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  24. package/dist/core/PostUpdateMigrator.js +57 -0
  25. package/dist/core/PostUpdateMigrator.js.map +1 -1
  26. package/dist/core/PreCompactionFlush.d.ts +1 -1
  27. package/dist/core/PreCompactionFlush.d.ts.map +1 -1
  28. package/dist/core/ResumeValidator.d.ts +1 -1
  29. package/dist/core/ResumeValidator.d.ts.map +1 -1
  30. package/dist/core/SessionManager.d.ts +130 -0
  31. package/dist/core/SessionManager.d.ts.map +1 -1
  32. package/dist/core/SessionManager.js +545 -10
  33. package/dist/core/SessionManager.js.map +1 -1
  34. package/dist/core/TopicFrameworksStore.d.ts.map +1 -1
  35. package/dist/core/TopicFrameworksStore.js +3 -0
  36. package/dist/core/TopicFrameworksStore.js.map +1 -1
  37. package/dist/core/frameworkInjectionProcesses.d.ts.map +1 -1
  38. package/dist/core/frameworkInjectionProcesses.js +4 -0
  39. package/dist/core/frameworkInjectionProcesses.js.map +1 -1
  40. package/dist/core/frameworkSessionLaunch.d.ts +8 -0
  41. package/dist/core/frameworkSessionLaunch.d.ts.map +1 -1
  42. package/dist/core/frameworkSessionLaunch.js +73 -0
  43. package/dist/core/frameworkSessionLaunch.js.map +1 -1
  44. package/dist/core/intelligenceProviderFactory.d.ts +15 -1
  45. package/dist/core/intelligenceProviderFactory.d.ts.map +1 -1
  46. package/dist/core/intelligenceProviderFactory.js +39 -1
  47. package/dist/core/intelligenceProviderFactory.js.map +1 -1
  48. package/dist/core/types.d.ts +88 -8
  49. package/dist/core/types.d.ts.map +1 -1
  50. package/dist/core/types.js.map +1 -1
  51. package/dist/messaging/SpawnRequestManager.d.ts +14 -0
  52. package/dist/messaging/SpawnRequestManager.d.ts.map +1 -1
  53. package/dist/messaging/SpawnRequestManager.js +17 -0
  54. package/dist/messaging/SpawnRequestManager.js.map +1 -1
  55. package/dist/messaging/shared/telegramRelayPrompt.d.ts +1 -1
  56. package/dist/messaging/shared/telegramRelayPrompt.d.ts.map +1 -1
  57. package/dist/monitoring/ApprenticeshipCycleStore.d.ts +59 -1
  58. package/dist/monitoring/ApprenticeshipCycleStore.d.ts.map +1 -1
  59. package/dist/monitoring/ApprenticeshipCycleStore.js +77 -2
  60. package/dist/monitoring/ApprenticeshipCycleStore.js.map +1 -1
  61. package/dist/monitoring/ReapLog.d.ts +6 -0
  62. package/dist/monitoring/ReapLog.d.ts.map +1 -1
  63. package/dist/monitoring/ReapLog.js +1 -0
  64. package/dist/monitoring/ReapLog.js.map +1 -1
  65. package/dist/monitoring/SessionReaper.d.ts +1 -1
  66. package/dist/monitoring/SessionReaper.d.ts.map +1 -1
  67. package/dist/monitoring/SessionReaper.js.map +1 -1
  68. package/dist/monitoring/frameworkActivitySignals.d.ts.map +1 -1
  69. package/dist/monitoring/frameworkActivitySignals.js +21 -0
  70. package/dist/monitoring/frameworkActivitySignals.js.map +1 -1
  71. package/dist/monitoring/frameworkProcessSignals.d.ts.map +1 -1
  72. package/dist/monitoring/frameworkProcessSignals.js +22 -0
  73. package/dist/monitoring/frameworkProcessSignals.js.map +1 -1
  74. package/dist/providers/adapters/pi-cli/capabilities.d.ts +31 -0
  75. package/dist/providers/adapters/pi-cli/capabilities.d.ts.map +1 -0
  76. package/dist/providers/adapters/pi-cli/capabilities.js +40 -0
  77. package/dist/providers/adapters/pi-cli/capabilities.js.map +1 -0
  78. package/dist/providers/adapters/pi-cli/config.d.ts +65 -0
  79. package/dist/providers/adapters/pi-cli/config.d.ts.map +1 -0
  80. package/dist/providers/adapters/pi-cli/config.js +43 -0
  81. package/dist/providers/adapters/pi-cli/config.js.map +1 -0
  82. package/dist/providers/adapters/pi-cli/control/piHardKill.d.ts +19 -0
  83. package/dist/providers/adapters/pi-cli/control/piHardKill.d.ts.map +1 -0
  84. package/dist/providers/adapters/pi-cli/control/piHardKill.js +67 -0
  85. package/dist/providers/adapters/pi-cli/control/piHardKill.js.map +1 -0
  86. package/dist/providers/adapters/pi-cli/errors.d.ts +43 -0
  87. package/dist/providers/adapters/pi-cli/errors.d.ts.map +1 -0
  88. package/dist/providers/adapters/pi-cli/errors.js +71 -0
  89. package/dist/providers/adapters/pi-cli/errors.js.map +1 -0
  90. package/dist/providers/adapters/pi-cli/index.d.ts +39 -0
  91. package/dist/providers/adapters/pi-cli/index.d.ts.map +1 -0
  92. package/dist/providers/adapters/pi-cli/index.js +69 -0
  93. package/dist/providers/adapters/pi-cli/index.js.map +1 -0
  94. package/dist/providers/adapters/pi-cli/observability/sessionId.d.ts +27 -0
  95. package/dist/providers/adapters/pi-cli/observability/sessionId.d.ts.map +1 -0
  96. package/dist/providers/adapters/pi-cli/observability/sessionId.js +53 -0
  97. package/dist/providers/adapters/pi-cli/observability/sessionId.js.map +1 -0
  98. package/dist/providers/adapters/pi-cli/policy.d.ts +44 -0
  99. package/dist/providers/adapters/pi-cli/policy.d.ts.map +1 -0
  100. package/dist/providers/adapters/pi-cli/policy.js +74 -0
  101. package/dist/providers/adapters/pi-cli/policy.js.map +1 -0
  102. package/dist/providers/adapters/pi-cli/transport/agenticSessionRpc.d.ts +34 -0
  103. package/dist/providers/adapters/pi-cli/transport/agenticSessionRpc.d.ts.map +1 -0
  104. package/dist/providers/adapters/pi-cli/transport/agenticSessionRpc.js +194 -0
  105. package/dist/providers/adapters/pi-cli/transport/agenticSessionRpc.js.map +1 -0
  106. package/dist/providers/adapters/pi-cli/transport/oneShotCompletion.d.ts +33 -0
  107. package/dist/providers/adapters/pi-cli/transport/oneShotCompletion.d.ts.map +1 -0
  108. package/dist/providers/adapters/pi-cli/transport/oneShotCompletion.js +166 -0
  109. package/dist/providers/adapters/pi-cli/transport/oneShotCompletion.js.map +1 -0
  110. package/dist/providers/adapters/pi-cli/transport/piSpawn.d.ts +87 -0
  111. package/dist/providers/adapters/pi-cli/transport/piSpawn.d.ts.map +1 -0
  112. package/dist/providers/adapters/pi-cli/transport/piSpawn.js +242 -0
  113. package/dist/providers/adapters/pi-cli/transport/piSpawn.js.map +1 -0
  114. package/dist/providers/adapters/pi-cli/transport/rpcClient.d.ts +103 -0
  115. package/dist/providers/adapters/pi-cli/transport/rpcClient.d.ts.map +1 -0
  116. package/dist/providers/adapters/pi-cli/transport/rpcClient.js +238 -0
  117. package/dist/providers/adapters/pi-cli/transport/rpcClient.js.map +1 -0
  118. package/dist/providers/bootRegistration.d.ts +38 -0
  119. package/dist/providers/bootRegistration.d.ts.map +1 -1
  120. package/dist/providers/bootRegistration.js +52 -0
  121. package/dist/providers/bootRegistration.js.map +1 -1
  122. package/dist/providers/parity/rules/skillParityRule.d.ts.map +1 -1
  123. package/dist/providers/parity/rules/skillParityRule.js +6 -0
  124. package/dist/providers/parity/rules/skillParityRule.js.map +1 -1
  125. package/dist/scaffold/templates.d.ts.map +1 -1
  126. package/dist/scaffold/templates.js +3 -2
  127. package/dist/scaffold/templates.js.map +1 -1
  128. package/dist/scheduler/JobScheduler.d.ts.map +1 -1
  129. package/dist/scheduler/JobScheduler.js +22 -0
  130. package/dist/scheduler/JobScheduler.js.map +1 -1
  131. package/dist/server/routes.d.ts.map +1 -1
  132. package/dist/server/routes.js +10 -3
  133. package/dist/server/routes.js.map +1 -1
  134. package/dist/threadline/PipeSessionSpawner.d.ts +23 -0
  135. package/dist/threadline/PipeSessionSpawner.d.ts.map +1 -1
  136. package/dist/threadline/PipeSessionSpawner.js +27 -0
  137. package/dist/threadline/PipeSessionSpawner.js.map +1 -1
  138. package/package.json +2 -2
  139. package/scripts/lint-no-direct-destructive.js +3 -0
  140. package/scripts/lint-no-unfunneled-headless-launch.js +128 -0
  141. package/src/data/builtin-manifest.json +65 -65
  142. package/src/scaffold/templates.ts +3 -2
  143. package/upgrades/1.3.344.md +46 -0
  144. package/upgrades/1.3.345.md +154 -0
  145. package/upgrades/side-effects/apprenticeship-layer-balance.md +50 -0
  146. package/upgrades/side-effects/june15-headless-spawn-reroute.md +105 -0
  147. package/upgrades/side-effects/pi-harness-integration.md +82 -0
@@ -0,0 +1,71 @@
1
+ /**
2
+ * PiCliIntelligenceProvider — IntelligenceProvider using the pi coding agent
3
+ * (PI-HARNESS-INTEGRATION-SPEC §4.4).
4
+ *
5
+ * Sibling of Claude/Codex/GeminiCliIntelligenceProvider: routes internal
6
+ * component judgment calls (sentinels, gates, reviewers) through pi's
7
+ * verified one-shot (`pi -p --mode json --no-session --offline`). This is
8
+ * the ALIVE path for `sessions.componentFrameworks` routing to 'pi-cli' —
9
+ * the registry adapter (src/providers/adapters/pi-cli/) shares the SAME
10
+ * transport implementation (createOneShotCompletion), so the alive path and
11
+ * the registry adapter can never diverge on safety:
12
+ *
13
+ * - the env allowlist + billing-var hard-delete (piSpawn.buildPiChildEnv)
14
+ * - the STRUCTURAL SUBSCRIPTION GUARD (policy.assertPiProviderAllowed) —
15
+ * an Anthropic/Claude-routed model pattern throws before any spawn;
16
+ * an UNSET model pattern is also denied (pi's ambient default could be
17
+ * an Anthropic login), which is why this provider REQUIRES an explicit
18
+ * model pattern at construction.
19
+ *
20
+ * Model semantics: pi is multi-provider — the pattern is `provider/id`
21
+ * (e.g. 'openai-codex/gpt-5.5' or a models.json custom provider). Tier
22
+ * hints from callers (fast/balanced/capable) have no universal pi mapping
23
+ * and resolve to the configured pattern; a caller-supplied EXPLICIT pattern
24
+ * (contains '/') wins and is re-checked by the guard.
25
+ */
26
+ import { createOneShotCompletion } from '../providers/adapters/pi-cli/transport/oneShotCompletion.js';
27
+ import { assertPiProviderAllowed } from '../providers/adapters/pi-cli/policy.js';
28
+ const DEFAULT_TIMEOUT_MS = 60_000;
29
+ export class PiCliIntelligenceProvider {
30
+ oneShot;
31
+ model;
32
+ allowAnthropicProviders;
33
+ constructor(options) {
34
+ this.model = options.model;
35
+ this.allowAnthropicProviders = options.allowAnthropicProviders;
36
+ // Fail at CONSTRUCTION when the configured pattern is denied — a
37
+ // misconfigured pi route should break loudly at boot wiring, not on the
38
+ // first sentinel call hours later.
39
+ assertPiProviderAllowed(this.model, {
40
+ ...(this.allowAnthropicProviders !== undefined
41
+ ? { allowAnthropicProviders: this.allowAnthropicProviders }
42
+ : {}),
43
+ });
44
+ this.oneShot = createOneShotCompletion({
45
+ piPath: options.piPath,
46
+ model: options.model,
47
+ ...(options.allowAnthropicProviders !== undefined
48
+ ? { allowAnthropicProviders: options.allowAnthropicProviders }
49
+ : {}),
50
+ ...(options.maxOutputBytes !== undefined ? { maxOutputBytes: options.maxOutputBytes } : {}),
51
+ });
52
+ }
53
+ async evaluate(prompt, options) {
54
+ // Per-call model hints (tier names like 'fast'/'haiku' or raw ids) are
55
+ // deliberately IGNORED for pi: tiers have no universal pi mapping (the
56
+ // provider half of the pattern decides the vocabulary), and honoring
57
+ // arbitrary per-call patterns would open a per-call bypass surface on
58
+ // the subscription guard. The construction-time pattern — already
59
+ // guard-checked — governs every call. This mirrors the spec's rule that
60
+ // the override is file-config-only, never per-call (§4.3).
61
+ const result = await this.oneShot.evaluate(prompt, {
62
+ timeoutMs: options?.timeoutMs ?? DEFAULT_TIMEOUT_MS,
63
+ });
64
+ const text = result.text.trim();
65
+ if (!text) {
66
+ throw new Error('pi CLI returned an empty completion');
67
+ }
68
+ return text;
69
+ }
70
+ }
71
+ //# sourceMappingURL=PiCliIntelligenceProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PiCliIntelligenceProvider.js","sourceRoot":"","sources":["../../src/core/PiCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6DAA6D,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAqBlC,MAAM,OAAO,yBAAyB;IACnB,OAAO,CAAoB;IAC3B,KAAK,CAAS;IACd,uBAAuB,CAAsB;IAE9D,YAAY,OAAyC;QACnD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC;QAC/D,iEAAiE;QACjE,wEAAwE;QACxE,mCAAmC;QACnC,uBAAuB,CAAC,IAAI,CAAC,KAAK,EAAE;YAClC,GAAG,CAAC,IAAI,CAAC,uBAAuB,KAAK,SAAS;gBAC5C,CAAC,CAAC,EAAE,uBAAuB,EAAE,IAAI,CAAC,uBAAuB,EAAE;gBAC3D,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,uBAAuB,CAAC;YACrC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,GAAG,CAAC,OAAO,CAAC,uBAAuB,KAAK,S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entorship instance plugs into (e.
2774
2774
  - Transition status (the ONLY way it changes — runs the gate): \`POST /apprenticeship/instances/:id/transition\` \`{"to":"active"}\` (refused + 409 on a failed gate or illegal transition; \`complete\` is terminal). Preview without mutating: \`.../can-start\` · \`.../can-complete\`.
2775
2775
  - Record a manual cycle: \`POST /apprenticeship/cycles\` with \`instanceId\`, positive \`cycleNumber\`, \`task\`, \`menteeOutput\`, optional \`mentorFlagged\` / \`overseerDifferential\` / \`coaching\` / \`infraItems\`, \`kind\` (\`mentor-mentee-differential\`, \`overseer-apprentice-devreview\`, \`overseer-mentee-direct\`), and \`channel\` (\`telegram-playwright\`, \`threadline-backup\`, \`direct-shortcut\`, \`unknown\`). A \`telegram-playwright\` cycle additionally REQUIRES a \`transcriptAudit\` block — \`{ topicIds, window: {start,end}, summary, findingDedupKeys, generatedAt, ledger: 'local'|'remote'|'dry-run'|'failed' }\` — built from \`instar dev:post-drive-transcript-audit\` run over the drive window (use \`--history-base-url\` when the transcript lives on the mentee's server; \`ledger:'local'\` claims are cross-checked against the real framework ledger). Use this when the overseer or manual loop found a differential outside the automated mentor tick.
2776
2776
  - **When to use** (PROACTIVE): when starting or closing a mentorship/apprenticeship instance, drive it through the registry + transitions so the retro-harvest is reviewed before the next instance starts and the lessons are captured before this one closes — never track the lifecycle by memory.
2777
+ - Layer-balance health: \`GET /apprenticeship/instances/:id/role-coverage\` returns a \`keystoneBalance\` block — \`{ keystoneAxis, keystoneCycleCount, lastKeystoneAt, oversightSinceKeystone, starved, reason }\` — answering "is my deepest layer (the real mentor→mentee drive) actually firing, or have I drifted into just reviewing/overseeing?" \`starved:true\` = the mentee layer is under-firing relative to ongoing activity (the silent "mentor-heavy/mentee-light" drift). Observe-only; tune via \`?oversightStarvationThreshold=N\`. **When to use** (PROACTIVE): before deciding the loop is healthy — if starved, drive the mentee layer (a real \`mentor-mentee-differential\` cycle through the dogfooded channel), not another review.
2777
2778
  `;
2778
2779
  content += '\n' + apprenticeshipSection;
2779
2780
  patched = true;
2780
2781
  result.upgraded.push('CLAUDE.md: added Apprenticeship Program section');
2781
2782
  }
2783
+ // Layer-balance signal (2026-06-06): agents that ALREADY carry the
2784
+ // Apprenticeship Program section need the keystoneBalance health line — an
2785
+ // agent that doesn't know to CHECK the balance can't notice the mentee
2786
+ // layer starving. Content-sniffed insertion; idempotent (only when the
2787
+ // section exists AND the line is absent).
2788
+ if (content.includes('**Apprenticeship Program**') && !content.includes('keystoneBalance')) {
2789
+ const anchor = '- **When to use** (PROACTIVE): when starting or closing a mentorship/apprenticeship instance, drive it through the registry + transitions so the retro-harvest is reviewed before the next instance starts and the lessons are captured before this one closes — never track the lifecycle by memory.';
2790
+ if (content.includes(anchor)) {
2791
+ const balanceLine = '\n- Layer-balance health: `GET /apprenticeship/instances/:id/role-coverage` returns a `keystoneBalance` block — `{ keystoneAxis, keystoneCycleCount, lastKeystoneAt, oversightSinceKeystone, starved, reason }` — answering "is my deepest layer (the real mentor→mentee drive) actually firing, or have I drifted into just reviewing/overseeing?" `starved:true` = the mentee layer is under-firing relative to ongoing activity (the silent "mentor-heavy/mentee-light" drift). Observe-only; tune via `?oversightStarvationThreshold=N`. **When to use** (PROACTIVE): before deciding the loop is healthy — if starved, drive the mentee layer (a real `mentor-mentee-differential` cycle through the dogfooded channel), not another review.';
2792
+ content = content.replace(anchor, anchor + balanceLine);
2793
+ patched = true;
2794
+ result.upgraded.push('CLAUDE.md: added apprenticeship layer-balance (keystoneBalance) awareness');
2795
+ }
2796
+ }
2782
2797
  // Transcript-audit gate (#864 follow-through): agents that ALREADY carry the
2783
2798
  // Apprenticeship Program section have the pre-gate "Record a manual cycle"
2784
2799
  // line, which no longer teaches the full required shape — telegram-playwright
@@ -2930,6 +2945,34 @@ Your internal background LLM calls (sentinels, gates, extractors) normally run a
2930
2945
  patched = true;
2931
2946
  result.upgraded.push('CLAUDE.md: added Anthropic Subscription-Path Routing (/providers/registry) awareness (provider-substrate-live-wiring)');
2932
2947
  }
2948
+ // subscription-path SCOPE correction (june15-headless-spawn-reroute,
2949
+ // review finding F2): PR 1's block scoped the lever to "internal
2950
+ // background LLM calls" — after PR 2 the SAME mode key also reroutes
2951
+ // headless job / A2A / dispatch spawns, so the deployed wording is
2952
+ // factually incomplete. The PR-1 sniff ('/providers/registry') is
2953
+ // already satisfied on every deployed agent and CANNOT gate this patch —
2954
+ // sniff on the NEW phrase instead, and splice the corrected scope line
2955
+ // into the existing section. Idempotent: skips once the phrase exists.
2956
+ if (content.includes('/providers/registry') &&
2957
+ !content.includes('headless job / agent-to-agent / dispatch spawns')) {
2958
+ // PR 1 shipped TWO wordings: the migrator section said "routes them",
2959
+ // the fresh-init template said "can route them" — match either.
2960
+ const oldScopeSentences = [
2961
+ 'Your internal background LLM calls (sentinels, gates, extractors) normally run as \`claude -p\` one-shots, which bill the Agent SDK credit pot after 2026-06-15. The subscription-path lever routes them through a pool of long-lived interactive Claude sessions instead — the path that keeps working when the pot is empty.',
2962
+ 'Your internal background LLM calls (sentinels, gates, extractors) normally run as \`claude -p\` one-shots, which bill the Agent SDK credit pot after 2026-06-15. The subscription-path lever can route them through a pool of long-lived interactive Claude sessions instead — the path that keeps working when the pot is empty.',
2963
+ ];
2964
+ const newScopeSentence = 'Your internal background LLM calls (sentinels, gates, extractors) AND your headless job / agent-to-agent / dispatch spawns normally run as \`claude -p\` one-shots, which bill the Agent SDK credit pot after 2026-06-15. The subscription-path lever routes BOTH through interactive Claude sessions instead — the path that keeps working when the pot is empty. (Rerouted job/A2A spawns run as normal interactive sessions with a completion marker, a concurrency cap, and quota backpressure — each session\'s \`launchLane\` in \`GET /sessions\` shows which billing lane it used.)';
2965
+ for (const oldScopeSentence of oldScopeSentences) {
2966
+ if (content.includes(oldScopeSentence)) {
2967
+ content = content.replace(oldScopeSentence, newScopeSentence);
2968
+ patched = true;
2969
+ result.upgraded.push('CLAUDE.md: corrected Subscription-Path Routing scope — lever now covers job/A2A/dispatch spawns too (june15-headless-spawn-reroute)');
2970
+ break;
2971
+ }
2972
+ }
2973
+ // A hand-edited section that no longer carries either PR-1 sentence is
2974
+ // left untouched — never clobber user-customized wording.
2975
+ }
2933
2976
  // session-clock (Agent Awareness + Migration Parity): existing agents must
2934
2977
  // learn they can ask how long they've been running / how much is left,
2935
2978
  // instead of guessing. Content-sniff on the route marker.
@@ -3451,6 +3494,20 @@ Run different INTERNAL components on different agentic frameworks to spread LLM
3451
3494
  patched = true;
3452
3495
  result.upgraded.push('CLAUDE.md: added Per-Component Framework Routing awareness');
3453
3496
  }
3497
+ // Pi framework awareness (PI-HARNESS-INTEGRATION-SPEC Phase A, 2026-06-06)
3498
+ // — Agent Awareness + Migration Parity: existing agents must learn that
3499
+ // 'pi-cli' is now a valid fourth framework value anywhere frameworks are
3500
+ // configured (topicFrameworks, enabledFrameworks, componentFrameworks).
3501
+ // Ships DARK (requires the pi binary + explicit opt-in), so this is a
3502
+ // one-liner, not a section. Content-sniffed for idempotency.
3503
+ if (content.includes('Per-Component Framework Routing') && !content.includes("pi-cli")) {
3504
+ const piNote = `
3505
+ **Pi framework (additive)** — \`pi-cli\` is a valid fourth framework value wherever frameworks are configured (\`topicFrameworks\`, \`enabledFrameworks\`, \`sessions.componentFrameworks\`). It drives the pi agent harness (\`npm install -g @earendil-works/pi-coding-agent --ignore-scripts\`); sessions run pi's TUI in tmux exactly like other frameworks (dashboard streaming unchanged). ADDITIVE ONLY: it never displaces a subscription path — Claude work stays on Claude Code. Ships dark; nothing changes unless explicitly enabled. (Spec: \`docs/specs/PI-HARNESS-INTEGRATION-SPEC.md\`.)
3506
+ `;
3507
+ content += '\n' + piNote;
3508
+ patched = true;
3509
+ result.upgraded.push('CLAUDE.md: added pi-cli framework awareness note');
3510
+ }
3454
3511
  // Correction & Preference Learning Sentinel (Slice 1a) §7 — Agent Awareness +
3455
3512
  // Migration Parity: existing agents must learn about the preferences read-
3456
3513
  // surface (the session-start hook now fetches /preferences/session-context