delegation-layer 0.1.19 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +13 -6
  2. package/package.json +1 -1
  3. package/plugins/delegation-layer/.claude-plugin/plugin.json +1 -1
  4. package/plugins/delegation-layer/.codex-plugin/plugin.json +1 -1
  5. package/plugins/delegation-layer/hooks/hooks.json +18 -0
  6. package/plugins/delegation-layer/skills/agent-integration/SKILL.md +70 -20
  7. package/plugins/delegation-layer/skills/agent-integration/evals/evals.json +40 -0
  8. package/plugins/delegation-layer/skills/agent-integration/evals/routing.json +47 -0
  9. package/plugins/delegation-layer/skills/agent-integration/examples/json-results.md +2 -2
  10. package/plugins/delegation-layer/skills/agent-integration/examples/read-only-task.md +1 -2
  11. package/plugins/delegation-layer/skills/agent-integration/examples/workspace-write-task.md +1 -2
  12. package/plugins/delegation-layer/skills/agent-integration/references/collaboration.md +77 -0
  13. package/plugins/delegation-layer/skills/agent-integration/references/command-reference.md +15 -4
  14. package/plugins/delegation-layer/skills/agent-integration/references/continuation.md +1 -1
  15. package/plugins/delegation-layer/skills/agent-integration/references/interaction.md +110 -0
  16. package/plugins/delegation-layer/skills/agent-integration/references/result-handling.md +4 -2
  17. package/plugins/delegation-layer/skills/agent-integration/references/routing-rule.json +1 -0
  18. package/plugins/delegation-layer/skills/agent-integration/scripts/delegate-routing-context.sh +26 -0
  19. package/scripts/install-agent-integration.mjs +212 -5
  20. package/skills/agent-integration/SKILL.md +70 -20
  21. package/skills/agent-integration/evals/evals.json +40 -0
  22. package/skills/agent-integration/evals/routing.json +47 -0
  23. package/skills/agent-integration/examples/json-results.md +2 -2
  24. package/skills/agent-integration/examples/read-only-task.md +1 -2
  25. package/skills/agent-integration/examples/workspace-write-task.md +1 -2
  26. package/skills/agent-integration/references/collaboration.md +77 -0
  27. package/skills/agent-integration/references/command-reference.md +15 -4
  28. package/skills/agent-integration/references/continuation.md +1 -1
  29. package/skills/agent-integration/references/interaction.md +110 -0
  30. package/skills/agent-integration/references/result-handling.md +4 -2
  31. package/skills/agent-integration/references/routing-rule.json +1 -0
  32. package/skills/agent-integration/scripts/delegate-routing-context.sh +26 -0
package/README.md CHANGED
@@ -20,6 +20,8 @@ already use instead of replacing them.
20
20
  and time budget.
21
21
  - **Recoverable results** — a later `collect` call can read a finished task
22
22
  without launching the provider again.
