pi-subagents 0.36.0 → 0.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +111 -16
  3. package/agents/delegate.md +2 -0
  4. package/agents/planner.md +2 -1
  5. package/agents/worker.md +2 -0
  6. package/package.json +6 -4
  7. package/skills/pi-subagents/SKILL.md +18 -973
  8. package/skills/pi-subagents/references/constraints-and-recipes.md +256 -0
  9. package/skills/pi-subagents/references/execution-controls.md +411 -0
  10. package/skills/pi-subagents/references/management-authoring-rpc.md +140 -0
  11. package/skills/pi-subagents/references/prompting-and-roles.md +268 -0
  12. package/src/agents/agent-management.ts +7 -1
  13. package/src/agents/agents.ts +99 -12
  14. package/src/api/capability-ceiling.ts +17 -0
  15. package/src/api/delegation.ts +6 -1
  16. package/src/api/preflight.ts +399 -0
  17. package/src/extension/index.ts +16 -7
  18. package/src/extension/rpc.ts +29 -2
  19. package/src/extension/schemas.ts +10 -4
  20. package/src/extension/tool-description.ts +4 -2
  21. package/src/intercom/intercom-bridge.ts +5 -2
  22. package/src/runs/background/async-execution.ts +125 -14
  23. package/src/runs/background/async-job-tracker.ts +19 -12
  24. package/src/runs/background/async-resume.ts +27 -9
  25. package/src/runs/background/async-status.ts +18 -0
  26. package/src/runs/background/notify.ts +3 -0
  27. package/src/runs/background/process-terminal.ts +280 -0
  28. package/src/runs/background/result-watcher.ts +9 -3
  29. package/src/runs/background/run-status.ts +7 -1
  30. package/src/runs/background/scheduled-runs.ts +6 -1
  31. package/src/runs/background/stale-run-reconciler.ts +6 -0
  32. package/src/runs/background/subagent-runner.ts +182 -12
  33. package/src/runs/foreground/chain-execution.ts +5 -0
  34. package/src/runs/foreground/execution.ts +59 -13
  35. package/src/runs/foreground/subagent-executor.ts +142 -47
  36. package/src/runs/shared/acceptance.ts +41 -30
  37. package/src/runs/shared/capability-ceiling.ts +177 -0
  38. package/src/runs/shared/dynamic-fanout.ts +1 -1
  39. package/src/runs/shared/mcp-direct-tool-allowlist.ts +56 -17
  40. package/src/runs/shared/model-fallback.ts +8 -0
  41. package/src/runs/shared/nested-events.ts +8 -1
  42. package/src/runs/shared/parallel-utils.ts +5 -0
  43. package/src/runs/shared/pi-args.ts +141 -58
  44. package/src/runs/shared/session-lease.ts +25 -5
  45. package/src/runs/shared/subagent-prompt-runtime.ts +14 -1
  46. package/src/runs/shared/task-intent.ts +1 -1
  47. package/src/runs/shared/tool-availability.ts +18 -2
  48. package/src/shared/launch-contract.ts +123 -0
  49. package/src/shared/types.ts +118 -8
  50. package/src/shared/utils.ts +17 -42
  51. package/src/slash/delegation-adapters.ts +6 -1
  52. package/src/slash/slash-commands.ts +1 -1
  53. package/src/tui/fleet-status.ts +62 -16
  54. package/src/tui/fleet.ts +1 -1
