pi-subagents 0.35.1 → 0.37.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 (89) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +224 -31
  3. package/agents/advisor.md +73 -0
  4. package/agents/delegate.md +2 -0
  5. package/agents/worker.md +2 -0
  6. package/package.json +11 -13
  7. package/skills/pi-subagents/SKILL.md +42 -13
  8. package/src/agents/agent-management.ts +7 -1
  9. package/src/agents/agents.ts +121 -17
  10. package/src/api/capability-ceiling.ts +17 -0
  11. package/src/api/delegation.ts +127 -0
  12. package/src/api/preflight.ts +399 -0
  13. package/src/extension/config.ts +7 -1
  14. package/src/extension/index.ts +52 -38
  15. package/src/extension/rpc.ts +31 -2
  16. package/src/extension/schemas.ts +29 -3
  17. package/src/extension/tool-description.ts +4 -2
  18. package/src/intercom/intercom-bridge.ts +1 -1
  19. package/src/intercom/native-supervisor-channel.ts +45 -6
  20. package/src/intercom/result-intercom.ts +7 -0
  21. package/src/runs/background/async-execution.ts +158 -17
  22. package/src/runs/background/async-job-tracker.ts +4 -0
  23. package/src/runs/background/async-resume.ts +47 -8
  24. package/src/runs/background/async-status.ts +94 -3
  25. package/src/runs/background/chain-append.ts +2 -0
  26. package/src/runs/background/completion-batcher.ts +6 -4
  27. package/src/runs/background/completion-dedupe.ts +2 -11
  28. package/src/runs/background/fleet-view.ts +9 -4
  29. package/src/runs/background/notify.ts +132 -120
  30. package/src/runs/background/process-terminal.ts +280 -0
  31. package/src/runs/background/result-watcher.ts +138 -78
  32. package/src/runs/background/run-status.ts +10 -2
  33. package/src/runs/background/scheduled-runs.ts +6 -1
  34. package/src/runs/background/stale-run-reconciler.ts +6 -0
  35. package/src/runs/background/subagent-runner.ts +406 -54
  36. package/src/runs/background/subagent-wait.ts +130 -4
  37. package/src/runs/background/wait-tool.ts +2 -2
  38. package/src/runs/foreground/chain-execution.ts +181 -111
  39. package/src/runs/foreground/execution.ts +147 -47
  40. package/src/runs/foreground/foreground-control.ts +90 -0
  41. package/src/runs/foreground/subagent-executor.ts +426 -165
  42. package/src/runs/shared/acceptance.ts +94 -41
  43. package/src/runs/shared/agent-contract.ts +38 -0
  44. package/src/runs/shared/capability-ceiling.ts +177 -0
  45. package/src/runs/shared/child-protocol.ts +1 -1
  46. package/src/runs/shared/completion-guard.ts +36 -5
  47. package/src/runs/shared/context-mode.ts +44 -0
  48. package/src/runs/shared/dynamic-fanout.ts +5 -5
  49. package/src/runs/shared/long-running-guard.ts +4 -0
  50. package/src/runs/shared/mcp-direct-tool-allowlist.ts +12 -6
  51. package/src/runs/shared/nested-events.ts +35 -3
  52. package/src/runs/shared/parallel-handoff.ts +154 -0
  53. package/src/runs/shared/parallel-utils.ts +11 -0
  54. package/src/runs/shared/pi-args.ts +148 -56
  55. package/src/runs/shared/run-history.ts +90 -5
  56. package/src/runs/shared/session-lease.ts +25 -5
  57. package/src/runs/shared/structured-output.ts +112 -7
  58. package/src/runs/shared/subagent-control.ts +4 -0
  59. package/src/runs/shared/subagent-prompt-runtime.ts +31 -19
  60. package/src/runs/shared/task-intent.ts +10 -5
  61. package/src/runs/shared/tool-availability.ts +21 -3
  62. package/src/runs/shared/tool-budget.ts +11 -5
  63. package/src/runs/shared/turn-budget.ts +2 -1
  64. package/src/runs/shared/worktree.ts +63 -14
  65. package/src/shared/accessible-dir.ts +25 -0
  66. package/src/shared/artifacts.ts +37 -7
  67. package/src/shared/atomic-json.ts +14 -42
  68. package/src/shared/child-transcript.ts +52 -0
  69. package/src/shared/file-system-retry.ts +47 -0
  70. package/src/shared/launch-contract.ts +123 -0
  71. package/src/shared/settings.ts +9 -1
  72. package/src/shared/types.ts +314 -28
  73. package/src/shared/utils.ts +17 -42
  74. package/src/slash/delegation-adapters.ts +153 -6
  75. package/src/slash/delegation-json.ts +108 -0
  76. package/src/slash/delegation-request.ts +182 -36
  77. package/src/slash/prompt-template-bridge.ts +222 -37
  78. package/src/slash/selector.ts +147 -0
  79. package/src/slash/slash-commands.ts +15 -6
  80. package/src/slash/slash-live-state.ts +2 -2
  81. package/src/slash/subagents-admin.ts +42 -42
  82. package/src/tui/fleet-status.ts +362 -0
  83. package/src/tui/fleet-transcript.ts +472 -0
  84. package/src/tui/fleet.ts +318 -59
  85. package/src/tui/render.ts +17 -15
  86. package/src/watchdog/change-signature.ts +105 -12
  87. package/src/watchdog/review.ts +7 -2
  88. package/src/watchdog/runtime.ts +5 -3
  89. package/src/slash/subagents-editor.ts +0 -86
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: advisor
3
+ description: Compatibility alias for oracle; high-context decision-consistency advisor
4
+ tools: read, grep, find, ls, bash, intercom
5
+ thinking: high
6
+ systemPromptMode: replace
7
+ inheritProjectContext: true
8
+ inheritSkills: false
9
+ defaultContext: fork
10
+ ---
11
+
12
+ You are the advisor, the compatibility alias for oracle: a high-context decision-consistency subagent.
13
+
14
+ Your primary job is to prevent the main agent from making hidden, conflicting, or inconsistent decisions by treating the inherited forked context as the authoritative contract. You are not the primary executor. You do not silently become a second decision-maker.
15
+
16
+ Before you do anything else, reconstruct the key inherited decisions, constraints, and open questions from the forked conversation, codebase state, and task. Those decisions form your baseline contract. Preserve them unless there is strong evidence they should be overturned.
17
+
18
+ If you need clarification from the main agent and runtime bridge instructions are present, use `contact_supervisor` with `reason: "need_decision"` and wait for the reply. Use `reason: "progress_update"` only for concise updates when blocked, explicitly asked for progress, or when a recommendation or concern would benefit from immediate discussion. Keep coordination traffic tight and purposeful. Do not narrate your whole review through `contact_supervisor`.
19
+
20
+ Do not send routine completion handoffs. If no coordination is needed, return the final oracle recommendation normally. Fall back to generic `intercom` only if `contact_supervisor` is unavailable and the runtime bridge instructions identify a safe target.
21
+
22
+ Core responsibilities:
23
+ - reconstruct inherited decisions, constraints, and open questions from the context
24
+ - identify drift between the current trajectory and those inherited decisions
25
+ - surface contradictions and hidden assumptions the main agent may be missing
26
+ - call out when a proposed move conflicts with an earlier decision or constraint
27
+ - protect consistency over novelty; prefer the path that honors existing decisions unless the context clearly supports a pivot
28
+ - when you do recommend a pivot, explain exactly which prior assumption or decision should be revised and why
29
+ - exploit your clean forked context to spot things the main agent may have missed due to context rot, accumulated reasoning, or errors in the original instruction
30
+ - look beyond the explicit question and suggest guidance based on the overall agent trajectory, even when not directly asked
31
+
32
+ What you do not do by default:
33
+ - do not edit files or write code
34
+ - do not propose additional parallel decision-makers or new subagent trees unless explicitly asked
35
+ - do not assume a `worker` implementation handoff is the default outcome
36
+ - do not propose broad pivots unless the context clearly supports them
37
+ - do not continue the user conversation directly
38
+
39
+ Working rules:
40
+ - Use `bash` only for inspection, verification, or read-only analysis.
41
+ - If information is missing and it matters, ask the main agent with `contact_supervisor` and `reason: "need_decision"` instead of guessing.
42
+ - If the answer depends on a decision the main agent has not made yet, stop and ask with `contact_supervisor` before continuing.
43
+ - When bridge instructions are present, send concise coordination messages only when a recommendation, concern, or question would benefit from immediate discussion instead of waiting silently until the final return.
44
+ - Prefer narrow, specific corrections to the current path over rewriting the whole plan.
45
+
46
+ Your output should follow this shape. If no executor handoff is warranted, say so plainly.
47
+
48
+ Inherited decisions:
49
+ - the key decisions, constraints, and assumptions already in play
50
+
51
+ Diagnosis:
52
+ - what is actually going on
53
+ - what the main agent may be missing
54
+
55
+ Drift / contradiction check:
56
+ - where the current trajectory conflicts with inherited decisions or constraints
57
+ - what assumptions have quietly changed
58
+
59
+ Recommendation:
60
+ - the best next move
61
+ - why it is the best move
62
+ - if recommending a pivot, which inherited decision is being revised and why
63
+
64
+ Risks:
65
+ - what could still go wrong
66
+ - what assumptions remain uncertain
67
+
68
+ Need from main agent:
69
+ - specific question or decision required before continuing, if any
70
+
71
+ Suggested execution prompt:
72
+ - a concrete prompt for `worker`, only if an implementation handoff is actually warranted
73
+ - if no handoff is warranted, say so explicitly
@@ -9,4 +9,6 @@ inheritSkills: false
9
9
 
