@xzzpig/pi-subagents 0.18.0 → 0.20.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 +129 -0
- package/README.md +1 -1
- package/docs/agents.md +32 -16
- package/docs/configuration.md +76 -9
- package/docs/extension-api.md +6 -5
- package/docs/missions.md +28 -14
- package/docs/models.md +8 -4
- package/docs/observability.md +10 -5
- package/docs/standalone-background.md +1 -1
- package/docs/tool-reference.md +90 -88
- package/docs/workflows.md +171 -173
- package/node_modules/@xzzpig/pi-components/package.json +4 -4
- package/package.json +6 -6
- package/prompts/review-loop.md +1 -1
- package/skills/council-mode/SKILL.md +1 -1
- package/skills/pi-subagents/SKILL.md +12 -5
- package/skills/pi-subagents/references/constraints-and-recipes.md +3 -3
- package/skills/pi-subagents/references/execution-controls.md +68 -67
- package/skills/pi-subagents/references/management-authoring-rpc.md +2 -2
- package/skills/pi-subagents/references/multi-lane-orchestration.md +1 -1
- package/skills/pi-subagents/references/prompting-and-roles.md +45 -48
- package/src/agents/advertised-agent-prompt.ts +21 -41
- package/src/agents/agent-management.ts +2 -2
- package/src/agents/agents.ts +66 -3
- package/src/api/preflight.ts +109 -63
- package/src/extension/config.ts +15 -4
- package/src/extension/control-notices.ts +3 -0
- package/src/extension/doctor.ts +1 -0
- package/src/extension/fanout-child.ts +12 -3
- package/src/extension/herdr-pi-bridge.ts +2 -0
- package/src/extension/index.ts +90 -174
- package/src/extension/public-execution.ts +72 -35
- package/src/extension/reply-workflow-script.ts +58 -0
- package/src/extension/rpc.ts +29 -10
- package/src/extension/schemas.ts +40 -135
- package/src/extension/tool-activation.ts +57 -108
- package/src/extension/tool-description.ts +62 -27
- package/src/extension/upgrade-notice.ts +40 -0
- package/src/integrations/herdr-status.ts +19 -3
- package/src/intercom/native-supervisor-channel.ts +4 -1
- package/src/missions/goal-driver.ts +44 -31
- package/src/missions/store.ts +10 -1
- package/src/profiles/profiles.ts +5 -2
- package/src/runs/background/async-execution.ts +146 -59
- package/src/runs/background/async-job-tracker.ts +66 -24
- package/src/runs/background/async-retention.ts +46 -16
- package/src/runs/background/await-async-run.ts +78 -0
- package/src/runs/background/chain-root-attachment.ts +4 -4
- package/src/runs/background/control-channel.ts +61 -2
- package/src/runs/background/notify.ts +5 -0
- package/src/runs/background/run-child-session.ts +17 -7
- package/src/runs/background/run-status.ts +6 -0
- package/src/runs/background/runner-aliases.ts +37 -6
- package/src/runs/background/runner-child-launch.ts +3 -0
- package/src/runs/background/scheduled-runs.ts +33 -18
- package/src/runs/background/stale-run-reconciler.ts +13 -2
- package/src/runs/background/subagent-runner.ts +58 -5
- package/src/runs/foreground/async-stop-action.ts +17 -3
- package/src/runs/foreground/command-action.ts +41 -0
- package/src/runs/foreground/execution.ts +145 -131
- package/src/runs/foreground/subagent-executor.ts +546 -296
- package/src/runs/shared/async-status-projection.ts +5 -0
- package/src/runs/shared/child-commands.ts +228 -0
- package/src/runs/shared/child-launch.ts +15 -2
- package/src/runs/shared/child-session.ts +184 -24
- package/src/runs/shared/child-tool-plan.ts +16 -4
- package/src/runs/shared/claude-code-adapter.ts +157 -2
- package/src/runs/shared/dynamic-fanout.ts +2 -2
- package/src/runs/shared/external-cli-preflight.ts +54 -6
- package/src/runs/shared/external-cli-runner.ts +5 -1
- package/src/runs/shared/mcp-config-sources.ts +2 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +104 -11
- package/src/runs/shared/model-resolution.ts +38 -10
- package/src/runs/shared/model-scope.ts +28 -9
- package/src/runs/shared/nested-events.ts +55 -55
- package/src/runs/shared/parallel-utils.ts +4 -0
- package/src/runs/shared/pi-spawn.ts +7 -95
- package/src/runs/shared/run-history.ts +87 -0
- package/src/runs/shared/subagent-control.ts +32 -17
- package/src/runs/shared/subagent-prompt-runtime.ts +14 -6
- package/src/runs/shared/worktree.ts +1 -1
- package/src/shared/disabled-features.ts +123 -0
- package/src/shared/extension-context.ts +13 -0
- package/src/shared/model-info.ts +9 -0
- package/src/shared/required-child-extensions.ts +39 -5
- package/src/shared/settings.ts +1 -1
- package/src/shared/types.ts +27 -1
- package/src/slash/prompt-template-bridge.ts +2 -2
- package/src/slash/slash-commands.ts +10 -5
- package/src/slash/subagent-cost.ts +9 -5
- package/src/slash/subagents-admin.ts +24 -24
- package/src/tui/fleet-status.ts +14 -6
- package/src/tui/fleet.ts +14 -2
- package/src/tui/render.ts +117 -56
- package/src/tui/running-tone.ts +28 -0
- package/src/watchdog/diff-tool.ts +23 -9
- package/src/watchdog/register-child.ts +3 -3
- package/src/watchdog/register-main.ts +3 -3
- package/src/watchdog/review.ts +2 -2
- package/src/watchdog/turn-delta.ts +1 -1
- package/src/workflows/chat-progress.ts +2 -2
- package/src/workflows/scripted-workflow.ts +117 -37
- package/src/workflows/structured-workflow-scripts.ts +177 -0
- package/src/workflows/workflow-checklist.ts +6 -0
- package/src/workflows/workflow-receipt.ts +10 -4
- package/src/workflows/workflow-resources.ts +44 -16
- package/src/workflows/workflow-reuse.ts +120 -0
- package/src/workflows/workflow-revival.ts +123 -0
package/docs/workflows.md
CHANGED
|
@@ -25,6 +25,10 @@ A failure in the subagent workflow, child launch, prompt runtime, extension load
|
|
|
25
25
|
|
|
26
26
|
Stop and report the exact failure, run/status, and repository/cwd/worktree/branch/ref state. Before a same-protocol retry or asking the owner, verify the worktree is clean or capture the partial diff. Retry or fix the `subagent` path only through a clear same-protocol action. For backlog lanes and other subagent-governed workflows, external/foreground/CLI fallback requires explicit owner approval. `interactive_shell` remains valid when the user explicitly requests visible foreground/CLI work or the task is outside the governed subagent protocol.
|
|
27
27
|
|
|
28
|
+
Failed workflow details and async `status.json` include `workflow.failureKind` as `validation`, `script`, `child`, `return-serialization`, `timeout`, `detached-child`, or `runtime`. `validation` means the host rejected the script before it ran (syntax or portability) or at completion (unawaited calls); errors thrown into a running script, including rejected `runs.run` parameters and runtime `SyntaxError`s, are `script` because the script could catch them, and failed children are `child`. `runtime` covers host setup and infrastructure failures, such as an unavailable cwd or a crashed worker. A workflow that is stopped or reloaded is not a failure and has no `failureKind`.
|
|
29
|
+
|
|
30
|
+
When `/reload`, a session resume, or a pi-web project switch replaces the extension runtime, a running async workflow stops with `workflow.stopCause: "runtime-replaced"` in `status.json`, and its awaited async children keep running. When the same workflow script is launched again with the same `args` in that session, a `runs.run` with the same key and params returns a child that already finished successfully without launching it, and waits for a child that is still running instead of starting another. Those results carry `reused: true`, their step and trace entry are marked `reused`, and the new run records `workflow.reusedFrom`. Failed and stopped children, and children that ran in-process, launch again. Reuse applies only when the newest run of that script and args in the session was stopped this way; a user stop or a completed run ends it.
|
|
31
|
+
|
|
28
32
|
Pi core may print a generic `pi -ne` extension-load hint; that out-of-repo hint is not protocol-approved fallback. A verified compaction abort may continue the retained child once on its already resolved model; it does not authorize an execution-mode or model switch.
|
|
29
33
|
|
|
30
34
|
## Prompt shortcuts
|
|
@@ -41,9 +45,17 @@ The package includes reusable prompt templates for common workflows. You do not
|
|
|
41
45
|
|
|
42
46
|
Add `autofix` to `/parallel-review` or `/parallel-cleanup` to apply only the synthesized fixes worth doing now after reviewers return.
|
|
43
47
|
|
|
44
|
-
## Scripted workflows
|
|
48
|
+
## Scripted workflows
|
|
49
|
+
|
|
50
|
+
Use direct `{ agent, task }` for one bounded child. Use a workflow script when the parent needs a stable keyed child, sequence, fanout, steering, retry, or aggregation. For ordinary parallel fanout, use `await runs.all([{ key, agent, task }, ...])`. It resolves to an ordered array, not a key map, so use indexes, destructuring, or `.map(...)`, not `results.<key>`. Do not read `.output` from unawaited `runs.run` launches. Store a `runs.run` promise only when the script later observes it with `await`, `Promise.race`, or `Promise.all`, such as steering a live child before awaiting its result. Scripts are ordinary JavaScript statement bodies. Use an explicit `return` for a useful result.
|
|
51
|
+
|
|
52
|
+
The `workflow` field selects the script source:
|
|
53
|
+
|
|
54
|
+
- `workflow: true` runs the one ```` ```js workflow ```` fenced block written in the same assistant reply as the `subagent` call. The script is plain text in the reply, so it needs no JSON string escaping. A reply can carry exactly one such block and one `workflow: true` call; zero or several blocks fail. A line containing only ```` ``` ```` (three or more backticks, optionally followed by spaces or tabs) ends the block, so keep Markdown fences inside quoted strings.
|
|
55
|
+
- A string containing `/` (or `\` in a Windows path), such as `workflow: "./workflows/review.js"`, is a script file.
|
|
56
|
+
- Any other string, such as `workflow: "review"`, is a [named workflow resource](#named-workflow-resources-for-permission-extensions). The string `"true"` is read as `workflow: true`, because some MCP clients send the boolean as a string.
|
|
45
57
|
|
|
46
|
-
|
|
58
|
+
`workflow: true` works only from a model tool call. Slash commands, RPC, and schedules pass scripts through their own inputs. Examples below that show only a ```` ```js workflow ```` block run with `subagent({ workflow: true })` in the same reply.
|
|
47
59
|
|
|
48
60
|
For multi-step or parallel work, make exactly one top-level `subagent` workflow call with `async:true` and launch children only inside it. Read this guide for recipes rather than constructing a second top-level orchestration. Available sandbox helpers include `runs.run`, `runs.all`, `runs.lanes`, `runs.steer`, `runs.status`, `runs.ref`/`runs.refs`, `emit`, `console`, standard JavaScript, and mission `state` when enabled. No filesystem, shell, arbitrary Pi tools, or host globals are available; named resources alone may grant `runs.host` authority.
|
|
49
61
|
|
|
@@ -57,26 +69,28 @@ A workflow can finish dispatch while these children remain running. Its summary
|
|
|
57
69
|
|
|
58
70
|
Validate a script without launching children:
|
|
59
71
|
|
|
72
|
+
```js workflow
|
|
73
|
+
const results = await runs.all([{ key: "scan", agent: "scout", task: "Scan" }]);
|
|
74
|
+
return results[0].output;
|
|
75
|
+
```
|
|
76
|
+
|
|
60
77
|
```js
|
|
61
|
-
subagent({ action: "validate",
|
|
62
|
-
const results = await runs.all([{ key: "scan", agent: "scout", task: "Scan" }]);
|
|
63
|
-
return results[0].output;
|
|
64
|
-
` });
|
|
78
|
+
subagent({ action: "validate", workflow: true });
|
|
65
79
|
```
|
|
66
80
|
|
|
67
|
-
For a script stored in a file,
|
|
81
|
+
For a script stored in a file, pass its path:
|
|
68
82
|
|
|
69
83
|
```js
|
|
70
|
-
subagent({
|
|
71
|
-
subagent({ action: "validate",
|
|
84
|
+
subagent({ workflow: "./workflows/review.js", cwd: "/path/to/project" });
|
|
85
|
+
subagent({ action: "validate", workflow: "./workflows/review.js" });
|
|
72
86
|
```
|
|
73
87
|
|
|
74
|
-
|
|
88
|
+
Relative paths resolve against the request `cwd`; absolute paths pass through. The host reads the file before validation, schedule creation, or workflow sandbox execution. The sandbox still has no filesystem access. Missing, unreadable, and empty files return file input errors instead of script syntax errors.
|
|
75
89
|
|
|
76
|
-
|
|
90
|
+
Reply-block and file-backed scripts accept bounded plain-JSON `args`:
|
|
77
91
|
|
|
78
92
|
```js
|
|
79
|
-
subagent({
|
|
93
|
+
subagent({ workflow: "./workflows/review.js", args: { target: "src/workflows" } });
|
|
80
94
|
// workflows/review.js
|
|
81
95
|
return runs.run("review", { agent: "reviewer", task: `Review ${args.target}` });
|
|
82
96
|
```
|
|
@@ -92,18 +106,20 @@ subagent({ workflow: "review", args: { task: "Review the change" } });
|
|
|
92
106
|
subagent({ workflow: "run-ci", args: { command: "npm test" } });
|
|
93
107
|
```
|
|
94
108
|
|
|
95
|
-
The host resolves the name and validates bounded plain-JSON `args` before starting the workflow. Resource provenance is recorded in workflow details and receipts for downstream permission/policy checks. Resource authority is not caller-supplied: `runs.host` is available only when the resolved resource explicitly grants the requested host key and command.
|
|
109
|
+
The host resolves the name and validates bounded plain-JSON `args` before starting the workflow. Resource provenance is recorded in workflow details and receipts for downstream permission/policy checks. Resource authority is not caller-supplied: `runs.host` is available only when the resolved resource explicitly grants the requested host key and command. Reply-block (`workflow: true`) and file-path scripts remain raw, unknown-provenance inputs, so their `runs.host` calls are unavailable through the public execution boundary. Named resources cannot be combined with `agent` or `task`; this first slice ships only the package-owned `review` and `run-ci` resources, not a user/project resource registry.
|
|
96
110
|
|
|
97
111
|
### Opt-in bounded workflows
|
|
98
112
|
|
|
99
113
|
Composite workflows have no default parent deadline. Add bounds only when the workflow contract calls for them:
|
|
100
114
|
|
|
115
|
+
```js workflow
|
|
116
|
+
const scan = await runs.run("scan", { agent: "scout", task: "Inspect the named files." });
|
|
117
|
+
return runs.run("review", { agent: "reviewer", task: "Review:\n" + scan.output });
|
|
118
|
+
```
|
|
119
|
+
|
|
101
120
|
```js
|
|
102
121
|
subagent({
|
|
103
|
-
|
|
104
|
-
const scan = await runs.run("scan", { agent: "scout", task: "Inspect the named files." });
|
|
105
|
-
return runs.run("review", { agent: "reviewer", task: "Review:\n" + scan.output });
|
|
106
|
-
`,
|
|
122
|
+
workflow: true,
|
|
107
123
|
timeoutMs: 900000,
|
|
108
124
|
toolBudget: { soft: 40, hard: 60 },
|
|
109
125
|
usageBudget: { tokens: { soft: 100000, hard: 150000 } }
|
|
@@ -118,80 +134,76 @@ subagent({
|
|
|
118
134
|
|
|
119
135
|
These controls are opt-in. Avoid tight hard budgets for mutation-capable workers unless the workflow has an explicit checkpoint and handoff path.
|
|
120
136
|
|
|
121
|
-
The optional `preflight` lane hints apply only to raw `
|
|
137
|
+
The optional `preflight` lane hints apply only to raw scripts (`workflow: true` or a script path), not named workflows or direct child calls. They are display-only: mismatched coverage warns but never changes execution authority.
|
|
122
138
|
|
|
123
|
-
The result is `{ ok, errors }`. Invalid scripts return a tool error and include line and column data when available. Validation checks syntax, portable nested-async rules, literal `runs.run` and `runs.all` keys and child `baseRef` values, duplicate literal keys in one `runs.all` group, direct keyed access to a known `runs.all` result, and statically clear non-JSON boundary values. Dynamic keys and other runtime-only values are accepted without a warning. Validation does not
|
|
139
|
+
The result is `{ ok, errors }`. Invalid scripts return a tool error and include line and column data when available. Validation checks syntax, portable nested-async rules, literal `runs.run` and `runs.all` keys and child `baseRef` values, duplicate literal keys in one `runs.all` group, direct keyed access to a known `runs.all` result, and statically clear non-JSON boundary values. It also looks up literal `agent` names in `runs.run`, `runs.all`, and `runs.lanes` children against the agents discovered for the request `cwd` and `agentScope`, and reports unknown or ambiguous names with a close match when one exists. Children with their own `cwd`, `agentScope`, or `resume`, object spreads, and names built at runtime are left to launch time. Dynamic keys and other runtime-only values are accepted without a warning. Validation does not launch children or create run artifacts. Executing a workflow runs the same agent-name check first, so an unknown literal agent fails before any child launches.
|
|
140
|
+
|
|
141
|
+
```js workflow
|
|
142
|
+
const scan = await runs.run("scan", { label: "Map codebase behavior", agent: "scout", task: "Scan the codebase" });
|
|
143
|
+
const reviews = await runs.all([
|
|
144
|
+
{ key: "correctness", label: "Review codebase correctness", agent: "reviewer", task: "Review correctness: " + scan.output },
|
|
145
|
+
{ key: "tests", label: "Review test coverage", agent: "reviewer", task: "Review tests: " + scan.output }
|
|
146
|
+
]);
|
|
147
|
+
return reviews.map(result => result.output);
|
|
148
|
+
```
|
|
124
149
|
|
|
125
150
|
```js
|
|
126
|
-
subagent({
|
|
127
|
-
const scan = await runs.run("scan", { label: "Map codebase behavior", agent: "scout", task: "Scan the codebase" });
|
|
128
|
-
const reviews = await runs.all([
|
|
129
|
-
{ key: "correctness", label: "Review codebase correctness", agent: "reviewer", task: "Review correctness: " + scan.output },
|
|
130
|
-
{ key: "tests", label: "Review test coverage", agent: "reviewer", task: "Review tests: " + scan.output }
|
|
131
|
-
]);
|
|
132
|
-
return reviews.map(result => result.output);
|
|
133
|
-
` });
|
|
151
|
+
subagent({ workflow: true });
|
|
134
152
|
```
|
|
135
153
|
|
|
136
|
-
Keep helper functions portable across Node and Bun. Use top-level `await`, plain helper functions that return `runs.run(...)`, or explicit Promise chains. Do not define nested `async function` helpers, async arrows, or async methods inside
|
|
154
|
+
Keep helper functions portable across Node and Bun. Use top-level `await`, plain helper functions that return `runs.run(...)`, or explicit Promise chains. Do not define nested `async function` helpers, async arrows, or async methods inside a workflow script; native async helpers hide child-launch observation in Bun and are rejected.
|
|
137
155
|
|
|
138
|
-
```js
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return result.output;
|
|
145
|
-
` });
|
|
156
|
+
```js workflow
|
|
157
|
+
function scan() {
|
|
158
|
+
return runs.run("scan", { label: "Map codebase behavior", agent: "scout", task: "Scan the codebase" });
|
|
159
|
+
}
|
|
160
|
+
const result = await scan();
|
|
161
|
+
return result.output;
|
|
146
162
|
```
|
|
147
163
|
|
|
148
164
|
Chaining is still supported. The supported form is scripted chaining: await one `runs.run(...)` result, then pass its output into the next step. Parallel fanout uses `runs.all(...)` inside the same script.
|
|
149
165
|
|
|
150
|
-
```js
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return patch.output;
|
|
155
|
-
` });
|
|
166
|
+
```js workflow
|
|
167
|
+
const plan = await runs.run("plan", { label: "Plan migration behavior", agent: "scout", task: "Plan the migration" });
|
|
168
|
+
const patch = await runs.run("patch", { label: "Implement migration behavior", agent: "worker", task: "Implement this plan:\n" + plan.output });
|
|
169
|
+
return patch.output;
|
|
156
170
|
```
|
|
157
171
|
|
|
158
172
|
### Parallel sequential lanes
|
|
159
173
|
|
|
160
|
-
For a bounded set of independent chains, `runs.lanes(...)` removes the mechanical loop that would otherwise connect each lane's stages. It is a helper inside
|
|
161
|
-
|
|
162
|
-
```js
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}));
|
|
194
|
-
` });
|
|
174
|
+
For a bounded set of independent chains, `runs.lanes(...)` removes the mechanical loop that would otherwise connect each lane's stages. It is a helper inside a workflow script, not a new top-level `subagent` execution mode:
|
|
175
|
+
|
|
176
|
+
```js workflow
|
|
177
|
+
const board = await runs.lanes([
|
|
178
|
+
{
|
|
179
|
+
key: "api",
|
|
180
|
+
stages: [
|
|
181
|
+
{ key: "writer", label: "Implement API behavior", agent: "worker", task: "Implement the API change" },
|
|
182
|
+
{ key: "challenge", label: "Challenge API behavior", resume: "previous", task: "Challenge the API implementation" },
|
|
183
|
+
{ key: "review", label: "Review API behavior", agent: "reviewer", task: "Review the API lane" }
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
key: "ui",
|
|
188
|
+
stages: [
|
|
189
|
+
{ key: "writer", label: "Implement UI behavior", agent: "worker", task: "Implement the UI change" },
|
|
190
|
+
{ key: "review", label: "Review UI behavior", agent: "reviewer", task: "Review the UI lane" }
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
]);
|
|
194
|
+
return board.map((lane) => ({
|
|
195
|
+
key: lane.key,
|
|
196
|
+
state: lane.state,
|
|
197
|
+
failedStage: lane.failedStage,
|
|
198
|
+
stages: lane.stages.map((stage) => ({
|
|
199
|
+
key: stage.key,
|
|
200
|
+
state: stage.state,
|
|
201
|
+
ok: stage.ok,
|
|
202
|
+
runId: stage.runId,
|
|
203
|
+
outputReference: stage.outputReference,
|
|
204
|
+
verdict: stage.verdict
|
|
205
|
+
}))
|
|
206
|
+
}));
|
|
195
207
|
```
|
|
196
208
|
|
|
197
209
|
The first stage from every lane is launched in one existing `runs.all(...)` batch. Later stages in each lane start only after the preceding stage settles. A later stage with `resume: "previous"` requires the preceding child to return a retained `runId`; the helper then uses the existing retained-resume launch checks and does not accept an arbitrary run id. Generated child keys use `<lane>.<stage>`, while the returned board uses the local lane and stage keys.
|
|
@@ -206,18 +218,16 @@ Two ways to put a small classifier (a script, a lookup, a fast evaluation model)
|
|
|
206
218
|
|
|
207
219
|
**A typed gate** runs a command after a child finishes and turns its JSON stdout into that child's `structuredOutput`:
|
|
208
220
|
|
|
209
|
-
```js
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return { verdict: review.structuredOutput.verdict, report: "reports/review.md" };
|
|
220
|
-
` });
|
|
221
|
+
```js workflow
|
|
222
|
+
const review = await runs.run("review", {
|
|
223
|
+
agent: "reviewer", task: args.packet,
|
|
224
|
+
output: "reports/review.md", outputMode: "file-only",
|
|
225
|
+
gate: { command: "classify --report reports/review.md", output: "json" }
|
|
226
|
+
});
|
|
227
|
+
if (review.structuredOutput.verdict === "blocked") {
|
|
228
|
+
return runs.run("fix", { agent: "worker", task: "Fix the findings in reports/review.md" });
|
|
229
|
+
}
|
|
230
|
+
return { verdict: review.structuredOutput.verdict, report: "reports/review.md" };
|
|
221
231
|
```
|
|
222
232
|
|
|
223
233
|
The parent receives a pointer plus a verdict instead of the review text. See [typed gates](tool-reference.md#typed-gates) for the contract and failure rules.
|
|
@@ -262,13 +272,11 @@ The first named resource version supports only `npm test` and `npm run typecheck
|
|
|
262
272
|
|
|
263
273
|
Use `await runs.steer(key, message, options?)` after `runs.run` or `runs.all` has launched that stable key. Scripts do not target raw run ids. The optional fields are `mode: "steer" | "follow_up" | "auto"`, a non-negative child `index`, and a positive `ackTimeoutMs`.
|
|
264
274
|
|
|
265
|
-
```js
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return { writer: await writer, receipt };
|
|
271
|
-
` });
|
|
275
|
+
```js workflow
|
|
276
|
+
const writer = runs.run("writer", { agent: "worker", task: "Implement the change" });
|
|
277
|
+
const evidence = await runs.run("evidence", { agent: "scout", task: "Find the exact contract" });
|
|
278
|
+
const receipt = await runs.steer("writer", "Also check: " + evidence.output, { mode: "follow_up" });
|
|
279
|
+
return { writer: await writer, receipt };
|
|
272
280
|
```
|
|
273
281
|
|
|
274
282
|
The receipt state is `queued`, `delivered`, `missed`, or `failed`. For an async child, `delivered` means it consumed the correlated user input; for a foreground child, it means the in-process Pi transport accepted the input. It does not mean the model followed it. `missed` means the keyed child became terminal or had no live route before delivery. This first slice uses the existing foreground and async steering transports but does not start steering recovery. Workflow traces include one steering attempt entry and one receipt entry.
|
|
@@ -279,111 +287,99 @@ Always await or return a `runs.steer` promise. The workflow waits for an observe
|
|
|
279
287
|
|
|
280
288
|
`runs.run` starts a keyed child when you call it. You do not need separate `runs.start`, `runs.next`, or `runs.collect` helpers for rolling councils or staged reviews. This is the advanced exception to ordinary `runs.all` fanout: keep launched promises only when the script later observes each one with direct `await`, `Promise.race`, or `Promise.all`. Use `Promise.race` to wait for the next completed child, steer a still-running sibling by its stable key, and use `Promise.all` to collect the remaining children.
|
|
281
289
|
|
|
282
|
-
```js
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
];
|
|
290
|
+
```js workflow
|
|
291
|
+
let pending = [
|
|
292
|
+
{ key: "analysis-a", promise: runs.run("analysis-a", { agent: "reviewer", task: "Analyze option A" }).then((result) => ({ key: "analysis-a", result })) },
|
|
293
|
+
{ key: "analysis-b", promise: runs.run("analysis-b", { agent: "reviewer", task: "Analyze option B" }).then((result) => ({ key: "analysis-b", result })) },
|
|
294
|
+
{ key: "critic", promise: runs.run("critic", { agent: "reviewer", task: "Find the strongest objection" }).then((result) => ({ key: "critic", result })) }
|
|
295
|
+
];
|
|
289
296
|
|
|
290
|
-
|
|
291
|
-
|
|
297
|
+
const first = await Promise.race(pending.map((child) => child.promise));
|
|
298
|
+
pending = pending.filter((child) => child.key !== first.key);
|
|
292
299
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
300
|
+
const target = pending.find((child) => child.key === "critic") ?? pending[0];
|
|
301
|
+
const receipt = await runs.steer(target.key, "Challenge this early result:\n" + first.result.output, { mode: "auto" });
|
|
302
|
+
const rest = await Promise.all(pending.map((child) => child.promise));
|
|
296
303
|
|
|
297
|
-
|
|
298
|
-
` });
|
|
304
|
+
return { first: first.result.output, rest: rest.map((child) => child.result.output), receipt };
|
|
299
305
|
```
|
|
300
306
|
|
|
301
307
|
The workflow trace records the run completions and steering receipt. Scripts cannot access the filesystem or control inboxes; returned run and artifact references are data only. If the keyed child is terminal, stale, or has no live route when `runs.steer` runs, the receipt reports `missed` or `failed` and the script can decide whether to continue.
|
|
302
308
|
|
|
303
309
|
Use named outputs when later workflow steps need structured data or durable references:
|
|
304
310
|
|
|
305
|
-
```js
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
});
|
|
321
|
-
` });
|
|
311
|
+
```js workflow
|
|
312
|
+
const inventory = await runs.run("inventory", {
|
|
313
|
+
agent: "scout",
|
|
314
|
+
task: "List the files that need review.",
|
|
315
|
+
outputSchema: {
|
|
316
|
+
type: "object",
|
|
317
|
+
properties: { files: { type: "array", items: { type: "string" } } },
|
|
318
|
+
required: ["files"],
|
|
319
|
+
additionalProperties: false
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
return runs.run("review", {
|
|
323
|
+
agent: "reviewer",
|
|
324
|
+
task: "Review these files: " + inventory.structuredOutput.files.join(", ")
|
|
325
|
+
});
|
|
322
326
|
```
|
|
323
327
|
|
|
324
328
|
For dynamic fanout, have one step return a structured list, check it in JavaScript, then map the bounded entries into `runs.all(...)`:
|
|
325
329
|
|
|
326
|
-
```js
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
})));
|
|
344
|
-
` });
|
|
330
|
+
```js workflow
|
|
331
|
+
const targets = await runs.run("targets", {
|
|
332
|
+
agent: "scout",
|
|
333
|
+
task: "Return up to five source files that need review.",
|
|
334
|
+
outputSchema: {
|
|
335
|
+
type: "object",
|
|
336
|
+
properties: { files: { type: "array", items: { type: "string" }, maxItems: 5 } },
|
|
337
|
+
required: ["files"],
|
|
338
|
+
additionalProperties: false
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
const files = targets.structuredOutput.files.slice(0, 5);
|
|
342
|
+
return runs.all(files.map((file, index) => ({
|
|
343
|
+
key: "review-" + index,
|
|
344
|
+
agent: "reviewer",
|
|
345
|
+
task: "Review " + file
|
|
346
|
+
})));
|
|
345
347
|
```
|
|
346
348
|
|
|
347
349
|
For intermediate data that only later steps need, prefer the prior child's returned output or `structuredOutput` instead of writing shared files:
|
|
348
350
|
|
|
349
|
-
```js
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return runs.run("fix", { agent: "worker", task: "Implement these findings:\n" + scan.output });
|
|
353
|
-
` });
|
|
351
|
+
```js workflow
|
|
352
|
+
const scan = await runs.run("scan", { agent: "scout", task: "Find the files that need fixes." });
|
|
353
|
+
return runs.run("fix", { agent: "worker", task: "Implement these findings:\n" + scan.output });
|
|
354
354
|
```
|
|
355
355
|
|
|
356
356
|
`{chain_dir}` remains available inside scripted workflow step templates for legacy-compatible path templates. It expands to the workflow cwd, not to private temporary storage.
|
|
357
357
|
|
|
358
358
|
### Migrating old chain shapes
|
|
359
359
|
|
|
360
|
-
Legacy top-level `chain`, `tasks`, `parallel`, `chainDir`, `/chain`, `/parallel`, `/run-chain`, and durable `.chain.md` execution are no longer the public workflow API. Rewrite them as JavaScript:
|
|
360
|
+
Legacy top-level `chain`, `tasks`, `parallel`, `chainDir`, `/chain`, `/parallel`, `/run-chain`, and durable `.chain.md` execution are no longer the public workflow API. Rewrite them as JavaScript. The exception is `disabledFeatures: ["workflow-scripts"]`, which replaces workflow scripts with top-level `chain` and `tasks` (see [configuration](configuration.md#chain-and-tasks-without-workflow-scripts)).
|
|
361
361
|
|
|
362
|
-
```js
|
|
362
|
+
```js workflow
|
|
363
363
|
// Old shape, no longer supported:
|
|
364
364
|
// { chain: [{ agent: "scout", task: "Scan" }, { agent: "worker", task: "Fix from {previous}" }] }
|
|
365
365
|
|
|
366
|
-
// Current shape:
|
|
367
|
-
{
|
|
368
|
-
|
|
369
|
-
return runs.run("fix", { agent: "worker", task: "Fix from: " + scan.output });
|
|
370
|
-
` }
|
|
366
|
+
// Current shape: this ```js workflow block plus subagent({ workflow: true })
|
|
367
|
+
const scan = await runs.run("scan", { agent: "scout", task: "Scan" });
|
|
368
|
+
return runs.run("fix", { agent: "worker", task: "Fix from: " + scan.output });
|
|
371
369
|
```
|
|
372
370
|
|
|
373
|
-
```js
|
|
371
|
+
```js workflow
|
|
374
372
|
// Old shape, no longer supported:
|
|
375
373
|
// { tasks: [{ agent: "reviewer", task: "Review API" }, { agent: "reviewer", task: "Review UI" }] }
|
|
376
374
|
|
|
377
|
-
// Current shape:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
]);
|
|
383
|
-
` }
|
|
375
|
+
// Current shape: this ```js workflow block plus subagent({ workflow: true })
|
|
376
|
+
return runs.all([
|
|
377
|
+
{ key: "api", agent: "reviewer", task: "Review API" },
|
|
378
|
+
{ key: "ui", agent: "reviewer", task: "Review UI" }
|
|
379
|
+
]);
|
|
384
380
|
```
|
|
385
381
|
|
|
386
|
-
For long task text with Markdown fences or shell blocks, use quoted lines instead of a raw template literal:
|
|
382
|
+
For long task text with Markdown fences or shell blocks, use quoted lines instead of a raw template literal. In a reply block, a line containing only ```` ``` ```` would end the block:
|
|
387
383
|
|
|
388
384
|
````js
|
|
389
385
|
const task = [
|
|
@@ -399,9 +395,9 @@ A plain workflow creates one enclosing mission by default. Its children do not c
|
|
|
399
395
|
|
|
400
396
|
### Repeatable workflows
|
|
401
397
|
|
|
402
|
-
Use stable child keys and keep process logic in ordinary JavaScript. `runs.run` launches one child, `runs.all` launches independent children together, and later steps can use each completed child's `output`. Put long task text in arrays joined with `"\n"` so Markdown fences do not conflict with the script string.
|
|
398
|
+
Use stable child keys and keep process logic in ordinary JavaScript. `runs.run` launches one child, `runs.all` launches independent children together, and later steps can use each completed child's `output`. Put long task text in arrays joined with `"\n"` so Markdown fences do not conflict with the script string. Pass long child briefs as files and put only their paths in task text, not the briefs themselves in `args`, which is limited to 16 KiB.
|
|
403
399
|
|
|
404
|
-
For a process you run often, save the task as a prompt template under `.pi/prompts/` or `~/.pi/agent/prompts/` and launch it with `/prompt-workflow`. The adapter compiles prompt steps into
|
|
400
|
+
For a process you run often, save the task as a prompt template under `.pi/prompts/` or `~/.pi/agent/prompts/` and launch it with `/prompt-workflow`. The adapter compiles prompt steps into a workflow script, so templates describe the work instead of embedding raw `subagent` tool calls. You can ask the parent agent to create or update these prompt files from a process described in natural language.
|
|
405
401
|
|
|
406
402
|
```md
|
|
407
403
|
---
|
|
@@ -426,6 +422,8 @@ For watched same-repo workflows, pass `async:false` only when the parent must bl
|
|
|
426
422
|
|
|
427
423
|
Synchronous workflows publish trace and `emit(...)` updates through the tool update callback regardless of `chatProgress`, including RPC/headless and cross-repository runs. These updates include `details.workflow` and `details.workflowChildren`; `chatProgress: "off"` disables the live card, not transport progress. Running foreground child rows additionally expose bounded `activity` (current tool, timing, and counters), plus resolved model/thinking when available, keyed by `childId`. Activity-only updates coalesce over 100 ms; lifecycle updates remain immediate. Activity clears when children settle, and is not persisted for async workflows. Tool names are limited to 256 UTF-8 bytes and each activity object is below 2 KiB (including JSON escaping); arguments and transcripts are not forwarded.
|
|
428
424
|
|
|
425
|
+
The workflow result text keeps the Return, Emitted, and Console sections, and a failed workflow's error, under 200 KB and 5000 lines, or under `maxOutput` when set. Each call-trace error is cut to 500 characters. A cut adds a `[TRUNCATED: ... - full output at <path>]` line. The full text goes to the workflow `output` file when one is set, otherwise to `<run>_workflow-result.md` in the run's artifacts directory, outside the `outputs/` tree where children save their reports. That file has the same retention as the other run artifacts: age-based cleanup removes it from temp and session artifact directories, and `artifactDir: "project"` files are kept. The status line, the rest of each trace line, warnings, and output-path mappings are never cut. Async completion notices and `action: "status"` show short previews; a cut preview or async error ends in `…` and names the run's `status.json`, which holds the full `workflow.value`, `workflow.emits`, and `error`.
|
|
426
|
+
|
|
429
427
|
The legacy `/chain`, `/parallel`, and `/run-chain` commands are not registered.
|
|
430
428
|
|
|
431
429
|
## Direct commands
|
|
@@ -446,11 +444,11 @@ return { api: api.artifactPaths, ui: ui.artifactPaths };
|
|
|
446
444
|
|
|
447
445
|
Each child uses the existing worktree lifecycle: it branches from clean HEAD, journals ownership before launch, captures a patch and handoff manifest, then removes cleanly captured temporary worktrees and branches. The handoff manifest path remains available in the child's `artifactPaths`; return or emit it when the orchestrator needs to apply or inspect the patches. `runs.ref` stays concise and intentionally omits full paths.
|
|
448
446
|
|
|
449
|
-
A top-level `{
|
|
447
|
+
A top-level `{ workflow: true, worktree: true }` makes isolation the default for every workflow child. An individual child can override that default with `worktree: false`. Keep one writer when parallel writes are not intentionally isolated.
|
|
450
448
|
|
|
451
449
|
Before a materialized `runs.run` or `runs.all` group dispatches fresh children, isolated sources must be Git repositories with clean working trees (excluding `.pi/subagents/` runtime state). A rejected group dispatches no children and spends no fan-out slots or child output claims; key-level failure traces can remain. Checks are shared only within that group, are cancellable, and run again at allocation because sources can change. Retained resumes keep their stored contracts. Select the correct cwd or arrange an operator-approved commit/stash; isolation is never dropped automatically.
|
|
452
450
|
|
|
453
|
-
Use `baseRef` to branch managed worktrees from `HEAD` or a supported named ref such as `refs/heads/release`, `refs/tags/v1`, or `origin/main`. Full 40/64-character commit IDs and revision expressions such as `HEAD~1` are unsupported. For example, `{
|
|
451
|
+
Use `baseRef` to branch managed worktrees from `HEAD` or a supported named ref such as `refs/heads/release`, `refs/tags/v1`, or `origin/main`. Full 40/64-character commit IDs and revision expressions such as `HEAD~1` are unsupported. For example, `{ workflow: true, worktree: true, baseRef: "refs/heads/release" }` applies the release ref to children unless a child supplies its own `baseRef`. If omitted, the default `HEAD` is resolved at worktree allocation, not when the script is validated or a schedule is created. The source checkout must still be clean, and the ref must resolve to a commit before any worktree is allocated.
|
|
454
452
|
|
|
455
453
|
Configure the worktree provider, native path layout, base directory, and setup hook in [configuration.md](configuration.md).
|
|
456
454
|
|
|
@@ -519,7 +517,7 @@ For A → B → C, C's request belongs to B, not A. B can escalate a separate qu
|
|
|
519
517
|
|
|
520
518
|
Child-side routine completion handoffs are not expected. If a child appears stalled, needs-attention notices show up in the parent session with useful next actions, such as checking `subagent({ action: "status" })`, interrupting the run, or nudging the child.
|
|
521
519
|
|
|
522
|
-
If a
|
|
520
|
+
If a workflow script child detaches through `contact_supervisor`, the enclosing async workflow stays `paused` until that child exits. Then the extension reconciles it to `complete` or `failed`. Wait on the child until that happens.
|
|
523
521
|
|
|
524
522
|
If messages do not show up, run `/subagents-doctor`. Advanced users can tune the bridge with `intercomBridge` in [configuration.md](configuration.md).
|
|
525
523
|
|
|
@@ -567,4 +565,4 @@ Then run it through the native adapter:
|
|
|
567
565
|
|
|
568
566
|
The adapter delegates to the named subagent, applies `model`, `skill`, `cwd`, and fork/fresh context metadata, and supports runtime overrides such as `--subagent reviewer`, `--fork`, `--fresh`, and `--bg`.
|
|
569
567
|
|
|
570
|
-
Prompt templates with `chain:` frontmatter are translated into
|
|
568
|
+
Prompt templates with `chain:` frontmatter are translated into a workflow script and launched through `/prompt-workflow`; `/chain-prompts` is no longer registered.
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"test": "vitest --run"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@earendil-works/pi-ai": ">=0.
|
|
35
|
-
"@earendil-works/pi-coding-agent": ">=0.
|
|
36
|
-
"@earendil-works/pi-tui": ">=0.
|
|
34
|
+
"@earendil-works/pi-ai": ">=1.0.0 <2",
|
|
35
|
+
"@earendil-works/pi-coding-agent": ">=1.0.0 <2",
|
|
36
|
+
"@earendil-works/pi-tui": ">=1.0.0 <2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@earendil-works/pi-ai": "
|
|
39
|
+
"@earendil-works/pi-ai": "catalog:",
|
|
40
40
|
"@earendil-works/pi-coding-agent": "catalog:",
|
|
41
41
|
"@earendil-works/pi-tui": "catalog:",
|
|
42
42
|
"@types/node": "catalog:",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xzzpig/pi-subagents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Pi extension for single-agent delegation and scripted multi-agent workflows",
|
|
5
5
|
"author": "Nico Bailon",
|
|
6
6
|
"license": "MIT",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@earendil-works/pi-agent-core": "*",
|
|
71
|
-
"@earendil-works/pi-ai": ">=0.
|
|
71
|
+
"@earendil-works/pi-ai": ">=1.0.0 <2",
|
|
72
72
|
"@earendil-works/pi-coding-agent": "*",
|
|
73
73
|
"@earendil-works/pi-tui": "*",
|
|
74
74
|
"typebox": "*"
|
|
@@ -94,13 +94,13 @@
|
|
|
94
94
|
"@xzzpig/pi-components": "0.4.0",
|
|
95
95
|
"acorn": "8.18.0",
|
|
96
96
|
"jiti": "2.7.0",
|
|
97
|
-
"undici": "8.10.
|
|
97
|
+
"undici": "8.10.2",
|
|
98
98
|
"yaml": "2.8.3"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@earendil-works/pi-agent-core": "0.
|
|
102
|
-
"@earendil-works/pi-ai": "0.
|
|
103
|
-
"@earendil-works/pi-tui": "0.
|
|
101
|
+
"@earendil-works/pi-agent-core": "1.0.0",
|
|
102
|
+
"@earendil-works/pi-ai": "1.0.0",
|
|
103
|
+
"@earendil-works/pi-tui": "1.0.0",
|
|
104
104
|
"@oxlint/plugins": "1.80.0",
|
|
105
105
|
"@types/node": "24.13.3",
|
|
106
106
|
"oxlint": "1.80.0",
|
package/prompts/review-loop.md
CHANGED
|
@@ -8,7 +8,7 @@ Use the `subagent` tool. Keep the parent session as the loop controller and fina
|
|
|
8
8
|
|
|
9
9
|
Default to a maximum of 3 review rounds unless I specify a different cap. Count a review round each time fresh-context reviewers inspect the current diff after a worker pass. Stop early when reviewers find no P0 findings, no P1 fixes worth doing now, and no approved P2 notes that should be handled in this loop.
|
|
10
10
|
|
|
11
|
-
If the invocation includes an implementation request, first launch one async `worker` to implement the approved scope. If the current diff is already the target, start with review. The sequence can be launched up front
|
|
11
|
+
If the invocation includes an implementation request, first launch one async `worker` to implement the approved scope. If the current diff is already the target, start with review. The sequence can be launched up front as a workflow script (a ```` ```js workflow ```` block plus `subagent({ workflow: true })`) when it is already clear, or continued as follow-up single-agent runs after each async completion. For an initial workflow script, pass `async: true` so the main chat is unblocked; do not set `clarify: true` unless I explicitly want the foreground clarify UI. Use only one writer against the active worktree at a time unless I explicitly ask for isolated worktrees.
|
|
12
12
|
|
|
13
13
|
As a conservative orchestration policy, do not set a hard `toolBudget` or tight `usageBudget` on implementation or fix workers. A default tool budget blocks read/search tools rather than mutation tools, and reported usage has no reservation model, so count or usage limits still do not measure delivery safety. Give each writer a narrow delivery slice and an outer elapsed deadline with enough margin. Before that deadline, request a checkpoint after the current tool returns with 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 the checkpoint trigger.
|
|
14
14
|
|
|
@@ -32,7 +32,7 @@ Pass 1 is independent reports. Pass 2 is one cross-exam. Run Pass 3 only when `-
|
|
|
32
32
|
|
|
33
33
|
1. Write the council brief: question, scope, non-goals, evidence targets, roster, known advisor context modes, and pass cap.
|
|
34
34
|
2. Tell the user the roster, context modes, and pass cap.
|
|
35
|
-
3. Launch one async `
|
|
35
|
+
3. Launch one async workflow script (a ```` ```js workflow ```` block plus `subagent({ workflow: true, async: true })`) with `runs.all` for Pass 1. Use stable keys, `phase: "Council pass 1"`, concise labels, and `output: false` unless separate artifacts are useful. Set `context` only when the profile context is known or a fallback rule requires it.
|
|
36
36
|
4. Return one aggregate Pass 1 receipt. On completion, tell the user completion count, agreement count, dispute count, and whether Pass 2 is needed.
|
|
37
37
|
5. Synthesize the claim matrix in the parent: agreements, disputed claims, missing proof, owner decisions, and at most five material relay claims per advisor.
|
|
38
38
|
6. For Pass 2, tell the user which claims are relayed and why they matter. Resume each advisor with a curated challenge packet. A resume needs a retained run id and task; it excludes `agent` and rejects `gate`. Record each new run id; Pass 3 resumes those latest ids with new stable keys.
|