23
+ - **Clarify while work runs** — answer native questions through Delegate; steer
24
+ an active Codex turn without restarting it. [Interactive tasks](docs/cli-reference.md#interactive-tasks).
23
25
  - **Resumable turns** — a durable timeout can continue the exact provider
24
26
  session through a linked successor task.
25
27
  - **Runtime compatibility** — the selected provider's executable and advertised
@@ -47,7 +49,9 @@ Delegate to launch another instance of the same CLI.
47
49
 
48
50
  Skill installation makes this workflow discoverable; it does not force a model
49
51
  to choose it over another plugin. Selection depends on the harness, model, and
50
- loaded instructions. No user rules, settings, or competing plugins are rewritten.
52
+ loaded instructions. The plugin and optional installer routing hooks supply a
53
+ shared preference at session and subagent startup; they do not intercept tools
54
+ or rewrite your persistent instructions.
51
55
  If an agent bypasses Delegate, that is a selection failure, not proof the
52
56
  integration worked. For a persistent preference, see
53
57
  [configure agent routing](docs/agent-routing.md).
@@ -57,7 +61,7 @@ integration worked. For a persistent preference, see
57
61
  ### Recommended for Codex and Claude Code
58
62
 
59
63
  Install the plugin from this repository. It installs the provider-neutral skill
60
- and runs a trusted session-start bootstrap that reuses the checksum-verified
64
+ and provides collaboration context hooks plus a trusted session-start bootstrap that reuses the checksum-verified
61
65
  Delegation Layer release installer when `delegate` is missing. The bootstrap
62
66
  installs the CLI and its bundled supervisor; it does not install provider CLIs,
63
67
  change provider authentication, or change provider configuration.
@@ -101,8 +105,9 @@ If you want the Delegation Layer guided installer instead, run:
101
105
  npx --yes delegation-layer install
102
106
  ```
103
107
 
104
- It provides an interactive scope and harness picker, with global installation
105
- selected by default. For scripts or a choice without prompts:
108
+ It provides interactive scope, harness, and routing choices. Global installation
109
+ and routing hooks for Claude/Codex are selected by default; choose skill-only
110
+ to omit hooks. Codex requires native hook trust before activation. For scripts or a choice without prompts:
106
111
 
107
112
  ```sh
108
113
  npx --yes delegation-layer install \
@@ -111,8 +116,10 @@ npx --yes delegation-layer install \
111
116
  --yes
112
117
  ```
113
118
 
114
- This path installs guidance only. It does not install the CLI, change provider
115
- logins, or run a task. Use the plugin path above when you want the skill and
119
+ The commands above do not install the CLI, change provider
120
+ logins, or run a task. Noninteractive installs remain skill-only unless you add
121
+ `--routing default`. See [routing setup and removal](docs/agent-routing.md).
122
+ Use the plugin path above when you want the skill and
116
123
  CLI bootstrap together.
117
124
 
118
125
  ### Install the CLI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Multi-provider AI agent delegation CLI and Agent Skill for running bounded coding tasks across provider CLIs.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
3
  "displayName": "Delegation Layer",
4
- "version": "0.1.19",
4
+ "version": "0.1.21",
5
5
  "description": "Consult external AI harnesses and CCR-configured models for reviews, research, implementation, and debate through the resumable Delegate CLI.",
6
6
  "author": {
7
7
  "name": "Hesham Karam",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Consult external AI harnesses and CCR-configured models for reviews, research, implementation, and debate through the resumable Delegate CLI.",
5
5
  "author": {
6
6
  "name": "Hesham Karam",
@@ -8,6 +8,24 @@
8
8
  "command": "/bin/sh -c 'plugin_root=\"${CLAUDE_PLUGIN_ROOT:-${PLUGIN_ROOT:?plugin root environment variable is missing}}\"; exec \"$plugin_root/scripts/ensure-delegate.sh\"'"
9
9
  }
10
10
  ]
11
+ },
12
+ {
13
+ "hooks": [
14
+ {
15
+ "type": "command",
16
+ "command": "/bin/sh -c 'plugin_root=\"${CLAUDE_PLUGIN_ROOT:-${PLUGIN_ROOT:?plugin root environment variable is missing}}\"; exec /bin/sh \"$plugin_root/skills/agent-integration/scripts/delegate-routing-context.sh\" SessionStart'"
17
+ }
18
+ ]
19
+ }
20
+ ],
21
+ "SubagentStart": [
22
+ {
23
+ "hooks": [
24
+ {
25
+ "type": "command",
26
+ "command": "/bin/sh -c 'plugin_root=\"${CLAUDE_PLUGIN_ROOT:-${PLUGIN_ROOT:?plugin root environment variable is missing}}\"; exec /bin/sh \"$plugin_root/skills/agent-integration/scripts/delegate-routing-context.sh\" SubagentStart'"
27
+ }
28
+ ]
11
29
  }
12
30
  ]
13
31
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: agent-integration
3
- description: Delegate external tasks to CCR (Claude Code Router) and other agents. Use for Codex, Claude, AGY, and other external agent or model collaboration for reviews, research, implementation, testing, second opinions, comparisons, and debates, including collaboration you choose during a task. Discover other supported harnesses such as Pi and OpenCode through Delegate. Not for ordinary native subagents, provider setup, or questions merely about a tool.
3
+ description: Coordinate external agent, model, and separate harness tasks through Delegate, including research, implementation, tests, reviews, consultations, comparisons, and debates. Use before choosing an external integration; ordinary native subagents and questions about tools remain local.
4
4
  ---
5
5
 
6
6
  # Delegation Layer
@@ -56,13 +56,27 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
56
56
  finite budget. Keep the state root outside the workspace. Reuse a supplied
57
57
  `DELEGATE_ROOT` for all providers and tasks; do not invent per-provider or
58
58
  per-task state roots. Task IDs separate work within that root.
59
- 4. Use `--json` and save the returned `task_id`. Read `admission`, `liveness`,
59
+ 4. Use `--json` and save each response separately with its requested destination,
60
+ model, effort, workspace, and returned `task_id`. Never merge concurrent
61
+ responses into an unlabeled output stream. Read `admission`, `liveness`,
60
62
  `publication`, `status`, `outcome`, `continuation`, `task_record`, `failure`,
61
63
  and `error` as separate fields.
62
64
  Delegate owns the supervisor lifecycle. Never install, configure, start,
63
65
  inspect, or repair Pueue, and never poll a task unless the response says its
64
66
  `task_record` is `created`.
65
- 5. Observe with `status` and collect with `collect`. Collection may recover the
67
+ 5. Observe tasks only through Delegate `status`, `collect`, or `events`.
68
+ Do not run `ps`, `pgrep`, process-tree searches, or supervisor commands to
69
+ monitor delegated work. Pending output is normal startup or work in progress;
70
+ empty `pending_requests` means keep collecting, not diagnose the environment.
71
+ Environment diagnostics require a separately requested troubleshooting task.
72
+ Keep collection in the
73
+ foreground until all requested tasks reach a terminal result or an explicit
74
+ blocker. Do not end a headless turn promising a background notification.
75
+ Pending publication (exit 3) means keep waiting, not success. When the JSON
76
+ includes an outstanding `interaction.pending_requests` batch, follow
77
+ [active-task interaction](references/interaction.md) before waiting again. Only detach
78
+ when the user explicitly requests it, retaining the exact task IDs.
79
+ Collection may recover the
66
80
  saved supervisor only to observe an already-requested budget stop; it never
67
81
  launches a provider or retries a task.
68
82
  6. If a task is timed out and its JSON says `continuation.resumable: true`, use
@@ -114,7 +128,7 @@ normal task. For an explicitly requested readiness check, see
114
128
  [preflight guidance](references/command-reference.md#checking-readiness).
115
129
 
116
130
  The catalog and `capabilities` response expose supported permission modes,
117
- request options, continuation, and the read-only mechanism. A read-only
131
+ request options, continuation, native interaction, and the read-only mechanism. A read-only
118
132
  capability with `containment: "provider-owned"` selects the provider's native
119
133
  behavior but is not an independent delegate-owned sandbox. Static discovery
120
134
  does not prove authentication or live acceptance; use the dispatch or live
@@ -129,28 +143,48 @@ name belongs to CCR; clarify only if discovery leaves the destination ambiguous.
129
143
 
130
144
  Keep provider defaults when no model or effort was requested and neither is required. When an explicit
131
145
  choice is needed, read [model and effort guidance](references/command-reference.md#choosing-models-and-effort).
132
- Pass requested choices through Delegate's public `--model` and `--effort`
133
- fields; discovery is advisory, never an allowlist.
146
+ Pass exact requested model IDs and effort values unchanged through Delegate's
147
+ public `--model` and `--effort` fields; discovery is advisory, never an allowlist.
148
+ For a natural-language model name, resolve one exact ID through discovery. If
149
+ it remains ambiguous or discovery is unavailable, ask for the exact model ID;
150
+ do not turn a display name into a guessed alias. An explicit ID needs no such
151
+ clarification just because it is absent from discovery.
152
+
153
+ For planning, consultation, debate, or other external work that may need
154
+ answers or guidance while it runs, read [active-task interaction](references/interaction.md)
155
+ and use `--interactive` when supported. Answer known facts yourself; ask the
156
+ user for missing preferences, authorization, or scope. Keep ordinary native
157
+ subagents available under the same-harness rule above.
134
158
 
135
159
  ### 3. Prepare separate paths and a finite brief
136
160
 
137
161
  Use an existing task brief when one is supplied. Otherwise create a bounded
138
162
  brief file that contains the requested work and its acceptance criteria. Keep
139
163
  the state root outside the workspace and provider-writable trees (which can
140
- include the system temporary directory). Use `DELEGATE_ROOT` when supplied:
164
+ include the system temporary directory). Use `DELEGATE_ROOT` when supplied.
141
165
 
142
166
  Run path preparation and dispatch in **one shell/tool invocation**, as shown
143
167
  below. Shell variables may disappear between tool calls. For later commands,
144
168
  use the actual saved absolute paths or assign them again in that invocation;
145
169
  never pass an empty `--root`, `--brief`, or `--cwd`.
146
170
 
147
- Replace the example brief below with the actual user request. Do not place the state
171
+ Write the brief as the **worker’s own assignment**, not a copy of the
172
+ orchestration request. For “consult another agent about X”, tell the worker
173
+ “Investigate X and return your findings; you are the assigned worker, do not
174
+ delegate this assignment.” Keep dispatching, answering questions, and
175
+ collecting results in the lead session unless recursive delegation was
176
+ explicitly requested.
177
+
178
+ Replace the example brief below with that bounded worker assignment. Do not place the state
148
179
  root inside the workspace or place secrets in either path’s task data. Keep it
149
180
  outside provider configuration and runtime directories as well. If delegate
150
181
  rejects a caller-supplied state root, report the placement error rather than
151
- silently replacing that root. If no root was supplied, choose one outside the
152
- workspace and reuse it. Do not change provider settings. Retain the selected
153
- root for every observation and continuation.
182
+ silently replacing that root. For every task command, use
183
+ `--root "${DELEGATE_ROOT:-$HOME/delegation-state}"` as shown below. This reads the supplied root in each shell call and uses the
184
+ same default when none was supplied; no root setup or new directory choice is
185
+ needed. If the user explicitly requests another root, substitute that exact
186
+ absolute path consistently. Do not change provider settings or switch roots
187
+ when waiting, replying, steering, or continuing.
154
188
 
155
189
  ### 4. Dispatch one bounded turn
156
190
 
@@ -159,19 +193,22 @@ For a named harness or provider resolved in step 2, replace `--auto` with `--pro
159
193
  combine the two:
160
194
 
161
195
  ```sh
162
- STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
163
196
  WORKSPACE="$PWD"
164
197
  BRIEF="$(mktemp)"
198
+ RESPONSE="$(mktemp)"
165
199
  cat >"$BRIEF" <<'EOF'
166
200
  Describe the delegated task, the files or behavior to change, and the checks
167
201
  that must pass. Keep the response concise and report validation evidence.
168
202
  EOF
169
- delegate --root "$STATE_ROOT" dispatch --auto \
203
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" dispatch --auto \
170
204
  --brief "$BRIEF" \
171
205
  --cwd "$WORKSPACE" \
172
206
  --permission read-only \
173
207
  --budget 30m \
174
- --json
208
+ --json >"$RESPONSE"
209
+ dispatch_exit=$?
210
+ cat "$RESPONSE"
211
+ printf '\nDispatch exit: %s; saved response: %s\n' "$dispatch_exit" "$RESPONSE"
175
212
  ```
176
213
 
177
214
  For an authorized code change, use `--permission workspace-write`; this requests
@@ -185,7 +222,16 @@ For independent work, the model may run several complete `dispatch` commands
185
222
  concurrently. Keep each task's brief, workspace, permission, and task ID
186
223
  independent. Do not configure Pueue or wait for one task before dispatching the
187
224
  next solely to serialize ordinary work. Inspect each returned task separately
188
- with `status` and `collect`.
225
+ with `status` and `collect`. Use independent tool calls or separate response
226
+ files, never background commands writing to the same stdout. Read
227
+ [parallel reviews and debates](references/collaboration.md) when coordinating
228
+ multiple participants or challenge rounds.
229
+
230
+ Capture the response and exit status in the **original** dispatch invocation,
231
+ as above. Read the saved response if you need it again. Never repeat dispatch
232
+ to obtain its exit code, recover output, or confirm that it worked: each call
233
+ can create new paid work. Once a response says `task_record: created`, save its
234
+ `task_id` and switch to observation. A missing exit code does not undo admission.
189
235
 
190
236
  Save the exact `task_id` from the JSON response. Apply this decision separately
191
237
  for **each attempt**, including requests issued together:
@@ -205,16 +251,20 @@ never retry that uncertain ID or run Pueue commands.
205
251
 
206
252
  ### 5. Observe and collect
207
253
 
208
- Use the same state root and task ID:
254
+ Use the same state root and task ID. Each command below resolves the root
255
+ in its own shell call, so it does not depend on a previous shell variable:
209
256
 
210
257
  ```sh
211
- delegate --root "$STATE_ROOT" status TASK_ID --json
212
- delegate --root "$STATE_ROOT" collect TASK_ID --watch 5s --json
258
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" status TASK_ID --json
259
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" collect TASK_ID --watch 5s --json
213
260
  ```
214
261
 
215
262
  Check `status` first: if it is `timed_out`, follow step 6 even when publication
216
- is pending and no outcome is present. Otherwise, if `collect` exits with code
217
- `3` because publication is still pending, wait a short interval and run
263
+ is pending and no outcome is present. If `interaction.pending_requests` is
264
+ nonempty and the interaction is not closed, answer the questions using
265
+ [active-task interaction](references/interaction.md) before collecting again.
266
+ Otherwise, if `collect` exits with code `3` because publication is still
267
+ pending, wait a short interval and run
218
268
  `collect` again. Do not dispatch again. Continue until
219
269
  the response has a terminal `outcome` or a bounded operational error that
220
270
  requires the caller’s attention.
@@ -56,6 +56,46 @@
56
56
  "name": "write-timeout",
57
57
  "prompt": "An authorized write task has status timed_out, publication unknown, no outcome, and continuation.resumable true.",
58
58
  "expected": ["delegate continue --task", "same state root", "new task id", "do not wait indefinitely for an outcome", "no fresh unrelated dispatch"]
59
+ },
60
+ {
61
+ "name": "admitted-without-explicit-exit-marker",
62
+ "prompt": "Dispatch returned task_record created, admission admitted, and a task_id. The shell output did not include a separate EXIT marker. Confirm the task and collect its result.",
63
+ "expected": ["use status with returned task_id", "read saved dispatch response if needed", "do not dispatch again to print an exit code", "exactly one admitted task for the assignment"]
64
+ },
65
+ {
66
+ "name": "supplied-root-across-shell-calls",
67
+ "prompt": "DELEGATE_ROOT is already set. Consult a separate external agent and answer its questions; each shell tool call starts a new shell.",
68
+ "expected": ["use supplied DELEGATE_ROOT on dispatch, status, collect, reply, steer, and continue", "resolve the same root in each shell call", "no invented task-specific root"]
69
+ },
70
+ {
71
+ "name": "pending-without-questions",
72
+ "prompt": "The admitted task is running. Collect exits 3 with pending publication, empty pending_requests, and no operational error.",
73
+ "expected": ["keep collecting the same task", "no ps or pgrep or process-tree inspection", "no supervisor commands", "no duplicate dispatch", "answer through delegate reply when a question appears"]
74
+ },
75
+ {
76
+ "name": "interactive-worker-assignment",
77
+ "prompt": "Consult a separate external agent about a pricing plan and answer its questions from README.md.",
78
+ "expected": ["brief assigns the pricing investigation directly", "worker does not recruit another external agent", "lead answers through delegate reply", "do not copy the orchestration request verbatim"]
79
+ },
80
+ {
81
+ "name": "interactive-clarification",
82
+ "prompt": "An external planning task returned pending.kind interaction with question IDs, choices, and free_text false. The requested preference is not in the user brief.",
83
+ "expected": ["read references/interaction.md", "ask user for missing preference", "reply through delegate with exact request and question IDs", "stable message ID", "continue collecting"]
84
+ },
85
+ {
86
+ "name": "interactive-steering",
87
+ "prompt": "The user adds guidance while an interactive external task is running and its capabilities advertise steering.",
88
+ "expected": ["delegate steer", "preserve task model permission and budget", "do not cancel and redispatch", "receipt is not completion"]
89
+ },
90
+ {
91
+ "name": "interactive-unknown-delivery",
92
+ "prompt": "A reply submission lost its CLI response. Its recorded delivery is unknown.",
93
+ "expected": ["same message ID and exact content to retrieve receipt", "no new message ID retry", "no native CLI bypass", "observe task"]
94
+ },
95
+ {
96
+ "name": "interactive-unsupported-destination",
97
+ "prompt": "A named external provider supports continuation but neither native clarification nor steering. The user wants a discussion with it.",
98
+ "expected": ["preserve named provider", "ordinary bounded turns and continuation", "explain no active-turn questions", "do not pass unsupported interactive flag"]
59
99
  }
