@llblab/pi-actors 0.17.0 → 0.18.0

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 (85) hide show
  1. package/AGENTS.md +5 -3
  2. package/BACKLOG.md +54 -29
  3. package/CHANGELOG.md +18 -2
  4. package/README.md +184 -300
  5. package/docs/actor-messages.md +6 -2
  6. package/docs/async-runs.md +3 -5
  7. package/docs/command-templates.md +2 -0
  8. package/docs/recipe-library.md +3 -0
  9. package/docs/task-first-recipes.md +29 -0
  10. package/docs/template-recipes.md +9 -14
  11. package/index.ts +158 -34
  12. package/lib/actor-inspector-tui.ts +374 -118
  13. package/lib/actor-rooms.ts +222 -24
  14. package/lib/async-runs.ts +59 -1
  15. package/lib/execution.ts +17 -0
  16. package/lib/file-state.ts +2 -1
  17. package/lib/observability.ts +82 -2
  18. package/lib/prompts.ts +2 -2
  19. package/lib/recipe-discovery.ts +86 -6
  20. package/lib/recipe-migration.ts +0 -2
  21. package/lib/recipe-references.ts +43 -10
  22. package/lib/temp.ts +55 -2
  23. package/lib/tools.ts +99 -11
  24. package/package.json +1 -1
  25. package/recipes/coordinator-locker.json +0 -1
  26. package/recipes/lens-swarm.json +0 -1
  27. package/recipes/music-player.json +0 -1
  28. package/recipes/pipeline-architect-coordinator.json +0 -1
  29. package/recipes/pipeline-artifact-bundle.json +0 -1
  30. package/recipes/pipeline-artifact-report.json +0 -1
  31. package/recipes/pipeline-artifact-write.json +0 -1
  32. package/recipes/pipeline-async-run-ops.json +0 -1
  33. package/recipes/pipeline-checkpoint-continuation.json +0 -1
  34. package/recipes/pipeline-development-tasking.json +0 -1
  35. package/recipes/pipeline-docs-maintenance.json +0 -1
  36. package/recipes/pipeline-media-library.json +0 -1
  37. package/recipes/pipeline-quorum-review.json +0 -1
  38. package/recipes/pipeline-release-readiness.json +0 -1
  39. package/recipes/pipeline-release-summary.json +0 -1
  40. package/recipes/pipeline-repo-health.json +0 -1
  41. package/recipes/pipeline-research-synthesis.json +0 -1
  42. package/recipes/pipeline-review-readiness.json +0 -1
  43. package/recipes/pipeline-room-swarm.json +48 -0
  44. package/recipes/subagent-artifact.json +0 -1
  45. package/recipes/subagent-checkpoint.json +0 -1
  46. package/recipes/subagent-conflict-report.json +0 -1
  47. package/recipes/subagent-contradiction-map.json +0 -1
  48. package/recipes/subagent-critic.json +0 -1
  49. package/recipes/subagent-evidence-map.json +0 -1
  50. package/recipes/subagent-followup.json +0 -1
  51. package/recipes/subagent-judge.json +0 -1
  52. package/recipes/subagent-merge.json +0 -1
  53. package/recipes/subagent-message.json +0 -1
  54. package/recipes/subagent-normalize.json +0 -1
  55. package/recipes/subagent-plan.json +0 -1
  56. package/recipes/subagent-prompt.json +0 -1
  57. package/recipes/subagent-quorum.json +0 -1
  58. package/recipes/subagent-review-coordinator.json +0 -1
  59. package/recipes/subagent-review.json +0 -1
  60. package/recipes/subagent-task-card.json +0 -1
  61. package/recipes/subagent-tools.json +0 -1
  62. package/recipes/subagent-verify.json +0 -1
  63. package/recipes/subagents-prompts.json +0 -1
  64. package/recipes/utility-actor-message.json +0 -1
  65. package/recipes/utility-artifact-manifest.json +0 -1
  66. package/recipes/utility-artifact-write.json +0 -1
  67. package/recipes/utility-changelog-head.json +0 -1
  68. package/recipes/utility-changelog-section.json +0 -1
  69. package/recipes/utility-coordinator-lock-snapshot.json +0 -1
  70. package/recipes/utility-git-log.json +0 -1
  71. package/recipes/utility-git-status.json +0 -1
  72. package/recipes/utility-jsonl-tail.json +0 -1
  73. package/recipes/utility-markdown-index.json +0 -1
  74. package/recipes/utility-package-summary.json +0 -1
  75. package/recipes/utility-playlist-build.json +0 -1
  76. package/recipes/utility-playlist-scan.json +0 -1
  77. package/recipes/utility-run-ops-snapshot.json +0 -1
  78. package/recipes/utility-run-state-files.json +0 -1
  79. package/recipes/utility-run-summary.json +0 -1
  80. package/recipes/utility-skill-summary.json +0 -1
  81. package/recipes/utility-validate-recipe.json +0 -1
  82. package/recipes/utility-validation-wrapper.json +0 -1
  83. package/scripts/room-swarm.mjs +243 -0
  84. package/skills/actors/SKILL.md +25 -12
  85. package/skills/swarm/SKILL.md +15 -1
