@llblab/pi-actors 0.42.3 → 0.43.1

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 (279) hide show
  1. package/AGENTS.md +127 -175
  2. package/BACKLOG.md +189 -1
  3. package/CHANGELOG.md +183 -292
  4. package/README.md +115 -276
  5. package/dist/fixtures/protocol/control-endpoint.json +6 -0
  6. package/dist/fixtures/protocol/control-record.json +9 -0
  7. package/dist/fixtures/protocol/recipe-summary.json +4 -12
  8. package/dist/fixtures/protocol/trace-event.json +9 -0
  9. package/dist/index.js +1 -1
  10. package/dist/lib/async-runs.d.ts +15 -38
  11. package/dist/lib/async-runs.js +173 -111
  12. package/dist/lib/automatic-review-runtime.d.ts +1 -1
  13. package/dist/lib/automatic-review-runtime.js +5 -5
  14. package/dist/lib/command-templates.d.ts +2 -0
  15. package/dist/lib/command-templates.js +38 -4
  16. package/dist/lib/control-projection.d.ts +20 -0
  17. package/dist/lib/control-projection.js +66 -0
  18. package/dist/lib/control.d.ts +15 -0
  19. package/dist/lib/control.js +97 -0
  20. package/dist/lib/draft-sleep.js +3 -3
  21. package/dist/lib/execution-sessions.d.ts +17 -0
  22. package/dist/lib/execution-sessions.js +85 -0
  23. package/dist/lib/file-state.d.ts +2 -0
  24. package/dist/lib/file-state.js +114 -46
  25. package/dist/lib/inspector-actions.d.ts +2 -2
  26. package/dist/lib/inspector-actions.js +2 -2
  27. package/dist/lib/inspector-command.js +3 -3
  28. package/dist/lib/inspector-overlay.d.ts +54 -70
  29. package/dist/lib/inspector-overlay.js +576 -910
  30. package/dist/lib/inspector.d.ts +3 -71
  31. package/dist/lib/inspector.js +19 -665
  32. package/dist/lib/limits.d.ts +7 -3
  33. package/dist/lib/limits.js +7 -3
  34. package/dist/lib/observability.d.ts +16 -16
  35. package/dist/lib/observability.js +43 -82
  36. package/dist/lib/prompts.d.ts +1 -1
  37. package/dist/lib/prompts.js +3 -3
  38. package/dist/lib/recipe-control.d.ts +7 -0
  39. package/dist/lib/recipe-control.js +43 -0
  40. package/dist/lib/recipes-discovery.js +2 -0
  41. package/dist/lib/recipes-references.d.ts +1 -14
  42. package/dist/lib/recipes-references.js +6 -21
  43. package/dist/lib/review-control.d.ts +1 -1
  44. package/dist/lib/review-control.js +4 -5
  45. package/dist/lib/review-projection.js +1 -5
  46. package/dist/lib/run-ui-runtime.js +2 -2
  47. package/dist/lib/runs-control-delivery.d.ts +28 -0
  48. package/dist/lib/runs-control-delivery.js +150 -0
  49. package/dist/lib/runs-controls.d.ts +37 -0
  50. package/dist/lib/runs-controls.js +146 -0
  51. package/dist/lib/runs-retention.d.ts +7 -0
  52. package/dist/lib/runs-retention.js +27 -3
  53. package/dist/lib/runs-start.js +4 -2
  54. package/dist/lib/runs-status.js +11 -6
  55. package/dist/lib/runs-trace.d.ts +24 -0
  56. package/dist/lib/runs-trace.js +102 -0
  57. package/dist/lib/runtime-identity.d.ts +7 -0
  58. package/dist/lib/runtime-identity.js +35 -0
  59. package/dist/lib/runtime-notifier.d.ts +1 -1
  60. package/dist/lib/runtime-notifier.js +1 -1
  61. package/dist/lib/runtime-triage.d.ts +29 -0
  62. package/dist/lib/runtime-triage.js +76 -0
  63. package/dist/lib/tool-review-scheduler.js +7 -7
  64. package/dist/lib/tools-inspect.d.ts +3 -3
  65. package/dist/lib/tools-inspect.js +241 -707
  66. package/dist/lib/tools-local.js +2 -10
  67. package/dist/lib/tools-message.d.ts +6 -7
  68. package/dist/lib/tools-message.js +95 -396
  69. package/dist/lib/tools-response.d.ts +1 -5
  70. package/dist/lib/tools-response.js +5 -48
  71. package/dist/lib/tools-spawn.js +16 -28
  72. package/dist/lib/tools.d.ts +1 -1
  73. package/dist/lib/tools.js +2 -3
  74. package/dist/lib/trace-projection.d.ts +22 -0
  75. package/dist/lib/trace-projection.js +185 -0
  76. package/dist/recipes/draft-review.json +0 -10
  77. package/dist/recipes/lens-swarm.json +0 -14
  78. package/dist/recipes/music-player.json +10 -19
  79. package/dist/recipes/pipeline-architect-coordinator.json +0 -11
  80. package/dist/recipes/pipeline-artifact-bundle.json +1 -22
  81. package/dist/recipes/pipeline-artifact-report.json +1 -18
  82. package/dist/recipes/pipeline-artifact-write.json +1 -18
  83. package/dist/recipes/pipeline-async-run-ops.json +0 -12
  84. package/dist/recipes/pipeline-checkpoint-continuation.json +0 -14
  85. package/dist/recipes/pipeline-development-tasking.json +0 -12
  86. package/dist/recipes/pipeline-docs-maintenance.json +0 -12
  87. package/dist/recipes/pipeline-media-library.json +0 -12
  88. package/dist/recipes/pipeline-quorum-review.json +0 -12
  89. package/dist/recipes/pipeline-release-readiness.json +0 -12
  90. package/dist/recipes/pipeline-release-summary.json +0 -12
  91. package/dist/recipes/pipeline-repo-health.json +0 -12
  92. package/dist/recipes/pipeline-research-synthesis.json +0 -11
  93. package/dist/recipes/pipeline-review-readiness.json +0 -12
  94. package/dist/recipes/resource-locker.json +27 -0
  95. package/dist/recipes/subagent-artifact.json +0 -9
  96. package/dist/recipes/subagent-checkpoint.json +0 -10
  97. package/dist/recipes/subagent-conflict-report.json +0 -11
  98. package/dist/recipes/subagent-contradiction-map.json +0 -11
  99. package/dist/recipes/subagent-critic.json +0 -11
  100. package/dist/recipes/subagent-evidence-map.json +0 -11
  101. package/dist/recipes/subagent-followup.json +0 -10
  102. package/dist/recipes/subagent-judge.json +0 -11
  103. package/dist/recipes/subagent-merge.json +0 -11
  104. package/dist/recipes/subagent-normalize.json +0 -11
  105. package/dist/recipes/subagent-plan.json +0 -11
  106. package/dist/recipes/subagent-preflight.json +0 -11
  107. package/dist/recipes/subagent-prompt.json +0 -10
  108. package/dist/recipes/subagent-quorum.json +0 -10
  109. package/dist/recipes/subagent-review-coordinator.json +0 -14
  110. package/dist/recipes/subagent-review.json +0 -11
  111. package/dist/recipes/subagent-task-card.json +0 -11
  112. package/dist/recipes/subagent-tools.json +0 -10
  113. package/dist/recipes/subagent-verify.json +0 -11
  114. package/dist/recipes/subagents-prompts.json +0 -10
  115. package/dist/recipes/tool-review.json +0 -10
  116. package/dist/scripts/async-runner.mjs +25 -25
  117. package/dist/scripts/conformance.mjs +4 -2
  118. package/dist/scripts/locker.mjs +196 -69
  119. package/dist/scripts/music-player.mjs +162 -159
  120. package/dist/scripts/recipe-utils.mjs +6 -96
  121. package/dist/scripts/release-gates.mjs +91 -0
  122. package/dist/scripts/validate-recipe.mjs +8 -57
  123. package/dist/skills/actors/SKILL.md +57 -265
  124. package/dist/skills/swarm/SKILL.md +10 -34
  125. package/docs/0.43-baseline.md +39 -0
  126. package/docs/README.md +4 -6
  127. package/docs/actor-inspector.md +26 -64
  128. package/docs/async-runs.md +81 -328
  129. package/docs/command-templates.md +8 -118
  130. package/docs/recipe-library.md +55 -182
  131. package/docs/releasing.md +28 -0
  132. package/docs/template-recipes.md +76 -289
  133. package/docs/tool-registry.md +41 -161
  134. package/fixtures/protocol/control-endpoint.json +6 -0
  135. package/fixtures/protocol/control-record.json +9 -0
  136. package/fixtures/protocol/recipe-summary.json +4 -12
  137. package/fixtures/protocol/trace-event.json +9 -0
  138. package/index.ts +1 -1
  139. package/lib/async-runs.ts +218 -204
  140. package/lib/automatic-review-runtime.ts +7 -7
  141. package/lib/command-templates.ts +44 -4
  142. package/lib/control-projection.ts +105 -0
  143. package/lib/control.ts +117 -0
  144. package/lib/draft-sleep.ts +3 -3
  145. package/lib/execution-sessions.ts +111 -0
  146. package/lib/file-state.ts +84 -64
  147. package/lib/inspector-actions.ts +2 -2
  148. package/lib/inspector-command.ts +3 -3
  149. package/lib/inspector-overlay.ts +617 -1126
  150. package/lib/inspector.ts +46 -979
  151. package/lib/limits.ts +7 -3
  152. package/lib/observability.ts +60 -101
  153. package/lib/prompts.ts +3 -3
  154. package/lib/recipe-control.ts +52 -0
  155. package/lib/recipes-discovery.ts +2 -0
  156. package/lib/recipes-references.ts +9 -45
  157. package/lib/review-control.ts +4 -5
  158. package/lib/review-projection.ts +1 -5
  159. package/lib/run-ui-runtime.ts +2 -2
  160. package/lib/runs-control-delivery.ts +209 -0
  161. package/lib/runs-controls.ts +213 -0
  162. package/lib/runs-retention.ts +38 -3
  163. package/lib/runs-start.ts +4 -2
  164. package/lib/runs-status.ts +11 -6
  165. package/lib/runs-trace.ts +136 -0
  166. package/lib/runtime-identity.ts +39 -0
  167. package/lib/runtime-notifier.ts +1 -1
  168. package/lib/runtime-triage.ts +120 -0
  169. package/lib/tool-review-scheduler.ts +7 -7
  170. package/lib/tools-inspect.ts +283 -900
  171. package/lib/tools-local.ts +2 -12
  172. package/lib/tools-message.ts +112 -520
  173. package/lib/tools-response.ts +5 -64
  174. package/lib/tools-spawn.ts +16 -32
  175. package/lib/tools.ts +5 -6
  176. package/lib/trace-projection.ts +244 -0
  177. package/package.json +2 -1
  178. package/recipes/draft-review.json +0 -10
  179. package/recipes/lens-swarm.json +0 -14
  180. package/recipes/music-player.json +10 -19
  181. package/recipes/pipeline-architect-coordinator.json +0 -11
  182. package/recipes/pipeline-artifact-bundle.json +1 -22
  183. package/recipes/pipeline-artifact-report.json +1 -18
  184. package/recipes/pipeline-artifact-write.json +1 -18
  185. package/recipes/pipeline-async-run-ops.json +0 -12
  186. package/recipes/pipeline-checkpoint-continuation.json +0 -14
  187. package/recipes/pipeline-development-tasking.json +0 -12
  188. package/recipes/pipeline-docs-maintenance.json +0 -12
  189. package/recipes/pipeline-media-library.json +0 -12
  190. package/recipes/pipeline-quorum-review.json +0 -12
  191. package/recipes/pipeline-release-readiness.json +0 -12
  192. package/recipes/pipeline-release-summary.json +0 -12
  193. package/recipes/pipeline-repo-health.json +0 -12
  194. package/recipes/pipeline-research-synthesis.json +0 -11
  195. package/recipes/pipeline-review-readiness.json +0 -12
  196. package/recipes/resource-locker.json +27 -0
  197. package/recipes/subagent-artifact.json +0 -9
  198. package/recipes/subagent-checkpoint.json +0 -10
  199. package/recipes/subagent-conflict-report.json +0 -11
  200. package/recipes/subagent-contradiction-map.json +0 -11
  201. package/recipes/subagent-critic.json +0 -11
  202. package/recipes/subagent-evidence-map.json +0 -11
  203. package/recipes/subagent-followup.json +0 -10
  204. package/recipes/subagent-judge.json +0 -11
  205. package/recipes/subagent-merge.json +0 -11
  206. package/recipes/subagent-normalize.json +0 -11
  207. package/recipes/subagent-plan.json +0 -11
  208. package/recipes/subagent-preflight.json +0 -11
  209. package/recipes/subagent-prompt.json +0 -10
  210. package/recipes/subagent-quorum.json +0 -10
  211. package/recipes/subagent-review-coordinator.json +0 -14
  212. package/recipes/subagent-review.json +0 -11
  213. package/recipes/subagent-task-card.json +0 -11
  214. package/recipes/subagent-tools.json +0 -10
  215. package/recipes/subagent-verify.json +0 -11
  216. package/recipes/subagents-prompts.json +0 -10
  217. package/recipes/tool-review.json +0 -10
  218. package/scripts/async-runner.mjs +25 -25
  219. package/scripts/conformance.mjs +4 -2
  220. package/scripts/locker.mjs +196 -69
  221. package/scripts/music-player.mjs +162 -159
  222. package/scripts/recipe-utils.mjs +6 -96
  223. package/scripts/release-gates.mjs +91 -0
  224. package/scripts/validate-recipe.mjs +8 -57
  225. package/skills/actors/SKILL.md +57 -265
  226. package/skills/swarm/SKILL.md +10 -34
  227. package/dist/fixtures/protocol/actor-message-branch.json +0 -13
  228. package/dist/fixtures/protocol/mailbox-contract.json +0 -15
  229. package/dist/fixtures/protocol/room-message.json +0 -11
  230. package/dist/fixtures/protocol/room-roster.json +0 -11
  231. package/dist/fixtures/protocol/run-inbox-message.json +0 -9
  232. package/dist/fixtures/protocol/run-outbox-event.json +0 -9
  233. package/dist/lib/mailbox-loop.d.ts +0 -41
  234. package/dist/lib/mailbox-loop.js +0 -60
  235. package/dist/lib/messages.d.ts +0 -25
  236. package/dist/lib/messages.js +0 -122
  237. package/dist/lib/rooms.d.ts +0 -104
  238. package/dist/lib/rooms.js +0 -647
  239. package/dist/lib/runs-mailbox.d.ts +0 -25
  240. package/dist/lib/runs-mailbox.js +0 -146
  241. package/dist/lib/runs-messages.d.ts +0 -15
  242. package/dist/lib/runs-messages.js +0 -179
  243. package/dist/lib/runs-outbox.d.ts +0 -41
  244. package/dist/lib/runs-outbox.js +0 -87
  245. package/dist/lib/tools-mailbox.d.ts +0 -8
  246. package/dist/lib/tools-mailbox.js +0 -48
  247. package/dist/recipes/actor-worker.json +0 -39
  248. package/dist/recipes/coordinator-locker.json +0 -45
  249. package/dist/recipes/locker.json +0 -45
  250. package/dist/recipes/pipeline-room-swarm.json +0 -50
  251. package/dist/recipes/subagent-message.json +0 -32
  252. package/dist/recipes/utility-actor-message.json +0 -23
  253. package/dist/scripts/actor-worker.mjs +0 -214
  254. package/dist/scripts/coordinator.mjs +0 -799
  255. package/docs/actor-messages.md +0 -225
  256. package/docs/actors-deep-reference.md +0 -66
  257. package/docs/component-recipes.md +0 -148
  258. package/docs/task-first-recipes.md +0 -263
  259. package/fixtures/protocol/actor-message-branch.json +0 -13
  260. package/fixtures/protocol/mailbox-contract.json +0 -15
  261. package/fixtures/protocol/room-message.json +0 -11
  262. package/fixtures/protocol/room-roster.json +0 -11
  263. package/fixtures/protocol/run-inbox-message.json +0 -9
  264. package/fixtures/protocol/run-outbox-event.json +0 -9
  265. package/lib/mailbox-loop.ts +0 -144
  266. package/lib/messages.ts +0 -151
  267. package/lib/rooms.ts +0 -939
  268. package/lib/runs-mailbox.ts +0 -208
  269. package/lib/runs-messages.ts +0 -252
  270. package/lib/runs-outbox.ts +0 -144
  271. package/lib/tools-mailbox.ts +0 -56
  272. package/recipes/actor-worker.json +0 -39
  273. package/recipes/coordinator-locker.json +0 -45
  274. package/recipes/locker.json +0 -45
  275. package/recipes/pipeline-room-swarm.json +0 -50
  276. package/recipes/subagent-message.json +0 -32
  277. package/recipes/utility-actor-message.json +0 -23
  278. package/scripts/actor-worker.mjs +0 -214
  279. package/scripts/coordinator.mjs +0 -799