10
10
  You are a delegated agent. Execute the assigned task using the provided tools. Be direct, efficient, and keep the response focused on the requested work.
11
11
 
12
+ The builtin delegate uses a strict tool allowlist and does not inherit ambient extension tools from the parent session. To use an extension tool, configure a custom agent with the tool name explicitly listed in `tools` and load its provider through `extensions` or `subagentOnlyExtensions`.
13
+
12
14
  If runtime bridge instructions identify a safe supervisor target and you are blocked or need a decision, use `contact_supervisor` with `reason: "need_decision"` and stay alive for the reply. Use `reason: "progress_update"` only for meaningful progress or unexpected discoveries that change the plan. Do not send routine completion handoffs; return normally when no coordination is needed.
package/agents/worker.md CHANGED
@@ -17,6 +17,8 @@ You are the single writer thread. Your job is to execute the assigned task or ap
17
17
 
18
18
  Use the provided tools directly. First understand the inherited context, supplied files, plan, and explicit task. Then implement carefully and minimally.
19
19
 
20
+ The builtin worker uses a strict tool allowlist. It does not inherit ambient extension tools from the parent session. To use an extension tool, configure a custom agent with the tool name explicitly listed in `tools` and load its provider through `extensions` or `subagentOnlyExtensions`.
21
+
20
22
  If the task is framed as an approved direction, oracle handoff, or execution plan, treat that direction as the contract. Validate it against the actual code, but do not silently make new product, architecture, or scope decisions.
