aptly 0.1.4 → 0.1.6
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.en.md +12 -5
- package/README.ja.md +12 -5
- package/README.md +12 -5
- package/README.zh-CN.md +12 -5
- package/dist/src/automatic-hook.d.ts +51 -2
- package/dist/src/automatic-hook.js +80 -6
- package/dist/src/context-retry.d.ts +29 -0
- package/dist/src/context-retry.js +236 -0
- package/dist/src/context-sufficiency.d.ts +1 -0
- package/dist/src/context-sufficiency.js +24 -0
- package/dist/src/routing-observations.d.ts +80 -1
- package/dist/src/routing-observations.js +43 -1
- package/dist/src/server.js +36 -5
- package/dist/src/setup.js +26 -17
- package/dist/src/spawn-context.js +2 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/windows-private.d.ts +2 -1
- package/dist/src/windows-private.js +37 -20
- package/docs/SPAWN_CONTEXT.md +305 -6
- package/docs/guide/en.md +28 -0
- package/docs/guide/ja.md +28 -0
- package/docs/guide/ko.md +28 -0
- package/docs/guide/zh-CN.md +28 -0
- package/package.json +1 -1
|
@@ -8,15 +8,15 @@ $ErrorActionPreference = 'Stop'
|
|
|
8
8
|
try {
|
|
9
9
|
$request = [Console]::In.ReadToEnd() | ConvertFrom-Json
|
|
10
10
|
$path = [string]$request.path
|
|
11
|
-
if ([string]::IsNullOrWhiteSpace($path) -or ![IO.Path]::IsPathRooted($path)) { throw '
|
|
11
|
+
if ([string]::IsNullOrWhiteSpace($path) -or ![IO.Path]::IsPathRooted($path)) { throw 'aptly_acl_rejected' }
|
|
12
12
|
$attributes = [IO.File]::GetAttributes($path)
|
|
13
|
-
if (($attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw '
|
|
13
|
+
if (($attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'aptly_acl_rejected' }
|
|
14
14
|
$isDirectory = ($attributes -band [IO.FileAttributes]::Directory) -ne 0
|
|
15
15
|
$sidType = [Security.Principal.SecurityIdentifier]
|
|
16
16
|
$current = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
17
17
|
$allowed = @($current.Value, 'S-1-5-18', 'S-1-5-32-544')
|
|
18
18
|
if ($request.action -eq 'protect-new-directory') {
|
|
19
|
-
if (!$isDirectory) { throw '
|
|
19
|
+
if (!$isDirectory) { throw 'aptly_acl_rejected' }
|
|
20
20
|
$acl = [Security.AccessControl.DirectorySecurity]::new()
|
|
21
21
|
$acl.SetOwner($current)
|
|
22
22
|
$acl.SetAccessRuleProtection($true, $false)
|
|
@@ -26,19 +26,19 @@ try {
|
|
|
26
26
|
$acl.AddAccessRule($rule)
|
|
27
27
|
}
|
|
28
28
|
[IO.Directory]::SetAccessControl($path, $acl)
|
|
29
|
-
} elseif ($request.action -ne 'assert-private') { throw '
|
|
29
|
+
} elseif ($request.action -ne 'assert-private') { throw 'aptly_acl_rejected' }
|
|
30
30
|
$acl = if ($isDirectory) { [IO.Directory]::GetAccessControl($path) } else { [IO.File]::GetAccessControl($path) }
|
|
31
|
-
if ($allowed -notcontains $acl.GetOwner($sidType).Value) { throw '
|
|
31
|
+
if ($allowed -notcontains $acl.GetOwner($sidType).Value) { throw 'aptly_acl_rejected' }
|
|
32
32
|
$descriptor = [Security.AccessControl.RawSecurityDescriptor]::new($acl.GetSecurityDescriptorBinaryForm(), 0)
|
|
33
|
-
if ($null -eq $descriptor.DiscretionaryAcl) { throw '
|
|
33
|
+
if ($null -eq $descriptor.DiscretionaryAcl) { throw 'aptly_acl_rejected' }
|
|
34
34
|
foreach ($rule in $acl.GetAccessRules($true, $true, $sidType)) {
|
|
35
|
-
if ($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow -and $allowed -notcontains $rule.IdentityReference.Value) { throw '
|
|
35
|
+
if ($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow -and $allowed -notcontains $rule.IdentityReference.Value) { throw 'aptly_acl_rejected' }
|
|
36
36
|
}
|
|
37
37
|
[Console]::Out.Write('private')
|
|
38
|
-
} catch { [Console]::Out.Write('rejected'); exit 1 }
|
|
38
|
+
} catch { if ($_.Exception.Message -eq 'aptly_acl_rejected') { [Console]::Out.Write('rejected') } else { [Console]::Out.Write('error') }; exit 1 }
|
|
39
39
|
`;
|
|
40
|
-
const run = (executable, args, input) => execFileSync(executable, [...args], {
|
|
41
|
-
input, encoding: 'utf8', windowsHide: true, timeout:
|
|
40
|
+
const run = (executable, args, input, timeoutMs) => execFileSync(executable, [...args], {
|
|
41
|
+
input, encoding: 'utf8', windowsHide: true, timeout: timeoutMs, maxBuffer: 4096, stdio: ['pipe', 'pipe', 'pipe']
|
|
42
42
|
});
|
|
43
43
|
const copyScript = String.raw `
|
|
44
44
|
$ErrorActionPreference = 'Stop'
|
|
@@ -47,13 +47,13 @@ try {
|
|
|
47
47
|
$request = [Console]::In.ReadToEnd() | ConvertFrom-Json
|
|
48
48
|
$source = [string]$request.source
|
|
49
49
|
$target = [string]$request.target
|
|
50
|
-
if (![IO.Path]::IsPathRooted($source) -or ![IO.Path]::IsPathRooted($target)) { throw '
|
|
50
|
+
if (![IO.Path]::IsPathRooted($source) -or ![IO.Path]::IsPathRooted($target)) { throw 'aptly_acl_rejected' }
|
|
51
51
|
$source = [IO.Path]::GetFullPath($source)
|
|
52
52
|
$target = [IO.Path]::GetFullPath($target)
|
|
53
|
-
if ([string]::Equals($source, $target, [StringComparison]::OrdinalIgnoreCase) -or ![string]::Equals([IO.Path]::GetDirectoryName($source), [IO.Path]::GetDirectoryName($target), [StringComparison]::OrdinalIgnoreCase)) { throw '
|
|
53
|
+
if ([string]::Equals($source, $target, [StringComparison]::OrdinalIgnoreCase) -or ![string]::Equals([IO.Path]::GetDirectoryName($source), [IO.Path]::GetDirectoryName($target), [StringComparison]::OrdinalIgnoreCase)) { throw 'aptly_acl_rejected' }
|
|
54
54
|
foreach ($path in @($source, $target)) {
|
|
55
55
|
$attributes = [IO.File]::GetAttributes($path)
|
|
56
|
-
if (($attributes -band [IO.FileAttributes]::Directory) -ne 0 -or ($attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw '
|
|
56
|
+
if (($attributes -band [IO.FileAttributes]::Directory) -ne 0 -or ($attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'aptly_acl_rejected' }
|
|
57
57
|
}
|
|
58
58
|
$sections = [Security.AccessControl.AccessControlSections]::Access
|
|
59
59
|
$sourceAcl = [IO.File]::GetAccessControl($source, $sections)
|
|
@@ -66,20 +66,37 @@ try {
|
|
|
66
66
|
$acl.SetSecurityDescriptorSddlForm($expected, $sections)
|
|
67
67
|
[IO.File]::SetAccessControl($target, $acl)
|
|
68
68
|
$actual = [IO.File]::GetAccessControl($target, $sections).GetSecurityDescriptorSddlForm($sections)
|
|
69
|
-
if ($expected -cne $actual) { throw '
|
|
69
|
+
if ($expected -cne $actual) { throw 'aptly_acl_rejected' }
|
|
70
70
|
[Console]::Out.Write('private')
|
|
71
|
-
} catch { [Console]::Out.Write('rejected'); exit 1 }
|
|
71
|
+
} catch { if ($_.Exception.Message -eq 'aptly_acl_rejected') { [Console]::Out.Write('rejected') } else { [Console]::Out.Write('error') }; exit 1 }
|
|
72
72
|
`;
|
|
73
73
|
function runScript(scriptText, input, options) {
|
|
74
|
+
const started = Date.now();
|
|
75
|
+
const timeoutMs = options.timeoutMs === undefined ? 10000 : options.timeoutMs;
|
|
76
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 30000)
|
|
77
|
+
throw new Error('windows_private_permissions');
|
|
78
|
+
let category = 'process';
|
|
74
79
|
try {
|
|
75
80
|
const executable = windowsPowerShellPath();
|
|
76
|
-
const result = (options.execute ?? run)(executable, ['-NoLogo', '-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(scriptText, 'utf16le').toString('base64')], JSON.stringify(input));
|
|
77
|
-
if (result
|
|
78
|
-
|
|
81
|
+
const result = (options.execute ?? run)(executable, ['-NoLogo', '-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(scriptText, 'utf16le').toString('base64')], JSON.stringify(input), timeoutMs);
|
|
82
|
+
if (result === 'private')
|
|
83
|
+
return;
|
|
84
|
+
category = result === 'rejected' ? 'rejected' : result === 'error' ? 'process' : 'unexpected_output';
|
|
79
85
|
}
|
|
80
|
-
catch {
|
|
81
|
-
|
|
86
|
+
catch (error) {
|
|
87
|
+
// Inspect only bounded process metadata; never propagate stderr or input.
|
|
88
|
+
const failure = error;
|
|
89
|
+
if (failure?.code === 'ETIMEDOUT')
|
|
90
|
+
category = 'timeout';
|
|
91
|
+
else if (failure?.stdout === 'rejected')
|
|
92
|
+
category = 'rejected';
|
|
93
|
+
else if (typeof failure?.code === 'string' && ['ENOENT', 'EACCES', 'EPERM', 'ENOEXEC', 'ENOTDIR'].includes(failure.code) && failure?.status == null)
|
|
94
|
+
category = 'launch';
|
|
82
95
|
}
|
|
96
|
+
const failure = new Error('windows_private_permissions');
|
|
97
|
+
failure.category = category;
|
|
98
|
+
failure.elapsed_ms = Math.max(0, Date.now() - started);
|
|
99
|
+
throw failure;
|
|
83
100
|
}
|
|
84
101
|
function invoke(path, action, options) {
|
|
85
102
|
if (typeof path !== 'string' || !path || path.includes('\0'))
|
package/docs/SPAWN_CONTEXT.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Spawn context handoff and recovery
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The original exact-event handoff is available from Aptly 0.1.4, following the
|
|
4
|
+
pre-spawn routing changes in #60. Context recovery and visible routing outcomes
|
|
5
|
+
are available from Aptly 0.1.5. Intentional fresh-delegation preparation is
|
|
6
|
+
available from Aptly 0.1.6.
|
|
4
7
|
It does not decode opaque messages, inspect conversations or modify host
|
|
5
8
|
internals. It provides an explicit caller protocol, not an automatic description
|
|
6
9
|
producer for the shipped Hook templates.
|
|
@@ -72,12 +75,12 @@ after the asynchronous provider call. Expiry/cancellation prevents output but
|
|
|
72
75
|
cannot refund or erase a provider request already sent. Revocation does not
|
|
73
76
|
cancel native execution; the host controls execution.
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
The original prepare_spawn_context handoff is immutable. Register before the
|
|
76
79
|
first evaluation. If a label-only or description-bound evaluation already
|
|
77
80
|
started, adding/changing the description fails closed (`call_conflict`);
|
|
78
81
|
unknown paid outcomes remain unknown. Do not change IDs to bypass this guard.
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
The 0.1.5 recovery protocol below provides a separate, bounded supplement;
|
|
83
|
+
it never rebinds this original association.
|
|
81
84
|
|
|
82
85
|
## Outcomes and evidence
|
|
83
86
|
|
|
@@ -123,4 +126,300 @@ This validates a caller that can capture the exact event before product
|
|
|
123
126
|
preflight. The adapter does not ship an automatic description producer, and
|
|
124
127
|
ordinary parent agents still cannot invent the required IDs. PR #60's separate
|
|
125
128
|
history/model application acceptance and merge order must be resolved before
|
|
126
|
-
merging this dependent change.
|
|
129
|
+
merging this dependent change. That historical test did not exercise the later recovery protocol below.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
## One context supplement after a Hook response
|
|
133
|
+
|
|
134
|
+
Available from Aptly 0.1.5.
|
|
135
|
+
|
|
136
|
+
When the enabled automatic Hook encounters local `insufficient_context` or a
|
|
137
|
+
completed provider `provider_needs_context`, it issues a `retry_id`. In
|
|
138
|
+
`defaults` mode it denies that pending spawn and includes model-visible recovery
|
|
139
|
+
instructions. In `advisory` mode it supplies those instructions without blocking.
|
|
140
|
+
This uses the documented [Codex PreToolUse deny feedback](https://learn.chatgpt.com/docs/hooks).
|
|
141
|
+
A missing, untrusted or failed Hook is outside this guarantee.
|
|
142
|
+
|
|
143
|
+
The parent agent can use its existing task knowledge to call:
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"retry_id": "<copy the 64-character retry_id from the Hook response>",
|
|
148
|
+
"description": "Review a small synthetic refresh change for conflict markers and incorrect imports. Return findings only; do not edit files."
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Send this input to `retry_spawn_recommendation` on the same MCP process within
|
|
153
|
+
five minutes. No future native call ID is required. Describe purpose, scope,
|
|
154
|
+
expected output and complexity; ask the user only for information genuinely
|
|
155
|
+
missing from the task. The description uses the same size and known-secret
|
|
156
|
+
checks as the original handoff. Only the labelled description and normal
|
|
157
|
+
classification contract are sent, never the opaque body or original event.
|
|
158
|
+
|
|
159
|
+
One valid supplement is allowed per original immutable call binding. Its
|
|
160
|
+
classification request ID is fixed, and a description digest is persisted before
|
|
161
|
+
provider preflight; text is not persisted by Aptly. Duplicate input reuses the
|
|
162
|
+
ledger/cache. Changed input conflicts, including after process recreation.
|
|
163
|
+
Timeout/network/unknown outcomes never issue replacement identities. A second
|
|
164
|
+
`needs_context`, a budget failure or an unavailable result ends this recovery:
|
|
165
|
+
`context_retry_allowed` is false and no further recovery ticket is created. Each process
|
|
166
|
+
holds at most 128 tickets without eviction; duplicates do not extend expiry.
|
|
167
|
+
Restart loses ticket lookup, although persistent bindings and the ledger still
|
|
168
|
+
prevent a recreated original Hook event from creating another paid retry.
|
|
169
|
+
|
|
170
|
+
The retry tool returns advice, not a rewritten original Hook response or a native
|
|
171
|
+
spawn. For a recommendation, inspect `spawn_application`: `caller_review_required`
|
|
172
|
+
requires the parent to review and explicitly supply only unspecified model/effort
|
|
173
|
+
fields to a new compatible native call. Caller review means argument review,
|
|
174
|
+
not a request for new user approval. Existing delegation authorization and host
|
|
175
|
+
permission checks still apply; this advisory result grants neither.
|
|
176
|
+
The response supplies concrete fields in
|
|
177
|
+
`next_call.set_if_unspecified`, excluding original explicit choices. Claude
|
|
178
|
+
receives model only, never an effort field. Blocked results omit `next_call`. `blocked` requires reporting the original
|
|
179
|
+
history/application constraint. Never change `all` or omitted fork to `none`,
|
|
180
|
+
discard history, alter explicit choices or bypass permissions to apply advice.
|
|
181
|
+
If no recommendation is available, stop and report the result.
|
|
182
|
+
|
|
183
|
+
Cancellation during the retry, expiry, and changed/disabled policy or catalog
|
|
184
|
+
suppress its result. A sent request may still consume budget and complete in the
|
|
185
|
+
ledger. The original event observation remains `awaiting_context` with execution
|
|
186
|
+
`not_observed`; a retry recommendation does not prove child execution.
|
|
187
|
+
|
|
188
|
+
This is a caller-driven recovery protocol. Hook feedback does not itself run the
|
|
189
|
+
parent's next MCP call or spawn a child. It does not guarantee that every host or
|
|
190
|
+
parent model follows the instructions, and inherited application remains blocked.
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### Bounded native recovery verification — 2026-11-07
|
|
194
|
+
|
|
195
|
+
A local Codex CLI 0.167.0 trial exercised the pre-release recovery implementation with
|
|
196
|
+
its existing trusted Hook and ephemeral MCP command/environment overrides.
|
|
197
|
+
The parent was instructed to attempt one fresh child (`fork_turns: "none"`)
|
|
198
|
+
with no model/effort, a short synthetic task name and a message that the Hook
|
|
199
|
+
received as opaque. The Hook denied the call and returned recovery instructions.
|
|
200
|
+
The parent then called `retry_spawn_recommendation` through normal MCP tool
|
|
201
|
+
orchestration, supplying a bounded description of sorting `[3, 1, 2]` without
|
|
202
|
+
files, tools, network activity or changes.
|
|
203
|
+
|
|
204
|
+
The accepted retry ID matched the Hook feedback. Exactly one real Decisions
|
|
205
|
+
request contained the labelled description, without the opaque body or native
|
|
206
|
+
event metadata. It recommended `codex-simple` (`gpt-6-luna` / `max`). The parent
|
|
207
|
+
explicitly supplied that profile on its second native attempt, with the original
|
|
208
|
+
fresh-child semantics. The actual linked child recorded Luna/max and returned
|
|
209
|
+
`[1, 2, 3]`. Only one child was created. Neither Hook responses nor product
|
|
210
|
+
behavior were modified by the transparent observation adapter; persistent host
|
|
211
|
+
configuration and trust settings were unchanged, and temporary files were removed.
|
|
212
|
+
|
|
213
|
+
Three earlier attempts were retained as failures: each stopped before a paid
|
|
214
|
+
classification or child execution. Inspection of the nested MCP call established
|
|
215
|
+
that the recovery tool's initial write annotation required approval and was
|
|
216
|
+
rejected under `approvalPolicy: "never"`. The successful trial used the same
|
|
217
|
+
read-only advisory annotations as `recommend_agent`; local cache/budget metadata
|
|
218
|
+
is still recorded, and this is not a claim of stateless execution.
|
|
219
|
+
|
|
220
|
+
This is a prompt-guided caller recovery check, not proof that every parent model
|
|
221
|
+
will retry automatically. It does not validate inherited model application,
|
|
222
|
+
Claude Code native recovery, model quality or cost savings. Claude recovery,
|
|
223
|
+
provider abstention, duplicate/unknown outcomes and revocation are covered by
|
|
224
|
+
separate offline tests; they are not native execution evidence.
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
## Visible routing outcomes and correlated recovery
|
|
228
|
+
|
|
229
|
+
Available from Aptly 0.1.5.
|
|
230
|
+
|
|
231
|
+
After establishing a valid enabled policy, a supported unpinned/default-selection
|
|
232
|
+
call and eligible profiles, `defaults` denies application incompatibilities and
|
|
233
|
+
classification failures instead of silently continuing with the original model.
|
|
234
|
+
The safe reason is model-visible. Budget exhaustion, unknown results and provider
|
|
235
|
+
errors do not authorize retrying with another identity. Cancellation of the host
|
|
236
|
+
request suppresses output; an operator-disabled policy stays disabled.
|
|
237
|
+
|
|
238
|
+
In particular, omitted or inherited Codex history still cannot apply a recommended
|
|
239
|
+
profile under the current verified contract. Defaults mode stops the spawn and
|
|
240
|
+
asks the parent to report that constraint. It does not silently rewrite history,
|
|
241
|
+
create a fresh child or execute the parent's defaults. Advisory mode remains
|
|
242
|
+
nonblocking feedback. Fully specified tuples, fixed roles and resumed agents
|
|
243
|
+
retain intentional local preservation without unnecessary paid classification.
|
|
244
|
+
|
|
245
|
+
The guarantee is limited to an enabled, trusted, connected and supported Hook.
|
|
246
|
+
The MCP server cannot intercept calls when the host does not invoke it. The
|
|
247
|
+
`automatic_hook.guarantee` capability describes this boundary and does not certify
|
|
248
|
+
installation, trust or dispatch. Missing/untrusted/unavailable Hooks remain a host
|
|
249
|
+
fallback condition, not a server-enforced block. See the official
|
|
250
|
+
[Codex Hook limitations](https://learn.chatgpt.com/docs/hooks) and
|
|
251
|
+
[Claude Code Hook reference](https://code.claude.com/docs/en/hooks).
|
|
252
|
+
|
|
253
|
+
A parent with a Hook-issued retry ID can query the existing observation tool:
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
get_spawn_routing_observation({retry_id})
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
This is an alternative to `{client, event}`; the two forms are mutually exclusive
|
|
260
|
+
and partial forms are rejected. Both look up the same bounded process-local
|
|
261
|
+
record. Original preflight remains `awaiting_context`; `context_retry.outcome`
|
|
262
|
+
records the separately classified recovery and `context_retry.last_attempt`
|
|
263
|
+
records the latest retrieval/rejection. A conflicting or concurrent duplicate
|
|
264
|
+
does not erase an earlier classification. Only safe status/reason, classification,
|
|
265
|
+
recommendation/application state and allowlisted profile identity are retained in
|
|
266
|
+
this view, never the description, original event, policy or raw provider output.
|
|
267
|
+
Lookups make no paid calls or retention renewal. Missing/expired records do not
|
|
268
|
+
prove bypass, and execution remains `not_observed` throughout.
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
### Ordinary Codex follow-through verification — 2026-11-07
|
|
272
|
+
|
|
273
|
+
A bounded native Codex CLI 0.167.0 trial used the existing trusted Hook with an
|
|
274
|
+
ephemeral product-server override and a transparent observer. The user prompt
|
|
275
|
+
requested a sorting delegation, a short synthetic task name and omitted model,
|
|
276
|
+
effort, fork and role fields. It did not describe the recovery tool, provide a
|
|
277
|
+
retry sequence or tell the parent how to supply a description after a denial.
|
|
278
|
+
|
|
279
|
+
The real opaque-body Hook invocation was denied for local context shortage.
|
|
280
|
+
The parent followed the Hook feedback and supplied a bounded description through
|
|
281
|
+
MCP. Exactly one real Decisions classification produced a recommendation, while
|
|
282
|
+
the original omitted-fork history constraint was returned as application blocked.
|
|
283
|
+
The parent reported the constraint without creating a child, switching to a
|
|
284
|
+
fresh fork or supplying a model to bypass it. The HTTP boundary recorder checked
|
|
285
|
+
that only the labelled description was shared as task text, without opaque body
|
|
286
|
+
or native event metadata. Persistent host configuration/trust stayed unchanged;
|
|
287
|
+
temporary files were removed.
|
|
288
|
+
|
|
289
|
+
This verifies one ordinary follow-through and a stopped inherited application,
|
|
290
|
+
not inherited-model compatibility, unconditional model compliance, a benchmark
|
|
291
|
+
or successful child execution. It does not recover evidence for the historical
|
|
292
|
+
reported session. The earlier fresh-child recovery verification is a separate
|
|
293
|
+
scenario and must not be substituted for this omitted-fork result.
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
### Claude Code recovery and child verification — 2026-11-07
|
|
297
|
+
|
|
298
|
+
A native Claude Code 2.1.314 trial used an ephemeral copy of the installed Hook
|
|
299
|
+
settings, a temporary MCP server override and normal permission checks. The
|
|
300
|
+
parent received an ordinary sorting-delegation request with a short initial
|
|
301
|
+
Agent prompt and no initial model. The request explicitly distinguished that
|
|
302
|
+
initial unpinned omission from a user prohibition on later model selection. It
|
|
303
|
+
did not provide recovery tool names or an MCP retry sequence.
|
|
304
|
+
|
|
305
|
+
The first real Agent call was denied for insufficient context. The parent
|
|
306
|
+
supplied a description through MCP; exactly one real Decisions request selected
|
|
307
|
+
`claude-simple` / `haiku`. The retry returned concrete missing defaults under
|
|
308
|
+
`next_call.set_if_unspecified`. The parent submitted a second Agent call with
|
|
309
|
+
`model: "haiku"`. One actual child produced `[1, 2, 3]`; forwarded child messages
|
|
310
|
+
with parent-tool linkage recorded `claude-haiku-5-5`, also present in model usage.
|
|
311
|
+
The transparent observer did not modify Hook responses. Persistent settings and
|
|
312
|
+
MCP registration were unchanged, permission bypass was not used, and temporary
|
|
313
|
+
files were removed.
|
|
314
|
+
|
|
315
|
+
Earlier native attempts remain failures, not successes. Two stopped before any
|
|
316
|
+
Agent/classification under the previous login context. Four authenticated trials
|
|
317
|
+
reached recommendation but did not create a child: one resubmitted omitted
|
|
318
|
+
defaults, one answered inline, and two stopped without a second Agent call. The final retained assistant
|
|
319
|
+
report attributed its stop to interpreting the test's model-omission wording as
|
|
320
|
+
a user constraint. The contract was clarified with concrete missing
|
|
321
|
+
fields and `context_retry_allowed` (ending supplementation, not authorizing or
|
|
322
|
+
forbidding native execution), while the final prompt clarified only the initial
|
|
323
|
+
unpinned state. These trials are not a model-quality or cost comparison.
|
|
324
|
+
|
|
325
|
+
This verifies one caller-driven Claude recovery under explicit unpinned task
|
|
326
|
+
semantics. It does not guarantee every parent model follows feedback, change
|
|
327
|
+
host permission decisions, or establish inherited Codex application support.
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
## Intentional fresh delegation
|
|
331
|
+
|
|
332
|
+
Available from Aptly 0.1.6.
|
|
333
|
+
|
|
334
|
+
`prepare_fresh_delegation` is a caller protocol for a separate Codex invocation,
|
|
335
|
+
not a rewrite of the original inherited invocation. An enabled defaults Hook can
|
|
336
|
+
provide a routing reference named `retry_id` after direct completed inherited
|
|
337
|
+
advice, or the caller can use the existing context-retry reference after a
|
|
338
|
+
completed recommendation. Direct-advice references cannot request another paid
|
|
339
|
+
context supplement. Advisory paths are excluded because the original invocation
|
|
340
|
+
may already execute.
|
|
341
|
+
|
|
342
|
+
The caller supplies `task_name`, a bounded `standalone_task`, and a declaration:
|
|
343
|
+
`independent_task: true`, `same_task: true`, `original_call_outcome: "blocked"`,
|
|
344
|
+
`history_requirement: "not_required"`,
|
|
345
|
+
`standalone_context_complete: true`. Required/unknown history, undeclared
|
|
346
|
+
independence, incomplete context and changed scope reject without preparing a
|
|
347
|
+
call. These declarations are not verified user-intent provenance. The caller
|
|
348
|
+
must not make them when the user explicitly requires inheritance.
|
|
349
|
+
|
|
350
|
+
Only original native inputs with the supported task/model/effort/fork fields
|
|
351
|
+
qualify. Unknown additional execution fields are rejected rather than silently
|
|
352
|
+
dropped. Fixed roles/resume remain locally preserved before advice. Explicit
|
|
353
|
+
partial model/effort choices still constrain the completed allowlisted profile.
|
|
354
|
+
The current policy/catalog, original event/context and completed ledger result
|
|
355
|
+
are revalidated. Unknown results and missing/abstaining recommendations cannot
|
|
356
|
+
prepare a child. No new classification occurs.
|
|
357
|
+
|
|
358
|
+
A successful response provides separate `next_call.arguments` including explicit
|
|
359
|
+
`fork_turns: "none"`, the validated profile and the caller's standalone task.
|
|
360
|
+
A deny was returned for the original input, which was not rewritten. Server
|
|
361
|
+
observation does not certify that the host enforced it. The caller must have a
|
|
362
|
+
host-reported blocked tool outcome; executed/unknown declarations reject.
|
|
363
|
+
The caller reviews and submits a
|
|
364
|
+
new native call under unchanged host permissions and existing delegation
|
|
365
|
+
authorization. Neither preparation nor argument output proves dispatch/execution.
|
|
366
|
+
The process does not own native spawn or guarantee caller compliance.
|
|
367
|
+
|
|
368
|
+
The original five-minute lifetime and process/capacity boundaries apply. One
|
|
369
|
+
immutable preparation digest binds task, declaration, profile and original
|
|
370
|
+
reference; text/history are not persisted. Duplicate identical preparation is
|
|
371
|
+
idempotent; changed input conflicts. Expiry, cancellation, original-event or
|
|
372
|
+
policy/catalog changes prevent preparation. `fresh_delegation` observations
|
|
373
|
+
separate the prepared outcome from the latest rejected attempt and always keep
|
|
374
|
+
execution `not_observed`. The eventual new native call has its own identity;
|
|
375
|
+
server evidence does not automatically certify its relationship to this plan.
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
### Bounded native fresh-delegation verification — 2026-11-07
|
|
379
|
+
|
|
380
|
+
Codex CLI 0.167.0 used its existing trusted Hook with an ephemeral product-server
|
|
381
|
+
override. One standalone sorting task specified an initial inherited caller
|
|
382
|
+
default while explicitly requiring no inherited history. The original opaque
|
|
383
|
+
call stayed blocked; the parent supplied context, obtained one real Decisions
|
|
384
|
+
recommendation, declared independent same-task intent and called the preparation
|
|
385
|
+
API. It then submitted a separate native call with `fork_turns: "none"` and the
|
|
386
|
+
returned Luna/max profile. The actual linked child recorded `gpt-6-luna` / `max`,
|
|
387
|
+
returned the expected list and contained no copied parent message payloads.
|
|
388
|
+
Approval/sandbox constraints matched the parent. Preparation added no paid call.
|
|
389
|
+
|
|
390
|
+
A separate two-turn test explicitly required inherited history. It obtained one
|
|
391
|
+
real recommendation, preserved `fork_turns: "all"`, made no fresh preparation and
|
|
392
|
+
created no child. Both tests preserved persistent configuration/trust, used no
|
|
393
|
+
response-modifying adapter and removed their temporary files. These are bounded
|
|
394
|
+
caller-driven checks, not universal model compliance or verified user provenance.
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
Captured event/context checks are process-local and do not observe later native
|
|
398
|
+
host-setting changes or host cancellation unless forwarded through the request
|
|
399
|
+
signal or explicit registered-context revocation. The reused profile was chosen
|
|
400
|
+
from the original classification summary; `same_task` is a caller declaration,
|
|
401
|
+
not a semantic comparison of the standalone task. Do not reuse it for different
|
|
402
|
+
work. Repeated preparation is idempotent, not an exactly-once spawn mechanism.
|
|
403
|
+
The host still owns each actual invocation and its permissions.
|
|
404
|
+
|
|
405
|
+
Private preparation digests are intentionally immutable once written, including
|
|
406
|
+
when a final currentness check rejects the response. This fail-closed binding
|
|
407
|
+
prevents changing a task under a consumed reference; it is not a plaintext backup
|
|
408
|
+
and is not deleted to permit a different-task retry. The advisory read-only hint
|
|
409
|
+
means no user file, host configuration or native execution is changed; like the
|
|
410
|
+
existing recommendation/cache tools, private query bookkeeping is still written.
|
|
411
|
+
It is not a statelessness or permission-approval claim.
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
The final instruction-contract candidate was also checked with explicit session
|
|
415
|
+
owner authorization for Aptly to choose model/effort defaults for the independent
|
|
416
|
+
task. The original caller-default all was denied, the caller used the declared
|
|
417
|
+
preparation API, and a separate none invocation ran the recommended Luna/max
|
|
418
|
+
child with the expected output. Exactly one Decisions request was forwarded.
|
|
419
|
+
A final explicit-history case preserved all and created no child. Persistent
|
|
420
|
+
configuration/trust stayed unchanged. An intervening candidate stopped after
|
|
421
|
+
recommendation when the parent treated original-fork preservation as a blanket
|
|
422
|
+
ban; that run remains a failed caller-follow-through observation, not successful
|
|
423
|
+
execution. This motivated the stricter instruction distinguishing original-call
|
|
424
|
+
resubmission from the only supported separate preparation protocol. These results
|
|
425
|
+
remain bounded and do not guarantee arbitrary parent-model compliance.
|
package/docs/guide/en.md
CHANGED
|
@@ -224,6 +224,8 @@ For genuinely independent work, the caller can intentionally choose a fresh chil
|
|
|
224
224
|
| `get_spawn_routing_observation` | Looks up one exact Hook invocation; never proves native execution |
|
|
225
225
|
| `prepare_spawn_context` | Registers a bounded description for one exact upcoming invocation |
|
|
226
226
|
| `cancel_spawn_context` | Revokes the description association, not native execution or a request already sent |
|
|
227
|
+
| `retry_spawn_recommendation` | Accepts one task-description supplement using a Hook-issued retry_id |
|
|
228
|
+
| `prepare_fresh_delegation` | Prepares a separate independent Codex call from completed inherited advice; never executes it |
|
|
227
229
|
|
|
228
230
|
### Outbound data and disabling automatic sharing
|
|
229
231
|
|
|
@@ -245,6 +247,32 @@ An integration that knows the real upcoming session/call IDs and exact original
|
|
|
245
247
|
|
|
246
248
|
Associations last five minutes, are immutable, and are limited to 128 per process. Changed, expired or cancelled associations block routing; an already evaluated call cannot acquire a richer-summary retry or new paid identity. A caller unable to obtain the actual upcoming event cannot use this handoff; shipped Hooks do not create descriptions or call IDs. Local `insufficient_context`, provider `provider_needs_context`, and native `inherited_context_application_unverified` are distinct. The [handoff contract](../SPAWN_CONTEXT.md) records a bounded native description-handoff check. It does not establish automatic description production or execution of the recommended model.
|
|
247
249
|
|
|
250
|
+
### Retry with additional context (0.1.5+)
|
|
251
|
+
|
|
252
|
+
When the automatic Hook returns `insufficient_context` or `provider_needs_context`, it provides a `retry_id` and recovery instructions. In `defaults` mode it denies that spawn; in `advisory` mode it only supplies feedback. The parent should describe purpose, scope, expected output and complexity using context it already has, then call `retry_spawn_recommendation({retry_id, description})` on the same MCP process within five minutes. No future native call ID is needed. Ask the user only for genuinely missing information.
|
|
253
|
+
|
|
254
|
+
One supplement is allowed per original call. Duplicate input reuses the cache; changed descriptions conflict. Stop if the retry still needs context or fails; never replace an uncertain paid request with a new ID. If `spawn_application` is `blocked`, report the constraint without applying the profile. Otherwise the parent must preserve explicit choices, history, roles and permissions when passing only unspecified model/effort to a new compatible native call. The Hook does not itself perform the parent's retry or native execution. The original `prepare_spawn_context` association stays immutable. See the [limits, costs and validation contract](../SPAWN_CONTEXT.md#one-context-supplement-after-a-hook-response).
|
|
255
|
+
|
|
256
|
+
The retry response includes `next_call.set_if_unspecified` with concrete fields for the next native call. It excludes already specified model/effort fields and never adds Claude effort. Blocked history/application results omit `next_call`. These fields are neither execution evidence nor permission approval.
|
|
257
|
+
|
|
258
|
+
`context_retry_allowed: false` ends further context supplementation. For a compatible recommendation, `caller_review_required` means the parent reviews arguments; it does not request new user approval. Existing delegation authorization and host permission checks still apply.
|
|
259
|
+
|
|
260
|
+
### Automatic routing guarantees and blocked outcomes (0.1.5+)
|
|
261
|
+
|
|
262
|
+
The guarantee covers supported calls handled by an enabled, trusted Hook on a connected MCP process. Check `get_routing_capabilities.automatic_hook.guarantee` for this scope. The server cannot detect or enforce an absent, untrusted, disconnected or host-failed Hook; the host controls fallback. MCP connection status alone is not per-call routing evidence.
|
|
263
|
+
|
|
264
|
+
After a valid enabled policy and eligible call are established, `defaults` returns a deny decision and a safe reason for incompatible application, budget exhaustion, classification failure or unknown outcomes. Original arguments and constraints remain intact, but that spawn does not proceed. For unverified inherited history, report the constraint instead of silently running parent defaults or switching to `none`. `advisory` describes the limit without blocking. Missing/disabled policy, explicit tuples, fixed roles and resume remain intentional local preservation paths rather than blanket denials.
|
|
265
|
+
|
|
266
|
+
With a recovery ID, use `get_spawn_routing_observation({retry_id})` on the same MCP process, or use the existing `{client, event}` form. Mixed or partial forms are rejected. Original `awaiting_context` and `context_retry.outcome` are separate stages; rejected duplicates appear under `last_attempt` without replacing an earlier classification outcome. Lookups incur no paid request and do not renew retention. Execution always remains `not_observed`; neither advice nor argument updates establish actual child execution.
|
|
267
|
+
|
|
268
|
+
### Prepare a separate independent delegation (0.1.6+)
|
|
269
|
+
|
|
270
|
+
After a defaults Hook blocks inherited application, the caller may use `prepare_fresh_delegation` only when it can declare **the same independent task, no user-required inherited history, and complete standalone instructions**. Supply the Hook/retry `retry_id`, `task_name`, `standalone_task`, and `declaration: {independent_task:true, same_task:true, original_call_outcome:"blocked", history_requirement:"not_required", standalone_context_complete:true}` on the same process. It revalidates completed allowlisted advice without another classification.
|
|
271
|
+
|
|
272
|
+
The original inherited invocation stays blocked. Review the separate `next_call.arguments` and submit it under existing delegation authorization and normal host permission checks. It includes `fork_turns: "none"` and preserves model/effort choices. This is caller-declared intent, not verified user intent or execution evidence. Do not use it for required/unknown history, fixed roles, resume or unverified additional execution arguments. A reference binds one task; five-minute expiry, cancellation, policy/catalog changes and changes to the original invocation block preparation. It is not offered for nonblocking advisory paths. See the [contract and limits](../SPAWN_CONTEXT.md#intentional-fresh-delegation).
|
|
273
|
+
|
|
274
|
+
Use this only after the host reports the original call blocked. `original_call_outcome` values `executed` and `unknown` reject preparation. This is caller-declared, not server execution observation. Repeated identical preparation does not guarantee single child execution. The profile was selected from the original classification summary and must not be reused for a different task.
|
|
275
|
+
|
|
248
276
|
## Direct recommendations
|
|
249
277
|
|
|
250
278
|
The `recommend_agent` MCP tool and CLI `recommend` accept a task summary and recommend a profile. They do not spawn subagents. Pass this JSON as MCP tool arguments, or save it to a file and provide it to the CLI through standard input.
|
package/docs/guide/ja.md
CHANGED
|
@@ -224,6 +224,8 @@ Codex の本文が不透明な場合、`cleanup_merged_worktrees` のような
|
|
|
224
224
|
| `get_spawn_routing_observation` | 一致する Hook 呼び出しを照会し、native 実行を証明しません |
|
|
225
225
|
| `prepare_spawn_context` | 正確に一致する予定呼び出しに上限付きの説明を登録します |
|
|
226
226
|
| `cancel_spawn_context` | 説明の対応付けを取り消します。native 実行や送信済みリクエストは取り消しません |
|
|
227
|
+
| `retry_spawn_recommendation` | Hook が返す retry_id を使い、タスク説明を一度補って再推薦します |
|
|
228
|
+
| `prepare_fresh_delegation` | 完了済みの継承推薦から別の独立 Codex 呼び出し引数を準備し、実行はしません |
|
|
227
229
|
|
|
228
230
|
### 外部送信と自動共有の無効化
|
|
229
231
|
|
|
@@ -245,6 +247,32 @@ Decisions には `client`、`task.summary`、`task.operation`、`task.context_su
|
|
|
245
247
|
|
|
246
248
|
対応付けは5分間有効で変更不可、プロセスごとに最大128件です。入力変更・期限切れ・取消時は分類を止め、評価済みの呼び出しを説明変更で有料再試行しません。実際の予定イベントを取得できない呼び出し元は利用できません。標準 Hook は説明や呼び出し ID を作成しません。ローカルの `insufficient_context`、プロバイダーの `provider_needs_context`、適用時の `inherited_context_application_unverified` は別の結果です。限定的な native 説明受け渡しの検証は[契約](../SPAWN_CONTEXT.md)に記録しています。この検証は、説明の自動生成や推薦モデルの実行を証明するものではありません。
|
|
247
249
|
|
|
250
|
+
### 文脈を補って再推薦する(0.1.5 以降)
|
|
251
|
+
|
|
252
|
+
自動 Hook が `insufficient_context` または `provider_needs_context` を返すと、`retry_id` と補足手順を提示します。`defaults` ではその生成呼び出しを拒否し、`advisory` では案内だけを返します。親エージェントは既知の情報から目的・範囲・期待する出力・複雑さを短く説明し、5分以内に同じ MCP プロセスで `retry_spawn_recommendation({retry_id, description})` を呼んでください。将来の native 呼び出し ID は不要です。本当に情報が不足する場合だけユーザーに質問してください。
|
|
253
|
+
|
|
254
|
+
元の呼び出しごとに補足は一度だけです。同じ入力はキャッシュを再利用し、説明の変更は競合として拒否します。再推薦も文脈不足または失敗なら終了し、結果不明の有料要求を新しい ID で繰り返さないでください。`spawn_application` が `blocked` なら推薦を適用せず制約を報告してください。それ以外も親は明示的な選択・履歴・役割・権限を保ち、新しい互換 native 呼び出しに未指定のモデル・effort だけを渡す必要があります。Hook 自体が親の再要求や native 実行を行うわけではありません。元の `prepare_spawn_context` の対応付けは変更不可のままです。[制限・費用・検証契約](../SPAWN_CONTEXT.md#one-context-supplement-after-a-hook-response)を参照してください。
|
|
255
|
+
|
|
256
|
+
再推薦の応答は `next_call.set_if_unspecified` に次の native 呼び出しで補う具体的な未指定フィールドを返します。明示済みのモデル・effort は含めず、Claude に effort を追加しません。履歴などで適用できない結果には `next_call` を返しません。実行証拠や権限承認ではありません。
|
|
257
|
+
|
|
258
|
+
`context_retry_allowed: false` は追加の文脈補足を終了する意味です。互換性のある推薦の `caller_review_required` は親が引数を確認する意味であり、新しいユーザー承認の要求ではありません。既存の委任権限とホストの権限確認は引き続き適用されます。
|
|
259
|
+
|
|
260
|
+
### 自動ルーティングの保証範囲と拒否結果(0.1.5 以降)
|
|
261
|
+
|
|
262
|
+
保証は、有効かつ信頼済みの Hook が接続中の MCP で処理する対応呼び出しに限ります。`get_routing_capabilities.automatic_hook.guarantee` で範囲を確認してください。サーバーは未登録・未信頼・切断・ホスト側で失敗した Hook を検出したり強制したりできず、その後の処理はホストが決めます。MCP の接続表示だけでは個別呼び出しの経由を証明できません。
|
|
263
|
+
|
|
264
|
+
有効なポリシーと対象呼び出しを確認した後、`defaults` は適用不能・予算超過・分類失敗・結果不明を `deny` と安全な理由コードで返します。元の引数と制約は保持しますが、その生成は実行しません。継承履歴の互換性が未検証なら、親のデフォルトで黙って実行したり `none` に切り替えたりせず、制約を報告してください。`advisory` は拒否せず同じ制限を説明します。ポリシー未設定・無効、明示タプル・固定役割・resume は意図的なローカル保持経路であり、一律には拒否しません。
|
|
265
|
+
|
|
266
|
+
復旧 ID があれば、同じ MCP プロセスで `get_spawn_routing_observation({retry_id})` を呼べます。従来の `{client, event}` 形式も使えますが、混在や不完全な入力は拒否します。元の `awaiting_context` と `context_retry.outcome` は別の段階です。拒否した重複要求は `last_attempt` に記録し、以前の分類結果を上書きしません。照会は有料要求を発行せず、保持期限も延長しません。実行は常に `not_observed` であり、推薦や引数更新は実際の子の実行証拠ではありません。
|
|
267
|
+
|
|
268
|
+
### 別の独立した委任を準備する(0.1.6 以降)
|
|
269
|
+
|
|
270
|
+
defaults Hook が継承呼び出しへの適用を拒否した後、呼び出し元が**同じ独立タスクであり、ユーザーが継承履歴を要求せず、完全な独立指示を渡せる**と宣言できる場合だけ `prepare_fresh_delegation` を使えます。同じプロセスで Hook または再推薦の `retry_id`、`task_name`、`standalone_task` と `declaration: {independent_task:true, same_task:true, original_call_outcome:"blocked", history_requirement:"not_required", standalone_context_complete:true}` を渡してください。完了済みの許可プロファイルを再確認し、分類を追加で呼びません。
|
|
271
|
+
|
|
272
|
+
元の継承呼び出しは拒否されたままです。別の `next_call.arguments` を確認し、既存の委任権限と通常のホスト権限確認の下で新しい呼び出しを送ってください。`fork_turns: "none"` と、元の選択を保つモデル・effort を含みます。呼び出し元の宣言であり、ユーザー意図や実行を検証するものではありません。履歴が必要・不明、固定役割、resume、未検証の追加実行引数がある場合は使わないでください。参照は一つのタスクだけに結び付き、5分の期限・取消・ポリシー/候補/元の呼び出しの変更で準備を止めます。元の実行を許す advisory 経路には提供しません。[契約と制限](../SPAWN_CONTEXT.md#intentional-fresh-delegation)を確認してください。
|
|
273
|
+
|
|
274
|
+
ホストが元の呼び出しの拒否を報告した後だけ使ってください。`original_call_outcome` が `executed` または `unknown` なら準備を拒否します。これは呼び出し元の宣言で、サーバーの実行観測ではありません。同じ準備の反復は子の一回実行を保証しません。プロファイルは元の分類要約に基づくため別タスクに再利用しないでください。
|
|
275
|
+
|
|
248
276
|
## 直接推薦
|
|
249
277
|
|
|
250
278
|
`recommend_agent` MCP と CLI の `recommend` は、タスク要約を受け取ってプロファイルを推薦します。子エージェントを直接生成することはありません。以下の JSON を MCP ツールの引数として渡すか、ファイルに保存して CLI の標準入力に渡してください。
|
package/docs/guide/ko.md
CHANGED
|
@@ -224,6 +224,8 @@ Codex 본문이 불투명할 때 `cleanup_merged_worktrees`처럼 구체적인
|
|
|
224
224
|
| `get_spawn_routing_observation` | 정확히 일치하는 Hook 호출을 조회하며 native 실행을 증명하지 않습니다 |
|
|
225
225
|
| `prepare_spawn_context` | 정확한 예정 호출에 제한된 설명을 등록합니다 |
|
|
226
226
|
| `cancel_spawn_context` | 등록한 설명의 연결을 취소하며 native 실행이나 이미 전송된 요청을 취소하지 않습니다 |
|
|
227
|
+
| `retry_spawn_recommendation` | Hook의 `retry_id`로 작업 설명을 한 번 보충해 재추천합니다 |
|
|
228
|
+
| `prepare_fresh_delegation` | 완료된 상속 추천으로 별도의 독립 Codex 호출 인자를 준비하며 실행하지 않습니다 |
|
|
227
229
|
|
|
228
230
|
### 외부 전송과 자동 공유 끄기
|
|
229
231
|
|
|
@@ -245,6 +247,32 @@ Decisions에는 `client`, `task.summary`, `task.operation`, `task.context_suffic
|
|
|
245
247
|
|
|
246
248
|
연결은 5분간 유효하고 변경할 수 없으며 프로세스당 최대 128개입니다. 입력 변경·만료·취소 시 분류를 중단하고, 이미 평가한 호출에 설명을 바꿔 유료 재시도하지 않습니다. 실제 예정 이벤트를 알 수 없는 호출자는 사용할 수 없습니다. 기본 Hook은 설명이나 호출 ID를 만들지 않습니다. 로컬 `insufficient_context`, 공급자 `provider_needs_context`, 실제 적용의 `inherited_context_application_unverified`는 서로 다릅니다. 제한된 native 설명 전달 검증은 [전달 계약](../SPAWN_CONTEXT.md)에 기록했습니다. 이 검증은 기본 설명의 자동 생성이나 추천 모델의 실행을 증명하지 않습니다.
|
|
247
249
|
|
|
250
|
+
### 맥락 보충 후 재추천 (0.1.5부터)
|
|
251
|
+
|
|
252
|
+
자동 Hook이 `insufficient_context` 또는 `provider_needs_context`를 반환하면 `retry_id`와 보충 안내를 제공합니다. `defaults`에서는 해당 스폰을 차단하고, `advisory`에서는 안내만 전달합니다. 부모 에이전트는 이미 아는 작업 목적·범위·결과물·복잡도를 짧게 작성해 같은 MCP 프로세스에서 5분 안에 `retry_spawn_recommendation({retry_id, description})`를 호출하십시오. 미래 native 호출 ID는 필요하지 않습니다. 실제로 정보가 없을 때만 사용자에게 질문하십시오.
|
|
253
|
+
|
|
254
|
+
보충은 원래 호출당 한 번이며 동일 입력은 캐시를 재사용하고 변경한 설명은 충돌로 거부합니다. 재추천도 `needs_context`이거나 실패하면 중단하십시오. 결과 불명인 요청을 새 ID로 반복하지 마십시오. `spawn_application`이 `blocked`이면 추천을 적용하지 말고 제약을 보고하십시오. 적용 가능한 추천도 부모가 명시 선택·이력·역할·권한을 보존하며 새 native 호출에 미지정 모델·effort만 전달해야 합니다. Hook이 부모의 재호출이나 실제 실행까지 자동 수행하지는 않습니다. 원래 `prepare_spawn_context` 연결은 여전히 변경할 수 없습니다. [한계·비용·검증 계약](../SPAWN_CONTEXT.md#one-context-supplement-after-a-hook-response)을 확인하십시오.
|
|
255
|
+
|
|
256
|
+
재추천 응답의 `next_call.set_if_unspecified`는 다음 native 호출에 넣을 미지정 필드만 제공합니다. 명시한 모델·effort는 포함하지 않으며 Claude에는 effort를 추가하지 않습니다. 이력 등으로 적용이 막히면 `next_call`을 제공하지 않습니다. 이 값은 실행 결과나 권한 승인이 아닙니다.
|
|
257
|
+
|
|
258
|
+
`context_retry_allowed: false`는 추가 설명 보충을 더 허용하지 않는다는 뜻입니다. 호환 가능한 추천에서 `caller_review_required`는 부모가 인자를 검토한다는 의미이며 새 사용자 승인을 요구하지 않습니다. 기존 위임 권한과 호스트 권한 검사는 그대로 유지됩니다.
|
|
259
|
+
|
|
260
|
+
### 자동 경유의 보장 범위와 차단 결과 (0.1.5부터)
|
|
261
|
+
|
|
262
|
+
활성화되고 신뢰된 Hook이 연결된 MCP에서 지원 호출을 처리하는 범위만 보장합니다. `get_routing_capabilities.automatic_hook.guarantee`로 이 범위를 확인하십시오. Hook 미등록·미신뢰·연결 해제·호스트 오류는 서버가 탐지하거나 강제로 차단할 수 없으며 호스트가 후속 처리를 결정합니다. MCP 연결 표시만으로 개별 호출의 경유를 판단하지 마십시오.
|
|
263
|
+
|
|
264
|
+
유효한 활성 정책과 지원 대상이 확인된 뒤, `defaults`는 추천 적용 불가·예산 초과·분류 실패·결과 불명 등을 `deny`와 안전한 사유 코드로 알립니다. 원래 인자와 제약은 유지하지만 해당 스폰은 진행하지 않습니다. 상속 이력이 미검증이면 부모 모델로 조용히 실행하거나 `none`으로 변경하지 말고 제약을 보고하십시오. `advisory`는 차단 없이 같은 한계를 설명합니다. 정책 미설정·비활성화, 명시 튜플·고정 역할·resume은 의도적인 로컬 보존 경로이며 일괄 차단하지 않습니다.
|
|
265
|
+
|
|
266
|
+
복구 ID가 있으면 `get_spawn_routing_observation({retry_id})`로 같은 MCP 프로세스의 관측을 조회할 수 있습니다. 또는 기존 `{client, event}`를 사용하십시오. 두 형식을 섞거나 일부만 보내면 거부합니다. 원래 `awaiting_context`와 `context_retry.outcome`은 별개이며, 거부된 중복 요청은 `last_attempt`에 표시해 이전 분류 결과를 덮어쓰지 않습니다. 조회는 유료 요청을 만들지 않고 보관 시간을 연장하지 않습니다. 실행은 항상 `not_observed`이므로 추천이나 인자 갱신을 실제 자식 실행으로 표현하지 마십시오.
|
|
267
|
+
|
|
268
|
+
### 상속 추천에서 별도 독립 위임 준비 (0.1.6부터)
|
|
269
|
+
|
|
270
|
+
`defaults`가 상속 적용을 차단한 뒤에도 호출자가 **같은 독립 작업이며 사용자에게 필요한 상속 이력이 없고 완전한 독립 지시를 제공할 수 있음**을 선언하면, 같은 프로세스에서 `prepare_fresh_delegation`을 호출할 수 있습니다. Hook 또는 재추천에서 받은 `retry_id`, `task_name`, `standalone_task`와 `declaration: {independent_task:true, same_task:true, original_call_outcome:"blocked", history_requirement:"not_required", standalone_context_complete:true}`를 전달하십시오. API는 이미 완료된 허용 프로필을 재검증하고 분류를 추가 호출하지 않습니다.
|
|
271
|
+
|
|
272
|
+
원래 상속 호출은 차단된 채 유지됩니다. 응답의 별도 `next_call.arguments`를 검토한 뒤 기존 위임 권한과 호스트 권한 검사에 따라 새 호출을 제출하십시오. `fork_turns: "none"`과 기존 선택을 보존한 모델·effort를 포함합니다. 이 API가 사용자 의도나 실제 실행을 확인한 것은 아닙니다. 이력이 필요하거나 불명확한 경우, 역할·resume·검증하지 않은 추가 실행 인자가 있는 경우에는 사용하지 마십시오. 같은 참조는 같은 작업에만 재사용할 수 있으며 5분 만료·취소·정책/후보 변경과 원래 호출 변경은 준비를 막습니다. `advisory`처럼 원래 실행을 허용한 경로에는 제공하지 않습니다. [계약과 한계](../SPAWN_CONTEXT.md#intentional-fresh-delegation)를 확인하십시오.
|
|
273
|
+
|
|
274
|
+
이 경로는 호스트가 원래 호출의 차단 결과를 돌려준 뒤에만 사용하십시오. `original_call_outcome`이 `executed` 또는 `unknown`이면 준비를 거절합니다. 이는 호출자 선언이며 서버의 실행 관측이 아닙니다. 동일 준비 응답을 여러 번 받는 것이 자식 실행 1회를 보장하지 않으며, 프로필은 원래 분류 요약을 기준으로 선택됐으므로 다른 작업에 재사용하면 안 됩니다.
|
|
275
|
+
|
|
248
276
|
## 직접 추천
|
|
249
277
|
|
|
250
278
|
`recommend_agent` MCP와 CLI `recommend`는 작업 요약을 받아 프로필을 추천합니다. 자식을 직접 생성하지 않습니다. 아래 JSON을 MCP 도구 인자로 전달하거나 파일에 저장해 CLI의 표준 입력으로 제공하십시오.
|