delegation-layer 0.1.18 → 0.1.20

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/README.md CHANGED
@@ -47,16 +47,19 @@ Delegate to launch another instance of the same CLI.
47
47
 
48
48
  Skill installation makes this workflow discoverable; it does not force a model
49
49
  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.
50
+ loaded instructions. The plugin and optional installer routing hooks supply a
51
+ shared preference at session and subagent startup; they do not intercept tools
52
+ or rewrite your persistent instructions.
51
53
  If an agent bypasses Delegate, that is a selection failure, not proof the
52
- integration worked.
54
+ integration worked. For a persistent preference, see
55
+ [configure agent routing](docs/agent-routing.md).
53
56
 
54
57
  ## Install
55
58
 
56
59
  ### Recommended for Codex and Claude Code
57
60
 
58
61
  Install the plugin from this repository. It installs the provider-neutral skill
59
- and runs a trusted session-start bootstrap that reuses the checksum-verified
62
+ and provides collaboration context hooks plus a trusted session-start bootstrap that reuses the checksum-verified
60
63
  Delegation Layer release installer when `delegate` is missing. The bootstrap
61
64
  installs the CLI and its bundled supervisor; it does not install provider CLIs,
62
65
  change provider authentication, or change provider configuration.
@@ -100,8 +103,9 @@ If you want the Delegation Layer guided installer instead, run:
100
103
  npx --yes delegation-layer install
101
104
  ```
102
105
 
103
- It provides an interactive scope and harness picker, with global installation
104
- selected by default. For scripts or a choice without prompts:
106
+ It provides interactive scope, harness, and routing choices. Global installation
107
+ and routing hooks for Claude/Codex are selected by default; choose skill-only
108
+ to omit hooks. Codex requires native hook trust before activation. For scripts or a choice without prompts:
105
109
 
106
110
  ```sh
107
111
  npx --yes delegation-layer install \
@@ -110,8 +114,10 @@ npx --yes delegation-layer install \
110
114
  --yes
