delegation-layer 0.1.39 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -320
- package/package.json +1 -1
- package/plugins/delegation-layer/.claude-plugin/plugin.json +1 -1
- package/plugins/delegation-layer/.codex-plugin/plugin.json +1 -1
- package/plugins/delegation-layer/skills/agent-integration/SKILL.md +127 -359
- package/plugins/delegation-layer/skills/agent-integration/evals/cases.json +240 -0
- package/plugins/delegation-layer/skills/agent-integration/evals/routing.json +54 -0
- package/plugins/delegation-layer/skills/agent-integration/examples/read-only-task.md +29 -6
- package/plugins/delegation-layer/skills/agent-integration/examples/workspace-write-task.md +12 -10
- package/plugins/delegation-layer/skills/agent-integration/references/command-reference.md +412 -145
- package/plugins/delegation-layer/skills/agent-integration/references/continuation.md +20 -19
- package/plugins/delegation-layer/skills/agent-integration/references/interaction.md +20 -7
- package/plugins/delegation-layer/skills/agent-integration/references/result-handling.md +246 -90
- package/plugins/delegation-layer/skills/agent-integration/references/routing-rule.json +1 -1
- package/plugins/delegation-layer/skills/agent-integration/references/workspaces.md +33 -0
- package/skills/agent-integration/SKILL.md +127 -359
- package/skills/agent-integration/evals/cases.json +240 -0
- package/skills/agent-integration/evals/routing.json +54 -0
- package/skills/agent-integration/examples/read-only-task.md +29 -6
- package/skills/agent-integration/examples/workspace-write-task.md +12 -10
- package/skills/agent-integration/references/command-reference.md +412 -145
- package/skills/agent-integration/references/continuation.md +20 -19
- package/skills/agent-integration/references/interaction.md +20 -7
- package/skills/agent-integration/references/result-handling.md +246 -90
- package/skills/agent-integration/references/routing-rule.json +1 -1
- package/skills/agent-integration/references/workspaces.md +33 -0
|
@@ -1,409 +1,177 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-integration
|
|
3
|
-
description: Use Delegate for work assigned to another agent, model, or separate harness CLI session. Load this before a provider-specific skill or plugin, including when a user names a CLI for research, implementation, tests, reviews, consultations, comparisons, or debates. A named destination still routes through Delegate. Ordinary same-harness subagents and questions about tools remain local; respect an explicit choice of another integration.
|
|
3
|
+
description: Use Delegate for work assigned to another agent, model, or separate harness CLI session. Load this before a provider-specific skill or plugin, including when a user names a CLI for research, implementation, tests, reviews, consultations, comparisons, or debates. Also manage optional Delegate Teams and explicit Member selection. A named destination still routes through Delegate. Ordinary same-harness subagents and questions about tools remain local; respect an explicit choice of another integration.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Delegation Layer
|
|
7
7
|
|
|
8
8
|
## When to use
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
path or hash drift alone is handled by normal adoption and does not require
|
|
49
|
-
this command.
|
|
50
|
-
Managed admission also permits the two explicit `watch_workspace` responses
|
|
51
|
-
in the task-record table below. They keep the exact admission command and
|
|
52
|
-
inputs, including `continue`; they do not authorize environment repair.
|
|
53
|
-
When a response says `failure.next_action: "stop_and_report"`, that attempt is
|
|
54
|
-
finished. Include its failure in your final response without opening a
|
|
55
|
-
clarification dialog to choose a fallback. For `task_record: not_created`,
|
|
56
|
-
identify the requested destination and include the saved JSON failure response
|
|
57
|
-
verbatim. A `task_id` can be returned even when no task record was created. Do
|
|
58
|
-
not infer that an unavailable provider is uninstalled or unauthenticated. Do
|
|
59
|
-
not append inferred state paths or provider-setup diagnoses, run diagnostic
|
|
60
|
-
commands, or use another integration.
|
|
61
|
-
Troubleshooting requires a separate user request. Other independently requested
|
|
62
|
-
tasks may proceed; the failed attempt must remain reported as failed or blocked.
|
|
63
|
-
|
|
64
|
-
## Rules
|
|
65
|
-
|
|
66
|
-
1. Check whether `delegate` is already installed. A plugin SessionStart hook
|
|
67
|
-
normally bootstraps the self-contained CLI when it is missing. This skill
|
|
68
|
-
never installs or repairs the CLI itself. If `delegate` is still missing or
|
|
69
|
-
unusable, report the bootstrap failure and stop; never fall back to a native
|
|
70
|
-
provider command.
|
|
71
|
-
2. Preserve a named harness or provider, even when the user supplied a natural
|
|
72
|
-
name rather than a provider ID. Use `dispatch --auto` when none was chosen.
|
|
73
|
-
Provider selection, executable checks, compatibility checks, authentication
|
|
74
|
-
gates, and supervisor admission belong inside Delegation Layer.
|
|
75
|
-
3. Give every turn an absolute workspace, an explicit permission mode, and a
|
|
76
|
-
finite budget. Keep the state root outside the workspace. Reuse a supplied
|
|
77
|
-
`DELEGATE_ROOT` for all providers and tasks; do not invent per-provider or
|
|
78
|
-
per-task state roots. Task IDs separate work within that root. Managed Git
|
|
79
|
-
workspaces are optional; read [managed workspace guidance](references/workspaces.md)
|
|
80
|
-
before creating or attaching one.
|
|
81
|
-
4. Use `--json` and save each response separately with its requested destination,
|
|
82
|
-
model, effort, workspace, and returned `task_id`. Never merge concurrent
|
|
83
|
-
responses into an unlabeled output stream. Read `admission`, `liveness`,
|
|
84
|
-
`publication`, `status`, `outcome`, `continuation`, `task_record`, `failure`,
|
|
85
|
-
and `error` as separate fields.
|
|
86
|
-
Delegate owns the supervisor lifecycle. Never install, configure, start,
|
|
87
|
-
inspect, or repair Pueue, and never poll a task unless the response says its
|
|
88
|
-
`task_record` is `created`.
|
|
89
|
-
5. Observe tasks only through Delegate `status`, `collect`, or `events`.
|
|
90
|
-
Do not run `ps`, `pgrep`, process-tree searches, or supervisor commands to
|
|
91
|
-
monitor delegated work. Pending output is normal startup or work in progress;
|
|
92
|
-
empty `pending_requests` means keep collecting, not diagnose the environment.
|
|
93
|
-
Environment diagnostics require a separately requested troubleshooting task.
|
|
94
|
-
Keep collection in the
|
|
95
|
-
foreground until all requested tasks reach a terminal result or an explicit
|
|
96
|
-
blocker. Do not end a headless turn promising a background notification.
|
|
97
|
-
Pending publication (exit 3) means keep waiting, not success. When the JSON
|
|
98
|
-
reports `pending.kind: "lifetime-finalization"`, the resident guardian still
|
|
99
|
-
owns cleanup; keep observing that same task without supervisor repair,
|
|
100
|
-
process commands, redispatch, or provider fallback. When the JSON
|
|
101
|
-
includes an outstanding `interaction.pending_requests` batch, follow
|
|
102
|
-
[active-task interaction](references/interaction.md) before waiting again. Only detach
|
|
103
|
-
when the user explicitly requests it, retaining the exact task IDs.
|
|
104
|
-
Collection may reconcile the saved Pueue binding and recover the guardian
|
|
105
|
-
lifetime only for an already-requested stop. A queue-row end alone cannot
|
|
106
|
-
publish terminal facts; collection never launches a provider or retries a
|
|
107
|
-
task.
|
|
108
|
-
6. If `failure.next_action` is `recheck`, follow
|
|
109
|
-
[offline recovery](references/result-handling.md#offline-recovery) once for
|
|
110
|
-
that task. Rechecking saved evidence does not run the provider again.
|
|
111
|
-
Otherwise, report a rejected result without redispatching or reading raw
|
|
112
|
-
output as an answer.
|
|
113
|
-
7. If a task is timed out and its JSON says `continuation.resumable: true`, use
|
|
114
|
-
`continue --task TASK_ID`, optionally with a new `--brief`. Do not create a
|
|
115
|
-
fresh unrelated dispatch to replace a resumable task. The one other automatic
|
|
116
|
-
route is an `interrupted` task from `status` or `collect`, and only when
|
|
117
|
-
`failure.code` is `"task_interrupted"`, `failure.next_action` is
|
|
118
|
-
`"continue_task"`, and `continuation.resumable` is `true`; see
|
|
119
|
-
[interrupted turn](references/continuation.md#interrupted-turn). A
|
|
120
|
-
cancellation, `stop_and_report`, or failed admission always takes precedence
|
|
121
|
-
over `resumable: true`.
|
|
122
|
-
8. Treat `blocked` authentication as unresolved. Do not call it compatible,
|
|
123
|
-
successful, or failed provider behavior, and do not invent login commands.
|
|
124
|
-
9. Never put credentials, tokens, or unrestricted provider output in a brief,
|
|
125
|
-
option, receipt, or agent message.
|
|
126
|
-
10. Permission modes select provider-native behavior, not an independent sandbox.
|
|
127
|
-
Providers load their own configuration and extensions. If a task is rejected,
|
|
128
|
-
report delegate's evidence; do not assume the user's configuration is faulty
|
|
129
|
-
or remove MCP servers, plugins, settings, or credentials to make it pass.
|
|
130
|
-
11. The model chooses ordinary-task fan-out by issuing independent `dispatch`
|
|
131
|
-
commands concurrently. There is no fixed task-count cap, but Delegate
|
|
132
|
-
refuses a new request while the host shows confirmed resource pressure (see
|
|
133
|
-
the `resource_pressure` row below). Use this for independent investigation, debate, review,
|
|
134
|
-
or provider comparison. For independent parallel writes, choose
|
|
135
|
-
`--isolation git-worktree` automatically unless the user explicitly chooses
|
|
136
|
-
shared coordination; the model chooses fan-out and task scope. A read-only
|
|
137
|
-
review may attach a retained workspace with `--workspace ID`. To fork a
|
|
138
|
-
worker from current uncommitted content, follow
|
|
139
|
-
[checkpoint before fork](references/workspaces.md#checkpoint-before-fork):
|
|
140
|
-
fork only from a `checkpointed`, `usable` checkpoint commit. If your own
|
|
141
|
-
turn holds the workspace, do not wait or retry through `--cwd`; report so
|
|
142
|
-
the Lead checkpoints after your turn closes.
|
|
143
|
-
|
|
144
|
-
For an explicit Codex code review, use the discoverable `codex:review` profile
|
|
145
|
-
with one persisted target: `--review-target uncommitted`,
|
|
146
|
-
`--review-target base:BRANCH`, or `--review-target commit:SHA`. It is read-only
|
|
147
|
-
and does not support `--interactive`, continuation, or workspace-write. Use
|
|
148
|
-
ordinary `codex:exec` when the request is a general investigation or asks the
|
|
149
|
-
provider to edit files; the review profile is for Codex's native review
|
|
150
|
-
operation and keeps the reviewed Git state explicit. The brief is retained as
|
|
151
|
-
task evidence; the review target supplies Codex's review scope because its
|
|
152
|
-
native command does not accept a prompt with the target flag.
|
|
153
|
-
For a complete managed-workspace turn, review the recorded initial base against
|
|
154
|
-
its captured tree through an ordinary read-only task. Include both sealed refs
|
|
155
|
-
and an explicit `git diff BASE TREE` scope. A native `uncommitted` review covers
|
|
156
|
-
current staged, unstaged, and untracked changes; it excludes worker commits.
|
|
157
|
-
Do not pass a tree as a native branch target. Preserve an explicitly requested
|
|
158
|
-
native review target and state its narrower scope. See [workspace review
|
|
159
|
-
guidance](references/workspaces.md#recovery-and-review-scope).
|
|
10
|
+
Load this skill before choosing tools for work assigned to an external agent,
|
|
11
|
+
model, or separate harness session, including collaboration you choose.
|
|
12
|
+
A named CLI identifies the destination; discover its provider ID through
|
|
13
|
+
Delegate. “CCR” or “Claude Code Router” means `ccr:print`; read
|
|
14
|
+
[CCR guidance](references/ccr.md).
|
|
15
|
+
|
|
16
|
+
Ordinary subagents inside the current harness remain available, even when that
|
|
17
|
+
harness is named. A separate CLI session uses Delegate, including another
|
|
18
|
+
instance of your current harness. Discussing, documenting, or configuring a
|
|
19
|
+
tool is local work. Respect an explicit user choice of another integration.
|
|
20
|
+
|
|
21
|
+
For optional Team management or explicit Member selection, use
|
|
22
|
+
[Teams](references/command-reference.md#teams). Management is local configuration
|
|
23
|
+
through Delegate CLI and does not launch a provider. Teams are never required
|
|
24
|
+
for ordinary delegation.
|
|
25
|
+
|
|
26
|
+
For recurring tasks, use the [schedule commands](references/command-reference.md#schedules)
|
|
27
|
+
and the independent [scheduler runtime](references/command-reference.md#scheduler-runtime).
|
|
28
|
+
|
|
29
|
+
## Boundaries
|
|
30
|
+
|
|
31
|
+
- Preserve the requested destination, exact model ID, effort, permissions,
|
|
32
|
+
workspace, and state root. Do not guess ambiguous model IDs.
|
|
33
|
+
- Delegate owns task lifecycle and evidence. Providers and users own their CLI
|
|
34
|
+
installations, accounts, settings, extensions, and native sessions.
|
|
35
|
+
- Permissions request native behavior, not an independent sandbox.
|
|
36
|
+
`workspace-write` authorizes unattended commands and edits; native access
|
|
37
|
+
can extend beyond the workspace.
|
|
38
|
+
- A `stop_and_report` ends that attempt, not investigation of its cause.
|
|
39
|
+
Follow [failure diagnosis](references/result-handling.md#failure-diagnosis)
|
|
40
|
+
without another generic troubleshooting request: inspect bounded evidence,
|
|
41
|
+
distinguish facts from uncertainty, and propose a concrete next step.
|
|
42
|
+
Do not retry, substitute an integration, or change configuration without
|
|
43
|
+
authorization covering that action. Independent requests may proceed.
|
|
44
|
+
- Observe through Delegate `status`, `collect`, or `events`; do not use
|
|
45
|
+
process searches or Pueue commands. Delegate manages its supervisor.
|
|
46
|
+
- Keep credentials and unrestricted private provider output out of briefs,
|
|
47
|
+
options, control responses, and messages.
|
|
160
48
|
|
|
161
49
|
## Operating procedure
|
|
162
50
|
|
|
163
51
|
### 1. Verify the control CLI
|
|
164
52
|
|
|
165
|
-
Run a quick local check:
|
|
166
|
-
|
|
167
53
|
```sh
|
|
168
54
|
command -v delegate && delegate --version
|
|
169
55
|
```
|
|
170
56
|
|
|
171
|
-
If
|
|
172
|
-
|
|
173
|
-
Do not substitute a provider command.
|
|
57
|
+
If missing or unusable, report and stop. This skill does not install or repair
|
|
58
|
+
the CLI. A trusted plugin startup hook normally handles bootstrap.
|
|
174
59
|
|
|
175
60
|
### 2. Discover only when useful
|
|
176
61
|
|
|
177
|
-
If
|
|
178
|
-
|
|
62
|
+
If a Team/Member was requested, inspect the scoped target and follow
|
|
63
|
+
[Member selection](references/command-reference.md#using-a-member). Preserve
|
|
64
|
+
explicit caller choices; do not replace a missing requested Member with another.
|
|
65
|
+
Without a Team target, if no destination was named, use `--auto`. Otherwise resolve the named
|
|
66
|
+
destination through `providers --json` and preserve it with `--provider`.
|
|
67
|
+
Read [providers and capabilities](references/command-reference.md#providers-and-capabilities)
|
|
68
|
+
for discovery and required options. Catalog support is not host readiness;
|
|
69
|
+
a normal task needs no separate preflight.
|
|
70
|
+
|
|
71
|
+
Keep provider defaults when model/effort were not requested and are not
|
|
72
|
+
required. For an explicit choice or natural-language model name, read
|
|
73
|
+
[model selection](references/command-reference.md#choosing-models-and-effort).
|
|
74
|
+
An exact requested ID passes unchanged even when discovery omits it. Ask for
|
|
75
|
+
an exact ID only when a name remains ambiguous.
|
|
76
|
+
|
|
77
|
+
For work likely to need questions or guidance, read
|
|
78
|
+
[interaction](references/interaction.md) before dispatch and use `--interactive`
|
|
79
|
+
when supported. Check clarification and steering separately; automatic
|
|
80
|
+
interactive selection does not require steering support.
|
|
81
|
+
For explicit native Codex review, read
|
|
82
|
+
[review scope](references/command-reference.md#codex-review).
|
|
179
83
|
|
|
180
|
-
|
|
181
|
-
delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" providers --json
|
|
182
|
-
```
|
|
84
|
+
### 3. Prepare separate paths and a finite brief
|
|
183
85
|
|
|
184
|
-
Use
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
The catalog is not proof that a provider is installed, authenticated, or ready.
|
|
188
|
-
Dispatch performs admission checks; a separate preflight is not needed for a
|
|
189
|
-
normal task. For an explicitly requested readiness check, see
|
|
190
|
-
[preflight guidance](references/command-reference.md#checking-readiness).
|
|
191
|
-
|
|
192
|
-
The catalog and `capabilities` response expose supported permission modes,
|
|
193
|
-
request options, continuation, native interaction, and the read-only mechanism. A read-only
|
|
194
|
-
capability with `containment: "provider-owned"` selects the provider's native
|
|
195
|
-
behavior but is not an independent delegate-owned sandbox. This is separate
|
|
196
|
-
from guardian-owned process-lifetime containment. Static discovery
|
|
197
|
-
does not prove authentication or live acceptance; use the dispatch or live
|
|
198
|
-
acceptance result for that evidence.
|
|
199
|
-
|
|
200
|
-
Read `required_options` in provider discovery before dispatch. Supply every
|
|
201
|
-
required option; a provider's optional defaults do not replace required inputs.
|
|
202
|
-
For CCR / Claude Code Router or a CCR model request, read
|
|
203
|
-
[CCR model selection](references/ccr.md). A CCR route is external collaboration
|
|
204
|
-
even when you are already using Claude. Do not assume every open-source model
|
|
205
|
-
name belongs to CCR; clarify only if discovery leaves the destination ambiguous.
|
|
206
|
-
|
|
207
|
-
Keep provider defaults when no model or effort was requested and neither is required. When an explicit
|
|
208
|
-
choice is needed, read [model and effort guidance](references/command-reference.md#choosing-models-and-effort).
|
|
209
|
-
Pass exact requested model IDs and effort values unchanged through Delegate's
|
|
210
|
-
public `--model` and `--effort` fields; discovery is advisory, never an allowlist.
|
|
211
|
-
For a natural-language model name, resolve one exact ID through discovery. If
|
|
212
|
-
it remains ambiguous or discovery is unavailable, ask for the exact model ID;
|
|
213
|
-
do not turn a display name into a guessed alias. An explicit ID needs no such
|
|
214
|
-
clarification just because it is absent from discovery.
|
|
215
|
-
|
|
216
|
-
For planning, consultation, debate, or other external work that may need
|
|
217
|
-
answers or guidance while it runs, read [active-task interaction](references/interaction.md)
|
|
218
|
-
and use `--interactive` when supported. Answer known facts yourself; ask the
|
|
219
|
-
user for missing preferences, authorization, or scope. Keep ordinary native
|
|
220
|
-
subagents available under the same-harness rule above.
|
|
86
|
+
Use a supplied brief or write the worker's bounded assignment and acceptance
|
|
87
|
+
criteria to a regular file. Do not copy the orchestration request or ask workers
|
|
88
|
+
to recruit others unless recursive delegation was requested.
|
|
221
89
|
|
|
222
|
-
|
|
90
|
+
Keep the state root outside provider-writable workspaces, provider runtime
|
|
91
|
+
directories, and temporary trees they may write. For every task command pass
|
|
92
|
+
`--root "${DELEGATE_ROOT:-$HOME/delegation-state}"` directly in that shell
|
|
93
|
+
invocation. If the user explicitly requests another root, use that exact path
|
|
94
|
+
consistently. Task IDs separate tasks; do not invent per-task roots.
|
|
223
95
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
never pass an empty `--root`, `--brief`, or `--cwd`.
|
|
235
|
-
|
|
236
|
-
Write the brief as the **worker’s own assignment**, not a copy of the
|
|
237
|
-
orchestration request. For “consult another agent about X”, tell the worker
|
|
238
|
-
“Investigate X and return your findings; you are the assigned worker, do not
|
|
239
|
-
delegate this assignment.” Keep dispatching, answering questions, and
|
|
240
|
-
collecting results in the lead session unless recursive delegation was
|
|
241
|
-
explicitly requested.
|
|
242
|
-
|
|
243
|
-
Replace the example brief below with that bounded worker assignment. Do not place the state
|
|
244
|
-
root inside the workspace or place secrets in either path’s task data. Keep it
|
|
245
|
-
outside provider configuration and runtime directories as well. If delegate
|
|
246
|
-
rejects a caller-supplied state root, report the placement error rather than
|
|
247
|
-
silently replacing that root. For every task command, use
|
|
248
|
-
`--root "${DELEGATE_ROOT:-$HOME/delegation-state}"` as shown below. This reads the supplied root in each shell call and uses the
|
|
249
|
-
same default when none was supplied; no root setup or new directory choice is
|
|
250
|
-
needed. If the user explicitly requests another root, substitute that exact
|
|
251
|
-
absolute path consistently. Do not change provider settings or switch roots
|
|
252
|
-
when waiting, replying, steering, or continuing.
|
|
96
|
+
Prepare paths and dispatch in one tool invocation; shell variables may not
|
|
97
|
+
persist between calls. Use saved absolute paths in later calls. Do not use
|
|
98
|
+
process substitution or ephemeral `/dev/fd` paths for briefs.
|
|
99
|
+
|
|
100
|
+
For independent parallel writes, choose managed worktrees unless the user
|
|
101
|
+
explicitly chooses shared coordination. Read
|
|
102
|
+
[workspaces](references/workspaces.md) before creating or attaching one.
|
|
103
|
+
To fork current uncommitted content, the Lead follows
|
|
104
|
+
[checkpoint before fork](references/workspaces.md#checkpoint-before-fork).
|
|
105
|
+
A worker must not checkpoint a workspace its own turn holds.
|
|
253
106
|
|
|
254
107
|
### 4. Dispatch one bounded turn
|
|
255
108
|
|
|
256
|
-
Use
|
|
257
|
-
|
|
258
|
-
|
|
109
|
+
Use the [read-only task example](examples/read-only-task.md), or its
|
|
110
|
+
[authorized write variation](examples/workspace-write-task.md). The
|
|
111
|
+
[command reference](references/command-reference.md#dispatch) owns flags and defaults.
|
|
259
112
|
|
|
260
|
-
Capture
|
|
261
|
-
|
|
113
|
+
Capture each response and exit status once in the original invocation.
|
|
114
|
+
Never dispatch again to recover output or discover the prior exit code.
|
|
115
|
+
Keep concurrent requests independently associated; see
|
|
116
|
+
[parallel reviews and debates](references/collaboration.md).
|
|
262
117
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
that must pass. Keep the response concise and report validation evidence.
|
|
270
|
-
EOF
|
|
271
|
-
printf 'Saved response: %s\n' "$RESPONSE"
|
|
272
|
-
if delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" dispatch --auto \
|
|
273
|
-
--brief "$BRIEF" \
|
|
274
|
-
--cwd "$WORKSPACE" \
|
|
275
|
-
--permission read-only \
|
|
276
|
-
--budget 30m \
|
|
277
|
-
--json >"$RESPONSE"; then
|
|
278
|
-
dispatch_exit=0
|
|
279
|
-
else
|
|
280
|
-
dispatch_exit=$?
|
|
281
|
-
fi
|
|
282
|
-
cat "$RESPONSE"
|
|
283
|
-
printf '\nDispatch exit: %s; saved response: %s\n' "$dispatch_exit" "$RESPONSE"
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
For an authorized code change, use `--permission workspace-write`; this requests
|
|
287
|
-
unattended native tool execution, including shell commands and file edits.
|
|
288
|
-
The provider may allow access beyond the selected workspace. Delegate supplies
|
|
289
|
-
the native approval options; do not add provider flags or call its CLI yourself.
|
|
290
|
-
Keep the budget finite. A successful dispatch means the request was durably admitted;
|
|
291
|
-
it does not mean the delegated work finished.
|
|
292
|
-
|
|
293
|
-
For independent work, the model may run several complete `dispatch` commands
|
|
294
|
-
concurrently. Keep each task's brief, workspace, permission, and task ID
|
|
295
|
-
independent. Do not configure Pueue or wait for one task before dispatching the
|
|
296
|
-
next solely to serialize ordinary work. Inspect each returned task separately
|
|
297
|
-
with `status` and `collect`. Use independent tool calls or separate response
|
|
298
|
-
files, never background commands writing to the same stdout. Read
|
|
299
|
-
[parallel reviews and debates](references/collaboration.md) when coordinating
|
|
300
|
-
multiple participants or challenge rounds.
|
|
301
|
-
|
|
302
|
-
Capture the response and exit status in the **original** dispatch invocation,
|
|
303
|
-
as above. Read the saved response if you need it again. Never repeat dispatch
|
|
304
|
-
to obtain its exit code, recover output, or confirm that it worked: each call
|
|
305
|
-
can create new paid work. Once a response says `task_record: created`, save its
|
|
306
|
-
`task_id` and switch to observation. A missing exit code does not undo admission.
|
|
307
|
-
|
|
308
|
-
Save the exact `task_id` from the JSON response. Apply this decision separately
|
|
309
|
-
for **each attempt**, including requests issued together:
|
|
310
|
-
|
|
311
|
-
| Response | Next action |
|
|
312
|
-
|---|---|
|
|
313
|
-
| Usage error, no JSON response | Correct the reported syntax using Delegate help or `providers --json`, then invoke that request again. Parsing failed before admission. |
|
|
314
|
-
| `task_record: not_created`, `failure.code: supervisor_upgrade_required`, and `failure.next_action: run_supervisor_migrate` | Run `delegate --root "<the exact absolute state root used by the failed command>" supervisor migrate --json` once. Retry the exact original admission argv once only after `supervisor_control.state: migrated` and `supervisor_control.next_action: retry_dispatch`; otherwise stop and report the migration response. Preserve an explicit custom root exactly. A failed `continue` must be retried as the same `continue`; never replace it with a fresh `dispatch` or a direct provider call. |
|
|
315
|
-
| `task_record: not_created` and `failure.next_action: correct_request` | Correct that request and retry it. |
|
|
316
|
-
| `task_record: not_created`, `failure.code: workspace_provision_pending` or `workspace_busy`, and `failure.next_action: watch_workspace` | Follow [managed workspace recovery](references/result-handling.md#managed-workspace-results) using the same root and workspace. Once ready, retry the exact admission command and inputs. A failed `continue` remains that same `continue`, never a new dispatch. |
|
|
317
|
-
| `task_record: not_created`, `failure.code: resource_pressure`, `failure.next_action: retry_later`, and `failure.retry_after_seconds: 30` | Delegate checked the host and confirmed resource pressure, so no ordinary task record was created and no provider task is running for this attempt. Do not poll or observe a task. Choose one: report the refusal and stop, or wait at least 30 seconds in the foreground and retry the exact original admission argv once. A `continue` stays that same `continue`. If the retry is refused again, report and stop. Never loop, retry in the background, schedule a retry, or run Pueue or process commands. The 30 seconds is advice, not a guarantee that the retry will pass. |
|
|
318
|
-
| `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. |
|
|
319
|
-
| `task_record: created` | Use `status` before taking any other action. Do not dispatch again. An optional `resource_admission` object with `status: unknown` and `warnings` only means a resource metric could not be read; the task was admitted. Keep the warning with your report, observe that same task with `status` and `collect`, and do not redispatch. |
|
|
320
|
-
| `task_record: unknown` or an ambiguous response | Stop and report; do not retry an uncertain task creation. |
|
|
321
|
-
|
|
322
|
-
`resource_admission` is optional. Its `status` is `clear`, `pressure`, or `unknown`, and `warnings` is a short list of bounded entries with `code`, optional `metric`, `reason_code`, and `message`. An unknown metric adds a warning and never refuses by itself, but confirmed pressure on an independent metric still refuses. The check runs only for a new dispatch or `continue`; `status`, `collect`, `cancel`, and the recovery of an existing task are not checked or refused.
|
|
323
|
-
|
|
324
|
-
One attempt's `stop_and_report` does not prevent correcting another independent
|
|
325
|
-
request's usage error. Keep the failed attempt reported as failed. With an
|
|
326
|
-
explicit task ID, absence can race another dispatch creating the same ID;
|
|
327
|
-
never retry that uncertain ID or run Pueue commands.
|
|
118
|
+
**Before any observation or retry, read and apply
|
|
119
|
+
[task creation](references/result-handling.md#task-creation).**
|
|
120
|
+
A task ID alone is not creation. That reference owns admission decisions,
|
|
121
|
+
including the same-root supervisor migration exception, workspace waits,
|
|
122
|
+
resource refusals, and uncertain creation. A failed continuation retains its
|
|
123
|
+
original command and intent.
|
|
328
124
|
|
|
329
125
|
### 5. Observe and collect
|
|
330
126
|
|
|
331
|
-
|
|
332
|
-
|
|
127
|
+
Follow [observation decisions](references/result-handling.md#observe-and-collect)
|
|
128
|
+
with the same root and created task ID:
|
|
333
129
|
|
|
334
130
|
```sh
|
|
335
131
|
delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" status TASK_ID --json
|
|
336
132
|
delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" collect TASK_ID --watch 5s --json
|
|
337
133
|
```
|
|
338
134
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
`collect` again. Do not dispatch again. Continue until
|
|
346
|
-
the response has a terminal `outcome` or a bounded operational error that
|
|
347
|
-
requires the caller’s attention.
|
|
348
|
-
|
|
349
|
-
Accept a result only when the terminal outcome is present and its publication
|
|
350
|
-
is committed. A rejected outcome is terminal evidence and must be reported as
|
|
351
|
-
rejected. Payload and raw output are returned as validated descriptors; do not
|
|
352
|
-
copy unrestricted provider output into the control response.
|
|
135
|
+
Apply the owning decision order before waiting: terminal outcomes and concrete
|
|
136
|
+
errors, cancellation/timeout/interruption, interaction, then pending
|
|
137
|
+
observation. Keep collection in the foreground until completion or a reported
|
|
138
|
+
blocker; detach only when requested and retain the exact task IDs and root.
|
|
139
|
+
A pending watch is not success. Read the complete validated answer and check
|
|
140
|
+
the requested deliverables before claiming completion.
|
|
353
141
|
|
|
354
142
|
### 6. Continue a timed out or interrupted turn
|
|
355
143
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
otherwise report it. When continuing, use the original state root and a finite
|
|
362
|
-
budget, then observe the returned successor ID. Do not
|
|
363
|
-
wait indefinitely for pending publication or restart the task as an unrelated
|
|
364
|
-
dispatch. If continuation is unavailable, report its reason, except the busy
|
|
365
|
-
managed-workspace case in [continuation and timeout
|
|
366
|
-
recovery](references/continuation.md). Apply the same
|
|
367
|
-
`failure` and `task_record` decisions as for dispatch; never repeat an uncertain
|
|
368
|
-
successor creation.
|
|
144
|
+
Read [continuation](references/continuation.md) for eligibility, cancellation
|
|
145
|
+
precedence, and exact-session follow-up. Preserve the root and finite budget,
|
|
146
|
+
then apply [task creation](references/result-handling.md#task-creation) to the
|
|
147
|
+
successor response. Never replace an uncertain or failed continuation with a
|
|
148
|
+
fresh dispatch.
|
|
369
149
|
|
|
370
150
|
## Comparisons, debate, and follow-up
|
|
371
151
|
|
|
372
|
-
Choose a finite scope and number of rounds
|
|
373
|
-
|
|
374
|
-
and
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
independent question. Preserve which agent supplied each finding, explain
|
|
378
|
-
agreements and disagreements, and stop at the agreed scope or a blocker.
|
|
379
|
-
An external worker should perform its assigned work; do not ask it to recursively
|
|
380
|
-
recruit more agents unless that is explicitly part of the task.
|
|
152
|
+
Choose a finite scope and number of rounds. Collect each participant's actual
|
|
153
|
+
result before giving it to another participant as challenge material. Keep
|
|
154
|
+
attribution and failed/blocked requests visible. Use each participant's own
|
|
155
|
+
predecessor for an exact-session follow-up. The
|
|
156
|
+
[collaboration reference](references/collaboration.md) owns coordination examples.
|
|
381
157
|
|
|
382
158
|
## Details when needed
|
|
383
159
|
|
|
384
|
-
-
|
|
385
|
-
|
|
386
|
-
-
|
|
387
|
-
|
|
388
|
-
-
|
|
389
|
-
|
|
390
|
-
-
|
|
391
|
-
|
|
392
|
-
[Git checkpoints](references/workspaces.md#git-checkpoints) before creating,
|
|
393
|
-
observing, forking from, or removing a checkpoint.
|
|
394
|
-
- Use [read-only example](examples/read-only-task.md),
|
|
395
|
-
[write example](examples/workspace-write-task.md),
|
|
396
|
-
[JSON examples](examples/json-results.md), and
|
|
397
|
-
[managed workspace example](examples/managed-workspace.md) when constructing
|
|
398
|
-
a task or parsing unfamiliar output. Do not load every reference for a
|
|
399
|
-
routine dispatch.
|
|
160
|
+
- [Commands and discovery](references/command-reference.md)
|
|
161
|
+
- [Optional Teams and Members](references/command-reference.md#teams)
|
|
162
|
+
- [Task/result decisions](references/result-handling.md), including conditional offline recheck
|
|
163
|
+
- [Continuation](references/continuation.md)
|
|
164
|
+
- [Interaction](references/interaction.md)
|
|
165
|
+
- [Managed workspaces and checkpoints](references/workspaces.md)
|
|
166
|
+
- [Managed workspace example](examples/managed-workspace.md)
|
|
167
|
+
- [JSON examples](examples/json-results.md)
|
|
400
168
|
|
|
401
169
|
## Completion report
|
|
402
170
|
|
|
403
|
-
|
|
404
|
-
returned
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
171
|
+
Use observed responses and validated evidence. Report each original task ID,
|
|
172
|
+
returned provider ID, admission/liveness/publication fields, terminal outcome,
|
|
173
|
+
evidence descriptors, and any successor or blocked authentication state.
|
|
174
|
+
For a `not_created` stop, name the requested destination and preserve its
|
|
175
|
+
saved JSON failure with sensitive content redacted. Report the evidence-backed
|
|
176
|
+
cause or what remains unknown and a specific next step; do not invent paths
|
|
177
|
+
or infer installation, authentication or configuration from rejection alone.
|