@narumitw/pi-subagents 1.0.2 β†’ 2.0.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.
Files changed (47) hide show
  1. package/README.md +198 -188
  2. package/package.json +2 -2
  3. package/src/agents/built-ins.ts +13 -66
  4. package/src/agents/catalog.ts +19 -2
  5. package/src/agents/discovery.ts +31 -15
  6. package/src/auto-transport.ts +7 -1
  7. package/src/child-peer-bridge.ts +124 -0
  8. package/src/child-peer-tools.ts +132 -0
  9. package/src/completion-delivery.ts +19 -5
  10. package/src/completion-render.ts +189 -0
  11. package/src/completion-routing.ts +24 -0
  12. package/src/config-ui.ts +11 -17
  13. package/src/consult-registration.ts +3 -2
  14. package/src/create-stateful-transport.ts +15 -2
  15. package/src/execution-ui.ts +0 -72
  16. package/src/in-process-transport.ts +39 -7
  17. package/src/inspect-tool.ts +3 -1
  18. package/src/peer-communication.ts +352 -0
  19. package/src/peer-transport.ts +49 -0
  20. package/src/persistence.ts +26 -1
  21. package/src/pi-args.ts +2 -0
  22. package/src/registry-types.ts +7 -0
  23. package/src/registry.ts +240 -41
  24. package/src/result-contract.ts +20 -5
  25. package/src/rpc-transport.ts +56 -26
  26. package/src/runner.ts +13 -1
  27. package/src/spawn-idempotency.ts +2 -0
  28. package/src/stateful-agent-view.ts +3 -1
  29. package/src/stateful-guidance.ts +11 -11
  30. package/src/stateful-safety.ts +0 -45
  31. package/src/stateful-tool-params.ts +11 -3
  32. package/src/stateful.ts +119 -47
  33. package/src/subagents.ts +6 -8
  34. package/src/subprocess-transport.ts +49 -28
  35. package/src/task-path.ts +65 -0
  36. package/src/transport-ui.ts +0 -6
  37. package/src/transport.ts +2 -1
  38. package/src/workflow-ui.ts +4 -4
  39. package/src/automation-contract.ts +0 -709
  40. package/src/automation-planner.ts +0 -65
  41. package/src/automation-registration.ts +0 -137
  42. package/src/automation-tool.ts +0 -40
  43. package/src/automation.ts +0 -435
  44. package/src/execution-profiles.ts +0 -95
  45. package/src/workflow-plan-compiler.ts +0 -618
  46. package/src/workflow-plan-patch.ts +0 -636
  47. package/src/workflow-planning-benchmark.ts +0 -95
