delegation-layer 0.1.16 → 0.1.18

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 (22) hide show
  1. package/README.md +47 -4
  2. package/install.sh +37 -6
  3. package/package.json +2 -1
  4. package/plugins/delegation-layer/.claude-plugin/plugin.json +22 -0
  5. package/plugins/delegation-layer/.codex-plugin/plugin.json +33 -0
  6. package/plugins/delegation-layer/hooks/hooks.json +14 -0
  7. package/plugins/delegation-layer/scripts/ensure-delegate.sh +123 -0
  8. package/plugins/delegation-layer/scripts/install-cli.sh +108 -0
  9. package/plugins/delegation-layer/skills/agent-integration/SKILL.md +251 -0
  10. package/plugins/delegation-layer/skills/agent-integration/evals/evals.json +61 -0
  11. package/plugins/delegation-layer/skills/agent-integration/evals/routing.json +155 -0
  12. package/plugins/delegation-layer/skills/agent-integration/examples/json-results.md +14 -0
  13. package/plugins/delegation-layer/skills/agent-integration/examples/read-only-task.md +12 -0
  14. package/plugins/delegation-layer/skills/agent-integration/examples/workspace-write-task.md +14 -0
  15. package/plugins/delegation-layer/skills/agent-integration/references/command-reference.md +80 -0
  16. package/plugins/delegation-layer/skills/agent-integration/references/continuation.md +49 -0
  17. package/plugins/delegation-layer/skills/agent-integration/references/result-handling.md +44 -0
  18. package/skills/agent-integration/SKILL.md +80 -124
  19. package/skills/agent-integration/evals/routing.json +155 -0
  20. package/skills/agent-integration/references/command-reference.md +31 -1
  21. package/skills/agent-integration/references/continuation.md +4 -1
  22. package/skills/agent-integration/references/result-handling.md +14 -7
@@ -0,0 +1,44 @@
1
+ # Result handling
2
+
3
+ Use the response fields independently. A successful control command is not
4
+ the same as a successful provider result.
5
+
6
+ 1. Save `task_id` immediately after dispatch or continue.
7
+ 2. For a dispatch or continue error, inspect `task_record` first. When it is
8
+ `created`, observe the returned ID with `status`. When it is `not_created`,
9
+ do not poll; correct the request only if `failure.next_action` is
10
+ `correct_request`, otherwise report and stop. When it is `unknown`, stop and
11
+ report without polling or retrying. Status and collect can report
12
+ `admission: "unknown"` alongside valid terminal evidence for an existing task.
13
+ 3. If `status` is `timed_out`, follow the continuation procedure before treating
14
+ pending publication as a reason to wait. `continuation.resumable: true`
15
+ permits a linked successor even when no outcome has been published.
16
+ 4. If `publication` is committed and `outcome.verdict` is committed, return
17
+ the result and its payload/evidence descriptors.
18
+ 5. If `outcome.verdict` is rejected, report a terminal rejected result with its
19
+ refusal and evidence. Do not retry automatically.
20
+ 6. Otherwise, if `liveness` is queued or running or publication is pending,
21
+ observe the same task again with a finite watch interval.
22
+ 7. If authentication is `blocked`, preserve that neutral state and tell the
23
+ caller what prerequisite is unavailable without inventing a login command.
24
+ 8. Never relaunch an uncertain task by guessing. Observe only a task whose
25
+ record is known to exist; the `task_record` decision above takes precedence.
26
+
27
+ For `delegate models`, validate the complete JSON envelope before using any
28
+ fact. Treat `available` and `partial` with exit `0` as observations, preserve
29
+ `blocked` and `unavailable` with exit `2` as unresolved prerequisites, and
30
+ preserve `failed` with exit `1` as a discovery failure. `complete` refers to
31
+ model enumeration. Keep `efforts: null` distinct from `efforts: []`, and do not
32
+ apply harness-wide effort choices to every model. Discovery is advisory and
33
+ never an admission allowlist; a provider default remains valid and a listed
34
+ model is not an execution guarantee.
35
+
36
+ Exit codes are bounded control signals: `0` is a completed command, `1` is an
37
+ operational error, `2` is an invalid or unsupported request, `3` is a pending
38
+ collection watch, and `4` is a validated rejected outcome.
39
+
40
+ Catalog facts (`verification: "catalog"`) are not runtime proof. Preflight
41
+ checks static readiness; runtime verification requires the supervised probe.
42
+ Versions and help are observations, not semantic-version allowlists.
43
+ Authentication is a separate live gate (`not_run`, `passed`, or `blocked`).
44
+ Report a blocked prerequisite without inventing a login command or retrying.
@@ -1,23 +1,47 @@
1
1
  ---