60
100
  ]
61
101
  }
@@ -198,6 +198,53 @@
198
198
  "codex:exec"
199
199
  ],
200
200
  "split": "validation"
201
+ },
202
+ {
203
+ "name": "requested-model-effort",
204
+ "prompt": "Ask a separate Codex CLI session to review pricing.py without edits. Use model gpt-5.6-luna and effort max, preserving both choices.",
205
+ "external": true,
206
+ "provider": "codex:exec",
207
+ "model": "gpt-5.6-luna",
208
+ "effort": "max",
209
+ "split": "validation",
210
+ "regression": true
211
+ },
212
+ {
213
+ "name": "ambiguous-model",
214
+ "prompt": "Ask a separate Antigravity CLI session to review pricing.py using the fastest Flash model. I do not know the exact model ID. Do not edit files.",
215
+ "external": true,
216
+ "provider": "antigravity:print",
217
+ "expectation": "Resolve an exact model ID through discovery; clarify if unavailable or ambiguous. Never guess an identifier.",
218
+ "split": "validation",
219
+ "regression": true
220
+ },
221
+ {
222
+ "name": "parallel-receipts",
223
+ "prompt": "Ask separate Codex and Claude CLI sessions to independently review pricing.py against README.md concurrently. Keep the exact provider-to-task-ID mapping for both, including any failed dispatch. No edits.",
224
+ "external": true,
225
+ "provider": [
226
+ "codex:exec",
227
+ "claude:print"
228
+ ],
229
+ "split": "validation",
230
+ "regression": true
231
+ },
232
+ {
233
+ "name": "subagent-external",
234
+ "prompt": "Use an ordinary native subagent to coordinate a read-only second opinion from a separate Codex CLI session about pricing.py. Let the subagent choose its tools. Report the external finding or blocker.",
235
+ "external": true,
236
+ "provider": "codex:exec",
237
+ "split": "validation",
238
+ "regression": true
239
+ },
240
+ {
241
+ "name": "explicit-bypass",
242
+ "prompt": "For this request explicitly bypass Delegate and its skill. Run only codex --version directly; do not start a model session or review.",
243
+ "external": false,
244
+ "provider": null,
245
+ "expectation": "Respect the explicit direct integration choice; this bounded test proves bypass permission, not task completion.",
246
+ "split": "validation",
247
+ "regression": true
201
248
  }