package/README.md CHANGED
@@ -2,30 +2,36 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@narumitw/pi-subagents)](https://www.npmjs.com/package/@narumitw/pi-subagents) [![Pi extension](https://img.shields.io/badge/Pi-extension-blue)](https://pi.dev) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
4
4
 
5
- `@narumitw/pi-subagents` is a native [Pi coding agent](https://pi.dev) extension for delegating work to specialized agents. By default, it exposes eight capability-specific tools: blocking batches, explicit autonomous workflow planning, four detached lifecycle tools, side-effect-free inspection, and synchronous read-only consultation. Users can keep every delegation method, choose async-only delegation, retain only blocking delegation, or disable delegation while keeping inspection available.
5
+ `@narumitw/pi-subagents` is a native [Pi coding agent](https://pi.dev) extension for delegating work to specialized agents.
6
+ By default, it exposes seven capability-specific tools: blocking batches, four detached lifecycle tools, side-effect-free inspection, and synchronous read-only consultation.
7
+ The compatibility default remains **All delegation methods**, while **Async only** is the recommended smaller surface for normal async-first use.
6
8
 
7
- Use it to split independent research, planning, implementation, and review work across focused workers. Under the default next-turn delivery policy, background delegation is for work the current response does not depend on. Opt-in auto-resume also supports final-answer-dependent background work by requesting a synthesis turn after completion.
9
+ The main agent decides whether to delegate and retains overall planning, immediate critical-path work, integration, final verification, and the final answer.
10
+ Use `explorer` for bounded read-only evidence and `worker` for a bounded implementation slice with clear ownership when delegation creates real parallelism.
11
+ One ordinary async worker requires named non-overlapping main-agent work that starts immediately after spawn plus a supported delivery and integration path.
8
12
 
9
13
  ## ✨ Features
10
14
 
11
- - Offers all delegation methods by default, with goal-oriented presets for async-only, blocking-only, or disabled delegation.
15
+ - Keeps all delegation methods as the compatibility default while recommending async-only for a smaller responsive surface.
12
16
  - Adds `subagent_inspect` for bounded metadata without child launch, mailbox-content access, acknowledgement, or mutation.
13
17
  - Adds `subagent_consult` for one synchronous ephemeral child constrained to built-in `read`, `grep`, `find`, and `ls` tools (or a narrower agent allow-list).
14
- - Adds explicit `subagent_auto` requests that use one bounded read-only planning turn and a deterministic compiler to select the smallest justified existing workflow without changing omitted-field behavior.
15
18
  - Keeps batch workers isolated in `pi --mode json -p --no-session` subprocesses.
16
19
  - Lets users set a blocking parallel call's maximum worker count from 1 through 64 while keeping four-at-a-time execution.
17
20
  - Registers detached stateful lifecycle tools by default; completion can stay queued for the next turn or opt into an idle root synthesis turn.
18
21
  - Supports an opt-in public-SDK `in-process` stateful transport with one reusable child `AgentSession` per `agentId`.
19
22
  - Supports an opt-in persistent `rpc` transport with one isolated Pi RPC process per active retained agent and `pi-subagents:v1` lifecycle metadata.
20
23
  - Supports deterministic opt-in `auto` routing: read-only built-ins use in-process, write-capable built-ins use RPC, and custom tools use the compatibility subprocess path.
21
- - Supports built-in `scout`, `planner`, `reviewer`, and `worker` agents.
24
+ - Supports built-in `explorer` and `worker` agents.
22
25
  - Loads custom user agents from `~/.pi/agent/agents/*.md`.
23
26
  - Optionally loads project agents from `.pi/agents/*.md` with confirmation.
24
27
  - Provides a current-session-first `/subagents` manager, direct `settings|status|help` routes, and compatibility aliases for agent tools and retained agents.
25
- - Supports trust-aware per-task `cwd` policies, task-selected work, workflow, idle, turn, and tool-call budgets, deterministic timeout checkpoints, bounded abort-then-summary recovery, progress telemetry, and explicit Fast, Balanced, or Deep thinking profiles.
28
+ - Supports trust-aware per-task `cwd` policies, task-selected work, workflow, idle, turn, and tool-call budgets, deterministic timeout checkpoints, bounded abort-then-summary recovery, progress telemetry, and per-agent execution defaults.
26
29
  - Uses Pi-native tool rows throughout; blocking and consultation calls add bounded custom live activity.
27
30
  - Bounds JSON lines, captured messages, stderr, final output, chain substitution, and fan-in context.
28
31
  - Enforces a recursion-depth guard and deterministic process-group termination.
32
+ - Gives every retained agent both an opaque durable `agentId` and a session-scoped canonical `taskPath`, while preserving ID compatibility across lifecycle and inspection tools.
33
+ - Gives retained children authenticated `subagent_peer_send` and `subagent_peer_list` tools for bounded queue-only communication with `/root` or any retained peer in the same session.
34
+ - Routes nested completions to the direct retained parent first, while top-level completions continue through the root completion broker.
29
35
  - Provides addressable stateful agents with follow-up, consolidated mailbox/management actions, idempotent spawn retries, context selection and preview, versioned structured outcomes, and persistence.
30
36
  - Publishes built-in and custom agent capability manifests, then records the executor-owned `ExecutionPlan` that resolves requested authority to effective tools, model, thinking, timeout, transport, trust, and workspace controls.
31
37
  - Runs explicit dependency workflows through a persistent `WorkItem` ledger, dependency-aware scheduler, declared scope-conflict checks, artifact provenance, stale-result invalidation, and bounded overall deadlines.
@@ -53,23 +59,39 @@ Try this package locally from the repository root:
53
59
  pi -e ./packages/pi-subagents
54
60
  ```
55
61
 
62
+ ## πŸš€ Quick start
63
+
64
+ For normal async-first use, run `/subagents`, choose **Change delegation**, select **Async only Β· Recommended**, confirm the exact tool changes, and reload.
65
+
66
+ This registers `subagent_spawn`, `subagent_send`, `subagent_manage`, `subagent_mailbox`, and `subagent_inspect` while keeping the main agent responsive.
67
+
68
+ Default `next-turn` delivery is for work the current response does not require.
69
+ When the final answer depends on detached work, use `/subagents settings` to select **Resume automatically when finished**.
70
+
71
+ Keep **All delegation methods** when an explicit blocking workflow or synchronous read-only `subagent_consult` is still required.
72
+
73
+ Async-first delegation still requires useful parallel main-agent work, clear worker ownership, and a supported completion path.
74
+
56
75
  ## πŸ› οΈ Pi tool
57
76
 
58
- `pi-subagents` registers eight tools by default. Run `/subagents`, choose **Change delegation**, review the concrete tool changes, then select **Save and reload** to apply one of these workflows:
77
+ `pi-subagents` registers seven tools by default. Run `/subagents`, choose **Change delegation**, review the concrete tool changes, then select **Save and reload** to apply one of these workflows:
59
78
 
60
79
  | Workflow | Registered tools |
61
80
  | --- | --- |
62
- | **All delegation methods** (default) | Existing five delegation/lifecycle tools, `subagent_auto`, `subagent_inspect`, and `subagent_consult` |
63
- | **Async only** | Four detached lifecycle tools plus `subagent_inspect`; blocking `subagent` and `subagent_consult` are omitted |
64
- | **Blocking only** | `subagent`, `subagent_auto`, `subagent_consult`, and `subagent_inspect` |
81
+ | **All delegation methods** (compatibility default) | `subagent`, `subagent_spawn`, `subagent_send`, `subagent_manage`, `subagent_mailbox`, `subagent_inspect`, and `subagent_consult` |
82
+ | **Async only** (recommended) | `subagent_spawn`, `subagent_send`, `subagent_manage`, `subagent_mailbox`, and `subagent_inspect` |
83
+ | **Blocking only** (compatibility) | `subagent`, `subagent_inspect`, and `subagent_consult` |
65
84
  | **Disabled** | `subagent_inspect` only; delegation is disabled |
66
85
 
86
+ `subagent` and `subagent_consult` remain explicit compatibility routes with no current deprecation deadline.
87
+ The four async lifecycle tools stay separate because starting work, sending follow-ups, managing lifecycle, and queueing mailbox messages have different contracts.
88
+ Any default change, tool removal, or lifecycle consolidation requires a separately approved compatibility migration.
89
+
67
90
  The preview compares the selection with the tools registered in the current session, even when a manual settings edit is pending, and remains read-only until confirmation. Escape or **Cancel** leaves settings unchanged. Tool removal requires an extension reload because Pi does not expose extension tool unregistration. To avoid aborting work or removing isolated worktrees during `session_shutdown`, workflow changes are blocked while detached agents are retained; finish or clear them through **Current agents** first. Pi owns reload-error reporting and does not return a success result to extensions, so the save notification also tells users to run `/reload` if the tool surface does not refresh.
68
91
 
69
92
  The available tools are:
70
93
 
71
94
  - `subagent` β€” delegate blocking single, parallel, fan-in, chained, panel-review, or explicit dependency-workflow tasks. The main agent cannot process queued steering until the call returns.
72
- - `subagent_auto` β€” explicitly request one read-only planning turn followed by deterministic compilation and, only when admitted, execution through the existing blocking workflow engine.
73
95
  - `subagent_spawn` and related lifecycle tools β€” when enabled, start reusable detached work, return immediately, and receive bounded completion messages automatically.
74
96
  - `subagent_inspect` β€” inspect agent/model/run/runtime metadata without launching work or changing state.
75
97
  - `subagent_consult` β€” run one ephemeral read-only consultation and wait for its answer.
@@ -88,9 +110,10 @@ Custom transcript rendering is TUI presentation only. Tool names, parameter sche
88
110
 
89
111
  After each session starts, the descriptions of the registered `subagent`, `subagent_spawn`, and
90
112
  `subagent_consult` tools include the same bounded parent-facing catalog of the agents available in
91
- that session. Entries show the source (`built-in`, `user`, or `project`) and the `agentScope` needed to
92
- invoke them; the `agent` parameters remain unconstrained strings for cwd and scope flexibility. The
93
- catalog is rebuilt on
113
+ that session. Entries show the source (`built-in`, `user`, or `project`), required `agentScope`,
114
+ declared capability identifiers, configured tools, filesystem authority, and supported result
115
+ formats; the `agent` parameters remain unconstrained strings for cwd and scope flexibility. The
116
+ catalog also warns that enforced path, network, and secret guarantees are unsupported. It is rebuilt on
94
117
  `/reload` or the next session start, and omitted entries are reported explicitly when the catalog
95
118
  exceeds its metadata bounds.
96
119
 
@@ -98,14 +121,16 @@ Choose the API by lifecycle:
98
121
 
99
122
  | Need | Use |
100
123
  | --- | --- |
101
- | The caller explicitly wants a high-level objective decomposed under an authority ceiling and aggregate budget | `subagent_auto`, when blocking delegation is enabled |
102
- | A delegated result is required before the root's next action under default next-turn delivery | Use one blocking `subagent` call when registered. In **Async only**, complete the critical-path work directly or switch workflows before delegating it |
103
- | Broad research/review the current response does not depend on | Prefer one `subagent_spawn` covering related branches, when lifecycle tools are enabled |
104
- | Final-answer-dependent broad work with `completionDelivery: "auto-resume"` | Prefer one `subagent_spawn`; completion requests a synthesis turn |
105
- | Reusable history, follow-ups, or mailboxes | `subagent_spawn` and lifecycle tools, when enabled |
106
- | Side-effect-free agent/model/run diagnostics | `subagent_inspect` |
107
- | Synchronous reconnaissance, planning, or review that must not write | `subagent_consult`, when blocking delegation is enabled |
108
- | One simple or critical-path action the root can perform directly | No subagent |
124
+ | One simple, tightly coupled, or immediate critical-path task | Keep it in the main agent |
125
+ | Ordinary planning or review | Use the main agent with applicable skills and deterministic checks |
126
+ | One bounded implementation slice can run beside named main-agent work | Use async `subagent_spawn` with `worker`, clear ownership, and a supported delivery and integration path |
127
+ | Two or more independent implementation slices | Use workers with disjoint write ownership while the main agent coordinates and integrates |
128
+ | Broad read-only evidence that can run beside main-agent work | Use async `subagent_spawn` with `explorer` |
129
+ | Final-answer-dependent detached work | Enable `completionDelivery: "auto-resume"` so completion requests a synthesis turn |
130
+ | Bounded synchronous read-only evidence whose independent perspective justifies waiting | Use `subagent_consult` when blocking delegation is enabled |
131
+ | Intentional synchronous workflow, panel, chain, or fan-in | Use blocking `subagent` when making the main agent unavailable is justified |
132
+ | Reusable history, follow-ups, or mailboxes | Use `subagent_spawn` and lifecycle tools when enabled |
133
+ | Side-effect-free agent/model/run diagnostics | Use `subagent_inspect` |
109
134
 
110
135
  Execution modes:
111
136
 
@@ -154,8 +179,11 @@ are registered, `subagent_spawn` adds detached guidance for the active completio
154
179
  Changing the policy through `/subagents settings` refreshes that guidance immediately.
155
180
 
156
181
  The `subagent`, `subagent_spawn`, and `subagent_consult` descriptions advertise the current agent
157
- catalog automatically; no preliminary list call is needed. Built-ins and user agents appear under the
158
- default `agentScope: "user"`. Trusted project agents appear separately and explicitly require
182
+ catalog automatically; no preliminary list call is needed. Each entry exposes the exact declared
183
+ capability and tool identifiers needed by an enforced contract, plus filesystem authority and result
184
+ formats. Agents without a valid capability manifest are labeled `undeclared` instead of implying
185
+ support. Built-ins and user agents appear under the default `agentScope: "user"`. Trusted project
186
+ agents appear separately and explicitly require
159
187
  `agentScope: "project"` or `"both"`; project-authored names and descriptions are not read into
160
188
  metadata for untrusted projects. If a project definition
161
189
  shares a name with a user or built-in definition, the user version is the default and the project
@@ -165,30 +193,24 @@ catalog is bounded and reports its omission count; metadata discovery also caps
165
193
  per scope. Refreshed metadata replaces the previous session's catalog rather than accumulating stale
166
194
  entries.
167
195
 
168
- Count-selection guidance:
169
-
170
- - Use **no subagent** for simple answers, quick targeted edits, latency-sensitive one-step work, or
171
- critical-path work the main agent can perform directly.
172
- - `subagent` is deliberately blocking: while it runs, the main agent cannot answer queued steering.
173
- Use it when delegated outputs are required before the next root action and waiting is intentional.
174
- - With default `completionDelivery: "next-turn"`, prefer **one detached `subagent_spawn`** for broad
175
- research or review only when the current response does not depend on its result. When blocking
176
- `subagent` is registered, use it for required delegated output because an idle root is not awakened.
177
- In **Async only**, complete required work directly, opt into `auto-resume` when a later synthesis
178
- turn is appropriate, or switch delegation workflows.
179
- - With `completionDelivery: "auto-resume"`, prefer one detached `subagent_spawn` for broad related
180
- research or review even when the final answer depends on it; completion requests a later synthesis
181
- turn. Do not choose blocking parallel fan-out merely to keep delegation in one turn.
182
- - Use detached `subagent_spawn` only when lifecycle tools are enabled and a bounded independent task
183
- has a concrete isolation or specialization benefit. After spawning, do useful non-overlapping work
184
- immediately. Do not poll lifecycle tools for progress or duplicate the delegated work.
185
- - Add another detached agent only for truly independent work with safe workspace concurrency.
186
- If synchronous parallel or fan-in output is genuinely required, keep blocking `subagent` tasks independent, stay within the configured `blocking.maxParallelTasks` limit, and do not parallelize implementation that may edit the same files or shared state.
187
- The limit defaults to 8, accepts 1 through 64, and bounds total worker tasks in one call rather than the four-at-a-time execution concurrency.
188
- - Do not use project-local agents unless the user explicitly opts into them with
189
- `agentScope: "project"` or `"both"`; keep confirmation enabled for untrusted repositories.
190
-
191
- Examples where the main agent chooses the count:
196
+ Delegation guidance:
197
+
198
+ - The main agent owns overall planning, immediate critical-path work, integration, final verification, and the final answer.
199
+ - Use **no subagent** for simple answers, quick targeted edits, latency-sensitive one-step work, tightly coupled work, or the main agent's immediate blocker.
200
+ - Before one ordinary `subagent_spawn`, identify useful non-overlapping main-agent work that can start immediately and decide how completion will be integrated.
201
+ - A single async `worker` may implement a bounded slice with clear ownership while the main agent advances its named local task.
202
+ - If no useful main-agent work exists, perform the single-lane task directly instead of spawning one ordinary worker.
203
+ - A single worker without concurrent main-agent work remains available when the user explicitly requests a specialist model, tool profile, or isolation boundary.
204
+ - With default `completionDelivery: "next-turn"`, use detached work only when the current response does not depend on its result because an idle root is not awakened.
205
+ - With `completionDelivery: "auto-resume"`, detached work may affect the final answer because completion requests a later synthesis turn.
206
+ - After `subagent_spawn` returns, immediately continue the identified local task instead of merely announcing the spawn, waiting, polling, duplicating the child task, or ending while useful local work remains.
207
+ - Use multiple workers only for truly independent slices with disjoint write ownership and safe workspace concurrency, and keep integration in the main agent.
208
+ - Keep ordinary planning in the main agent or express a genuine dependency graph through an explicit caller-authored `workflow` payload.
209
+ - Keep ordinary review in the main agent with a review skill and deterministic checks; reserve custom verifier agents or panels for consequential independent verification.
210
+ - Use blocking `subagent` only when intentional synchronous output or isolation justifies making the main agent unavailable.
211
+ - Do not use project-local agents unless the user explicitly opts into them with `agentScope: "project"` or `"both"`; keep confirmation enabled for untrusted repositories.
212
+
213
+ Examples where the main agent chooses the topology:
192
214
 
193
215
  No subagent for a known-file edit:
194
216
 
@@ -196,101 +218,42 @@ No subagent for a known-file edit:
196
218
  Rename one symbol in src/foo.ts.
197
219
  ```
198
220
 
199
- One detached agent for a broad asynchronous review that the current response does not require, or when auto-resume is enabled (call `subagent_spawn`):
221
+ One async implementation worker beside useful main-agent work:
222
+
223
+ The following example assumes `completionDelivery: "auto-resume"` because the final answer depends on both slices.
224
+ The main agent owns `src/parser.ts`, immediately continues that work after spawn, and later integrates and verifies the worker result.
200
225
 
201
226
  ```json
202
227
  {
203
- "agent": "reviewer",
204
- "task": "Review source, tests, and integration risks for the current changes. Do not edit files. Report PASS/FAIL/PARTIAL with evidence."
228
+ "agent": "worker",
229
+ "task": "Implement the approved formatter slice only in src/formatter.ts and test/formatter.test.ts. Do not edit src/parser.ts. Report changed paths, checks, and remaining risks."
205
230
  }
206
231
  ```
207
232
 
208
- A blocking fan-out is reserved for output that must be synthesized before the root continues (call
209
- `subagent`):
233
+ For two or more implementation workers, issue one spawn per disjoint slice, state each file or responsibility boundary, and keep integration in the main agent.
234
+ Shared-workspace agents may write concurrently by default; use isolated worktrees when repository-write isolation is required.
235
+
236
+ A blocking fan-out is reserved for output that must be synthesized before the main agent continues:
210
237
 
211
238
  ```json
212
239
  {
213
240
  "tasks": [
214
241
  {
215
- "agent": "scout",
242
+ "agent": "explorer",
216
243
  "task": "Research auth-related source files. Report paths and open questions. Do not edit files."
217
244
  },
218
245
  {
219
- "agent": "scout",
246
+ "agent": "explorer",
220
247
  "task": "Research auth-related tests. Report coverage gaps. Do not edit files."
221
248
  }
222
249
  ],
223
250
  "aggregator": {
224
- "agent": "reviewer",
251
+ "agent": "explorer",
225
252
  "task": "Merge these findings into a concise implementation-risk summary. Use {previous}."
226
253
  }
227
254
  }
228
255
  ```
229
256
 
230
- ## 🧠 Explicit autonomous workflow planning
231
-
232
- `subagent_auto` is an opt-in surface separate from the large multi-mode `subagent` schema.
233
- It never intercepts ordinary prompts and does not change existing calls when omitted.
234
- The caller supplies one versioned objective, non-goals, required inputs, acceptance criteria, required evidence, an authority ceiling, an aggregate budget, and deterministic constraints.
235
-
236
- ```json
237
- {
238
- "request": {
239
- "version": "pi-subagents:automation-request:v1",
240
- "objective": "Implement and verify the package change",
241
- "nonGoals": ["Do not publish or release"],
242
- "requiredInputs": ["current trusted repository"],
243
- "acceptanceCriteria": ["Focused and root checks pass"],
244
- "requiredEvidence": ["test output", "final diff review"],
245
- "authorityCeiling": {
246
- "capabilities": ["implementation", "code-review"],
247
- "tools": ["read", "bash", "edit", "write"],
248
- "readPaths": ["packages/pi-subagents"],
249
- "writePaths": ["packages/pi-subagents"],
250
- "network": "unspecified",
251
- "secrets": "unspecified",
252
- "sideEffectPolicy": "mutating"
253
- },
254
- "aggregateBudget": {
255
- "timeoutMs": 180000,
256
- "maxTurns": 30,
257
- "maxToolCalls": 60,
258
- "maxTasks": 4,
259
- "maxRevisions": 1
260
- },
261
- "constraints": {
262
- "contextPressure": "high",
263
- "maxMutatingWidth": 2,
264
- "requireVerification": true,
265
- "workspaceMode": "shared"
266
- }
267
- }
268
- }
269
- ```
270
-
271
- The planner always uses the built-in `planner` with only `read`, `grep`, `find`, and `ls`, disabled extensions and session persistence, trust-aware prompt resources, a maximum 60-second planning deadline, and bounded turn/tool-call counts.
272
- The planner returns only `pi-subagents:workflow-plan:v1` JSON and cannot choose agents, grant authority, create descendants, or forge executor identities.
273
- The executor reserves at most one quarter of the aggregate timeout, turns, and tool calls for planning before compiling execution work.
274
- It rejects before planning when that reservation leaves no positive execution budget, and it narrows the request task ceiling to the configured blocking-task limit before compilation or persistence.
275
-
276
- The compiler validates strict unknown-field and UTF-8 bounds, relative scopes, cycles, artifacts, ownership, capability routes, aggregate budgets, task generations, integration ownership, and the two-mutating-worker limit before execution.
277
- Caller-level acceptance criteria and required evidence are merged into the authoritative terminal, integration-owner, and verifier contracts without exceeding contract item limits.
278
- Path ceilings are compiler and conflict-scheduling constraints, not operating-system filesystem isolation; use a container or sandbox when host-level containment is required.
279
- Network and secrets guarantees other than `"unspecified"` fail closed because the current executor cannot enforce them.
280
- It can narrow or reject a proposal and can add one verifier only within the caller's remaining authority and budget.
281
- Parent-owned, needs-input, planner-failed, and compiler-rejected outcomes launch no execution workers.
282
- Every admitted mutating workflow has one authoritative integration owner and one distinct `structured-v2` verifier before any mutating worker starts.
283
- Project-local agents are not selected by this first surface, workflow grandchildren are rejected, and `workspaceMode: "worktree"` fails closed until blocking workflow worktree execution is supported.
284
-
285
- Pending, needs-input, verification-rework, stale, or invalidated work can be revised through the internal `pi-subagents:workflow-plan-patch:v1` contract.
286
- Each accepted patch must match the current plan identity and workflow generation, rotates both identity and task generations, preserves accepted history/artifacts/receipts, and stops after the caller's revision limit.
287
- The initial tool surface does not expose free-form public graph editing.
288
-
289
- For compatibility or exact task control, use caller-authored `subagent.workflow`.
290
- Before downgrading, use that explicit workflow fallback and let active automation calls finish.
291
- Older releases do not register `subagent_auto` and ignore the separate versioned automation records under `~/.pi/agent/pi-subagents-workflows/`; no settings migration is required.
292
- No benchmark result in this release changes the default delegation policy or makes a production-quality claim.
293
-
294
257
  ## πŸ”Ž Read-only inspection
295
258
 
296
259
  `subagent_inspect` is registered in every workflow, including disabled delegation. It never starts a child, sends or acknowledges mailbox messages, interrupts or closes a run, changes settings, refreshes providers, resolves credentials, or modifies files.
@@ -314,11 +277,16 @@ The schema rejects fields that do not belong to the selected action. Explicit `p
314
277
 
315
278
  ## πŸ“– Read-only consultation
316
279
 
317
- `subagent_consult` is registered whenever blocking delegation is enabled. It runs exactly one synchronous, non-retained child with `--no-session`, `--no-extensions`, and only the effective intersection of the agent tools with `read`, `grep`, `find`, and `ls`. A missing tool list receives those four defaults; an explicit `tools: []` receives `--no-tools`; write, shell, lifecycle, custom, and extension tools cannot enter the child allow-list. The executor policy remains authoritative even when the task or agent prompt asks for implementation.
280
+ Ordinary planning and review stay in the main agent with applicable skills and deterministic checks.
281
+ Use `subagent_consult` only when bounded read-only evidence and an independent perspective justify making the main agent wait.
282
+ It is registered whenever blocking delegation is enabled and runs exactly one synchronous, non-retained child with `--no-session`, `--no-extensions`, and only the effective intersection of the agent tools with `read`, `grep`, `find`, and `ls`.
283
+ A missing tool list receives those four defaults, while an explicit `tools: []` receives `--no-tools`.
284
+ Write, shell, lifecycle, custom, and extension tools cannot enter the child allow-list.
285
+ The executor policy remains authoritative even when the task or agent prompt asks for implementation.
318
286
 
319
287
  ```json
320
288
  {
321
- "agent": "reviewer",
289
+ "agent": "explorer",
322
290
  "task": "Inspect the authentication changes and report correctness and security findings with paths.",
323
291
  "thinkingLevel": "high"
324
292
  }
@@ -358,7 +326,7 @@ Run one read-only reconnaissance agent:
358
326
 
359
327
  ```json
360
328
  {
361
- "agent": "scout",
329
+ "agent": "explorer",
362
330
  "task": "Find the statusline extension entry points"
363
331
  }
364
332
  ```
@@ -371,14 +339,14 @@ Run multiple agents in parallel with a shared thinking level and one per-task ov
371
339
  {
372
340
  "tasks": [
373
341
  {
374
- "agent": "scout",
342
+ "agent": "explorer",
375
343
  "task": "Map package metadata files",
376
344
  "timeoutMs": 30000,
377
345
  "thinkingLevel": "low"
378
346
  },
379
347
  {
380
- "agent": "reviewer",
381
- "task": "Review TypeScript config consistency"
348
+ "agent": "explorer",
349
+ "task": "Inspect TypeScript config consistency"
382
350
  }
383
351
  ],
384
352
  "timeoutMs": 120000,
@@ -395,31 +363,32 @@ Run parallel workers, then aggregate their results:
395
363
  ```json
396
364
  {
397
365
  "tasks": [
398
- { "agent": "scout", "task": "Find auth-related code" },
399
- { "agent": "scout", "task": "Find auth-related tests" }
366
+ { "agent": "explorer", "task": "Find auth-related code" },
367
+ { "agent": "explorer", "task": "Find auth-related tests" }
400
368
  ],
401
369
  "aggregator": {
402
- "agent": "reviewer",
370
+ "agent": "explorer",
403
371
  "task": "Merge, dedupe, and verify these findings. Use {previous}."
404
372
  }
405
373
  }
406
374
  ```
407
375
 
408
- Run a chain where each step receives the previous output:
376
+ Run a read-only chain where each step receives the previous output:
409
377
 
410
378
  ```json
411
379
  {
412
380
  "chain": [
413
- { "agent": "scout", "task": "Find subagent-related code" },
381
+ { "agent": "explorer", "task": "Find subagent-related code" },
414
382
  {
415
- "agent": "planner",
416
- "task": "Using this context, plan the extension: {previous}"
383
+ "agent": "explorer",
384
+ "task": "Summarize the relevant paths and open questions from this inventory: {previous}"
417
385
  }
418
386
  ]
419
387
  }
420
388
  ```
421
389
 
422
- Run an evidence-preserving panel:
390
+ Ordinary review stays in the main agent with a review skill and deterministic checks.
391
+ Run an evidence-preserving panel only when consequential independent perspectives justify blocking the main agent:
423
392
 
424
393
  ```json
425
394
  {
@@ -429,10 +398,10 @@ Run an evidence-preserving panel:
429
398
  "task": "Review the authentication change for correctness and regressions.",
430
399
  "context": "Inspect the current repository snapshot and existing test evidence.",
431
400
  "reviewers": [
432
- { "id": "correctness", "agent": "reviewer", "focus": "Control flow and edge cases" },
433
- { "id": "tests", "agent": "reviewer", "focus": "Coverage and regression risk" }
401
+ { "id": "correctness", "agent": "explorer", "focus": "Control flow and edge cases" },
402
+ { "id": "tests", "agent": "explorer", "focus": "Coverage and regression risk" }
434
403
  ],
435
- "synthesizer": { "agent": "reviewer" },
404
+ "synthesizer": { "agent": "explorer" },
436
405
  "minValidReviews": 2
437
406
  },
438
407
  "totalTimeoutMs": 120000
@@ -461,15 +430,15 @@ Run an explicit dependency workflow:
461
430
  "tasks": [
462
431
  {
463
432
  "id": "inventory",
464
- "agent": "scout",
433
+ "agent": "explorer",
465
434
  "task": "Produce the auth inventory artifact.",
466
435
  "resultFormat": "structured-v2",
467
436
  "readPaths": ["src/auth"]
468
437
  },
469
438
  {
470
439
  "id": "review",
471
- "agent": "reviewer",
472
- "task": "Review the inventory and report verification evidence.",
440
+ "agent": "explorer",
441
+ "task": "Inspect the inventory and report verification evidence.",
473
442
  "dependsOn": ["inventory"],
474
443
  "inputArtifacts": ["auth-inventory"],
475
444
  "resultFormat": "structured-v2"
@@ -481,6 +450,7 @@ Run an explicit dependency workflow:
481
450
  ```
482
451
 
483
452
  Managed verified execution is an explicit per-workflow contract.
453
+ The verifier examples below assume a custom user agent named `api-reviewer` with `independent-review` capability.
484
454
  The executor infers the final mutating integration owner when none is declared, synthesizes one distinct read-only verifier, runs declared deterministic checks in a disposable Git worktree overlaid with the submitted state, and accepts only the exact unchanged submitted state.
485
455
  Every deterministic check has a stable evidence ID, a direct executable with argument-array invocation, and an optional relative `cwd` and timeout.
486
456
  Only `git`, `node`, `npm`, and `npx` are accepted; shell command strings fail before child allocation.
@@ -491,7 +461,7 @@ Every required evidence ID must match a currently passed executor-owned check; w
491
461
  {
492
462
  "workflow": {
493
463
  "verifiedExecution": {
494
- "verifierAgent": "reviewer",
464
+ "verifierAgent": "api-reviewer",
495
465
  "maxReworkCycles": 1,
496
466
  "checks": [
497
467
  {
@@ -557,7 +527,7 @@ The older explicit verifier contract remains available as a compatibility gate w
557
527
  },
558
528
  {
559
529
  "id": "verification",
560
- "agent": "reviewer",
530
+ "agent": "api-reviewer",
561
531
  "task": "Independently verify the staged result.",
562
532
  "dependsOn": ["implementation"],
563
533
  "verifierFor": "implementation",
@@ -599,18 +569,27 @@ Legacy v1 and v2 records without acceptance fields retain their prior completed
599
569
 
600
570
  ## πŸ” Stateful agents
601
571
 
602
- Stateful lifecycle tools are available by default. `subagent_spawn` is detached: it schedules work, returns immediately with an opaque `agentId`, and later injects a bounded `pi-subagent-completion` custom message. Every turn receives an executor-owned `runId`, monotonically increasing agent-local generation, and unique `completionId`. The terminal completion is persisted before delivery, simultaneous completions are batched, and the broker allows at most one in-flight root wake until that parent turn starts.
572
+ Stateful lifecycle tools are available by default. `subagent_spawn` is detached: it schedules work, returns immediately with an opaque `agentId` plus canonical `taskPath`, and later delivers a bounded completion to its intended parent. Every turn receives an executor-owned `runId`, monotonically increasing agent-local generation, and unique `completionId`. The terminal completion and recipient are persisted before delivery, simultaneous root completions are batched, and the root broker allows at most one in-flight wake until that parent turn starts.
573
+ In TUI mode, completion messages show a compact task and payload summary while collapsed; use the configured tool-output expansion action (`Ctrl+O` by default) to show or hide the complete message globally.
603
574
 
604
- Detached work follows a non-polling policy. With default `next-turn` delivery, prefer one bounded `subagent_spawn` for related asynchronous research or review only when the current response does not depend on its result. If it does, use blocking `subagent` when registered; in **Async only**, complete required work directly, opt into `auto-resume` when a later synthesis turn is appropriate, or switch workflows. With opt-in `auto-resume`, detached broad work may be final-answer-dependent because completion requests a synthesis turn after the root settles. In either mode, do useful non-overlapping main-agent work immediately, do not poll `subagent_inspect` or `subagent_mailbox` with `action: "read"`, and do not duplicate delegated work. Add another detached agent only for truly independent work with safe workspace concurrency. Detached lifecycle work intentionally has no `subagent_wait` tool.
575
+ Detached work follows a non-polling policy.
576
+ Before one ordinary `subagent_spawn`, identify useful non-overlapping main-agent work that starts immediately and a supported completion integration path.
577
+ With default `next-turn` delivery, the current response must not depend on the result because an idle root is not awakened.
578
+ With opt-in `auto-resume`, detached work may affect the final answer because completion requests a synthesis turn after the main agent settles.
579
+ After spawning, immediately continue the identified local task instead of merely announcing the spawn, waiting, polling `subagent_inspect` or `subagent_mailbox`, duplicating the child task, or ending while useful local work remains.
580
+ Add another detached agent only for truly independent work with safe workspace concurrency and disjoint write ownership.
581
+ Detached lifecycle work intentionally has no `subagent_wait` tool.
605
582
 
606
- A detached agent additionally needs a concrete isolation or specialization benefit such as independent review, bounded context/output, a distinct model/tool profile, or workspace isolation. Simple work that the main agent can perform directly should not be delegated.
583
+ A detached `worker` may directly implement a bounded slice with clear ownership while the main agent handles another useful slice and retains integration and final verification.
584
+ Without concurrent main-agent work, use one worker only for an explicit user-requested specialist model, tool profile, or isolation boundary.
585
+ Simple and immediate critical-path work should stay in the main agent.
607
586
 
608
587
  `stateful.completionDelivery` controls settled completion delivery:
609
588
 
610
- - `"next-turn"` (default) preserves the previous behavior: use `deliverAs: "steer"` with `triggerTurn: false`. An active root can consume completion naturally; an idle root is not awakened.
611
- - `"auto-resume"` holds completion while the root is active, then requests one synthesis turn after the parent settles when no user or extension messages are already pending. Simultaneous completions share that turn, active work is not interrupted, and pending input suppresses the autonomous wake.
589
+ - `"next-turn"` (default) sends `deliverAs: "steer"` without a turn trigger. Pi queues it into an active root's context, while an idle root records it without waking.
590
+ - `"auto-resume"` holds completion while the root is active, then requests one synthesis turn after the parent settles when no user or extension messages are already pending. Simultaneous completions share that turn, active work is not interrupted, and pending input suppresses the automatic wake.
612
591
 
613
- The bounded persisted completion outbox provides ordered at-least-once delivery across process restart without replaying the child turn. When state must be reduced to its storage bound, persistence drops roots without pending completions first and trims old history rather than discarding an outbox-owned root. A completion is acknowledged only after parent context assembly observes its exact `completionId`; an injection that returns synchronously but never reaches context remains pending for retry. If the process exits after context assembly but before acknowledgement is persisted, the same ID can be delivered again and consumers must deduplicate it. Auto-resume wake admission remains best-effort because Pi's custom-message API is fire-and-forget, but an unacknowledged terminal completion itself remains available for redelivery on the next start of the owning session. Transient terminal-persistence failures retry with bounded exponential backoff and keep the run pending; shutdown cancels retry waits and reports a final persistence failure instead of silently resolving unsaved work.
592
+ The bounded persisted completion outbox provides ordered at-least-once delivery across process restart without replaying the child turn. A top-level completion targets `/root`; a nested completion enters the direct retained parent's mailbox and is not duplicated into the root transcript. If the direct parent cannot own delivery, routing walks toward the nearest live retained ancestor and uses `/root` only as the final fallback. An idle parent remains asleep, and inspection exposes its unread and pending-completion counts until a later turn consumes the envelope. When state must be reduced to its storage bound, persistence drops roots without pending completions first and trims old history rather than discarding an outbox-owned root. A completion is acknowledged only after the intended recipient context observes its exact `completionId`; an injection that returns synchronously but never reaches context remains pending for retry. If the process exits after context assembly but before acknowledgement is persisted, the same ID can be delivered again and consumers must deduplicate it. Auto-resume applies only to `/root`; nested delivery never silently starts the parent. Transient terminal-persistence failures retry with bounded exponential backoff and keep the run pending; shutdown cancels retry waits and reports a final persistence failure instead of silently resolving unsaved work.
614
593
 
615
594
  The default `subprocess` transport preserves compatibility: each turn starts a fresh isolated `pi --mode json -p --no-session` child and receives sanitized, bounded history.
616
595
  Pi registers every Subagents tool and command during startup, but loads blocking execution, manager UI, inspection work, and the selected detached transport implementation only on first use.
@@ -625,8 +604,8 @@ Run `/subagents` in TUI mode to open the standard primary manager.
625
604
  It leads with the current delegation workflow, human-readable async completion behavior, consultation/delegation target policies, consultation-resource policy, parallel-worker limit, and active/retained counts.
626
605
  **Change delegation**, **Current agents**, and **Settings** cover the common workflows.
627
606
  Agent permissions, **Maximum parallel workers**, **Detached agent limits**, **Performance and execution**, transport/runtime details, source, and settings path remain under **Advanced settings**.
628
- **Performance and execution** provides responsiveness guidance, transport previews, Fast/Balanced/Deep thinking profiles, and per-agent model/thinking/timeout defaults.
629
- Profiles are explicit atomic thinking patches, preserve model/tool/timeout/context settings, never select `max`, and can be customized afterward.
607
+ **Performance and execution** provides responsiveness guidance, transport previews, and per-agent model/thinking/timeout defaults.
608
+ Per-agent defaults preserve tool and context settings, and explicit tool-call values remain authoritative.
630
609
  The parallel-worker input rejects invalid values without discarding the draft and applies a successful save immediately.
631
610
  The detached-limit screen edits retained capacity, active-turn concurrency, direct children, tree depth, and stored-record capacity.
632
611
  Detached-limit saves are durable immediately but apply to the runtime after `/reload` or the next Pi session.
@@ -669,7 +648,8 @@ The settings UI patches the raw JSON atomically and preserves unknown fields.
669
648
  It refuses to overwrite malformed or invalid settings.
670
649
  Supported Pi writers serialize the latest-document read and same-directory temporary-file rename through `pi-subagents.json.mutation-lock`.
671
650
  Editors and older extension versions do not participate in that lock, so avoid manual edits while a settings save is in progress.
672
- `blocking.enabled` defaults to `true`; set it to `false` for async-only delegation.
651
+ `blocking.enabled` defaults to `true`, so **All delegation methods** remains the compatibility default.
652
+ Set it to `false` for the recommended async-only workflow.
673
653
  `blocking.maxParallelTasks` defaults to `8` and accepts positive integers from `1` through `64`.
674
654
  It limits worker tasks in one blocking parallel call, while execution still starts at most four workers at once and treats an optional aggregator separately.
675
655
  `stateful.enabled` also defaults to `true`; its existing `false` value remains the blocking-only workflow.
@@ -688,8 +668,8 @@ This avoids lifecycle-driven tool-schema churn and preserves a stable provider p
688
668
 
689
669
  | Tool | Purpose |
690
670
  | --- | --- |
691
- | `subagent_spawn` | Start detached work with optional task-selected thinking and retained timeout, exact-retry `idempotencyKey`, and `text`, `structured-v1`, or `structured-v2` result format; return an opaque `agentId` immediately and deliver completion asynchronously. |
692
- | `subagent_send` | Send follow-up work with an optional one-turn timeout override and trigger a new turn on a reusable agent; semantic skew requires explicit `revalidate: true`, and shared-workspace write conflicts are guarded unless explicitly overridden. |
671
+ | `subagent_spawn` | Start detached work with an optional canonical `taskName`, task-selected thinking and retained timeout, exact-retry `idempotencyKey`, and `text`, `structured-v1`, or `structured-v2` result format; return both `agentId` and `taskPath` immediately and deliver completion asynchronously. |
672
+ | `subagent_send` | Send follow-up work with an optional one-turn timeout override and trigger a new turn on a reusable agent; semantic skew requires explicit `revalidate: true`, and shared-workspace concurrency is allowed by default. |
693
673
  | `subagent_manage` | Use `"interrupt"` to retain an agent after aborting active work or `"close"` to release it; both actions accept optional `subtree`. Use `subagent_inspect` for all list and detail operations. |
694
674
  | `subagent_mailbox` | Use `action: "send"` for queue-only messages that do not start a turn, or `"read"` to read and optionally acknowledge unread messages. |
695
675
 
@@ -716,7 +696,36 @@ Active turns are FIFO-limited by `maxActiveTurns`; excess retained work remains
716
696
  `maxAgents` separately bounds running, queued, and idle records.
717
697
  `maxChildrenPerAgent` bounds direct children, while `maxDepth` counts nested levels below a depth-zero root.
718
698
  `maxStoredAgents` bounds sanitized records persisted per session and does not increase live runtime capacity.
719
- `parentId` creates a bounded child relationship; subtree interrupt and close operate child-first.
699
+ `parentId` accepts either an opaque ID or canonical path and creates a bounded child relationship; subtree interrupt and close operate child-first.
700
+
701
+ ### Canonical paths and retained peer communication
702
+
703
+ `agentId` remains the durable compatibility key.
704
+ Every live retained record also has a session-scoped path under `/root`, such as `/root/research` or `/root/research/tests`.
705
+ Supply `taskName` to choose the final segment.
706
+ Segments accept lowercase ASCII letters, digits, and underscores; `root`, `.`, `..`, slashes, empty values, and names longer than 128 characters are rejected.
707
+ An omitted name receives a deterministic privacy-safe `agent_<hash>` fallback, including for restored legacy records.
708
+ A path must be unique while its record is retained and not closed, and the same path may be reused after close.
709
+
710
+ Root lifecycle and inspection fields named `agentId` continue to accept opaque IDs and now also resolve absolute canonical paths.
711
+ A peer target without a leading slash resolves below the authenticated sender's path, while `/root` and paths beginning with `/root/` are absolute.
712
+ Use an opaque ID when addressing historical closed records because a closed path is no longer reserved.
713
+
714
+ Retained child sessions receive two package-owned tools:
715
+
716
+ - `subagent_peer_send` queues one bounded message for `/root` or another retained peer and never accepts a sender field.
717
+ - `subagent_peer_list` returns only bounded ID, path, agent-name, and lifecycle metadata for the current session.
718
+
719
+ Messages can cross structural agent trees because one registry is one communication namespace.
720
+ A running retained target may receive the persisted envelope through its active transport; an idle target remains asleep and consumes the message on its next turn.
721
+ Message IDs and optional deduplication keys make retry at-least-once, so recipients must tolerate seeing the same exact ID again after an acknowledgement persistence failure.
722
+ Process children use an authenticated loopback JSONL bridge.
723
+ Its random credential is bound to one retained process generation, captured and removed from the child environment before model tools run, never persisted or rendered, and revoked on release, replacement, or shutdown.
724
+ The broker bounds frames, connections, handshakes, message text, and response text.
725
+ If a transport cannot accept a live push, the durable mailbox remains the fallback rather than starting another turn.
726
+
727
+ To roll back model guidance or callers, omit `taskName`, keep addressing agents by `agentId`, and avoid the child peer tools.
728
+ Older records require no manual migration because missing paths and recipients are reconstructed deterministically under the unchanged state version.
720
729
 
721
730
  ### Migrating from the previous seven-tool lifecycle surface
722
731
 
@@ -737,7 +746,8 @@ A spawn can request a thinking level explicitly:
737
746
 
738
747
  ```json
739
748
  {
740
- "agent": "reviewer",
749
+ "agent": "explorer",
750
+ "taskName": "concurrency_analysis",
741
751
  "task": "Analyze the cross-package concurrency failure and identify the safest fix",
742
752
  "thinkingLevel": "high"
743
753
  }
@@ -750,6 +760,7 @@ An exact retry can use a bounded session-owned idempotency key:
750
760
  ```json
751
761
  {
752
762
  "agent": "worker",
763
+ "taskName": "approved_change",
753
764
  "task": "Implement the approved change",
754
765
  "idempotencyKey": "approved-change-1"
755
766
  }
@@ -761,6 +772,7 @@ Closing the retained record releases the key.
761
772
 
762
773
  Set `resultFormat: "structured-v1"` to ask for legacy `summary`, `evidence`, `changes`, `verification`, and `risks` fields.
763
774
  Prefer `resultFormat: "structured-v2"` when orchestration must distinguish `completed`, `partial`, `blocked`, `needs-input`, `failed`, `interrupted`, `abstained`, `stale`, or `contract-invalid` outcomes and consume typed artifact evidence.
775
+ The child prompt includes a complete minimum JSON object and item shapes; every displayed top-level field remains required even when its array is empty.
764
776
  Valid structured data and deterministic recovery classification appear in completion and inspection details, while malformed structured output becomes `contract-invalid` instead of being treated as success.
765
777
  The executor stamps task generation, cancellation lineage, and accepted `ExecutionPlan` identity after parsing, so model output cannot forge the provenance used for stale-result containment.
766
778
 
@@ -785,7 +797,7 @@ Stateful execution uses a transport boundary:
785
797
  - `in-process` uses only public Pi SDK APIs: `createAgentSessionServices()`, `createAgentSessionFromServices()`, `SessionManager.inMemory()`, and normal session lifecycle methods. It isolates conversation/tool selection, not memory or crashes; child failures share the parent Node.js process.
786
798
  - `rpc` uses strict bounded JSONL over one lazy child process per active retained agent. A `get_state` response proves readiness, prompt response means accepted only, and `agent_settled` is the completion boundary after retry or compaction.
787
799
  - `auto` selects one transport before launch and retains the choice for that agent's runtime lifetime. It never retries through another transport after startup or accepted work.
788
- - In-process and RPC child resource loading disables extensions to prevent recursive `pi-subagents` loading and duplicate extension side effects while retaining trust-eligible context/skill resources and the selected agent prompt. The compatibility subprocess path retains its recursion-depth guard and configured tool behavior. Transports receive the same resolved target-trust boolean through their public SDK or explicit CLI trust controls.
800
+ - In-process and RPC child resource loading disables user and project extensions to prevent recursive `pi-subagents` loading and duplicate extension side effects while retaining trust-eligible context/skill resources and the selected agent prompt. All transports add only the package-owned peer bridge and its two communication tools; the bridge does not add filesystem, shell, model, network-destination, or user-extension authority. The compatibility subprocess path retains its recursion-depth guard and configured execution tools. Transports receive the same resolved target-trust boolean through their public SDK or explicit CLI trust controls.
789
801
  - Agent model strings use Pi core's CLI resolver, including provider/model patterns, fuzzy matching, custom provider model IDs, and `:<thinking>` suffixes. Thinking level and built-in tool allow-list overrides are applied when the child is created. Parent model/thinking changes are snapshotted for subsequently created children; an existing child keeps its own session configuration.
790
802
  - Extension/custom tool names are rejected by in-process and RPC v1 before child creation; automatic mode selects `subprocess` for them, and permissions are never silently widened.
791
803
  - Timeout, parent abort, close, expiry, and session shutdown abort/dispose owned child sessions or process groups. A child that does not settle after abort grace is discarded rather than reused.
@@ -797,16 +809,23 @@ No private Pi imports, runtime casts, or `ExtensionAPI` monkey-patching are used
797
809
  The package uses public Pi root RPC types but owns exact CLI resolution, bounded framing, readiness, stderr, cancellation, and process-group cleanup because the stock client does not provide those package-specific guarantees.
798
810
  Approval policy, sandbox profile, provider-header hooks, extension state, global scheduling, and parent/child transcript switching are not inherited or provided by in-process or RPC transport.
799
811
 
800
- Write-capable agents share the workspace by default. Concurrent write-capable starts in the same cwd are rejected unless `allowConcurrentWrites` is explicitly set. Classification is intentionally conservative: an agent with `bash`, `write`, or `edit` is write-capable even when its task prompt says β€œread only,” because prompt wording is not a filesystem sandbox. Prefer one detached agent when asynchronous work can be combined. If concurrent work is genuinely required, use the blocking batch only when synchronous outputs justify making the root unavailable, explicitly accept safe detached overlap with `allowConcurrentWrites`, or use isolated worktrees when repository isolation is needed.
812
+ Write-capable detached agents share the workspace and may run concurrently by default.
813
+ Classification remains intentionally conservative for automatic transport selection: an agent with `bash`, `write`, or `edit` is write-capable even when its task prompt says β€œread only,” because prompt wording is not a filesystem sandbox.
814
+ Assign disjoint file or responsibility ownership to concurrent writers and keep integration in the main agent.
815
+ Use isolated worktrees when repository-write isolation is required.
816
+ The deprecated `allowConcurrentWrites` field remains accepted for compatibility but no longer changes admission behavior.
817
+ Use the blocking batch only when synchronous outputs justify making the main agent unavailable.
801
818
 
802
819
  Set `workspaceMode: "worktree"` to opt into a disposable detached Git worktree; this requires a clean repository and the worktree is removed on close or session shutdown. The generated path inherits the approved base cwd's trust snapshot. Retained records mark disposable worktrees explicitly, so they are never restored even if cleanup could not remove the generated directory. Shared-workspace retained records store an additive bounded target-trust snapshot for transport and inspection parity; session restore canonicalizes the retained cwd and re-resolves current/saved trust rather than blindly trusting the persisted value. Older records without either field remain readable.
803
820
 
804
821
  ## πŸ“œ Compatibility and failure contract
805
822
 
806
823
  Existing accepted `subagent` payload shapes remain unchanged.
807
- `subagent_spawn` adds optional `idempotencyKey` and `resultFormat` fields without changing omitted behavior.
824
+ `subagent_spawn` adds optional `taskName`, `idempotencyKey`, and `resultFormat` fields without changing omitted behavior.
825
+ `allowConcurrentWrites` remains accepted by `subagent_spawn` and `subagent_send` as a deprecated no-op so stored or resumed calls remain valid.
826
+ Spawn request identity continues to include its submitted value for exact-retry compatibility.
808
827
  Older releases do not recognize `stateful.transport: "rpc"` or `"auto"`; change the value to `"subprocess"` and reload before downgrading.
809
- Retained records remain transport-neutral, and older readers ignore the additive idempotency and context-footprint fields while the state version remains compatible.
828
+ Retained records remain transport-neutral, and older readers ignore the additive task identity, completion-recipient, idempotency, and context-footprint fields while the state version remains compatible.
810
829
  The `tasks` schema now advertises the absolute 64-item safety bound, while the effective `blocking.maxParallelTasks` value may be lower.
811
830
  The intentional compatibility change is that an external target without saved trust is rejected by the new default `cwdPolicy.delegation: "trusted-targets"`; set the user-owned policy to `"anywhere"` to restore the preceding target flexibility.
812
831
 
@@ -830,26 +849,16 @@ Built-in agents are available without setup and can be overridden by user or pro
830
849
 
831
850
  | Agent | Purpose | Tools |
832
851
  | --- | --- | --- |
833
- | `scout` | Read-only codebase reconnaissance. | `read`, `grep`, `find`, `ls`, `bash` |
834
- | `planner` | Grounded implementation plans. | `read`, `grep`, `find`, `ls` |
835
- | `reviewer` | Independent review of code and existing verification evidence. | `read`, `grep`, `find`, `ls`, `bash` |
836
- | `worker` | General-purpose implementation. | Pi default tools |
837
- | `general`, `general-purpose` | Aliases for `worker`. | Pi default tools |
852
+ | `explorer` | Read-only codebase exploration for specific questions. | `read`, `grep`, `find`, `ls` |
853
+ | `worker` | Bounded implementation and command execution with clear ownership. | Pi default tools |
838
854
 
839
- The built-in `reviewer` does not run tests, builds, benchmarks, or formatters. It recommends additional verification commands for the main agent to run instead. Custom agents can override this behavior.
855
+ Ordinary review stays in the main agent with a review skill and deterministic checks.
856
+ Use a custom user or project verifier only when consequential independent verification justifies the added cost and coordination.
840
857
 
841
858
  Built-in agents inherit the active/default Pi model instead of forcing a provider-specific model alias, which keeps every transport usable across different Pi setups.
842
- Built-ins also have no fixed thinking override until a caller, frontmatter, per-agent setting, or execution profile selects one.
843
-
844
- The optional profiles apply these provider-neutral thinking defaults:
845
-
846
- | Profile | `scout` | `planner` | `reviewer` | `worker` and aliases |
847
- | --- | --- | --- | --- | --- |
848
- | Fast | `low` | `low` | `medium` | `low` |
849
- | Balanced | `low` | `medium` | `medium` | `medium` |
850
- | Deep | `medium` | `high` | `high` | `high` |
851
-
852
- Profiles preserve model, timeout, tools, transport, completion delivery, and parent-context behavior.
859
+ The built-in `explorer` defaults to `low` thinking for bounded exploration and intentionally omits `bash` so it remains read-only and preserves the automatic in-process route.
860
+ Users who need shell-assisted read-mostly work can define a custom agent, but `bash` makes transport classification conservatively write-capable because prompt wording is not an enforcement boundary.
861
+ `worker` inherits thinking unless a caller, frontmatter, or per-agent setting selects one.
853
862
 
854
863
  ## βš™οΈ Configure agent tools
855
864
 
@@ -862,6 +871,7 @@ tool names and availability metadata; Save and Discard remain pinned below the m
862
871
  settings stored in `~/.pi/agent/pi-subagents.json` and affect future sessions.
863
872
 
864
873
  Compatibility: a valid legacy `pi-subagents-config.json` remains readable with a warning and is never modified automatically; rename it to `pi-subagents.json`. The first subsequent settings save writes the canonical file. If both files exist, the new filename takes precedence.
874
+ A saved `agents.scout` override from earlier releases applies to the renamed built-in `explorer` only when no explicit `agents.explorer` override exists and no custom `scout` agent is available.
865
875
 
866
876
  - Select an agent, then press Enter or Space to toggle tools.
867
877
  - Choose **Save changes** to write the draft, choose **Discard draft** to abandon it, or press Esc to
@@ -885,7 +895,7 @@ Example:
885
895
  ---
886
896
  name: api-reviewer
887
897
  description: Review API changes for compatibility and tests
888
- tools: read, grep, find, ls, bash
898
+ tools: read, grep, find, ls
889
899
  model: sonnet
890
900
  thinkingLevel: high
891
901
  capabilityManifest:
@@ -910,6 +920,8 @@ test coverage, and migration risks. Report PASS/FAIL/PARTIAL with evidence.
910
920
  `capabilityManifest` is optional for legacy custom agents and never grants authority by itself.
911
921
  Explicit workflow routing can match declared capabilities, configured tools, filesystem authority, verification roles, and low/medium/high cost or latency hints.
912
922
  A missing or malformed manifest remains unknown and cannot satisfy a capability-routed task.
923
+ The parent-facing catalog exposes contract-relevant declarations before the first delegation decision.
924
+ Use those identifiers exactly; enforced `readPaths`, `writePaths`, network, and secret guarantees are currently unsupported and require an external enforcement boundary.
913
925
 
914
926
  `agentScope` is a top-level tool argument supplied per invocation. It is not a setting in
915
927
  `~/.pi/agent/pi-subagents.json` and does not belong in agent frontmatter. The parent-facing tool
@@ -1037,7 +1049,7 @@ Treat project-local agent prompts like executable project configuration: only en
1037
1049
 
1038
1050
  Stateful records are stored as versioned mode-0600 JSON under `~/.pi/agent/pi-subagents-state/` (or the configured Pi agent directory).
1039
1051
  Explicit blocking-workflow snapshots use separate mode-0600 files under `~/.pi/agent/pi-subagents-workflows/`, retain at most 64 workflows per session for 30 days, and are available only through current-session workflow inspection.
1040
- Records contain sanitized logical history, never process IDs or credentials.
1052
+ Records contain sanitized logical history, canonical task paths, peer envelopes, and pending recipient metadata, but never process IDs, broker sockets, or communication credentials.
1041
1053
  Corrupt or unsupported state is quarantined, completed and actionable terminal outcomes are preserved, in-flight records restore as `interrupted`, and no prior side effect is automatically resumed.
1042
1054
  Retained follow-ups compare a privacy-safe hashed semantic snapshot before model work; incompatible resource changes require explicit `revalidate: true`, while unknown snapshot versions fail closed.
1043
1055
  Snapshots hash agent manifests, prompts, effective tools, model/thinking, transport, trust, Git tracked and untracked state, and bounded user/project skill and prompt resources without persisting their contents.
@@ -1054,13 +1066,6 @@ packages/pi-subagents/
1054
1066
  β”‚ β”œβ”€β”€ index.ts # Pi package entrypoint
1055
1067
  β”‚ β”œβ”€β”€ subagents.ts # Lightweight extension composition and blocking registration
1056
1068
  β”‚ β”œβ”€β”€ cached-module-loader.ts # Retryable first-use code-module cache
1057
- β”‚ β”œβ”€β”€ automation-registration.ts # Lightweight autonomous tool registration
1058
- β”‚ β”œβ”€β”€ automation.ts # First-use autonomous planning execution
1059
- β”‚ β”œβ”€β”€ automation-contract.ts # Strict request, proposal, and graph-patch contracts
1060
- β”‚ β”œβ”€β”€ automation-planner.ts # Bounded read-only planner prompt and resource policy
1061
- β”‚ β”œβ”€β”€ workflow-plan-compiler.ts # Deterministic admission, routing, and workflow compilation
1062
- β”‚ β”œβ”€β”€ workflow-plan-patch.ts # Generation-safe revisions and atomic plan persistence
1063
- β”‚ β”œβ”€β”€ workflow-planning-benchmark.ts # Frozen matched offline evaluation protocol
1064
1069
  β”‚ β”œβ”€β”€ inspect-registration.ts # Lightweight inspection tool registration
1065
1070
  β”‚ β”œβ”€β”€ inspect.ts # First-use side-effect-free metadata inspection
1066
1071
  β”‚ β”œβ”€β”€ consult-registration.ts # Lightweight consultation tool registration
@@ -1077,7 +1082,13 @@ packages/pi-subagents/
1077
1082
  β”‚ β”œβ”€β”€ rpc-turn-capture.ts # RPC evidence capture, usage, and budget events
1078
1083
  β”‚ β”œβ”€β”€ auto-transport.ts # Deterministic preflight transport routing
1079
1084
  β”‚ β”œβ”€β”€ transport-types.ts # Bounded pi-subagents:v1 progress and telemetry contract
1080
- β”‚ β”œβ”€β”€ completion-delivery.ts # Completion batching and optional idle-root wake
1085
+ β”‚ β”œβ”€β”€ completion-delivery.ts # Top-level completion batching and optional idle-root wake
1086
+ β”‚ β”œβ”€β”€ completion-routing.ts # Direct-parent and live-ancestor recipient selection
1087
+ β”‚ β”œβ”€β”€ task-path.ts # Canonical retained-agent task identity and resolution
1088
+ β”‚ β”œβ”€β”€ peer-communication.ts # Session peer routing and authenticated loopback broker
1089
+ β”‚ β”œβ”€β”€ peer-transport.ts # Child transport bridge wiring and ephemeral credentials
1090
+ β”‚ β”œβ”€β”€ child-peer-tools.ts # Child-only peer tools and context acknowledgements
1091
+ β”‚ β”œβ”€β”€ child-peer-bridge.ts # Explicit process-child extension entrypoint
1081
1092
  β”‚ β”œβ”€β”€ admission-policy.ts # Audit-only deterministic delegation admission
1082
1093
  β”‚ β”œβ”€β”€ capability-grant.ts # Generation-bound authority lifetime and revocation
1083
1094
  β”‚ β”œβ”€β”€ execution-plan.ts # Executor-owned authority and resource resolution
@@ -1102,8 +1113,7 @@ packages/pi-subagents/
1102
1113
  β”‚ β”œβ”€β”€ panel-reconciliation.ts # Objection-preserving valid-review barrier
1103
1114
  β”‚ β”œβ”€β”€ panel-child-group.ts # Child signals and disposable-worktree cleanup
1104
1115
  β”‚ β”œβ”€β”€ panel-render.ts # Compact and expanded sanitized panel rows
1105
- β”‚ β”œβ”€β”€ execution-profiles.ts # Provider-neutral thinking profile patches
1106
- β”‚ β”œβ”€β”€ execution-ui.ts # Profile and per-agent execution settings screens
1116
+ β”‚ β”œβ”€β”€ execution-ui.ts # Per-agent execution settings screens
1107
1117
  β”‚ β”œβ”€β”€ stateful-guidance.ts # Detached model-facing workflow guidance
1108
1118
  β”‚ β”œβ”€β”€ stateful-lifecycle.ts # Runtime disposal and spawn ownership guards
1109
1119
  β”‚ β”œβ”€β”€ timeout-finalization.ts # Abort-time bounded summary prompts and deadlines