111
115
  ```
112
116
 
113
- This path installs guidance only. It does not install the CLI, change provider
114
- logins, or run a task. Use the plugin path above when you want the skill and
117
+ The commands above do not install the CLI, change provider
118
+ logins, or run a task. Noninteractive installs remain skill-only unless you add
119
+ `--routing default`. See [routing setup and removal](docs/agent-routing.md).
120
+ Use the plugin path above when you want the skill and
115
121
  CLI bootstrap together.
116
122
 
117
123
  ### Install the CLI
@@ -249,3 +255,10 @@ The successor receives a new task ID and is observed with the same `status` and
249
255
  ## License
250
256
 
251
257
  This project is licensed under the [MIT License](LICENSE).
258
+
259
+ ### Consult models through Claude Code Router
260
+
261
+ Delegate also supports CCR-configured third-party and local models through
262
+ `ccr:print`. Ask your agent to “have CCR review this” and it can discover and
263
+ choose a configured model alias. CCR and Claude Code must already be installed
264
+ and the provider configured. See [provider guidance](docs/providers.md#claude-code-router).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
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,8 +1,8 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
3
  "displayName": "Delegation Layer",
4
- "version": "0.1.18",
5
- "description": "Consult external AI harnesses for reviews, research, implementation, and debate through the bounded, resumable Delegate CLI.",
4
+ "version": "0.1.20",
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",
8
8
  "url": "https://github.com/hishamkaram"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.18",
4
- "description": "Consult external AI harnesses for reviews, research, implementation, and debate through the bounded, resumable Delegate CLI.",
3
+ "version": "0.1.20",
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",
7
7
  "url": "https://github.com/hishamkaram"
@@ -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: Consult external AI agents and harnesses through Delegate for reviews, research, implementation, testing, second opinions, comparisons, and debates. Use when asked to ask Codex, consult Claude, get Antigravity’s opinion, or assign work to another harness or model, including external collaboration you choose during a task. 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
@@ -13,6 +13,9 @@ external harness to do work. Requests such as “ask Codex to review this”,
13
13
  collaboration even when the user never mentions Delegate. The same applies
14
14
  when you decide external expertise is useful to fulfill the user's task.
15
15
  These names are examples; discover supported destinations through the CLI.
16
+ “Claude Code Router” and “CCR” mean `ccr:print`, not ordinary Claude Code.
17
+ For that request, use Delegate with a CCR model alias; a Claude-specific skill
18
+ or subscription model does not fulfill the requested route.
16
19
 
17
20
  Ordinary subagents within the current harness remain available. Naming the
18
21
  current harness (for example, “have Claude investigate” while using Claude)
@@ -28,6 +31,16 @@ replace it with a provider command, a provider-specific plugin, or an API call.
28
31
  Do not inspect, authenticate, install, or repair provider CLIs to bypass a
29
32
  Delegate blocker.
30
33
 
34
+ A reported blocker is a valid final response to a delegation request. It does
35
+ not turn that request into an environment-repair task. When a response says
36
+ `failure.next_action: "stop_and_report"`, that attempt is finished. Include its
37
+ failure in your final response without opening a clarification dialog to choose
38
+ a fallback. For `task_record: not_created`, identify the requested destination
39
+ and quote the returned `task_id` (if present), `task_record`, `failure`, and
40
+ `error`. Do not append inferred state paths or provider-setup diagnoses. Do not run diagnostic commands, retry it, or use another integration.
41
+ Troubleshooting requires a separate user request. Other independently requested
42
+ tasks may proceed; the failed attempt must remain reported as failed or blocked.
43
+
31
44
  ## Rules
32
45
 
33
46
  1. Check whether `delegate` is already installed. A plugin SessionStart hook
@@ -39,16 +52,24 @@ Delegate blocker.
39
52
  name rather than a provider ID. Use `dispatch --auto` when none was chosen.
40
53
  Provider selection, executable checks, compatibility checks, authentication
41
54
  gates, and supervisor admission belong inside Delegation Layer.
42
- 3. Give every turn an absolute workspace, a separate state root, an explicit
43
- permission mode, and a finite budget. Preserve a caller-supplied
44
- `DELEGATE_ROOT`; do not replace it with a temporary directory.
45
- 4. Use `--json` and save the returned `task_id`. Read `admission`, `liveness`,
55
+ 3. Give every turn an absolute workspace, an explicit permission mode, and a
56
+ finite budget. Keep the state root outside the workspace. Reuse a supplied
57
+ `DELEGATE_ROOT` for all providers and tasks; do not invent per-provider or
58
+ per-task state roots. Task IDs separate work within that root.
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`,
46
62
  `publication`, `status`, `outcome`, `continuation`, `task_record`, `failure`,
47
63
  and `error` as separate fields.
48
64
  Delegate owns the supervisor lifecycle. Never install, configure, start,
49
65
  inspect, or repair Pueue, and never poll a task unless the response says its
50
66
  `task_record` is `created`.
51
- 5. Observe with `status` and collect with `collect`. Collection may recover the
67
+ 5. Observe with `status` and collect with `collect`. Keep collection in the
68
+ foreground until all requested tasks reach a terminal result or an explicit
69
+ blocker. Do not end a headless turn promising a background notification.
70
+ Pending publication (exit 3) means keep waiting, not success. Only detach
71
+ when the user explicitly requests it, retaining the exact task IDs.
72
+ Collection may recover the
52
73
  saved supervisor only to observe an already-requested budget stop; it never
53
74
  launches a provider or retries a task.
54
75
  6. If a task is timed out and its JSON says `continuation.resumable: true`, use
@@ -95,19 +116,9 @@ Use the matching catalog ID with `--provider`; do not silently substitute
95
116
  `--auto` or another provider. If the name is ambiguous, clarify the intended
96
117
  destination. If it is absent, report that this build does not support it.
97
118
  The catalog is not proof that a provider is installed, authenticated, or ready.
