delegation-layer 0.1.17 → 0.1.19

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
@@ -36,6 +36,22 @@ already use instead of replacing them.
36
36
  3. Delegation Layer admits one bounded provider turn through the supervisor.
37
37
  4. The lead agent collects the sealed result and evidence.
38
38
 
39
+ ## Ask naturally
40
+
41
+ Try “Ask Codex to review this change”, “Get Antigravity’s opinion”, or
42
+ “Have Claude investigate this failure”. The skill routes external collaboration
43
+ through `delegate`, preserves a named destination, and collects task evidence.
44
+ Ordinary native subagents remain available for work inside the current harness,
45
+ even when you name that harness. Ask for a separate session when you want
46
+ Delegate to launch another instance of the same CLI.
47
+
48
+ Skill installation makes this workflow discoverable; it does not force a model
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.
51
+ If an agent bypasses Delegate, that is a selection failure, not proof the
52
+ integration worked. For a persistent preference, see
53
+ [configure agent routing](docs/agent-routing.md).
54
+
39
55
  ## Install
40
56
 
41
57
  ### Recommended for Codex and Claude Code
@@ -234,3 +250,10 @@ The successor receives a new task ID and is observed with the same `status` and
234
250
  ## License
235
251
 
236
252
  This project is licensed under the [MIT License](LICENSE).
253
+
254
+ ### Consult models through Claude Code Router
255
+
256
+ Delegate also supports CCR-configured third-party and local models through
257
+ `ccr:print`. Ask your agent to “have CCR review this” and it can discover and
258
+ choose a configured model alias. CCR and Claude Code must already be installed
259
+ 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.17",
3
+ "version": "0.1.19",
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.17",
5
- "description": "Route every delegated agent task through a bounded, resumable Delegation Layer CLI.",
4
+ "version": "0.1.19",
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.17",
4
- "description": "Route every delegated agent task through a bounded, resumable Delegation Layer CLI.",
3
+ "version": "0.1.19",
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"
@@ -19,7 +19,7 @@
19
19
  "skills": "./skills/",
20
20
  "interface": {
21
21
  "displayName": "Delegation Layer",
22
- "shortDescription": "Delegate agent work reliably",
22
+ "shortDescription": "Consult external AI harnesses",
23
23
  "longDescription": "Routes external agent work through a bounded, resumable CLI with durable evidence and provider-neutral capability handling.",
24
24
  "developerName": "Hesham Karam",
25
25
  "category": "Productivity",
@@ -28,6 +28,6 @@
28
28
  "Bounded execution",
29
29
  "Resumable tasks"
30
30
  ],
31
- "defaultPrompt": "Use $agent-integration whenever another agent, harness, model, or provider should perform work."
31
+ "defaultPrompt": "Use $agent-integration to consult another harness or model for review, research, implementation, testing, or debate."
32
32
  }
33
33
  }
@@ -1,16 +1,45 @@
1
1
  ---
2
2
  name: agent-integration
3
- description: Use the Delegation Layer CLI whenever another agent, harness, model, or provider should perform work, then collect durable evidence and continue timed out sessions safely.
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.
4
4
  ---
5
5
 
6
6
  # Delegation Layer
7
7
 
8
- Use this skill whenever the user asks another agent, harness, model, or provider
9
- to perform any part of the work. This includes implementation, research,
10
- review, testing, debate, comparison, summarization, and follow-up work. Route
11
- that work through the local `delegate` CLI. The CLI is the only integration
12
- surface. Do not call, inspect, authenticate, or install a provider CLI directly,
13
- and do not replace delegation with a provider's native subagent or team feature.
8
+ ## When to use
9
+
10
+ Use this skill before selecting a provider-specific plugin or launching an
11
+ external harness to do work. Requests such as “ask Codex to review this”,
12
+ “get Antigravity’s opinion”, and “have Claude investigate” are external
13
+ collaboration even when the user never mentions Delegate. The same applies
14
+ when you decide external expertise is useful to fulfill the user's task.
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.
19
+
20
+ Ordinary subagents within the current harness remain available. Naming the
21
+ current harness (for example, “have Claude investigate” while using Claude)
22
+ also permits native delegation unless the user requests a separate session.
23
+ A separate CLI session uses Delegate even when its brand matches yours. A subagent
24
+ or plugin that calls an external harness is still external collaboration and
25
+ uses Delegate. Merely discussing a provider, editing documentation about it,
26
+ or troubleshooting its installation does not trigger delegation. Respect an
27
+ explicit user choice of another integration; this skill does not override it.
28
+
29
+ The local `delegate` CLI is the integration surface for external work. Do not
30
+ replace it with a provider command, a provider-specific plugin, or an API call.
31
+ Do not inspect, authenticate, install, or repair provider CLIs to bypass a
32
+ Delegate blocker.
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.
14
43
 