2
2
  name: agent-integration
3
- description: Use the installed Delegation Layer CLI to select a ready provider, run one bounded agent turn, collect durable JSON evidence, and continue a timed out session safely.
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.
4
4
  ---
5
5
 
6
6
  # Delegation Layer
7
7
 
8
- Use this skill when a task should be performed by another coding agent through
9
- the local `delegate` CLI. The CLI is the only integration surface. Do not call,
10
- inspect, authenticate, or install a provider CLI directly.
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
+
17
+ Ordinary subagents within the current harness remain available. Naming the
18
+ current harness (for example, “have Claude investigate” while using Claude)
19
+ also permits native delegation unless the user requests a separate session.
20
+ A separate CLI session uses Delegate even when its brand matches yours. A subagent
21
+ or plugin that calls an external harness is still external collaboration and
22
+ uses Delegate. Merely discussing a provider, editing documentation about it,
23
+ or troubleshooting its installation does not trigger delegation. Respect an
24
+ explicit user choice of another integration; this skill does not override it.
25
+
26
+ The local `delegate` CLI is the integration surface for external work. Do not
27
+ replace it with a provider command, a provider-specific plugin, or an API call.
28
+ Do not inspect, authenticate, install, or repair provider CLIs to bypass a
29
+ Delegate blocker.
11
30
 
12
31
  ## Rules
13
32
 
14
- 1. Check whether `delegate` is already installed. If it is missing, report the
15
- missing prerequisite and stop. This skill never installs or repairs the CLI.
16
- 2. Use `dispatch --auto` unless the user explicitly selected a provider ID.
33
+ 1. Check whether `delegate` is already installed. A plugin SessionStart hook
34
+ normally bootstraps the self-contained CLI when it is missing. This skill
35
+ never installs or repairs the CLI itself. If `delegate` is still missing or
36
+ unusable, report the bootstrap failure and stop; never fall back to a native
37
+ provider command.
38
+ 2. Preserve a named harness or provider, even when the user supplied a natural
39
+ name rather than a provider ID. Use `dispatch --auto` when none was chosen.
17
40
  Provider selection, executable checks, compatibility checks, authentication
18
41
  gates, and supervisor admission belong inside Delegation Layer.
19
42
  3. Give every turn an absolute workspace, a separate state root, an explicit
20
- permission mode, and a finite budget.
43
+ permission mode, and a finite budget. Preserve a caller-supplied
44
+ `DELEGATE_ROOT`; do not replace it with a temporary directory.
21
45
  4. Use `--json` and save the returned `task_id`. Read `admission`, `liveness`,
22
46
  `publication`, `status`, `outcome`, `continuation`, `task_record`, `failure`,
23
47
  and `error` as separate fields.
@@ -60,15 +84,18 @@ Do not substitute a provider command.
60
84
 
61
85
  ### 2. Discover only when useful
62
86
 
63
- For the normal path, use automatic selection directly. If you need to explain
64
- what the installed build knows, run:
87
+ If no destination was named, use automatic selection directly. If the user
88
+ named a harness (for example, “Codex”), resolve its exact provider ID from:
65
89
 
66
90
  ```sh
67
91
  delegate providers --json
68
92
  ```
69
93
 
70
- This is a catalog, not proof that a provider is installed, authenticated, or
71
- ready. If the caller named one provider ID and wants a side-effect-free check,
94
+ Use the matching catalog ID with `--provider`; do not silently substitute
95
+ `--auto` or another provider. If the name is ambiguous, clarify the intended
96
+ destination. If it is absent, report that this build does not support it.
97
+ The catalog is not proof that a provider is installed, authenticated, or ready.
98
+ If a side-effect-free readiness check is useful,
72
99
  run:
73
100
 
