pi-subagents 0.58.0 → 0.60.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 +102 -0
- package/docs/agents.md +5 -3
- package/docs/configuration.md +4 -4
- package/docs/extension-api.md +1 -1
- package/docs/models.md +24 -1
- package/docs/observability.md +1 -1
- package/docs/tool-reference.md +93 -5
- package/docs/workflows.md +94 -3
- package/package.json +3 -1
- package/prompts/review-loop.md +2 -2
- package/skills/council-mode/SKILL.md +48 -243
- package/skills/council-mode/references/pass-contracts.md +150 -0
- package/skills/pi-subagents/SKILL.md +87 -37
- package/skills/pi-subagents/references/constraints-and-recipes.md +29 -233
- package/skills/pi-subagents/references/execution-controls.md +52 -7
- package/skills/pi-subagents/references/management-authoring-rpc.md +3 -4
- package/skills/pi-subagents/references/multi-lane-orchestration.md +13 -1
- package/skills/pi-subagents/references/prompting-and-roles.md +54 -26
- package/skills/pi-subagents/references/review-and-validation.md +73 -0
- package/src/agents/agent-management.ts +159 -42
- package/src/agents/agent-serializer.ts +4 -2
- package/src/agents/agents.ts +67 -26
- package/src/agents/runtime-agent-registry.ts +9 -16
- package/src/api/background-work.ts +5 -1
- package/src/api/delegation.ts +0 -7
- package/src/api/preflight.ts +6 -9
- package/src/api/shared-types.ts +2 -0
- package/src/extension/fanout-child.ts +5 -3
- package/src/extension/index.ts +51 -23
- package/src/extension/public-execution.ts +16 -2
- package/src/extension/schemas.ts +36 -10
- package/src/extension/tool-description.ts +24 -5
- package/src/intercom/result-intercom.ts +2 -0
- package/src/profiles/profiles.ts +5 -6
- package/src/runs/background/active-async-capacity.ts +2 -2
- package/src/runs/background/async-execution.ts +52 -37
- package/src/runs/background/async-job-tracker.ts +17 -12
- package/src/runs/background/async-resume.ts +23 -25
- package/src/runs/background/async-status-snapshot.ts +23 -261
- package/src/runs/background/async-status.ts +110 -8
- package/src/runs/background/chain-append.ts +6 -3
- package/src/runs/background/chain-root-attachment.ts +60 -8
- package/src/runs/background/control-channel.ts +3 -2
- package/src/runs/background/fleet-view.ts +21 -11
- package/src/runs/background/notify.ts +158 -6
- package/src/runs/background/result-files.ts +2 -1
- package/src/runs/background/result-watcher.ts +2 -0
- package/src/runs/background/resume-guidance.ts +1 -1
- package/src/runs/background/retained-children.ts +1 -1
- package/src/runs/background/run-status.ts +30 -9
- package/src/runs/background/scheduled-runs.ts +86 -7
- package/src/runs/background/stale-run-reconciler.ts +10 -4
- package/src/runs/background/steering.ts +4 -14
- package/src/runs/background/subagent-runner.ts +351 -358
- package/src/runs/background/subagent-wait.ts +68 -12
- package/src/runs/background/terminal-run-index.ts +1 -1
- package/src/runs/background/wait-completions.ts +25 -1
- package/src/runs/background/wait-config.ts +23 -9
- package/src/runs/background/wait-tool.ts +9 -2
- package/src/runs/foreground/async-steering-action.ts +2 -2
- package/src/runs/foreground/execution.ts +125 -122
- package/src/runs/foreground/foreground-control.ts +3 -0
- package/src/runs/foreground/foreground-history.ts +1 -0
- package/src/runs/foreground/subagent-executor.ts +576 -240
- package/src/runs/foreground/workflow-detach-reconcile.ts +99 -200
- package/src/runs/shared/abort-recovery.ts +119 -0
- package/src/runs/shared/async-status-projection.ts +597 -0
- package/src/runs/shared/background-process-options.ts +9 -0
- package/src/runs/shared/child-identity.ts +19 -4
- package/src/runs/shared/child-launch-plan.ts +151 -0
- package/src/runs/shared/completion-evidence.ts +89 -0
- package/src/runs/shared/completion-guard.ts +1 -1
- package/src/runs/shared/dynamic-fanout.ts +2 -2
- package/src/runs/shared/host-step-status.ts +230 -0
- package/src/runs/shared/lane-metadata.ts +105 -0
- package/src/runs/shared/mcp-config-sources.ts +42 -6
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +93 -143
- package/src/runs/shared/mcp-direct-tool-grant.ts +194 -0
- package/src/runs/shared/model-fallback.ts +9 -2
- package/src/runs/shared/mutation-evidence.ts +52 -3
- package/src/runs/shared/nested-events.ts +6 -2
- package/src/runs/shared/nested-render.ts +7 -3
- package/src/runs/shared/parallel-handoff.ts +419 -7
- package/src/runs/shared/parallel-utils.ts +7 -0
- package/src/runs/shared/pi-args.ts +67 -3
- package/src/runs/shared/single-output.ts +72 -22
- package/src/runs/shared/subagent-prompt-runtime.ts +33 -6
- package/src/runs/shared/workflow-graph.ts +15 -0
- package/src/runs/shared/worktree-cleanup-plan.ts +847 -0
- package/src/runs/shared/worktree.ts +18 -0
- package/src/shared/child-session-name.ts +46 -0
- package/src/shared/extension-context.ts +24 -0
- package/src/shared/formatters.ts +5 -2
- package/src/shared/launch-contract.ts +1 -1
- package/src/shared/settings.ts +9 -103
- package/src/shared/types.ts +232 -30
- package/src/shared/utils.ts +35 -55
- package/src/slash/delegation-adapters.ts +1 -8
- package/src/slash/delegation-request.ts +0 -4
- package/src/slash/slash-bridge.ts +1 -2
- package/src/slash/slash-commands.ts +369 -90
- package/src/slash/slash-live-state.ts +22 -11
- package/src/tui/fleet-status.ts +134 -75
- package/src/tui/fleet.ts +11 -5
- package/src/tui/render-helpers.ts +31 -0
- package/src/tui/render.ts +895 -121
- package/src/watchdog/change-signature.ts +40 -1
- package/src/watchdog/turn-delta.ts +1 -1
- package/src/workflows/chat-progress.ts +6 -3
- package/src/workflows/host-command.ts +235 -0
- package/src/workflows/scripted-workflow.ts +503 -38
- package/src/workflows/workflow-child-summary.ts +9 -5
- package/src/workflows/workflow-preflight.ts +270 -0
- package/src/workflows/workflow-receipt.ts +43 -4
- package/src/workflows/workflow-settlement.ts +246 -0
- package/src/runs/shared/turn-budget.ts +0 -98
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "Pi extension for single-agent delegation and scripted multi-agent workflows",
|
|
5
5
|
"author": "Nico Bailon",
|
|
6
6
|
"license": "MIT",
|
|
@@ -100,7 +100,9 @@
|
|
|
100
100
|
"@earendil-works/pi-agent-core": "0.81.0",
|
|
101
101
|
"@earendil-works/pi-ai": "0.81.0",
|
|
102
102
|
"@earendil-works/pi-tui": "0.81.0",
|
|
103
|
+
"@oxlint/plugins": "1.80.0",
|
|
103
104
|
"@types/node": "24.13.3",
|
|
105
|
+
"oxlint": "1.80.0",
|
|
104
106
|
"typescript": "5.9.3",
|
|
105
107
|
"@earendil-works/pi-coding-agent": "file:./test/fixtures/pi-coding-agent-shim"
|
|
106
108
|
}
|
package/prompts/review-loop.md
CHANGED
|
@@ -10,7 +10,7 @@ Default to a maximum of 3 review rounds unless I specify a different cap. Count
|
|
|
10
10
|
|
|
11
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 with `workflowScript` when it is already clear, or continued as follow-up single-agent runs after each async completion. For an initial workflowScript, 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
|
-
As a conservative orchestration policy, do not set
|
|
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
|
|
|
15
15
|
For each review round, launch fresh-context `reviewer` agents in parallel. Reviewers must inspect the repository, relevant instructions, and current diff directly from files and commands. They must not rely on the main conversation history and must not edit files.
|
|
16
16
|
|
|
@@ -28,7 +28,7 @@ Do not blindly apply every reviewer suggestion. If reviewers surface an unapprov
|
|
|
28
28
|
|
|
29
29
|
When an async implementation worker completes, treat its handoff as the transition into review, not as final completion, unless I explicitly asked for worker-only work, review-only output, or to stop after implementation.
|
|
30
30
|
|
|
31
|
-
When there are fixes worth doing now and the workflow is implementation-authorized, launch one async forked `worker` without hard
|
|
31
|
+
When there are fixes worth doing now and the workflow is implementation-authorized, launch one async forked `worker` without hard tool-call caps to apply only those synthesized fixes. Ask it to preserve the approved scope, run focused validation, and report changed files, commands run with exit codes, validation evidence, surprises, and anything left undone.
|
|
32
32
|
|
|
33
33
|
After a fix worker returns, run another review round only when it made material changes or addressed non-trivial findings. Do not keep looping for optional polish, speculative improvements, or findings already deferred by the parent.
|
|
34
34
|
|
|
@@ -5,250 +5,55 @@ description: Run a bounded supervisor-mediated advisor council. Use when the use
|
|
|
5
5
|
|
|
6
6
|
# Council Mode
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
`skills/
|
|
16
|
-
|
|
17
|
-
## Roster
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
installed and their external-job provider is registered. For Surf, `gpt-pro` is
|
|
25
|
-
available only after the `surf-cli` Pi extension loads Surf's `surf-oracle`
|
|
26
|
-
provider. Treat it as a normal advisor name in `runs.all` after that provider is
|
|
27
|
-
visible. It is background-only, so omit `async` unless you explicitly want
|
|
28
|
-
detached receipt semantics; workflow execution will await the terminal provider
|
|
29
|
-
result. External runners can lack repo tools, structured-output support, or
|
|
30
|
-
resumability. For them, include the needed evidence or file excerpts in the task,
|
|
31
|
-
use the text JSON contract below instead of `outputSchema`, and use the
|
|
32
|
-
fresh-context fallback path for cross-exam when the run is not resumable.
|
|
33
|
-
|
|
34
|
-
Create model-based profiles in your user or project agent directory. Do not add
|
|
35
|
-
them to this package. This is a valid example:
|
|
36
|
-
|
|
37
|
-
```markdown
|
|
38
|
-
---
|
|
39
|
-
name: council-sol
|
|
40
|
-
description: Read-only fresh-context advisor for bounded council decisions
|
|
41
|
-
tools: read, grep, find, ls
|
|
42
|
-
model: openai-codex/gpt-5.6-sol
|
|
43
|
-
thinking: high
|
|
44
|
-
systemPromptMode: replace
|
|
45
|
-
inheritProjectContext: true
|
|
46
|
-
inheritSkills: false
|
|
47
|
-
defaultContext: fresh
|
|
48
|
-
acceptanceRole: read-only
|
|
49
|
-
---
|
|
8
|
+
Council mode is parent-supervised advice for a material decision with real tradeoffs. It is not free-form agent chat, implementation work, a transcript dump, mutation authority, or a council UI.
|
|
9
|
+
|
|
10
|
+
The parent selects the roster, relays only curated claims, decides validity, and writes the memo. Advisors stay read-only and do not see peer transcripts by default.
|
|
11
|
+
|
|
12
|
+
Before launch, read:
|
|
13
|
+
|
|
14
|
+
- `skills/pi-subagents/references/execution-controls.md`
|
|
15
|
+
- `skills/council-mode/references/pass-contracts.md`
|
|
16
|
+
|
|
17
|
+
## Roster
|
|
18
|
+
|
|
19
|
+
Run `subagent({ action: "list" })`, then choose 2-3 executable advisor names that start with `council-`. The prefix is convention only. Never use more than four advisors.
|
|
20
|
+
|
|
21
|
+
If fewer than two council profiles are available, fill with `oracle`, then `reviewer`. Launch fallback `oracle` with `context: "fork"`; let fallback `reviewer` use its normal profile context. Note fallbacks and known context modes in the memo. If fewer than two advisors remain, use the normal one-oracle consultation loop and label it degraded mode.
|
|
22
|
+
|
|
23
|
+
`council-*` profiles live in user or project agent directories, not this package. A profile defines model, tools, context, output defaults, and persistent stance. Keep advisors read-only, disable inherited skills unless needed, and put stance in the profile body instead of inventing per-run role labels.
|
|
50
24
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
After `subagent({ action: "list" })`, prefer 2–3 executable names that start with
|
|
57
|
-
`council-`. The prefix is a naming convention, not runtime selection. If fewer
|
|
58
|
-
than two profiles are available, fill the roster with `oracle`, then `reviewer`,
|
|
59
|
-
until it has two advisors. Launch fallback `oracle` with `context: "fork"` so
|
|
60
|
-
global defaults cannot remove its parent-chat context. Let fallback `reviewer`
|
|
61
|
-
use its normal profile context. Note the fallback and known context modes in the
|
|
62
|
-
memo. Use the normal single-oracle consultation loop only when a requested roster
|
|
63
|
-
or unavailable builtins leaves fewer than two advisors.
|
|
64
|
-
Label that result as degraded mode. Never use more than four advisors.
|
|
65
|
-
|
|
66
|
-
Pass 1 is independent reports. Pass 2 is one cross-exam. The default pass cap is
|
|
67
|
-
2. Run pass 3 only when `--max-passes 3` was requested and a material dispute can
|
|
68
|
-
be settled by evidence an advisor can produce. Never run an unbounded loop.
|
|
25
|
+
External-job/package advisors may join only when their provider is registered. Treat them as ordinary advisor names in `runs.all`, but honor their runner limits: they may lack repo tools, structured output, or resumability. Include evidence they cannot read, request JSON text instead of `outputSchema`, and use a fresh-context fallback when they cannot resume for cross-exam.
|
|
26
|
+
|
|
27
|
+
## Passes
|
|
28
|
+
|
|
29
|
+
Pass 1 is independent reports. Pass 2 is one cross-exam. Run Pass 3 only when `--max-passes 3` was requested and a material dispute can still be settled by evidence. Never run an unbounded loop.
|
|
69
30
|
|
|
70
31
|
## Protocol
|
|
71
32
|
|
|
72
|
-
1.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
6. Before Pass 2, tell the user how many claims are relayed and why each is
|
|
100
|
-
material. Launch a second async `workflowScript` with `runs.all` resume calls.
|
|
101
|
-
Each task is a curated challenge packet, not a peer transcript. A resume requires
|
|
102
|
-
a retained run id and a non-empty task. It excludes `agent` and rejects `gate`.
|
|
103
|
-
Record the new run id from every resume. Pass 3 resumes those latest ids. Return
|
|
104
|
-
one aggregate Pass 2 receipt.
|
|
105
|
-
7. After Pass 2, tell the user whether the council converged or which owner
|
|
106
|
-
decisions remain. The parent writes the final memo. Do not delegate it.
|
|
107
|
-
|
|
108
|
-
If an advisor is not resumable, run the same profile in fresh context with its own
|
|
109
|
-
pass-1 report and the challenge packet. Label that response as a fresh-context
|
|
110
|
-
fallback, not a true cross-exam.
|
|
111
|
-
|
|
112
|
-
Do not set `clarify`, `worktree`, `gate`, turn budgets, tool budgets, or tight usage
|
|
113
|
-
budgets on advisors. Bound work through the roster, pass cap, and report length.
|
|
114
|
-
|
|
115
|
-
## Advisor contracts and pass receipts
|
|
116
|
-
|
|
117
|
-
Pass-1 reports are at most about 600 words. Give native Pi advisors the same
|
|
118
|
-
`outputSchema`, so reports are comparable without heading cleanup. For
|
|
119
|
-
external-runner advisors, do not pass `outputSchema`; ask them to return compact
|
|
120
|
-
JSON text with the same fields. The following shape is a contract template. Use
|
|
121
|
-
the runtime schema syntax supported by the workflow for native advisors and keep
|
|
122
|
-
narrative fields as strings:
|
|
123
|
-
|
|
124
|
-
```js
|
|
125
|
-
const pass1OutputSchema = {
|
|
126
|
-
type: "object",
|
|
127
|
-
required: [
|
|
128
|
-
"recommendation", "evidence", "assumptions", "risks", "confidence",
|
|
129
|
-
"challengeClaims", "ownerDecisions", "changeMyMind"
|
|
130
|
-
],
|
|
131
|
-
properties: {
|
|
132
|
-
recommendation: { type: "string" },
|
|
133
|
-
evidence: {
|
|
134
|
-
type: "array",
|
|
135
|
-
items: {
|
|
136
|
-
type: "object",
|
|
137
|
-
required: ["claim", "sources"],
|
|
138
|
-
properties: {
|
|
139
|
-
claim: { type: "string" },
|
|
140
|
-
sources: { type: "array", items: { type: "string" } }
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
assumptions: {
|
|
145
|
-
type: "array",
|
|
146
|
-
items: {
|
|
147
|
-
type: "object",
|
|
148
|
-
required: ["assumption", "status"],
|
|
149
|
-
properties: {
|
|
150
|
-
assumption: { type: "string" },
|
|
151
|
-
status: { enum: ["verified", "unverified"] }
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
risks: { type: "array", items: { type: "string" } },
|
|
156
|
-
confidence: {
|
|
157
|
-
type: "object",
|
|
158
|
-
required: ["level", "reason"],
|
|
159
|
-
properties: {
|
|
160
|
-
level: { enum: ["high", "medium", "low"] },
|
|
161
|
-
reason: { type: "string" }
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
challengeClaims: { type: "array", items: { type: "string" }, maxItems: 3 },
|
|
165
|
-
ownerDecisions: { type: "array", items: { type: "string" } },
|
|
166
|
-
changeMyMind: { type: "array", items: { type: "string" } }
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Include this contract in each Pass 1 task: inspect supplied evidence directly; do
|
|
172
|
-
not see or ask about other advisors; stay read-only; do not spawn children; return
|
|
173
|
-
only the structured report. For external-runner advisors, say `Return only JSON
|
|
174
|
-
matching this shape. Do not wrap it in Markdown.` and include any evidence they
|
|
175
|
-
cannot read through tools.
|
|
176
|
-
|
|
177
|
-
After `runs.all`, return one aggregate receipt rather than making the parent find
|
|
178
|
-
separate artifacts. Preserve the result order or map it by stable key so each row
|
|
179
|
-
contains the advisor identity and report:
|
|
180
|
-
|
|
181
|
-
```js
|
|
182
|
-
return {
|
|
183
|
-
pass: 1,
|
|
184
|
-
advisors: results.map((result, index) => ({
|
|
185
|
-
key: result.key,
|
|
186
|
-
agent: result.agent,
|
|
187
|
-
requestedContext: roster[index].context ?? "runtime-default-unknown",
|
|
188
|
-
runId: result.runId,
|
|
189
|
-
report: result.structuredOutput ?? result.output
|
|
190
|
-
}))
|
|
191
|
-
};
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Do not replace `runtime-default-unknown` with a guessed context. It records that
|
|
195
|
-
the launch intentionally omitted context.
|
|
196
|
-
|
|
197
|
-
A challenge packet contains only disputed claims, strong conflicting evidence,
|
|
198
|
-
missing proof, owner decisions, and high-impact risks. Attribute peer content as
|
|
199
|
-
"another advisor". Do not include full peer reports. Use a common Pass 2 contract:
|
|
200
|
-
|
|
201
|
-
```js
|
|
202
|
-
const pass2OutputSchema = {
|
|
203
|
-
type: "object",
|
|
204
|
-
required: ["responses", "recommendationChanged", "outOfScopeFindings"],
|
|
205
|
-
properties: {
|
|
206
|
-
responses: {
|
|
207
|
-
type: "array",
|
|
208
|
-
items: {
|
|
209
|
-
type: "object",
|
|
210
|
-
required: ["claimId", "disposition", "reason", "sources"],
|
|
211
|
-
properties: {
|
|
212
|
-
claimId: { type: "string" },
|
|
213
|
-
disposition: {
|
|
214
|
-
enum: ["accept", "reject", "refine", "owner-decision"]
|
|
215
|
-
},
|
|
216
|
-
reason: { type: "string" },
|
|
217
|
-
sources: { type: "array", items: { type: "string" } }
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
recommendationChanged: {
|
|
222
|
-
type: "object",
|
|
223
|
-
required: ["changed", "reason"],
|
|
224
|
-
properties: { changed: { type: "boolean" }, reason: { type: "string" } }
|
|
225
|
-
},
|
|
226
|
-
outOfScopeFindings: { type: "array", items: { type: "string" } }
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
Use stable resume keys such as `cross-oracle`, `phase: "Council pass 2"`, concise
|
|
232
|
-
labels, and `output: false` unless separate artifacts are requested or useful. Keep
|
|
233
|
-
any artifact outputs under the managed run artifact directory. Do not pass
|
|
234
|
-
`outputSchema` to external-runner fallback launches; ask for compact JSON text
|
|
235
|
-
instead. The aggregate Pass 2 receipt uses the same row shape as Pass 1, with the
|
|
236
|
-
new `runId` and `structuredOutput ?? output`.
|
|
237
|
-
|
|
238
|
-
## Stop and memo
|
|
239
|
-
|
|
240
|
-
Converged means no disputed claim remains that both materially affects the
|
|
241
|
-
recommendation and can plausibly be settled by evidence. Stop at convergence, the
|
|
242
|
-
pass cap, failed fallback, or user interruption. Put unresolved disputes in owner
|
|
243
|
-
decisions. Never add a round for polish or symmetry.
|
|
244
|
-
|
|
245
|
-
The parent memo states the question and scope, recommendation, rationale, accepted
|
|
246
|
-
and rejected feedback with reasons, owner decisions, evidence and run ids,
|
|
247
|
-
confidence, what would change the decision, and the roster, passes, fallbacks, and
|
|
248
|
-
known advisor context modes. Identify advisors by profile name or model-based
|
|
249
|
-
profile, not by invented role labels. State that fallback `oracle` is context-aware
|
|
250
|
-
and forked.
|
|
251
|
-
|
|
252
|
-
Council mode is not agent-to-agent chat, a transcript dump, mutation authority,
|
|
253
|
-
auto-escalation to writer lanes, or a council UI. Escalate to a writer only after
|
|
254
|
-
the parent memo and only when the user explicitly requests it.
|
|
33
|
+
1. Write the council brief: question, scope, non-goals, evidence targets, roster, known advisor context modes, and pass cap.
|
|
34
|
+
2. Tell the user the roster, context modes, and pass cap.
|
|
35
|
+
3. Launch one async `workflowScript` 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
|
+
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
|
+
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
|
+
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.
|
|
39
|
+
7. Stop at convergence, pass cap, failed fallback, or user interruption. The parent writes the final memo.
|
|
40
|
+
|
|
41
|
+
If an advisor is not resumable, run the same profile fresh with its Pass 1 report and challenge packet. Label it a fresh-context fallback, not true cross-exam.
|
|
42
|
+
|
|
43
|
+
Do not set `clarify`, `worktree`, `gate`, tool budgets, or tight usage budgets on advisors. Bound work through the roster, pass cap, and report length.
|
|
44
|
+
|
|
45
|
+
## Memo
|
|
46
|
+
|
|
47
|
+
Converged means no disputed claim remains that both affects the recommendation and can plausibly be settled by advisor evidence. Put unresolved disputes in owner decisions. Do not add a round for polish or symmetry.
|
|
48
|
+
|
|
49
|
+
The memo states:
|
|
50
|
+
|
|
51
|
+
- question and scope
|
|
52
|
+
- recommendation and rationale
|
|
53
|
+
- accepted and rejected feedback with reasons
|
|
54
|
+
- owner decisions
|
|
55
|
+
- evidence and run ids
|
|
56
|
+
- confidence and what would change the decision
|
|
57
|
+
- roster, passes, fallbacks, and known advisor context modes
|
|
58
|
+
|
|
59
|
+
Identify advisors by profile name. State when fallback `oracle` was forked and context-aware. Escalate to a writer only after the memo and only when the user requests it.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Council Mode Pass Contracts
|
|
2
|
+
|
|
3
|
+
Load this before launching council advisors.
|
|
4
|
+
|
|
5
|
+
## Pass 1 report
|
|
6
|
+
|
|
7
|
+
Native Pi advisors should receive this `outputSchema`. External runners should receive the same shape as plain JSON text and no `outputSchema`.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
const pass1OutputSchema = {
|
|
11
|
+
type: "object",
|
|
12
|
+
required: [
|
|
13
|
+
"recommendation",
|
|
14
|
+
"evidence",
|
|
15
|
+
"assumptions",
|
|
16
|
+
"risks",
|
|
17
|
+
"confidence",
|
|
18
|
+
"challengeClaims",
|
|
19
|
+
"ownerDecisions",
|
|
20
|
+
"changeMyMind"
|
|
21
|
+
],
|
|
22
|
+
properties: {
|
|
23
|
+
recommendation: { type: "string" },
|
|
24
|
+
evidence: {
|
|
25
|
+
type: "array",
|
|
26
|
+
items: {
|
|
27
|
+
type: "object",
|
|
28
|
+
required: ["claim", "sources"],
|
|
29
|
+
properties: {
|
|
30
|
+
claim: { type: "string" },
|
|
31
|
+
sources: { type: "array", items: { type: "string" } }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
assumptions: {
|
|
36
|
+
type: "array",
|
|
37
|
+
items: {
|
|
38
|
+
type: "object",
|
|
39
|
+
required: ["assumption", "status"],
|
|
40
|
+
properties: {
|
|
41
|
+
assumption: { type: "string" },
|
|
42
|
+
status: { enum: ["verified", "unverified"] }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
risks: { type: "array", items: { type: "string" } },
|
|
47
|
+
confidence: {
|
|
48
|
+
type: "object",
|
|
49
|
+
required: ["level", "reason"],
|
|
50
|
+
properties: {
|
|
51
|
+
level: { enum: ["high", "medium", "low"] },
|
|
52
|
+
reason: { type: "string" }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
challengeClaims: { type: "array", items: { type: "string" }, maxItems: 3 },
|
|
56
|
+
ownerDecisions: { type: "array", items: { type: "string" } },
|
|
57
|
+
changeMyMind: { type: "array", items: { type: "string" } }
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Task text:
|
|
63
|
+
|
|
64
|
+
- inspect supplied evidence directly
|
|
65
|
+
- do not ask other advisors or read peer reports
|
|
66
|
+
- stay read-only
|
|
67
|
+
- do not spawn children
|
|
68
|
+
- return only the structured report
|
|
69
|
+
- keep the report under about 600 words
|
|
70
|
+
|
|
71
|
+
For external runners, say: `Return only JSON matching this shape. Do not wrap it in Markdown.` Include any evidence they cannot read with tools.
|
|
72
|
+
|
|
73
|
+
## Pass 1 aggregate receipt
|
|
74
|
+
|
|
75
|
+
Return one aggregate receipt. Preserve result order or map it by stable key.
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
return {
|
|
79
|
+
pass: 1,
|
|
80
|
+
advisors: results.map((result, index) => ({
|
|
81
|
+
key: result.key,
|
|
82
|
+
agent: result.agent,
|
|
83
|
+
requestedContext: roster[index].context ?? "runtime-default-unknown",
|
|
84
|
+
runId: result.runId,
|
|
85
|
+
report: result.structuredOutput ?? result.output
|
|
86
|
+
}))
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Do not replace `runtime-default-unknown` with a guessed context.
|
|
91
|
+
|
|
92
|
+
## Pass 2 challenge
|
|
93
|
+
|
|
94
|
+
A challenge packet contains only disputed claims, strong conflicting evidence, missing proof, owner decisions, and high-impact risks. Attribute peer content as "another advisor". Do not include full peer reports.
|
|
95
|
+
|
|
96
|
+
Native Pi advisors receive `pass2OutputSchema`. External runners and fresh external fallbacks receive the same shape as JSON-only task text and no `outputSchema`.
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
const pass2OutputSchema = {
|
|
100
|
+
type: "object",
|
|
101
|
+
required: ["responses", "recommendationChanged", "outOfScopeFindings"],
|
|
102
|
+
properties: {
|
|
103
|
+
responses: {
|
|
104
|
+
type: "array",
|
|
105
|
+
items: {
|
|
106
|
+
type: "object",
|
|
107
|
+
required: ["claimId", "disposition", "reason", "sources"],
|
|
108
|
+
properties: {
|
|
109
|
+
claimId: { type: "string" },
|
|
110
|
+
disposition: { enum: ["accept", "reject", "refine", "owner-decision"] },
|
|
111
|
+
reason: { type: "string" },
|
|
112
|
+
sources: { type: "array", items: { type: "string" } }
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
recommendationChanged: {
|
|
117
|
+
type: "object",
|
|
118
|
+
required: ["changed", "reason"],
|
|
119
|
+
properties: {
|
|
120
|
+
changed: { type: "boolean" },
|
|
121
|
+
reason: { type: "string" }
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
outOfScopeFindings: { type: "array", items: { type: "string" } }
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Use stable resume keys such as `cross-oracle`, `phase: "Council pass 2"`, concise labels, and `output: false` unless separate artifacts are useful. The aggregate Pass 2 receipt uses the Pass 1 row shape with the new `runId` and `structuredOutput ?? output`. Pass 3 resumes those latest ids with new stable keys.
|
|
130
|
+
|
|
131
|
+
## Advisor profile template
|
|
132
|
+
|
|
133
|
+
Create model-based advisors in the user or project agent directory, not in this package:
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
---
|
|
137
|
+
name: council-sol
|
|
138
|
+
description: Read-only fresh-context advisor for bounded council decisions
|
|
139
|
+
tools: read, grep, find, ls
|
|
140
|
+
model: provider/top-reasoning-model
|
|
141
|
+
thinking: high
|
|
142
|
+
systemPromptMode: replace
|
|
143
|
+
inheritProjectContext: true
|
|
144
|
+
inheritSkills: false
|
|
145
|
+
defaultContext: fresh
|
|
146
|
+
acceptanceRole: read-only
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
Analyze the council question independently. Inspect evidence directly. Do not edit, run mutating commands, commit, push, contact peers, or spawn subagents. Return concise, cited advice using the report contract in the council task.
|
|
150
|
+
```
|