21
23
 
22
24
  If the implementation reveals a decision that was not approved and is required to continue safely, pause and escalate through the live coordination channel. If runtime bridge instructions are present, use them as the source of truth for which supervisor session to contact and how to coordinate. Use `contact_supervisor` with `reason: "need_decision"` when a new decision is needed, and stay alive to receive the reply before continuing. Use `reason: "progress_update"` only for concise non-blocking progress updates when that extra coordination is helpful or explicitly requested. Fall back to generic `intercom` only if `contact_supervisor` is unavailable. Do not finish your final response with a question that requires the supervisor to choose before you can continue.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-subagents",
3
- "version": "0.35.1",
3
+ "version": "0.37.0",
4
4
  "description": "Pi extension for delegating tasks to subagents with chains, parallel execution, and TUI clarification",
5
5
  "author": "Nico Bailon",
6
6
  "license": "MIT",
@@ -8,7 +8,9 @@
8
8
  "exports": {
9
9
  ".": "./index.ts",
10
10
  "./background-work": "./src/api/background-work.ts",
11
- "./delegation": "./src/api/delegation.ts"
11
+ "./delegation": "./src/api/delegation.ts",
12
+ "./capability-ceiling": "./src/api/capability-ceiling.ts",
13
+ "./preflight": "./src/api/preflight.ts"
12
14
  },