package/AGENTS.md CHANGED
@@ -2,191 +2,143 @@
2
2
 
3
3
  ## Meta-Protocol Principles
4
4
 
5
- - `Constraint-Driven Evolution`: Add structure when real project constraints justify it.
6
- - `Single Source of Truth`: Keep durable protocol, open work, completed delivery, and docs in separate files.
7
- - `Context Hygiene`: Compress stale context before it becomes coordination drag.
8
- - `Boundary Clarity`: README is the human entrypoint, `AGENTS.md` is durable protocol, `BACKLOG.md` is open work, and `CHANGELOG.md` is delivery history.
5
+ - `README.md`: human product entrypoint.
6
+ - `AGENTS.md`: durable implementation protocol.
7
+ - `BACKLOG.md`: canonical future-only work.
8
+ - `CHANGELOG.md`: completed delivery history.
9
+ - `docs/README.md`: documentation index.
10
+
11
+ Keep these surfaces distinct and reconcile them after meaningful changes. Every release section, historical or new, keeps at most 8 outcome records of at most 512 characters.
9
12
 
10
13
  ## Concept
11
14
 
12
- `pi-actors` is a local-first actor runtime and orchestrator for Pi. It wraps trusted local programs, scripts, services, pipelines, and recipes as addressable actors that agents can `spawn`, control with typed `message` envelopes, and observe with `inspect`. It also persists user/agent-registered actor-control tools as recipe files under `~/.pi/agent/recipes`, giving agents durable operational muscle memory for launching and managing the local actor zoo.
15
+ `pi-actors` is a local Run kernel and persistent capability registry for Pi:
16
+
17
+ ```text
18
+ Recipe --spawn--> Run
19
+ Run = Recipe + Trace + Control
20
+ ```
21
+
22
+ An actor is any runnable local capability, including a script, tool, service, pipeline, or subagent. Recipes define actors' reusable execution. Runs are concrete actor instances and own one generation of execution and evidence. Trace owns observations. Control owns actor-local inputs for services that actually consume them. `register_tool` persists capabilities separately.
13
23
 
