pi-subagents 0.67.0 → 0.69.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.
- package/CHANGELOG.md +90 -0
- package/README.md +1 -1
- package/docs/agents.md +41 -12
- package/docs/configuration.md +61 -19
- package/docs/extension-api.md +5 -1
- package/docs/missions.md +2 -2
- package/docs/models.md +11 -79
- package/docs/observability.md +18 -8
- package/docs/standalone-background.md +13 -3
- package/docs/tool-reference.md +38 -14
- package/docs/watchdog.md +10 -12
- package/docs/workflows.md +59 -1
- package/index.ts +5 -2
- package/package.json +4 -2
- package/runner-peer-loader.mjs +24 -0
- package/runner-peer-preload.mjs +25 -11
- package/skills/pi-subagents/SKILL.md +18 -21
- package/skills/pi-subagents/references/constraints-and-recipes.md +3 -2
- package/skills/pi-subagents/references/execution-controls.md +6 -4
- package/skills/pi-subagents/references/management-authoring-rpc.md +0 -1
- package/skills/pi-subagents/references/multi-lane-orchestration.md +1 -1
- package/skills/pi-subagents/references/prompting-and-roles.md +16 -12
- package/skills/pi-subagents/references/review-and-validation.md +3 -3
- package/src/agents/agent-management.ts +57 -58
- package/src/agents/agent-serializer.ts +4 -3
- package/src/agents/agents.ts +185 -72
- package/src/agents/chain-serializer.ts +5 -0
- package/src/agents/runtime-agent-registry.ts +7 -6
- package/src/agents/skills.ts +1 -1
- package/src/api/preflight.ts +20 -16
- package/src/api/required-child-extensions.ts +6 -0
- package/src/extension/config.ts +10 -37
- package/src/extension/fanout-child.ts +3 -0
- package/src/extension/herdr-pi-bridge.ts +160 -0
- package/src/extension/index.ts +42 -31
- package/src/extension/public-execution.ts +3 -3
- package/src/extension/schemas.ts +23 -6
- package/src/extension/tool-description.ts +8 -7
- package/src/inspectors/ghostty/plugin.ts +13 -1
- package/src/intercom/native-supervisor-channel.ts +22 -18
- package/src/policy/authority.ts +4 -0
- package/src/profiles/profiles.ts +12 -6
- package/src/runs/background/active-run-index.ts +17 -1
- package/src/runs/background/async-execution.ts +309 -126
- package/src/runs/background/async-job-tracker.ts +8 -6
- package/src/runs/background/async-resume.ts +13 -4
- package/src/runs/background/async-status.ts +15 -4
- package/src/runs/background/auto-drain.ts +20 -10
- package/src/runs/background/binary-bootstrap.ts +5 -0
- package/src/runs/background/chain-append.ts +1 -1
- package/src/runs/background/chain-root-attachment.ts +14 -33
- package/src/runs/background/notify.ts +74 -6
- package/src/runs/background/result-files.ts +8 -4
- package/src/runs/background/result-watcher.ts +19 -2
- package/src/runs/background/run-child-session.ts +20 -29
- package/src/runs/background/runner-aliases.ts +4 -33
- package/src/runs/background/runner-child-launch.ts +4 -1
- package/src/runs/background/runner-child-sessions.ts +2 -2
- package/src/runs/background/runner-http-dispatcher.ts +119 -0
- package/src/runs/background/scheduled-runs.ts +11 -5
- package/src/runs/background/stale-run-reconciler.ts +35 -11
- package/src/runs/background/subagent-runner.ts +413 -276
- package/src/runs/background/subagent-wait.ts +128 -23
- package/src/runs/background/wait-completions.ts +75 -27
- package/src/runs/background/wait-subscriptions.ts +9 -3
- package/src/runs/background/wait-tool.ts +4 -2
- package/src/runs/foreground/async-stop-action.ts +93 -3
- package/src/runs/foreground/execution.ts +115 -219
- package/src/runs/foreground/foreground-history.ts +2 -1
- package/src/runs/foreground/subagent-executor.ts +281 -80
- package/src/runs/shared/acceptance.ts +194 -37
- package/src/runs/shared/async-status-projection.ts +123 -33
- package/src/runs/shared/child-launch-plan.ts +15 -3
- package/src/runs/shared/child-launch.ts +19 -6
- package/src/runs/shared/child-runtime-config.ts +5 -0
- package/src/runs/shared/child-session.ts +94 -50
- package/src/runs/shared/child-tool-plan.ts +28 -16
- package/src/runs/shared/dynamic-fanout.ts +2 -2
- package/src/runs/shared/external-cli-contract.ts +11 -1
- package/src/runs/shared/external-cli-preflight.ts +6 -2
- package/src/runs/shared/herdr-connection.ts +134 -0
- package/src/runs/shared/herdr-external-adapters.ts +169 -0
- package/src/runs/shared/herdr-machine.ts +279 -0
- package/src/runs/shared/herdr-pi-protocol.ts +59 -0
- package/src/runs/shared/herdr-placed-run.ts +263 -0
- package/src/runs/shared/model-resolution-diagnostic.ts +76 -0
- package/src/runs/shared/{model-fallback.ts → model-resolution.ts} +22 -237
- package/src/runs/shared/model-scope.ts +1 -1
- package/src/runs/shared/nested-events.ts +11 -2
- package/src/runs/shared/parallel-utils.ts +7 -2
- package/src/runs/shared/pi-spawn.ts +1 -1
- package/src/runs/shared/subagent-prompt-runtime.ts +4 -2
- package/src/runs/shared/worktree-setup-command.ts +27 -4
- package/src/runs/shared/worktree.ts +30 -8
- package/src/shared/child-cache-retention.ts +43 -0
- package/src/shared/launch-contract.ts +6 -9
- package/src/shared/pruned-fork.ts +1 -1
- package/src/shared/required-child-extensions.ts +81 -0
- package/src/shared/settings.ts +5 -2
- package/src/shared/shortcuts.ts +0 -4
- package/src/shared/types.ts +81 -29
- package/src/slash/slash-commands.ts +0 -6
- package/src/slash/subagents-admin.ts +13 -9
- package/src/tui/render.ts +20 -10
- package/src/watchdog/child-status.ts +28 -36
- package/src/watchdog/lsp-diagnostics.ts +1 -1
- package/src/watchdog/model-selection.ts +1 -1
- package/src/watchdog/register-child.ts +10 -3
- package/src/watchdog/register-main.ts +20 -20
- package/src/watchdog/render.ts +1 -1
- package/src/watchdog/review.ts +14 -30
- package/src/watchdog/rules.ts +1 -1
- package/src/watchdog/runtime.ts +23 -12
- package/src/watchdog/settings.ts +3 -6
- package/src/watchdog/types.ts +3 -5
- package/src/watchdog/warning-format.ts +1 -1
- package/src/workflows/scripted-workflow.ts +68 -7
- package/src/workflows/workflow-receipt.ts +21 -3
- package/src/workflows/workflow-resources.ts +13 -2
- package/src/runs/shared/model-exclusions.ts +0 -374
- package/src/runs/shared/readonly-model-continuation.ts +0 -69
- package/src/runs/shared/readonly-session-evidence.ts +0 -307
package/index.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type {} from "./src/types/pi-runtime-compat.d.ts";
|
|
3
|
+
import { HERDR_PI_MODE_ENV } from "./src/runs/shared/herdr-pi-protocol.ts";
|
|
3
4
|
|
|
4
|
-
const
|
|
5
|
+
const registerExtension = process.env[HERDR_PI_MODE_ENV] === "1"
|
|
6
|
+
? (await import("./src/extension/herdr-pi-bridge.ts")).default
|
|
7
|
+
: process.env.PI_SUBAGENT_CHILD === "1"
|
|
5
8
|
? undefined
|
|
6
9
|
: (await import("./src/extension/index.ts")).default;
|
|
7
10
|
|
|
8
11
|
export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
9
|
-
|
|
12
|
+
registerExtension?.(pi);
|
|
10
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.0",
|
|
4
4
|
"description": "Pi extension for single-agent delegation and scripted multi-agent workflows",
|
|
5
5
|
"author": "Nico Bailon",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"./delegation": "./src/api/delegation.ts",
|
|
15
15
|
"./capability-ceiling": "./src/api/capability-ceiling.ts",
|
|
16
16
|
"./workflow-resources": "./src/api/workflow-resources.ts",
|
|
17
|
+
"./required-child-extensions": "./src/api/required-child-extensions.ts",
|
|
17
18
|
"./preflight": "./src/api/preflight.ts",
|
|
18
19
|
"./control-channel": "./src/api/control-channel.ts",
|
|
19
20
|
"./intercom-bridge": "./src/api/intercom-bridge.ts",
|
|
@@ -53,6 +54,8 @@
|
|
|
53
54
|
"CHANGELOG.md"
|
|
54
55
|
],
|
|
55
56
|
"scripts": {
|
|
57
|
+
"build:pkg": "node scripts/build-package.mjs",
|
|
58
|
+
"pack:pkg": "npm run build:pkg && npm pack ./dist-pkg",
|
|
56
59
|
"typecheck": "tsc --noEmit",
|
|
57
60
|
"test": "npm run test:unit",
|
|
58
61
|
"test:unit": "node --experimental-strip-types --import ./test/support/isolated-temp-root.mjs --test test/unit/*.test.ts",
|
|
@@ -91,7 +94,6 @@
|
|
|
91
94
|
}
|
|
92
95
|
},
|
|
93
96
|
"dependencies": {
|
|
94
|
-
"@earendil-works/pi-server": "0.85.0",
|
|
95
97
|
"acorn": "8.18.0",
|
|
96
98
|
"jiti": "2.7.0",
|
|
97
99
|
"typebox": "1.1.38",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url";
|
|
2
|
+
|
|
3
|
+
let aliases = {};
|
|
4
|
+
let nativeRunner = false;
|
|
5
|
+
let compiledRunner = false;
|
|
6
|
+
let packageRootUrl;
|
|
7
|
+
const redirected = new Set([
|
|
8
|
+
"@earendil-works/pi-tui",
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
export function initialize(data) {
|
|
12
|
+
aliases = data?.aliases ?? {};
|
|
13
|
+
nativeRunner = data?.nativeRunner === true;
|
|
14
|
+
compiledRunner = data?.compiledRunner === true;
|
|
15
|
+
packageRootUrl = data?.packageRootUrl;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function resolve(specifier, context, nextResolve) {
|
|
19
|
+
const packageImport = typeof packageRootUrl === "string" && context.parentURL?.startsWith(packageRootUrl) === true;
|
|
20
|
+
if (nativeRunner && (!compiledRunner || packageImport) ? aliases[specifier] : redirected.has(specifier) && aliases[specifier]) {
|
|
21
|
+
return nextResolve(pathToFileURL(aliases[specifier]).href, context);
|
|
22
|
+
}
|
|
23
|
+
return nextResolve(specifier, context);
|
|
24
|
+
}
|
package/runner-peer-preload.mjs
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as nodeModule from "node:module";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
|
|
4
4
|
const aliases = JSON.parse(process.env.JITI_ALIAS ?? "{}");
|
|
5
|
+
const nativeRunner = process.env.PI_ASYNC_NATIVE_RUNNER === "1";
|
|
6
|
+
const compiledRunner = process.env.PI_ASYNC_COMPILED_RUNNER === "1";
|
|
7
|
+
// Pi's jiti loader owns aliases for external extensions; these hooks only supply peers to our compiled package.
|
|
8
|
+
const packageRootUrl = new URL("./", import.meta.url).href;
|
|
5
9
|
const redirected = new Set([
|
|
6
|
-
"@earendil-works/pi-server",
|
|
7
|
-
"@earendil-works/pi-server/unix",
|
|
8
10
|
"@earendil-works/pi-tui",
|
|
9
11
|
]);
|
|
10
12
|
|
|
11
|
-
registerHooks
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (typeof nodeModule.registerHooks === "function") {
|
|
14
|
+
nodeModule.registerHooks({
|
|
15
|
+
resolve(specifier, context, nextResolve) {
|
|
16
|
+
const packageImport = context.parentURL?.startsWith(packageRootUrl) === true;
|
|
17
|
+
if ((nativeRunner && (!compiledRunner || packageImport) ? aliases[specifier] : redirected.has(specifier) && aliases[specifier])) {
|
|
18
|
+
return nextResolve(pathToFileURL(aliases[specifier]).href, context);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
return nextResolve(specifier, context);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (nativeRunner && specifier.endsWith(".js")) return nextResolve(`${specifier.slice(0, -3)}.ts`, context);
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
nodeModule.register(new URL("./runner-peer-loader.mjs", import.meta.url), {
|
|
30
|
+
data: { aliases, nativeRunner, compiledRunner, packageRootUrl },
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pi-subagents
|
|
3
3
|
description: |
|
|
4
|
-
|
|
5
|
-
review, scripted
|
|
6
|
-
|
|
7
|
-
supply focused context, planning, review, or execution.
|
|
4
|
+
Technical guidance for operator-requested delegation to builtin or custom
|
|
5
|
+
subagents: bounded handoffs, parallel review, scripted workflows, async work,
|
|
6
|
+
forked context, isolation, and coordinated execution.
|
|
8
7
|
---
|
|
9
8
|
|
|
10
9
|
# Pi Subagents
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- Direct parent edits during orchestrator mode should be intentional, small
|
|
25
|
-
interventions with a brief reason.
|
|
11
|
+
The parent works directly by default. Invoke subagents only when the operator
|
|
12
|
+
requested delegation in the current request or through applicable user/project
|
|
13
|
+
instructions. Task size, complexity, risk, tool-call count, recipe fit, or an
|
|
14
|
+
available specialist does not independently authorize delegation.
|
|
15
|
+
|
|
16
|
+
Once authorized, choose the smallest bounded shape that earns its token and
|
|
17
|
+
elapsed-time overhead through concrete evidence, independent review,
|
|
18
|
+
specialization, useful parallelism, or needed isolation. A single child is
|
|
19
|
+
valid; writer, challenge, and review stages must each earn their overhead rather
|
|
20
|
+
than becoming default ceremony. The parent keeps user intent, constraints,
|
|
21
|
+
routing, arbitration, decisions, final acceptance, and publication authority,
|
|
22
|
+
and may perform the work directly where it is the most efficient owner.
|
|
26
23
|
|
|
27
24
|
Children do not spawn subagents unless the parent explicitly delegated fanout
|
|
28
25
|
and their resolved `tools` allow `subagent`.
|
|
@@ -94,9 +91,9 @@ For exact API fields and worked examples, call `subagent({action:"guide",topic:"
|
|
|
94
91
|
| List, create, edit, disable, eject, or expose agents/RPC | `references/management-authoring-rpc.md` |
|
|
95
92
|
| Check safety constraints, recipes, or error handling | `references/constraints-and-recipes.md` |
|
|
96
93
|
|
|
97
|
-
For complex
|
|
98
|
-
|
|
99
|
-
review.
|
|
94
|
+
For an authorized complex delegated workflow, read `prompting-and-roles.md` and
|
|
95
|
+
`execution-controls.md`, then load `review-and-validation.md` and
|
|
96
|
+
`constraints-and-recipes.md` before launch or review.
|
|
100
97
|
|
|
101
98
|
## Operating rules
|
|
102
99
|
|
|
@@ -52,10 +52,11 @@ This reference keeps cross-cutting policy and failure handling. Load the matchin
|
|
|
52
52
|
| Independent lanes, repositories, worktrees, and handoffs | [`references/multi-lane-orchestration.md`](multi-lane-orchestration.md) |
|
|
53
53
|
| Agent management, file authoring, prompt integration, or RPC | [`references/management-authoring-rpc.md`](management-authoring-rpc.md) |
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
After delegation is operator-authorized, choose the smallest recipe that earns
|
|
56
|
+
its overhead. Recipes select a shape; they do not authorize delegation:
|
|
56
57
|
|
|
57
58
|
- **Recon → plan → implement:** run one focused `scout`, then one `worker` that consumes its findings.
|
|
58
|
-
- **
|
|
59
|
+
- **Implementation:** clarify scope and acceptance, record user-owned decisions and seam/validation contracts, and use a bounded scout, writer, or fresh reviewer only where the requested delegation benefits from that stage. Keep one writer, inspect direct evidence, and require every added stage to earn its overhead. Split large work into serial milestones instead of a writer swarm; do not stop at review without disposition.
|
|
59
60
|
- **Parallel analysis:** fan out only independent read/review/validation work, or isolate each writer in its own worktree. Never run concurrent writers in one checkout.
|
|
60
61
|
|
|
61
62
|
## Error Handling
|
|
@@ -24,7 +24,7 @@ Project settings resolve from the nearest parent directory containing `.pi` or `
|
|
|
24
24
|
|
|
25
25
|
An agent may set `runner.type: external-cli` with a non-empty `command`, optional string `args`, and `promptDelivery: stdin` (the default). The command runs with `shell: false`, inherits the resolved cwd and environment, and receives the combined agent instructions and task through stdin. It must already be installed; pi-subagents adds no CLI dependency.
|
|
26
26
|
|
|
27
|
-
External CLI profiles are async-only and one-shot. They support lifecycle artifacts, stdout/stderr logs, timeout, and stop. Full stdout and stderr are retained in their log files, while the final stdout response and stderr error kept in memory are each limited to their last 64 KiB. They do not support native Pi child options such as model override, structured output, acceptance/agent contract, tool budgets, fast mode, fork context, skills, or native Pi tools unless the runner explicitly implements them. Foreground/clarify, steer/resume/interrupt-as-pause, nested subagents,
|
|
27
|
+
A command-runner agent with a plain `command` (no adapter) is also how a classifier or scoring script becomes a typed workflow step: the prompt arrives on stdin, stdout is the child's `output`, and the script parses it. Keep `inheritProjectContext`, `inheritGlobalContext`, and `inheritSkills` off unless the command wants that text. External CLI profiles are async-only and one-shot. They support lifecycle artifacts, stdout/stderr logs, timeout, and stop. Full stdout and stderr are retained in their log files, while the final stdout response and stderr error kept in memory are each limited to their last 64 KiB. They do not support native Pi child options such as model override, structured output, acceptance/agent contract, tool budgets, fast mode, fork context, skills, or native Pi tools unless the runner explicitly implements them. Foreground/clarify, steer/resume/interrupt-as-pause, nested subagents, and sessions are also unsupported.
|
|
28
28
|
|
|
29
29
|
### External job profiles
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ An agent may set `runner.type: external-job` with a non-empty `provider` and opt
|
|
|
32
32
|
|
|
33
33
|
External job profiles are async-only. The provider owns the remote job and Pi owns the async run record. Status persists provider name, provider job id, prompt digest, provider options, handle/conversation URLs when supplied, result artifact path, last known state, and provider failure code/message. Recovery uses existing provider job metadata to call `reattach` and `result`; it refuses to redispatch a prompt when the persisted provider job does not match the prompt digest.
|
|
34
34
|
|
|
35
|
-
External job profiles do not support foreground/clarify, steer/resume, Pi models/tools/extensions/skills, tool budgets, structured output, native child permissions,
|
|
35
|
+
External job profiles do not support foreground/clarify, steer/resume, Pi models/tools/extensions/skills, tool budgets, structured output, native child permissions, or Pi child sessions. Capacity conflicts fail closed and include the blocking provider job id when the provider supplies it.
|
|
36
36
|
|
|
37
37
|
### Single agent
|
|
38
38
|
|
|
@@ -99,6 +99,8 @@ If `runs.all` is missing in a running session, reload or update `pi-subagents` b
|
|
|
99
99
|
|
|
100
100
|
For one host-run verification command, pass `gate: "npm test"` on a `runs.run`/`runs.all` item (or at the top level as a workflow default). It is shorthand for verified acceptance with that single command: the runtime executes it on the host, records the result as evidence, and memoizes it per tracked workspace state and effective environment. `gate` cannot be combined with `acceptance`; use explicit `acceptance.verify` for multiple commands or custom criteria.
|
|
101
101
|
|
|
102
|
+
For a typed post-run check, pass the object form `gate: { command, output: "json", schema?, timeoutMs? }`. A passing command must print one JSON document (under 12,000 characters); the parsed value, validated against `schema` when given, becomes the child's `structuredOutput`, so a script can branch on `result.structuredOutput` and `runs.lanes` blocks on `verdict === "blocked"` without the parent reading the child's output. Pair it with `output` + `outputMode: "file-only"` so the command reads the saved file. Empty, non-JSON, or schema-invalid stdout fails the gate and rejects the run. Typed gates are never memoized. A typed gate cannot be combined with an `outputSchema` from the launch or the agent; the launch is rejected before any child starts. See the `tool-reference` guide, "Typed gates".
|
|
103
|
+
|
|
102
104
|
If omitted, acceptance is inferred from role, mode, and risk. Use `level: "checked"` for ordinary writer evidence and `level: "verified"` when the runtime should run explicit validation commands. Independent review is orthogonal: use `review: { required: true, agent: "reviewer" }`; reviewer/read-only calls omit `acceptance`. `review-required` means evidence passed but review is pending; `reviewed` means an independent review found no blockers. Never request `level: "reviewed"`; it is recognized only so preflight can return an actionable correction. Disable gates with `{ level: "none", reason: "..." }`; bare `"none"` is rejected and `false` is only a deprecated shorthand. Child-reported command success is evidence, not runtime verification.
|
|
103
105
|
|
|
104
106
|
Completed workflow children from this parent session stay addressable as retained children. `subagent({ action: "children.list" })` lists up to the last 10 with run ids and reports each row as `resumable` or `not resumable` with a reason. Resume only rows reported `resumable`. For a retained-child challenge, use `resume` instead of `steer` when the child is complete. If no retained child is resumable, launch a same-role fallback challenge and label it as fallback. A later workflow continues a resumable child with `runs.run(key, { resume: "<run-id>", task: "follow-up" })`. Inside `workflowScript`, awaiting that call waits for the revived child to finish and returns its completed output and new `runId`; top-level `{ action: "resume" }` remains detached. Pass explicit follow-up task text. Assign each returned child result back to the loop variable because every resume can return a new retained `runId`; always resume the latest returned id. `resume` and `agent` are mutually exclusive, the revived child keeps its stored agent/model/tool contract, and `gate` is rejected on retained resume items.
|
|
@@ -248,9 +250,9 @@ Use diagnostics when setup or child startup looks wrong:
|
|
|
248
250
|
subagent({ action: "doctor" })
|
|
249
251
|
```
|
|
250
252
|
|
|
251
|
-
### Failed lane recovery and execution-mode
|
|
253
|
+
### Failed lane recovery and execution-mode changes
|
|
252
254
|
|
|
253
|
-
A failure in the subagent workflow, child launch, prompt runtime, extension loading, or child tooling setup is a lane infrastructure blocker, not permission to silently change execution mode. Stop and report the exact failure, run/status, and repo/cwd/worktree/branch/ref state. Retry or fix the `subagent` path only through a clear same-protocol retry; before retrying or asking the owner, verify the worktree is clean or capture the partial diff. For backlog lanes and other subagent-governed workflows, switching to `interactive_shell`, `pi -ne`, Codex/Claude/Cursor CLI, a foreground agent, or another external mode requires explicit owner approval. Pi core may print a generic `pi -ne` extension-load hint; that hint is outside this package and is not protocol-approved
|
|
255
|
+
A failure in the subagent workflow, child launch, prompt runtime, extension loading, or child tooling setup is a lane infrastructure blocker, not permission to silently change execution mode. Stop and report the exact failure, run/status, and repo/cwd/worktree/branch/ref state. Retry or fix the `subagent` path only through a clear same-protocol retry; before retrying or asking the owner, verify the worktree is clean or capture the partial diff. For backlog lanes and other subagent-governed workflows, switching to `interactive_shell`, `pi -ne`, Codex/Claude/Cursor CLI, a foreground agent, or another external mode requires explicit owner approval. Pi core may print a generic `pi -ne` extension-load hint; that hint is outside this package and is not protocol-approved. A verified compaction abort may continue the retained child session once on the same resolved model; provider failures never select another model automatically.
|
|
254
256
|
|
|
255
257
|
### External terminal work
|
|
256
258
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Use this reference when several independent tasks need coordinated workers, worktrees, or repositories. It defines lane ownership; use the other pi-subagents references for run controls, prompts, and mission details. The parent remains the final decision-maker.
|
|
4
4
|
|
|
5
|
-
Create lanes only
|
|
5
|
+
Create lanes only after delegation is operator-authorized and each lane materially improves evidence, independent review, specialization, useful parallelism, or isolated execution. Do not manufacture parallelism: keep dependent work serial, and only split work when each lane has a distinct decision and useful output.
|
|
6
6
|
|
|
7
7
|
## Lane board and authority
|
|
8
8
|
|
|
@@ -8,12 +8,17 @@ Parent extensions may register a session-scoped, out-of-band ceiling through `pi
|
|
|
8
8
|
|
|
9
9
|
## When to Use
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
All launch guidance below assumes delegation was requested by the operator in
|
|
12
|
+
the current request or applicable user/project instructions. Complexity,
|
|
13
|
+
workflow fit, and potential quality gains help choose a shape after that gate;
|
|
14
|
+
they do not authorize a launch.
|
|
15
|
+
|
|
16
|
+
- **Complex work orchestration**: after delegation is authorized, keep the parent on its ordinary strong default model and launch only when a bounded child materially improves evidence, independent review, specialization, useful parallelism, or isolated execution. For hard orchestration or root-cause questions, use a top-reasoning model only as a bounded read-only critic/oracle escalation, never as an autonomous root. Lightweight one-off delegation can stay lightweight.
|
|
12
17
|
- **Advisory review**: use fresh-context `reviewer` agents for adversarial code review; fork to `oracle` only for rare escalation where inherited decisions, drift, model routing, root cause, or hard tradeoffs matter
|
|
13
18
|
- **Implementation handoff**: have `oracle` advise, then `worker` implement only after an approved direction
|
|
14
19
|
- **Recon and planning**: use `scout`, then write a plan when needed
|
|
15
20
|
- **Parallel exploration**: run multiple non-conflicting tasks concurrently
|
|
16
|
-
- **Regular skill specialists**: when
|
|
21
|
+
- **Regular skill specialists**: when authorized delegation names or benefits from a relevant specialization, discovery suggestions may help select a small fresh-context fanout
|
|
17
22
|
- **Long-running work**: launch async/background runs and inspect them later. For mutation-capable work, bound the delivery slice and elapsed runtime, then request checkpoints after active tool work returns. Reserve hard tool-call caps for explicitly read-only children.
|
|
18
23
|
- **Subagent control**: watch needs-attention signals and soft-interrupt only when a delegated run is genuinely blocked
|
|
19
24
|
- **Agent authoring**: create, update, or override project agents. Treat saved chain records as legacy inspection or migration inputs, not as a current authoring target.
|
|
@@ -29,7 +34,7 @@ Agents use the `subagent(...)` tool for execution, management, status, and contr
|
|
|
29
34
|
- `/subagents-detach [run-id]` — detach an active foreground single-subagent run without terminating its child
|
|
30
35
|
- `/subagents-steer <run-id> [--child <child-id>] <message>` — steer a live async run (or one child of it) from non-TUI sessions and RPC hosts
|
|
31
36
|
- `/subagent-cost` — show parent plus child token usage and cost for the session
|
|
32
|
-
- `/subagents-fleet` — open the live fleet inspector with per-child controls;
|
|
37
|
+
- `/subagents-fleet` — open the live fleet inspector with per-child controls; `↑↓`/`jk` selects children, `PgUp`/`PgDn` scrolls transcript detail, `s` steers the selected live async child, and `D` stops its top-level async run after confirmation
|
|
33
38
|
- `/subagents-watchdog` — inspect or configure the opt-in adversarial change watchdog (model, on/off, recommend-model, check)
|
|
34
39
|
- `/subagents-doctor` — diagnose setup, discovery, async paths, and intercom bridge state
|
|
35
40
|
- `/subagents-models [agent]` — show the live runtime-loaded builtin model mapping
|
|
@@ -39,7 +44,7 @@ Agents use the `subagent(...)` tool for execution, management, status, and contr
|
|
|
39
44
|
Prefer the tool when you are writing agent logic. Prefer the slash commands when
|
|
40
45
|
you are guiding a human through an interactive flow.
|
|
41
46
|
|
|
42
|
-
Packaged prompt shortcuts are also available for repeatable workflows. Treat them as reusable orchestration recipes, not just human slash commands. When the user asks for one of these shapes,
|
|
47
|
+
Packaged prompt shortcuts are also available for repeatable workflows. Treat them as reusable orchestration recipes, not just human slash commands. When the user asks for one of these shapes, apply the same pattern directly with `subagent(...)` and other tools:
|
|
43
48
|
- `/parallel-review` — fresh-context reviewers with distinct review angles, then synthesis
|
|
44
49
|
- `/review-loop` — parent-orchestrated worker, fresh-reviewer, and fix-worker cycles until clean or capped
|
|
45
50
|
- `/parallel-research` — combine `researcher` and `scout` for external evidence plus local code context
|
|
@@ -53,7 +58,7 @@ The prompt templates in `prompts/` encode workflows the parent agent can run on
|
|
|
53
58
|
|
|
54
59
|
### Commission-risk and cold-start packets
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
After the operator-authority gate above, delegate only when the child materially improves evidence, independent review, specialization, useful parallelism, or isolated execution; do not manufacture parallelism. Every child packet must be cold-start complete: state the goal, exact target/cwd/ref, authority and edit boundary, relevant context/evidence, success criteria, validation, output, and stop/escalation rules. For an orchestration audit by the critic tier, make the child read-only and request at most three omissions, each cited to a file, line, or decision; high thinking is an explicit escalation, not a default.
|
|
57
62
|
|
|
58
63
|
### Council Mode technique
|
|
59
64
|
|
|
@@ -67,7 +72,7 @@ Use this when the user wants adversarial review of a diff, plan, issue, file, or
|
|
|
67
72
|
|
|
68
73
|
### Proactive skill-specialist technique
|
|
69
74
|
|
|
70
|
-
Use this when `{ action: "list" }` reports
|
|
75
|
+
Use this only within operator-authorized delegation when `{ action: "list" }` reports skill subagent suggestions relevant to the requested handoff. Availability is a selection hint, not authority or a command to fan out.
|
|
71
76
|
|
|
72
77
|
Default guardrails:
|
|
73
78
|
- Keep the fanout small: usually one or two skill-specialist children, never more than the listed recommendations or configured cap.
|
|
@@ -105,11 +110,11 @@ Use this when the question needs both external evidence and local implications.
|
|
|
105
110
|
|
|
106
111
|
### Gather-context-and-clarify technique
|
|
107
112
|
|
|
108
|
-
Use this
|
|
113
|
+
Use this when the operator requests delegated context gathering. Launch `scout` for local context and `researcher` only when external docs, recent sources, ecosystem context, or primary evidence would materially improve understanding. Ask children for concise findings plus remaining clarification questions. Then synthesize what is known and use `interview` to ask the unresolved questions needed for shared understanding before planning or implementing.
|
|
109
114
|
|
|
110
115
|
### Parallel cleanup technique
|
|
111
116
|
|
|
112
|
-
Use this after implementation when the user
|
|
117
|
+
Use this after implementation when the user or applicable instructions request delegated cleanup review. Launch two fresh-context `reviewer` tasks with `output: false` and `progress: false`: one deslop pass and one verbosity pass. If the `deslop` or `verbosity-cleaner` skills are available, pass the relevant skill to that reviewer; otherwise inline the criteria. Both reviewers are review-only and should flag concrete issues with severity, file/line references, and smallest safe fixes. Phrase the constraint as “Do not modify project/source files; returning findings through the configured output artifact is allowed” when you use `output` or `outputMode: "file-only"`. The parent decides what to apply and asks before making changes unless cleanup was already authorized.
|
|
113
118
|
|
|
114
119
|
### Staged fix orchestration technique
|
|
115
120
|
|
|
@@ -203,7 +208,7 @@ For one run, use inline config:
|
|
|
203
208
|
|
|
204
209
|
For persistent tweaks, edit `subagents.agentOverrides` in user or project settings. User overrides apply everywhere. Project overrides apply only in that repo and win over user overrides. Use `/subagents-models` or `subagent({ action: "models" })` to inspect the live mapping after settings and overrides load.
|
|
205
210
|
|
|
206
|
-
Provider-scoped entries can layer on top of the default override for the active parent session provider. The provider is selected once from the parent model
|
|
211
|
+
Provider-scoped entries can layer on top of the default override for the active parent session provider. The provider is selected once from the parent model. Within each settings file, the provider entry wins per field; project settings still win over user settings.
|
|
207
212
|
|
|
208
213
|
```json
|
|
209
214
|
{
|
|
@@ -261,7 +266,6 @@ Direct settings example:
|
|
|
261
266
|
"reviewer": {
|
|
262
267
|
"model": "provider/strong-review-model",
|
|
263
268
|
"thinking": "high",
|
|
264
|
-
"fallbackModels": ["backup-provider/strong-review-model"],
|
|
265
269
|
"acceptanceRole": "read-only"
|
|
266
270
|
}
|
|
267
271
|
}
|
|
@@ -269,7 +273,7 @@ Direct settings example:
|
|
|
269
273
|
}
|
|
270
274
|
```
|
|
271
275
|
|
|
272
|
-
Useful override fields: `description`, `model`, `
|
|
276
|
+
Useful override fields: `description`, `model`, `thinking`,
|
|
273
277
|
`systemPromptMode`, `inheritProjectContext`, `inheritGlobalContext`, `inheritSkills`, `defaultContext`,
|
|
274
278
|
`acceptanceRole`, `disabled`, `skills`, `tools`, `extensions`, and `systemPrompt`.
|
|
275
279
|
`description` replaces the discovered description for builtin and custom agents
|
|
@@ -283,7 +287,7 @@ Keep the parent/orchestrator on the ordinary strong default model because omissi
|
|
|
283
287
|
|
|
284
288
|
Examples are illustrative, not requirements. Map these tiers to concrete models in user/project settings or a profile. A non-OpenAI setup should choose comparable available models by capability.
|
|
285
289
|
|
|
286
|
-
|
|
290
|
+
Each child launch uses one resolved model exactly once. If quota or availability fails, surface that failure and let the parent or operator explicitly launch a later attempt with another model. Forked children keep their requested thinking level even when provider-specific reasoning blocks are stripped from the inherited transcript.
|
|
287
291
|
|
|
288
292
|
If a provider rejects model IDs with thinking suffixes, use
|
|
289
293
|
`subagents.disableThinking: true` in user or project settings to clear bundled
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Pi Subagents: Review And Validation
|
|
2
2
|
|
|
3
|
-
Generic review and delivery guidance for delegated work. This file does not encode private backlog, merge, or release policy.
|
|
3
|
+
Generic review and delivery guidance for operator-authorized delegated work. This file does not encode private backlog, merge, or release policy.
|
|
4
4
|
|
|
5
5
|
## Delivery loop
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Use the smallest loop that proves the change:
|
|
|
9
9
|
1. Inspect the source, diff, issue, or plan directly.
|
|
10
10
|
2. Keep one writer for each cwd or worktree.
|
|
11
11
|
3. Run focused validation that can fail for the changed behavior.
|
|
12
|
-
4.
|
|
12
|
+
4. When the operator/project delegation contract calls for independent review, use a fresh-context read-only reviewer; otherwise parent inspection is valid.
|
|
13
13
|
5. Apply only accepted findings inside the same writer boundary.
|
|
14
14
|
6. Re-run affected validation and review only the changed blast radius.
|
|
15
15
|
7. Inspect the final diff and evidence before parent acceptance.
|
|
@@ -61,7 +61,7 @@ Before reporting delegated work as done, verify the relevant subset:
|
|
|
61
61
|
|
|
62
62
|
- final diff contains only intended files
|
|
63
63
|
- focused validation covers changed behavior
|
|
64
|
-
-
|
|
64
|
+
- required independent review has fresh-review evidence
|
|
65
65
|
- accepted findings are fixed and revalidated
|
|
66
66
|
- publication authority exists before push, comment, close, merge, deploy, or release
|
|
67
67
|
- external checks are exact-head when used as evidence
|