202
249
  ]
203
250
  }
@@ -1,8 +1,8 @@
1
1
  # JSON decision sketch
2
2
 
3
3
  ```sh
4
- delegate --root "$STATE_ROOT" status "$TASK_ID" --json
5
- delegate --root "$STATE_ROOT" collect "$TASK_ID" --watch 5s --json
4
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" status "$TASK_ID" --json
5
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" collect "$TASK_ID" --watch 5s --json
6
6
  ```
7
7
 
8
8
  Decision order:
@@ -1,10 +1,9 @@
1
1
  # Read-only task
2
2
 
3
3
  ```sh
4
- STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
5
4
  BRIEF="$(mktemp)"
6
5
  printf '%s\n' 'Inspect the workspace and summarize the current test failures. Do not edit files.' >"$BRIEF"
7
- delegate --root "$STATE_ROOT" dispatch --auto \
6
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" dispatch --auto \
8
7
  --brief "$BRIEF" --cwd "$PWD" --permission read-only --budget 15m --json
9
8
  ```
10
9
 
@@ -1,8 +1,7 @@
1
1
  # Authorized workspace write task
2
2
 
3
3
  ```sh
4
- STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
5
- delegate --root "$STATE_ROOT" dispatch --auto \
4
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" dispatch --auto \
6
5
  --brief "$PWD/delegated-task.md" --cwd "$PWD" \
7
6
  --permission workspace-write --budget 30m --json
8
7
  ```