14
- Treat this extension as an experimental self-evolution membrane for the agent harness: a way for agents that are not pretrained on local workflows to acquire, preserve, inspect, and refine operational capabilities through explicit local actors, recipes, fixtures, skills, and state rather than hidden assumptions. Keep that potential grounded in small, testable, operator-visible protocol slices.
24
+ Public Run verbs remain `spawn`, `message`, and `inspect`.
15
25
 
16
- ## Topology
26
+ ## Core Structure
17
27
 
18
28
  ```text
19
29
  Pi host
20
- -> index.ts composition root
21
- -> lib/tools*.ts / prompts.ts public tool + injected prompt surface
22
- -> lib/runtime.ts / registry.ts active user recipe tools
23
- -> lib/recipes-*.ts packaged/user/draft recipe discovery
24
- -> lib/async-runs.ts spawn lifecycle and run state
25
- -> lib/rooms.ts room, roster, mailbox, communication log
26
- -> scripts/*.mjs self-contained process entrypoints
27
- -> recipes/*.json packaged actor components
28
- -> skills/* + docs/* agent guidance and transportable specs
30
+ -> index.ts composition root
31
+ -> lib/tools*.ts public tool adapters
32
+ -> lib/runtime.ts / registry.ts active user Recipe tools
33
+ -> lib/recipes-*.ts Recipe resolution/evolution
34
+ -> lib/async-runs.ts Run lifecycle facade
35
+ -> lib/runs-*.ts focused lifecycle/evidence domains
36
+ -> lib/observability.ts terminal + Trace-attention observation
37
+ -> lib/inspector*.ts owner-filtered actor-instance inspection
38
+ -> scripts/*.mjs process/service entrypoints
39
+ -> recipes/*.json packaged Recipe library
40
+ -> skills/* + docs/* agent and human guidance
29
41
  ```
30
42
 
