delegation-layer 0.1.18 → 0.1.20

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.
@@ -0,0 +1,77 @@
1
+ # Parallel reviews and debates
2
+
3
+ ## Keep each request identifiable
4
+
5
+ Choose the fan-out needed for the user's task. Each participant needs its own
6
+ brief and response association, even when two participants use the same provider.
7
+ Record the request label, provider, exact requested model/effort, workspace,
8
+ permission, state root, and response together. The label identifies the attempt
9
+ before admission; the returned task ID identifies it afterward.
10
+
11
+ Prefer independent tool calls: each tool result belongs to its invocation.
12
+ When a shell must launch requests concurrently, redirect each invocation to its
13
+ own files. Never use `dispatch ... & dispatch ... & wait` with shared stdout.
14
+
15
+ After preparing two independent briefs, a portable capture pattern is:
16
+
17
+ ```sh
18
+ RECEIPTS="$(mktemp -d)" || exit 1
19
+ # Set these absolute paths and catalog IDs in this same tool invocation.
20
+ # BRIEF_A and BRIEF_B contain the real independent assignments.
21
+ (
22
+ delegate --root "$STATE_ROOT" dispatch --provider "$PROVIDER_A" \
23
+ --brief "$BRIEF_A" --cwd "$WORKSPACE_A" \
24
+ --permission read-only --budget 30m --json \
25
+ >"$RECEIPTS/review-a.json" 2>"$RECEIPTS/review-a.stderr"
26
+ printf '%s\n' "$?" >"$RECEIPTS/review-a.exit"
27
+ ) &
28
+ (
29
+ delegate --root "$STATE_ROOT" dispatch --provider "$PROVIDER_B" \
30
+ --brief "$BRIEF_B" --cwd "$WORKSPACE_B" \
31
+ --permission read-only --budget 30m --json \
32
+ >"$RECEIPTS/review-b.json" 2>"$RECEIPTS/review-b.stderr"
33
+ printf '%s\n' "$?" >"$RECEIPTS/review-b.exit"
34
+ ) &
35
+ wait
36
+ printf 'Read each response separately in %s\n' "$RECEIPTS"
37
+ ```
38
+
39
+ Keep the request-to-label mapping alongside those files. Include any exact
40
+ requested model/effort in its invocation. Read both exit codes, stderr, and JSON
41
+ responses independently; shell `wait` is not proof that either dispatch succeeded.
42
+ Poll only tasks with `task_record: created`. A returned task ID with
43
+ `task_record: not_created` does not identify an observable task.
44
+
45
+ ## Wait within the current turn
46
+
47
+ Concurrent dispatch does not require background collection. Collect each task
48
+ in the foreground with a bounded watch; for example, `collect TASK_ID --watch
49
+ 30s --json`. Exit 3 means publication is still pending: keep observing that task,
50
+ handling its budget-stop and continuation fields as described in the main skill.
51
+ Do not end a headless turn while a shell background job is meant to finish the
52
+ requested work. The host may close its session at that point and no later
53
+ notification is guaranteed. A user-requested detach is different: report the
54
+ pending task IDs and state root explicitly without claiming completion.
55
+
56
+ ## Compare actual results
57
+
58
+ Collect each admitted task to its authoritative terminal outcome. Present each
59
+ participant's findings with its task ID and evidence. Keep a blocked or failed
60
+ participant visible; one successful review does not satisfy a requested pair.
61
+ Do not attribute your own analysis to an unavailable participant.
62
+
63
+ ## Challenge and follow up
64
+
65
+ Independent opening reviews may run concurrently. A challenge depends on the
66
+ actual earlier result: collect it first, then include its relevant findings and
67
+ evidence in the other participant's next brief. Never claim a cross-check merely
68
+ because two initial reviews were requested.
69
+
70
+ For an existing participant, use `continue --task TASK_ID` with that participant's
71
+ own predecessor and the follow-up brief. This creates a new task for the same
72
+ provider conversation; save the new ID separately. Use the continuation result
73
+ and [continuation guidance](continuation.md), including advertised resumability
74
+ after a budget stop. Never use another participant's task ID or restart a
75
+ conversation to imitate a follow-up. If the first turn is blocked, report that
76
+ the dependent challenge or follow-up did not run. Other independent assignments
77
+ may still proceed.
@@ -29,10 +29,10 @@ Dispatch flags:
29
29
  - `--budget DURATION`: finite turn budget;
30
30
  - `--auto`: let the CLI select a ready provider;
