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.
Files changed (26) hide show
  1. package/README.md +45 -320
  2. package/package.json +1 -1
  3. package/plugins/delegation-layer/.claude-plugin/plugin.json +1 -1
  4. package/plugins/delegation-layer/.codex-plugin/plugin.json +1 -1
  5. package/plugins/delegation-layer/skills/agent-integration/SKILL.md +127 -359
  6. package/plugins/delegation-layer/skills/agent-integration/evals/cases.json +240 -0
  7. package/plugins/delegation-layer/skills/agent-integration/evals/routing.json +54 -0
  8. package/plugins/delegation-layer/skills/agent-integration/examples/read-only-task.md +29 -6
  9. package/plugins/delegation-layer/skills/agent-integration/examples/workspace-write-task.md +12 -10
  10. package/plugins/delegation-layer/skills/agent-integration/references/command-reference.md +412 -145
  11. package/plugins/delegation-layer/skills/agent-integration/references/continuation.md +20 -19
  12. package/plugins/delegation-layer/skills/agent-integration/references/interaction.md +20 -7
  13. package/plugins/delegation-layer/skills/agent-integration/references/result-handling.md +246 -90
  14. package/plugins/delegation-layer/skills/agent-integration/references/routing-rule.json +1 -1
  15. package/plugins/delegation-layer/skills/agent-integration/references/workspaces.md +33 -0
  16. package/skills/agent-integration/SKILL.md +127 -359
  17. package/skills/agent-integration/evals/cases.json +240 -0
  18. package/skills/agent-integration/evals/routing.json +54 -0
  19. package/skills/agent-integration/examples/read-only-task.md +29 -6
  20. package/skills/agent-integration/examples/workspace-write-task.md +12 -10
  21. package/skills/agent-integration/references/command-reference.md +412 -145
  22. package/skills/agent-integration/references/continuation.md +20 -19
  23. package/skills/agent-integration/references/interaction.md +20 -7
  24. package/skills/agent-integration/references/result-handling.md +246 -90
  25. package/skills/agent-integration/references/routing-rule.json +1 -1
  26. package/skills/agent-integration/references/workspaces.md +33 -0
package/README.md CHANGED
@@ -1,341 +1,66 @@
1
1
  # Delegation Layer
2
2
 
3
- <p align="center">
4
- <a href="#install"><img src="docs/assets/delegation-layer-hero.jpg" alt="One lead AI sends briefs through Delegate to three specialist agents and collects their findings" width="1400"></a>
5
- </p>
6
-
7
- Briefs out. Findings back. One place to track the work.
8
-
9
- Give your lead AI agent a reliable way to delegate bounded coding work to the
10
- provider that fits the task.
3
+ Delegate manages the local lifecycle of bounded tasks run by the agent CLIs
4
+ you already use: delegation, tracking, budgets, cancellation, continuation,
5
+ and retrieving results with evidence.
11
6
 