31
- - `/index.ts`: Minimal extension coordinator/composition root. It wires live pi ports and should avoid owning domain behavior.
32
-
33
- ## Domain Modules
34
-
35
- - `/lib/*.ts`: Flat Domain DAG modules for cohesive reusable behavior.
36
- - `command-templates.ts`: portable command-template execution graph.
37
- - `tools-access.ts`: shared public tool access/session ownership guards and normalized mismatch diagnostics.
38
- - `tools-mailbox.ts`: mailbox contract normalization and accepted/emitted message type helpers for public tool responses.
39
- - `schema.ts`: tool arg declarations and placeholder-derived schemas.
40
- - `identity.ts`, `paths.ts`, `config.ts`: names, paths, and persistence.
41
- - `registry.ts`, `runtime.ts`: register/update/delete, load/conflict/registration coordination.
42
- - `execution.ts`, `execution-output.ts`, `limits.ts`: registered-tool execution and bounded output.
43
- - `recipes-references.ts`, `recipes-discovery.ts`, `recipes-usage.ts`, `draft-review.ts`, `draft-sleep.ts`, `tool-review.ts`, `tool-review-scheduler.ts`, `tool-review-transaction.ts`, `tool-review-lineage.ts`, `tool-review-lineage-transaction.ts`, `review-projection.ts`, `review-diagnostics.ts`, `review-control.ts`, `draft-consolidation.ts`, `draft-consolidation-transaction.ts`: recipe graph/discovery, automatic review admission, journaled filesystem and lineage execution/recovery, and bounded diagnostics.
44
- - `async-runs.ts`: detached run lifecycle facade; `runs-*` subdomains own artifacts, start guards, status, indexes, inbox/outbox, delivery, process control, and retention internals.
45
- - `runtime-notifier.ts`, `mailbox-loop.ts`: wake notifications and reusable run/branch mailbox worker loops.
46
- - `messages.ts`, `rooms.ts`, `recipes-context.ts`, `session-evidence.ts`, `inspector.ts`, `inspector-overlay.ts`, `observability.ts`: addressed message protocol, rooms, recipe prompt context, bounded/redacted child-session turns, inspector evidence/navigation, keyboard-driven overlay UI, and ambient run status.
47
- - `prompts.ts`, `temp.ts`: LLM-facing copy and temp cleanup.
48
- - `automatic-review-runtime.ts`, `run-ui-runtime.ts`, `inspector-command.ts`: session-bound review composition, ambient run-observability lifecycle, and Inspector host-command adapters kept outside the entrypoint.
49
- - `tools.ts`: public tool family composition and reserved tool names.
50
- - `tools-message.ts`: public `message` tool behavior, including run controls, branch/room routing, tool actor invocation, and delivery feedback.
51
- - `tools-inspect.ts`: public `inspect` tool behavior, including recipe registry, room/session/tool/run views, and observation formatting.
52
- - `tools-spawn.ts`: public `spawn` tool behavior, including actor launch, draft recipe capture, and launch diagnostics.
53
- - `tools-local.ts`: saved local capability execution, generated schemas, value normalization, and async recipe launch.
54
- - `tools-register.ts`: public `register_tool` behavior and schema for persisted local capability registration.
55
- - `tools-response.ts`: compact model-facing responses and next-action rendering shared by public tool execution paths.
56
-
57
- ## Repo Surfaces
58
-
59
- - `/scripts/*.mjs`: Stable executables for detached/helper processes. Prefer self-contained script ownership; do not preemptively move script logic into `lib/` just to make scripts thin.
60
- - `/lib/*.ts`: Compiled reusable domains for the extension/runtime. Move script behavior into `lib/` only when it has real non-script consumers or belongs to an existing reusable domain. Packaged JS-only execution, tests, or shim neatness alone do not justify a new `lib/` domain.
61
- - `/recipes/*.json`: Packaged standard recipe library. Keep recipes optional, composable, policy-light, and caller-configurable.
62
- - `/skills/actors/SKILL.md`: Dense practical reference for operating pi-actors itself.
63
- - `/skills/swarm/SKILL.md`: Bundled methodology skill for multi-agent standards, strategies, and portable examples.
64
- - `/tests/*.test.ts`: Focused regression tests for pure domains.
65
- - `/README.md`: Human-facing install, usage, and runtime semantics. Keep it as a product/onboarding entrypoint rather than an implementation dump: identity → why it exists → core verbs → install → first run → address/message model → feature showcase → golden path → recipe memory → platform/safety/docs. Preserve both layers: strong local-actor-kernel positioning plus compact practical capability catalog.
66
- - `/BACKLOG.md`: Canonical open work; only completable future work.
67
- - `/CHANGELOG.md`: Completed delivery history.
68
- - `/docs/README.md`: Documentation index.
43
+ `index.ts` wires Pi ports and must not own domain behavior. Keep the local TypeScript import graph acyclic.
44
+
45
+ ## Key Domains
46
+
47
+ - `command-templates.ts`: portable synchronous execution graph.
48
+ - `recipes-references.ts`, `recipes-discovery.ts`, `recipe-control.ts`: Recipe resolution, imports, shadowing, and Control declarations.
49
+ - `async-runs.ts`: lifecycle facade.
50
+ - `runs-start.ts`, `runs-status.ts`, `runs-control.ts`, `runs-control-delivery.ts`, `runs-controls.ts`, `runs-trace.ts`, `runs-process.ts`, `runs-retention.ts`, `runs-parent-teardown.ts`: focused Run internals.
51
+ - `execution-sessions.ts`, `trace-projection.ts`, `control-projection.ts`, `session-evidence.ts`: bounded/redacted execution and inspection evidence.
52
+ - `tools-message.ts`: exact Control facade.
53
+ - `tools-inspect.ts`: exact `run:<id>`, `runtime`, `recipes`, and `tool:<name>` inspection.
54
+ - `runtime-identity.ts`, `runtime-triage.ts`: immutable package/schema identity and pure pending/stale Control classification.
55
+ - `tools-spawn.ts`, `tools-register.ts`, `tools-local.ts`, `tools-response.ts`: Run creation, persistent capabilities, Recipe-backed tools, and compact results.
56
+ - `inspector.ts`, `inspector-overlay.ts`, `inspector-command.ts`, `inspector-actions.ts`: actor-instance Recipe/Trace/Control projection, navigation, command wiring, and fenced actions. **Actor Inspector** remains the product and command name, not a separate domain.
57
+ - `observability.ts`, `runtime-notifier.ts`, `run-ui-runtime.ts`: Trace attention, terminal reconciliation, and Pi follow-up delivery.
58
+ - automatic draft/tool review domains: structurally redacted model review, journaled mutation, lineage, recovery, and explicit retry/reset safety.
59
+
60
+ Scripts remain self-contained when no non-script consumer justifies a TypeScript domain. Command-template script leaves infer `.js`/`.mjs` in order through Node, Bun, or `deno run` and `.sh` through Bash without shell evaluation. Helper-backed packaged Recipes self-locate their installed package root while explicit caller values remain authoritative. Recipes stay optional, composable, policy-light, and caller-configurable.
69
61
 
70
62
  ## Operating Principles
71
63
 