31
31
  - `--provider ID`: preserve the caller’s named harness or provider, resolved through the catalog;
32
- - `--model MODEL` and `--effort VALUE`: optional provider-advertised choices;
32
+ - `--model MODEL` and `--effort VALUE`: provider-advertised choices (CCR requires a model alias);
33
33
  Codex maps effort to TOML `model_reasoning_effort`, while Claude and AGY
34
34
  pass native effort flags; Pi maps effort to `--thinking`; OpenCode maps it to
35
- `--variant`; `default` is omitted;
35
+ `--variant`; CCR forwards effort to Claude and uses `--model` as a CCR alias; `default` is omitted;
36
36
  - `--native-timeout DURATION`: optional provider-native timeout where advertised.
37
37
 
38
38
  Model discovery uses the same `--provider ID` profiles and accepts an optional
@@ -51,8 +51,9 @@ Continuation flags:
51
51
 
52
52
  ## Choosing models and effort
53
53
 
54
- If the caller needs an explicit model or effort, use the implemented native
55
- discovery command for that provider:
54
+ Pass an explicitly supplied model ID and effort unchanged, even if discovery
55
+ is incomplete or does not list them. To resolve a natural-language model name
56
+ or choose an option the caller left open, use native discovery:
56
57
 
57
58
  ```sh
58
59
  delegate models --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE --json
@@ -68,6 +69,10 @@ requested value merely because discovery did not list it, and do not infer
68
69
  per-model effort support from the harness-wide list. If a selected model has
69
70
  `efforts: null` or `efforts: []`, omit `--effort` unless the caller explicitly
70
71
  requested it; do not invent model aliases or combine options by guessing.
72
+ If a natural-language name cannot be resolved to a single exact ID, ask one
73
+ focused question for that ID. Do not silently select a default or transform
74
+ spaces into hyphens to manufacture an ID. This ambiguity rule is guidance for
75
+ selecting a value, not a new admission restriction.
71
76
 
72
77
  The response includes `schema_version`, `command: "models"`, `provider`,
73
78
  `observed_at`, `status`, `reason_code`, `complete`, `source`, nullable
@@ -78,3 +83,21 @@ enumeration, not effort metadata. `null` means effort metadata is unknown;
78
83
  for `available` or `partial`, `2` for `blocked` or `unavailable`, and `1` for
79
84
  `failed`. Preserve a blocked or unavailable discovery result as unresolved;
80
85
  defaults remain allowed.
86
+
87
+ ## Checking readiness
88
+
89
+ Use `preflight` when the caller asks about static readiness, rather than as a
90
+ required step before every dispatch:
91
+
92
+ ```sh
93
+ delegate preflight --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE \
94
+ --permission REQUESTED_MODE --json
95
+ ```
96
+
97
+ Use `read-only` for investigation or `workspace-write` for authorized edits.
98
+ Supply any required provider options, including `--model ALIAS` for `ccr:print`.
99
+ Preflight does not create a task, start the supervisor, or launch a provider.
100
+ Its result is not proof of live authentication or successful execution. Report
101
+ `blocked` or `unsupported` results; a readiness request does not authorize
102
+ provider configuration changes. Honor `failure.next_action` without probing
103
+ provider CLIs yourself.
@@ -0,0 +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, set STATE_ROOT=\"${DELEGATE_ROOT:-$HOME/delegation-state}\" and pass --root \"$STATE_ROOT\" in the same shell invocation; reuse that root for dispatch, observation, and continuation, never an invented /tmp root. Keep each concurrent request and its response associated separately. 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. A stop_and_report failure ends that attempt: report it without retrying, diagnosing setup, or offering a fallback. Continue other independent requests. Keep collection in the foreground until completion or a reported blocker unless the user requested detachment. Merely discussing or configuring a tool is not delegation."
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+ # Context delivery only: no installation, discovery, or provider execution.
3
+ set -eu
4
+ case "${1:-}" in
5
+ SessionStart|SubagentStart) event=$1 ;;
6
+ *) printf '%s\n' 'Expected SessionStart or SubagentStart.' >&2; exit 2 ;;
7
+ esac
8
+ script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
9
+ rule_file="$script_dir/../references/routing-rule.json"
10
+ # Read before emitting anything so a missing asset cannot produce partial JSON.
11
+ rule=$(cat "$rule_file")
12
+ printf '{"hookSpecificOutput":{"hookEventName":"%s","additionalContext":%s}}\n' "$event" "$rule"