74
101
  ```sh
@@ -89,39 +116,17 @@ behavior but is not an independent delegate-owned sandbox. Static discovery
89
116
  does not prove authentication or live acceptance; use the dispatch or live
90
117
  acceptance result for that evidence.
91
118
 
92
- If the caller needs an explicit model or effort, use the implemented native
93
- discovery command for that provider:
94
-
95
- ```sh
96
- delegate models --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE --json
97
- ```
98
-
99
- Omit `--cwd` to use the current directory. Run discovery only when the caller
100
- needs a non-default choice; provider defaults are valid. The command uses the
101
- state-rooted supervisor and a bounded `model-discovery-v1` five-minute native
102
- inspection to allow first-run provider model/cache initialization. It creates
103
- inspection evidence without admitting a provider task, and may contact the
104
- provider CLI. It is advisory and never an admission allowlist. Do not reject a
105
- requested value merely because discovery did not list it, and do not infer
106
- per-model effort support from the harness-wide list. If a selected model has
107
- `efforts: null` or `efforts: []`, omit `--effort` unless the caller explicitly
108
- requested it; do not invent model aliases or combine options by guessing.
109
-
110
- The response includes `schema_version`, `command: "models"`, `provider`,
111
- `observed_at`, `status`, `reason_code`, `complete`, `source`, nullable
112
- `efforts`, and model rows with exact `id` values plus optional `name`, nullable
113
- `efforts`, and optional `default_effort`. `complete` describes model
114
- enumeration, not effort metadata. `null` means effort metadata is unknown;
115
- `[]` means the provider explicitly reported no choices. Discovery exits `0`
116
- for `available` or `partial`, `2` for `blocked` or `unavailable`, and `1` for
117
- `failed`. Preserve a blocked or unavailable discovery result as unresolved;
118
- defaults remain allowed.
119
+ Keep provider defaults when no model or effort was requested. When an explicit
120
+ 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.
119
123
 
120
124
  ### 3. Prepare separate paths and a finite brief
121
125
 
122
126
  Use an existing task brief when one is supplied. Otherwise create a bounded
123
127
  brief file that contains the requested work and its acceptance criteria. Keep
124
- the state root outside the workspace:
128
+ the state root outside the workspace and provider-writable trees (which can
129
+ include the system temporary directory). Use `DELEGATE_ROOT` when supplied:
125
130
 
126
131
  ```sh
127
132
  STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
@@ -142,8 +147,8 @@ observation and continuation.
142
147
 
143
148
  ### 4. Dispatch one bounded turn
144
149
 
145
- Use automatic selection unless the user explicitly supplied `PROVIDER_ID`.
146
- For a named provider, replace `--auto` with `--provider PROVIDER_ID`; never
150
+ Use automatic selection unless the user named a destination.
151
+ For a named harness or provider resolved in step 2, replace `--auto` with `--provider PROVIDER_ID`; never
147
152
  combine the two:
148
153
 