72
- - Automatic recipe evolution remains silent but mechanically fenced: no-tools reviewers select lifecycle/name operations from value-free structural projections without receiving recipe bodies, template/default values, authored prose, canonical names, draft basenames, raw content hashes, or filesystem paths; batch-local opaque occurrence IDs and equality-only content groups preserve decision correlation and deduplication, while sensitive active recipes stay outside model review as defense in depth, deterministic executors derive unchanged recipes from separate trusted captures, and safe-session activation separates approval from live registry mutation. `PI_ACTORS_AUTOMATIC_REVIEW=off` is the explicit startup opt-out and must disable both scheduling and safe-boundary activation while remaining visible in runtime status. Automatic portfolio review may keep, demote, rename, or deduplicate canonically identical recipes; replacement, split, and executable contract changes require explicit operator authoring. Transactions must hold canonical source/target locks, enforce compare-and-swap preconditions, preserve complete recipes, quarantine before commit, journal process-crash recovery phases, validate recovery CAS/hashes, and derive evidence from runtime outcomes. Prefer `register_tool draft=...` for a fenced manual single-draft override; deliberate filesystem promotion remains valid but may invalidate and defer an already captured batch.
73
- - Keep published documentation portable: use `~`, `<repo>`, or relative paths instead of machine-local absolute paths.
74
- - Preserve runtime output discipline because tool output flows directly into agent context. Tool result/error text contributes exactly one leading line break; Pi's renderer contributes the other break after the call header, producing one empty separator row without doubled gaps.
75
- - Optimize every actor-facing surface for signal over volume: prefer compact state-backed hints and fewer concepts over broad explanatory prose or speculative guidance.
76
- - Split broad domains proactively when the current name becomes a generic bucket. Prefer concise domain names that match actual ownership. `tools.ts` is the public tool family owner; decomposed tool subdomains use `tools-<part>.ts` (`tools-message.ts`, `tools-inspect.ts`, `tools-spawn.ts`) under that family. Keep only genuinely cross-family domains unprefixed (`schema.ts`); tool-only helpers stay under `tools-*`. If a `tools-*` helper becomes reused by non-tools domains, remove the `tools-` prefix in the same slice and update ownership comments/imports so the name matches its broader responsibility. Avoid redundant internal `actor-` file prefixes in this actor-scoped package unless the file is deliberately tied to a public actor-named recipe/script/docs surface.
77
- - Until a stable release greater than `1.x.x`, favor context compression over compatibility shims: do not preserve legacy actor-facing names, aliases, fields, env vars, paths, or docs solely for backward compatibility when a clearer current term exists. Remove compatibility layers in the same slice that renames a concept, and record the break in `CHANGELOG.md`.
78
- - Keep the project lens local-first and cybernetic: agents wrap durable local capabilities as actors, then use semantic tools and messages instead of repeatedly reconstructing shell commands.
79
- - Design recipes as agent-callable tools: make prompts, scopes, paths, models, and policy knobs public args/defaults when the caller should decide them at invocation time.
80
- - Decompose oversized bullets into sublists or hierarchy; long flat list items are a context-smell.
81
-
82
- ## Knowledge Surfaces
83
-
84
- - Injected prompt: tiny bootstrap/reminder, never full docs.
85
- - Skill header: routing metadata that tells agents when to load a bundled skill.
86
- - Skill body: dense agent-facing operating manual for the matched concern.
87
- - README: public face of the project. Keep it current, focused, pruned, and limited to highest-signal scenarios.
88
- - `actors` skill: runtime/tooling manual for operating the extension and navigating high-value bundled recipes.
89
- - `swarm` skill: multi-agent methodology, strategies, standards, and portable examples.
90
- - `/docs`: detailed transportable standards read on demand.
91
- - `AGENTS.md`: durable project protocol for agents changing this repo.
92
- - Skill evolution is passive-active: when implementation yields durable mechanics, invariants, warnings, or orchestration lessons, update `skills/actors/SKILL.md` or `skills/swarm/SKILL.md` immediately instead of carrying evergreen skill-upkeep items in `BACKLOG.md`.
93
-
94
- ## Public Actor Model
95
-
96
- - Preserve the public verbs: `spawn`, `message`, `inspect`.
97
- - Keep the model-facing concept ladder minimal: core is run actors, typed messages, intentional inspection, artifacts, and recipe/tool memory; group messaging, roster, branches, sessions, and diagnostics are advanced surfaces.
98
- - Prefer one typed actor-message envelope for upward, downward, lateral, parent/branch, and branch/parent messages.
99
- - Prefer actor addresses and inspect views over exposing FIFO, outbox, or status mechanics as public concepts.
100
- - Keep route and semantic type separate: delivery behavior comes from `to`, while `type` describes intent.
101
- - Treat dotted message types as the minimal action surface: `channel.action` should often be enough for script-backed actors, with `body` reserved for extra context or free-form prompts to LLM-backed actors.
102
-
103
- ## Runtime Contract
104
-
105
- - Register trusted command templates with placeholder-derived args, progressive typed arg declarations, inline/default/`??`/ternary fallback, and split-first command argv construction.
106
- - Serialize extension-authored recipe mutations with canonical-path locks across each complete check/read/write/runtime-update window; keep usage and lineage evidence in the locked `.usage/recipes/<recipe-name>.json` ledger plus path index so metadata cannot overwrite authored recipes, and do not replace keyed recipe locking with a broad registry lock. Launch accounting is the narrow exception: it briefly shares the portfolio transaction’s canonical recipe-root fence before taking index/ledger locks, so quarantine cannot make an already-authorized launch disappear; a source that changed before that fence rejects the stale launch and asks for reload.
107
- - Keep command templates synchronous and portable; `async: true` is the detached run switch.
108
- - Preserve node controls: `when`, positive `timeout`, `delay`, bounded `retry`, `failure`, and `recover` cleanup.
109
- - Persist every async command's complete byte-exact stdout/stderr under command- and retry-specific run-state paths while keeping returned tails bounded and pipeline stdin complete.
110
- - Keep async run state under `~/.pi/agent/tmp/pi-actors/runs` with injected `{run_id}` and `{state_dir}` values.
111
- - Preserve event-driven observability with bounded reconciliation: file watchers accelerate durable retrying terminal follow-up notifications, while a conservative terminal-only interval recovers missed watcher activity, rearms degraded watchers, and never replays outbox traffic. Queue compact terminal coordinator notices through Pi follow-up delivery rather than steering so current work finishes before async results arrive and host follow-up batching policy can combine concurrent completions; LLM content contains only run id, status, one base path, and relative artifact names, while semantic output/error/correlation stays in non-LLM details and run state. Terminal delivery is at-least-once across the unavoidable send/handled-marker crash window; watch-triggered and periodic delivery share one live-runtime in-flight guard.
112
- - When a deferred actor result gates the next step, wait for its terminal follow-up. Do not schedule continuation loops, repeatedly inspect, or mutate its reviewed scope while it runs; inspect early only on operator request, meaningful actor event, or diagnosis of an overdue/stuck run.
113
- - Do not restore busy-polling examples, duplicate terminal notifications, or duplicate notifications for handled `cancel`, `kill`, or control-stop actions.
114
-
115
- ## Recipes And Registry
116
-
117
- - `~/.pi/agent/recipes/*.json` is executable muscle memory: recipes there become persistent tools by location.
118
- - Preserve filename identity, atomic writes, explicit operator-gated changes, and local transportability. Extension-authored draft creation must take the same canonical per-path mutation lock used by consolidation so source compare-and-swap and quarantine cannot race a writer.
119
- - Recipe live reload must watch the parent when the user recipe root is absent, switch to the root watcher when it appears, and rearm after deletion/rename without polling or duplicate watcher ownership. Every callback must compare its exact watcher instance before closing, replacing, notifying, or scheduling so delayed callbacks from closed generations cannot affect the current watcher.
120
- - Packaged/ad hoc recipes outside the agent root are components, not user tools.
121
- - Register existing recipes by importing them from the user-root wrapper and using a `{ "name": "alias" }` template node; do not duplicate a ready recipe's script command, defaults, mailbox, or artifact contract in the wrapper.
122
- - Skill-owned scripts must be exposed through skill-owned recipes first. If a local tool needs that capability, import the skill recipe via `{agent}/skills/<skill>/recipes/<recipe>.json` instead of calling `{agent}/skills/<skill>/scripts/*` directly.
123
- - Tool definitions use `template`, not `script`, and built-in/core tool names must not be shadowed.
124
- - Host registrations may remain visible because Pi cannot unregister dynamic definitions, but extension-local `message` and `inspect` lookup must consult the current runtime recipe registry before returning or executing a cached definition.
125
- - Packaged recipe growth is demand-driven: prefer reusable components over speculative scenario catalogs.
126
- - Recipe templates may point directly at executable helper scripts when the recipe owns that script boundary; keep script executable bits and avoid unnecessary `node` prefixes.
127
-
128
- ## Command And Recipe Layers
129
-
130
- - Keep command-template semantics in `docs/command-templates.md`.
131
- - Keep recipe storage/import/default/reference behavior in `docs/template-recipes.md`.
132
- - Keep detached lifecycle/state/IPC behavior in `docs/async-runs.md`.
133
- - Imported recipes are command-template-shaped definitions, not async-run instances.
134
- - Valid chain: `tool → template → recipe → run → template`; reject cyclic shortcuts.
135
- - Typed args support `string`, `path`, `int`, `number`, `bool`, `array`, and `enum(...)`.
136
- - Preserve both metadata-first args and inline-first placeholder style.
137
-
138
- ## State, IO, And Safety
139
-
140
- - Tool stdout and temp state must stay bounded and local; preserve complete high-volume streams in spill files with byte/truncation metadata, and never feed a truncated capture tail into pipeline stdin.
141
- - Feedback hints must be evidence-backed, bounded, and action-shaped; prefer `next_actions` pointing to existing verbs over prose, and avoid hints when no concrete next step is justified.
142
- - Keep tail truncation, full-output temp files, failure formatting, and centralized limits intact.
143
- - Published docs must not include machine-local absolute paths.
144
- - Any view scanning run directories must apply coordinator/session ownership filters before exposing summaries or previews.
145
- - Actor Inspector remains evidence-first; its `Kill` action is available only for a focused owned running run, requires in-overlay confirmation, revalidates exact ownership/status at action time, routes through canonical `control.kill`, and renders bounded success/failure feedback without direct process signaling. Keep active key hints in the bottom border as one blue-key/border-accent-description rail joined by border-accent `─`, never as a dedicated body row or bullet-separated footer.
146
- - Direct branch messages are active inbox queues; guard branch-local append/status rewrites with the branch inbox lock and keep claim/handled/failed transitions tested.
147
- - Run-state launch and destructive retention require the runtime ownership marker bound to the canonical directory and run id; reject non-run directories, missing/mismatched markers, and symlink aliases rather than trusting `run.json`.
148
- - Runner lifecycle and destructive process controls require the persisted cross-platform process identity proof (start time, command, and cwd where available), revalidated at authorization and immediately before signaling; dead, mismatched, or unsupported proofs stay distinct and fail closed rather than degrading to pid liveness. On Unix, only process-group `ESRCH` followed by another matching identity proof permits exact-pid fallback. Keep the residual post-read OS PID/PGID reuse window explicit because Node lacks one portable identity-stable group handle.
149
- - Automatic draft review may schedule one silent review after ordinary `agent_end` only when twelve drafts exist and no actor is running; it must snapshot an exact batch, leave newer drafts for later, suppress routine terminal/outbox delivery, and never mutate recipes from the reviewer process.
150
- - Automatic tool review seeds zero-call lineage without fabricating launches, admits only current non-sensitive revisions lacking a review fingerprint, captures exactly thirty-six oldest eligible active user tools, and uses the same silent post-turn/active-actor boundary. Completed output becomes a size-bounded immutable approval only after result validation plus source and target CAS; approval must not mutate the live registry. Approved filesystem mutation uses intent-before-mutation journaling and source quarantine, composition invokes it only during `session_start` before runtime tool loading, persists `lineage_pending`, and must finalize lineage before quarantine cleanup. Failed cycles persist bounded stage/error/remediation evidence; explicit `review.retry`/`review.reset` messages to `tool:pi-actors` may reset counters or disposable state, but reset must reject approved/transaction/lineage evidence that requires roll-forward recovery. Draft retry must preserve the original reviewer run once a transaction journal exists and derive lineage/evidence from that authenticated journal plan, never from later reviewer output.
151
- - Parent-session teardown runs on every Pi `session_shutdown`, never ordinary `agent_end`: select discovered readable persisted `running` runs with the exact retiring session `ownerId`, carry immutable `run_instance_id` through canonical `control.kill`, serialize control against same-directory restart, fence teardown evidence to that generation, continue across partial failures, and leave terminal, ambiguous, changed-generation, or other-session runs untouched. Use unbounded teardown discovery, count unreadable/corrupt state as failures, and persist one bounded shutdown summary outside individual runs. Descendant Pi sessions remain separate exact owners and rely on their own shutdown hooks; hard termination keeps OS/manual orphan recovery as an honest boundary.
152
- - Room/branch provenance checks should validate that accepted `from` addresses belong to the addressed run.
153
-
154
- ## Coordination And Lifecycle
155
-
156
- - Persistent implementer workflows are recipe composition, not one-off scripts.
157
- - Compose cells such as `coordinator-locker`, subagent launchers, actor-message utilities, and mailbox-loop helpers.
158
- - Preserve JSON envelope object shape across handoffs.
159
- - Keep locker state generic and thin; orchestration strategy belongs in the coordinator.
160
- - Graceful actor retirement is opt-in through recipe/run metadata and must not infer retirement for persistent services or backlog implementers.
161
- - Script helpers that spawn long-lived child processes should keep those children inside the async run's owned process group unless they also provide an explicit termination bridge; `control.kill` must not leave detached playback/service descendants alive.
162
- - True daemon recipes are allowed, but daemon ownership belongs to the recipe/script contract: persist a pid or service handle, verify ownership before signaling, expose status/stop semantics, and bridge `control.kill` to daemon cleanup instead of relying on the generic runner to discover detached services.
163
-
164
- ## Context And Planning Hygiene
165
-
166
- - `BACKLOG.md` is planning, not history: only completable future work with current scope and exit criteria.
167
- - Completed delivery belongs in `CHANGELOG.md`.
168
- - Durable/evergreen behavior belongs in `AGENTS.md`, README, docs, or skills.
169
- - Changelog bullets describe meaningful user/operator/developer changes, not release bookkeeping.
170
- - PR/release summaries are temporary artifacts; keep durable release evidence in `CHANGELOG.md` and gates in `BACKLOG.md`.
171
- - Meaningful implementation or docs changes must reconcile `BACKLOG.md`, `CHANGELOG.md`, README, and docs navigation.
172
-
173
- ## Validation
174
-
175
- - `npm run check`: Lightweight extension-load sanity check.
176
- - `npm test`: Focused regression tests for extracted pure domains.
177
- - `npm run pack:dry`: Verify package contents and npm metadata.
178
- - `npm run conformance`: Compact protocol conformance runner for actor/recipe behavior.
179
-
180
- ## Pre-Task Preparation
181
-
182
- 1. Read this file, `BACKLOG.md`, and `README.md`.
183
- 2. Inspect `index.ts` around the touched tool/runtime path.
184
- 3. Prefer targeted edits over broad rewrites.
185
- 4. Run the smallest validation set that covers the touched scope.
186
-
187
- ## Task Completion Protocol
188
-
189
- 1. Reconcile backlog state with reality: close, narrow, split, defer, or gate items explicitly.
190
- 2. Update README/docs when public behavior, setup, package contents, or navigation changes.
191
- 3. Record meaningful delivered slices in `CHANGELOG.md`.
192
- 4. Run relevant validation and report exact commands.
64
+ ### Recipe
65
+
66
+ - Recipe files may define args/defaults, imports, artifacts, command-template flags, and `control`.
67
+ - Declare actor-local actions only when a long-lived process implements them.
68
+ - Actions are lowercase, unique, and cannot use runtime-reserved lifecycle names.
69
+ - Removed communication-plane metadata fails explicitly; never translate it.
70
+ - User Recipes shadow packaged definitions; invalid shadowing blocks fallback.
71
+ - Files over 1 MiB, import depth over 32, and import cycles fail closed.
72
+
73
+ ### Trace
74
+
75
+ Canonical event:
76
+
77
+ ```json
78
+ {"id":"…","ts":"…","kind":"…","summary":"…","data":{},"level":"info","attention":"notify"}
79
+ ```
80
+
81
+ Keep events bounded and free of addressing/routing fields. Every first-party writer must call `appendRunTraceEvent`; it validates and size-checks inside the canonical token-owned mutation lock, then performs one append-only JSONL write. Never append `trace.jsonl` directly from scripts. Use artifacts or execution captures for large evidence. `attention: "followup"` must remain rare and semantically justified.
82
+
83
+ ### Control
84
+
85
+ Public shape:
86
+
87
+ ```json
88
+ {"target":"run:<id>","action":"…","input":{},"verbose":false}
89
+ ```
90
+
91
+ Admit only lowercase ASCII actions of at most 64 characters, serialized JSON input of at most 380 bytes, and complete newline-terminated wire records of at most 512 bytes on both FIFO and named pipe. Invalid envelopes remain outside the journal; persist every admitted Control before transport. Put larger data in a declared artifact/path and send only a bounded reference or instruction through Control. Fence every record and endpoint with immutable `run_instance_id`; controlled services capture that generation at startup. Serialize atomic journal replacement through token-owned dead-process-reclaiming locks, and keep status transitions expected-state-fenced and monotonic when consumers complete before producer delivery evidence. FIFO and named pipe are transport details, not public concepts; reject partial writes and keep FIFO readers gap-free across writers. Revalidate owner, generation, state, and process identity under the lifecycle lock immediately before delivery.
92
+
93
+ Keep `controls.jsonl` raw and local for execution fidelity. Every model-facing and Actor Inspector Control surface must use the shared bounded `control-projection.ts` redaction before exposure; never attach a second raw copy in tool details.
94
+
95
+ Runtime lifecycle and review actions remain runtime-owned.
96
+
97
+ ### Inspect
98
+
99
+ Run views are exactly `recipe`, `trace`, and `control`. Non-Run management targets are `runtime`, `recipes`, and `tool:<name>`. Apply owner filtering and redaction before projecting evidence.
100
+
101
+ ## Retained Safety Invariants
102
+
103
+ Never weaken:
104
+
105
+ - owner filtering;
106
+ - immutable generation fencing;
107
+ - cross-platform process identity checks;
108
+ - canonical lifecycle locks and same-directory restart serialization;
109
+ - shutdown and parent-teardown kill;
110
+ - terminal notification reconciliation and handled/failure evidence;
111
+ - bounded logs, complete captures, and tool output;
112
+ - owned Pi session provenance;
113
+ - path containment, canonical ownership markers, and symlink rejection;
114
+ - redaction of secrets and machine-local paths;
115
+ - automatic review admission, CAS, journaling, quarantine, lineage, retry, and reset safety.
116
+
117
+ Lifecycle operations fail closed when identity, ownership, or generation cannot be proven. Do not directly signal processes from UI code or edit active Run state to force outcomes.
118
+
119
+ ## Registry and Evolution
120
+
121
+ `~/.pi/agent/recipes/*.json` is executable capability memory. Preserve filename identity, atomic writes, canonical per-path locks with atomic owner publication and non-blocking abandoned staging, explicit operator-gated changes, and transportability.
122
+
123
+ Automatic review receives value-free structural projections, not executable content, paths, prose, canonical names, or secrets. Deterministic executors derive unchanged Recipes from trusted captures. Approved mutation must journal intent before mutation and roll forward safely after crashes.
124
+
125
+ `PI_ACTORS_AUTOMATIC_REVIEW=off` disables scheduling and safe-boundary activation while remaining visible in runtime status.
126
+
127
+ ## Output and Observability
128
+
129
+ Tool result/error text contributes exactly one leading line break. Keep model-facing responses compact and state-backed. Preserve complete byte-exact command streams in bounded spill files while returning bounded tails; never feed truncated tails into pipeline stdin.
130
+
131
+ File watchers accelerate reconciliation; a bounded terminal-only interval recovers missed events. Terminal follow-ups contain only Run id, status, one base path, and relative artifact names in visible content; semantic details remain structured. Delivery remains honestly at-least-once across the send/handled-marker crash window.
132
+
133
+ When a deferred Run result gates the next step, wait for its terminal follow-up. Inspect early only for operator request, meaningful attention, or diagnosis of an overdue Run.
134
+
135
+ ## Documentation and Release Discipline
136
+
137
+ - Keep published text portable: use `~`, `<repo>`, or relative paths.
138
+ - Update `skills/actors/SKILL.md` when durable operating mechanics change.
139
+ - Keep `skills/swarm/SKILL.md` focused on multi-agent methodology rather than kernel internals.
140
+ - Recipe `description` is optional because discovery supplies stable fallback tool copy; packaged Recipe QA must report zero diagnostics and zero release-blocking warnings without component boilerplate.
141
+ - Before release run build, full tests, preservation tests, Recipe QA, Domain DAG validation, ABCd context validation, line-count gates, and release gates.
142
+ - `.github/workflows/release.yml` owns the immutable sequence reusable validation → npm Trusted Publisher publication/verification → GitHub Release convergence; follow [docs/releasing.md](docs/releasing.md).
143
+ - Keep npm publication tokenless: use the exact npm Trusted Publisher binding and job-scoped OIDC permission, never a long-lived npm token or token fallback.
144
+ - Until a stable version beyond `1.x`, prefer clean breaking simplification over compatibility aliases or renamed legacy abstractions.
package/BACKLOG.md CHANGED
@@ -1,3 +1,191 @@
1
1
  # Project Backlog