98
- If a side-effect-free readiness check is useful,
99
- run:
100
-
101
- ```sh
102
- delegate preflight --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE \
103
- --permission REQUESTED_MODE --json
104
- ```
105
-
106
- Replace `REQUESTED_MODE` with `read-only` for investigation or
107
- `workspace-write` for authorized edits. Preflight reports static admission only.
108
- It does not create a task, start the supervisor, or launch a provider. Do not keep
109
- retrying preflight when it says
110
- `blocked` or `unsupported`; report the bounded reason.
119
+ Dispatch performs admission checks; a separate preflight is not needed for a
120
+ normal task. For an explicitly requested readiness check, see
121
+ [preflight guidance](references/command-reference.md#checking-readiness).
111
122
 
112
123
  The catalog and `capabilities` response expose supported permission modes,
113
124
  request options, continuation, and the read-only mechanism. A read-only
@@ -116,10 +127,21 @@ behavior but is not an independent delegate-owned sandbox. Static discovery
116
127
  does not prove authentication or live acceptance; use the dispatch or live
117
128
  acceptance result for that evidence.
118
129
 
119
- Keep provider defaults when no model or effort was requested. When an explicit
130
+ Read `required_options` in provider discovery before dispatch. Supply every
131
+ required option; a provider's optional defaults do not replace required inputs.
132
+ For CCR / Claude Code Router or a CCR model request, read
133
+ [CCR model selection](references/ccr.md). A CCR route is external collaboration
134
+ even when you are already using Claude. Do not assume every open-source model
135
+ name belongs to CCR; clarify only if discovery leaves the destination ambiguous.
136
+
137
+ Keep provider defaults when no model or effort was requested and neither is required. When an explicit
120
138
  choice is needed, read [model and effort guidance](references/command-reference.md#choosing-models-and-effort).
121
- Pass requested choices through Delegate's public `--model` and `--effort`
122
- fields; discovery is advisory, never an allowlist.
139
+ Pass exact requested model IDs and effort values unchanged through Delegate's
140
+ public `--model` and `--effort` fields; discovery is advisory, never an allowlist.
141
+ For a natural-language model name, resolve one exact ID through discovery. If
142
+ it remains ambiguous or discovery is unavailable, ask for the exact model ID;
143
+ do not turn a display name into a guessed alias. An explicit ID needs no such
144
+ clarification just because it is absent from discovery.
123
145
 
124
146
  ### 3. Prepare separate paths and a finite brief
125
147
 
@@ -128,22 +150,18 @@ brief file that contains the requested work and its acceptance criteria. Keep
128
150
  the state root outside the workspace and provider-writable trees (which can
129
151
  include the system temporary directory). Use `DELEGATE_ROOT` when supplied:
130
152
 
131
- ```sh
132
- STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
133
- WORKSPACE="$PWD"
134
- BRIEF="$(mktemp)"
135
- cat >"$BRIEF" <<'EOF'
136
- Describe the delegated task, the files or behavior to change, and the checks
137
- that must pass. Keep the response concise and report validation evidence.
138
- EOF
139
- ```
153
+ Run path preparation and dispatch in **one shell/tool invocation**, as shown
154
+ below. Shell variables may disappear between tool calls. For later commands,
155
+ use the actual saved absolute paths or assign them again in that invocation;
156
+ never pass an empty `--root`, `--brief`, or `--cwd`.
140
157
 
141
- Replace the example brief with the actual user request. Do not place the state
158
+ Replace the example brief below with the actual user request. Do not place the state
142
159
  root inside the workspace or place secrets in either path’s task data. Keep it
143
160
  outside provider configuration and runtime directories as well. If delegate
144
- rejects placement before admission, choose a separate state directory; do not
145
- change provider settings. Once admitted, retain that state root for every
146
- observation and continuation.
161
+ rejects a caller-supplied state root, report the placement error rather than
162
+ silently replacing that root. If no root was supplied, choose one outside the
163
+ workspace and reuse it. Do not change provider settings. Retain the selected
164
+ root for every observation and continuation.
147
165
 
148
166
  ### 4. Dispatch one bounded turn
149
167
 
@@ -152,6 +170,13 @@ For a named harness or provider resolved in step 2, replace `--auto` with `--pro
152
170
  combine the two:
153
171
 
154
172
  ```sh
173
+ STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
174
+ WORKSPACE="$PWD"
175
+ BRIEF="$(mktemp)"
176
+ cat >"$BRIEF" <<'EOF'
177
+ Describe the delegated task, the files or behavior to change, and the checks
178
+ that must pass. Keep the response concise and report validation evidence.
179
+ EOF
155
180
  delegate --root "$STATE_ROOT" dispatch --auto \
156
181
  --brief "$BRIEF" \
157
182
  --cwd "$WORKSPACE" \
@@ -171,21 +196,26 @@ For independent work, the model may run several complete `dispatch` commands
171
196
  concurrently. Keep each task's brief, workspace, permission, and task ID
172
197
  independent. Do not configure Pueue or wait for one task before dispatching the
173
198
  next solely to serialize ordinary work. Inspect each returned task separately
174
- with `status` and `collect`.
175
-
176
- Save the exact `task_id` from the JSON response. The recovery steps below apply
177
- to parsed dispatch responses. If the CLI rejects the command syntax before
178
- dispatch (nonzero exit with a usage error and no JSON response), correct the
179
- reported syntax and invoke it again; argument parsing fails before admission and
180
- does not create a task record. For a parsed dispatch error, read its `failure`
181
- and `task_record` fields. If `task_record` is
182
- `not_created`, do not run `status`, `collect`, or `continue`; correct the request
183
- only when `failure.next_action` is `correct_request`, otherwise report the
184
- delegate failure and stop. If it is `created`, use `status` before taking any
185
- other action. If it is `unknown`, stop and report the failure: with an
186
- explicit task ID, absence can race another dispatch that is creating the same
187
- ID. Never retry that ID, run Pueue commands, or silently try another provider
188
- after a task may have been admitted.
199
+ with `status` and `collect`. Use independent tool calls or separate response
200
+ files, never background commands writing to the same stdout. Read
201
+ [parallel reviews and debates](references/collaboration.md) when coordinating
202
+ multiple participants or challenge rounds.
203
+
204
+ Save the exact `task_id` from the JSON response. Apply this decision separately
205
+ for **each attempt**, including requests issued together:
206
+
207
+ | Response | Next action |
208
+ |---|---|
209
+ | Usage error, no JSON response | Correct the reported syntax using Delegate help or `providers --json`, then invoke that request again. Parsing failed before admission. |
210
+ | `task_record: not_created` and `failure.next_action: correct_request` | Correct that request and retry it. |
211
+ | `task_record: not_created` with any other next action | Report that attempt's failure and stop it. Do not diagnose provider setup or substitute an integration. |
212
+ | `task_record: created` | Use `status` before taking any other action. Do not dispatch again. |
213
+ | `task_record: unknown` or an ambiguous response | Stop and report; do not retry an uncertain task creation. |
214
+
215
+ One attempt's `stop_and_report` does not prevent correcting another independent
216
+ request's usage error. Keep the failed attempt reported as failed. With an
217
+ explicit task ID, absence can race another dispatch creating the same ID;
218
+ never retry that uncertain ID or run Pueue commands.
189
219
 
190
220
  ### 5. Observe and collect
191
221
 
@@ -246,6 +276,10 @@ recruit more agents unless that is explicitly part of the task.
246
276
 
247
277
  ## Completion report
248
278
 
279
+ Build the report from observed CLI responses and collected evidence. Copy
280
+ returned values; do not reconstruct paths from example commands or shell
281
+ defaults. Omit unobserved configuration details.
282
+
249
283
  Report the original task ID, selected provider ID when the CLI returns one,
250
284
  the final admission/liveness/publication fields, the terminal outcome and
251
285
  evidence descriptors, and any continuation or blocked-authentication state.
@@ -150,6 +150,101 @@
150
150
  "external": false,
151
151
  "provider": null,
152
152
  "split": "validation"
153
+ },
154
+ {
155
+ "name": "ccr-review",
156
+ "prompt": "Ask Claude Code Router to review pricing.py for correctness without editing. Choose an appropriate configured model and report which one you used.",
157
+ "external": true,
158
+ "provider": "ccr:print",
159
+ "split": "development"
160
+ },
161
+ {
162
+ "name": "ccr-explicit-alias",
163
+ "prompt": "Ask CCR using the alias local-review to investigate pricing.py. Do not edit files.",
164
+ "external": true,
165
+ "provider": "ccr:print",
166
+ "model": "local-review",
167
+ "split": "validation"
168
+ },
169
+ {
170
+ "name": "ccr-write",
171
+ "prompt": "Have CCR with the alias local-review fix pricing.py so discounts are percentages, and test the correction. Authorize edits in this workspace.",
172
+ "external": true,
173
+ "provider": "ccr:print",
174
+ "model": "local-review",
175
+ "split": "validation"
176
+ },
177
+ {
178
+ "name": "ccr-follow-up",
179
+ "prompt": "Ask CCR using local-review to critique pricing.py, then ask that same session one follow-up about its recommendation. No edits.",
180
+ "external": true,
181
+ "provider": "ccr:print",
182
+ "model": "local-review",
183
+ "split": "validation"
184
+ },
185
+ {
186
+ "name": "ccr-explain",
187
+ "prompt": "Explain what Claude Code Router does. Do not ask it to perform work.",
188
+ "external": false,
189
+ "provider": null,
190
+ "split": "validation"
191
+ },
192
+ {
193
+ "name": "ccr-compare",
194
+ "prompt": "Ask CCR using local-review and a separate Codex session for independent reviews of pricing.py, then compare their findings. No edits.",
195
+ "external": true,
196
+ "provider": [
197
+ "ccr:print",
198
+ "codex:exec"
199
+ ],
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
153
248
  }
154
249
  ]
