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.
Files changed (122) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +1 -1
  3. package/docs/agents.md +41 -12
  4. package/docs/configuration.md +61 -19
  5. package/docs/extension-api.md +5 -1
  6. package/docs/missions.md +2 -2
  7. package/docs/models.md +11 -79
  8. package/docs/observability.md +18 -8
  9. package/docs/standalone-background.md +13 -3
  10. package/docs/tool-reference.md +38 -14
  11. package/docs/watchdog.md +10 -12
  12. package/docs/workflows.md +59 -1
  13. package/index.ts +5 -2
  14. package/package.json +4 -2
  15. package/runner-peer-loader.mjs +24 -0
  16. package/runner-peer-preload.mjs +25 -11
  17. package/skills/pi-subagents/SKILL.md +18 -21
  18. package/skills/pi-subagents/references/constraints-and-recipes.md +3 -2
  19. package/skills/pi-subagents/references/execution-controls.md +6 -4
  20. package/skills/pi-subagents/references/management-authoring-rpc.md +0 -1
  21. package/skills/pi-subagents/references/multi-lane-orchestration.md +1 -1
  22. package/skills/pi-subagents/references/prompting-and-roles.md +16 -12
  23. package/skills/pi-subagents/references/review-and-validation.md +3 -3
  24. package/src/agents/agent-management.ts +57 -58
  25. package/src/agents/agent-serializer.ts +4 -3
  26. package/src/agents/agents.ts +185 -72
  27. package/src/agents/chain-serializer.ts +5 -0
  28. package/src/agents/runtime-agent-registry.ts +7 -6
  29. package/src/agents/skills.ts +1 -1
  30. package/src/api/preflight.ts +20 -16
  31. package/src/api/required-child-extensions.ts +6 -0
  32. package/src/extension/config.ts +10 -37
  33. package/src/extension/fanout-child.ts +3 -0
  34. package/src/extension/herdr-pi-bridge.ts +160 -0
  35. package/src/extension/index.ts +42 -31
  36. package/src/extension/public-execution.ts +3 -3
  37. package/src/extension/schemas.ts +23 -6
  38. package/src/extension/tool-description.ts +8 -7
  39. package/src/inspectors/ghostty/plugin.ts +13 -1
  40. package/src/intercom/native-supervisor-channel.ts +22 -18
  41. package/src/policy/authority.ts +4 -0
  42. package/src/profiles/profiles.ts +12 -6
  43. package/src/runs/background/active-run-index.ts +17 -1
  44. package/src/runs/background/async-execution.ts +309 -126
  45. package/src/runs/background/async-job-tracker.ts +8 -6
  46. package/src/runs/background/async-resume.ts +13 -4
  47. package/src/runs/background/async-status.ts +15 -4
  48. package/src/runs/background/auto-drain.ts +20 -10
  49. package/src/runs/background/binary-bootstrap.ts +5 -0
  50. package/src/runs/background/chain-append.ts +1 -1
  51. package/src/runs/background/chain-root-attachment.ts +14 -33
  52. package/src/runs/background/notify.ts +74 -6
  53. package/src/runs/background/result-files.ts +8 -4
  54. package/src/runs/background/result-watcher.ts +19 -2
  55. package/src/runs/background/run-child-session.ts +20 -29
  56. package/src/runs/background/runner-aliases.ts +4 -33
  57. package/src/runs/background/runner-child-launch.ts +4 -1
  58. package/src/runs/background/runner-child-sessions.ts +2 -2
  59. package/src/runs/background/runner-http-dispatcher.ts +119 -0
  60. package/src/runs/background/scheduled-runs.ts +11 -5
  61. package/src/runs/background/stale-run-reconciler.ts +35 -11
  62. package/src/runs/background/subagent-runner.ts +413 -276
  63. package/src/runs/background/subagent-wait.ts +128 -23
  64. package/src/runs/background/wait-completions.ts +75 -27
  65. package/src/runs/background/wait-subscriptions.ts +9 -3
  66. package/src/runs/background/wait-tool.ts +4 -2
  67. package/src/runs/foreground/async-stop-action.ts +93 -3
  68. package/src/runs/foreground/execution.ts +115 -219
  69. package/src/runs/foreground/foreground-history.ts +2 -1
  70. package/src/runs/foreground/subagent-executor.ts +281 -80
  71. package/src/runs/shared/acceptance.ts +194 -37
  72. package/src/runs/shared/async-status-projection.ts +123 -33
  73. package/src/runs/shared/child-launch-plan.ts +15 -3
  74. package/src/runs/shared/child-launch.ts +19 -6
  75. package/src/runs/shared/child-runtime-config.ts +5 -0
  76. package/src/runs/shared/child-session.ts +94 -50
  77. package/src/runs/shared/child-tool-plan.ts +28 -16
  78. package/src/runs/shared/dynamic-fanout.ts +2 -2
  79. package/src/runs/shared/external-cli-contract.ts +11 -1
  80. package/src/runs/shared/external-cli-preflight.ts +6 -2
  81. package/src/runs/shared/herdr-connection.ts +134 -0
  82. package/src/runs/shared/herdr-external-adapters.ts +169 -0
  83. package/src/runs/shared/herdr-machine.ts +279 -0
  84. package/src/runs/shared/herdr-pi-protocol.ts +59 -0
  85. package/src/runs/shared/herdr-placed-run.ts +263 -0
  86. package/src/runs/shared/model-resolution-diagnostic.ts +76 -0
  87. package/src/runs/shared/{model-fallback.ts → model-resolution.ts} +22 -237
  88. package/src/runs/shared/model-scope.ts +1 -1
  89. package/src/runs/shared/nested-events.ts +11 -2
  90. package/src/runs/shared/parallel-utils.ts +7 -2
  91. package/src/runs/shared/pi-spawn.ts +1 -1
  92. package/src/runs/shared/subagent-prompt-runtime.ts +4 -2
  93. package/src/runs/shared/worktree-setup-command.ts +27 -4
  94. package/src/runs/shared/worktree.ts +30 -8
  95. package/src/shared/child-cache-retention.ts +43 -0
  96. package/src/shared/launch-contract.ts +6 -9
  97. package/src/shared/pruned-fork.ts +1 -1
  98. package/src/shared/required-child-extensions.ts +81 -0
  99. package/src/shared/settings.ts +5 -2
  100. package/src/shared/shortcuts.ts +0 -4
  101. package/src/shared/types.ts +81 -29
  102. package/src/slash/slash-commands.ts +0 -6
  103. package/src/slash/subagents-admin.ts +13 -9
  104. package/src/tui/render.ts +20 -10
  105. package/src/watchdog/child-status.ts +28 -36
  106. package/src/watchdog/lsp-diagnostics.ts +1 -1
  107. package/src/watchdog/model-selection.ts +1 -1
  108. package/src/watchdog/register-child.ts +10 -3
  109. package/src/watchdog/register-main.ts +20 -20
  110. package/src/watchdog/render.ts +1 -1
  111. package/src/watchdog/review.ts +14 -30
  112. package/src/watchdog/rules.ts +1 -1
  113. package/src/watchdog/runtime.ts +23 -12
  114. package/src/watchdog/settings.ts +3 -6
  115. package/src/watchdog/types.ts +3 -5
  116. package/src/watchdog/warning-format.ts +1 -1
  117. package/src/workflows/scripted-workflow.ts +68 -7
  118. package/src/workflows/workflow-receipt.ts +21 -3
  119. package/src/workflows/workflow-resources.ts +13 -2
  120. package/src/runs/shared/model-exclusions.ts +0 -374
  121. package/src/runs/shared/readonly-model-continuation.ts +0 -69
  122. 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 registerParentExtension = process.env.PI_SUBAGENT_CHILD === "1"
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
- registerParentExtension?.(pi);
12
+ registerExtension?.(pi);
10
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-subagents",
3
- "version": "0.67.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
+ }
@@ -1,18 +1,32 @@
1
- import { registerHooks } from "node:module";
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
- resolve(specifier, context, nextResolve) {
13
- if (redirected.has(specifier) && aliases[specifier]) {
14
- return nextResolve(pathToFileURL(aliases[specifier]).href, context);
15
- }
16
- return nextResolve(specifier, context);
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
- Delegate to builtin or custom subagents for single-agent handoffs, parallel
5
- review, scripted chaining, async work, forked context, and coordinated
6
- workflows. Use when one parent agent should stay in control while children
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
- Choose a mode:
13
-
14
- - **Direct mode:** For tiny or focused work, the parent handles the task
15
- directly; a single bounded child handoff is fine. Skip workflow ceremony.
16
- - **Orchestrator mode:** For substantial or delegated work, the parent is the
17
- supervisor, arbiter, and authority holder—not the routine primary doer.
18
- Subagents may own planning/design, scouting, implementation,
19
- simplification/challenge, validation, and review as useful. The parent keeps
20
- user intent, constraints, authority, routing, arbitration, final acceptance,
21
- and publication.
22
- - A useful loop for substantial work is **writer → challenge/simplify → review**;
23
- the parent arbitrates between steps, and tiny tasks can skip it.
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 work, read `prompting-and-roles.md` and `execution-controls.md`, then
98
- load `review-and-validation.md` and `constraints-and-recipes.md` before launch or
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
- Choose the smallest recipe that fits:
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
- - **Non-trivial implementation:** clarify scope and acceptance, record user-owned decisions and seam/validation contracts, scout load-bearing code, plan when useful, use one writer, run fresh review/validation, apply only accepted fixes with one writer, then inspect direct evidence and the final diff before parent acceptance. Split large work into serial milestones instead of a writer swarm; do not stop at review without disposition.
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, fallbacks, and sessions are also unsupported.
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, fallbacks, or Pi child sessions. Capacity conflicts fail closed and include the blocking provider job id when the provider supplies it.
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 fallback
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 fallback. This execution-mode boundary does not prohibit configured native model/provider fallback.
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
 
@@ -117,7 +117,6 @@ That is only a starting point. Omit `package` for the traditional unqualified ru
117
117
  - `defaultReads`
118
118
  - `output`
119
119
  - `aliases`
120
- - `fallbackModels`
121
120
  - `subagentOnlyExtensions`
122
121
  - `skills`
123
122
  - `skillPath`
@@ -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 when delegation materially improves evidence, independent review, 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.
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
- - **Complex work orchestration**: keep the parent on its ordinary strong default model. Delegate only when another child materially improves evidence, independent review, or isolated execution; omission failures are cheaper than unnecessary commissions. 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. Complex means the task has multiple moving parts, unclear acceptance, cross-cutting code, meaningful user-visible impact, expensive or irreversible validation, broad review surface, or the user asks for orchestration. Lightweight one-off delegation can stay lightweight.
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 discovery shows proactive skill subagent suggestions and the current work is broad enough, launch a small fresh-context fanout that asks one subagent per relevant regularly used skill to apply that skill's perspective to the task
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; `Ctrl+Alt+F` opens it during an active foreground turn, `↑↓`/`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
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, or when the workflow clearly fits, apply the same pattern directly with `subagent(...)` and other tools:
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
- Delegate only when the child materially improves evidence, independent review, 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.
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 proactive skill subagent suggestions and the user's task would benefit from perspectives the parent regularly uses. These suggestions are conservative: a skill is recommended only when it is available and referenced repeatedly by configured agents or saved chains. Treat the list as an opt-in hint for the current task, not a command to always fan out.
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 at the start of non-trivial work. 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.
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 wants cleanup review or when a final pass would reduce AI-slop. 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.
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 before child model fallback starts, so fallback attempts cannot switch configuration. Within each settings file, the provider entry wins per field; project settings still win over user settings.
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`, `fallbackModels`, `thinking`,
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
- Use `fallbackModels` when a tier has provider quota or availability risk. Forked children keep their requested thinking level even when provider-specific reasoning blocks are stripped from the inherited transcript.
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. Use fresh-context read-only review for substantial, risky, public, or hard-to-see changes.
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
- - substantial or risky changes have fresh-review evidence
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