@@ -2,7 +2,7 @@
2
2
  name: actors
3
3
  description: Highest-density practical guide for pi-actors. Read this skill whenever prompt and tools are not enough for spawn, message, inspect, actor runs, tools, recipes, command templates, async lifecycle, mailboxes, artifacts, and local orchestration mechanics.
4
4
  metadata:
5
- version: 0.17.0
5
+ version: 0.18.0
6
6
  ---
7
7
 
8
8
  # Actors (pi-actors)
@@ -113,17 +113,25 @@ Views:
113
113
  - `roster`: room member list with address, role, parent, caps, claim, status, and last seen.
114
114
  - `contacts`: roster-derived direct-message targets without full roster metadata.
115
115
  - `previews`: TUI-ready bounded room message previews with timestamp/from/to/type/summary/body_preview.
116
- - `mailbox`: declared accepts/emits contract.
116
+ - `mailbox`: declared accepts/emits contract for runs; queued direct branch inbox messages for `branch:<run>/<branch>` with `id`, status, route/type, and queue/handling timestamps.
117
117
  - `files`: run state directory file list.
118
118
  - `artifacts`: declared artifact paths/status.
119
119
  - `recipes` target: registry summary for active, shadowed, invalid, disabled, and diagnostic recipe entries.
120
120
 
121
+ Actor inspector commands:
122
+
123
+ - `/actors-inspector-toggle [rows]`: open/close the compact table or set row count; default is 12 log rows when no size is supplied.
124
+ - `/actors-inspector-filter all|room|direct|broadcast|mention <text>`: narrow table previews without changing room/run state.
125
+ - `/actors-inspect <number>`: open one visible row as a full-message view.
126
+
127
+ The table is compact and optimistic by default: bounded body previews, capped noisy room rows, and an inline roster summary in the form `role/name` that wraps only when needed. Active roster members use the target color; members that sent `actor.leave` stay visible as inactive/muted participants from the current run. Actor display names come from `actor.join` bodies (`display`) or branch addresses, keeping debugger output plain and name-driven.
128
+
121
129
  Let terminal notifications arrive; avoid sleep-poll loops except during diagnosis.
122
130
 
123
131
  ## Stable Multi-Actor Review Rules
124
132
 
125
133
  - Prefer independent read-only reviewers for review swarms. Use shared room messages for coordination signals and observability, not for letting reviewers converge early, unless the task explicitly asks for collaborative discussion.
126
- - Treat inspector-visible communication logs as recipe-quality evidence. Verbose room/direct timelines show whether recipes coordinate clearly, emit useful summaries, over-chat, miss handoffs, choose poor message types, or need better mailbox/artifact conventions. Use `inspect room:<run> view=messages|previews`, `inspect run:<id> view=communication`, and the actor inspector compact/verbose modes to improve recipes after real runs.
134
+ - Treat inspector-visible communication logs as recipe-quality evidence. Full room/direct timelines show whether recipes coordinate clearly, emit useful summaries, over-chat, miss handoffs, choose poor message types, or need better mailbox/artifact conventions. Use `inspect room:<run> view=messages|previews`, `inspect run:<id> view=communication`, and the actor inspector table/full-message views to improve recipes after real runs.
127
135
  - Smoke-test provider/model availability before launching expensive fanout, or choose a provider known to be configured in this environment. A failed provider fanout creates noisy run transitions without useful review signal.
128
136
  - Keep one public communication model: `spawn` creates actors, `message` sends typed envelopes, and `inspect` observes. Avoid adding public side channels or storage nouns when a normal actor address/view can express the operation.
129
137
  - Keep route and semantic type separate. Direct, room, coordinator, and session messages may share `type`; delivery behavior comes from `to`.
@@ -189,7 +197,6 @@ Minimal actor recipe:
189
197
 