13
15
  "repository": {
14
16
  "type": "git",
@@ -60,10 +62,9 @@
60
62
  },
61
63
  "peerDependencies": {
62
64
  "@earendil-works/pi-agent-core": "*",
63
- "@earendil-works/pi-ai": "*",
65
+ "@earendil-works/pi-ai": ">=0.80.0",
64
66
  "@earendil-works/pi-coding-agent": "*",
65
- "@earendil-works/pi-tui": "*",
66
- "typebox": "*"
67
+ "@earendil-works/pi-tui": "*"
67
68
  },
68
69
  "peerDependenciesMeta": {
69
70
  "@earendil-works/pi-agent-core": {
@@ -77,20 +78,17 @@
77
78
  },
78
79
  "@earendil-works/pi-tui": {
79
80
  "optional": true
80
- },
81
- "typebox": {
82
- "optional": true
83
81
  }
84
82
  },
85
83
  "dependencies": {
86
84
  "jiti": "2.7.0",
85
+ "typebox": "1.1.38",
87
86
  "yaml": "2.8.3"
88
87
  },
89
88
  "devDependencies": {
90
- "@earendil-works/pi-agent-core": "0.80.10",
91
- "@earendil-works/pi-ai": "0.80.10",
92
- "@earendil-works/pi-coding-agent": "0.80.10",
93
- "@earendil-works/pi-tui": "0.80.10",
94
- "typebox": "1.1.38"
89
+ "@earendil-works/pi-agent-core": "0.81.0",
90
+ "@earendil-works/pi-ai": "0.81.0",
91
+ "@earendil-works/pi-coding-agent": "0.81.0",
92
+ "@earendil-works/pi-tui": "0.81.0"
95
93
  }
96
94
  }
@@ -14,6 +14,10 @@ This skill is for the main parent orchestrator only. Do not inject or follow it
14
14
 
15
15
  Use this skill when the parent orchestrator needs to launch a specialized subagent, compose multiple agents into a workflow, or create/edit agents and chains on demand.
16
16
 
17
+ ## Capability ceilings
18
+
19
+ Parent extensions may register a session-scoped, out-of-band ceiling through `pi-subagents/capability-ceiling`. Child tools are intersected with every active registration and inherited snapshot; `denyExtensions` removes ambient/provider extension loading while retaining package protocol runtime. Do not add a model-visible ceiling field or rely on role selection for enforcement. Restricted schedules are rejected until their ceiling can be persisted safely.
20
+
17
21
  ## When to Use
18
22
 
19
23
  - **Complex work orchestration**: use Fable mode as the default parent-agent loop for complex work. 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.
@@ -191,9 +195,20 @@ and user/project agents override builtins with the same name.
191
195
  | `researcher` | Web research brief generator | inherits default | Writes `research.md` |
192
196
  | `delegate` | Lightweight generic delegate | inherits default | No fixed output; generic delegated work |
193
197
  | `oracle` | Decision-consistency advisory review | inherits default | Advisory review, intercom coordination |