@@ -0,0 +1,77 @@
1
+ # Parallel reviews and debates
2
+
3
+ ## Keep each request identifiable
4
+
5
+ Choose the fan-out needed for the user's task. Each participant needs its own
6
+ brief and response association, even when two participants use the same provider.
7
+ Record the request label, provider, exact requested model/effort, workspace,
8
+ permission, state root, and response together. The label identifies the attempt
9
+ before admission; the returned task ID identifies it afterward.
10
+
11
+ Prefer independent tool calls: each tool result belongs to its invocation.
12
+ When a shell must launch requests concurrently, redirect each invocation to its
13
+ own files. Never use `dispatch ... & dispatch ... & wait` with shared stdout.
14
+
15
+ After preparing two independent briefs, a portable capture pattern is:
16
+
17
+ ```sh
18
+ RECEIPTS="$(mktemp -d)" || exit 1
19
+ # Set these absolute paths and catalog IDs in this same tool invocation.
20
+ # BRIEF_A and BRIEF_B contain the real independent assignments.
21
+ (
22
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" dispatch --provider "$PROVIDER_A" \
23
+ --brief "$BRIEF_A" --cwd "$WORKSPACE_A" \
24
+ --permission read-only --budget 30m --json \
25
+ >"$RECEIPTS/review-a.json" 2>"$RECEIPTS/review-a.stderr"
26
+ printf '%s\n' "$?" >"$RECEIPTS/review-a.exit"
27
+ ) &
28
+ (
29
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" dispatch --provider "$PROVIDER_B" \
30
+ --brief "$BRIEF_B" --cwd "$WORKSPACE_B" \
31
+ --permission read-only --budget 30m --json \
32
+ >"$RECEIPTS/review-b.json" 2>"$RECEIPTS/review-b.stderr"
33
+ printf '%s\n' "$?" >"$RECEIPTS/review-b.exit"
34
+ ) &
35
+ wait
36
+ printf 'Read each response separately in %s\n' "$RECEIPTS"
37
+ ```
38
+
39
+ Keep the request-to-label mapping alongside those files. Include any exact
40
+ requested model/effort in its invocation. Read both exit codes, stderr, and JSON
41
+ responses independently; shell `wait` is not proof that either dispatch succeeded.
42
+ Poll only tasks with `task_record: created`. A returned task ID with
43
+ `task_record: not_created` does not identify an observable task.
44
+
45
+ ## Wait within the current turn
46
+
47
+ Concurrent dispatch does not require background collection. Collect each task
48
+ in the foreground with a bounded watch; for example, `collect TASK_ID --watch
49
+ 30s --json`. Exit 3 means publication is still pending: keep observing that task,
50
+ handling its budget-stop and continuation fields as described in the main skill.
51
+ Do not end a headless turn while a shell background job is meant to finish the
52
+ requested work. The host may close its session at that point and no later
53
+ notification is guaranteed. A user-requested detach is different: report the
54
+ pending task IDs and state root explicitly without claiming completion.
55
+
56
+ ## Compare actual results
57
+
58
+ Collect each admitted task to its authoritative terminal outcome. Present each
59
+ participant's findings with its task ID and evidence. Keep a blocked or failed
60
+ participant visible; one successful review does not satisfy a requested pair.
61
+ Do not attribute your own analysis to an unavailable participant.
62
+
63
+ ## Challenge and follow up
64
+
65
+ Independent opening reviews may run concurrently. A challenge depends on the
66
+ actual earlier result: collect it first, then include its relevant findings and
67
+ evidence in the other participant's next brief. Never claim a cross-check merely
68
+ because two initial reviews were requested.
69
+
70
+ For an existing participant, use `continue --task TASK_ID` with that participant's
71
+ own predecessor and the follow-up brief. This creates a new task for the same
72
+ provider conversation; save the new ID separately. Use the continuation result
73
+ and [continuation guidance](continuation.md), including advertised resumability
74
+ after a budget stop. Never use another participant's task ID or restart a
75
+ conversation to imitate a follow-up. If the first turn is blocked, report that
76
+ the dependent challenge or follow-up did not run. Other independent assignments
77
+ may still proceed.
@@ -14,6 +14,9 @@ All paths passed to `--root`, `--cwd`, and `--brief` must be absolute. Add
14
14
  | `delegate status TASK --json` | Reconcile and observe task state | No provider launch |