2
2
 
3
- No open items.
3
+ ## 0.43.1 — Contract Closure
4
+
5
+ **Base:** `0.43.0` at `0d6db30cd2e070c1d03ed1e60bef70538a3083c1`
6
+ **Release type:** patch-level assurance and distribution closure
7
+ **Release sentence:** the Run kernel is published, portable, redacted, and mechanically self-consistent.
8
+
9
+ ## Mission
10
+
11
+ Close the concrete gaps exposed after the `0.43.0` Run-kernel migration without adding another orchestration layer or expanding the public model.
12
+
13
+ The canonical model remains unchanged:
14
+
15
+ ```text
16
+ Recipe --spawn--> Run
17
+ Run = Recipe + Trace + Control
18
+ ```
19
+
20
+ The public lifecycle remains:
21
+
22
+ ```text
23
+ spawn create a Run
24
+ message apply Control
25
+ inspect read Recipe, Trace, or Control
26
+ ```
27
+
28
+ `register_tool` remains the separate capability-memory surface.
29
+
30
+ `0.43.1` succeeds when the same contract is true in source mode, installed-package mode, documentation, diagnostics, first-party controlled services, CI, GitHub Release, and npm distribution.
31
+
32
+ ## Hard Boundaries
33
+
34
+ The release must preserve:
35
+
36
+ - exactly the existing public Run nouns: `Recipe`, `Run`, `Trace`, and `Control`;
37
+ - exactly the existing Run views: `recipe`, `trace`, and `control`;
38
+ - exactly the existing management targets: `runtime`, `recipes`, and `tool:<name>`;
39
+ - the stable public tool names `spawn`, `message`, `inspect`, and `register_tool`;
40
+ - owner filtering, immutable `run_instance_id` fencing, canonical lifecycle locking, and process-identity verification;
41
+ - shutdown and parent-teardown behavior;
42
+ - terminal reconciliation and bounded follow-up context;
43
+ - complete command captures, owned Pi-session evidence, redaction, path containment, and symlink rejection;
44
+ - automatic Recipe review, immutable capture, CAS, journaled mutation, lineage, retry, reset, and recovery safety;
45
+ - shell-free command-template execution;
46
+ - the strict Domain DAG and removed-communication-surface gates.
47
+
48
+ The release must not add:
49
+
50
+ - actor chat, rooms, branches, peers, routing, mailboxes, inboxes, outboxes, or addressed envelopes under any name;
51
+ - a task tree, planner hierarchy, decision registry, swarm scheduler, model router, or model-economics subsystem to the kernel;
52
+ - new public targets, views, request fields, Trace fields, Control states, or Recipe keys;
53
+ - a remote protocol, broker, workflow DSL, or general event bus;
54
+ - compatibility aliases for removed `0.42` surfaces;
55
+ - a long-lived npm token or third-party publish action;
56
+ - new runtime dependencies unless an existing retained invariant cannot be closed otherwise.
57
+
58
+ ## Deferred Beyond This Release
59
+
60
+ Do not absorb these future lines into `0.43.1`:
61
+
62
+ - total Trace retention, rotation, or semantic compaction;
63
+ - pending-Control admission backpressure and queue quotas;
64
+ - outcome/cost aggregation for Recipe fitness;
65
+ - automatic model selection or planner/worker economics;
66
+ - task-tree or decision-ownership orchestration;
67
+ - a generalized acknowledgement protocol for arbitrary controlled services.
68
+
69
+ Those require separate evidence and belong to later releases.
70
+
71
+ ## Known Closure Gaps
72
+
73
+ The executor must verify this observation against the current checkout before changing code:
74
+
75
+ 1. The repository-side Trusted Publisher path is prepared, but npm account binding and tagged publication proof remain external release preconditions.
76
+
77
+ If the observation no longer holds, preserve the already-closed behavior and remove only the corresponding obsolete task. Do not reimplement solved work.
78
+
79
+ ---
80
+
81
+ ## P0 — Release and Contract Closure
82
+
83
+ ### CCL-02 — Activate npm Trusted Publisher and prove registry convergence
84
+
85
+ **Goal:** make `pi install npm:@llblab/pi-actors` install the released Run kernel through the prepared tokenless, provenance-bearing path.
86
+
87
+ **Status:** repository preparation is complete; npm account configuration and one tagged release proof remain externally gated.
88
+
89
+ **External operator precondition:**
90
+
91
+ - Configure the npm Trusted Publisher for package `@llblab/pi-actors` with owner `llblab`, repository `pi-actors`, workflow filename `release.yml`, and no environment unless both sides adopt the same reviewed environment name.
92
+ - Do not add `NPM_TOKEN`, `NODE_AUTH_TOKEN`, or another long-lived token fallback.
93
+ - Remove any obsolete account-level automation tokens only after one Trusted Publisher release succeeds.
94
+
95
+ **Release-time closure:**
96
+
97
+ - The tagged workflow passes reusable validation, publishes or safely recognizes the exact npm version, verifies matching `gitHead` and packed Pi runtime manifests, then converges the GitHub Release.
98
+ - `npm view @llblab/pi-actors@0.43.1 version` and npm `latest` resolve to `0.43.1`.
99
+ - The GitHub Release and npm package identify the same tag commit.
100
+ - The Pi package index may update asynchronously; observe it without unbounded polling or repository mutation.
101
+ - If Trusted Publisher remains unconfigured or mismatched, report that exact external blocker and keep publication failed closed.
102
+
103
+ **Dependencies:** npm account configuration and the final tagged release.
104
+
105
+ ---
106
+
107
+ ## P1 — Signal, Compression, and Integration Closure
108
+
109
+ ### CCL-12 — Close release evidence and publish `0.43.1`
110
+
111
+ **Goal:** leave one internally consistent source tree, package, release, and empty future-work file.
112
+
113
+ **Work:**
114
+
115
+ - Reconcile implementation comments, README, `AGENTS.md`, `docs/`, Actors skill, fixtures, schemas, tests, and release notes.
116
+ - Keep Swarm skill changes limited to kernel-interface corrections; do not expand orchestration methodology in this release.
117
+ - Update package version and packaged skill metadata to `0.43.1` only after all implementation tasks close.
118
+ - Move completed work into one concise `CHANGELOG.md` section with externally meaningful behavior and impact.
119
+ - Reset `BACKLOG.md` to:
120
+
121
+ ```text
122
+ # Project Backlog
123
+
124
+ No open items.
125
+ ```
126
+
127
+ - Run the final local boundary:
128
+
129
+ ```bash
130
+ npm ci
131
+ npm run test:preservation
132
+ npm run release:validate
133
+ npm run audit:dependencies
134
+ ```
135
+
136
+ - Create tag `v0.43.1` only from the validated release commit.
137
+ - Observe the gated workflow through successful validation, npm publication, npm verification, and GitHub Release publication.
138
+ - Verify the final public package through npm, not only `npm pack --dry-run`.
139
+
140
+ **Release closure:**
141
+
142
+ - Ubuntu, macOS, Windows, and dependency-audit jobs succeed.
143
+ - GitHub Release is published only after validation and npm verification.
144
+ - npm exact version and `latest` both resolve to `0.43.1`.
145
+ - The installed package reports `0.43.1`, exposes the same schemas as source, and contains no removed communication surface.
146
+ - Recipe QA has zero diagnostics and zero baseline warnings.
147
+ - Shipped lines remain below `28,853`.
148
+ - No unresolved P0/P1 finding remains.
149
+ - `BACKLOG.md` contains no completed work.
150
+
151
+ **Dependencies:** all prior tasks and the npm Trusted Publisher external precondition.
152
+
153
+ ---
154
+
155
+ ## Dependency Order
156
+
157
+ ```text
158
+ Released 0.43.0 baseline
159
+ └── CCL-02 → CCL-12
160
+ ```
161
+
162
+ `CCL-02` may proceed in parallel with kernel fixes after the frozen released baseline, but no tag may be created until the complete graph closes.
163
+
164
+ ## Required Test Matrix
165
+
166
+ At minimum, retain or add direct evidence for:
167
+
168
+ | Boundary | Required evidence |
169
+ | ---------------------- | ----------------------------------------------------------------------------------------- |
170
+ | Public Control request | exact fields, action length, serialized-input bound, removed-field rejection |
171
+ | Recipe Control | same action grammar/length, duplicate and runtime-reserved rejection |
172
+ | Control journal | generation fencing, monotonic transitions, compaction, stale-lock recovery |
173
+ | Control projection | recursive redaction in tool content/details, triage, and Actor Inspector |
174
+ | Control transport | exact complete-wire bound, FIFO atomicity, named-pipe parity, partial-write failure |
175
+ | Runtime status | exact version in source and packed/dist modes |
176
+ | Runtime triage | pending/stale distinction, delivered inclusion, age boundaries, owner/lifecycle filtering |
177
+ | Trace append | canonical validation, cross-process serialization, no malformed/lost/duplicate records |
178
+ | First-party services | canonical Trace only, canonical Control claim/finalization, endpoint generation |
179
+ | Documentation | canonical examples accepted by current schemas/dispatchers |
180
+ | Recipe QA | zero diagnostics and zero normalized warnings |
181
+ | Release | validation-before-publication, OIDC-only npm publishing, rerun convergence |
182
+ | Compression | strict shipped-line ratchet from `0.43.0` |
183
+ | Installed package | compiled entrypoint, skills, version, schemas, no stale files/source imports |
184
+
185
+ ## Final Decision Rule
186
+
187
+ Do not release because the code compiles or because the new abstractions look cleaner.
188
+
189
+ Release only when this statement is supported end to end:
190
+
191
+ > A user installing `@llblab/pi-actors@0.43.1` receives the same validated Run kernel described by the repository: every Run exposes one captured Recipe, one redacted causal Trace, and one portable generation-fenced Control boundary—without a communication plane and without distribution ambiguity.