190
198
  ```json
191
199
  {
192
- "name": "my-task",
193
200
  "async": true,
194
201
  "args": ["path:path", "model:string"],
195
202
  "defaults": {},
@@ -210,11 +217,11 @@ Rules:
210
217
  4. Use `imports` to compose recipes; imported recipes are definitions, not nested async runs.
211
218
  5. Declare `mailbox` for actors that accept or emit meaningful messages.
212
219
  6. Declare `artifacts` for durable outputs the coordinator should inspect.
213
- 7. Recipe identity comes from the filename basename when `name` is omitted.
220
+ 7. File-backed recipe identity comes from the filename basename; legacy top-level `name` fields are ignored by loaders.
214
221
  8. Keep packaged recipes generic: no machine-local paths, no private companion identities, no project-specific defaults unless the recipe is explicitly project-specific.
215
222
  9. Do not ship concrete model-version defaults in packaged recipes; expose `model`, `models`, and stage-specific model args so the caller must choose current policy at launch.
216
223
 
217
- Priority for same-name recipes:
224
+ Priority for same-id recipes:
218
225
 
219
226
  1. No recipe: no capability.
220
227
  2. Packaged pi-actors recipe: standard-library declarative actor component.
@@ -270,7 +277,7 @@ Use packaged recipes by name with `spawn file=<name>` for async actors, or regis
270
277
  - [`pipeline-docs-maintenance`](../../recipes/pipeline-docs-maintenance.json): docs index/review/planning → maintenance artifact.
271
278
  - Artifacts: [`pipeline-artifact-report`](../../recipes/pipeline-artifact-report.json), [`pipeline-artifact-write`](../../recipes/pipeline-artifact-write.json), [`pipeline-artifact-bundle`](../../recipes/pipeline-artifact-bundle.json).
272
279
  - Review gates: [`pipeline-quorum-review`](../../recipes/pipeline-quorum-review.json), [`pipeline-review-readiness`](../../recipes/pipeline-review-readiness.json).
273
- - Task-first workflows: [`pipeline-architect-coordinator`](../../recipes/pipeline-architect-coordinator.json), [`pipeline-research-synthesis`](../../recipes/pipeline-research-synthesis.json), [`pipeline-development-tasking`](../../recipes/pipeline-development-tasking.json), [`pipeline-checkpoint-continuation`](../../recipes/pipeline-checkpoint-continuation.json), [`pipeline-media-library`](../../recipes/pipeline-media-library.json).
280
+ - Task-first workflows: [`pipeline-architect-coordinator`](../../recipes/pipeline-architect-coordinator.json), [`pipeline-research-synthesis`](../../recipes/pipeline-research-synthesis.json), [`pipeline-development-tasking`](../../recipes/pipeline-development-tasking.json), [`pipeline-checkpoint-continuation`](../../recipes/pipeline-checkpoint-continuation.json), [`pipeline-media-library`](../../recipes/pipeline-media-library.json), [`pipeline-room-swarm`](../../recipes/pipeline-room-swarm.json). For room swarms, prefer `roles_path` for custom role JSON and keep role `name` ASCII-safe for branch addresses. Use `locker=true` when the swarm needs a coordinator-locker-backed artifact lock and journal.
274
281
 
275
282
  ### Utilities
276
283
 
@@ -285,14 +292,15 @@ Deep inventory: [`docs/recipe-library.md`](../../docs/recipe-library.md).
285
292
  - **Short deterministic command**: call foreground registered tool or command template.
286
293
  - **Long job/service/fanout**: `spawn` async recipe, then inspect/messages/artifacts.
287
294
  - **One-off experiment**: inline `template`; promote after repeat use.
288
- - **Reusable workflow**: recipe with public knobs, mailbox, artifacts, docs.
289
- - **Subagent/swarm execution**: actor mechanics here; methodology belongs to swarm guidance.
295
+ - **Reusable workflow**: packaged or user recipe with public knobs, mailbox, artifacts, docs.
296
+ - **Subagent/swarm execution**: compose packaged recipes/pipelines from smaller recipe cells; add missing generic cells to the extension rather than creating one-off external orchestration scripts.
297
+ - **Consensus-first build**: when many lenses should shape one artifact, have proposer subagents post room messages, then one named implementer writes, one QA reviewer checks, and one finalizer emits `run.done`; do not ask every lens to mutate the same artifact.
290
298
  - **Coordinated workers**: spawn `coordinator-locker` when several actors need a shared queue, acquire/renew/release resource leases, or a journaled coordination point.
291
299
  - **Release/review pipeline**: pi-actors can prepare evidence, summaries, and artifacts; external actions such as commit, PR, merge, tag, and publish require the appropriate gated release workflow.
292
300
 
293
301
  ## Complementary Methodology Engines
294
302
 
295
- pi-actors is the local execution engine for methodology skills. A methodology skill can define abstract patterns such as lens swarm, quorum, task cards, lock discipline, or clean-context merge; pi-actors turns those patterns into concrete local actors, recipes, queues, leases, artifacts, and messages.
303
+ pi-actors is the local execution engine for methodology skills. A methodology skill can define abstract patterns such as lens swarm, quorum, task cards, lock discipline, consensus-first build, or clean-context merge; pi-actors turns those patterns into concrete local actors, recipes, queues, leases, artifacts, and messages.
296
304
 
297
305
  Example mapping:
298
306
 
@@ -313,19 +321,24 @@ Keep the split clean: methodology chooses coordination shape; pi-actors supplies
313
321
  3. Inspect `status` after launch.
314
322
  4. Use notifications and `inspect`; do not busy-poll.
315
323
  5. Read `messages` and `artifacts`, not only stdout.
316
- 6. Use `message` for explicit control or domain commands.
324
+ 6. Use `message` for explicit control or domain commands; treat direct branch messages as intended initiating work. Direct branch envelopes are queued under the recipient branch inbox and can be inspected with `inspect branch:<run>/<branch> view=mailbox`; queued entries have stable `id` values and internal `claimed` / `handled` / `failed` states for worker protocols and retries. Room messages are shared transcript/context.
317
325
  7. Promote repeated inline forms to recipes.
318
- 8. Update docs/context when changing public behavior.
326
+ 8. Keep recipes small and shallow: files over 1 MiB or import chains deeper than 32 are rejected.
327
+ 9. Update docs/context when changing public behavior; if the change affects how agents operate this extension, update this skill and the bundled prompt guidance too.
319
328
 
320
329
  ## Common Pitfalls
321
330
 
322
331
  - Treating actor mechanics as multi-agent methodology.
323
332
  - Repeating inline templates instead of promoting recipes.
333
+ - Creating task-specific external orchestration scripts when the scenario belongs in pi-actors as a reusable recipe/pipeline with prompts, roles, artifact paths, and model/tool policy passed as args.
334
+ - Embedding complex shell loops or Bash `${...}` parameter expansion directly in command templates; braces are pi-actors placeholders too, so put only generic trusted helper cells in packaged scripts when command-template composition is not enough.
324
335
  - Omitting stable run ids for work that needs follow-up.
325
336
  - Sending domain messages without checking `mailbox`.
337
+ - Expecting current room messages to wake prompt-only subagents; use direct branch messages or a runner protocol for initiating work.
326
338
  - Reading only stdout and missing actor messages/artifacts.
327
339
  - Baking local absolute paths into published docs or reusable recipes.
328
340
  - Creating recipes that perform external side effects without explicit operator gates.
341
+ - Letting project insights live only in chat instead of updating BACKLOG/CHANGELOG/docs and, when agent behavior changes, the packaged skill or prompt guidance.
329
342
  - Preserving old runtime/event/FIFO vocabulary instead of `spawn`/`message`/`inspect` and actor messages.
330
343
 
331
344
  ## Deep References
@@ -2,7 +2,7 @@
2
2
  name: swarm
3
3
  description: Subagent orchestration with scoped locks and quorum consensus. Use for multi-model review, parallel scoped work, delegated audit, and coordinated subagent execution.
4
4
  metadata:
5
- version: 0.17.0
5
+ version: 0.18.0
6
6
  ---
7
7
 
8
8
  # Swarm
@@ -135,6 +135,20 @@ Planner → Lens Swarm → Merger → Scoped Implementers → Integrator → Rev
135
135
 
136
136
  Use scoped write locks or a repository-local soft-lock manifest when multiple implementers may edit files. Keep implementation agents bounded by module, artifact, or responsibility: code, tests, docs, examples, migration, or release notes. Prefer one owner per writable scope and run verification with fresh reviewers after implementation.
137
137
 
138
+ ### Consensus-First Build Swarm
139
+
140
+ Purpose: create one coherent artifact from several expert lenses without making every participant write the artifact.
141
+
142
+ Recommended flow:
143
+
144
+ ```text
145
+ Lens proposers → shared room consensus → named implementer → QA reviewer → finalizer
146
+ ```
147
+
148
+ Use this shape for creative/product artifacts, demos, single-file deliverables, docs, specs, prompts, and other work where parallel implementation would fragment the result. Lens proposers should post concrete constraints, proposals, and handoff notes to the shared room but should not mutate files. One named implementer inspects the room transcript and owns the first artifact write. A fresh QA reviewer inspects the artifact plus room evidence and reports issues back to the room. The implementer/finalizer then applies only the review-grounded fixes and emits the final artifact message.
149
+
150
+ Failure mode: if the runner only asks all lenses to chat and then writes a report, it can "succeed" without producing the requested artifact. Guard against this with explicit artifact assertions, role-specific write permissions, and a finalizer that checks artifact existence/size/content before `run.done`.
151
+
138
152
  ### Small-Team Development Swarm
139
153
 
140
154
  For 2–4 implementation agents, prefer the dedicated MAWP reference instead of expanding the general Swarm skill. The portable idea is simple: isolate writable work surfaces, give each agent a bounded task card, preserve handoff evidence, and merge through one integrator.