149
154
  ```sh
@@ -168,15 +173,6 @@ independent. Do not configure Pueue or wait for one task before dispatching the
168
173
  next solely to serialize ordinary work. Inspect each returned task separately
169
174
  with `status` and `collect`.
170
175
 
171
- When an explicit selection is supplied, pass it through the public fields:
172
- `--model MODEL` and `--effort VALUE`. Codex encodes effort as its native TOML
173
- `model_reasoning_effort` setting; Claude and AGY use their native effort flags;
174
- Pi maps effort to `--thinking`; and OpenCode maps effort to `--variant`. An
175
- omitted or `default` effort is omitted from native argv. For AGY read-only,
176
- `--permission read-only` selects the exact native `--sandbox --mode plan` path
177
- without a bypass. Authorized AGY workspace-write retains its existing native
178
- bypass. Do not add these native flags yourself.
179
-
180
176
  Save the exact `task_id` from the JSON response. The recovery steps below apply
181
177
  to parsed dispatch responses. If the CLI rejects the command syntax before
182
178
  dispatch (nonzero exit with a usage error and no JSON response), correct the
@@ -214,79 +210,39 @@ copy unrestricted provider output into the control response.
214
210
 
215
211
  ### 6. Continue a timed out turn
216
212
 
217
- When `status` or `collect` returns `status: "timed_out"`, inspect the nested
218
- continuation object:
219
-
220
- ```json
221
- {
222
- "status": "timed_out",
223
- "continuation": {
224
- "resumable": true,
225
- "mode": "native",
226
- "predecessor_task_id": "TASK_ID",
227
- "continue_command": "delegate continue --task TASK_ID --json"
228
- }
229
- }
230
- ```
231
-
232
- If `resumable` is true, create the linked successor through the public
233
- continuation command. Supply a new follow-up brief when the next turn needs a
234
- new instruction:
235
-
236
- ```sh
237
- delegate --root "$STATE_ROOT" continue \
238
- --task TASK_ID \
239
- --brief "$FOLLOW_UP_BRIEF" \
240
- --budget 30m \
241
- --json
242
- ```
243
-
244
- The command preserves the exact provider session and permission mode and
245
- creates a new task ID. Do not add `--permission` to `continue`. Always include
246
- the original `--root`, even if a returned command hint omits it. Observe and
247
- collect the successor by repeating step 5. If `resumable` is
248
- false, report the reason and stop; a fresh dispatch would lose the original
249
- conversation and is not an equivalent recovery.
250
-
251
- If `continue` returns an error, use its `failure` and `task_record` fields just
252
- as for dispatch: when the record is `created`, check the returned successor
253
- `task_id` with `status`; when it is `not_created`, correct the request only if
254
- `failure.next_action` is `correct_request`; and when it is `unknown`, stop and
255
- report the failure. Do not repeat `continue` while successor creation is
256
- unknown.
257
-
258
- ## JSON decisions
259
-
260
- The capability projection uses the stable `runtime-capability-v1` contract.
261
- Catalog responses have `verification: "catalog"` and `status: "unknown"`.
262
- Preflight responses have `verification: "preflight"` and describe static
263
- readiness. A dispatch response can report `verification: "runtime"` only after
264
- the supervised runtime probe has observed the required behavior and executable
265
- identity.
266
-
267
- Versions and help text are observations. Accept any valid nonempty version
268
- reported by the CLI; never apply a semantic-version allowlist or web lookup.
269
- The adapter’s required flags and runtime behavior decide compatibility.
270
-
271
- Authentication is a separate live gate. `live_acceptance.status` values are
272
- `not_run`, `passed`, or `blocked`; a blocked authentication prerequisite is
273
- neutral evidence and must not be relabeled. Report the missing authentication
274
- prerequisite and stop that attempt; do not retry or authenticate the provider.
275
-
276
- The task response separates:
277
-
278
- - `admission`: whether the request was accepted by the durable boundary;
279
- - `liveness`: the observed supervisor state;
280
- - `publication`: whether validated evidence was committed or rejected;
281
- - `outcome`: the terminal authority, when available;
282
- - `continuation`: whether the exact session can make a linked successor; and
283
- - `error`: bounded operational diagnostics.
284
-
285
- See [references/command-reference.md](references/command-reference.md) for
286
- the command matrix, [references/result-handling.md](references/result-handling.md)
287
- for decision rules, and [references/continuation.md](references/continuation.md)
288
- for timeout recovery. The examples and machine-readable checks in `examples/`
289
- and `evals/` are part of this skill package.
213
+ When `status` or `collect` reports `timed_out`, read
214
+ [continuation and timeout recovery](references/continuation.md). If
215
+ `continuation.resumable` is true, use `continue --task TASK_ID` with the original
216
+ state root and a finite budget, then observe the returned successor ID. Do not
217
+ wait indefinitely for pending publication or restart the task as an unrelated
218
+ dispatch. If continuation is unavailable, report its reason. Apply the same
219
+ `failure` and `task_record` decisions as for dispatch; never repeat an uncertain
220
+ successor creation.
221
+
222
+ ## Comparisons, debate, and follow-up
223
+
224
+ Choose a finite scope and number of rounds appropriate to the user's request.
225
+ For independent opinions, dispatch separate briefs to the chosen destinations
226
+ and collect each result. Summarize the relevant findings as task data in the
227
+ next brief; do not forward credentials or unrestricted output. Use a supported
228
+ `continue` for an exact-session follow-up, or a new bounded task for an
229
+ independent question. Preserve which agent supplied each finding, explain
230
+ agreements and disagreements, and stop at the agreed scope or a blocker.
231
+ An external worker should perform its assigned work; do not ask it to recursively
232
+ recruit more agents unless that is explicitly part of the task.
233
+
234
+ ## Details when needed
235
+
236
+ - Read [command reference](references/command-reference.md) when choosing
237
+ model/effort options or another public command.
238
+ - Read [result handling](references/result-handling.md) when interpreting
239
+ admission, publication, authentication, errors, or exit codes.
240
+ - Read [continuation](references/continuation.md) for timeout recovery or an
241
+ exact-session follow-up.
242
+ - Use [read-only example](examples/read-only-task.md),
243
+ [write example](examples/workspace-write-task.md), and
244
+ [JSON examples](examples/json-results.md) when constructing a task or parsing
245
+ unfamiliar output. Do not load every reference for a routine dispatch.
290
246
 
291
247
  ## Completion report
292
248
 
@@ -0,0 +1,155 @@
1
+ {
2
+ "version": 1,
3
+ "cases": [
4
+ {
5
+ "name": "codex-review",
6
+ "prompt": "Ask Codex to review pricing.py for correctness. Return the finding without editing files.",
7
+ "external": true,
8
+ "provider": "codex:exec",
9
+ "split": "development",
10
+ "native_alternative_for": "codex"
11
+ },
12
+ {
13
+ "name": "agy-opinion",
14
+ "prompt": "Get Antigravity\u2019s opinion on the discount calculation in pricing.py. Do not edit files.",
15
+ "external": true,
16
+ "provider": "antigravity:print",
17
+ "split": "development"
18
+ },
19
+ {
20
+ "name": "claude-investigate",
21
+ "prompt": "Have Claude investigate why discounted_price(200, 10) returns the wrong value. Do not change files.",
22
+ "external": true,
23
+ "provider": "claude:print",
24
+ "split": "development",
25
+ "native_alternative_for": "claude"
26
+ },
27
+ {
28
+ "name": "external-write",
29
+ "prompt": "Ask Codex to fix pricing.py so discounts are percentages. Authorize edits only in this workspace and verify 200 with 10 percent gives 180.",
30
+ "external": true,
31
+ "provider": "codex:exec",
32
+ "split": "development",
33
+ "native_alternative_for": "codex"
34
+ },
35
+ {
36
+ "name": "external-testing",
37
+ "prompt": "Have Claude independently test the pricing calculation against the requirement in README.md. Report evidence without editing.",
38
+ "external": true,
39
+ "provider": "claude:print",
40
+ "split": "development",
41
+ "native_alternative_for": "claude"
42
+ },
43
+ {
44
+ "name": "external-research",
45
+ "prompt": "Consult another AI harness on how to represent percentage discounts without floating-point surprises. Give one concise recommendation.",
46
+ "external": true,
47
+ "provider": null,
48
+ "split": "development"
49
+ },
50
+ {
51
+ "name": "comparison",
52
+ "prompt": "Ask Codex and Claude independently whether pricing.py meets README.md, then compare their findings. No edits.",
53
+ "external": true,
54
+ "provider": [
55
+ "codex:exec",
56
+ "claude:print"
57
+ ],
58
+ "split": "validation"
59
+ },
60
+ {
61
+ "name": "debate",
62
+ "prompt": "Ask Codex for a critique of pricing.py, then ask Claude to challenge that critique. One round each, no edits.",
63
+ "external": true,
64
+ "provider": [
65
+ "codex:exec",
66
+ "claude:print"
67
+ ],
68
+ "split": "validation"
69
+ },
70
+ {
71
+ "name": "unavailable-destination",
72
+ "prompt": "Ask the NebulaReview9000 harness to review pricing.py. If it is unavailable, report that; do not substitute another harness.",
73
+ "external": true,
74
+ "provider": "unavailable",
75
+ "split": "validation"
76
+ },
77
+ {
78
+ "name": "follow-up",
79
+ "prompt": "Get a second opinion from a separate Codex CLI session on the calculation, then ask that same session one follow-up about the simplest correction. Do not edit.",
80
+ "external": true,
81
+ "provider": "codex:exec",
82
+ "split": "validation"
83
+ },
84
+ {
85
+ "name": "local-review",
86
+ "prompt": "Review pricing.py yourself for correctness. Do not consult another harness or change files.",
87
+ "external": false,
88
+ "provider": null,
89
+ "split": "development"
90
+ },
91
+ {
92
+ "name": "native-subagent",
93
+ "prompt": "Use an ordinary native subagent within this harness to examine pricing.py if available; otherwise examine it yourself. No external harness and no edits.",
94
+ "external": false,
95
+ "provider": null,
96
+ "split": "development"
97
+ },
98
+ {
99
+ "name": "explain-codex",
100
+ "prompt": "Explain what Codex is. Do not run it or ask it to do any work.",
101
+ "external": false,
102
+ "provider": null,
103
+ "split": "development"
104
+ },
105
+ {
106
+ "name": "claude-docs",
107
+ "prompt": "Add one sentence to README.md saying that Claude can review code. Do not ask it to review anything.",
108
+ "external": false,
109
+ "provider": null,
110
+ "split": "development"
111
+ },
112
+ {
113
+ "name": "provider-install",
114
+ "prompt": "Explain how to diagnose a command-not-found error for Codex. Do not install or run it.",
115
+ "external": false,
116
+ "provider": null,
117
+ "split": "development"
118
+ },
119
+ {
120
+ "name": "local-fix",
121
+ "prompt": "Fix pricing.py yourself so discounts are percentages. No external consultation.",
122
+ "external": false,
123
+ "provider": null,
124
+ "split": "development"
125
+ },
126
+ {
127
+ "name": "agy-question",
128
+ "prompt": "What does a read-only mode mean in an AI coding tool such as Antigravity? Answer conceptually without invoking it.",
129
+ "external": false,
130
+ "provider": null,
131
+ "split": "validation"
132
+ },
133
+ {
134
+ "name": "quote-request",
135
+ "prompt": "In README.md, quote the example sentence \"Ask Codex to review this\" as documentation. Do not execute the example.",
136
+ "external": false,
137
+ "provider": null,
138
+ "split": "validation"
139
+ },
140
+ {
141
+ "name": "compare-tools",
142
+ "prompt": "Explain the difference between a CLI and a plugin. Mention Claude and Codex as examples, without consulting them.",
143
+ "external": false,
144
+ "provider": null,
145
+ "split": "validation"
146
+ },
147
+ {
148
+ "name": "local-test",
149
+ "prompt": "Check the discount function yourself against README.md and report the result. No other agents.",
150
+ "external": false,
151
+ "provider": null,
152
+ "split": "validation"
153
+ }
154
+ ]
155
+ }
@@ -28,7 +28,7 @@ Dispatch flags:
28
28
  - `--permission read-only|workspace-write`: read-only investigation or authorized unattended write execution, including commands (not independent containment);
29
29
  - `--budget DURATION`: finite turn budget;
30
30
  - `--auto`: let the CLI select a ready provider;
31
- - `--provider ID`: use only when the caller explicitly selected an ID;
31
+ - `--provider ID`: preserve the caller’s named harness or provider, resolved through the catalog;
32
32
  - `--model MODEL` and `--effort VALUE`: optional provider-advertised choices;
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
@@ -48,3 +48,33 @@ Continuation flags:
48
48
  - `--task TASK`: predecessor task ID;
49
49
  - `--brief FILE`: optional new follow-up instruction;
50
50
  - `--budget DURATION`, `--model MODEL`, and `--effort VALUE`: optional overrides.
51
+
52
+ ## Choosing models and effort
53
+
54
+ If the caller needs an explicit model or effort, use the implemented native
55
+ discovery command for that provider:
56
+
57
+ ```sh
58
+ delegate models --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE --json
59
+ ```
60
+
61
+ Omit `--cwd` to use the current directory. Run discovery only when the caller
62
+ needs a non-default choice; provider defaults are valid. The command uses the
63
+ state-rooted supervisor and a bounded `model-discovery-v1` five-minute native
64
+ inspection to allow first-run provider model/cache initialization. It creates
65
+ inspection evidence without admitting a provider task, and may contact the
66
+ provider CLI. It is advisory and never an admission allowlist. Do not reject a
67
+ requested value merely because discovery did not list it, and do not infer
68
+ per-model effort support from the harness-wide list. If a selected model has
69
+ `efforts: null` or `efforts: []`, omit `--effort` unless the caller explicitly
70
+ requested it; do not invent model aliases or combine options by guessing.
71
+
72
+ The response includes `schema_version`, `command: "models"`, `provider`,
73
+ `observed_at`, `status`, `reason_code`, `complete`, `source`, nullable
74
+ `efforts`, and model rows with exact `id` values plus optional `name`, nullable
75
+ `efforts`, and optional `default_effort`. `complete` describes model
76
+ enumeration, not effort metadata. `null` means effort metadata is unknown;
77
+ `[]` means the provider explicitly reported no choices. Discovery exits `0`
78
+ for `available` or `partial`, `2` for `blocked` or `unavailable`, and `1` for
79
+ `failed`. Preserve a blocked or unavailable discovery result as unresolved;
80
+ defaults remain allowed.
@@ -30,7 +30,10 @@ indefinitely for a publication that the interrupted turn cannot complete.
30
30
 
31
31
  The follow-up brief is optional. If it is omitted, Delegation Layer reuses the
32
32
  validated predecessor brief. A successful continuation returns a new task ID
33
- and links it to the predecessor. Observe and collect the new ID separately.
33
+ and links it to the predecessor. Observe and collect the new ID separately. Always retain the original state
34
+ root, even if a returned command hint omits it. Permission is inherited; do not
35
+ add `--permission` to `continue`. Apply the dispatch `task_record` error rules
36
+ in [result handling](result-handling.md) before retrying or observing.
34
37
 
35
38
  `mode` describes the provider contract:
36
39
 
@@ -4,10 +4,12 @@ Use the response fields independently. A successful control command is not
4
4
  the same as a successful provider result.
5
5
 
6
6
  1. Save `task_id` immediately after dispatch or continue.
7
- 2. If a dispatch or continue response does not confirm admission, preserve any
8
- task ID and report its bounded error. An uncertain admission must be
9
- inspected, never automatically dispatched again. Status and collect can
10
- report `admission: "unknown"` alongside valid terminal evidence.
7
+ 2. For a dispatch or continue error, inspect `task_record` first. When it is
8
+ `created`, observe the returned ID with `status`. When it is `not_created`,
9
+ do not poll; correct the request only if `failure.next_action` is
10
+ `correct_request`, otherwise report and stop. When it is `unknown`, stop and
11
+ report without polling or retrying. Status and collect can report
12
+ `admission: "unknown"` alongside valid terminal evidence for an existing task.
11
13
  3. If `status` is `timed_out`, follow the continuation procedure before treating
12
14
  pending publication as a reason to wait. `continuation.resumable: true`
13
15
  permits a linked successor even when no outcome has been published.
@@ -19,9 +21,8 @@ the same as a successful provider result.
19
21
  observe the same task again with a finite watch interval.
20
22
  7. If authentication is `blocked`, preserve that neutral state and tell the
21
23
  caller what prerequisite is unavailable without inventing a login command.
22
- 8. If a command reports an operational uncertainty, inspect the original task
23
- with `status` and `collect` before considering any action. Never relaunch an
24
- uncertain task by guessing.
24
+ 8. Never relaunch an uncertain task by guessing. Observe only a task whose
25
+ record is known to exist; the `task_record` decision above takes precedence.
25
26
 
26
27
  For `delegate models`, validate the complete JSON envelope before using any
27
28
  fact. Treat `available` and `partial` with exit `0` as observations, preserve
@@ -35,3 +36,9 @@ model is not an execution guarantee.
35
36
  Exit codes are bounded control signals: `0` is a completed command, `1` is an
36
37
  operational error, `2` is an invalid or unsupported request, `3` is a pending
37
38
  collection watch, and `4` is a validated rejected outcome.
39
+
40
+ Catalog facts (`verification: "catalog"`) are not runtime proof. Preflight
41
+ checks static readiness; runtime verification requires the supervised probe.
42
+ Versions and help are observations, not semantic-version allowlists.
43
+ Authentication is a separate live gate (`not_run`, `passed`, or `blocked`).
44
+ Report a blocked prerequisite without inventing a login command or retrying.