15
44
  ## Rules
16
45
 
@@ -19,11 +48,14 @@ and do not replace delegation with a provider's native subagent or team feature.
19
48
  never installs or repairs the CLI itself. If `delegate` is still missing or
20
49
  unusable, report the bootstrap failure and stop; never fall back to a native
21
50
  provider command.
22
- 2. Use `dispatch --auto` unless the user explicitly selected a provider ID.
51
+ 2. Preserve a named harness or provider, even when the user supplied a natural
52
+ name rather than a provider ID. Use `dispatch --auto` when none was chosen.
23
53
  Provider selection, executable checks, compatibility checks, authentication
24
54
  gates, and supervisor admission belong inside Delegation Layer.
25
- 3. Give every turn an absolute workspace, a separate state root, an explicit
26
- permission mode, and a finite budget.
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.
27
59
  4. Use `--json` and save the returned `task_id`. Read `admission`, `liveness`,
28
60
  `publication`, `status`, `outcome`, `continuation`, `task_record`, `failure`,
29
61
  and `error` as separate fields.
@@ -66,27 +98,20 @@ Do not substitute a provider command.
66
98
 
67
99
  ### 2. Discover only when useful
68
100
 
69
- For the normal path, use automatic selection directly. If you need to explain
70
- what the installed build knows, run:
101
+ If no destination was named, use automatic selection directly. If the user
102
+ named a harness (for example, “Codex”), resolve its exact provider ID from:
71
103
 
72
104
  ```sh
73
105
  delegate providers --json
74
106
  ```
75
107
 
