@llblab/pi-actors 0.40.0 → 0.40.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.
- package/AGENTS.md +2 -2
- package/BACKLOG.md +3 -1
- package/CHANGELOG.md +6 -0
- package/README.md +3 -3
- package/dist/lib/observability.d.ts +1 -1
- package/dist/lib/observability.js +2 -2
- package/dist/lib/pi.d.ts +1 -1
- package/dist/lib/pi.js +2 -2
- package/dist/lib/prompts.d.ts +1 -1
- package/dist/lib/prompts.js +3 -3
- package/dist/skills/actors/SKILL.md +6 -3
- package/dist/skills/swarm/SKILL.md +4 -2
- package/docs/async-runs.md +2 -2
- package/lib/observability.ts +3 -3
- package/lib/pi.ts +3 -3
- package/lib/prompts.ts +3 -3
- package/package.json +1 -1
- package/skills/actors/SKILL.md +6 -3
- package/skills/swarm/SKILL.md +4 -2
package/AGENTS.md
CHANGED
|
@@ -107,8 +107,8 @@ Pi host
|
|
|
107
107
|
- Preserve node controls: `when`, positive `timeout`, `delay`, bounded `retry`, `failure`, and `recover` cleanup.
|
|
108
108
|
- 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.
|
|
109
109
|
- Keep async run state under `~/.pi/agent/tmp/pi-actors/runs` with injected `{run_id}` and `{state_dir}` values.
|
|
110
|
-
- Preserve event-driven observability: durable retrying terminal
|
|
111
|
-
- When a deferred actor result gates the next step, wait for its terminal
|
|
110
|
+
- Preserve event-driven observability: durable retrying terminal follow-up notifications, coordinator-bound outbox messages, branch-aware triangles, process-tree expansion, and bounded body previews. Queue coordinator context 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. Terminal delivery is at-least-once across the unavoidable send/handled-marker crash window.
|
|
111
|
+
- 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.
|
|
112
112
|
- Do not restore busy-polling examples, duplicate terminal notifications, or duplicate notifications for handled `cancel`, `kill`, or control-stop actions.
|
|
113
113
|
|
|
114
114
|
## Recipes And Registry
|
package/BACKLOG.md
CHANGED
|
@@ -39,7 +39,9 @@ Non-goals:
|
|
|
39
39
|
|
|
40
40
|
## Open Work
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### Manual draft-memory consolidation
|
|
43
|
+
|
|
44
|
+
- [ ] Add a manually invoked command that launches an agent-led consolidation cycle over `~/.pi/agent/recipes/drafts`. The cycle must inventory and classify every draft, propose a complete `promote`, `merge`, or `discard` plan, require explicit operator confirmation before mutations, normalize approved reusable capabilities into active recipe-backed tools under `~/.pi/agent/recipes`, and remove every handled source so the drafts directory finishes empty. It must never run automatically or promote tools silently; preserve evidence for each decision and add regressions for plan-only, confirmation, promotion, merge, discard, failure recovery, and empty-directory completion.
|
|
43
45
|
|
|
44
46
|
## Backlog Curation Rules
|
|
45
47
|
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.40.1: Follow-up Delivery Hotfix
|
|
6
|
+
|
|
7
|
+
- `[Coordinator Delivery]` Queue terminal and coordinator-bound actor notifications through Pi's `followUp` delivery mode instead of `steer`, while retaining `triggerTurn: true` for idle sessions. Impact: active coordinators finish their current work before actor results arrive, and Pi can apply its configured follow-up batching policy to concurrently completed runs instead of injecting each result between tool calls.
|
|
8
|
+
- `[Agent Autonomy]` Clarified in the injected prompt and bundled Actors skill that command-template strings execute directly without shell evaluation, so `&&`, pipes, redirects, and `cd` do not provide shell composition. Strengthened both skill descriptions and added explicit Swarm activation for multiple parallel actors, independent artifact generation, implementation fanout, and review; the coordinator now receives a compact preflight contract for disjoint scopes, stable run ids, artifacts, launch correctness, integration, and final validation. Impact: agents avoid malformed launches such as `cd <dir> && pi ...` and autonomously load the right orchestration guidance before multi-actor work.
|
|
9
|
+
- `[CI Stability]` Wait for the detached runner process to exit before removing the large-review-evidence fixture directory, and wait for the terminal evidence manifest instead of racing its final write. Impact: Linux CI cleanup no longer intermittently fails with `ENOTEMPTY` after the assertions pass.
|
|
10
|
+
|
|
5
11
|
## 0.40.0: Durable Review and Runtime Hardening
|
|
6
12
|
|
|
7
13
|
- `[Runtime]` Collapsed every natural-language positional fragment in child `pi -p` launches into one inspectable prompt file while preserving Pi options and intentional `@file` attachments, so review stages receive one authoritative user turn and preflight diagnostics resolve the concrete stage.
|
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Use actors instead of ad hoc shell backgrounding when work is long-running, stat
|
|
|
65
65
|
Start an actor:
|
|
66
66
|
|
|
67
67
|
```text
|
|
68
|
-
spawn template="sleep 30
|
|
68
|
+
spawn template="sleep 30" as=run:demo
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
Inspect it when you need evidence:
|
|
@@ -125,7 +125,7 @@ Routing comes from `to`, actor ownership, and runtime policy. `type` describes i
|
|
|
125
125
|
| --- | --- | --- |
|
|
126
126
|
| Command templates | Portable command graphs with placeholders, defaults, guards, retries, parallel nodes, recovery, and timeouts | Wrap a trusted local executable without writing a bespoke tool |
|
|
127
127
|
| Recipes | JSON/Markdown capability specs with metadata, args, defaults, imports, mailbox contracts, artifacts, and async mode | Save a known-good local workflow as reusable muscle memory |
|
|
128
|
-
| Async runs | File-backed detached lifecycle, logs, progress, output, cancellation, artifacts, and durable terminal
|
|
128
|
+
| Async runs | File-backed detached lifecycle, logs, progress, output, cancellation, artifacts, and durable terminal follow-up notifications | Let model work, media jobs, services, or pipelines continue after the turn |
|
|
129
129
|
| Message protocol | Typed envelopes across run, tool, branch, room, coordinator, and session targets | Continue, approve, kill, or route work without restarting actors |
|
|
130
130
|
| Rooms and rosters | Run-local group timeline with actor join/leave, contacts, previews, and branch-aware delivery | Coordinate multiple subagents under one visible run |
|
|
131
131
|
| Registry and recipe doctor | Discovered tools, overrides, drafts, invalid recipes, and advisory risk labels | Audit local capability memory before using or promoting it |
|
|
@@ -275,7 +275,7 @@ Packaged recipes are building blocks. Use `spawn file=<recipe>` for maintained p
|
|
|
275
275
|
| A useful output that should survive context compression | Artifacts |
|
|
276
276
|
| A repeated local workflow | Recipe/tool memory |
|
|
277
277
|
|
|
278
|
-
When a directly spawned inline/ad hoc actor or a recipe outside the user recipe root completes successfully, `pi-actors` may include a promotion suggestion in its terminal
|
|
278
|
+
When a directly spawned inline/ad hoc actor or a recipe outside the user recipe root completes successfully, `pi-actors` may include a promotion suggestion in its terminal follow-up notification. The agent should ask first and never auto-save.
|
|
279
279
|
|
|
280
280
|
## Platform support
|
|
281
281
|
|
|
@@ -50,7 +50,7 @@ export interface RunUiSnapshot {
|
|
|
50
50
|
}
|
|
51
51
|
export interface RunUiNotificationSink {
|
|
52
52
|
notify(message: string, level: "info" | "warning" | "error"): void;
|
|
53
|
-
|
|
53
|
+
sendFollowUp(message: {
|
|
54
54
|
customType: string;
|
|
55
55
|
content: string;
|
|
56
56
|
display: true;
|
|
@@ -37,7 +37,7 @@ export function deliverRunTransitionNotifications(transitions, sink) {
|
|
|
37
37
|
sink.notify(text, getRunTransitionNotificationType(transition));
|
|
38
38
|
if (!shouldSendRunTransitionFollowUp(transition))
|
|
39
39
|
continue;
|
|
40
|
-
sink.
|
|
40
|
+
sink.sendFollowUp({
|
|
41
41
|
customType: "pi-actors-run",
|
|
42
42
|
content: text,
|
|
43
43
|
display: true,
|
|
@@ -56,7 +56,7 @@ export function deliverRunOutboxNotifications(events, sink) {
|
|
|
56
56
|
sink.notify(text, getRunOutboxNotificationType(event));
|
|
57
57
|
if (!shouldSendRunOutboxFollowUp(event))
|
|
58
58
|
continue;
|
|
59
|
-
sink.
|
|
59
|
+
sink.sendFollowUp({
|
|
60
60
|
customType: "pi-actors-run-message",
|
|
61
61
|
content: text,
|
|
62
62
|
display: true,
|
package/dist/lib/pi.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-a
|
|
|
7
7
|
export type { ExtensionAPI, ExtensionContext };
|
|
8
8
|
export interface PiNotificationSink {
|
|
9
9
|
notify(message: string, level: "info" | "warning" | "error"): void;
|
|
10
|
-
|
|
10
|
+
sendFollowUp(message: {
|
|
11
11
|
customType: string;
|
|
12
12
|
content: string;
|
|
13
13
|
display: true;
|
package/dist/lib/pi.js
CHANGED
|
@@ -9,8 +9,8 @@ export function getSessionId(ctx) {
|
|
|
9
9
|
export function createNotificationSink(pi, ctx) {
|
|
10
10
|
return {
|
|
11
11
|
notify: (message, level) => ctx.ui.notify(message, level),
|
|
12
|
-
|
|
13
|
-
deliverAs: "
|
|
12
|
+
sendFollowUp: (message) => pi.sendMessage(message, {
|
|
13
|
+
deliverAs: "followUp",
|
|
14
14
|
triggerTurn: true,
|
|
15
15
|
}),
|
|
16
16
|
};
|
package/dist/lib/prompts.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export declare const REGISTER_TOOL_DESCRIPTION: string;
|
|
7
7
|
export declare const REGISTER_TOOL_PROMPT_SNIPPET = "Register persistent command templates as agent-callable tools";
|
|
8
8
|
export declare const REGISTER_TOOL_GUIDELINES: string[];
|
|
9
|
-
export declare const ONBOARDING_SYSTEM_PROMPT = "pi-actors quick model:\n- Local-first actor memory: persist trusted local capabilities instead of rebuilding shell recipes.\n- Layers: task -> command template -> recipe/tool -> spawn -> run:<id>; tool:<name> wraps registered capabilities.\n- Command templates stay sync: string
|
|
9
|
+
export declare const ONBOARDING_SYSTEM_PROMPT = "pi-actors quick model:\n- Local-first actor memory: persist trusted local capabilities instead of rebuilding shell recipes.\n- Layers: task -> command template -> recipe/tool -> spawn -> run:<id>; tool:<name> wraps registered capabilities.\n- Command templates stay sync and shell-free: string leaves split into executable + argv, so operators such as && are literal arguments; use template arrays for sequencing or an explicit trusted shell/script when shell semantics are required. Flags include args/defaults, parallel, concurrency, min_successful, when, timeout, delay, retry, failure, recover, repeat, accept_output, output.\n- Placeholders support typed/default args plus {value??fallback} and {flag?yes:no}.\n- ~/.pi/agent/recipes/*.json is actor muscle memory: every recipe there is auto-registered as an agent tool across sessions; register_tool writes there.\n- Recipes own template directly and may declare metadata/defaults/imports/mailbox/artifacts; files >1 MiB or import depth >32 fail closed.\n- Recipe imports are local variables; imported recipes are definitions, not nested async runs; parent async:true creates one run.\n- Actor-mode trigger: if work may outlive this turn, need steering/follow-up/artifacts, run as a service, fan out, or be resumed/inspected later, use spawn -> message -> inspect instead of ad hoc shell backgrounding.\n- Use spawn/message/inspect for actor-level start/send/observe; short foreground checks can stay ordinary tools/templates; avoid runtime/FIFO/outbox vocabulary in public guidance.\n- Run state lives under ~/.pi/agent/tmp/pi-actors/runs. Inspect intentionally and avoid busy-polling. Terminal and coordinator-bound notifications queue as Pi follow-ups so concurrently completed actors can reach the coordinator after current work instead of steering between tool calls. 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 for an operator request, a meaningful actor event, or diagnosis of an overdue/stuck run.\n- Maintain ~/.pi/agent/recipes like MEMORY.md for capabilities: keep useful tools, curate stale ones, and fix/remove/disable invalid recipes flagged by registry warnings; packaged/ad hoc recipes are lower-priority components; offer to save successful recurring patterns only after confirmation.\n- Prefer maintained packaged recipes/pipelines with spawn file=<recipe> before ad hoc scripts/wrappers; review swarms inherit current model/thinking, preflight before fanout, and expose quorum/concurrency/TTL knobs unless explicit args are passed.\n- For any non-trivial actor use or pi-actors change, read the bundled actors skill first. Before launching multiple actors/subagents for parallel implementation, independent artifact generation, delegated audit, or review, also read the bundled swarm skill; the coordinator owns decomposition, disjoint scopes, launch correctness, integration, and final validation. For deeper guidance, inspect installed extension sources/docs/recipes because README/docs are not automatically in context.";
|
|
10
10
|
export declare const REGISTER_TOOL_PARAM_DESCRIPTIONS: {
|
|
11
11
|
readonly name: "Tool name in snake_case (e.g., 'transcribe')";
|
|
12
12
|
readonly description: "Describe what the tool does for the LLM. Required unless deleting; omitted updates keep the old description.";
|
package/dist/lib/prompts.js
CHANGED
|
@@ -16,17 +16,17 @@ export const REGISTER_TOOL_GUIDELINES = [
|
|
|
16
16
|
export const ONBOARDING_SYSTEM_PROMPT = `pi-actors quick model:
|
|
17
17
|
- Local-first actor memory: persist trusted local capabilities instead of rebuilding shell recipes.
|
|
18
18
|
- Layers: task -> command template -> recipe/tool -> spawn -> run:<id>; tool:<name> wraps registered capabilities.
|
|
19
|
-
- Command templates stay sync: string
|
|
19
|
+
- Command templates stay sync and shell-free: string leaves split into executable + argv, so operators such as && are literal arguments; use template arrays for sequencing or an explicit trusted shell/script when shell semantics are required. Flags include args/defaults, parallel, concurrency, min_successful, when, timeout, delay, retry, failure, recover, repeat, accept_output, output.
|
|
20
20
|
- Placeholders support typed/default args plus {value??fallback} and {flag?yes:no}.
|
|
21
21
|
- ~/.pi/agent/recipes/*.json is actor muscle memory: every recipe there is auto-registered as an agent tool across sessions; register_tool writes there.
|
|
22
22
|
- Recipes own template directly and may declare metadata/defaults/imports/mailbox/artifacts; files >1 MiB or import depth >32 fail closed.
|
|
23
23
|
- Recipe imports are local variables; imported recipes are definitions, not nested async runs; parent async:true creates one run.
|
|
24
24
|
- Actor-mode trigger: if work may outlive this turn, need steering/follow-up/artifacts, run as a service, fan out, or be resumed/inspected later, use spawn -> message -> inspect instead of ad hoc shell backgrounding.
|
|
25
25
|
- Use spawn/message/inspect for actor-level start/send/observe; short foreground checks can stay ordinary tools/templates; avoid runtime/FIFO/outbox vocabulary in public guidance.
|
|
26
|
-
- Run state lives under ~/.pi/agent/tmp/pi-actors/runs. Inspect intentionally and avoid busy-polling. When a deferred actor result gates the next step, wait for its terminal
|
|
26
|
+
- Run state lives under ~/.pi/agent/tmp/pi-actors/runs. Inspect intentionally and avoid busy-polling. Terminal and coordinator-bound notifications queue as Pi follow-ups so concurrently completed actors can reach the coordinator after current work instead of steering between tool calls. 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 for an operator request, a meaningful actor event, or diagnosis of an overdue/stuck run.
|
|
27
27
|
- Maintain ~/.pi/agent/recipes like MEMORY.md for capabilities: keep useful tools, curate stale ones, and fix/remove/disable invalid recipes flagged by registry warnings; packaged/ad hoc recipes are lower-priority components; offer to save successful recurring patterns only after confirmation.
|
|
28
28
|
- Prefer maintained packaged recipes/pipelines with spawn file=<recipe> before ad hoc scripts/wrappers; review swarms inherit current model/thinking, preflight before fanout, and expose quorum/concurrency/TTL knobs unless explicit args are passed.
|
|
29
|
-
- For any non-trivial actor use or pi-actors change, read the bundled actors skill first
|
|
29
|
+
- For any non-trivial actor use or pi-actors change, read the bundled actors skill first. Before launching multiple actors/subagents for parallel implementation, independent artifact generation, delegated audit, or review, also read the bundled swarm skill; the coordinator owns decomposition, disjoint scopes, launch correctness, integration, and final validation. For deeper guidance, inspect installed extension sources/docs/recipes because README/docs are not automatically in context.`;
|
|
30
30
|
export const REGISTER_TOOL_PARAM_DESCRIPTIONS = {
|
|
31
31
|
name: "Tool name in snake_case (e.g., 'transcribe')",
|
|
32
32
|
description: "Describe what the tool does for the LLM. Required unless deleting; omitted updates keep the old description.",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: actors
|
|
3
|
-
description: Required practical guide for non-trivial pi-actors use. Read before using or changing spawn, message, inspect, actor runs, tools, recipes, command templates, async lifecycle, mailboxes, artifacts, and local orchestration mechanics.
|
|
3
|
+
description: Required practical guide for non-trivial pi-actors use, including parallel actor launches, subagent fanout, and autonomous coordinator workflows. Read before using or changing spawn, message, inspect, actor runs, tools, recipes, command templates, async lifecycle, mailboxes, artifacts, and local orchestration mechanics.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.40.
|
|
5
|
+
version: 0.40.1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Actors (pi-actors)
|
|
@@ -53,6 +53,8 @@ Actor-mode trigger: if work may outlive this turn, needs steering/follow-up/arti
|
|
|
53
53
|
|
|
54
54
|
Use for long work, background services, subagents, fanout, pipelines, and reusable recipes.
|
|
55
55
|
|
|
56
|
+
Before a parallel launch, the coordinator should verify five things once: each actor owns a disjoint mutation scope, every run has a stable id, each durable result has an artifact path, every command template respects shell-free argv execution, and completion can return through follow-up delivery without polling. For multiple delegated implementation or review actors, also load the bundled Swarm skill before choosing decomposition, locks, or quorum shape.
|
|
57
|
+
|
|
56
58
|
```json
|
|
57
59
|
{
|
|
58
60
|
"as": "run:repo-health",
|
|
@@ -64,6 +66,7 @@ Use for long work, background services, subagents, fanout, pipelines, and reusab
|
|
|
64
66
|
|
|
65
67
|
Rules:
|
|
66
68
|
|
|
69
|
+
- Command-template strings execute directly without a shell. Operators such as `&&`, `||`, pipes, redirects, and `cd` remain literal argv unless an explicit trusted shell is the executable. Prefer absolute paths or template arrays for sequencing; put non-trivial shell behavior in a reviewed script.
|
|
67
70
|
- Use `file`/`recipe` for saved recipes; bare names resolve under `~/.pi/agent/recipes`.
|
|
68
71
|
- Use inline `template` for one-off experiments; promote useful repeats to recipes.
|
|
69
72
|
- When a successful actor follow-up suggests persistence, decide whether the pattern deserves durable tool memory; call `register_tool` yourself only when the evidence is strong, and ask before writing the user recipe root.
|
|
@@ -130,7 +133,7 @@ Actor inspector commands:
|
|
|
130
133
|
|
|
131
134
|
The table is compact and optimistic by default: bounded body previews, capped noisy room rows, branch-local inbox previews, stable event ids in selected-message details, and an inline roster summary in the form `name/role` that wraps only when needed. Use `unread` for queued branch inbox work and `branch <name>` / `current-branch <name>` for one branch's room/direct/inbox traffic. Rows with `metadata.requires_response=true` show a `!` attention marker. `/actors-inspect <number>` marks that row read for the current session filter. 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.
|
|
132
135
|
|
|
133
|
-
Let terminal notifications arrive. When a deferred actor result gates the next step, wait for that terminal
|
|
136
|
+
Let terminal notifications arrive. They queue through Pi's follow-up delivery mode, so a busy coordinator finishes its current work before receiving concurrently completed actor results; the host's `followUpMode` controls whether queued results arrive together or one at a time. When a deferred actor result gates the next step, wait for that terminal follow-up instead of scheduling continuation loops, repeatedly inspecting, or mutating the actor's reviewed scope. Idle coordinators still start a normal turn through `triggerTurn: true`. Inspect early only for an operator request, a meaningful actor event, or diagnosis of an overdue or stuck run.
|
|
134
137
|
|
|
135
138
|
## Runtime Communication Rules
|
|
136
139
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: swarm
|
|
3
|
-
description: Subagent orchestration with scoped locks and quorum consensus. Use for
|
|
3
|
+
description: Subagent and actor orchestration with scoped locks, fanout, and quorum consensus. Use before launching multiple parallel actors or subagents for independent implementation, artifact generation, review, delegated audit, coordinated execution, or any workflow that needs autonomous coordinator decomposition and integration.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.40.
|
|
5
|
+
version: 0.40.1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Swarm
|
|
@@ -13,6 +13,8 @@ Subagent orchestration: delegated review, quorum consensus, scoped locks, clean-
|
|
|
13
13
|
|
|
14
14
|
Run subagents safely and predictably through reusable orchestration contracts.
|
|
15
15
|
|
|
16
|
+
Activation rule: load this skill before launching multiple independent actors or subagents, even when the work is creative artifact generation rather than code review. The coordinator owns decomposition, disjoint scopes, launch correctness, result integration, and final validation; participants may choose local content or implementation details independently inside their assigned boundaries.
|
|
17
|
+
|
|
16
18
|
Swarm is independent. It must not require concrete sibling skill names, private repositories, local model aliases, or a specific tool registry layout. Local agents may bind the contracts to their own tools, command templates, model names, and review protocols.
|
|
17
19
|
|
|
18
20
|
Maintain this skill as a living orchestration standard. When real swarm work exposes better decomposition shapes, lock etiquette, quorum rules, checkpoint semantics, failure modes, or trade-offs, fold those lessons back here as durable guidance instead of leaving them only in one-off transcripts or backlog notes.
|
package/docs/async-runs.md
CHANGED
|
@@ -216,9 +216,9 @@ Runtime wake notifications are now modeled separately from durable queues. Messa
|
|
|
216
216
|
|
|
217
217
|
## Coordinator Notifications
|
|
218
218
|
|
|
219
|
-
The launching coordinator should not busy-poll long-running async runs. The extension watches run state directories and
|
|
219
|
+
The launching coordinator should not busy-poll long-running async runs. The extension watches run state directories and queues terminal `done`/`failed`/unhandled `killed`/`exited` transitions back to the owning session through Pi's `followUp` delivery mode with `triggerTurn: true`; a busy coordinator finishes its current work before queued actor results arrive, while an idle coordinator starts a normal turn without a racy manual idle check. Pi's configured `followUpMode` determines whether concurrently queued results arrive together or one at a time. Script-authored `notify`/`followup` actor messages still follow their declared outbox delivery policy. Terminal notifications include recipe-level named `artifacts` when declared. The generic runner also emits compact `command.done` actor messages for completed leaf commands; recipe authors declare that capability in `mailbox.emits` rather than configuring a separate delivery policy. Failures and in-flight parallel branch completions can bubble according to outbox policy, while successful final leaf completions stay diagnostic to avoid flooding long sequential pipelines. Intentional `control.kill` and recipe-local stop commands stay out of coordinator context because the initiating message already returns synchronously or is handled by actor-local policy. If a notification asks for direction, answer with `message` rather than starting a polling loop. Use explicit `inspect` only when a delivered notification requests inspection, a real decision depends on state, or a suspected stuck run needs diagnosis — never merely because a timeout elapsed.
|
|
220
220
|
|
|
221
|
-
Ambient status indicators may refresh while work is active, but coordinator attention is driven from run-state changes rather than a coordinator agent loop. This lets the coordinator continue other work after `spawn`; the run signals back through lifecycle state, results, and actor messages. An owned terminal run without `terminal-handled.json` remains retry-eligible during same-runtime and extension/session replacement reconciliation; the marker is written only after successful
|
|
221
|
+
Ambient status indicators may refresh while work is active, but coordinator attention is driven from run-state changes rather than a coordinator agent loop. This lets the coordinator continue other work after `spawn`; the run signals back through lifecycle state, results, and actor messages. An owned terminal run without `terminal-handled.json` remains retry-eligible during same-runtime and extension/session replacement reconciliation; the marker is written only after successful follow-up delivery, and initial reconciliation does not replay historical outbox traffic. This is an at-least-once contract: a process crash after send but before marker persistence can produce a duplicate notification, while a failed send remains durably retryable. The ambient triangle count represents active async work units: each running async run contributes at least one triangle, and a run with multiple active parallel command/subagent branches contributes the reported active branch count. If a coordinator starts one parent run with four active parallel branches, four triangles are shown; if the same coordinator starts five independent single-branch runs, five triangles are shown.
|
|
222
222
|
|
|
223
223
|
## Run Actor Messages
|
|
224
224
|
|
package/lib/observability.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface RunUiSnapshot {
|
|
|
81
81
|
|
|
82
82
|
export interface RunUiNotificationSink {
|
|
83
83
|
notify(message: string, level: "info" | "warning" | "error"): void;
|
|
84
|
-
|
|
84
|
+
sendFollowUp(message: {
|
|
85
85
|
customType: string;
|
|
86
86
|
content: string;
|
|
87
87
|
display: true;
|
|
@@ -140,7 +140,7 @@ export function deliverRunTransitionNotifications(
|
|
|
140
140
|
const text = formatRunTransitionMessage(transition);
|
|
141
141
|
sink.notify(text, getRunTransitionNotificationType(transition));
|
|
142
142
|
if (!shouldSendRunTransitionFollowUp(transition)) continue;
|
|
143
|
-
sink.
|
|
143
|
+
sink.sendFollowUp({
|
|
144
144
|
customType: "pi-actors-run",
|
|
145
145
|
content: text,
|
|
146
146
|
display: true,
|
|
@@ -164,7 +164,7 @@ export function deliverRunOutboxNotifications(
|
|
|
164
164
|
const text = formatRunOutboxMessage(event);
|
|
165
165
|
sink.notify(text, getRunOutboxNotificationType(event));
|
|
166
166
|
if (!shouldSendRunOutboxFollowUp(event)) continue;
|
|
167
|
-
sink.
|
|
167
|
+
sink.sendFollowUp({
|
|
168
168
|
customType: "pi-actors-run-message",
|
|
169
169
|
content: text,
|
|
170
170
|
display: true,
|
package/lib/pi.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type { ExtensionAPI, ExtensionContext };
|
|
|
13
13
|
|
|
14
14
|
export interface PiNotificationSink {
|
|
15
15
|
notify(message: string, level: "info" | "warning" | "error"): void;
|
|
16
|
-
|
|
16
|
+
sendFollowUp(message: {
|
|
17
17
|
customType: string;
|
|
18
18
|
content: string;
|
|
19
19
|
display: true;
|
|
@@ -31,9 +31,9 @@ export function createNotificationSink(
|
|
|
31
31
|
): PiNotificationSink {
|
|
32
32
|
return {
|
|
33
33
|
notify: (message, level) => ctx.ui.notify(message, level),
|
|
34
|
-
|
|
34
|
+
sendFollowUp: (message) =>
|
|
35
35
|
pi.sendMessage(message, {
|
|
36
|
-
deliverAs: "
|
|
36
|
+
deliverAs: "followUp",
|
|
37
37
|
triggerTurn: true,
|
|
38
38
|
}),
|
|
39
39
|
};
|
package/lib/prompts.ts
CHANGED
|
@@ -22,17 +22,17 @@ export const REGISTER_TOOL_GUIDELINES = [
|
|
|
22
22
|
export const ONBOARDING_SYSTEM_PROMPT = `pi-actors quick model:
|
|
23
23
|
- Local-first actor memory: persist trusted local capabilities instead of rebuilding shell recipes.
|
|
24
24
|
- Layers: task -> command template -> recipe/tool -> spawn -> run:<id>; tool:<name> wraps registered capabilities.
|
|
25
|
-
- Command templates stay sync: string
|
|
25
|
+
- Command templates stay sync and shell-free: string leaves split into executable + argv, so operators such as && are literal arguments; use template arrays for sequencing or an explicit trusted shell/script when shell semantics are required. Flags include args/defaults, parallel, concurrency, min_successful, when, timeout, delay, retry, failure, recover, repeat, accept_output, output.
|
|
26
26
|
- Placeholders support typed/default args plus {value??fallback} and {flag?yes:no}.
|
|
27
27
|
- ~/.pi/agent/recipes/*.json is actor muscle memory: every recipe there is auto-registered as an agent tool across sessions; register_tool writes there.
|
|
28
28
|
- Recipes own template directly and may declare metadata/defaults/imports/mailbox/artifacts; files >1 MiB or import depth >32 fail closed.
|
|
29
29
|
- Recipe imports are local variables; imported recipes are definitions, not nested async runs; parent async:true creates one run.
|
|
30
30
|
- Actor-mode trigger: if work may outlive this turn, need steering/follow-up/artifacts, run as a service, fan out, or be resumed/inspected later, use spawn -> message -> inspect instead of ad hoc shell backgrounding.
|
|
31
31
|
- Use spawn/message/inspect for actor-level start/send/observe; short foreground checks can stay ordinary tools/templates; avoid runtime/FIFO/outbox vocabulary in public guidance.
|
|
32
|
-
- Run state lives under ~/.pi/agent/tmp/pi-actors/runs. Inspect intentionally and avoid busy-polling. When a deferred actor result gates the next step, wait for its terminal
|
|
32
|
+
- Run state lives under ~/.pi/agent/tmp/pi-actors/runs. Inspect intentionally and avoid busy-polling. Terminal and coordinator-bound notifications queue as Pi follow-ups so concurrently completed actors can reach the coordinator after current work instead of steering between tool calls. 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 for an operator request, a meaningful actor event, or diagnosis of an overdue/stuck run.
|
|
33
33
|
- Maintain ~/.pi/agent/recipes like MEMORY.md for capabilities: keep useful tools, curate stale ones, and fix/remove/disable invalid recipes flagged by registry warnings; packaged/ad hoc recipes are lower-priority components; offer to save successful recurring patterns only after confirmation.
|
|
34
34
|
- Prefer maintained packaged recipes/pipelines with spawn file=<recipe> before ad hoc scripts/wrappers; review swarms inherit current model/thinking, preflight before fanout, and expose quorum/concurrency/TTL knobs unless explicit args are passed.
|
|
35
|
-
- For any non-trivial actor use or pi-actors change, read the bundled actors skill first
|
|
35
|
+
- For any non-trivial actor use or pi-actors change, read the bundled actors skill first. Before launching multiple actors/subagents for parallel implementation, independent artifact generation, delegated audit, or review, also read the bundled swarm skill; the coordinator owns decomposition, disjoint scopes, launch correctness, integration, and final validation. For deeper guidance, inspect installed extension sources/docs/recipes because README/docs are not automatically in context.`;
|
|
36
36
|
|
|
37
37
|
export const REGISTER_TOOL_PARAM_DESCRIPTIONS = {
|
|
38
38
|
name: "Tool name in snake_case (e.g., 'transcribe')",
|
package/package.json
CHANGED
package/skills/actors/SKILL.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: actors
|
|
3
|
-
description: Required practical guide for non-trivial pi-actors use. Read before using or changing spawn, message, inspect, actor runs, tools, recipes, command templates, async lifecycle, mailboxes, artifacts, and local orchestration mechanics.
|
|
3
|
+
description: Required practical guide for non-trivial pi-actors use, including parallel actor launches, subagent fanout, and autonomous coordinator workflows. Read before using or changing spawn, message, inspect, actor runs, tools, recipes, command templates, async lifecycle, mailboxes, artifacts, and local orchestration mechanics.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.40.
|
|
5
|
+
version: 0.40.1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Actors (pi-actors)
|
|
@@ -53,6 +53,8 @@ Actor-mode trigger: if work may outlive this turn, needs steering/follow-up/arti
|
|
|
53
53
|
|
|
54
54
|
Use for long work, background services, subagents, fanout, pipelines, and reusable recipes.
|
|
55
55
|
|
|
56
|
+
Before a parallel launch, the coordinator should verify five things once: each actor owns a disjoint mutation scope, every run has a stable id, each durable result has an artifact path, every command template respects shell-free argv execution, and completion can return through follow-up delivery without polling. For multiple delegated implementation or review actors, also load the bundled Swarm skill before choosing decomposition, locks, or quorum shape.
|
|
57
|
+
|
|
56
58
|
```json
|
|
57
59
|
{
|
|
58
60
|
"as": "run:repo-health",
|
|
@@ -64,6 +66,7 @@ Use for long work, background services, subagents, fanout, pipelines, and reusab
|
|
|
64
66
|
|
|
65
67
|
Rules:
|
|
66
68
|
|
|
69
|
+
- Command-template strings execute directly without a shell. Operators such as `&&`, `||`, pipes, redirects, and `cd` remain literal argv unless an explicit trusted shell is the executable. Prefer absolute paths or template arrays for sequencing; put non-trivial shell behavior in a reviewed script.
|
|
67
70
|
- Use `file`/`recipe` for saved recipes; bare names resolve under `~/.pi/agent/recipes`.
|
|
68
71
|
- Use inline `template` for one-off experiments; promote useful repeats to recipes.
|
|
69
72
|
- When a successful actor follow-up suggests persistence, decide whether the pattern deserves durable tool memory; call `register_tool` yourself only when the evidence is strong, and ask before writing the user recipe root.
|
|
@@ -130,7 +133,7 @@ Actor inspector commands:
|
|
|
130
133
|
|
|
131
134
|
The table is compact and optimistic by default: bounded body previews, capped noisy room rows, branch-local inbox previews, stable event ids in selected-message details, and an inline roster summary in the form `name/role` that wraps only when needed. Use `unread` for queued branch inbox work and `branch <name>` / `current-branch <name>` for one branch's room/direct/inbox traffic. Rows with `metadata.requires_response=true` show a `!` attention marker. `/actors-inspect <number>` marks that row read for the current session filter. 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.
|
|
132
135
|
|
|
133
|
-
Let terminal notifications arrive. When a deferred actor result gates the next step, wait for that terminal
|
|
136
|
+
Let terminal notifications arrive. They queue through Pi's follow-up delivery mode, so a busy coordinator finishes its current work before receiving concurrently completed actor results; the host's `followUpMode` controls whether queued results arrive together or one at a time. When a deferred actor result gates the next step, wait for that terminal follow-up instead of scheduling continuation loops, repeatedly inspecting, or mutating the actor's reviewed scope. Idle coordinators still start a normal turn through `triggerTurn: true`. Inspect early only for an operator request, a meaningful actor event, or diagnosis of an overdue or stuck run.
|
|
134
137
|
|
|
135
138
|
## Runtime Communication Rules
|
|
136
139
|
|
package/skills/swarm/SKILL.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: swarm
|
|
3
|
-
description: Subagent orchestration with scoped locks and quorum consensus. Use for
|
|
3
|
+
description: Subagent and actor orchestration with scoped locks, fanout, and quorum consensus. Use before launching multiple parallel actors or subagents for independent implementation, artifact generation, review, delegated audit, coordinated execution, or any workflow that needs autonomous coordinator decomposition and integration.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.40.
|
|
5
|
+
version: 0.40.1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Swarm
|
|
@@ -13,6 +13,8 @@ Subagent orchestration: delegated review, quorum consensus, scoped locks, clean-
|
|
|
13
13
|
|
|
14
14
|
Run subagents safely and predictably through reusable orchestration contracts.
|
|
15
15
|
|
|
16
|
+
Activation rule: load this skill before launching multiple independent actors or subagents, even when the work is creative artifact generation rather than code review. The coordinator owns decomposition, disjoint scopes, launch correctness, result integration, and final validation; participants may choose local content or implementation details independently inside their assigned boundaries.
|
|
17
|
+
|
|
16
18
|
Swarm is independent. It must not require concrete sibling skill names, private repositories, local model aliases, or a specific tool registry layout. Local agents may bind the contracts to their own tools, command templates, model names, and review protocols.
|
|
17
19
|
|
|
18
20
|
Maintain this skill as a living orchestration standard. When real swarm work exposes better decomposition shapes, lock etiquette, quorum rules, checkpoint semantics, failure modes, or trade-offs, fold those lessons back here as durable guidance instead of leaving them only in one-off transcripts or backlog notes.
|