pi-subagents 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -4
- package/README.md +1 -1
- package/docs/configuration.md +3 -3
- package/docs/models.md +17 -3
- package/index.ts +10 -1
- package/package.json +1 -1
- package/prompts/council.md +10 -7
- package/skills/council-mode/SKILL.md +17 -16
- package/skills/pi-subagents/SKILL.md +5 -1
- package/skills/pi-subagents/references/execution-controls.md +2 -0
- package/skills/pi-subagents/references/prompting-and-roles.md +7 -0
- package/src/agents/agent-management.ts +85 -5
- package/src/agents/agents.ts +67 -24
- package/src/api/preflight.ts +7 -2
- package/src/extension/doctor.ts +10 -0
- package/src/extension/fanout-child.ts +3 -2
- package/src/extension/index.ts +4 -3
- package/src/extension/public-execution.ts +1 -1
- package/src/extension/tool-result.ts +19 -0
- package/src/inspectors/herdr/client.ts +3 -3
- package/src/runs/background/async-execution.ts +10 -5
- package/src/runs/background/async-retention.ts +1 -1
- package/src/runs/background/chain-root-attachment.ts +5 -0
- package/src/runs/background/result-watcher.ts +4 -3
- package/src/runs/background/stale-run-reconciler.ts +3 -0
- package/src/runs/background/subagent-runner.ts +26 -2
- package/src/runs/background/wait-completions.ts +2 -0
- package/src/runs/background/wait-tool.ts +4 -3
- package/src/runs/foreground/execution.ts +29 -1
- package/src/runs/foreground/subagent-executor.ts +14 -6
- package/src/runs/shared/model-fallback.ts +36 -15
- package/src/runs/shared/model-scope.ts +106 -39
- package/src/runs/shared/pi-args.ts +34 -1
- package/src/runs/shared/subagent-prompt-runtime.ts +36 -9
- package/src/shared/types.ts +13 -3
- package/src/watchdog/permission-arbiter.ts +59 -51
package/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.54.0] - 2026-08-21
|
|
6
|
+
|
|
7
|
+
### Highlights
|
|
8
|
+
- Subagent model selection is more precise with per-agent restrictions and an `inherit` shortcut for the current parent model.
|
|
9
|
+
- Package agents are easier to discover because list and detail output now shows where they come from and whether their external provider is ready.
|
|
10
|
+
- Workflow runs are less fragile: tool-result backfill, context-overflow handling, resumed children, and permission asks now behave more predictably.
|
|
11
|
+
- Child launches are lighter and safer because subagent processes avoid loading the parent extension graph and avoid unnecessary permission bridge setup.
|
|
12
|
+
- Council Mode is easier to use from natural language and no longer requires invented advisor role labels.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- Add per-agent model restrictions and a current-parent `inherit` allow-list alias. Thanks to [@hieudmg](https://github.com/hieudmg) for #1328.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Show package names, versions, and external-job provider status in subagent list and detail output so package agents such as Surf's `gpt-pro` are easier to find and use.
|
|
19
|
+
- Make scripted workflow helper support and stale-session recovery easier to see in `doctor` and the workflow guide (#1344).
|
|
20
|
+
- Keep structured single-child execution receipts quieter by removing an internal conversion log from public workflow output.
|
|
21
|
+
- Route natural-language requests for advisor councils, plan critique, cross-exam, or multiple model perspectives to the Council Mode protocol.
|
|
22
|
+
- Simplify Council Mode advisor selection so model-based profiles provide the perspective and the question supplies the decision frame.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- Layer custom-agent user and project overrides without dropping user-only fields, while preserving project precedence. Thanks to [@jagaliano](https://github.com/jagaliano) for #1348.
|
|
26
|
+
- Avoid child tool-call hangs by loading the external permission-system bridge only for explicit native permission rules and by failing stalled ask decisions closed. Thanks to [@moekyo](https://github.com/moekyo) for #1339.
|
|
27
|
+
- Keep foreground workflow children from timing out after a tool result is backfilled without a separate execution-end event. Thanks to [@moekyo](https://github.com/moekyo) for #1339.
|
|
28
|
+
- Mark completed foreground workflow children as resumable in keyed receipts when their persisted session file is available (#1335).
|
|
29
|
+
- Avoid loading the parent extension graph in subagent child processes. Thanks to [@ccharname](https://github.com/ccharname) for #1330.
|
|
30
|
+
- Stop model fallback on context-overflow failures and surface `contextOverflow`. Thanks to [@srcKod](https://github.com/srcKod) for #1323.
|
|
31
|
+
- Stop empty slow result scans from spamming the session transcript. Thanks to [@afrodao2394](https://github.com/afrodao2394) for #1329.
|
|
32
|
+
- Surface logical tool failures so subagent tool results backfill correctly. Thanks to [@abdwhb-png](https://github.com/abdwhb-png) for #1332 and [@moekyo](https://github.com/moekyo) for #1331.
|
|
33
|
+
|
|
5
34
|
## [0.53.0] - 2026-08-20
|
|
6
35
|
|
|
7
36
|
### Highlights
|
|
37
|
+
- New `/council` mode helps with material decisions by running a small, bounded group of advisors and ending with a parent-written decision memo.
|
|
8
38
|
- Pi extensions can now register runtime agents without writing user or project config.
|
|
9
39
|
- Async workflows are easier to resume because completed children now have durable keyed receipts.
|
|
10
40
|
- Model fallback is less noisy and less wasteful when a model fails or the prompt is too large.
|
|
11
|
-
- Fleet and `/council` now give clearer supervision cues while keeping control in the parent session.
|
|
12
41
|
- Extension RPC hosts can safely inspect status, launch async work, steer children, and manage schedules.
|
|
13
42
|
|
|
14
43
|
### Added
|
|
@@ -23,9 +52,7 @@
|
|
|
23
52
|
- Add durable keyed async workflow receipts and resume-by-key selectors for
|
|
24
53
|
retained workflow children (#1302).
|
|
25
54
|
- Add the `resultScanLogging` config to control result scan logging. Thanks to [@apoapostolov](https://github.com/apoapostolov) for #1293.
|
|
26
|
-
- Add
|
|
27
|
-
supervisor-mediated advisor loop, plus documented model-based `council-*`
|
|
28
|
-
profile examples (#1295).
|
|
55
|
+
- Add `/council` and `council-mode` for bounded advisor councils. Use it for material decisions that need multiple perspectives: the parent picks 2–3 advisors, collects independent reports, optionally runs one cross-exam pass, and writes the final decision memo. The package also documents model-based `council-*` profile examples (#1295).
|
|
29
56
|
|
|
30
57
|
### Changed
|
|
31
58
|
- Show bounded workflow progress in Fleet detail views while keeping workflow
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ The package includes `/council` and `council-mode`, plus documented model-based
|
|
|
76
76
|
| Solve a hard problem | "Use oracle to investigate this bug before we edit." |
|
|
77
77
|
| Review a diff | "Use reviewer to review this diff." |
|
|
78
78
|
| Run parallel reviewers | "Run reviewers for correctness, tests, and cleanup." |
|
|
79
|
-
| Debate a material decision | "Use `/council`
|
|
79
|
+
| Debate a material decision | "Use `/council` with model-based advisors to compare this decision." |
|
|
80
80
|
| Implement then review | "Implement this, then review it." |
|
|
81
81
|
| Review until clean | "Run a review loop on this change with a max of 3 rounds." |
|
|
82
82
|
| Execute a plan carefully | "Have worker implement this approved plan, then run reviewers and apply the feedback." |
|
package/docs/configuration.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`pi-subagents` reads optional JSON config from `~/.pi/agent/extensions/subagent/config.json`. This page lists every key, plus the environment variables and the settings-file keys that affect config resolution.
|
|
4
4
|
|
|
5
|
-
Settings-level keys (`subagents.defaultModel`, `defaultThinking`, `defaultExtensions`, `agentOverrides`, `modelScope`, `disableThinking`, `disableBuiltins`, watchdog settings) live in Pi settings files, not this config file. See [models.md](models.md), [agents.md](agents.md), and [watchdog.md](watchdog.md).
|
|
5
|
+
Settings-level keys (`subagents.defaultModel`, `defaultThinking`, `defaultExtensions`, `agentOverrides`, `modelScope`, `disableThinking`, `disableBuiltins`, watchdog settings) live in Pi settings files, not this config file. `modelScope.agents.<name>` adds per-agent restrictions, and `allow: ["inherit"]` permits the current parent model. See [models.md](models.md), [agents.md](agents.md), and [watchdog.md](watchdog.md).
|
|
6
6
|
|
|
7
7
|
## Project root resolution (settings)
|
|
8
8
|
|
|
@@ -170,9 +170,9 @@ This is different from `waitTool.enabled=false`, which returns immediately witho
|
|
|
170
170
|
{ "resultScanLogging": "activity" }
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
Controls how slow result-index scans are logged. Defaults to `"
|
|
173
|
+
Controls how slow result-index scans are logged. Defaults to `"activity"`; valid values are `"all"`, `"activity"`, and `"off"`.
|
|
174
174
|
|
|
175
|
-
The watcher logs `Subagent result scan inspected … scheduled …` through `console.error` whenever a result-index scan passes the slow threshold (500ms). With `"
|
|
175
|
+
The watcher logs `Subagent result scan inspected … scheduled …` through `console.error` whenever a result-index scan passes the slow threshold (500ms). With `"activity"` (default), it logs only scans that inspected or scheduled actual work. Use `"all"` to log every slow scan, including the periodic healthy rescan that inspects zero files while no async runs are pending, or `"off"` to silence slow-scan logging entirely. `"off"` does not disable result delivery or the watcher itself, only its slow-scan log line.
|
|
176
176
|
|
|
177
177
|
## `forceTopLevelAsync`
|
|
178
178
|
|
package/docs/models.md
CHANGED
|
@@ -10,6 +10,8 @@ Builtin agents inherit your current Pi default model. This keeps new installs fr
|
|
|
10
10
|
|
|
11
11
|
Precedence, strongest first: per-run override → agent frontmatter `model` → `agentOverrides.<name>.model` → `subagents.defaultModel` → the parent session model.
|
|
12
12
|
|
|
13
|
+
Use `model: "inherit"` in agent frontmatter or `agentOverrides.<name>.model` to select the current parent session model explicitly.
|
|
14
|
+
|
|
13
15
|
## Setting defaults and overrides
|
|
14
16
|
|
|
15
17
|
In `~/.pi/agent/settings.json` (user) or the project config settings file (`.pi/settings.json` in standard Pi; project wins):
|
|
@@ -153,17 +155,29 @@ To keep subagents inside a budget or compliance profile, enforce a model scope.
|
|
|
153
155
|
"modelScope": {
|
|
154
156
|
"enforce": true,
|
|
155
157
|
"strict": true,
|
|
156
|
-
"allow": ["
|
|
158
|
+
"allow": ["inherit", "openai/gpt-5-*"],
|
|
159
|
+
"agents": {
|
|
160
|
+
"worker": { "allow": ["openai/gpt-5-mini"] },
|
|
161
|
+
"reviewer": { "allow": ["inherit"] }
|
|
162
|
+
}
|
|
157
163
|
}
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
166
|
```
|
|
161
167
|
|
|
162
|
-
- `allow` is a list of glob patterns matched against the resolved `provider/id` (only `*` is special, case-insensitive).
|
|
168
|
+
- `allow` is a list of glob patterns matched against the resolved `provider/id` (only `*` is special, case-insensitive). The literal `inherit` means the current parent session model.
|
|
169
|
+
- `agents.<name>` adds a second allow-list for that agent. The model must pass both the global list and the matching agent list, so an agent rule cannot weaken the global rule. Agent rules inherit `enforce` and `strict` when those fields are absent.
|
|
170
|
+
- A top-level `enforce: true` with only agent allow-lists restricts only those named agents. Unknown names are allowed so settings can be shared across projects and machines.
|
|
163
171
|
- Models you pass explicitly — the tool-call `model`, `--model`, or a clarify pick — error and abort the run.
|
|
164
172
|
- By default, models from agent frontmatter, `subagents.defaultModel`, the inherited parent session model, or fallback chains only warn and remain available, so existing configurations keep working while you tighten the scope.
|
|
165
173
|
- Set `strict: true` with `enforce: true` to reject every resolved out-of-scope model. This includes inherited models and fallback candidates. An invalid fallback fails the run instead of being removed from the candidate chain.
|
|
166
|
-
- `enforce: true` requires
|
|
174
|
+
- `enforce: true` requires at least one non-empty global or agent `allow` list; otherwise the config is rejected at load time.
|
|
175
|
+
|
|
176
|
+
Model scope is policy only. It rejects or warns; it does not select a cheaper model. Set `agentOverrides.worker.model` to choose a worker model and use `modelScope.agents.worker` to prevent a per-run override or fallback from escaping that restriction.
|
|
177
|
+
|
|
178
|
+
`inherit` expands in the parent process at each launch. It is never sent to the child as a model id. A nested child therefore inherits its immediate parent's current model, not the original top-level model. If no parent model is available, an enforced `inherit` entry does not match and fails closed.
|
|
179
|
+
|
|
180
|
+
Project `modelScope` settings replace the complete user `modelScope`, as with the existing project-over-user settings precedence. Project settings are trusted and can therefore replace user restrictions.
|
|
167
181
|
|
|
168
182
|
## Profiles and provider model catalogs
|
|
169
183
|
|
package/index.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type {} from "./src/types/pi-runtime-compat.d.ts";
|
|
3
|
+
|
|
4
|
+
const registerParentExtension = process.env.PI_SUBAGENT_CHILD === "1"
|
|
5
|
+
? undefined
|
|
6
|
+
: (await import("./src/extension/index.ts")).default;
|
|
7
|
+
|
|
8
|
+
export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
9
|
+
registerParentExtension?.(pi);
|
|
10
|
+
}
|
package/package.json
CHANGED
package/prompts/council.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Run a bounded supervisor-mediated council of advisors and write a decision memo
|
|
3
|
-
argument-hint: "<question> [--advisors name
|
|
3
|
+
argument-hint: "<question> [--advisors name,name] [--max-passes 2|3] [--scope ...] [--non-goals ...]"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Run a bounded, supervisor-mediated council on this question. You, the parent
|
|
@@ -13,13 +13,14 @@ Before you orchestrate, read `skills/council-mode/SKILL.md` and
|
|
|
13
13
|
|
|
14
14
|
Parse the invocation yourself. The flags below are conventions, not runtime
|
|
15
15
|
options. Record a brief with the question, scope, non-goals, evidence targets,
|
|
16
|
-
roster,
|
|
17
|
-
the question is trivial or settled, answer directly instead
|
|
16
|
+
roster, known advisor context modes, and pass cap. Default `--max-passes` to 2.
|
|
17
|
+
Clamp it to 2 or 3. If the question is trivial or settled, answer directly instead
|
|
18
|
+
of convening a council.
|
|
18
19
|
|
|
19
20
|
## Roster
|
|
20
21
|
|
|
21
|
-
- If `--advisors` is given, use exactly those
|
|
22
|
-
unknown agent.
|
|
22
|
+
- If `--advisors` is given, use exactly those agent names. Fail clearly on an
|
|
23
|
+
unknown agent. Do not require or invent per-advisor role labels.
|
|
23
24
|
- Otherwise list agents with `subagent({ action: "list" })`, then prefer 2–3
|
|
24
25
|
executable names that start with `council-`.
|
|
25
26
|
- If fewer than two profiles are available, fill the roster with `oracle`, then
|
|
@@ -30,8 +31,10 @@ the question is trivial or settled, answer directly instead of convening a counc
|
|
|
30
31
|
- Use the normal single-oracle loop only when a requested roster or unavailable
|
|
31
32
|
builtins leaves fewer than two advisors. Label the memo as degraded mode.
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
Profiles provide the model, tools, context, and advisor stance. The council
|
|
35
|
+
question and scope provide the decision frame. If the user wants a specific lens,
|
|
36
|
+
they should put it in the question, scope, or profile definition. Keep the roster
|
|
37
|
+
at 2–3 and never exceed 4.
|
|
35
38
|
|
|
36
39
|
## Run the protocol
|
|
37
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: council-mode
|
|
3
|
-
description: Run a bounded supervisor-mediated advisor council. Use when the user asks to convene advisors, debate a decision, cross-examine recommendations, or run /council.
|
|
3
|
+
description: Run a bounded supervisor-mediated advisor council. Use when the user asks for council mode, asks to convene advisors, debate a decision, cross-examine recommendations, or run /council.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Council Mode
|
|
@@ -16,13 +16,12 @@ trivial or settled question, or for implementation work. Read
|
|
|
16
16
|
|
|
17
17
|
## Roster and limits
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
choice.
|
|
19
|
+
Use advisor profile names directly. A `council-*` profile defines model, tools,
|
|
20
|
+
context, output defaults, and any persistent stance in the profile body. Its
|
|
21
|
+
profile configuration or explicit invocation owns its context choice.
|
|
23
22
|
|
|
24
23
|
Create model-based profiles in your user or project agent directory. Do not add
|
|
25
|
-
them to this package. This is a valid example
|
|
24
|
+
them to this package. This is a valid example:
|
|
26
25
|
|
|
27
26
|
```markdown
|
|
28
27
|
---
|
|
@@ -38,9 +37,9 @@ defaultContext: fresh
|
|
|
38
37
|
acceptanceRole: read-only
|
|
39
38
|
---
|
|
40
39
|
|
|
41
|
-
Analyze
|
|
42
|
-
run mutating commands, commit, push, contact peers, or spawn subagents.
|
|
43
|
-
concise, cited advice using the report contract in the council task.
|
|
40
|
+
Analyze the council question independently. Inspect evidence directly. Do not
|
|
41
|
+
edit, run mutating commands, commit, push, contact peers, or spawn subagents.
|
|
42
|
+
Return concise, cited advice using the report contract in the council task.
|
|
44
43
|
```
|
|
45
44
|
|
|
46
45
|
After `subagent({ action: "list" })`, prefer 2–3 executable names that start with
|
|
@@ -60,9 +59,11 @@ be settled by evidence an advisor can produce. Never run an unbounded loop.
|
|
|
60
59
|
## Protocol
|
|
61
60
|
|
|
62
61
|
1. The parent writes a brief with the question, scope, non-goals, evidence targets,
|
|
63
|
-
roster,
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
roster, known advisor context modes, and pass cap. If the user wants a specific
|
|
63
|
+
lens, keep it in the question, scope, or profile body instead of inventing a
|
|
64
|
+
per-advisor label.
|
|
65
|
+
2. Before Pass 1, tell the user the roster, requested or known context modes, and
|
|
66
|
+
pass cap. Use a stable key, `phase`, and concise `label` for every
|
|
66
67
|
workflow child. For example, use `advisor-oracle`, `phase: "Council pass 1"`,
|
|
67
68
|
and `label: "Oracle — intent and consistency"`.
|
|
68
69
|
3. Launch one async `workflowScript` with `runs.all` for independent advisor
|
|
@@ -162,7 +163,6 @@ return {
|
|
|
162
163
|
advisors: results.map((result, index) => ({
|
|
163
164
|
key: result.key,
|
|
164
165
|
agent: result.agent,
|
|
165
|
-
role: roster[index].role,
|
|
166
166
|
requestedContext: roster[index].context ?? "runtime-default-unknown",
|
|
167
167
|
runId: result.runId,
|
|
168
168
|
report: result.structuredOutput
|
|
@@ -221,9 +221,10 @@ decisions. Never add a round for polish or symmetry.
|
|
|
221
221
|
|
|
222
222
|
The parent memo states the question and scope, recommendation, rationale, accepted
|
|
223
223
|
and rejected feedback with reasons, owner decisions, evidence and run ids,
|
|
224
|
-
confidence, what would change the decision, and the roster,
|
|
225
|
-
|
|
226
|
-
context-aware
|
|
224
|
+
confidence, what would change the decision, and the roster, passes, fallbacks, and
|
|
225
|
+
known advisor context modes. Identify advisors by profile name or model-based
|
|
226
|
+
profile, not by invented role labels. State that fallback `oracle` is context-aware
|
|
227
|
+
and forked.
|
|
227
228
|
|
|
228
229
|
Council mode is not agent-to-agent chat, a transcript dump, mutation authority,
|
|
229
230
|
auto-escalation to writer lanes, or a council UI. Escalate to a writer only after
|
|
@@ -14,6 +14,8 @@ 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 one specialized child or composed orchestration. Use `workflowScript` for all execution, including one isolated child. Chaining is still supported, but it is code-driven: use `await runs.run(...)` for sequential steps, `runs.all([...])` for parallel fanout, and ordinary JavaScript for branching, retries, gate monitors, and aggregation. Keep workflow helpers portable: use plain helper functions or explicit Promise chains, not nested `async function` helpers, async arrows, or async methods. Do not use legacy top-level `chain` / `tasks` inputs or durable `.chain.md` execution. Scripted workflows normally start asynchronously unless config sets `asyncByDefault:false`; set `async:true` explicitly when async behavior matters. Pass `async:false` only when the parent must block until completion. Async mode still shows progress. Do not use `async:false` for final reviews, backlog gates, run-to-completion convenience, or because no other work is available.
|
|
16
16
|
|
|
17
|
+
Package-installed agents appear in `subagent({ action: "list" })` with builtin, user, and project agents. If `surf-cli` is installed as a Pi package, the Surf browser extension is loaded, and Chrome is logged into a ChatGPT Pro account, Surf can expose `gpt-pro`: a read-only async advisor that reaches ChatGPT web through Surf Oracle. Check it with `subagent({ action: "get", agent: "gpt-pro" })` and run it with `subagent({ agent: "gpt-pro", task: "Review this plan and identify release risks." })`.
|
|
18
|
+
|
|
17
19
|
## How to use this router
|
|
18
20
|
|
|
19
21
|
Read the matching reference file before acting. Paths are relative to this `SKILL.md`; resolve them against `skills/pi-subagents/` and load them with the read tool.
|
|
@@ -21,6 +23,7 @@ Read the matching reference file before acting. Paths are relative to this `SKIL
|
|
|
21
23
|
| Task | Read |
|
|
22
24
|
| --- | --- |
|
|
23
25
|
| Decide whether to delegate, choose agents, compare tool versus slash commands, apply prompt techniques, or understand builtin roles | `references/prompting-and-roles.md` |
|
|
26
|
+
| Use council mode, convene several advisors, debate a decision, cross-examine recommendations, critique or improve a plan with multiple model perspectives, or run `/council` | `../council-mode/SKILL.md` |
|
|
24
27
|
| Run one-child, scripted, async, scheduled, mission-backed, forked, watchdog, oracle, or intercom-coordinated workflows | `references/execution-controls.md` |
|
|
25
28
|
| Coordinate several independent tasks, worktrees, repositories, or writer lanes | `references/multi-lane-orchestration.md` |
|
|
26
29
|
| List/create/update/delete/eject/disable agents, inspect legacy chain records, edit agent files, use prompt-template integration, or expose extension RPC | `references/management-authoring-rpc.md` |
|
|
@@ -32,7 +35,8 @@ For broad or uncertain requests, read more than one reference. For complex work,
|
|
|
32
35
|
|
|
33
36
|
- Keep the parent as orchestrator and final decision-maker.
|
|
34
37
|
- Before multiple mutation-capable lanes, record a lane board and each lane's isolation path.
|
|
35
|
-
- For plan, design, or architecture advice that asks
|
|
38
|
+
- For plan, design, or architecture advice that asks for council mode, asks to convene several advisors, compare model perspectives, debate a decision, cross-examine recommendations, or critique and improve a plan, read `../council-mode/SKILL.md` and use Council Mode instead of ad hoc parallel oracle calls.
|
|
39
|
+
- For plan, design, or architecture advice that asks to consult, discuss with, or come to agreement with one `oracle`, use a short same-session consultation loop: read the first result, resume once with a targeted challenge when material tradeoffs remain, then synthesize the parent decision. Keep explicit one-shot, trivial, and fully settled consultations one-shot.
|
|
36
40
|
- Use one writer per cwd/worktree unless isolated worktrees are intentional.
|
|
37
41
|
- For cross-codebase work, record the target repo, explicit `cwd`, authority boundary, and expected output before launch. Do not assume the parent session cwd is the child repo.
|
|
38
42
|
- For parallel fanout, compare child prompts before launch. Do not send clone prompts with only issue numbers, titles, or broad file globs swapped; each child needs a lane-specific task, source seam, prior evidence, and decision that remains distinct without the item number. Launch that fanout as one async `workflowScript` with stable keys and aggregate output unless there is truly only one child.
|
|
@@ -78,6 +78,8 @@ subagent({
|
|
|
78
78
|
|
|
79
79
|
Scripts run in a timed worker with only `runs.run`, `runs.all`, `runs.status`, `runs.ref/refs`, `emit`, captured `console`, and standard JavaScript. Pass explicit task text to `runs.run`. Mission-attached workflows also get `await state.get(key)` and `await state.set(key, value)` for durable JSON state shared across workflows on the same mission; `mission: false` workflows have no `state` global. Stable keys are required. Child launches follow ordinary single-agent execution controls. Give each child a distinct decision and output path when reports must outlive the workflow, then consume the aggregate workflow result before opening individual reports.
|
|
80
80
|
|
|
81
|
+
If `runs.all` is missing in a running session, reload or update `pi-subagents` before retrying. The current runtime supports `runs.all`; `await Promise.all([runs.run(...)])` is also supported for advanced dynamic fanout.
|
|
82
|
+
|
|
81
83
|
For one host-run verification command, pass `gate: "npm test"` on a `runs.run`/`runs.all` item (or at the top level as a workflow default). It is shorthand for verified acceptance with that single command: the runtime executes it on the host, records the result as evidence, and memoizes it per tracked workspace state and effective environment. `gate` cannot be combined with `acceptance`; use explicit `acceptance.verify` for multiple commands or custom criteria.
|
|
82
84
|
|
|
83
85
|
Completed workflow children from this parent session stay addressable as retained children. `subagent({ action: "children.list" })` lists up to the last 10 with run ids and reports each row as `resumable` or `not resumable` with a reason. Resume only rows reported `resumable`. For a retained-child challenge, use `resume` instead of `steer` when the child is complete. If no retained child is resumable, launch a same-role fallback challenge and label it as fallback. A later workflow continues a resumable child with `runs.run(key, { resume: "<run-id>", task: "follow-up" })`. Inside `workflowScript`, awaiting that call waits for the revived child to finish and returns its completed output and new `runId`; top-level `{ action: "resume" }` remains detached. Pass explicit follow-up task text. Assign each returned child result back to the loop variable because every resume can return a new retained `runId`; always resume the latest returned id. `resume` and `agent` are mutually exclusive, the revived child keeps its stored agent/model/tool contract, and `gate` is rejected on retained resume items.
|
|
@@ -44,11 +44,18 @@ Packaged prompt shortcuts are also available for repeatable workflows. Treat the
|
|
|
44
44
|
- `/parallel-research` — combine `researcher` and `scout` for external evidence plus local code context
|
|
45
45
|
- `/gather-context-and-clarify` — scout/research first, then ask the user clarifying questions with `interview`
|
|
46
46
|
- `/parallel-cleanup` — two fresh-context reviewers (deslop + verbosity passes) for an adversarial cleanup review of the current diff
|
|
47
|
+
- `/council` — bounded advisor council for material decisions, plan critique, cross-exam, and parent-written decision memos
|
|
47
48
|
|
|
48
49
|
## Applying Prompt Techniques Without Slash Commands
|
|
49
50
|
|
|
50
51
|
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. For targets outside the parent cwd, include the exact repository, explicit `cwd`, authority boundary, and expected output path in each child task. Do not depend on the parent conversation history when the recipe calls for fresh context.
|
|
51
52
|
|
|
53
|
+
### Council Mode technique
|
|
54
|
+
|
|
55
|
+
Use Council Mode when the user asks to convene advisors, debate a material decision, cross-examine recommendations, or critique and improve a plan with several model perspectives. This includes requests such as “run a council on this architecture,” “have Sol, Fable, and Kimi critique this plan,” or “get multiple oracles to debate the tradeoffs.” Read `../council-mode/SKILL.md` and follow its bounded parent-supervised protocol instead of launching ad hoc parallel oracle calls.
|
|
56
|
+
|
|
57
|
+
Council advisors are read-only. User or project `council-*` profiles can pin models such as GPT 5.6 Sol, Fable, or Kimi and define any persistent stance in the profile body. The council question and scope provide the decision frame; do not invent per-advisor role labels. The parent collects independent reports, optionally sends curated cross-exam packets, and writes the final memo. Do not treat the council as agent-to-agent chat, implementation authority, or a writer swarm.
|
|
58
|
+
|
|
52
59
|
### Parallel review technique
|
|
53
60
|
|
|
54
61
|
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.
|
|
@@ -37,6 +37,7 @@ import type { AcceptanceInput, Details, ExtensionConfig, ToolBudgetConfig } from
|
|
|
37
37
|
import { getProjectConfigDir } from "../shared/utils.ts";
|
|
38
38
|
import { capabilityCeilingAgentRestrictionSources, isAgentAllowedByCapabilityCeiling, resolveCurrentSubagentCapabilityCeiling } from "../runs/shared/capability-ceiling.ts";
|
|
39
39
|
import { listRuntimeAgentConfigs, mergeRuntimeAgents, type RuntimeAgentOwner } from "./runtime-agent-registry.ts";
|
|
40
|
+
import { listExternalJobProviders } from "../api/external-job-provider.ts";
|
|
40
41
|
|
|
41
42
|
type ManagementAction = "list" | "get" | "models" | "create" | "update" | "delete" | "eject" | "disable" | "enable" | "reset";
|
|
42
43
|
type ManagementScope = "user" | "project";
|
|
@@ -590,9 +591,83 @@ function renamePath(currentPath: string, newName: string, scope: ManagementScope
|
|
|
590
591
|
return { filePath };
|
|
591
592
|
}
|
|
592
593
|
|
|
594
|
+
function packageSourceLabel(agent: AgentConfig): string {
|
|
595
|
+
if (!agent.packageSourceName) return agent.source;
|
|
596
|
+
return agent.packageSourceVersion ? `${agent.packageSourceName}@${agent.packageSourceVersion}` : agent.packageSourceName;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
type ExternalJobProviderStatus =
|
|
600
|
+
| { ok: true; names: Set<string> }
|
|
601
|
+
| { ok: false; error: string };
|
|
602
|
+
|
|
603
|
+
function errorMessage(error: unknown): string {
|
|
604
|
+
return error instanceof Error ? error.message : String(error);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function registeredExternalJobProviderStatus(): ExternalJobProviderStatus {
|
|
608
|
+
try {
|
|
609
|
+
return { ok: true, names: new Set(listExternalJobProviders().map((provider) => provider.name)) };
|
|
610
|
+
} catch (error) {
|
|
611
|
+
return { ok: false, error: errorMessage(error) };
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
function externalJobProviderSuffix(provider: string, names: Set<string> | undefined): string {
|
|
616
|
+
if (!names) return "?";
|
|
617
|
+
return names.has(provider) ? "✓" : "missing";
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
function runnerListBadge(agent: AgentConfig, providerNames: Set<string> | undefined): string | undefined {
|
|
621
|
+
if (agent.runner?.type === "external-job") return `external-job:${agent.runner.provider} ${externalJobProviderSuffix(agent.runner.provider, providerNames)}`;
|
|
622
|
+
if (agent.runner?.type === "external-cli") return "external-cli";
|
|
623
|
+
return undefined;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function formatAgentListLine(agent: AgentConfig, providerNames: Set<string> | undefined): string {
|
|
627
|
+
const source = agent.source === "package" ? packageSourceLabel(agent) : agent.source;
|
|
628
|
+
const parts = [
|
|
629
|
+
source,
|
|
630
|
+
runnerListBadge(agent, providerNames),
|
|
631
|
+
agent.defaultContext ? `context: ${agent.defaultContext}` : undefined,
|
|
632
|
+
agent.aliases?.length ? `aliases: ${agent.aliases.join(", ")}` : undefined,
|
|
633
|
+
].filter((part): part is string => Boolean(part));
|
|
634
|
+
return `- ${agent.name} (${parts.join(", ")}): ${agent.description}`;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function formatAgentListSections(agents: AgentConfig[], providerNames: Set<string> | undefined): string[] {
|
|
638
|
+
if (agents.length === 0) return ["- (none)"];
|
|
639
|
+
const sections: Array<[AgentSource, string]> = [
|
|
640
|
+
["package", "Package agents"],
|
|
641
|
+
["user", "User agents"],
|
|
642
|
+
["project", "Project agents"],
|
|
643
|
+
["runtime", "Runtime agents"],
|
|
644
|
+
["builtin", "Builtin agents"],
|
|
645
|
+
];
|
|
646
|
+
const lines: string[] = [];
|
|
647
|
+
for (const [source, label] of sections) {
|
|
648
|
+
const matches = agents.filter((agent) => agent.source === source);
|
|
649
|
+
if (matches.length === 0) continue;
|
|
650
|
+
if (lines.length > 0) lines.push("");
|
|
651
|
+
lines.push(label, ...matches.map((agent) => formatAgentListLine(agent, providerNames)));
|
|
652
|
+
}
|
|
653
|
+
return lines;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function formatRunnerDetail(agent: AgentConfig, providerNames: Set<string> | undefined): string | undefined {
|
|
657
|
+
if (!agent.runner) return undefined;
|
|
658
|
+
if (agent.runner.type === "external-job") return `Runner: external-job via ${agent.runner.provider} ${externalJobProviderSuffix(agent.runner.provider, providerNames)}`;
|
|
659
|
+
if (agent.runner.type === "external-cli") return `Runner: external-cli ${agent.runner.command}`;
|
|
660
|
+
return `Runner: ${JSON.stringify(agent.runner)}`;
|
|
661
|
+
}
|
|
662
|
+
|
|
593
663
|
function formatAgentDetail(agent: AgentConfig): string {
|
|
594
664
|
const tools = [...(agent.tools ?? []), ...(agent.mcpDirectTools ?? []).map((t) => `mcp:${t}`)];
|
|
665
|
+
const providerStatus = registeredExternalJobProviderStatus();
|
|
595
666
|
const lines: string[] = [`Agent: ${agent.name} (${agent.source})`, `Path: ${agent.filePath}`, `Description: ${agent.description}`];
|
|
667
|
+
if (agent.source === "package" && agent.packageSourceName) {
|
|
668
|
+
lines.push(`Source package: ${packageSourceLabel(agent)}`);
|
|
669
|
+
if (agent.packageSourceRoot) lines.push(`Package root: ${agent.packageSourceRoot}`);
|
|
670
|
+
}
|
|
596
671
|
if (agent.packageName) {
|
|
597
672
|
lines.push(`Local name: ${frontmatterNameForConfig(agent)}`);
|
|
598
673
|
lines.push(`Package: ${agent.packageName}`);
|
|
@@ -604,7 +679,12 @@ function formatAgentDetail(agent: AgentConfig): string {
|
|
|
604
679
|
if (agent.skills?.length) lines.push(`Skills: ${agent.skills.join(", ")}`);
|
|
605
680
|
if (agent.skillPath?.length) lines.push(`Skill paths: ${agent.skillPath.join(", ")}`);
|
|
606
681
|
lines.push(`System prompt mode: ${agent.systemPromptMode}`);
|
|
607
|
-
|
|
682
|
+
const runnerDetail = formatRunnerDetail(agent, providerStatus.ok ? providerStatus.names : undefined);
|
|
683
|
+
if (runnerDetail) {
|
|
684
|
+
lines.push(runnerDetail);
|
|
685
|
+
if (agent.runner?.type === "external-job" && !providerStatus.ok) lines.push(`External-job provider registry unavailable: ${providerStatus.error}`);
|
|
686
|
+
if (agent.runner?.type === "external-job" && agent.runner.options) lines.push(`Runner options: ${JSON.stringify(agent.runner.options)}`);
|
|
687
|
+
}
|
|
608
688
|
lines.push(`Inherit project context: ${agent.inheritProjectContext ? "true" : "false"}`);
|
|
609
689
|
lines.push(`Inherit skills: ${agent.inheritSkills ? "true" : "false"}`);
|
|
610
690
|
if (agent.defaultContext) lines.push(`Default context: ${agent.defaultContext}`);
|
|
@@ -654,16 +734,16 @@ export function handleList(params: ManagementParams, ctx: ManagementContext): Ag
|
|
|
654
734
|
...(ctx.config?.proactiveSkillSubagents !== undefined ? { config: ctx.config.proactiveSkillSubagents } : {}),
|
|
655
735
|
discoverAvailableSkills: () => discoverAvailableSkills(ctx.cwd),
|
|
656
736
|
});
|
|
737
|
+
const providerStatus = registeredExternalJobProviderStatus();
|
|
657
738
|
const lines = [
|
|
658
739
|
"Executable agents:",
|
|
659
|
-
...(agents.
|
|
660
|
-
? agents.map((a) => `- ${a.name} (${a.source}${a.defaultContext ? `, context: ${a.defaultContext}` : ""}${a.aliases?.length ? `, aliases: ${a.aliases.join(", ")}` : ""}): ${a.description}`)
|
|
661
|
-
: ["- (none)"]),
|
|
740
|
+
...formatAgentListSections(agents, providerStatus.ok ? providerStatus.names : undefined),
|
|
662
741
|
...(restrictedAgents.length ? [
|
|
663
742
|
"",
|
|
664
743
|
`Restricted agents (not executable in this session${restrictedSources?.length ? `; capability ceiling: ${restrictedSources.join(", ")}` : ""}):`,
|
|
665
|
-
...restrictedAgents.map((a) =>
|
|
744
|
+
...restrictedAgents.map((a) => formatAgentListLine(a, providerStatus.ok ? providerStatus.names : undefined)),
|
|
666
745
|
] : []),
|
|
746
|
+
...(!providerStatus.ok && [...agents, ...restrictedAgents].some((agent) => agent.runner?.type === "external-job") ? ["", `External-job provider registry unavailable: ${providerStatus.error}`] : []),
|
|
667
747
|
...(d.agentDiagnostics?.length ? [
|
|
668
748
|
"",
|
|
669
749
|
"Invalid agent definitions:",
|