76
- This is a catalog, not proof that a provider is installed, authenticated, or
77
- ready. If the caller named one provider ID and wants a side-effect-free check,
78
- run:
79
-
80
- ```sh
81
- delegate preflight --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE \
82
- --permission REQUESTED_MODE --json
83
- ```
84
-
85
- Replace `REQUESTED_MODE` with `read-only` for investigation or
86
- `workspace-write` for authorized edits. Preflight reports static admission only.
87
- It does not create a task, start the supervisor, or launch a provider. Do not keep
88
- retrying preflight when it says
89
- `blocked` or `unsupported`; report the bounded reason.
108
+ Use the matching catalog ID with `--provider`; do not silently substitute
109
+ `--auto` or another provider. If the name is ambiguous, clarify the intended
110
+ destination. If it is absent, report that this build does not support it.
111
+ The catalog is not proof that a provider is installed, authenticated, or ready.
112
+ Dispatch performs admission checks; a separate preflight is not needed for a
113
+ normal task. For an explicitly requested readiness check, see
114
+ [preflight guidance](references/command-reference.md#checking-readiness).
90
115
 
91
116
  The catalog and `capabilities` response expose supported permission modes,
92
117
  request options, continuation, and the read-only mechanism. A read-only
@@ -95,64 +120,52 @@ behavior but is not an independent delegate-owned sandbox. Static discovery
95
120
  does not prove authentication or live acceptance; use the dispatch or live
96
121
  acceptance result for that evidence.
97
122
 
98
- If the caller needs an explicit model or effort, use the implemented native
99
- discovery command for that provider:
123
+ Read `required_options` in provider discovery before dispatch. Supply every
124
+ required option; a provider's optional defaults do not replace required inputs.
125
+ For CCR / Claude Code Router or a CCR model request, read
126
+ [CCR model selection](references/ccr.md). A CCR route is external collaboration
127
+ even when you are already using Claude. Do not assume every open-source model
128
+ name belongs to CCR; clarify only if discovery leaves the destination ambiguous.
100
129
 
101
- ```sh
102
- delegate models --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE --json
103
- ```
104
-
105
- Omit `--cwd` to use the current directory. Run discovery only when the caller
106
- needs a non-default choice; provider defaults are valid. The command uses the
107
- state-rooted supervisor and a bounded `model-discovery-v1` five-minute native
108
- inspection to allow first-run provider model/cache initialization. It creates
109
- inspection evidence without admitting a provider task, and may contact the
110
- provider CLI. It is advisory and never an admission allowlist. Do not reject a
111
- requested value merely because discovery did not list it, and do not infer
112
- per-model effort support from the harness-wide list. If a selected model has
113
- `efforts: null` or `efforts: []`, omit `--effort` unless the caller explicitly
114
- requested it; do not invent model aliases or combine options by guessing.
115
-
116
- The response includes `schema_version`, `command: "models"`, `provider`,
117
- `observed_at`, `status`, `reason_code`, `complete`, `source`, nullable
118
- `efforts`, and model rows with exact `id` values plus optional `name`, nullable
119
- `efforts`, and optional `default_effort`. `complete` describes model
120
- enumeration, not effort metadata. `null` means effort metadata is unknown;
121
- `[]` means the provider explicitly reported no choices. Discovery exits `0`
122
- for `available` or `partial`, `2` for `blocked` or `unavailable`, and `1` for
123
- `failed`. Preserve a blocked or unavailable discovery result as unresolved;
124
- defaults remain allowed.
130
+ Keep provider defaults when no model or effort was requested and neither is required. When an explicit
131
+ 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.
125
134
 
126
135
  ### 3. Prepare separate paths and a finite brief
127
136
 
128
137
  Use an existing task brief when one is supplied. Otherwise create a bounded
129
138
  brief file that contains the requested work and its acceptance criteria. Keep
130
- the state root outside the workspace:
139
+ the state root outside the workspace and provider-writable trees (which can
140
+ include the system temporary directory). Use `DELEGATE_ROOT` when supplied:
131
141
 
132
- ```sh
133
- STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
134
- WORKSPACE="$PWD"
135
- BRIEF="$(mktemp)"
136
- cat >"$BRIEF" <<'EOF'
137
- Describe the delegated task, the files or behavior to change, and the checks
138
- that must pass. Keep the response concise and report validation evidence.
139
- EOF
140
- ```
142
+ Run path preparation and dispatch in **one shell/tool invocation**, as shown
143
+ below. Shell variables may disappear between tool calls. For later commands,
144
+ use the actual saved absolute paths or assign them again in that invocation;
145
+ never pass an empty `--root`, `--brief`, or `--cwd`.
141
146
 
142
- Replace the example brief with the actual user request. Do not place the state
147
+ Replace the example brief below with the actual user request. Do not place the state
143
148
  root inside the workspace or place secrets in either path’s task data. Keep it
144
149
  outside provider configuration and runtime directories as well. If delegate
145
- rejects placement before admission, choose a separate state directory; do not
146
- change provider settings. Once admitted, retain that state root for every
147
- observation and continuation.
150
+ 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.
148
154
 
149
155
  ### 4. Dispatch one bounded turn
150
156
 
151
- Use automatic selection unless the user explicitly supplied `PROVIDER_ID`.
152
- For a named provider, replace `--auto` with `--provider PROVIDER_ID`; never
157
+ Use automatic selection unless the user named a destination.
158
+ For a named harness or provider resolved in step 2, replace `--auto` with `--provider PROVIDER_ID`; never
153
159
  combine the two:
154
160
 
155
161
  ```sh
162
+ STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
163
+ WORKSPACE="$PWD"
164
+ BRIEF="$(mktemp)"
165
+ cat >"$BRIEF" <<'EOF'
166
+ Describe the delegated task, the files or behavior to change, and the checks
167
+ that must pass. Keep the response concise and report validation evidence.
168
+ EOF
156
169
  delegate --root "$STATE_ROOT" dispatch --auto \
157
170
  --brief "$BRIEF" \
158
171
  --cwd "$WORKSPACE" \
@@ -174,28 +187,21 @@ independent. Do not configure Pueue or wait for one task before dispatching the
174
187
  next solely to serialize ordinary work. Inspect each returned task separately
175
188
  with `status` and `collect`.
176
189
 
177
- When an explicit selection is supplied, pass it through the public fields:
178
- `--model MODEL` and `--effort VALUE`. Codex encodes effort as its native TOML
179
- `model_reasoning_effort` setting; Claude and AGY use their native effort flags;
180
- Pi maps effort to `--thinking`; and OpenCode maps effort to `--variant`. An
181
- omitted or `default` effort is omitted from native argv. For AGY read-only,
182
- `--permission read-only` selects the exact native `--sandbox --mode plan` path
183
- without a bypass. Authorized AGY workspace-write retains its existing native
184
- bypass. Do not add these native flags yourself.
185
-
186
- Save the exact `task_id` from the JSON response. The recovery steps below apply
187
- to parsed dispatch responses. If the CLI rejects the command syntax before
188
- dispatch (nonzero exit with a usage error and no JSON response), correct the
189
- reported syntax and invoke it again; argument parsing fails before admission and
190
- does not create a task record. For a parsed dispatch error, read its `failure`
191
- and `task_record` fields. If `task_record` is
192
- `not_created`, do not run `status`, `collect`, or `continue`; correct the request
193
- only when `failure.next_action` is `correct_request`, otherwise report the
194
- delegate failure and stop. If it is `created`, use `status` before taking any
195
- other action. If it is `unknown`, stop and report the failure: with an
196
- explicit task ID, absence can race another dispatch that is creating the same
197
- ID. Never retry that ID, run Pueue commands, or silently try another provider
198
- after a task may have been admitted.
190
+ Save the exact `task_id` from the JSON response. Apply this decision separately
191
+ for **each attempt**, including requests issued together:
192
+
193
+ | Response | Next action |
194
+ |---|---|
195
+ | Usage error, no JSON response | Correct the reported syntax using Delegate help or `providers --json`, then invoke that request again. Parsing failed before admission. |
196
+ | `task_record: not_created` and `failure.next_action: correct_request` | Correct that request and retry it. |
197
+ | `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. |
198
+ | `task_record: created` | Use `status` before taking any other action. Do not dispatch again. |
199
+ | `task_record: unknown` or an ambiguous response | Stop and report; do not retry an uncertain task creation. |
200
+
201
+ One attempt's `stop_and_report` does not prevent correcting another independent
202
+ request's usage error. Keep the failed attempt reported as failed. With an
203
+ explicit task ID, absence can race another dispatch creating the same ID;
204
+ never retry that uncertain ID or run Pueue commands.
199
205
 
200
206
  ### 5. Observe and collect
201
207
 
@@ -220,82 +226,46 @@ copy unrestricted provider output into the control response.
220
226
 
221
227
  ### 6. Continue a timed out turn
222
228
 
223
- When `status` or `collect` returns `status: "timed_out"`, inspect the nested
224
- continuation object:
225
-
226
- ```json
227
- {
228
- "status": "timed_out",
229
- "continuation": {
230
- "resumable": true,
231
- "mode": "native",
232
- "predecessor_task_id": "TASK_ID",
233
- "continue_command": "delegate continue --task TASK_ID --json"
234
- }
235
- }
236
- ```
237
-
238
- If `resumable` is true, create the linked successor through the public
239
- continuation command. Supply a new follow-up brief when the next turn needs a
240
- new instruction:
241
-
242
- ```sh
243
- delegate --root "$STATE_ROOT" continue \
244
- --task TASK_ID \
245
- --brief "$FOLLOW_UP_BRIEF" \
246
- --budget 30m \
247
- --json
248
- ```
249
-
250
- The command preserves the exact provider session and permission mode and
251
- creates a new task ID. Do not add `--permission` to `continue`. Always include
252
- the original `--root`, even if a returned command hint omits it. Observe and
253
- collect the successor by repeating step 5. If `resumable` is
254
- false, report the reason and stop; a fresh dispatch would lose the original
255
- conversation and is not an equivalent recovery.
256
-
257
- If `continue` returns an error, use its `failure` and `task_record` fields just
258
- as for dispatch: when the record is `created`, check the returned successor
259
- `task_id` with `status`; when it is `not_created`, correct the request only if
260
- `failure.next_action` is `correct_request`; and when it is `unknown`, stop and
261
- report the failure. Do not repeat `continue` while successor creation is
262
- unknown.
263
-
264
- ## JSON decisions
265
-
266
- The capability projection uses the stable `runtime-capability-v1` contract.
267
- Catalog responses have `verification: "catalog"` and `status: "unknown"`.
268
- Preflight responses have `verification: "preflight"` and describe static
269
- readiness. A dispatch response can report `verification: "runtime"` only after
270
- the supervised runtime probe has observed the required behavior and executable
271
- identity.
272
-
273
- Versions and help text are observations. Accept any valid nonempty version
274
- reported by the CLI; never apply a semantic-version allowlist or web lookup.
275
- The adapter’s required flags and runtime behavior decide compatibility.
276
-
277
- Authentication is a separate live gate. `live_acceptance.status` values are
278
- `not_run`, `passed`, or `blocked`; a blocked authentication prerequisite is
279
- neutral evidence and must not be relabeled. Report the missing authentication
280
- prerequisite and stop that attempt; do not retry or authenticate the provider.
281
-
282
- The task response separates:
283
-
284
- - `admission`: whether the request was accepted by the durable boundary;
285
- - `liveness`: the observed supervisor state;
286
- - `publication`: whether validated evidence was committed or rejected;
287
- - `outcome`: the terminal authority, when available;
288
- - `continuation`: whether the exact session can make a linked successor; and
289
- - `error`: bounded operational diagnostics.
290
-
291
- See [references/command-reference.md](references/command-reference.md) for
292
- the command matrix, [references/result-handling.md](references/result-handling.md)
293
- for decision rules, and [references/continuation.md](references/continuation.md)
294
- for timeout recovery. The examples and machine-readable checks in `examples/`
295
- and `evals/` are part of this skill package.
229
+ When `status` or `collect` reports `timed_out`, read
230
+ [continuation and timeout recovery](references/continuation.md). If
231
+ `continuation.resumable` is true, use `continue --task TASK_ID` with the original
232
+ state root and a finite budget, then observe the returned successor ID. Do not
233
+ wait indefinitely for pending publication or restart the task as an unrelated
234
+ dispatch. If continuation is unavailable, report its reason. Apply the same
235
+ `failure` and `task_record` decisions as for dispatch; never repeat an uncertain
236
+ successor creation.
237
+
238
+ ## Comparisons, debate, and follow-up
239
+
240
+ Choose a finite scope and number of rounds appropriate to the user's request.
241
+ For independent opinions, dispatch separate briefs to the chosen destinations
242
+ and collect each result. Summarize the relevant findings as task data in the
243
+ next brief; do not forward credentials or unrestricted output. Use a supported
244
+ `continue` for an exact-session follow-up, or a new bounded task for an
245
+ independent question. Preserve which agent supplied each finding, explain
246
+ agreements and disagreements, and stop at the agreed scope or a blocker.
247
+ An external worker should perform its assigned work; do not ask it to recursively
248
+ recruit more agents unless that is explicitly part of the task.
249
+
250
+ ## Details when needed
251
+
252
+ - Read [command reference](references/command-reference.md) when choosing
253
+ model/effort options or another public command.
254
+ - Read [result handling](references/result-handling.md) when interpreting
255
+ admission, publication, authentication, errors, or exit codes.
256
+ - Read [continuation](references/continuation.md) for timeout recovery or an
257
+ exact-session follow-up.
258
+ - Use [read-only example](examples/read-only-task.md),
259
+ [write example](examples/workspace-write-task.md), and
260
+ [JSON examples](examples/json-results.md) when constructing a task or parsing
261
+ unfamiliar output. Do not load every reference for a routine dispatch.
296
262
 
297
263
  ## Completion report
298
264
 
265
+ Build the report from observed CLI responses and collected evidence. Copy
266
+ returned values; do not reconstruct paths from example commands or shell
267
+ defaults. Omit unobserved configuration details.
268
+
299
269
  Report the original task ID, selected provider ID when the CLI returns one,
300
270
  the final admission/liveness/publication fields, the terminal outcome and
301
271
  evidence descriptors, and any continuation or blocked-authentication state.