155
250
  }
@@ -0,0 +1,33 @@
1
+ # CCR model selection
2
+
3
+ Use this reference when asked to consult Claude Code Router (CCR), use one of
4
+ its configured model aliases, or compare its models with other harnesses.
5
+ CCR runs Claude Code against a configured third-party or local provider.
6
+
7
+ 1. Resolve CCR through `delegate providers --json`; its profile is `ccr:print`.
8
+ 2. Preserve an explicitly requested CCR alias as `--model ALIAS`. Do not replace
9
+ it with an upstream model ID or reject it solely because discovery omitted it.
10
+ 3. If no alias was chosen, run
11
+ `delegate models --provider ccr:print --cwd ABSOLUTE_WORKSPACE --json`.
12
+ Choose a suitable configured alias from the available metadata and report
13
+ the choice. Clarify when the intended model remains ambiguous. If discovery
14
+ is unavailable and no alias is known, report the blocker; do not guess.
15
+ 4. Dispatch through Delegate with `--provider ccr:print --model ALIAS`, the brief,
16
+ workspace, permission, finite budget, and `--json`. Use the normal status,
17
+ collect, and continuation procedure from the main skill.
18
+
19
+ CCR requires an explicit alias. Unspecified external collaboration still uses
20
+ `dispatch --auto`; do not prefer CCR unless the request calls for it. Multiple
21
+ aliases can be assigned independent tasks for comparison or debate.
22
+
23
+ Read-only selects native Claude plan behavior; workspace-write selects native
24
+ unattended tool execution. Neither is an independent Delegate sandbox. Preserve
25
+ requested effort through `--effort`; unknown effort metadata is not an allowlist
26
+ or a reason to invent a level. Leave effort unspecified unless requested.
27
+
28
+ Delegate uses CCR's foreground provider-only route. Model/provider setup and
29
+ credentials belong to CCR. Never run `ccr launch`, configure CCR, inspect its
30
+ SQLite database, call Claude directly, or select another integration to bypass a
31
+ Delegate error. Ordinary questions about CCR or installation do not trigger
32
+ external collaboration. An explicit request to use another integration remains
33
+ an explicit user choice.
@@ -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 "$STATE_ROOT" 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 "$STATE_ROOT" 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.
@@ -29,10 +29,10 @@ Dispatch flags:
29
29
  - `--budget DURATION`: finite turn budget;