198
+ | `advisor` | Claude Code-compatible alias for `oracle` | inherits default | Same advisory role as `oracle` |
194
199
 
195
200
  Builtin agents inherit the current Pi default model unless a run, user setting, project setting, or `subagents.defaultModel` overrides `model`. Set `subagents.defaultModel` when subagents should use a different default model than the parent session. Override builtin defaults before copying full agent files when a small tweak is enough.
196
201
 
202
+ Set `subagents.defaultThinking` to apply a shared thinking level to builtin, package, user, and project agents whose frontmatter leaves `thinking` unset. Project settings win over user settings; explicit frontmatter (including `thinking: false`), `agentOverrides.<name>.thinking`, and per-run overrides remain more specific. This setting affects child agents only and does not change the parent session's default thinking level.
203
+
204
+ ```json
205
+ {
206
+ "subagents": {
207
+ "defaultThinking": "medium"
208
+ }
209
+ }
210
+ ```
211
+
197
212
  For one run, use inline config:
198
213
 
199
214
  ```text
@@ -246,14 +261,16 @@ Direct settings example:
246
261
 
247
262
  Useful override fields: `model`, `fallbackModels`, `thinking`,
248
263
  `systemPromptMode`, `inheritProjectContext`, `inheritSkills`, `defaultContext`,
249
- `acceptanceRole`, `disabled`, `skills`, `tools`, and `systemPrompt`. Use
250
- `acceptanceRole: false` to clear an override. Create a user or project
264
+ `acceptanceRole`, `disabled`, `skills`, `tools`, `extensions`, and `systemPrompt`.
265
+ Use `acceptanceRole: false` to clear an override. Create a user or project
251
266
  agent with the same name only when you want a substantially different agent.
252
267
 
253
268
  If a provider rejects model IDs with thinking suffixes, use
254
269
  `subagents.disableThinking: true` in user or project settings to clear bundled
255
270
  builtin thinking defaults globally. A higher-precedence per-agent `thinking`
256
- override can opt one builtin back in.
271
+ override can opt one builtin back in. Existing custom-agent frontmatter remains authoritative.
272
+
273
+ Set `subagents.defaultExtensions` to give agents without an `extensions` field a shared child extension allowlist. Omit it to preserve ambient extension discovery, set it to `[]` to disable ambient extensions by default, or use `agentOverrides.<name>.extensions` for one agent. Explicit custom-agent frontmatter still wins.
257
274
 
258
275
  Tool description modes live in `~/.pi/agent/extensions/subagent/config.json`, not `subagents` settings. Set `toolDescriptionMode` to `compact` to reduce tool-description prompt cost while keeping the execution, async/`subagent_wait`, child-safety, one-writer, management/action, and artifact/status guardrails. Set it to `custom` to read `subagent-tool-description.md` from the project config dir or agent dir; invalid custom files fall back to full mode and the safety guidance is still appended.
259
276
 
@@ -291,7 +308,8 @@ subagent({
291
308
  ```typescript
292
309
  subagent({
293
310
  agent: "oracle",
294
- task: "Review my current direction and challenge assumptions."
311
+ task: "Review my current direction and challenge assumptions.",
312
+ context: "fork"
295
313
  })
296
314
  ```
297
315
 
@@ -324,7 +342,7 @@ subagent({
324
342
  })
325
343
  ```
326
344
 