15
15
  | `delegate collect TASK --watch 5s --json` | Read or wait for publication | No provider launch |
16
16
  | `delegate continue --task TASK ... --json` | Create an exact-session successor | Yes, at most once for the successor |
17
+ | `delegate reply TASK --request ID --answers FILE --id MESSAGE_ID --json` | Answer a pending native question | No new launch |
18
+ | `delegate steer TASK --brief FILE --id MESSAGE_ID --json` | Guide a supported active turn | No new launch |
19
+ | `delegate events TASK --after SEQUENCE --watch 5s --json` | Read a bounded interaction event page | No |
17
20
  | `delegate logs TASK --json` | Return validated output descriptors | No |
18
21
  | `delegate cancel TASK --json` | Record one explicit stop request | Stops, does not relaunch |
19
22
 
@@ -30,9 +33,11 @@ Dispatch flags:
30
33
  - `--auto`: let the CLI select a ready provider;
31
34
  - `--provider ID`: preserve the caller’s named harness or provider, resolved through the catalog;
32
35
  - `--model MODEL` and `--effort VALUE`: provider-advertised choices (CCR requires a model alias);
33
- Codex maps effort to TOML `model_reasoning_effort`, while Claude and AGY
36
+ Codex maps effort to TOML `model_reasoning_effort` for ordinary turns or a native
37
+ turn parameter for interactive turns, while Claude and AGY
34
38
  pass native effort flags; Pi maps effort to `--thinking`; OpenCode maps it to
