delegation-layer 0.2.0 → 0.3.1

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 (31) hide show
  1. package/README.md +7 -0
  2. package/docs/assets/delegation-layer-hero.jpg +0 -0
  3. package/package.json +1 -1
  4. package/plugins/delegation-layer/.claude-plugin/plugin.json +1 -1
  5. package/plugins/delegation-layer/.codex-plugin/plugin.json +1 -1
  6. package/plugins/delegation-layer/skills/agent-integration/SKILL.md +16 -8
  7. package/plugins/delegation-layer/skills/agent-integration/evals/evals.json +23 -3
  8. package/plugins/delegation-layer/skills/agent-integration/examples/json-results.md +5 -2
  9. package/plugins/delegation-layer/skills/agent-integration/examples/managed-workspace.md +50 -17
  10. package/plugins/delegation-layer/skills/agent-integration/examples/read-only-task.md +3 -1
  11. package/plugins/delegation-layer/skills/agent-integration/references/ccr.md +7 -3
  12. package/plugins/delegation-layer/skills/agent-integration/references/collaboration.md +2 -2
  13. package/plugins/delegation-layer/skills/agent-integration/references/command-reference.md +152 -47
  14. package/plugins/delegation-layer/skills/agent-integration/references/continuation.md +7 -4
  15. package/plugins/delegation-layer/skills/agent-integration/references/interaction.md +6 -5
  16. package/plugins/delegation-layer/skills/agent-integration/references/result-handling.md +66 -3
  17. package/plugins/delegation-layer/skills/agent-integration/references/routing-rule.json +1 -1
  18. package/plugins/delegation-layer/skills/agent-integration/references/workspaces.md +18 -14
  19. package/skills/agent-integration/SKILL.md +16 -8
  20. package/skills/agent-integration/evals/evals.json +23 -3
  21. package/skills/agent-integration/examples/json-results.md +5 -2
  22. package/skills/agent-integration/examples/managed-workspace.md +50 -17
  23. package/skills/agent-integration/examples/read-only-task.md +3 -1
  24. package/skills/agent-integration/references/ccr.md +7 -3
  25. package/skills/agent-integration/references/collaboration.md +2 -2
  26. package/skills/agent-integration/references/command-reference.md +152 -47
  27. package/skills/agent-integration/references/continuation.md +7 -4
  28. package/skills/agent-integration/references/interaction.md +6 -5
  29. package/skills/agent-integration/references/result-handling.md +66 -3
  30. package/skills/agent-integration/references/routing-rule.json +1 -1
  31. package/skills/agent-integration/references/workspaces.md +18 -14