30
30
  - `--auto`: let the CLI select a ready provider;
31
31
  - `--provider ID`: preserve the caller’s named harness or provider, resolved through the catalog;
32
- - `--model MODEL` and `--effort VALUE`: optional provider-advertised choices;
32
+ - `--model MODEL` and `--effort VALUE`: provider-advertised choices (CCR requires a model alias);
33
33
  Codex maps effort to TOML `model_reasoning_effort`, while Claude and AGY
34
34
  pass native effort flags; Pi maps effort to `--thinking`; OpenCode maps it to
35
- `--variant`; `default` is omitted;
35
+ `--variant`; CCR forwards effort to Claude and uses `--model` as a CCR alias; `default` is omitted;
36
36
  - `--native-timeout DURATION`: optional provider-native timeout where advertised.
37
37
 
38
38
  Model discovery uses the same `--provider ID` profiles and accepts an optional
@@ -51,8 +51,9 @@ Continuation flags:
51
51
 
52
52
  ## Choosing models and effort
53
53
 
54
- If the caller needs an explicit model or effort, use the implemented native
55
- discovery command for that provider:
54
+ Pass an explicitly supplied model ID and effort unchanged, even if discovery
55
+ is incomplete or does not list them. To resolve a natural-language model name
56
+ or choose an option the caller left open, use native discovery:
56
57
 