327
- Avoid duplicate output paths in parallel tasks. Concurrent children should not write to the same file. For large saved outputs, set `outputMode: "file-only"` together with an `output` path. The parent result then contains only a compact reference like `Output saved to: /abs/report.md (48.2 KB, 2847 lines). Read this file if needed.` instead of the full saved content. Do not use `output: false` for this; `output: false` means no file output. Read-only children return the complete artifact in their final response and the runtime persists it, so missing write tools are not a supervisor blocker. Mutation-capable children still receive direct-write instructions. Failed runs and save errors still return inline details for debugging.
345
+ Avoid duplicate output paths in parallel tasks. Concurrent children should not write to the same file. For large saved outputs, set `outputMode: "file-only"` together with an `output` path. The parent result then contains only a compact reference like `Output saved to: /abs/report.md (48.2 KB, 2847 lines). Read this file if needed.` instead of the full saved content. Do not use `output: false` for this; `output: false` means no file output. In chains, relative `output` paths are chain-artifact paths under `{chain_dir}`, not project CWD paths; use an absolute `output` path or a persistent `chainDir` when a saved artifact must outlive the temp chain directory. Read-only children return the complete artifact in their final response and the runtime persists it, so missing write tools are not a supervisor blocker. Mutation-capable children still receive direct-write instructions. Failed runs and save errors still return inline details for debugging.
328
346
 
329
347
  ### Chain execution
330
348
 
@@ -346,6 +364,13 @@ handoffs or full fan-in summaries. Use `phase` and `label` for status readabilit
346
364
  Use `outputSchema` when later steps need reliable structured data; the child must
347
365
  call `structured_output` with schema-valid JSON, or the step fails.
348
366
 
367
+ Use `agentContract: { version: 1 }` when a caller needs generic result projections
368
+ instead of acceptance or mutation effects rewriting execution success. V1 adds
369
+ `execution`, `acceptance`, `review`, and `effects`; omitted acceptance means no
370
+ acceptance request. Chain steps advance on execution by default under v1. Set
371
+ `gateOn: "acceptance"` only when a rejected explicit acceptance report should stop
372
+ the chain.
373
+
349
374
  ### Async/background
350
375
 
351
376
  Prefer async mode for every subagent launch. Set `async: true` no matter the task unless there is a specific reason to opt into a foreground/blocking run. This applies to scouts, researchers, workers, reviewers, validators, oracle checks, one-off delegates, chains, and parallel groups. Keep the write path single-threaded even when the run is async.
@@ -366,7 +391,7 @@ subagent({
366
391
  })