12
- Delegation Layer is a local CLI and Agent Skill for supervising one finite turn
13
- of a coding agent, checking its capabilities at runtime, and returning a
14
- validated result with durable evidence. It works with the provider CLIs you
15
- already use instead of replacing them.
7
+ **[Install](https://github.com/hishamkaram/delegation-layer/blob/main/docs/installation.md)**
8
+ · [Example](#ask-naturally)
9
+ · [Providers](https://github.com/hishamkaram/delegation-layer/blob/main/docs/providers.md)
10
+ · [Teams](https://github.com/hishamkaram/delegation-layer/blob/main/docs/teams.md)
11
+ · [Docs](https://github.com/hishamkaram/delegation-layer/blob/main/docs/README.md)
16
12
 
17
- ## Why use it?
18
-
19
- - **One simple control layer** — your agent can discover providers and dispatch
20
- work through one provider-neutral interface.
21
- - **Bounded by design** — every task has an explicit workspace, permission mode,
22
- and time budget.
23
- - **Recoverable results** — a later `collect` call can read a finished task
24
- without launching the provider again.
25
- - **Clarify while work runs** — answer native questions through Delegate; steer
26
- an active Codex turn without restarting it. [Interactive tasks](docs/cli-reference.md#interactive-tasks).
27
- - **Resumable turns** — a durable timeout can continue the exact provider
28
- session through a linked successor task.
29
- - **Runtime compatibility** — the selected provider's executable and advertised
30
- capabilities are checked before provider execution.
31
- - **Model choice when needed** — native model and effort discovery is available
32
- without turning discovery into an admission allowlist.
33
- - **Optional retained worktrees** — independent Git writes can use a managed
34
- worktree with explicit capture and Lead-controlled release.
35
- - **Native authentication** — provider login stays with the provider CLI; task
36
- state does not contain copied credentials.
13
+ <p align="center">
14
+ <a href="https://github.com/hishamkaram/delegation-layer/blob/main/docs/installation.md"><img src="docs/assets/delegation-layer-hero.jpg" alt="One lead AI sends briefs through Delegate to specialist agents and collects their findings" width="1400"></a>
15
+ </p>
37
16
 
38
- ## How it works
17
+ ## What it provides
39
18
 
40
- 1. Install the plugin so the skill and self-contained CLI are available together.
41
- 2. The lead agent discovers the available provider capabilities.
42
- 3. Delegation Layer admits one bounded provider turn through the supervisor.
43
- 4. The lead agent collects the sealed result and evidence.
19
+ | Capability | Benefit | Status | Reference |
20
+ | --- | --- | --- | --- |
21
+ | Supervised agent tasks | Track one bounded turn through a provider-neutral interface. | Available | [Task commands](skills/agent-integration/references/command-reference.md) |
22
+ | Budgets and cancellation | Bound execution time and request an explicit stop. | Available | [Result handling](skills/agent-integration/references/result-handling.md) |
23
+ | Durable results | Collect validated answers and evidence after the turn ends. | Available | [Results](skills/agent-integration/references/result-handling.md) |
24
+ | Exact-session continuation | Follow up in the recorded provider conversation. | Available | [Continuation](skills/agent-integration/references/continuation.md) |
25
+ | Native clarification | Answer questions and steer supported active turns. | Available | [Interaction](skills/agent-integration/references/interaction.md) |
26
+ | Managed Git workspaces | Separate parallel writes and review captured changes before landing them. | Available | [Workspaces](skills/agent-integration/references/workspaces.md) |
27
+ | Recurring background tasks | Run saved schedules independently and inspect their execution history. | Available | [Recurring tasks](docs/getting-started.md#recurring-tasks) |
28
+ | Optional Teams | Save scoped Roles, Members and execution defaults; explicitly choose a Member for direct or scheduled work. | Available | [Teams](docs/teams.md) |
44
29
 
45
30
  ## Ask naturally
46
31
 
47
- Try “Ask Codex to review this change”, “Get Antigravity’s opinion”, or
48
- “Have Claude investigate this failure”. The skill routes external collaboration
49
- through `delegate`, preserves a named destination, and collects task evidence.
50
- Ordinary native subagents remain available for work inside the current harness,
51
- even when you name that harness. Ask for a separate session when you want
52
- Delegate to launch another instance of the same CLI.
53
-
54
- Skill installation makes this workflow discoverable; it does not force a model
55
- to choose it over another plugin. Selection depends on the harness, model, and
56
- loaded instructions. The plugin and optional installer routing hooks supply a
57
- shared preference at session and subagent startup; they do not intercept tools
58
- or rewrite your persistent instructions.
59
- If an agent bypasses Delegate, that is a selection failure, not proof the
60
- integration worked. For a persistent preference, see
61
- [configure agent routing](docs/agent-routing.md).
62
-
63
- ## Install
64
-
65
- ### Recommended for Codex and Claude Code
66
-
67
- Install the plugin from this repository. It installs the provider-neutral skill
68
- and provides collaboration context hooks plus a trusted session-start bootstrap that reuses the checksum-verified
69
- Delegation Layer release installer when `delegate` is missing. The bootstrap
70
- installs the CLI and its bundled supervisor; it does not install provider CLIs,
71
- change provider authentication, or change provider configuration.
72
-
73
- For Codex:
74
-
75
- ```sh
76
- codex plugin marketplace add hishamkaram/delegation-layer
77
- codex plugin add delegation-layer@delegation-layer
78
- ```
79
-
80
- For Claude Code:
81
-
82
- ```sh
83
- claude plugin marketplace add hishamkaram/delegation-layer
84
- claude plugin install delegation-layer@delegation-layer
85
- ```
86
-
87
- Start a new harness session after installation. Plugin hooks require the
88
- harness trust review before they run. If the bootstrap reports that the
89
- install directory is not on `PATH`, add the reported directory to `PATH` and
90
- start a new session; the skill never falls back to a provider-native CLI.
91
-
92
- ### Install the Agent Skill only
93
-
94
- The standard Agent Skills installer works across popular coding agents. From
95
- the project where you want the skill available, run:
96
-
97
- ```sh
98
- npx --yes skills add hishamkaram/delegation-layer --skill agent-integration
99
- ```
100
-
101
- The `--skill agent-integration` selection matters because this repository also
102
- contains maintainer skills. The installer detects supported agents and lets you
103
- choose the project or global scope. Add `--global` to install for all projects,
104
- or `--agent codex` (and similar agent names) to choose a specific harness.
105
-
106
- If you want the Delegation Layer guided installer instead, run:
107
-
108
- ```sh
109
- npx --yes delegation-layer install
110
- ```
111
-
112
- It provides interactive scope, harness, and routing choices. Global installation
113
- and routing hooks for Claude/Codex are selected by default; choose skill-only
114
- to omit hooks. Codex requires native hook trust before activation. For scripts or a choice without prompts:
115
-
116
- ```sh
117
- npx --yes delegation-layer install \
118
- --scope project \
119
- --harness universal \
120
- --yes
121
- ```
122
-
123
- The commands above do not install the CLI, change provider
124
- logins, or run a task. Noninteractive installs remain skill-only unless you add
125
- `--routing default`. See [routing setup and removal](docs/agent-routing.md).
126
- Use the plugin path above when you want the skill and
127
- CLI bootstrap together.
128
-
129
- ### Install the CLI
130
-
131
- Use the prebuilt installer that fits your machine:
32
+ Inside Claude, after installing and trusting the integration, try:
132
33
 
133
- ```sh
134
- curl -fsSL https://raw.githubusercontent.com/hishamkaram/delegation-layer/main/install.sh | sh
135
- ```
34
+ > Ask Codex to review the current changes and return confirmed issues and recommendations.
136
35
 
137
- ```sh
138
- brew install hishamkaram/tap/delegation-layer
139
- ```
36
+ For reusable task selection, try:
140
37
 
141
- ```sh
142
- npx --yes delegation-layer install-cli
143
- pnpm dlx delegation-layer install-cli
144
- bunx --bun delegation-layer install-cli
145
- ```
38
+ > Register a project review Team with a primary Member using Codex defaults.
39
+ > Show its saved configuration, then ask that Member to review the changes,
40
+ > read-only, with a 30-minute budget.
146
41
 
147
- The release installer verifies checksums and installs `delegate`,
148
- `delegate-run`, `pueue`, and `pueued` into `$HOME/.local/bin` by default. The
149
- CLI uses the bundled supervisor automatically. Set
150
- `DELEGATION_LAYER_INSTALL_DIR` to use another directory.
42
+ [Teams](docs/teams.md) are optional; direct delegation needs no catalog setup.
151
43
 
152
- Check the installation:
44
+ The lead loads its installed skill, sends a bounded task through Delegate,
45
+ tracks it, then collects and evaluates the answer. Your provider keeps its
46
+ native account and configuration. Permissions select provider-native behavior;
47
+ see [security](https://github.com/hishamkaram/delegation-layer/blob/main/docs/security.md).
153
48
 
154
- ```sh
155
- delegate --help
156
- delegate providers --json
157
- ```
49
+ Ordinary subagents in the current harness remain available. Ask for a separate
50
+ session when you want another instance of that same CLI. Hooks supply a routing
51
+ preference; the harness and model still choose tools. See
52
+ [agent routing](https://github.com/hishamkaram/delegation-layer/blob/main/docs/agent-routing.md)
53
+ for activation and limits.
158
54
 
159
- ## What you need to run a task
55
+ For a manual CLI task, use the packaged
56
+ [read-only example](skills/agent-integration/examples/read-only-task.md).
160
57
 
161
- Normal users do not need Go or Node after choosing an installation method.
162
- Dispatching a task requires:
58
+ ## Help and contributing
163
59
 
164
- - a released Delegation Layer CLI;
165
- - a compatible provider CLI with an available native login;
166
- - a supported provider CLI such as `agy`, `codex`, `claude`, `pi`, or `opencode`;
167
- - Darwin or Linux on amd64 or arm64 for the supplied release builds.
168
-
169
- The release contains the supervisor client and daemon and starts a private
170
- instance under the state root, recovering it when a control command finds it
171
- stopped. A reachable compatible daemon is adopted across CLI upgrades without
172
- stopping it or rewriting its launch record. An explicit supervisor repair
173
- command is available for a real logical/configuration migration; it preserves
174
- active work and the legacy journal. An explicit `--pueue-config` or
175
- `DELEGATE_PUEUE_CONFIG` can still select an existing compatible supervisor for
176
- advanced integrations. Node.js 18 or newer is needed only for the npm-based
177
- installers; it is not a runtime requirement for the released Go CLI. Provider
178
- authentication remains native to each provider. Your provider settings, MCP
179
- servers, plugins, and skills stay with that provider. Permission modes select
180
- native behavior; Delegation Layer is not an independent sandbox. Authorized
181
- `workspace-write` tasks run unattended using native approval behavior, including
182
- Pi file edits and shell commands. Native access can extend beyond the workspace.
183
-
184
- ## Try one bounded task
185
-
186
- Create a brief and a workspace outside the private state root:
187
-
188
- ```sh
189
- mkdir -p "$HOME/delegation-workspace"
190
- printf '%s\n' 'Inspect the repository and summarize the current build status.' > brief.txt
191
-
192
- delegate --root "$HOME/delegation-state" dispatch \
193
- --auto \
194
- --brief "$PWD/brief.txt" \
195
- --cwd "$HOME/delegation-workspace" \
196
- --permission read-only \
197
- --budget 30m \
198
- --json
199
- ```
200
-
201
- The response contains a task ID and separate admission, liveness, and
202
- publication fields. Observe and collect it with:
203
-
204
- ```sh
205
- delegate --root "$HOME/delegation-state" status TASK_ID --json
206
- delegate --root "$HOME/delegation-state" collect TASK_ID --watch 5s --json
207
- ```
208
-
209
- Use `delegate providers --json` for the compiled provider catalog and
210
- `delegate capabilities --provider PROFILE --json` for a provider-neutral
211
- capability response. `delegate preflight --provider PROFILE --cwd ABS --json`
212
- checks static admission without creating a task. Managed runtime-only tasks
213
- perform the fresh runtime probe inside their supervised worker before provider
214
- execution; inspection-backed paths retain admission checks. See
215
- [architecture](docs/architecture.md#ownership-boundaries). Catalog discovery
216
- alone does not prove authentication or supervisor readiness.
217
-
218
- When an explicit model or effort choice is needed, query the implemented native
219
- discovery command:
220
-
221
- ```sh
222
- delegate models --provider codex:exec --cwd "$HOME/delegation-workspace" --json
223
- ```
224
-
225
- `--cwd` defaults to the current directory. Model discovery uses the
226
- state-rooted supervisor and a bounded `model-discovery-v1` five-minute
227
- inspection to allow a provider's first-run model/cache initialization. It
228
- creates inspection evidence without admitting a provider task, and may contact
229
- the provider CLI.
230
- It is advisory: a discovered model is not an admission guarantee or an
231
- allowlist. `complete` describes model enumeration. A null effort list means
232
- unknown metadata; an empty list means the provider explicitly reported no
233
- choices. Per-model effort metadata is independent of the harness-wide list.
234
- Discovery exits `0` for `available` or `partial`, `2` for `blocked` or
235
- `unavailable`, and `1` for `failed`.
236
-
237
- For Codex's native read-only review command, select `codex:review` and make
238
- the Git state explicit. Run this from an existing Git checkout outside the
239
- Delegate state root, with the changes you want reviewed:
240
-
241
- ```sh
242
- (
243
- REVIEW_WORKSPACE="$(git rev-parse --show-toplevel)" || exit 1
244
- REVIEW_BRIEF="$(mktemp)" || exit 1
245
- REVIEW_RESPONSE="$(mktemp)" || exit 1
246
- printf '%s\n' 'Review the uncommitted changes in this Git checkout.' >"$REVIEW_BRIEF"
247
- if delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" dispatch \
248
- --provider codex:review \
249
- --review-target uncommitted \
250
- --brief "$REVIEW_BRIEF" \
251
- --cwd "$REVIEW_WORKSPACE" \
252
- --permission read-only \
253
- --budget 1h \
254
- --json >"$REVIEW_RESPONSE"; then
255
- review_exit=0
256
- else
257
- review_exit=$?
258
- fi
259
- cat "$REVIEW_RESPONSE"
260
- printf '\nDispatch exit: %s; saved response: %s\n' "$review_exit" "$REVIEW_RESPONSE"
261
- )
262
- ```
263
-
264
- When that response says `task_record: "created"`, observe its exact `task_id`
265
- with the `status` and `collect` commands above, using the same state root.
266
- Otherwise follow the returned failure; do not dispatch again to recover output.
267
-
268
- Use `base:BRANCH` or `commit:SHA` for a different review target. Review tasks
269
- are persisted as read-only tasks and do not support continuation or active-turn
270
- interaction. The brief is retained in the task evidence; Codex's explicit
271
- review target supplies the native review scope because the Codex CLI does not
272
- accept a prompt together with these target flags.
273
-
274
- If a task reports `status: "timed_out"` and
275
- `continuation.resumable: true`, continue the exact session:
276
-
277
- ```sh
278
- delegate --root "$HOME/delegation-state" continue \
279
- --task TASK_ID --brief "$HOME/follow-up.txt" --budget 30m --json
280
- ```
281
-
282
- The successor receives a new task ID and is observed with the same `status` and
283
- `collect` commands.
284
-
285
- ### Optional managed Git workspaces
286
-
287
- Ordinary delegation is unchanged. For independent parallel writes, use a
288
- managed worktree unless the user explicitly chooses shared coordination:
289
-
290
- ```sh
291
- delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" dispatch --auto \
292
- --brief /absolute/brief.txt --cwd /absolute/git/source \
293
- --permission workspace-write --isolation git-worktree \
294
- --base HEAD --workspace-budget 5m --budget 30m --json
295
- ```
296
-
297
- The committed base is authoritative; dirty and untracked source changes are
298
- excluded. The worktree remains retained until the Lead reviews the captured
299
- Git-content evidence and explicitly releases it. Use the [managed workspace
300
- reference](skills/agent-integration/references/workspaces.md) for attachment,
301
- continuation, verification, review scope, release, and forgetting. This
302
- feature does not automatically apply, commit, branch, or merge worker changes.
303
-
304
- To fork a worker from current uncommitted work, first record a Git checkpoint
305
- with `delegate checkpoint create --cwd ABS` (or `--workspace ID`). It stores a
306
- synthetic commit under a Delegate-owned ref without moving `HEAD` or touching
307
- the real index. After `checkpoint status` reports it `checkpointed` and
308
- `usable`, pass its commit to `dispatch --isolation git-worktree --base`.
309
- Checkpoints stay until `checkpoint remove`; see the [checkpoint
310
- guidance](skills/agent-integration/references/workspaces.md#git-checkpoints).
311
-
312
- ## Documentation
313
-
314
- - [Getting started](docs/getting-started.md) — install and run a first task.
315
- - [CLI reference](docs/cli-reference.md) — commands, flags, responses, and
316
- exit codes.
317
- - [Integration API](docs/api.md) — JSON responses and idempotent client
318
- behavior.
319
- - [Provider guide](docs/providers.md) — profiles and runtime compatibility.
320
- - [Architecture](docs/architecture.md) — lifecycle and ownership boundaries.
321
- - [System components](diagrams/components.html) — interactive Archify view; [SVG](diagrams/components.light.svg) · [PNG](diagrams/components.light.png).
322
- - [Task lifecycle](diagrams/lead-interface.html) — interactive lifecycle view; [SVG](diagrams/lead-interface.light.svg) · [PNG](diagrams/lead-interface.light.png).
323
- - [Security](docs/security.md) — isolation, policy, and result integrity.
324
- - [Troubleshooting](docs/troubleshooting.md) — common setup and runtime
325
- failures.
326
- - [Agent integration skill](skills/agent-integration/SKILL.md) — the
327
- provider-neutral instructions installed into an agent harness.
328
- - [Managed workspaces](skills/agent-integration/references/workspaces.md) —
329
- optional Git checkout, capture, and retention policy.
330
- - [Contributing](docs/contributing.md) — development and review guidance.
60
+ See [troubleshooting](https://github.com/hishamkaram/delegation-layer/blob/main/docs/troubleshooting.md),
61
+ [open an issue](https://github.com/hishamkaram/delegation-layer/issues), or read
62
+ [contributing](https://github.com/hishamkaram/delegation-layer/blob/main/docs/contributing.md).
331
63
 
332
64
  ## License
333
65
 
334
- This project is licensed under the [MIT License](LICENSE).
335
-
336
- ### Consult models through Claude Code Router
337
-
338
- Delegate also supports CCR-configured third-party and local models through
339
- `ccr:print`. Ask your agent to “have CCR review this” and it can discover and
340
- choose a configured model alias. CCR and Claude Code must already be installed
341
- and the provider configured. See [provider guidance](docs/providers.md#claude-code-router).
66
+ [MIT](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.39",
3
+ "version": "0.2.0",
4
4
  "description": "Multi-provider AI agent delegation CLI and Agent Skill for running bounded coding tasks across provider CLIs.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
3
  "displayName": "Delegation Layer",
4
- "version": "0.1.39",
4
+ "version": "0.2.0",
5
5
  "description": "Consult external AI harnesses and CCR-configured models for reviews, research, implementation, and debate through the resumable Delegate CLI.",
6
6
  "author": {
7
7
  "name": "Hesham Karam",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.39",
3
+ "version": "0.2.0",
4
4
  "description": "Consult external AI harnesses and CCR-configured models for reviews, research, implementation, and debate through the resumable Delegate CLI.",
5
5
  "author": {
6
6
  "name": "Hesham Karam",