@llblab/pi-actors 0.37.0 → 0.37.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/CHANGELOG.md +5 -0
- package/dist/lib/prompts.d.ts +1 -1
- package/dist/lib/prompts.js +1 -1
- package/dist/lib/recipes-context.js +55 -3
- package/dist/skills/actors/SKILL.md +3 -1
- package/dist/skills/swarm/SKILL.md +1 -1
- package/docs/recipe-library.md +2 -0
- package/lib/prompts.ts +1 -1
- package/lib/recipes-context.ts +57 -3
- package/package.json +1 -1
- package/skills/actors/SKILL.md +3 -1
- package/skills/swarm/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.37.1: Subagent Recipe Prompt Injection Hotfix
|
|
6
|
+
|
|
7
|
+
- `[Recipes]` Fixed actor recipe context injection for child `pi -p` launches with options after the print flag, so packaged subagent recipes such as `subagent-review` and `pipeline-review-readiness` append context to the actual prompt instead of corrupting `--model` or other option values.
|
|
8
|
+
- `[Guidance]` Tightened onboarding, actor-skill, and recipe-library guidance so agents prefer maintained packaged review recipes via `spawn file=<recipe>` before rebuilding script commands or creating unnecessary wrappers.
|
|
9
|
+
|
|
5
10
|
## 0.37.0: Direct Recipe Delegation And Quiet Overrides
|
|
6
11
|
|
|
7
12
|
- `[Recipes]` Added direct recipe delegation from `template` strings so thin wrappers can point at ready recipe names/paths while preserving priority resolution, inherited metadata, and import-based composition for richer graphs.
|
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 leaf, array sequence, object node; flags include args/defaults, parallel, when, timeout, delay, retry, failure, recover, repeat, 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 status/tail/messages/mailbox/files/artifacts intentionally and avoid busy-polling.\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-
|
|
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 leaf, array sequence, object node; flags include args/defaults, parallel, when, timeout, delay, retry, failure, recover, repeat, 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 status/tail/messages/mailbox/files/artifacts intentionally and avoid busy-polling.\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; long fanout = parent async recipe wrapping template(parallel:true) and imports.\n- For any non-trivial actor use or pi-actors change, read the bundled actors skill first; 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
|
@@ -25,7 +25,7 @@ export const ONBOARDING_SYSTEM_PROMPT = `pi-actors quick model:
|
|
|
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
26
|
- Run state lives under ~/.pi/agent/tmp/pi-actors/runs; inspect status/tail/messages/mailbox/files/artifacts intentionally and avoid busy-polling.
|
|
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; long fanout = parent async recipe wrapping template(parallel:true) and imports.
|
|
29
29
|
- For any non-trivial actor use or pi-actors change, read the bundled actors skill first; 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')",
|
|
@@ -10,14 +10,66 @@ function commandName(command) {
|
|
|
10
10
|
function isPiCommand(command) {
|
|
11
11
|
return commandName(command) === "pi";
|
|
12
12
|
}
|
|
13
|
+
const PI_PRINT_FLAGS = new Set(["-p", "--print"]);
|
|
14
|
+
const PI_VALUE_OPTIONS = new Set([
|
|
15
|
+
"--api-key",
|
|
16
|
+
"--append-system-prompt",
|
|
17
|
+
"--exclude-tools",
|
|
18
|
+
"--extension",
|
|
19
|
+
"--fork",
|
|
20
|
+
"--mode",
|
|
21
|
+
"--model",
|
|
22
|
+
"--models",
|
|
23
|
+
"--name",
|
|
24
|
+
"--prompt-template",
|
|
25
|
+
"--provider",
|
|
26
|
+
"--session",
|
|
27
|
+
"--session-dir",
|
|
28
|
+
"--skill",
|
|
29
|
+
"--system-prompt",
|
|
30
|
+
"--theme",
|
|
31
|
+
"--thinking",
|
|
32
|
+
"--tools",
|
|
33
|
+
]);
|
|
34
|
+
const PI_SHORT_VALUE_OPTIONS = new Set(["-e", "-n", "-t", "-xt"]);
|
|
35
|
+
function isPiPrintFlag(arg) {
|
|
36
|
+
return PI_PRINT_FLAGS.has(arg);
|
|
37
|
+
}
|
|
38
|
+
function isPiOption(arg) {
|
|
39
|
+
return arg.startsWith("-") && arg !== "-";
|
|
40
|
+
}
|
|
41
|
+
function piOptionConsumesNextArg(arg) {
|
|
42
|
+
if (arg.includes("="))
|
|
43
|
+
return false;
|
|
44
|
+
return PI_VALUE_OPTIONS.has(arg) || PI_SHORT_VALUE_OPTIONS.has(arg);
|
|
45
|
+
}
|
|
46
|
+
function isPiFileArgument(arg) {
|
|
47
|
+
return arg.startsWith("@") && arg.length > 1;
|
|
48
|
+
}
|
|
13
49
|
function findPrintPromptIndex(args) {
|
|
50
|
+
let printMode = false;
|
|
51
|
+
let positionalOnly = false;
|
|
52
|
+
let promptIndex;
|
|
14
53
|
for (let index = 0; index < args.length; index += 1) {
|
|
15
54
|
const arg = args[index];
|
|
16
|
-
if (
|
|
17
|
-
|
|
55
|
+
if (!positionalOnly && arg === "--") {
|
|
56
|
+
positionalOnly = true;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (!positionalOnly && isPiPrintFlag(arg)) {
|
|
60
|
+
printMode = true;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (!positionalOnly && isPiOption(arg)) {
|
|
64
|
+
if (piOptionConsumesNextArg(arg))
|
|
65
|
+
index += 1;
|
|
66
|
+
continue;
|
|
18
67
|
}
|
|
68
|
+
if (!printMode || isPiFileArgument(arg))
|
|
69
|
+
continue;
|
|
70
|
+
promptIndex = index;
|
|
19
71
|
}
|
|
20
|
-
return
|
|
72
|
+
return promptIndex;
|
|
21
73
|
}
|
|
22
74
|
function matchesActorContext(record, context) {
|
|
23
75
|
if (!context)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: actors
|
|
3
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.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.37.
|
|
5
|
+
version: 0.37.1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Actors (pi-actors)
|
|
@@ -284,6 +284,8 @@ The user recipe root is the default tool set by location. It accepts canonical J
|
|
|
284
284
|
|
|
285
285
|
Use packaged recipes by name with `spawn file=<name>` for async actors, or register/call them as tools when repeated use deserves a stable shortcut.
|
|
286
286
|
|
|
287
|
+
Packaged review recipes are directly spawnable. Use `spawn file="pipeline-review-readiness" values={...}` for readiness review or `spawn file="subagent-review" values={...}` for one reviewer; pass model/thinking/tool policy through values, then inspect the run. Do not recreate their script commands, call packaged scripts directly, or create wrapper recipes just to launch the maintained recipe.
|
|
288
|
+
|
|
287
289
|
- [`pipeline-room-swarm`](../../recipes/pipeline-room-swarm.json): room-visible swarm coordination with roles, rounds, optional locker, artifact synthesis, and `subagent_ttl_ms` for hard participant budgets.
|
|
288
290
|
- [`pipeline-repo-health`](../../recipes/pipeline-repo-health.json): git/doc/validation evidence → normalized repository health report.
|
|
289
291
|
- [`pipeline-release-readiness`](../../recipes/pipeline-release-readiness.json): changelog/package/skill/validation evidence → release review → artifact report.
|
package/docs/recipe-library.md
CHANGED
|
@@ -48,6 +48,8 @@ Core subagent recipes:
|
|
|
48
48
|
|
|
49
49
|
Most atoms expose policy knobs such as `model`, `thinking`, `tools`, `output_format`, `evidence_policy`, `risk_policy`, source policy, continuity policy, handoff format, or model pools. Packaged recipes intentionally do not ship concrete model-version defaults: callers must pass current model policy at launch, which keeps reusable recipe components from aging around old provider aliases. The generic prompt launchers, including `subagent-tools` and `subagents-prompts`, expose the same core model/thinking/tool/output knobs so callers do not need separate recipe families for policy tuning. Interactive async atoms also declare mailbox metadata for their basic control, completion, and domain-result message surface. Higher-level recipes pass these knobs through instead of hard-coding local policy.
|
|
50
50
|
|
|
51
|
+
For one-off packaged subagent reviews, launch the recipe directly with `spawn file="subagent-review" values={...}` or `spawn file="pipeline-review-readiness" values={...}`. Do not copy the underlying `pi -p` command or wrap the recipe unless you are creating a durable operator tool with a narrower interface.
|
|
52
|
+
|
|
51
53
|
For build-oriented swarms, prefer a consensus-first shape over parallel writers: proposer roles coordinate in a room with message/inspect tools, a named implementer owns the first artifact write, a QA reviewer inspects the result, and a finalizer applies review-grounded fixes before `run.done`. This pattern keeps creative/lens diversity while preserving one coherent artifact and gives recipes concrete artifact assertions instead of treating room discussion as success.
|
|
52
54
|
|
|
53
55
|
Register one atom:
|
package/lib/prompts.ts
CHANGED
|
@@ -31,7 +31,7 @@ export const ONBOARDING_SYSTEM_PROMPT = `pi-actors quick model:
|
|
|
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
32
|
- Run state lives under ~/.pi/agent/tmp/pi-actors/runs; inspect status/tail/messages/mailbox/files/artifacts intentionally and avoid busy-polling.
|
|
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; long fanout = parent async recipe wrapping template(parallel:true) and imports.
|
|
35
35
|
- For any non-trivial actor use or pi-actors change, read the bundled actors skill first; 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 = {
|
package/lib/recipes-context.ts
CHANGED
|
@@ -22,14 +22,68 @@ function isPiCommand(command: string): boolean {
|
|
|
22
22
|
return commandName(command) === "pi";
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const PI_PRINT_FLAGS = new Set(["-p", "--print"]);
|
|
26
|
+
const PI_VALUE_OPTIONS = new Set([
|
|
27
|
+
"--api-key",
|
|
28
|
+
"--append-system-prompt",
|
|
29
|
+
"--exclude-tools",
|
|
30
|
+
"--extension",
|
|
31
|
+
"--fork",
|
|
32
|
+
"--mode",
|
|
33
|
+
"--model",
|
|
34
|
+
"--models",
|
|
35
|
+
"--name",
|
|
36
|
+
"--prompt-template",
|
|
37
|
+
"--provider",
|
|
38
|
+
"--session",
|
|
39
|
+
"--session-dir",
|
|
40
|
+
"--skill",
|
|
41
|
+
"--system-prompt",
|
|
42
|
+
"--theme",
|
|
43
|
+
"--thinking",
|
|
44
|
+
"--tools",
|
|
45
|
+
]);
|
|
46
|
+
const PI_SHORT_VALUE_OPTIONS = new Set(["-e", "-n", "-t", "-xt"]);
|
|
47
|
+
|
|
48
|
+
function isPiPrintFlag(arg: string): boolean {
|
|
49
|
+
return PI_PRINT_FLAGS.has(arg);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function isPiOption(arg: string): boolean {
|
|
53
|
+
return arg.startsWith("-") && arg !== "-";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function piOptionConsumesNextArg(arg: string): boolean {
|
|
57
|
+
if (arg.includes("=")) return false;
|
|
58
|
+
return PI_VALUE_OPTIONS.has(arg) || PI_SHORT_VALUE_OPTIONS.has(arg);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function isPiFileArgument(arg: string): boolean {
|
|
62
|
+
return arg.startsWith("@") && arg.length > 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
25
65
|
function findPrintPromptIndex(args: string[]): number | undefined {
|
|
66
|
+
let printMode = false;
|
|
67
|
+
let positionalOnly = false;
|
|
68
|
+
let promptIndex: number | undefined;
|
|
26
69
|
for (let index = 0; index < args.length; index += 1) {
|
|
27
70
|
const arg = args[index];
|
|
28
|
-
if (
|
|
29
|
-
|
|
71
|
+
if (!positionalOnly && arg === "--") {
|
|
72
|
+
positionalOnly = true;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (!positionalOnly && isPiPrintFlag(arg)) {
|
|
76
|
+
printMode = true;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (!positionalOnly && isPiOption(arg)) {
|
|
80
|
+
if (piOptionConsumesNextArg(arg)) index += 1;
|
|
81
|
+
continue;
|
|
30
82
|
}
|
|
83
|
+
if (!printMode || isPiFileArgument(arg)) continue;
|
|
84
|
+
promptIndex = index;
|
|
31
85
|
}
|
|
32
|
-
return
|
|
86
|
+
return promptIndex;
|
|
33
87
|
}
|
|
34
88
|
|
|
35
89
|
function matchesActorContext(
|
package/package.json
CHANGED
package/skills/actors/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: actors
|
|
3
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.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.37.
|
|
5
|
+
version: 0.37.1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Actors (pi-actors)
|
|
@@ -284,6 +284,8 @@ The user recipe root is the default tool set by location. It accepts canonical J
|
|
|
284
284
|
|
|
285
285
|
Use packaged recipes by name with `spawn file=<name>` for async actors, or register/call them as tools when repeated use deserves a stable shortcut.
|
|
286
286
|
|
|
287
|
+
Packaged review recipes are directly spawnable. Use `spawn file="pipeline-review-readiness" values={...}` for readiness review or `spawn file="subagent-review" values={...}` for one reviewer; pass model/thinking/tool policy through values, then inspect the run. Do not recreate their script commands, call packaged scripts directly, or create wrapper recipes just to launch the maintained recipe.
|
|
288
|
+
|
|
287
289
|
- [`pipeline-room-swarm`](../../recipes/pipeline-room-swarm.json): room-visible swarm coordination with roles, rounds, optional locker, artifact synthesis, and `subagent_ttl_ms` for hard participant budgets.
|
|
288
290
|
- [`pipeline-repo-health`](../../recipes/pipeline-repo-health.json): git/doc/validation evidence → normalized repository health report.
|
|
289
291
|
- [`pipeline-release-readiness`](../../recipes/pipeline-release-readiness.json): changelog/package/skill/validation evidence → release review → artifact report.
|
package/skills/swarm/SKILL.md
CHANGED