57
58
  ```sh
58
59
  delegate models --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE --json
@@ -68,6 +69,10 @@ requested value merely because discovery did not list it, and do not infer
68
69
  per-model effort support from the harness-wide list. If a selected model has
69
70
  `efforts: null` or `efforts: []`, omit `--effort` unless the caller explicitly
70
71
  requested it; do not invent model aliases or combine options by guessing.
72
+ If a natural-language name cannot be resolved to a single exact ID, ask one
73
+ focused question for that ID. Do not silently select a default or transform
74
+ spaces into hyphens to manufacture an ID. This ambiguity rule is guidance for
75
+ selecting a value, not a new admission restriction.
71
76
 
72
77
  The response includes `schema_version`, `command: "models"`, `provider`,
73
78
  `observed_at`, `status`, `reason_code`, `complete`, `source`, nullable
@@ -78,3 +83,21 @@ enumeration, not effort metadata. `null` means effort metadata is unknown;
78
83
  for `available` or `partial`, `2` for `blocked` or `unavailable`, and `1` for
79
84
  `failed`. Preserve a blocked or unavailable discovery result as unresolved;
80
85
  defaults remain allowed.
86
+
87
+ ## Checking readiness
88
+
89
+ Use `preflight` when the caller asks about static readiness, rather than as a
90
+ required step before every dispatch:
91
+
92
+ ```sh
93
+ delegate preflight --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE \
94
+ --permission REQUESTED_MODE --json
95
+ ```
96
+
97
+ Use `read-only` for investigation or `workspace-write` for authorized edits.
98
+ Supply any required provider options, including `--model ALIAS` for `ccr:print`.
99
+ Preflight does not create a task, start the supervisor, or launch a provider.
100
+ Its result is not proof of live authentication or successful execution. Report
101
+ `blocked` or `unsupported` results; a readiness request does not authorize
102
+ provider configuration changes. Honor `failure.next_action` without probing
103
+ provider CLIs yourself.
@@ -0,0 +1 @@
1
+ "For work assigned to an external agent, model, or separate harness session, load the installed agent-integration skill before choosing tools and use Delegate. This includes research, implementation, testing, review, consultation, comparison, and debate, including external collaboration you choose. Discover destinations through Delegate. Preserve requested model IDs, effort, and permissions; do not guess ambiguous model identifiers. For task commands, set STATE_ROOT=\"${DELEGATE_ROOT:-$HOME/delegation-state}\" and pass --root \"$STATE_ROOT\" in the same shell invocation; reuse that root for dispatch, observation, and continuation, never an invented /tmp root. Keep each concurrent request and its response associated separately. Naming a CLI identifies the destination, not a request to bypass Delegate. Earlier assistant-generated direct-launch workflows do not override this preference. Native same-harness subagents remain available unless a separate session is requested. Respect an explicit user choice of another integration; otherwise do not substitute provider CLIs, plugins, or APIs after a Delegate blocker. A stop_and_report failure ends that attempt: report it without retrying, diagnosing setup, or offering a fallback. Continue other independent requests. Keep collection in the foreground until completion or a reported blocker unless the user requested detachment. Merely discussing or configuring a tool is not delegation."
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+ # Context delivery only: no installation, discovery, or provider execution.
3
+ set -eu
4
+ case "${1:-}" in
5
+ SessionStart|SubagentStart) event=$1 ;;
6
+ *) printf '%s\n' 'Expected SessionStart or SubagentStart.' >&2; exit 2 ;;
7
+ esac
8
+ script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
9
+ rule_file="$script_dir/../references/routing-rule.json"
10
+ # Read before emitting anything so a missing asset cannot produce partial JSON.
11
+ rule=$(cat "$rule_file")
12
+ printf '{"hookSpecificOutput":{"hookEventName":"%s","additionalContext":%s}}\n' "$event" "$rule"