@@ -22,15 +22,17 @@ The main skill owns [root selection](../SKILL.md#3-prepare-separate-paths-and-a-
22
22
  | `workspace`, `checkpoint` | [Git resources](workspaces.md) | Helpers, not provider turns |
23
23
  | `teams` | [Optional configuration and Member selection](#teams) | None |
24
24
  | `schedule` | [Recurring definitions](#schedules), [history and execution evidence](#schedule-history-and-execution) | None |
25
- | `scheduler run` | [Independent scheduler](#scheduler-runtime) | Admits due occurrences through normal dispatch |
25
+ | `scheduler serve/status/stop` (when supported), `scheduler run` | [User-started host and compatibility runtime](#scheduler-runtime) | Due occurrences use normal dispatch; status/stop do not launch providers |
26
26
 
27
- Prefix every task command with `delegate --root ROOT`, using the same
28
- explicit root across invocations.
27
+ The commands below use the CLI default and omit `--root`. The advanced override
28
+ syntax is `delegate --root ABS COMMAND ...`; use it only for an explicitly
29
+ supplied or already recorded custom or historical root, preserved exactly under
30
+ the main skill's [root rule](../SKILL.md#3-prepare-separate-paths-and-a-finite-brief).
29
31
 
30
32
  ## Dispatch
31
33
 
32
34
  ```text
33
- delegate --root ROOT dispatch [--auto | --provider ID] --brief FILE \
35
+ delegate dispatch [--auto | --provider ID] --brief FILE \
34
36
  --cwd ABS [--id TASK_ID] [--permission MODE] [--budget DURATION] \
35
37
  [--model MODEL] [--effort EFFORT] [--native-timeout DURATION] \
36
38
  [--interactive] [--review-target TARGET] [--resume-task TASK_ID] \
@@ -170,8 +172,8 @@ setup, even when there is no matching Team or project default.
170
172
  After a task record is created, inspect the same ID and root:
171
173
 
172
174
  ```sh
173
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" status TASK_ID --json
174
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" collect TASK_ID --watch 5s --json
175
+ delegate status TASK_ID --json
176
+ delegate collect TASK_ID --watch 5s --json
175
177
  ```
176
178
 
177
179
  Dispatch/status/collect optionally expose top-level `team`, the admitted
@@ -186,23 +188,30 @@ not prove admission, provider readiness or successful publication.
186
188
 
187
189
  ## Schedules
188
190
 
189
- The management commands below save and inspect definitions. They do not start
190
- a scheduler, launch a provider, or prove that a task ran. Start the
191
- [scheduler](#scheduler-runtime) separately to execute due occurrences.
191
+ The management commands below save and inspect definitions; they do not start a
192
+ scheduler, launch a provider themselves, or prove that a task ran. On builds with
193
+ [host controls](#scheduler-runtime), create/resume check for a compatible live
194
+ host after saving. When a response includes `scheduler.serve_command`, retain
195
+ the saved ID and give that argv array intact to the user for an independent
196
+ terminal or tmux pane. For run-only builds, use the
197
+ [compatibility instructions](#scheduler-runtime); do not expect those host fields.
198
+ Never start a persistent scheduler inside the agent's bounded task or submit
199
+ another create to obtain a running scheduler.
200
+ See [definition and host results](result-handling.md#schedule-definition-and-host-results).
192
201
 
193
202
  ```text
194
- delegate --root ROOT schedule create --brief FILE --cwd ABS \
203
+ delegate schedule create --brief FILE --cwd ABS \
195
204
  [--auto | --provider ID] --cron 'MIN HOUR DOM MONTH DOW' \
196
205
  [--timezone ZONE] [--id SCHEDULE_ID] [--model MODEL] [--effort EFFORT] \
197
206
  [--permission MODE] [--budget DURATION] [--native-timeout DURATION] \
198
207
  [--review-target TARGET] \
199
208
  [--team-scope user|project --team TEAM_ID --member MEMBER_ID] \
200
209
  [--project-root ABS] --json
201
- delegate --root ROOT schedule list [--after SCHEDULE_ID] [--limit N] --json
202
- delegate --root ROOT schedule show SCHEDULE_ID --json
203
- delegate --root ROOT schedule pause SCHEDULE_ID --json
204
- delegate --root ROOT schedule resume SCHEDULE_ID --json
205
- delegate --root ROOT schedule delete SCHEDULE_ID --json
210
+ delegate schedule list [--after SCHEDULE_ID] [--limit N] --json
211
+ delegate schedule show SCHEDULE_ID --json
212
+ delegate schedule pause SCHEDULE_ID --json
213
+ delegate schedule resume SCHEDULE_ID --json
214
+ delegate schedule delete SCHEDULE_ID --json
206
215
  ```
207
216
 
208
217
  - Requested provider options remain as supplied, including omissions. Creation
@@ -235,17 +244,23 @@ delegate --root ROOT schedule delete SCHEDULE_ID --json
235
244
  - Definitions are immutable. Pause blocks future admissions; resume skips the
236
245
  interval from the stored cursor through now without catch-up. A clock behind
237
246
  the cursor leaves that cursor unchanged. Delete is terminal and retains
238
- history. Pause/delete do not cancel an active occurrence.
239
- - Only create initializes absent schedule storage. An absent store lists as
240
- empty; show/state commands report not found. List defaults to 50 rows, at most
241
- 100, including paused/deleted definitions. Use the returned cursor to page.
247
+ history. Pause/delete do not cancel an active occurrence or require a live
248
+ host. Create/resume preserve the saved definition even when the host is
249
+ absent, starting, in backoff or otherwise not confirmed ready.
250
+ - Among schedule management commands, only create initializes absent storage.
251
+ An absent store lists as empty; show/state commands report not found. List
252
+ defaults to 50 rows, at most 100, including paused/deleted definitions. Use the
253
+ returned cursor to page.
242
254
  - Create/state responses are compact. Show returns saved requested choices and
243
255
  brief metadata, not brief contents, with a 2 MiB response limit. Keep the ID
244
256
  when output or storage reports uncertainty; inspect it with show rather than
245
257
  submitting another create. Reusing an existing ID conflicts.
246
258
 
247
- Handler results use exit `0` for success/advisory warnings, `2` for invalid
248
- input/state transitions and `1` for not-found, conflicts or operational failures.
259
+ Handler results use exit `0` for confirmed completion/advisory warnings, `2` for
260
+ invalid input/state transitions and `1` for not-found, conflicts or operational
261
+ failures. On builds with host controls, create/resume also use exit `3` for saved
262
+ definitions needing user host start or pending host readiness; keep the same ID
263
+ and follow [result handling](result-handling.md#schedule-definition-and-host-results).
249
264
  `--json` applies to handler responses; argument/usage errors retain the CLI's
250
265
  normal stderr behavior. A valid rule with no future occurrence in the supported
251
266
  timestamp range has a distinct range error, not a claim of permanent invalidity.
@@ -253,8 +268,8 @@ timestamp range has a distinct range error, not a claim of permanent invalidity.
253
268
  ### Schedule history and execution
254
269
 
255
270
  ```text
256
- delegate --root ROOT schedule history SCHEDULE_ID [--before RFC3339Nano] [--limit N] --json
257
- delegate --root ROOT schedule execution TASK_ID --json
271
+ delegate schedule history SCHEDULE_ID [--before RFC3339Nano] [--limit N] --json
272
+ delegate schedule execution TASK_ID --json
258
273
  ```
259
274
 
260
275
  `history` returns occurrence summaries and compact skipped intervals together,
@@ -282,31 +297,121 @@ for freshness, no-result states, response bounds, exit codes and recovery.
282
297
 
283
298
  ## Scheduler runtime
284
299
 
300
+ Check `delegate help` for the installed build's command surface. Use `serve`,
301
+ `status` and `stop` only when that help advertises them; prefer `serve` for managed
302
+ recovery. The signatures below describe the current command surface. They use
303
+ the same CLI default as ordinary schedule commands; preserve an explicit custom
304
+ or historical root when the schedule is bound to one.
305
+
285
306
  ```text
286
- delegate --root ROOT scheduler run [--pueue-config ABS] [--json]
307
+ delegate scheduler serve
308
+ delegate scheduler status
309
+ delegate scheduler stop
310
+ delegate scheduler run [--pueue-config ABS] [--json]
287
311
  ```
288
312
 
289
- The scheduler requires the automatic managed worker. Use colocated `delegate`
313
+ If installed help offers only `scheduler run`, the user runs
314
+ `delegate scheduler run` in an independent terminal or tmux pane and
315
+ leaves it in the foreground. Ctrl-C in its original pane stops it; it has no
316
+ automatic child restart. Keep the saved schedule ID and inspect
317
+ [history and execution](#schedule-history-and-execution) for actual occurrences.
318
+ Do not issue unsupported `scheduler status` or `scheduler stop` commands, or
319
+ expect `start_required` or `scheduler.serve_command` fields from that build.
320
+ The managed-host controls and response fields below apply only when installed
321
+ help supports them.
322
+
323
+ The user starts one foreground `serve` host per canonical execution root in an
324
+ independent terminal or tmux pane and leaves it running. It manages every saved
325
+ schedule in that root. When returned, agents give the exact
326
+ `scheduler.serve_command` argv array to the user. Agents must not start either
327
+ persistent scheduler command inside their own bounded task. The guard recognizes
328
+ an explicit Delegate task-scope marker and, on Linux, native Delegate
329
+ cgroup membership. It does not reconstruct guardian ownership or detect every
330
+ enclosing ancestor. A successful check or missing marker does not prove
331
+ independent placement; independent user launch remains required. Delegate
332
+ installs no OS service, enables no reboot/login startup and
333
+ does not automatically launch a detached host.
334
+
335
+ When present, `scheduler.serve_command` preserves spaces and shell metacharacters
336
+ as separate arguments. Human output also prints JSON argv, not an unquoted shell string.
337
+ Preserve those boundaries; see the [scheduler response fields](result-handling.md#schedule-definition-and-host-results).
338
+
339
+ Explicit `serve` may initialize absent scheduler storage through the same
340
+ scheduler owner lease used by `schedule create`. It can become ready with no
341
+ definitions; later creates reach that running host without a restart. Existing
342
+ root identity and data stay in place; invalid existing storage fails explicitly.
343
+ Passive reads and low-level `run` do not initialize absent storage. A second host
344
+ or competing `run` cannot acquire the same root's ownership. The host uses its
345
+ retained launch context and the saved requested provider choices. For
346
+ Team-targeted schedules, new occurrences read the pinned catalog's latest Member
347
+ defaults through normal admission; existing task IDs retain saved settings. Use
348
+ the intended user configuration context, or a different catalog instance fails
349
+ admission even when Team/Member IDs match. Context changes require completed stop
350
+ and a fresh user start; full launch environments are not persisted.
351
+
352
+ While the host lives, it restarts its scheduler child after an unexpected exit,
353
+ including a clean exit while running is still desired. A successful Start needs
354
+ its exact child Wait before replacement; a definitively failed Start that
355
+ created no child may retry without Wait. Retry delays are 1, 2, 4, 8, 16, 30, 60,
356
+ 120 and 300 seconds, capped at five minutes indefinitely. Five continuous healthy
357
+ minutes reset the policy;
358
+ elapsed healthy time and delays use monotonic timing. Create/resume/status do not
359
+ reset cooldown. A live but unready child or uncertain launch is not replaced.
360
+ Before the child reports Ready or scans for due work, the application's
361
+ before-Ready check validates every current saved definition. An incompatible
362
+ definition leaves the host degraded and stops automatic child restart for that
363
+ incompatibility; it does not enter an endless crash/retry loop. Preserve the
364
+ saved definitions and report the compatibility fault.
365
+ If the host, terminal/tmux pane or machine stops, automatic recovery ends; the
366
+ user must run serve again.
367
+
368
+ `scheduler status` is passive: it does not start, migrate, repair or clean
369
+ anything. It observes starting, ready, backoff, degraded, stopping or stopped
370
+ state, or a compatibility runtime's `foreground` generation, and available
371
+ attempt, bounded diagnostic and retry information. Optional
372
+ `scheduler.fault: true` is the host owner's permanent fault decision; degraded state or
373
+ `last_error` alone is not that decision. After a definition is saved,
374
+ transport-only unreachability returns pending exit `3` without a top-level
375
+ `error`; a permanent host fault returns exit `1`, retaining
376
+ `schedule.saved: true` and the same ID.
377
+
378
+ `scheduler stop` persists a stopped fence, interrupts backoff, ends admission and
379
+ joins accepted controls, GoCron shutdown and child Wait. The host remains
380
+ responsive to authenticated status/stop while joining its child or waiting for a
381
+ prior execution owner. Under host ownership, it writes a closure witness once
382
+ execution ownership is free. Completed stop requires that witness and exact
383
+ host absence; acceptance, timeout or host death alone is not completion.
384
+ Authenticated acceptance remains visible even if later readback fails; concrete
385
+ faults remain visible too. SIGINT, SIGTERM and SIGHUP use the same fenced shutdown
386
+ path. Independently admitted tasks retain their own supervisors and budgets.
387
+ See [host result decisions](result-handling.md#schedule-definition-and-host-results).
388
+
389
+ `scheduler run` runs the foreground runtime directly and remains a compatibility
390
+ path without automatic child restart. On builds with host controls, it shares
391
+ root ownership with serve and announces its current foreground generation,
392
+ which an older managed-host stop
393
+ receipt cannot hide. Status reports `scheduler.state: foreground`.
394
+ `scheduler stop` does not terminate the raw invocation: it returns
395
+ `stop_accepted: false` and `next_action: stop_foreground_runtime`. The user ends
396
+ it with Ctrl-C in its original pane; prefer `scheduler serve` for managed
397
+ recovery. The existing manual OS-service hosting option is separate from the new
398
+ foreground host path; see [operator hosting](https://github.com/hishamkaram/delegation-layer/blob/main/docs/cli-reference.md#scheduler-hosting).
399
+
400
+ Serve and run require the automatic managed worker. Use colocated `delegate`
290
401
  and `delegate-run` binaries from the same build and omit the advanced `--runner`
291
402
  override. An override selects custom ownership even when it names the bundled
292
- worker; startup rejects it with exit `2` before opening storage or acquiring a
293
- lease. Ordinary explicit custom-runner dispatch and continuation retain their
403
+ worker. `scheduler run` rejects it with exit `2` before opening storage or
404
+ acquiring a lease. `scheduler serve` checks existing state and schedule storage
405
+ before rejecting the override with exit `2`, so a storage error can take
406
+ precedence. Ordinary explicit custom-runner dispatch and continuation retain their
294
407
  existing compatibility rules. Historical custom-runner claims are not
295
408
  automatically repaired or released.
296
409
 
297
- This foreground command requires existing schedule storage. One process owns
298
- each root; a second fails busy. It uses the service launch environment and the
299
- saved requested provider choices. Saving a definition never starts the service.
300
- For Team-targeted schedules, new occurrences read the pinned catalog's latest
301
- Member defaults through normal admission; existing task IDs retain saved settings.
302
- Use the same intended user configuration context as creation, or a different
303
- catalog instance fails admission even when Team/Member IDs match.
304
- See [operator hosting](https://github.com/hishamkaram/delegation-layer/blob/main/docs/cli-reference.md#scheduler-hosting).
305
-
306
410
  Startup skips past appointments. Expired, overlapping or capacity-limited
307
411
  appointments are skipped with a recorded reason; no catch-up queue or automatic
308
- retry/continuation is added. Pause/delete prevent new claims, without canceling
309
- already claimed tasks. Use [history and execution](#schedule-history-and-execution)
412
+ provider retry/continuation is added. Downtime is recorded in compact skipped
413
+ intervals, never replayed minute by minute. Pause/delete prevent new claims,
414
+ without canceling already claimed tasks. Use [history and execution](#schedule-history-and-execution)
310
415
  to inspect recorded work, and [result handling](result-handling.md#scheduled-execution-results)
311
416
  to collect its answer. Schedule reservation release is separate from result
312
417
  publication.
@@ -317,12 +422,12 @@ Delegate workers keep their own budgets; provider-native in-session subagents do
317
422
  not acquire independent Delegate lifetimes. The workflow owns saved progress,
318
423
  worker IDs and deduplication; unknown acknowledgment is not permission to resend.
319
424
 
320
- Interrupting the service joins its admission/control work before releasing its
321
- owner lease. Accepted lifecycle calls settle independently of the stop signal;
425
+ Interrupting the compatibility runtime joins its admission/control work before
426
+ releasing its owner lease. Accepted lifecycle calls settle independently of the stop signal;
322
427
  there is no shutdown-time guarantee. Already admitted tasks continue under their
323
- own supervisors. The
324
- service reports bounded identifiers/codes on stderr; `--json` selects the final
325
- command response, not an event stream or daemon-control protocol. Uncertain task
428
+ own supervisors. The compatibility command reports bounded identifiers/codes on
429
+ stderr; `--json` selects the final command response, not an event stream or
430
+ daemon-control protocol. Uncertain task
326
431
  evidence blocks only its schedule until the existing owners can prove closure.
327
432
 
328
433
  ## Codex review
@@ -355,8 +460,8 @@ A checkpoint is Git-content evidence, not a provider outcome.
355
460
  ## Providers and capabilities
356
461
 
357
462
  ```sh
358
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" providers --json
359
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" capabilities --provider PROVIDER_ID --json
463
+ delegate providers --json
464
+ delegate capabilities --provider PROVIDER_ID --json
360
465
  ```
361
466
 
362
467
  `providers` returns `schema_version: 1` and a sorted `providers` array.
@@ -393,7 +498,7 @@ them. Keep defaults when no explicit choice is needed. Resolve a natural-languag
393
498
  name through native discovery:
394
499
 
395
500
  ```sh
396
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" models \
501
+ delegate models \
397
502
  --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE --json
398
503
  ```
399
504
 
@@ -436,7 +541,7 @@ reason codes and return no model facts.
436
541
  Use static preflight when readiness was requested, not before every task:
437
542
 
438
543
  ```sh
439
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" preflight \
544
+ delegate preflight \
440
545
  --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE \
441
546
  --permission REQUESTED_MODE --json
442
547
  ```
@@ -22,7 +22,7 @@ When `status` or `collect` reports a timed-out turn with:
22
22
  run:
23
23
 
24
24
  ```sh
25
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" continue \
25
+ delegate continue \
26
26
  --task PREDECESSOR_TASK_ID \
27
27
  --brief FOLLOW_UP_BRIEF \
28
28
  --budget 30m \
@@ -35,8 +35,11 @@ indefinitely for a publication that the interrupted turn cannot complete.
35
35
 
36
36
  The follow-up brief is optional. If it is omitted, Delegation Layer reuses the
37
37
  validated predecessor brief. A successful continuation returns a new task ID
38
- and links it to the predecessor. Observe and collect the new ID separately. Always retain the original state
39
- root, even if a returned command hint omits it. Permission is inherited; do not
38
+ and links it to the predecessor. Observe and collect the new ID separately.
39
+ Follow the main skill's [root rule](../SKILL.md#3-prepare-separate-paths-and-a-finite-brief):
40
+ ordinary continuation omits `--root` in the same user/configuration context;
41
+ an explicit custom or recorded historical root must be retained exactly, even
42
+ if a returned command hint omits it. Permission is inherited; do not
40
43
  add `--permission` to `continue`. Apply
41
44
  [task creation](result-handling.md#task-creation) before retrying or observing.
42
45
  Any authorized admission retry remains the argv-equivalent `continue`;
@@ -85,7 +88,7 @@ observe that successor instead; if its creation is uncertain, follow the
85
88
  `workspace.id` from the task response; never guess an ID or path:
86
89
 
87
90
  ```sh
88
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" workspace status \
91
+ delegate workspace status \
89
92
  WORKSPACE_ID --watch 30s --json
90
93
  ```
91
94
 
@@ -62,7 +62,7 @@ question. A printed question alone is not a pending reply request.
62
62
  together with the exact answers. Submit the reply:
63
63
 
64
64
  ```sh
65
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" reply "$task_id" \
65
+ delegate reply "$task_id" \
66
66
  --request "$request_id" --answers "$answers_file" \
67
67
  --id "$message_id" --json
68
68
  ```
@@ -70,9 +70,10 @@ question. A printed question alone is not a pending reply request.
70
70
  6. Keep collecting. A receipt is not task completion. Only the task's
71
71
  authoritative `outcome` establishes the final result.
72
72
 
73
- Use the same root expression for dispatch, collection, reply, and steering.
74
- If the user explicitly chose another root, use that exact path for all of
75
- them. The other variables stand for actual values saved from this task;
73
+ Follow the main skill's [root rule](../SKILL.md#3-prepare-separate-paths-and-a-finite-brief)
74
+ for dispatch, collection, reply, and steering. The examples use the CLI default;
75
+ preserve an explicit custom or recorded historical root for all of them.
76
+ The variables stand for actual values saved from this task;
76
77
  reassign them in each shell invocation if your tool does not preserve variables.
77
78
  A pending response without questions means keep collecting, not inspect OS
78
79
  processes or dispatch a replacement task.
@@ -86,7 +87,7 @@ reply IDs and earlier steering IDs. Submit it; for a lost response, follow the
86
87
  [delivery rules](#interpret-delivery-precisely) with the same ID and content:
87
88
 
88
89
  ```sh
89
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" steer "$task_id" \
90
+ delegate steer "$task_id" \
90
91
  --brief "$guidance_file" --id "$steering_message_id" --json
91
92
  ```
92
93
 
@@ -2,6 +2,9 @@
2
2
 
3
3
  Read response fields independently. A successful control command is not a
4
4
  successful provider result.
5
+ Examples use the CLI default under the main skill's
6
+ [root rule](../SKILL.md#3-prepare-separate-paths-and-a-finite-brief); preserve an
7
+ explicit custom or recorded historical root on related commands.
5
8
 
6
9
  ## Task control response
7
10
 
@@ -49,7 +52,7 @@ this table to each dispatch or continuation attempt separately, in order:
49
52
  | Response | Next action |
50
53
  |---|---|
51
54
  | Usage error, no JSON response | Correct the reported syntax using Delegate help or `providers --json`, then invoke that request again. Parsing failed before admission. |
52
- | `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. |
55
+ | `task_record: not_created`, `failure.code: supervisor_upgrade_required`, and `failure.next_action: run_supervisor_migrate` | Run `delegate supervisor migrate --json` once in the same user/configuration context for ordinary default-root work. If the failed command used an explicit custom or recorded historical root, run `delegate --root "<the exact absolute root used by the failed command>" supervisor migrate --json` instead. 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. A failed `continue` must be retried as the same `continue`; never replace it with a fresh `dispatch` or a direct provider call. |
53
56
  | `task_record: not_created` and `failure.next_action: correct_request` | Correct that request and retry it. |
54
57
  | `task_record: not_created`, `failure.code: workspace_provision_pending` or `workspace_busy`, and `failure.next_action: watch_workspace` | Follow [managed workspace recovery](#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. |
55
58
  | `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. |
@@ -166,6 +169,66 @@ asking again, but never infer it from a rejection or silently substitute a
166
169
  destination. Keep the original failed attempt reported as failed; independent
167
170
  requests and explicitly allowed recovery paths retain their existing rules.
168
171
 
172
+ ## Schedule definition and host results
173
+
174
+ Use the installed build's help to check `scheduler serve/status/stop` support.
175
+ Keep three facts separate: the definition was
176
+ saved, the host is ready, and an occurrence produced an accepted provider result.
177
+ Neither saving nor host readiness proves that a task ran.
178
+
179
+ Schedule create/resume report confirmed persistence as `schedule.saved: true`;
180
+ keep `schedule.id` even if the command exits nonzero. The separate top-level
181
+ `scheduler` object carries host observation and guidance:
182
+
183
+ | JSON field | Meaning |
184
+ | --- | --- |
185
+ | `scheduler.state` | Observed lifecycle or availability state, including `foreground` for a current raw `scheduler run`. Read it with `ready` and the process exit. |
186
+ | `scheduler.epoch`, `scheduler.attempt` | Owner generation string and numeric child attempt, when known. Omission does not identify an owner. |
187
+ | `scheduler.ready` | Whether this observation confirms host/child readiness; it is not an occurrence result. |
188
+ | `scheduler.fault` | Optional `true` for a permanent fault reported by the host owner. Do not infer it from degraded state or `last_error`; omission is not proof that the whole command is fault-free. |
189
+ | `scheduler.next_retry_at` | Optional next retry timestamp during recovery. Observation does not reset it. |
190
+ | `scheduler.last_error` | Optional bounded host diagnostic. Keep it alongside pending or readiness facts. |
191
+ | `scheduler.next_action` | Caller guidance, such as `start_required`, `inspect_scheduler` or `stop_foreground_runtime`. |
192
+ | `scheduler.serve_command` | Optional exact argv array for an independent user start. Preserve every element and its argument boundary. |
193
+ | `scheduler.stop_accepted` | Optional boolean for acceptance of this stop request. `true` is accepted, `false` is explicitly not accepted, and omission is unknown. Acceptance does not prove shutdown completed. |
194
+
195
+ For `start_required`, both `schedule.next_action` and `scheduler.next_action`
196
+ carry that guidance. `scheduler.serve_command` is JSON argv, including the
197
+ resolved executable and exact root. Human output also prints JSON argv after
198
+ `run independently (argv):`. For example, a returned root containing spaces:
199
+
200
+ ```text
201
+ run independently (argv): ["/installation with spaces/delegate","--root","/state with spaces","scheduler","serve"]
202
+ ```
203
+
204
+ Forward the array intact. It is not an unquoted shell command: do not join its
205
+ elements with spaces or pass the joined text through a shell. The user starts
206
+ serve independently with those exact argument boundaries; the agent must not
207
+ execute it inside its bounded task. An omitted `schedule.saved` does not confirm
208
+ persistence; preserve any ID and follow the reported storage/error guidance.
209
+
210
+ | Response or observation | Next action |
211
+ | --- | --- |
212
+ | Create/resume saved the definition and confirmed a compatible ready host; exit `0` | Keep its schedule ID/root. The host will handle future due work; use history/execution for actual occurrence evidence. |
213
+ | Create/resume returns exit `3`, `schedule.saved: true` and `scheduler.next_action: start_required` | The definition remains saved. Preserve the returned schedule ID/root and give `scheduler.serve_command` unchanged to the user to run in an independent terminal or tmux pane. Never start it inside the agent's bounded task, detach it in the background, or submit another create. |
214
+ | Create/resume saved the definition but reports starting, backoff or pending readiness; exit `3` | Keep the same ID and report its host state and available retry time. Use passive scheduler status for later observation; do not create another definition, start a competing host or reset cooldown. |
215
+ | Create/resume saved the definition but the host is temporarily unreachable; exit `3`, pending guidance and no top-level `error` | Preserve `schedule.saved: true` and the same ID. Use passive status to observe the uncertainty. A transport failure does not establish owner death or a permanent host fault. |
216
+ | Create/resume saved the definition and the host reports `scheduler.fault: true`; exit `1` | Report the permanent fault and available `scheduler.last_error`; retain `schedule.saved: true` and the ID. For an incompatible saved definition, the before-Ready check stops automatic child restart. Repeated create, serve or status calls are not a repair. |
217
+ | Scheduler status observes starting, ready, backoff, degraded, stopping or stopped; exit `0` | Observation completed. Report the observed state; exit `0` does not mean ready or that an occurrence succeeded. Status does not start, migrate, repair or clean resources. |
218
+ | Scheduler stop confirms completed stop; exit `0` | The exact stopped intent has a validated owner-written closure witness and the exact host is absent. The witness follows joined child shutdown and free execution ownership. Independently admitted tasks keep their existing lifetimes. A later host needs a fresh explicit user-run serve command. |
219
+ | Scheduler stop has `scheduler.stop_accepted: true` but completion is pending; exit `3` | Preserve its acceptance and pending state. The host remains control-responsive while joining its child or waiting for a prior execution owner. Host death before the closure witness does not complete stop. Observe the same generation; do not claim stopped, launch a replacement or repeat schedule creation. An omitted `stop_accepted` is unknown, not false. |
220
+ | Scheduler stop has authenticated `scheduler.stop_accepted: true` and a later readback fault; exit `1` | Preserve the accepted fact and report the concrete fault. Readback failure does not revoke acceptance or establish completed shutdown. |
221
+ | Status reports `scheduler.state: foreground`, or stop returns exit `3` with that state, `stop_accepted: false` and `next_action: stop_foreground_runtime` | The current compatibility `scheduler run` owns this generation; an older managed-host receipt cannot hide it. Public stop does not terminate it. Have the user end that invocation with Ctrl-C in its original pane. Prefer managed `scheduler serve` afterward. |
222
+ | Invalid input/state; exit `2`, or concrete operational/compatibility/cleanup fault; exit `1` | Report the error and retain any saved ID or accepted-control fact. A concrete fault joined to pending work remains a fault; it is not a pending-only result. |
223
+
224
+ If the host dies, its pane closes or the machine reboots, the user must start
225
+ serve again. Child crash recovery applies only while that host remains alive.
226
+ An absent heartbeat or unresponsive endpoint is uncertainty, not permission to
227
+ replace an owner. Do not install a service or invoke a detached bootstrap as a
228
+ recovery step. Pause/delete affect future claims and need no live host; they do
229
+ not cancel already admitted occurrences. [Scheduler runtime](command-reference.md#scheduler-runtime)
230
+ owns launch, backoff and calendar behavior.
231
+
169
232
  ## Scheduled execution results
170
233
 
171
234
  Use [schedule history and execution](command-reference.md#schedule-history-and-execution)
@@ -220,7 +283,7 @@ For an older released occurrence whose publication is unfinished, use the
220
283
  existing collection command with the same root and task ID:
221
284
 
222
285
  ```sh
223
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" collect TASK_ID --watch 0s --json
286
+ delegate collect TASK_ID --watch 0s --json
224
287
  ```
225
288
 
226
289
  Follow its own response and exit using [observation guidance](#observe-and-collect).
@@ -330,7 +393,7 @@ When Delegate returns `failure.next_action: "recheck"`, use the same root and
330
393
  exact task ID:
331
394
 
332
395
  ```sh
333
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" recheck TASK_ID --json
396
+ delegate recheck TASK_ID --json
334
397
  ```
335
398
 
336
399
  This command checks the already sealed evidence with an explicitly compatible
@@ -1 +1 @@
1
- "For work assigned to an external agent, model, or separate harness session, load the installed agent-integration skill before choosing tools and use Delegate. This includes research, implementation, testing, review, consultation, comparison, and debate, including external collaboration you choose. Discover destinations through Delegate. Preserve requested model IDs, effort, and permissions; do not guess ambiguous model identifiers. For task commands, pass --root \"${DELEGATE_ROOT:-$HOME/delegation-state}\" directly in each shell invocation; reuse that root for dispatch, observation, and continuation, never an invented /tmp root. If the user explicitly requests another root, use that exact path consistently. Keep each concurrent request and its response associated separately. Capture each dispatch response and exit status once; after task_record created, observe that task ID. Never dispatch again merely to recover output or inspect its exit status. Naming a CLI identifies the destination, not a request to bypass Delegate. Earlier assistant-generated direct-launch workflows do not override this preference. Native same-harness subagents remain available unless a separate session is requested. Respect an explicit user choice of another integration; otherwise do not substitute provider CLIs, plugins, or APIs after a Delegate blocker. Before observing or retrying an admission, read the installed skill's references/result-handling.md#task-creation and apply its creation decisions. It owns the narrow same-root migration, workspace-wait, and resource-refusal exceptions before the generic not_created stop rule. Preserve the original admission intent: dispatch remains dispatch and continue remains continue; never replace a failed continue with a fresh dispatch or direct provider call. A stop_and_report failure ends that attempt, not diagnosis: follow references/result-handling.md#failure-diagnosis without another generic troubleshooting request. Inspect bounded returned evidence and relevant authorized local read-only facts, distinguish supported causes from uncertainty, and propose a concrete next step. Do not poll unknown/uncreated tasks, expose credentials or unrestricted output, retry uncertain work, change setup/permissions or substitute destinations without authorization covering that action. Continue other independent requests. Keep collection in the foreground until completion or a reported blocker unless the user requested detachment. Pending work is observed through Delegate status, collect, or events, not OS process searches or supervisor commands. Merely discussing or configuring a tool is not delegation."
1
+ "For work assigned to an external agent, model, or separate harness session, load the installed agent-integration skill before choosing tools and use Delegate. This includes research, implementation, testing, review, consultation, comparison, and debate, including external collaboration you choose. Discover destinations through Delegate. Preserve requested model IDs, effort, and permissions; do not guess ambiguous model identifiers. For ordinary task, schedule, observation, interaction, and continuation commands, omit --root and let the CLI resolve its default in the same user/configuration context, independently of project cwd. Never assemble a default path, use a sample path or shell fallback, or treat ambient DELEGATE_ROOT as authority. Only pass --root for an explicitly user-supplied or already recorded custom or historical root; preserve that exact path for every command concerning its work. Do not search other roots for an old task or invent per-task or per-project roots. Keep each concurrent request and its response associated separately. Capture each dispatch response and exit status once; after task_record created, observe that task ID. Never dispatch again merely to recover output or inspect its exit status. Naming a CLI identifies the destination, not a request to bypass Delegate. Earlier assistant-generated direct-launch workflows do not override this preference. Native same-harness subagents remain available unless a separate session is requested. Respect an explicit user choice of another integration; otherwise do not substitute provider CLIs, plugins, or APIs after a Delegate blocker. Before observing or retrying an admission, read the installed skill's references/result-handling.md#task-creation and apply its creation decisions. It owns the narrow same-root migration, workspace-wait, and resource-refusal exceptions before the generic not_created stop rule. Preserve the original admission intent: dispatch remains dispatch and continue remains continue; never replace a failed continue with a fresh dispatch or direct provider call. A stop_and_report failure ends that attempt, not diagnosis: follow references/result-handling.md#failure-diagnosis without another generic troubleshooting request. Inspect bounded returned evidence and relevant authorized local read-only facts, distinguish supported causes from uncertainty, and propose a concrete next step. Do not poll unknown/uncreated tasks, expose credentials or unrestricted output, retry uncertain work, change setup/permissions or substitute destinations without authorization covering that action. Continue other independent requests. Keep collection in the foreground until completion or a reported blocker unless the user requested detachment. Pending work is observed through Delegate status, collect, or events, not OS process searches or supervisor commands. Merely discussing or configuring a tool is not delegation."
@@ -7,6 +7,10 @@ or attaches to a managed workspace (`--isolation git-worktree` or
7
7
  `--workspace ID`), or creates or removes a [Git checkpoint](#git-checkpoints).
8
8
 
9
9
  This reference is self-contained guidance for using managed workspaces.
10
+ Commands use the CLI default under the main skill's
11
+ [root rule](../SKILL.md#3-prepare-separate-paths-and-a-finite-brief). For a workspace
12
+ or checkpoint in an explicit custom or recorded historical root, pass that
13
+ exact `--root` on every related command.
10
14
 
11
15
  Provider-native permissions still apply inside an isolated checkout. A provider
12
16
  may edit files but be unable to stage or commit because linked-worktree Git
@@ -41,7 +45,7 @@ row ending or a provider outcome alone is not closure evidence.
41
45
  Create a managed workspace from a committed source base:
42
46
 
43
47
  ```text
44
- delegate --root ROOT dispatch --isolation git-worktree --cwd ABS \
48
+ delegate dispatch --isolation git-worktree --cwd ABS \
45
49
  [--base REV] [--workspace-budget DURATION] ... --json
46
50
  ```
47
51
 
@@ -55,7 +59,7 @@ removing that source does not block capture, release, or forget. A request that
55
59
  workspace uses its recorded checkout and source identity:
56
60
 
57
61
  ```text
58
- delegate --root ROOT dispatch --workspace WORKSPACE_ID ... --json
62
+ delegate dispatch --workspace WORKSPACE_ID ... --json
59
63
  ```
60
64
 
61
65
  Public `--workspace` cannot be combined with `--cwd`, `--base`, or
@@ -80,11 +84,11 @@ made no write outside the promised content scope.
80
84
  The CLI currently exposes these managed-workspace commands:
81
85
 
82
86
  ```text
83
- delegate --root ROOT workspace list [--after ID] [--limit 1..50] --json
84
- delegate --root ROOT workspace status ID [--operation OP] [--watch DURATION] --json
85
- delegate --root ROOT workspace exec ID --budget DURATION --json -- ARGV...
86
- delegate --root ROOT workspace release ID [--discard] [--budget DURATION] --json
87
- delegate --root ROOT workspace forget ID [--budget DURATION] --json
87
+ delegate workspace list [--after ID] [--limit 1..50] --json
88
+ delegate workspace status ID [--operation OP] [--watch DURATION] --json
89
+ delegate workspace exec ID --budget DURATION --json -- ARGV...
90
+ delegate workspace release ID [--discard] [--budget DURATION] --json
91
+ delegate workspace forget ID [--budget DURATION] --json
88
92
  ```
89
93
 
90
94
  `workspace exec` passes `ARGV...` directly to the supervised helper; the
@@ -110,7 +114,7 @@ must not mutate the predecessor's immutable records. A retained workspace can be
110
114
  read-only review by attaching its ID, for example:
111
115
 
112
116
  ```text
113
- delegate --root ROOT dispatch --provider codex:review \
117
+ delegate dispatch --provider codex:review \
114
118
  --workspace WORKSPACE_ID --review-target TARGET --brief ABS_BRIEF \
115
119
  --permission read-only --budget 1h --json
116
120
  ```
@@ -183,11 +187,11 @@ fixed Delegate values; trailers carry the checkpoint ID and request digest.
183
187
  This is unrelated to a provider continuation `mode: "checkpoint"`.
184
188
 
185
189
  ```text
186
- delegate --root ROOT checkpoint create --cwd ABS [--budget DURATION] --json
187
- delegate --root ROOT checkpoint create --workspace ID [--budget DURATION] --json
188
- delegate --root ROOT checkpoint status CHECKPOINT_ID [--operation OP] [--watch DURATION] --json
189
- delegate --root ROOT checkpoint list [--after CHECKPOINT_ID] [--limit 1..50] --json
190
- delegate --root ROOT checkpoint remove CHECKPOINT_ID [--budget DURATION] --json
190
+ delegate checkpoint create --cwd ABS [--budget DURATION] --json
191
+ delegate checkpoint create --workspace ID [--budget DURATION] --json
192
+ delegate checkpoint status CHECKPOINT_ID [--operation OP] [--watch DURATION] --json
193
+ delegate checkpoint list [--after CHECKPOINT_ID] [--limit 1..50] --json
194
+ delegate checkpoint remove CHECKPOINT_ID [--budget DURATION] --json
191
195
  ```
192
196
 
193
197
  - `create` names exactly one target: `--cwd` for an absolute ordinary Git
@@ -232,7 +236,7 @@ Save every response and exit code once; follow
232
236
  the same repository as `--cwd`, normally the source the Lead already uses:
233
237
 
234
238
  ```text
235
- delegate --root ROOT dispatch --auto --brief ABS_BRIEF --cwd ABS_SOURCE \
239
+ delegate dispatch --auto --brief ABS_BRIEF --cwd ABS_SOURCE \
236
240
  --isolation git-worktree --base COMMIT_OID \
237
241
  --permission workspace-write --budget 30m --json
238
242
  ```
@@ -87,11 +87,16 @@ Use a supplied brief or write the worker's bounded assignment and acceptance
87
87
  criteria to a regular file. Do not copy the orchestration request or ask workers
88
88
  to recruit others unless recursive delegation was requested.
89
89
 
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.
90
+ For ordinary task, schedule, observation, interaction, and continuation commands,
91
+ omit `--root`; the CLI owns default-root resolution for the user's configuration
92
+ context, independently of the project cwd. Do not assemble a default path, use a
93
+ sample path or shell fallback, or treat ambient `DELEGATE_ROOT` as authority.
94
+ Only pass `--root` when the user explicitly supplies a root or existing work has
95
+ an already recorded custom or historical root; preserve that exact path for
96
+ every command concerning that work. Never search other roots for an old task.
97
+ Task IDs separate tasks; do not invent per-task or per-project roots. The state
98
+ root must remain outside provider-writable workspaces, provider runtime
99
+ directories, and temporary trees they may write.
95
100
 
96
101
  Prepare paths and dispatch in one tool invocation; shell variables may not
97
102
  persist between calls. Use saved absolute paths in later calls. Do not use
@@ -125,13 +130,16 @@ original command and intent.
125
130
  ### 5. Observe and collect
126
131
 
127
132
  Follow [observation decisions](references/result-handling.md#observe-and-collect)
128
- with the same root and created task ID:
133
+ with the created task ID, using the CLI default for ordinary work:
129
134
 
130
135
  ```sh
131
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" status TASK_ID --json
132
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" collect TASK_ID --watch 5s --json
136
+ delegate status TASK_ID --json
137
+ delegate collect TASK_ID --watch 5s --json
133
138
  ```
134
139
 
140
+ For work bound to an explicit custom or historical root, add its exact
141
+ `--root` to both commands under the [root rule](#3-prepare-separate-paths-and-a-finite-brief).
142
+
135
143
  Apply the owning decision order before waiting: terminal outcomes and concrete
136
144
  errors, cancellation/timeout/interruption, interaction, then pending
137
145
  observation. Keep collection in the foreground until completion or a reported