@@ -0,0 +1,268 @@
1
+ # Pi Subagents: Prompting And Roles
2
+
3
+ This file is a detailed reference loaded from `skills/pi-subagents/SKILL.md`.
4
+
5
+ ## Capability ceilings
6
+
7
+ 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.
8
+
9
+ ## When to Use
10
+
11
+ - **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.
12
+ - **Advisory review**: use fresh-context `reviewer` agents for adversarial code review, or fork to `oracle` when inherited decisions and drift matter
13
+ - **Implementation handoff**: have `oracle` advise, then `worker` implement only after an approved direction
14
+ - **Recon and planning**: use `scout` or `context-builder`, then `planner`
15
+ - **Parallel exploration**: run multiple non-conflicting tasks concurrently
16
+ - **Regular skill specialists**: when discovery shows proactive skill subagent suggestions and the current work is broad enough, launch a small fresh-context fanout that asks one subagent per relevant regularly used skill to apply that skill's perspective to the task
17
+ - **Long-running work**: launch async/background runs and inspect them later. For mutation-capable work, bound the delivery slice and elapsed runtime, then request checkpoints after active tool work returns. Reserve hard turn and tool-call caps for explicitly read-only children.
18
+ - **Subagent control**: watch needs-attention signals and soft-interrupt only when a delegated run is genuinely blocked
19
+ - **Agent authoring**: create, update, or override agents and chains for a project
20
+
21
+ ## Tool vs Slash Commands
22
+
23
+ Agents can use the `subagent(...)` tool directly for execution, management, status, and control.
24
+ Humans often use the slash-command layer instead:
25
+
26
+ - `/run` — launch a single agent
27
+ - `/chain` — launch a chain of steps
28
+ - `/parallel` — launch top-level parallel tasks
29
+ - `/run-chain` — launch a saved `.chain.md` or `.chain.json` workflow
30
+ - `/subagents` — interactive admin for inspecting agents and editing model, thinking, or system prompt
31
+ - `/subagents-stop [run-id]` — stop a current-session top-level async run; opens a selector when no id is given
32
+ - `/subagent-cost` — show parent plus child token usage and cost for the session
33
+ - `/subagents-fleet` — open the live, inspection-only foreground/async fleet; `Ctrl+Alt+F` opens it during an active foreground turn, `↑↓`/`jk` selects children, and `PgUp`/`PgDn` scrolls transcript detail
34
+ - `/subagents-watchdog` — inspect or configure the opt-in adversarial change watchdog (model, on/off, recommend-model, check)
35
+ - `/subagents-doctor` — diagnose setup, discovery, async paths, and intercom bridge state
36
+ - `/subagents-models [agent]` — show the live runtime-loaded builtin model mapping
37
+ - `/subagents-profiles`, `/subagents-load-profile`, `/subagents-refresh-provider-models`, `/subagents-generate-profiles`, `/subagents-check-profile` — manage model profiles and provider catalogs
38
+ - `/prompt-workflow` and `/chain-prompts` — run prompt templates through native subagent single/chain workflows
39
+
40
+ Prefer the tool when you are writing agent logic. Prefer the slash commands when
41
+ you are guiding a human through an interactive flow.
42
+
43
+ Packaged prompt shortcuts are also available for repeatable workflows. Treat them as reusable orchestration recipes, not just human slash commands. When the user asks for one of these shapes, or when the workflow clearly fits, apply the same pattern directly with `subagent(...)` and other tools:
44
+ - `/parallel-review` — fresh-context reviewers with distinct review angles, then synthesis
45
+ - `/review-loop` — parent-orchestrated worker, fresh-reviewer, and fix-worker cycles until clean or capped
46
+ - `/parallel-research` — combine `researcher` and `scout` for external evidence plus local code context
47
+ - `/parallel-context-build` — parallel `context-builder` passes that produce planning handoff context and meta-prompts
48
+ - `/parallel-handoff-plan` — external-reference research plus local `context-builder` passes, followed by a synthesis handoff plan and implementation-ready meta-prompt
49
+ - `/gather-context-and-clarify` — scout/research first, then ask the user clarifying questions with `interview`
50
+ - `/parallel-cleanup` — two fresh-context reviewers (deslop + verbosity passes) for an adversarial cleanup review of the current diff
51
+
52
+ ## Applying Prompt Techniques Without Slash Commands
53
+
54
+ The prompt templates in `prompts/` encode workflows the parent agent can run on demand. If the user provides a URL, issue, PR, plan, local file, screenshot, or freeform target, treat that target as the primary scope: read or fetch it before launching children, then include it explicitly in every child task. Do not depend on the parent conversation history when the recipe calls for fresh context.
55
+
56
+ ### Parallel review technique
57
+
58
+ Use this when the user wants adversarial review of a diff, plan, issue, file, or implemented work. Launch fresh-context `reviewer` agents with distinct angles generated from the actual target. Common angles are correctness/regressions, tests/validation, and simplicity/maintainability; adapt for TypeScript, UI, security, docs, or large structural changes. Reviewers should inspect files and diffs directly, return concise evidence-backed findings with file/line references, and avoid edits unless the user explicitly asks for a writer pass. The parent synthesizes fixes worth doing now, optional improvements, and feedback to ignore/defer before applying anything.
59
+
60
+ ### Proactive skill-specialist technique
61
+
62
+ Use this when `{ action: "list" }` reports proactive skill subagent suggestions and the user's task would benefit from perspectives the parent regularly uses. These suggestions are conservative: a skill is recommended only when it is available and referenced repeatedly by configured agents or saved chains. Treat the list as an opt-in hint for the current task, not a command to always fan out.
63
+
64
+ Default guardrails:
65
+ - Keep the fanout small: usually one or two skill-specialist children, never more than the listed recommendations or configured cap.
66
+ - Prefer `context: "fresh"` and include only the files, diff, plan, URL, or request details each child needs. Use forked context only when private/session history is essential and appropriate to share.
67
+ - Use read-only agents for analysis/review unless implementation was explicitly requested; do not create several writers in the same worktree.
68
+ - Skip proactive skill subagents for tiny questions, direct commands, highly private requests, or when the user asks not to delegate.
69
+ - Make cost and concurrency visible by using an ordinary `subagent(...)` call rather than hidden/background automation.
70
+
71
+ Example shape:
72
+
73
+ ```typescript
74
+ subagent({
75
+ tasks: [
76
+ { agent: "reviewer", task: "Apply the available 'deslop' skill to review the current diff for concrete cleanup findings only. Do not modify files.", skill: "deslop" },
77
+ { agent: "reviewer", task: "Apply the available 'accessibility' skill to review the UI changes for concrete issues only. Do not modify files.", skill: "accessibility" }
78
+ ],
79
+ context: "fresh",
80
+ concurrency: 2
81
+ })
82
+ ```
83
+
84
+ ### Review-loop technique
85
+
86
+ Use this when the user wants implementation or current diff review to continue until reviewers stop finding fixes worth doing now. Keep the loop in the parent session: one async `worker` implements or fixes, fresh-context `reviewer` agents inspect the actual repo and diff, the parent synthesizes accepted fixes, and one async forked `worker` applies them. The parent can express the sequence up front as an async/background chain when the workflow is known, or continue with explicit follow-up subagent runs after each async completion. For an initial chain, pass `async: true` so the main chat is unblocked; do not set `clarify: true` unless the user explicitly wants the foreground clarify UI. Treat an async implementation worker handoff as an intermediate state, not final completion, unless the user explicitly asked for worker-only work, review-only output, or to stop after implementation. Stop when reviewers find no blockers or fixes worth doing now, remaining feedback is optional or deferred, an unapproved product/scope/architecture decision appears, or the max review-round cap is reached. Default to 3 review rounds unless the user sets a different cap. Do not loop for optional polish, and do not let children launch subagents or decide the loop outcome.
87
+
88
+ As a conservative orchestration policy, do not pass `turnBudget` or a hard `toolBudget` to an implementation worker, fix worker, reviewer with edit authority, or other mutation-capable child. The default tool budget blocks read/search tools rather than mutation tools, but count limits still do not measure delivery safety. Use a narrow task plus an outer elapsed deadline with enough margin, then request a checkpoint after the current tool returns. The checkpoint should report changed files, build/test state, remaining work, and commit or PR state. An elapsed timeout is not a mutation-safe boundary and must not be used as the checkpoint trigger.
89
+
90
+ ### Parallel research technique
91
+
92
+ Use this when the question needs both external evidence and local implications. Combine `researcher` for official docs, specs, ecosystem behavior, recent changes, benchmarks, and primary sources with `scout` for repository files, patterns, constraints, tests, and likely integration points. Give each child a distinct angle: external evidence, local code context, and practical tradeoffs. Ask for source links or file ranges, confidence level, gaps, and decision implications. Do not ask these children to edit unless implementation was explicitly requested.
93
+
94
+ ### Parallel context-build technique
95
+
96
+ Use this before planning or implementation when a stronger handoff is needed. Run a chain with one parallel step of `context-builder` agents rather than top-level parallel tasks, so relative output files live under the temporary chain directory. Give every task a distinct output path such as `context-build/request-and-scope.md`, `context-build/codebase-and-patterns.md`, and `context-build/validation-and-risks.md`. Choose two or three builders: request/scope, codebase/patterns, and validation/risks. Each builder must read every relevant file needed to understand its slice, follow imports/callers/tests/docs/config, conduct tool-available web research when needed, and include a compact `meta-prompt` section. The parent synthesizes the outputs into important context, recommended next meta-prompt, open questions, assumptions, and artifact paths.
97
+
98
+ Example shape:
99
+
100
+ ```typescript
101
+ subagent({
102
+ chain: [{
103
+ parallel: [
104
+ { agent: "context-builder", task: "Build request/scope context for: ...", output: "context-build/request-and-scope.md" },
105
+ { agent: "context-builder", task: "Build codebase/pattern context for: ...", output: "context-build/codebase-and-patterns.md" },
106
+ { agent: "context-builder", task: "Build validation/risk context for: ...", output: "context-build/validation-and-risks.md" }
107
+ ]
108
+ }],
109
+ context: "fresh"
110
+ })
111
+ ```
112
+
113
+ ### Parallel handoff-plan technique
114
+
115
+ Use this when the user needs a solution brief or implementation-ready handoff from an external reference plus local code context, such as “study this library behavior, inspect our codebase, then produce a worker prompt.” Run a chain with a first parallel group and a second synthesis `context-builder` step. The first group usually includes `researcher` for external projects/docs/prompt guidance and `context-builder` for local code context; add a second `context-builder` for implementation strategy only when the scope is large enough to benefit. Use distinct output paths under `handoff/`, then have the synthesis `context-builder` read those outputs and write `handoff/final-handoff-plan.md` with the recommended approach, likely files, constraints, non-goals, validation, risks, unresolved questions, and final compact implementation-ready meta-prompt.
116
+
117
+ Example shape:
118
+
119
+ ```typescript
120
+ subagent({
121
+ chain: [
122
+ { parallel: [
123
+ { agent: "researcher", task: "Research the external reference and transferable implementation ideas for: ...", output: "handoff/external-reference.md" },
124
+ { agent: "context-builder", task: "Build local codebase context for: ...", output: "handoff/local-context.md" },
125
+ { agent: "context-builder", task: "Compare evidence and propose implementation strategy for: ...", output: "handoff/implementation-strategy.md" }
126
+ ] },
127
+ { agent: "context-builder", task: "Read {previous} and synthesize the final handoff plan and implementation-ready meta-prompt.", output: "handoff/final-handoff-plan.md" }
128
+ ],
129
+ context: "fresh"
130
+ })
131
+ ```
132
+
133
+ ### Gather-context-and-clarify technique
134
+
135
+ Use this at the start of non-trivial work. Launch `scout` for local context and `researcher` only when external docs, recent sources, ecosystem context, or primary evidence would materially improve understanding. Ask children for concise findings plus remaining clarification questions. Then synthesize what is known and use `interview` to ask the unresolved questions needed for shared understanding before planning or implementing.
136
+
137
+ ### Parallel cleanup technique
138
+
139
+ Use this after implementation when the user wants cleanup review or when a final pass would reduce AI-slop. Launch two fresh-context `reviewer` tasks with `output: false` and `progress: false`: one deslop pass and one verbosity pass. If the `deslop` or `verbosity-cleaner` skills are available, pass the relevant skill to that reviewer; otherwise inline the criteria. Both reviewers are review-only and should flag concrete issues with severity, file/line references, and smallest safe fixes. Phrase the constraint as “Do not modify project/source files; returning findings through the configured output artifact is allowed” when you use `output` or `outputMode: "file-only"`. The parent decides what to apply and asks before making changes unless cleanup was already authorized.
140
+
141
+ ### Staged fix orchestration technique
142
+
143
+ Use this when a broad diff has known reviewer findings across several items and the user wants the parent to “orchestrate subagents like a boss.” Keep the active worktree safe with a three-stage chain:
144
+
145
+ 1. A parallel read-only planning fanout, one planner/reviewer per issue cluster. Each child inspects the real diff and returns exact files, line refs, proposed fixes, and focused validation. They must not edit.
146
+ 2. One writer worker. It receives the planner summaries through `{previous}`, the parent’s accepted scope, stop rules, and verification contract. It is the only child allowed to edit the active worktree.
147
+ 3. A parallel read-only validation fanout. Validators inspect the worker diff from fresh context with distinct angles, report pass/fail, remaining blockers, and missing verification.
148
+
149
+ Prefer `async: true`, `context: "fresh"` for planners/validators, `outputMode: "file-only"` for large summaries, and per-stage output names that will not collide. Add `phase` and `label` to make async status readable, and use `as` plus `{outputs.name}` when a later step needs a specific earlier result instead of the whole `{previous}` blob. Use this pattern instead of launching several writer workers into a dirty worktree. Include non-blocking suggestions in the writer prompt only when they are small, safe, and do not expand product scope; otherwise record them as deferred.
150
+
151
+ When the first step can return a structured target list, prefer dynamic fanout instead of hand-authoring a static parallel group. Use `outputSchema` and `as` on the producer, then an `expand` step with `from: { output, path }`, an explicit `maxItems`, one `parallel` child template, and `collect.as`. Item templates may use `{item}` or a named item such as `{target.path}`. Do not use dynamic fanout for prose outputs, nested fanout, dynamic agent selection, reducers, `when` conditions, or arbitrary expressions; `.chain.md` does not support this syntax, so use direct JSON or a saved `.chain.json`.
152
+
153
+ Example shape:
154
+
155
+ ```typescript
156
+ subagent({
157
+ async: true,
158
+ context: "fresh",
159
+ chain: [
160
+ { parallel: [
161
+ { agent: "reviewer", phase: "Planning", label: "Deploy docs", as: "deployPlan", task: "Plan fixes for deploy docs/workflow. Inspect the current diff. Do not modify project/source files; returning findings via the configured output artifact is allowed.", output: "plans/deploy.md", outputMode: "file-only" },
162
+ { agent: "reviewer", phase: "Planning", label: "Scheduler contract", as: "schedulerPlan", task: "Plan fixes for scheduler contract. Inspect the current diff. Do not modify project/source files; returning findings via the configured output artifact is allowed.", output: "plans/scheduler.md", outputMode: "file-only" },
163
+ { agent: "reviewer", phase: "Planning", label: "Sandbox/security", as: "sandboxPlan", task: "Plan fixes for sandbox/security. Inspect the current diff. Do not modify project/source files; returning findings via the configured output artifact is allowed.", output: "plans/sandbox.md", outputMode: "file-only" }
164
+ ], concurrency: 3 },
165
+ { agent: "worker", phase: "Implementation", label: "Apply accepted fixes", as: "workerResult", task: "Apply only the accepted fixes from these planning summaries. You are the sole writer for the active worktree. Run focused validation and report changed files, commands, failures, and remaining issues.\n\nDeploy plan:\n{outputs.deployPlan}\n\nScheduler plan:\n{outputs.schedulerPlan}\n\nSandbox plan:\n{outputs.sandboxPlan}", output: "worker/fixes.md", outputMode: "file-only", progress: true },
166
+ { parallel: [
167
+ { agent: "reviewer", phase: "Validation", label: "Deploy/scheduler validation", task: "Validate the post-worker diff for deploy and scheduler fixes. Start from the worker result: {outputs.workerResult}. Do not modify project/source files; returning findings via the configured output artifact is allowed.", output: "validation/deploy-scheduler.md", outputMode: "file-only" },
168
+ { agent: "reviewer", phase: "Validation", label: "Sandbox validation", task: "Validate the post-worker diff for sandbox/security fixes. Start from the worker result: {outputs.workerResult}. Do not modify project/source files; returning findings via the configured output artifact is allowed.", output: "validation/sandbox.md", outputMode: "file-only" }
169
+ ], concurrency: 2 }
170
+ ]
171
+ })
172
+ ```
173
+
174
+ ## Builtin Agents
175
+
176
+ Builtin agents load at the lowest priority. Project agents override user agents,
177
+ and user/project agents override builtins with the same name.
178
+
179
+ | Agent | Purpose | Model | Typical output / role |
180
+ |-------|---------|-------|------------------------|
181
+ | `scout` | Fast codebase recon | inherits default | Writes `context.md` handoff material |
182
+ | `planner` | Creates implementation plans | inherits default | Writes `plan.md` |
183
+ | `worker` | Implementation and approved oracle handoffs | inherits default | Single-writer implementation with decision escalation |
184
+ | `reviewer` | Review specialist | inherits default | Default recipes are review-only; tools include edit/write when a fix pass is explicit |
185
+ | `context-builder` | Requirements/codebase handoff builder | inherits default | Writes structured context files |
186
+ | `researcher` | Web research brief generator | inherits default | Writes `research.md` |
187
+ | `delegate` | Lightweight generic delegate | inherits default | No fixed output; generic delegated work |
188
+ | `oracle` | Decision-consistency advisory review | inherits default | Advisory review, intercom coordination |
189
+ | `advisor` | Claude Code-compatible alias for `oracle` | inherits default | Same advisory role as `oracle` |
190
+
191
+ Builtin `worker` and `delegate` use strict tool allowlists and do not inherit ambient parent extension tools. To give a child an extension tool, name it in `tools` and load its provider via `extensions`, a path-like `tools` entry, or `subagentOnlyExtensions`. Custom agents without an `extensions` field follow `subagents.defaultExtensions` when set.
192
+
193
+ 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.
194
+
195
+ 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.
196
+
197
+ ```json
198
+ {
199
+ "subagents": {
200
+ "defaultThinking": "medium"
201
+ }
202
+ }
203
+ ```
204
+
205
+ For one run, use inline config:
206
+
207
+ ```text
208
+ /run reviewer[model=anthropic/claude-sonnet-4] "Review this diff"
209
+ ```
210
+
211
+ For persistent tweaks, edit `subagents.agentOverrides` in user or project settings. User overrides apply everywhere. Project overrides apply only in that repo and win over user overrides. Use `/subagents-models` or `subagent({ action: "models" })` to inspect the live mapping after settings and overrides load.
212
+
213
+ Model ids do not have to be exact. Separator variations (`claude-haiku-4.5` vs `claude-haiku-4-5`), case (`Claude-Sonnet-4`), and optional trailing date stamps (`claude-haiku-4-5-20251001`) all resolve to the same registry model. Exact `provider/id` wins; a qualified `provider/model` never switches providers. To constrain subagents to a budget or compliance profile, set `subagents.modelScope: { enforce: true, allow: ["anthropic/*", "openai/gpt-5-*"] }` in user or project settings. Out-of-scope models you pass explicitly error and abort; models inherited from frontmatter, `subagents.defaultModel`, agent frontmatter, or the parent session only warn.
214
+
215
+ For model fleets, use the profile commands instead of hand-editing repeated overrides: `/subagents-refresh-provider-models <provider>`, `/subagents-generate-profiles <provider>`, `/subagents-load-profile <name>`, and `/subagents-check-profile <name>`. Profiles live under `~/.pi/agent/profiles/pi-subagents/` and replace only `settings.subagents` when loaded.
216
+
217
+ ## Prompting role subagents
218
+
219
+ Builtin role agents inherit the current Pi default model unless you override them. When launching them, write the task prompt as a compact contract, not a long procedural script. Define the destination and let the role choose the efficient path.
220
+
221
+ A strong subagent prompt usually includes:
222
+ - **Goal**: the concrete outcome the child should produce.
223
+ - **Context/evidence**: relevant plan paths, files, diffs, decisions, or user constraints already approved.
224
+ - **Success criteria**: what must be true before the child can finish.
225
+ - **Hard constraints**: true invariants only, such as no edits for review-only tasks, one writer thread, child must not run subagents unless it is an explicitly assigned `tools: subagent` fanout child, or escalation for unapproved decisions.
226
+ - **Validation**: targeted checks to run, or the next-best check when validation is impossible.
227
+ - **Output**: the expected summary shape, artifact path, or finding format.
228
+ - **Stop rules**: when to ask via `intercom`, when to stop after enough evidence, and when not to keep searching.
229
+
230
+ Avoid carrying over old prompt habits that over-specify every step. Use `must`, `always`, and `never` for real invariants; for judgment calls, give decision rules. For example, tell a reviewer to inspect the staged diff directly and report only evidence-backed findings, rather than prescribing every file or command. Tell a researcher the retrieval budget: start with broad targeted searches, fetch only the strongest sources, search again only when a required fact is missing, then stop.
231
+
232
+ For implementation handoffs, name the approved scope and success criteria more clearly than the process. Good prompts say what to change, what not to change, where the evidence lives, how to validate, and when to escalate. They should not ask the child to create another subagent plan or continue the parent conversation.
233
+
234
+ Settings locations:
235
+ - User scope: `~/.pi/agent/settings.json`
236
+ - Project scope: `.pi/settings.json`
237
+
238
+ Direct settings example:
239
+
240
+ ```json
241
+ {
242
+ "subagents": {
243
+ "agentOverrides": {
244
+ "reviewer": {
245
+ "model": "anthropic/claude-sonnet-4",
246
+ "thinking": "high",
247
+ "fallbackModels": ["openai/gpt-5-mini"],
248
+ "acceptanceRole": "read-only"
249
+ }
250
+ }
251
+ }
252
+ }
253
+ ```
254
+
255
+ Useful override fields: `model`, `fallbackModels`, `thinking`,
256
+ `systemPromptMode`, `inheritProjectContext`, `inheritSkills`, `defaultContext`,
257
+ `acceptanceRole`, `disabled`, `skills`, `tools`, `extensions`, and `systemPrompt`.
258
+ Use `acceptanceRole: false` to clear an override. Create a user or project
259
+ agent with the same name only when you want a substantially different agent.
260
+
261
+ If a provider rejects model IDs with thinking suffixes, use
262
+ `subagents.disableThinking: true` in user or project settings to clear bundled
263
+ builtin thinking defaults globally. A higher-precedence per-agent `thinking`
264
+ override can opt one builtin back in. Existing custom-agent frontmatter remains authoritative.
265
+
266
+ 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.
267
+
268
+ 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.
@@ -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,
@@ -73,6 +73,7 @@ export interface BuiltinAgentOverrideBase {
73
73
  skillPath?: string[];
74
74
  tools?: string[];
75
75
  mcpDirectTools?: string[];
76
+ extensions?: string[];
76
77
  subagentOnlyExtensions?: string[];
77
78
  completionGuard?: boolean;
78
79
  toolBudget?: ToolBudgetConfig;
@@ -91,6 +92,7 @@ interface BuiltinAgentOverrideConfig {
91
92
  systemPrompt?: string;
92
93
  skills?: string[] | false;
93
94
  tools?: string[] | false;
95
+ extensions?: string[] | false;
94
96
  subagentOnlyExtensions?: string[] | false;
95
97
  completionGuard?: boolean;
96
98
  toolBudget?: ToolBudgetConfig | false;
@@ -134,6 +136,7 @@ export interface AgentConfig {
134
136
  skills?: string[];
135
137
  skillPath?: string[];
136
138
  extensions?: string[];
139
+ extensionsFromDefault?: boolean;
137
140
  subagentOnlyExtensions?: string[];
138
141
  output?: string;
139
142
  defaultReads?: string[];
@@ -152,6 +155,8 @@ export interface AgentConfig {
152
155
  interface SubagentSettings {
153
156
  overrides: Record<string, BuiltinAgentOverrideConfig>;
154
157
  defaultModel?: string;
158
+ defaultThinking?: string;
159
+ defaultExtensions?: string[];
155
160
  disableBuiltins?: boolean;
156
161
  disableThinking?: boolean;
157
162
  modelScope?: ModelScopeConfig;
@@ -516,6 +521,7 @@ function cloneOverrideBase(agent: AgentConfig): BuiltinAgentOverrideBase {
516
521
  skillPath: agent.skillPath ? [...agent.skillPath] : undefined,
517
522
  tools: agent.tools ? [...agent.tools] : undefined,
518
523
  mcpDirectTools: agent.mcpDirectTools ? [...agent.mcpDirectTools] : undefined,
524
+ extensions: agent.extensionsFromDefault ? undefined : agent.extensions ? [...agent.extensions] : undefined,
519
525
  subagentOnlyExtensions: agent.subagentOnlyExtensions ? [...agent.subagentOnlyExtensions] : undefined,
520
526
  completionGuard: agent.completionGuard,
521
527
  toolBudget: agent.toolBudget,
@@ -538,6 +544,7 @@ function cloneOverrideValue(override: BuiltinAgentOverrideConfig): BuiltinAgentO
538
544
  ...(override.systemPrompt !== undefined ? { systemPrompt: override.systemPrompt } : {}),
539
545
  ...(override.skills !== undefined ? { skills: override.skills === false ? false : [...override.skills] } : {}),
540
546
  ...(override.tools !== undefined ? { tools: override.tools === false ? false : [...override.tools] } : {}),
547
+ ...(override.extensions !== undefined ? { extensions: override.extensions === false ? false : [...override.extensions] } : {}),
541
548
  ...(override.subagentOnlyExtensions !== undefined ? { subagentOnlyExtensions: override.subagentOnlyExtensions === false ? false : [...override.subagentOnlyExtensions] } : {}),
542
549
  ...(override.completionGuard !== undefined ? { completionGuard: override.completionGuard } : {}),
543
550
  ...(override.toolBudget !== undefined ? { toolBudget: override.toolBudget === false ? false : { ...override.toolBudget, ...(Array.isArray(override.toolBudget.block) ? { block: [...override.toolBudget.block] } : {}) } } : {}),
@@ -717,6 +724,9 @@ function parseBuiltinOverrideEntry(
717
724
  const tools = parseOverrideStringArrayOrFalse(input.tools, { filePath, name, field: "tools" });
718
725
  if (tools !== undefined) override.tools = tools;
719
726
 
727
+ const extensions = parseOverrideStringArrayOrFalse(input.extensions, { filePath, name, field: "extensions" });
728
+ if (extensions !== undefined) override.extensions = extensions;
729
+
720
730
  const subagentOnlyExtensions = parseOverrideStringArrayOrFalse(input.subagentOnlyExtensions, { filePath, name, field: "subagentOnlyExtensions" });
721
731
  if (subagentOnlyExtensions !== undefined) override.subagentOnlyExtensions = subagentOnlyExtensions;
722
732
 
@@ -754,18 +764,34 @@ function readSubagentSettings(filePath: string | null): SubagentSettings {
754
764
  throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultModel'; expected a non-empty string.`);
755
765
  }
756
766
  }
767
+ let defaultThinking: string | undefined;
768
+ if ("defaultThinking" in subagentsObject) {
769
+ if (typeof subagentsObject.defaultThinking === "string" && subagentsObject.defaultThinking.trim()) {
770
+ defaultThinking = subagentsObject.defaultThinking.trim();
771
+ } else {
772
+ throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultThinking'; expected a non-empty string.`);
773
+ }
774
+ }
775
+ let defaultExtensions: string[] | undefined;
776
+ if ("defaultExtensions" in subagentsObject) {
777
+ if (!Array.isArray(subagentsObject.defaultExtensions)
778
+ || subagentsObject.defaultExtensions.some((item) => typeof item !== "string" || !item.trim())) {
779
+ throw new Error(`Subagent settings in '${filePath}' have invalid 'defaultExtensions'; expected an array of non-empty strings.`);
780
+ }
781
+ defaultExtensions = subagentsObject.defaultExtensions.map((item) => item.trim());
782
+ }
757
783
  const modelScope = parseModelScopeConfig(subagentsObject.modelScope, { filePath });
758
784
 
759
785
  const parsed: Record<string, BuiltinAgentOverrideConfig> = {};
760
786
  const agentOverrides = subagentsObject.agentOverrides;
761
787
  if (!agentOverrides || typeof agentOverrides !== "object" || Array.isArray(agentOverrides)) {
762
- return { overrides: parsed, defaultModel, disableBuiltins, disableThinking, modelScope };
788
+ return { overrides: parsed, defaultModel, defaultThinking, defaultExtensions, disableBuiltins, disableThinking, modelScope };
763
789
  }
764
790
  for (const [name, value] of Object.entries(agentOverrides)) {
765
791
  const override = parseBuiltinOverrideEntry(name, value, filePath);
766
792
  if (override) parsed[name] = override;
767
793
  }
768
- return { overrides: parsed, defaultModel, disableBuiltins, disableThinking, modelScope };
794
+ return { overrides: parsed, defaultModel, defaultThinking, defaultExtensions, disableBuiltins, disableThinking, modelScope };
769
795
  }
770
796
 
771
797
  function resolveSubagentDefaultModel(
@@ -793,6 +819,58 @@ function applySubagentDefaultModel(agents: AgentConfig[], defaultModel: AgentMod
793
819
  });
794
820
  }
795
821
 
822
+ function resolveSubagentDefaultThinking(
823
+ userSettings: SubagentSettings,
824
+ projectSettings: SubagentSettings,
825
+ projectSettingsPath: string | null,
826
+ ): string | undefined {
827
+ if (projectSettingsPath && projectSettings.defaultThinking !== undefined) return projectSettings.defaultThinking;
828
+ return userSettings.defaultThinking;
829
+ }
830
+
831
+ function applySubagentDefaultThinking(agents: AgentConfig[], defaultThinking: string | undefined): AgentConfig[] {
832
+ if (defaultThinking === undefined) return agents;
833
+ return agents.map((agent) => {
834
+ if (agent.thinking !== undefined) return agent;
835
+ const next = { ...agent, thinking: defaultThinking };
836
+ const frontmatterFields = agentFrontmatterFields.get(agent);
837
+ if (frontmatterFields) agentFrontmatterFields.set(next, frontmatterFields);
838
+ return next;
839
+ });
840
+ }
841
+
842
+ function resolveSubagentDefaultExtensions(
843
+ userSettings: SubagentSettings,
844
+ projectSettings: SubagentSettings,
845
+ projectSettingsPath: string | null,
846
+ ): string[] | undefined {
847
+ if (projectSettingsPath && projectSettings.defaultExtensions !== undefined) return projectSettings.defaultExtensions;
848
+ return userSettings.defaultExtensions;
849
+ }
850
+
851
+ function applySubagentDefaultExtensions(agents: AgentConfig[], defaultExtensions: string[] | undefined): AgentConfig[] {
852
+ if (defaultExtensions === undefined) return agents;
853
+ return agents.map((agent) => {
854
+ if (agent.extensions !== undefined) return agent;
855
+ const next = { ...agent, extensions: [...defaultExtensions], extensionsFromDefault: true };
856
+ const frontmatterFields = agentFrontmatterFields.get(agent);
857
+ if (frontmatterFields) agentFrontmatterFields.set(next, frontmatterFields);
858
+ return next;
859
+ });
860
+ }
861
+
862
+ function applySubagentDefaults(
863
+ agents: AgentConfig[],
864
+ defaultModel: AgentModelSourceInfo | undefined,
865
+ defaultThinking: string | undefined,
866
+ defaultExtensions: string[] | undefined,
867
+ ): AgentConfig[] {
868
+ return applySubagentDefaultExtensions(
869
+ applySubagentDefaultThinking(applySubagentDefaultModel(agents, defaultModel), defaultThinking),
870
+ defaultExtensions,
871
+ );
872
+ }
873
+
796
874
  function applyBuiltinOverride(
797
875
  agent: AgentConfig,
798
876
  override: BuiltinAgentOverrideConfig,
@@ -821,6 +899,7 @@ function applyBuiltinOverride(
821
899
  next.tools = tools;
822
900
  next.mcpDirectTools = mcpDirectTools;
823
901
  }
902
+ if (override.extensions !== undefined) next.extensions = override.extensions === false ? undefined : [...override.extensions];
824
903
  if (override.subagentOnlyExtensions !== undefined) {
825
904
  next.subagentOnlyExtensions = override.subagentOnlyExtensions === false ? undefined : [...override.subagentOnlyExtensions];
826
905
  }
@@ -964,6 +1043,9 @@ function applyCustomAgentOverride(
964
1043
  target.mcpDirectTools = mcpDirectTools;
965
1044
  anyFilled = true;
966
1045
  }
1046
+ if (override.extensions !== undefined) {
1047
+ fill("extensions", ["extensions"], override.extensions === false ? undefined : [...override.extensions]);
1048
+ }
967
1049
  if (override.subagentOnlyExtensions !== undefined) {
968
1050
  fill(
969
1051
  "subagentOnlyExtensions",
@@ -1009,7 +1091,7 @@ function applyCustomAgentOverrides(
1009
1091
 
1010
1092
  export function buildBuiltinOverrideConfig(
1011
1093
  base: BuiltinAgentOverrideBase,
1012
- draft: Pick<AgentConfig, "model" | "fallbackModels" | "thinking" | "systemPromptMode" | "inheritProjectContext" | "inheritSkills" | "defaultContext" | "acceptanceRole" | "disabled" | "systemPrompt" | "skills" | "tools" | "mcpDirectTools" | "subagentOnlyExtensions" | "completionGuard" | "toolBudget">,
1094
+ draft: Pick<AgentConfig, "model" | "fallbackModels" | "thinking" | "systemPromptMode" | "inheritProjectContext" | "inheritSkills" | "defaultContext" | "acceptanceRole" | "disabled" | "systemPrompt" | "skills" | "tools" | "mcpDirectTools" | "extensions" | "subagentOnlyExtensions" | "completionGuard" | "toolBudget">,
1013
1095
  ): BuiltinAgentOverrideConfig | undefined {
1014
1096
  const override: BuiltinAgentOverrideConfig = {};
1015
1097
 
@@ -1028,6 +1110,7 @@ export function buildBuiltinOverrideConfig(
1028
1110
  const baseTools = joinToolList(base);
1029
1111
  const draftTools = joinToolList(draft);
1030
1112
  if (!arraysEqual(draftTools, baseTools)) override.tools = draftTools ? [...draftTools] : false;
1113
+ if (!arraysEqual(draft.extensions, base.extensions)) override.extensions = draft.extensions ? [...draft.extensions] : false;
1031
1114
  if (!arraysEqual(draft.subagentOnlyExtensions, base.subagentOnlyExtensions)) {
1032
1115
  override.subagentOnlyExtensions = draft.subagentOnlyExtensions ? [...draft.subagentOnlyExtensions] : false;
1033
1116
  }
@@ -1460,6 +1543,8 @@ export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryRe
1460
1543
  const userSettings = scope === "project" ? EMPTY_SUBAGENT_SETTINGS : readSubagentSettings(userSettingsPath);
1461
1544
  const projectSettings = scope === "user" ? EMPTY_SUBAGENT_SETTINGS : readSubagentSettings(projectSettingsPath);
1462
1545
  const defaultModel = resolveSubagentDefaultModel(userSettings, projectSettings, userSettingsPath, projectSettingsPath);
1546
+ const defaultThinking = resolveSubagentDefaultThinking(userSettings, projectSettings, projectSettingsPath);
1547
+ const defaultExtensions = resolveSubagentDefaultExtensions(userSettings, projectSettings, projectSettingsPath);
1463
1548
  const modelScope = projectSettings.modelScope ?? userSettings.modelScope;
1464
1549
  const packageSubagentPaths = collectPackageSubagentPaths(cwd, {
1465
1550
  includeUser: scope !== "project",
@@ -1467,7 +1552,7 @@ export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryRe
1467
1552
  });
1468
1553
 
1469
1554
  const builtinAgents = applyBuiltinOverrides(
1470
- applySubagentDefaultModel(loadAgentsFromDir(BUILTIN_AGENTS_DIR, "builtin"), defaultModel),
1555
+ applySubagentDefaults(loadAgentsFromDir(BUILTIN_AGENTS_DIR, "builtin"), defaultModel, defaultThinking, defaultExtensions),
1471
1556
  userSettings,
1472
1557
  projectSettings,
1473
1558
  userSettingsPath,
@@ -1478,7 +1563,7 @@ export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryRe
1478
1563
  const userAgentsOld = scope === "project" ? [] : loadAgentsFromDir(userDirOld, "user");
1479
1564
  const userAgentsNew = scope === "project" ? [] : loadAgentsFromDir(userDirNew, "user");
1480
1565
  const userAgents = applyCustomAgentOverrides(
1481
- applySubagentDefaultModel([...userAgentsExtra, ...userAgentsOld, ...userAgentsNew], defaultModel),
1566
+ applySubagentDefaults([...userAgentsExtra, ...userAgentsOld, ...userAgentsNew], defaultModel, defaultThinking, defaultExtensions),
1482
1567
  userSettings,
1483
1568
  projectSettings,
1484
1569
  userSettingsPath,
@@ -1486,14 +1571,14 @@ export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryRe
1486
1571
  );
1487
1572
 
1488
1573
  const projectAgents = applyCustomAgentOverrides(
1489
- applySubagentDefaultModel(scope === "user" ? [] : projectAgentDirs.flatMap((dir) => loadAgentsFromDir(dir, "project")), defaultModel),
1574
+ applySubagentDefaults(scope === "user" ? [] : projectAgentDirs.flatMap((dir) => loadAgentsFromDir(dir, "project")), defaultModel, defaultThinking, defaultExtensions),
1490
1575
  userSettings,
1491
1576
  projectSettings,
1492
1577
  userSettingsPath,
1493
1578
  projectSettingsPath,
1494
1579
  );
1495
1580
  const packageAgents = applyCustomAgentOverrides(
1496
- applySubagentDefaultModel(packageSubagentPaths.agents.flatMap((dir) => loadAgentsFromDir(dir, "package")), defaultModel),
1581
+ applySubagentDefaults(packageSubagentPaths.agents.flatMap((dir) => loadAgentsFromDir(dir, "package")), defaultModel, defaultThinking, defaultExtensions),
1497
1582
  userSettings,
1498
1583
  projectSettings,
1499
1584
  userSettingsPath,
@@ -1529,21 +1614,23 @@ export function discoverAgentsAll(cwd: string): {
1529
1614
  const userSettings = readSubagentSettings(userSettingsPath);
1530
1615
  const projectSettings = readSubagentSettings(projectSettingsPath);
1531
1616
  const defaultModel = resolveSubagentDefaultModel(userSettings, projectSettings, userSettingsPath, projectSettingsPath);
1617
+ const defaultThinking = resolveSubagentDefaultThinking(userSettings, projectSettings, projectSettingsPath);
1618
+ const defaultExtensions = resolveSubagentDefaultExtensions(userSettings, projectSettings, projectSettingsPath);
1532
1619
  const packageSubagentPaths = collectPackageSubagentPaths(cwd);
1533
1620
 
1534
1621
  const builtin = applyBuiltinOverrides(
1535
- applySubagentDefaultModel(loadAgentsFromDir(BUILTIN_AGENTS_DIR, "builtin"), defaultModel),
1622
+ applySubagentDefaults(loadAgentsFromDir(BUILTIN_AGENTS_DIR, "builtin"), defaultModel, defaultThinking, defaultExtensions),
1536
1623
  userSettings,
1537
1624
  projectSettings,
1538
1625
  userSettingsPath,
1539
1626
  projectSettingsPath,
1540
1627
  );
1541
1628
  const user = applyCustomAgentOverrides(
1542
- applySubagentDefaultModel([
1629
+ applySubagentDefaults([
1543
1630
  ...extraUserAgentDirs().flatMap((dir) => loadAgentsFromDir(dir, "user")),
1544
1631
  ...loadAgentsFromDir(userDirOld, "user"),
1545
1632
  ...loadAgentsFromDir(userDirNew, "user"),
1546
- ], defaultModel),
1633
+ ], defaultModel, defaultThinking, defaultExtensions),
1547
1634
  userSettings,
1548
1635
  projectSettings,
1549
1636
  userSettingsPath,
@@ -1556,7 +1643,7 @@ export function discoverAgentsAll(cwd: string): {
1556
1643
  }
1557
1644
  }
1558
1645
  const packageAgents = applyCustomAgentOverrides(
1559
- applySubagentDefaultModel(Array.from(packageMap.values()), defaultModel),
1646
+ applySubagentDefaults(Array.from(packageMap.values()), defaultModel, defaultThinking, defaultExtensions),
1560
1647
  userSettings,
1561
1648
  projectSettings,
1562
1649
  userSettingsPath,
@@ -1569,7 +1656,7 @@ export function discoverAgentsAll(cwd: string): {
1569
1656
  }
1570
1657
  }
1571
1658
  const project = applyCustomAgentOverrides(
1572
- applySubagentDefaultModel(Array.from(projectMap.values()), defaultModel),
1659
+ applySubagentDefaults(Array.from(projectMap.values()), defaultModel, defaultThinking, defaultExtensions),
1573
1660
  userSettings,
1574
1661
  projectSettings,
1575
1662
  userSettingsPath,
@@ -0,0 +1,17 @@
1
+ export {
2
+ SUBAGENT_CAPABILITY_CEILING_ENV,
3
+ SUBAGENT_CAPABILITY_CEILING_REGISTRY_KEY,
4
+ SUBAGENT_CAPABILITY_CEILING_VERSION,
5
+ decodeSubagentCapabilityCeiling,
6
+ encodeSubagentCapabilityCeiling,
7
+ intersectSubagentCapabilityCeilings,
8
+ parseSubagentCapabilityCeiling,
9
+ registerSubagentCapabilityCeiling,
10
+ resolveCurrentSubagentCapabilityCeiling,
11
+ resolveSubagentCapabilityCeiling,
12
+ type RegisterSubagentCapabilityCeilingOptions,
13
+ type ResolvedSubagentCapabilityCeiling,
14
+ type SubagentCapabilityCeiling,
15
+ type SubagentCapabilityCeilingHandle,
16
+ type SubagentCapabilityAudit,
17
+ } from "../runs/shared/capability-ceiling.ts";
@@ -38,7 +38,7 @@ export interface SubagentDelegationExecutionResult {
38
38
  }
39
39
 
40
40
  export interface SubagentDelegationReviewResult {
41
- status: "not-requested" | "no-blockers" | "blockers" | "needs-parent-decision";
41
+ status: "not-requested" | "review-required" | "reviewed" | "blockers";
42
42
  findings?: Array<{ severity: "blocker" | "non-blocking"; file?: string; issue: string; rationale: string }>;
43
43
  }
44
44
 
@@ -131,6 +131,7 @@ export interface SubagentDelegationStarted {
131
131
  }
132
132
 
133
133
  export interface SubagentDelegationUpdate extends SubagentDelegationStarted {
134
+ runId?: string;
134
135
  currentTool?: string;
135
136
  currentToolArgs?: string;
136
137
  recentOutput?: string;
@@ -162,12 +163,14 @@ export type SubagentDelegationAcceptanceStatus =
162
163
  | "attested"
163
164
  | "checked"
164
165
  | "verified"
166
+ | "review-required"
165
167
  | "reviewed"
166
168
  | "accepted"
167
169
  | "rejected";
168
170
 
169
171
  export interface SubagentDelegationAcceptanceResult {
170
172
  status: SubagentDelegationAcceptanceStatus;
173
+ evidenceStatus: Exclude<SubagentDelegationAcceptanceStatus, "review-required" | "reviewed" | "accepted">;
171
174
  explicit: boolean;
172
175
  }
173
176
 
@@ -228,6 +231,7 @@ export interface SubagentDelegationV2Started {
228
231
  }
229
232
 
230
233
  export interface SubagentDelegationV2Update extends SubagentDelegationV2Started {
234
+ runId?: string;
231
235
  currentTool?: string;
232
236
  currentToolArgs?: string;
233
237
  recentOutput?: string;
@@ -264,6 +268,7 @@ export interface SubagentDelegationV2TerminalResponse extends SubagentDelegation
264
268
  model?: string;
265
269
  thinking?: string;
266
270
  exitCode?: number;
271
+ launchContractDigest?: string;
267
272
  result?: SubagentDelegationV2Value;
268
273
  usage?: SubagentDelegationV2Usage;
269
274
  }