367
392
  ```
368
393
 
369
- File-only output mode also works for async single runs, top-level parallel task items, sequential chain steps, and chain parallel task items. In chains, `{previous}` receives the compact saved-file reference when the prior step used file-only mode.
394
+ File-only output mode also works for async single runs, top-level parallel task items, sequential chain steps, and chain parallel task items. In chains, `{previous}` receives the compact saved-file reference when the prior step used file-only mode. Relative chain output paths are resolved under `{chain_dir}`; pass a persistent `chainDir` or an absolute `output` path when a later human or process needs a stable path outside the temp chain run.
370
395
 
371
396
  For review fanout where the parent continues a local audit:
372
397
 
@@ -510,8 +535,12 @@ subagent({
510
535
 
511
536
  `worktree: true` gives each parallel task its own git worktree branched from
512
537
  HEAD. This requires a clean git state and is mainly for intentionally parallel
513
- write workflows. If you want one writer thread and several advisory agents,
514
- prefer a single-writer pattern instead.
538
+ write workflows. On completion, use the `parallelHandoff.path` returned in
539
+ foreground details or async status/results instead of scraping the combined
540
+ text. Its versioned manifest records child status and output references, full
541
+ patch paths and stats, and whether each temporary worktree and branch was
542
+ removed. If you want one writer thread and several advisory agents, prefer a
543
+ single-writer pattern instead.
515
544
 
516
545
  ## The Oracle Workflow
517
546
 
@@ -722,15 +751,15 @@ Additional user prompt templates can delegate into `pi-subagents` through the na
722
751
 
723
752
  ## Extension RPC
724
753
 
725
- Other Pi extensions can call `pi-subagents` through the in-process event bus. The stable v1 channels are `subagents:rpc:v1:ready`, `subagents:rpc:v1:request`, and per-request replies at `subagents:rpc:v1:reply:<requestId>`. Envelopes use `{ version: 1, requestId, method, params }`, and replies use `{ version: 1, requestId, success, data | error }`.
754
+ Other Pi extensions can call `pi-subagents` through the in-process event bus. The stable v1 channels are `subagents:rpc:v1:ready`, `subagents:rpc:v1:request`, and per-request replies at `subagents:rpc:v1:reply:<requestId>`. Envelopes use `{ version: 1, requestId, method, params }`, and replies use `{ version: 1, requestId, success, data | error }`. `ping` advertises the exact process-local async completion event as `events.asyncComplete` for RPC-spawn consumers.
726
755
 
727
- Methods: `ping`, `status`, `spawn`, `interrupt`, and `stop`. `spawn` is async-only and rejects management actions, `async: false`, or `clarify: true`; it reuses the normal executor, so discovery, validation, session attribution, configured spawn caps, child-safety depth, artifacts, and async status are shared with the `subagent` tool. `status` and `interrupt` map to the normal control actions. `stop` targets running async runs through the existing timeout control channel. `pi.events` is process-local, so separate Pi processes and child subagents need lifecycle artifact files or `pi-intercom` instead.
756
+ Methods: `ping`, `status`, `spawn`, `steer`, `interrupt`, and `stop`. `spawn` is async-only and rejects management actions, `async: false`, or `clarify: true`; it reuses the normal executor, so discovery, validation, session attribution, configured spawn caps, child-safety depth, artifacts, and async status are shared with the `subagent` tool. `status`, acknowledged async `steer`, and `interrupt` map to the normal control actions. RPC steer disables pause-and-revive recovery and advertises `capabilities.nonRecoveringSteer`, preserving the caller's authority over the exact spawned child. `stop` targets running async runs through the existing timeout control channel. `pi.events` is process-local, so separate Pi processes and child subagents need lifecycle artifact files or `pi-intercom` instead.
728
757
 
729
758
  ## Important Constraints
730
759
 
731
760
  - **Forking requires a persisted parent session.** If the current session does not
732
761
  have a persisted session file, forked runs fail. Packaged `planner`, `worker`,
733
- and `oracle` default to forked context, so use `context: "fresh"` explicitly
762
+ `oracle`, and `advisor` default to forked context, so use `context: "fresh"` explicitly
734
763
  when that is not available or not wanted.
735
764
  - **Forked runs inherit parent history.** They are branched threads, not fresh
736
765
  filtered contexts. Use fresh context for adversarial reviewers unless the user explicitly asks for forked context.
@@ -827,7 +856,7 @@ Run the work through seven gated phases:
827
856
 
828
857
  For straightforward non-trivial work, this sequence is the lightweight version of the parent-owned loop. When the task is complex, use Fable mode above. In either case, factor in the packaged prompt workflows without literally invoking slash commands. Use the same patterns through tools and subagents.
829
858
 
830
- Keep builtin agent defaults unless the user explicitly asks for a different model, thinking level, skills, output behavior, context mode, or other override. Do not add overrides just because you are orchestrating; the defaults encode the intended role behavior. In particular, packaged `planner`, `worker`, and `oracle` default to forked context.
859
+ Keep builtin agent defaults unless the user explicitly asks for a different model, thinking level, skills, output behavior, context mode, or other override. Do not add overrides just because you are orchestrating; the defaults encode the intended role behavior. In particular, packaged `planner`, `worker`, `oracle`, and `advisor` default to forked context.
831
860
 
832
861
  When the user approves launching a subagent to carry out a plan or workflow, treat that as approval to generate a proper role-specific meta prompt for that subagent. Include the approved plan path or summary, clarified requirements, non-goals, relevant context, role boundaries, files or areas to inspect, acceptance criteria, expected output, and validation expectations. Do not pass vague instructions like “implement the plan fully” or “review this” by themselves.
833
862
 
@@ -847,7 +876,7 @@ clarify → validation contract → planner → async worker → parallel async
847
876
 
848
877
  The validation contract defines acceptance before code is written: expected behavior, acceptance checks, commands or user flows to exercise, and evidence the worker should return. Keep it lightweight for small tasks, but make it explicit enough that reviewers and validators are checking the intended outcome rather than the worker’s own assumptions.
849
878
 
850
- Use the structured `acceptance` field when the run should carry an explicit acceptance contract. If omitted, subagents infer an effective acceptance policy from role, mode, and risk. Use `level: "checked"` for ordinary writer evidence gates and `level: "verified"` when the runtime should run explicit validation commands. Do not explicitly request `level: "reviewed"`: the current run cannot supply an independent reviewer result, so that level is reserved for inferred policy. Orchestrate a separate reviewer instead. To disable gates, use `{ level: "none", reason: "..." }`; the bare string `"none"` is rejected, and `false` is accepted only as a deprecated shorthand. Do not call a run reviewed just because the worker says it is done; reviewed means a reviewer gate returned a result. Child-reported command success is evidence, not runtime verification.
879
+ Use the structured `acceptance` field when the run should carry an explicit acceptance contract. If omitted, subagents infer an effective policy from role, mode, and risk. Evidence levels end at `verified`: 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" }` and orchestrate the reviewer separately. `review-required` means evidence passed but review is pending, while `reviewed` means a real independent result found no blockers. For reviewer/read-only calls, omit `acceptance`. Never explicitly request `level: "reviewed"`; that value remains recognized only so preflight can return an actionable correction. To disable gates, use `{ level: "none", reason: "..." }`; the bare string `"none"` is rejected, and `false` is accepted only as a deprecated shorthand. Child-reported command success is evidence, not runtime verification.
851
880
 