35
39
  `--variant`; CCR forwards effort to Claude and uses `--model` as a CCR alias; `default` is omitted;
40
+ - `--interactive`: enable advertised native clarification and steering; see [interaction](interaction.md);
36
41
  - `--native-timeout DURATION`: optional provider-native timeout where advertised.
37
42
 
38
43
  Model discovery uses the same `--provider ID` profiles and accepts an optional
@@ -47,12 +52,14 @@ Continuation flags:
47
52
 
48
53
  - `--task TASK`: predecessor task ID;
49
54
  - `--brief FILE`: optional new follow-up instruction;
50
- - `--budget DURATION`, `--model MODEL`, and `--effort VALUE`: optional overrides.
55
+ - `--budget DURATION`, `--model MODEL`, and `--effort VALUE`: optional overrides;
56
+ - `--interactive`: enable interaction when supported; already-interactive predecessors keep it.
51
57
 
52
58
  ## Choosing models and effort
53
59
 
54
- If the caller needs an explicit model or effort, use the implemented native
55
- discovery command for that provider:
60
+ Pass an explicitly supplied model ID and effort unchanged, even if discovery
61
+ is incomplete or does not list them. To resolve a natural-language model name
62
+ or choose an option the caller left open, use native discovery:
56
63
 
57
64
  ```sh
58
65
  delegate models --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE --json
@@ -68,6 +75,10 @@ requested value merely because discovery did not list it, and do not infer
68
75
  per-model effort support from the harness-wide list. If a selected model has
69
76
  `efforts: null` or `efforts: []`, omit `--effort` unless the caller explicitly
70
77
  requested it; do not invent model aliases or combine options by guessing.
78
+ If a natural-language name cannot be resolved to a single exact ID, ask one
79
+ focused question for that ID. Do not silently select a default or transform
80
+ spaces into hyphens to manufacture an ID. This ambiguity rule is guidance for
81
+ selecting a value, not a new admission restriction.
71
82
 
72
83
  The response includes `schema_version`, `command: "models"`, `provider`,
73
84
  `observed_at`, `status`, `reason_code`, `complete`, `source`, nullable
@@ -17,7 +17,7 @@ When `status` or `collect` reports a timed-out turn with:
17
17
  run:
18
18
 
19
19
  ```sh
20
- delegate --root "$STATE_ROOT" continue \
20
+ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" continue \
21
21
  --task PREDECESSOR_TASK_ID \
22
22
  --brief FOLLOW_UP_BRIEF \
23
23
  --budget 30m \