852
881
  The first `worker` implements the approved plan. The parent continues with independent inspection or validation prep while it runs, not parallel edits to the same worktree. When the async worker completes, treat its handoff as the transition into review, not as final completion, unless the user explicitly asked for worker-only work, review-only output, or to stop after implementation. Parallel reviewers inspect the resulting diff from fresh context. Validators check behavior with the best available evidence: commands, tests, browser/CLI interaction, screenshots, logs, or manual reproduction notes. The final `worker` applies synthesized review fixes in forked context, then the parent looks over the final diff before completing. The parent may launch these steps as an initial async chain when the workflow is already clear, or as follow-up subagent runs after each async completion. Initial chains should pass `async: true` so the main chat is unblocked; avoid `clarify: true` unless the user asked for foreground clarification. Do not stop after parallel review unless the user explicitly asked for review-only output or the review surfaced a decision that needs approval first.
853
882
 
@@ -203,7 +203,12 @@ function skillsWarning(cwd: string, agent: Pick<AgentConfig, "skills" | "skillPa
203
203
 
204
204
  export function editableAgentConfig(agent: AgentConfig): AgentConfig {
205
205
  const base = agent.override?.base;
206
- if (!base) return { ...agent };
206
+ if (!base) {
207
+ return {
208
+ ...agent,
209
+ extensions: agent.extensionsFromDefault ? undefined : agent.extensions ? [...agent.extensions] : undefined,
210
+ };
211
+ }
207
212
 
208
213
  return {
209
214
  ...agent,
@@ -221,6 +226,7 @@ export function editableAgentConfig(agent: AgentConfig): AgentConfig {
221
226
  skillPath: base.skillPath ? [...base.skillPath] : undefined,
222
227
  tools: base.tools ? [...base.tools] : undefined,
223
228
  mcpDirectTools: base.mcpDirectTools ? [...base.mcpDirectTools] : undefined,
229
+ extensions: base.extensions ? [...base.extensions] : undefined,
224
230
  subagentOnlyExtensions: base.subagentOnlyExtensions ? [...base.subagentOnlyExtensions] : undefined,
225
231
  completionGuard: base.completionGuard,
226
232
  override: undefined,