aptly 0.1.3 → 0.1.5
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 +14 -7
- package/README.ja.md +14 -7
- package/README.md +14 -7
- package/README.zh-CN.md +14 -7
- package/dist/src/automatic-hook.d.ts +56 -2
- package/dist/src/automatic-hook.js +157 -26
- package/dist/src/context-retry.d.ts +15 -0
- package/dist/src/context-retry.js +134 -0
- package/dist/src/hook.d.ts +7 -2
- package/dist/src/hook.js +32 -14
- package/dist/src/routing-observations.d.ts +90 -0
- package/dist/src/routing-observations.js +61 -0
- package/dist/src/server.js +61 -7
- package/dist/src/spawn-context.d.ts +15 -0
- package/dist/src/spawn-context.js +65 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/SPAWN_CONTEXT.md +326 -0
- package/docs/guide/en.md +38 -9
- package/docs/guide/ja.md +38 -9
- package/docs/guide/ko.md +38 -9
- package/docs/guide/zh-CN.md +38 -9
- package/examples/spawn-preflight.codex.json +30 -0
- package/package.json +2 -1
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# Spawn context handoff and recovery
|
|
2
|
+
|
|
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.
|
|
6
|
+
It does not decode opaque messages, inspect conversations or modify host
|
|
7
|
+
internals. It provides an explicit caller protocol, not an automatic description
|
|
8
|
+
producer for the shipped Hook templates.
|
|
9
|
+
|
|
10
|
+
## Supported caller contract
|
|
11
|
+
|
|
12
|
+
A caller/integration that knows the **real upcoming** client, session ID, native
|
|
13
|
+
call ID and exact original invocation can call these tools on the same MCP
|
|
14
|
+
server process, in order:
|
|
15
|
+
|
|
16
|
+
1. `prepare_spawn_context({client, event, description})`: register a short
|
|
17
|
+
description before the installed PreToolUse Hook runs. Check for
|
|
18
|
+
`status: "registered"`. Registration makes no provider request.
|
|
19
|
+
2. The existing Hook calls `route_spawn_hook({client, event})` with that exact
|
|
20
|
+
event. It can use the registered description instead of the label/excerpt.
|
|
21
|
+
3. `get_spawn_routing_observation({client, event})` reports the result separately
|
|
22
|
+
from native application/execution. Use `cancel_spawn_context({client, event})`
|
|
23
|
+
to revoke the association if the intended spawn is abandoned.
|
|
24
|
+
|
|
25
|
+
Do not manually route and then invoke an unrelated native call: an MCP response
|
|
26
|
+
does not prove that a host Hook intercepted or updated it. The caller description
|
|
27
|
+
is untrusted task data, not permissions, policy, host capability or verified user
|
|
28
|
+
intent. Explicit pins, roles, resume and inherited history remain protected.
|
|
29
|
+
|
|
30
|
+
The shipped Hook templates do not produce descriptions or preassign native call
|
|
31
|
+
IDs. If an integration cannot obtain the exact event before preflight, or connects
|
|
32
|
+
to a different MCP process, this handoff cannot be used. In particular, a parent
|
|
33
|
+
agent cannot invent IDs or add unsupported fields to a native spawn to make this
|
|
34
|
+
work. Such paths retain the existing label/excerpt behavior. No automatic
|
|
35
|
+
integration with the original Mac host is claimed.
|
|
36
|
+
|
|
37
|
+
## What to describe and what is shared
|
|
38
|
+
|
|
39
|
+
Use purpose, bounded scope, expected output, constraints and relevant complexity.
|
|
40
|
+
For example:
|
|
41
|
+
|
|
42
|
+
> Inspect three synthetic merged branches and their worktrees. Return a short
|
|
43
|
+
> table proposing which could be cleaned up. Do not delete files or run commands.
|
|
44
|
+
> No repository contents are needed.
|
|
45
|
+
|
|
46
|
+
Only this description, prefixed as caller-supplied untrusted task data, is sent as
|
|
47
|
+
task text. The existing client/catalog/provider contract is also sent. Neither
|
|
48
|
+
the opaque body, original label, history, event metadata, files nor raw errors are
|
|
49
|
+
added. References can supplement the description; URLs are not fetched and do
|
|
50
|
+
not substitute for describing the task.
|
|
51
|
+
|
|
52
|
+
Descriptions are at most `min(3800, max_summary_bytes - 96)` UTF-8 bytes, with a
|
|
53
|
+
small minimum length/word check. The prefixed summary must also satisfy
|
|
54
|
+
`min(4000, max_summary_bytes)`. Known key/Bearer patterns are rejected; this is
|
|
55
|
+
not complete secret detection or anonymization. Review text before registration.
|
|
56
|
+
An enabled automatic policy is required; `enabled: false` blocks registration
|
|
57
|
+
and transmission even if an association already exists.
|
|
58
|
+
|
|
59
|
+
## Association, expiry and costs
|
|
60
|
+
|
|
61
|
+
The process keeps at most 128 immutable associations. Five-minute expiry starts
|
|
62
|
+
at first registration; a duplicate does not extend it. Changed payloads for the
|
|
63
|
+
same client/session/call are rejected, not rebound. Cancellation and expiry
|
|
64
|
+
leave tombstones until process exit; capacity rejects new registrations rather
|
|
65
|
+
than evicting a binding and silently falling back. Expired text is discarded
|
|
66
|
+
when the store is accessed; nothing is enumerated or written to disk as text.
|
|
67
|
+
A restart loses the handoff. The persistent paid-call binding still prevents a
|
|
68
|
+
context-free request from replacing an already evaluated context-bound call.
|
|
69
|
+
|
|
70
|
+
A summary hash joins the existing immutable input/policy/catalog binding before
|
|
71
|
+
classification. Duplicate calls use the same request/cache identity and budgets;
|
|
72
|
+
changed or missing context cannot replace it. Context is checked before and
|
|
73
|
+
after the asynchronous provider call. Expiry/cancellation prevents output but
|
|
74
|
+
cannot refund or erase a provider request already sent. Revocation does not
|
|
75
|
+
cancel native execution; the host controls execution.
|
|
76
|
+
|
|
77
|
+
The original prepare_spawn_context handoff is immutable. Register before the
|
|
78
|
+
first evaluation. If a label-only or description-bound evaluation already
|
|
79
|
+
started, adding/changing the description fails closed (`call_conflict`);
|
|
80
|
+
unknown paid outcomes remain unknown. Do not change IDs to bypass this guard.
|
|
81
|
+
The 0.1.5 recovery protocol below provides a separate, bounded supplement;
|
|
82
|
+
it never rebinds this original association.
|
|
83
|
+
|
|
84
|
+
## Outcomes and evidence
|
|
85
|
+
|
|
86
|
+
- `insufficient_context`: local description/size/context checks failed.
|
|
87
|
+
- `provider_needs_context`: a valid provider abstention; its rationale is not
|
|
88
|
+
inferred, and useful-looking text does not guarantee a recommendation.
|
|
89
|
+
- `inherited_context_application_unverified`: advice can be available while
|
|
90
|
+
the native model/history update remains unverified and blocked.
|
|
91
|
+
|
|
92
|
+
Automated tests use synthetic opaque strings, injected providers, mocked
|
|
93
|
+
Decisions HTTP and in-memory MCP transport. They verify shared summaries,
|
|
94
|
+
identity, cancellation, bounds and cache/unknown protections. The separate
|
|
95
|
+
native observation below does not turn those fixtures into native evidence.
|
|
96
|
+
|
|
97
|
+
### Bounded native protocol verification — 2026-11-06
|
|
98
|
+
|
|
99
|
+
A macOS Codex CLI 0.167.0 test used product commit
|
|
100
|
+
`efae8211f6d92b9a9619886c80792d4e1b737d4d`. The installed Hook was enabled and
|
|
101
|
+
trusted without changing its trust settings. A test-only MCP transport adapter
|
|
102
|
+
captured the real host event, registered the description on the same product
|
|
103
|
+
server, and then forwarded the original `route_spawn_hook` request. It did not
|
|
104
|
+
invent IDs, decode the opaque body, alter Hook responses or patch host code.
|
|
105
|
+
|
|
106
|
+
The safe synthetic description requested extraction of a nonsecret marker
|
|
107
|
+
from earlier conversation history and output of `[1, 2, 3]`, with no tools,
|
|
108
|
+
files, network access, settings changes or real worktree deletion. An HTTP
|
|
109
|
+
boundary recorder confirmed exactly one forwarded Decisions request whose task
|
|
110
|
+
text was the labelled description, with no opaque body or native event fields.
|
|
111
|
+
Registration and observation correlation matched the actual invocation.
|
|
112
|
+
|
|
113
|
+
The provider selected `codex-simple` (`gpt-6-luna` / `max`). Application remained
|
|
114
|
+
blocked as `inherited_context_application_unverified` for `fork_turns: "all"`.
|
|
115
|
+
The native child's final context remained `gpt-6.1-sol` / `low`, matching the
|
|
116
|
+
parent. Parent linkage, exact copying of the marker-bearing parent user payload,
|
|
117
|
+
and the child's final marker/list response were independently checked.
|
|
118
|
+
|
|
119
|
+
This is one protocol and payload verification, not a provider-quality benchmark,
|
|
120
|
+
a causal comparison with label-only advice, or successful application of the
|
|
121
|
+
recommended model. The test used two parent turns and one child; temporary
|
|
122
|
+
files were removed and persistent host configuration was unchanged.
|
|
123
|
+
|
|
124
|
+
This validates a caller that can capture the exact event before product
|
|
125
|
+
preflight. The adapter does not ship an automatic description producer, and
|
|
126
|
+
ordinary parent agents still cannot invent the required IDs. PR #60's separate
|
|
127
|
+
history/model application acceptance and merge order must be resolved before
|
|
128
|
+
merging this dependent change. That historical test did not exercise the later recovery protocol below.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## One context supplement after a Hook response
|
|
132
|
+
|
|
133
|
+
Available from Aptly 0.1.5.
|
|
134
|
+
|
|
135
|
+
When the enabled automatic Hook encounters local `insufficient_context` or a
|
|
136
|
+
completed provider `provider_needs_context`, it issues a `retry_id`. In
|
|
137
|
+
`defaults` mode it denies that pending spawn and includes model-visible recovery
|
|
138
|
+
instructions. In `advisory` mode it supplies those instructions without blocking.
|
|
139
|
+
This uses the documented [Codex PreToolUse deny feedback](https://learn.chatgpt.com/docs/hooks).
|
|
140
|
+
A missing, untrusted or failed Hook is outside this guarantee.
|
|
141
|
+
|
|
142
|
+
The parent agent can use its existing task knowledge to call:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"retry_id": "<copy the 64-character retry_id from the Hook response>",
|
|
147
|
+
"description": "Review a small synthetic refresh change for conflict markers and incorrect imports. Return findings only; do not edit files."
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Send this input to `retry_spawn_recommendation` on the same MCP process within
|
|
152
|
+
five minutes. No future native call ID is required. Describe purpose, scope,
|
|
153
|
+
expected output and complexity; ask the user only for information genuinely
|
|
154
|
+
missing from the task. The description uses the same size and known-secret
|
|
155
|
+
checks as the original handoff. Only the labelled description and normal
|
|
156
|
+
classification contract are sent, never the opaque body or original event.
|
|
157
|
+
|
|
158
|
+
One valid supplement is allowed per original immutable call binding. Its
|
|
159
|
+
classification request ID is fixed, and a description digest is persisted before
|
|
160
|
+
provider preflight; text is not persisted by Aptly. Duplicate input reuses the
|
|
161
|
+
ledger/cache. Changed input conflicts, including after process recreation.
|
|
162
|
+
Timeout/network/unknown outcomes never issue replacement identities. A second
|
|
163
|
+
`needs_context`, a budget failure or an unavailable result ends this recovery:
|
|
164
|
+
`context_retry_allowed` is false and no further recovery ticket is created. Each process
|
|
165
|
+
holds at most 128 tickets without eviction; duplicates do not extend expiry.
|
|
166
|
+
Restart loses ticket lookup, although persistent bindings and the ledger still
|
|
167
|
+
prevent a recreated original Hook event from creating another paid retry.
|
|
168
|
+
|
|
169
|
+
The retry tool returns advice, not a rewritten original Hook response or a native
|
|
170
|
+
spawn. For a recommendation, inspect `spawn_application`: `caller_review_required`
|
|
171
|
+
requires the parent to review and explicitly supply only unspecified model/effort
|
|
172
|
+
fields to a new compatible native call. Caller review means argument review,
|
|
173
|
+
not a request for new user approval. Existing delegation authorization and host
|
|
174
|
+
permission checks still apply; this advisory result grants neither.
|
|
175
|
+
The response supplies concrete fields in
|
|
176
|
+
`next_call.set_if_unspecified`, excluding original explicit choices. Claude
|
|
177
|
+
receives model only, never an effort field. Blocked results omit `next_call`. `blocked` requires reporting the original
|
|
178
|
+
history/application constraint. Never change `all` or omitted fork to `none`,
|
|
179
|
+
discard history, alter explicit choices or bypass permissions to apply advice.
|
|
180
|
+
If no recommendation is available, stop and report the result.
|
|
181
|
+
|
|
182
|
+
Cancellation during the retry, expiry, and changed/disabled policy or catalog
|
|
183
|
+
suppress its result. A sent request may still consume budget and complete in the
|
|
184
|
+
ledger. The original event observation remains `awaiting_context` with execution
|
|
185
|
+
`not_observed`; a retry recommendation does not prove child execution.
|
|
186
|
+
|
|
187
|
+
This is a caller-driven recovery protocol. Hook feedback does not itself run the
|
|
188
|
+
parent's next MCP call or spawn a child. It does not guarantee that every host or
|
|
189
|
+
parent model follows the instructions, and inherited application remains blocked.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### Bounded native recovery verification — 2026-11-07
|
|
193
|
+
|
|
194
|
+
A local Codex CLI 0.167.0 trial exercised the pre-release recovery implementation with
|
|
195
|
+
its existing trusted Hook and ephemeral MCP command/environment overrides.
|
|
196
|
+
The parent was instructed to attempt one fresh child (`fork_turns: "none"`)
|
|
197
|
+
with no model/effort, a short synthetic task name and a message that the Hook
|
|
198
|
+
received as opaque. The Hook denied the call and returned recovery instructions.
|
|
199
|
+
The parent then called `retry_spawn_recommendation` through normal MCP tool
|
|
200
|
+
orchestration, supplying a bounded description of sorting `[3, 1, 2]` without
|
|
201
|
+
files, tools, network activity or changes.
|
|
202
|
+
|
|
203
|
+
The accepted retry ID matched the Hook feedback. Exactly one real Decisions
|
|
204
|
+
request contained the labelled description, without the opaque body or native
|
|
205
|
+
event metadata. It recommended `codex-simple` (`gpt-6-luna` / `max`). The parent
|
|
206
|
+
explicitly supplied that profile on its second native attempt, with the original
|
|
207
|
+
fresh-child semantics. The actual linked child recorded Luna/max and returned
|
|
208
|
+
`[1, 2, 3]`. Only one child was created. Neither Hook responses nor product
|
|
209
|
+
behavior were modified by the transparent observation adapter; persistent host
|
|
210
|
+
configuration and trust settings were unchanged, and temporary files were removed.
|
|
211
|
+
|
|
212
|
+
Three earlier attempts were retained as failures: each stopped before a paid
|
|
213
|
+
classification or child execution. Inspection of the nested MCP call established
|
|
214
|
+
that the recovery tool's initial write annotation required approval and was
|
|
215
|
+
rejected under `approvalPolicy: "never"`. The successful trial used the same
|
|
216
|
+
read-only advisory annotations as `recommend_agent`; local cache/budget metadata
|
|
217
|
+
is still recorded, and this is not a claim of stateless execution.
|
|
218
|
+
|
|
219
|
+
This is a prompt-guided caller recovery check, not proof that every parent model
|
|
220
|
+
will retry automatically. It does not validate inherited model application,
|
|
221
|
+
Claude Code native recovery, model quality or cost savings. Claude recovery,
|
|
222
|
+
provider abstention, duplicate/unknown outcomes and revocation are covered by
|
|
223
|
+
separate offline tests; they are not native execution evidence.
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## Visible routing outcomes and correlated recovery
|
|
227
|
+
|
|
228
|
+
Available from Aptly 0.1.5.
|
|
229
|
+
|
|
230
|
+
After establishing a valid enabled policy, a supported unpinned/default-selection
|
|
231
|
+
call and eligible profiles, `defaults` denies application incompatibilities and
|
|
232
|
+
classification failures instead of silently continuing with the original model.
|
|
233
|
+
The safe reason is model-visible. Budget exhaustion, unknown results and provider
|
|
234
|
+
errors do not authorize retrying with another identity. Cancellation of the host
|
|
235
|
+
request suppresses output; an operator-disabled policy stays disabled.
|
|
236
|
+
|
|
237
|
+
In particular, omitted or inherited Codex history still cannot apply a recommended
|
|
238
|
+
profile under the current verified contract. Defaults mode stops the spawn and
|
|
239
|
+
asks the parent to report that constraint. It does not silently rewrite history,
|
|
240
|
+
create a fresh child or execute the parent's defaults. Advisory mode remains
|
|
241
|
+
nonblocking feedback. Fully specified tuples, fixed roles and resumed agents
|
|
242
|
+
retain intentional local preservation without unnecessary paid classification.
|
|
243
|
+
|
|
244
|
+
The guarantee is limited to an enabled, trusted, connected and supported Hook.
|
|
245
|
+
The MCP server cannot intercept calls when the host does not invoke it. The
|
|
246
|
+
`automatic_hook.guarantee` capability describes this boundary and does not certify
|
|
247
|
+
installation, trust or dispatch. Missing/untrusted/unavailable Hooks remain a host
|
|
248
|
+
fallback condition, not a server-enforced block. See the official
|
|
249
|
+
[Codex Hook limitations](https://learn.chatgpt.com/docs/hooks) and
|
|
250
|
+
[Claude Code Hook reference](https://code.claude.com/docs/en/hooks).
|
|
251
|
+
|
|
252
|
+
A parent with a Hook-issued retry ID can query the existing observation tool:
|
|
253
|
+
|
|
254
|
+
```text
|
|
255
|
+
get_spawn_routing_observation({retry_id})
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
This is an alternative to `{client, event}`; the two forms are mutually exclusive
|
|
259
|
+
and partial forms are rejected. Both look up the same bounded process-local
|
|
260
|
+
record. Original preflight remains `awaiting_context`; `context_retry.outcome`
|
|
261
|
+
records the separately classified recovery and `context_retry.last_attempt`
|
|
262
|
+
records the latest retrieval/rejection. A conflicting or concurrent duplicate
|
|
263
|
+
does not erase an earlier classification. Only safe status/reason, classification,
|
|
264
|
+
recommendation/application state and allowlisted profile identity are retained in
|
|
265
|
+
this view, never the description, original event, policy or raw provider output.
|
|
266
|
+
Lookups make no paid calls or retention renewal. Missing/expired records do not
|
|
267
|
+
prove bypass, and execution remains `not_observed` throughout.
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
### Ordinary Codex follow-through verification — 2026-11-07
|
|
271
|
+
|
|
272
|
+
A bounded native Codex CLI 0.167.0 trial used the existing trusted Hook with an
|
|
273
|
+
ephemeral product-server override and a transparent observer. The user prompt
|
|
274
|
+
requested a sorting delegation, a short synthetic task name and omitted model,
|
|
275
|
+
effort, fork and role fields. It did not describe the recovery tool, provide a
|
|
276
|
+
retry sequence or tell the parent how to supply a description after a denial.
|
|
277
|
+
|
|
278
|
+
The real opaque-body Hook invocation was denied for local context shortage.
|
|
279
|
+
The parent followed the Hook feedback and supplied a bounded description through
|
|
280
|
+
MCP. Exactly one real Decisions classification produced a recommendation, while
|
|
281
|
+
the original omitted-fork history constraint was returned as application blocked.
|
|
282
|
+
The parent reported the constraint without creating a child, switching to a
|
|
283
|
+
fresh fork or supplying a model to bypass it. The HTTP boundary recorder checked
|
|
284
|
+
that only the labelled description was shared as task text, without opaque body
|
|
285
|
+
or native event metadata. Persistent host configuration/trust stayed unchanged;
|
|
286
|
+
temporary files were removed.
|
|
287
|
+
|
|
288
|
+
This verifies one ordinary follow-through and a stopped inherited application,
|
|
289
|
+
not inherited-model compatibility, unconditional model compliance, a benchmark
|
|
290
|
+
or successful child execution. It does not recover evidence for the historical
|
|
291
|
+
reported session. The earlier fresh-child recovery verification is a separate
|
|
292
|
+
scenario and must not be substituted for this omitted-fork result.
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
### Claude Code recovery and child verification — 2026-11-07
|
|
296
|
+
|
|
297
|
+
A native Claude Code 2.1.314 trial used an ephemeral copy of the installed Hook
|
|
298
|
+
settings, a temporary MCP server override and normal permission checks. The
|
|
299
|
+
parent received an ordinary sorting-delegation request with a short initial
|
|
300
|
+
Agent prompt and no initial model. The request explicitly distinguished that
|
|
301
|
+
initial unpinned omission from a user prohibition on later model selection. It
|
|
302
|
+
did not provide recovery tool names or an MCP retry sequence.
|
|
303
|
+
|
|
304
|
+
The first real Agent call was denied for insufficient context. The parent
|
|
305
|
+
supplied a description through MCP; exactly one real Decisions request selected
|
|
306
|
+
`claude-simple` / `haiku`. The retry returned concrete missing defaults under
|
|
307
|
+
`next_call.set_if_unspecified`. The parent submitted a second Agent call with
|
|
308
|
+
`model: "haiku"`. One actual child produced `[1, 2, 3]`; forwarded child messages
|
|
309
|
+
with parent-tool linkage recorded `claude-haiku-5-5`, also present in model usage.
|
|
310
|
+
The transparent observer did not modify Hook responses. Persistent settings and
|
|
311
|
+
MCP registration were unchanged, permission bypass was not used, and temporary
|
|
312
|
+
files were removed.
|
|
313
|
+
|
|
314
|
+
Earlier native attempts remain failures, not successes. Two stopped before any
|
|
315
|
+
Agent/classification under the previous login context. Four authenticated trials
|
|
316
|
+
reached recommendation but did not create a child: one resubmitted omitted
|
|
317
|
+
defaults, one answered inline, and two stopped without a second Agent call. The final retained assistant
|
|
318
|
+
report attributed its stop to interpreting the test's model-omission wording as
|
|
319
|
+
a user constraint. The contract was clarified with concrete missing
|
|
320
|
+
fields and `context_retry_allowed` (ending supplementation, not authorizing or
|
|
321
|
+
forbidding native execution), while the final prompt clarified only the initial
|
|
322
|
+
unpinned state. These trials are not a model-quality or cost comparison.
|
|
323
|
+
|
|
324
|
+
This verifies one caller-driven Claude recovery under explicit unpinned task
|
|
325
|
+
semantics. It does not guarantee every parent model follows feedback, change
|
|
326
|
+
host permission decisions, or establish inherited Codex application support.
|
package/docs/guide/en.md
CHANGED
|
@@ -203,16 +203,17 @@ aptly remove --client all
|
|
|
203
203
|
|
|
204
204
|
## Automatic Hook
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
**The following preflight, recommendation and observation behavior requires Aptly 0.1.4 or later.** The installed `PreToolUse` matcher routes supported Codex `spawn_agent` / `collaborationspawn_agent` / `Agent` and Claude Code `Agent` calls to local `route_spawn_hook` before native execution. The host must load and trust this Hook and connect its MCP server. Aptly cannot enforce interception in an unconfigured or unsupported host, or when MCP is unavailable; native execution remains the host's responsibility.
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
| Claude Code | Calls with `subagent_type: "general-purpose"` and no explicit model, effort, fixed role, resume target, or inherited history |
|
|
208
|
+
Local preflight checks explicit fields, roles/resume, policy, cache and budget. A new paid Decisions request is not required for every spawn. Model-only or effort-only Codex selections restrict candidates to matching allowlisted tuples; only the unspecified field can be filled. Both specified fields, unsupported values, fixed roles and resumed identities are preserved without classification. Input fields do not establish whether a choice came from the user or a host default.
|
|
209
|
+
|
|
210
|
+
Unspecified model/effort with `fork_turns: "all"` or omitted fork now reaches recommendation. It does **not** authorize history changes: Codex model/effort application still requires explicit `fork_turns: "none"`. Otherwise the Hook reports `inherited_context_application_unverified` and preserves the original arguments. Other history fields produce `history_semantics_unverified`; Claude application remains limited to general-purpose calls without history constraints. A recommendation may therefore be produced without being applied.
|
|
212
211
|
|
|
213
|
-
|
|
212
|
+
For opaque Codex messages, a concrete short task name such as `cleanup_merged_worktrees` can supply label-only advice. The short-name allowlist covers cleanup/remove/prune + merged + worktrees/branches, and review/fix/test + failing/broken/flaky + tests/builds; other names retain the descriptive six-word check. The body is never decoded or sent. This does not establish missing task details or permission to clean up. Inherited application is unverified for the target host, not universally impossible; public source support alone cannot certify the installed runtime.
|
|
214
213
|
|
|
215
|
-
|
|
214
|
+
For genuinely independent work, the caller can intentionally choose a fresh child and provide sufficient standalone task context. Aptly never changes `all` to `none`, removes history or rewrites a specified model/effort. [Synthetic inherited and fresh examples](../../examples/spawn-preflight.codex.json) show the distinct requests; they are not automatic retries. Never retry an uncertain paid call with a new ID.
|
|
215
|
+
|
|
216
|
+
`defaults` enables compatible argument updates; `advisory` supplies advice only. Inherited calls and partially specified calls may now share the same bounded task excerpt with Decisions even when application is blocked; history is not a privacy opt-out. Disabled policy, insufficient context, budget limits, failure and cancellation preserve execution constraints. Input, policy and catalog bindings, duplicate suppression and unknown-outcome protection remain in place. Fixture recommendations never rewrite native defaults. The strict evidence-based path without an automatic policy remains separate; host-internal patches stay paused.
|
|
216
217
|
|
|
217
218
|
| MCP tool | Purpose |
|
|
218
219
|
|---|---|
|
|
@@ -220,6 +221,10 @@ The CLI without additional configuration, and existing manual configurations, de
|
|
|
220
221
|
| `recommend_agent` | Returns a direct recommendation for a task summary |
|
|
221
222
|
| `get_routing_precedence` | Explains preserved choices and unverified configuration sources for a call |
|
|
222
223
|
| `route_spawn_hook` | Selects defaults for eligible calls or passes advice only, according to the installed policy |
|
|
224
|
+
| `get_spawn_routing_observation` | Looks up one exact Hook invocation; never proves native execution |
|
|
225
|
+
| `prepare_spawn_context` | Registers a bounded description for one exact upcoming invocation |
|
|
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 |
|
|
223
228
|
|
|
224
229
|
### Outbound data and disabling automatic sharing
|
|
225
230
|
|
|
@@ -235,6 +240,30 @@ For control over the shared summary, disable automatic sharing and write only th
|
|
|
235
240
|
|
|
236
241
|
The ledger and Hook bindings store request metadata, hashes, and cached results, not task excerpts. Aptly diagnostics also exclude raw task text. The local Hook's `updatedInput` retains the original task so the host can continue execution. Aptly does not control the host's own transcript or log retention.
|
|
237
242
|
|
|
243
|
+
### Explicit description for opaque spawns (0.1.4+)
|
|
244
|
+
|
|
245
|
+
An integration that knows the real upcoming session/call IDs and exact original event can call `prepare_spawn_context({client, event, description})` on the same MCP process before the Hook. Describe purpose, scope, expected output, constraints and complexity; URLs alone do not fetch content. Only the bounded description and fixed prefix replace the task excerpt, not history, files or the opaque body. `cancel_spawn_context({client, event})` revokes it. Registration needs enabled automatic policy; `enabled: false` prevents sharing. Known-secret filters are incomplete.
|
|
246
|
+
|
|
247
|
+
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.
|
|
248
|
+
|
|
249
|
+
### Retry with additional context (0.1.5+)
|
|
250
|
+
|
|
251
|
+
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.
|
|
252
|
+
|
|
253
|
+
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).
|
|
254
|
+
|
|
255
|
+
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.
|
|
256
|
+
|
|
257
|
+
`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.
|
|
258
|
+
|
|
259
|
+
### Automatic routing guarantees and blocked outcomes (0.1.5+)
|
|
260
|
+
|
|
261
|
+
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.
|
|
262
|
+
|
|
263
|
+
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.
|
|
264
|
+
|
|
265
|
+
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.
|
|
266
|
+
|
|
238
267
|
## Direct recommendations
|
|
239
268
|
|
|
240
269
|
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.
|
|
@@ -310,9 +339,9 @@ Refresh only reads the fixed [Claude model documentation](https://code.claude.co
|
|
|
310
339
|
|
|
311
340
|
## Providing context
|
|
312
341
|
|
|
313
|
-
When Codex passes a subagent `message` to the Hook as ciphertext, Aptly does not read or decrypt its body. It uses only a sufficiently descriptive plaintext `task_name` as a summary. Describe the task and its scope, for example `sort_supplied_numbers_3_1_2_ascending_without_tools`.
|
|
342
|
+
When Codex passes a subagent `message` to the Hook as ciphertext, Aptly does not read or decrypt its body. It uses only a sufficiently descriptive plaintext `task_name` as a summary. Describe the task and its scope, for example `sort_supplied_numbers_3_1_2_ascending_without_tools`. Unsupported or ambiguous task names preserve the original model. Claude Code calls and calls that expose a plaintext body use a summary of the provided body.
|
|
314
343
|
|
|
315
|
-
Use `
|
|
344
|
+
Use `get_spawn_routing_observation` with the same `client` and exact original Hook `event` to query one invocation. It returns a redacted correlation ID, preflight, classification/cache outcome, recommendation, argument-update or blocked application, and `execution: not_observed`. `arguments_updated` only describes emitted Hook arguments, never an observed child model. Records are limited to 128 calls and 10 minutes in this MCP process; `not_observed` can also mean another process, restart, expiry, eviction or mismatched input. It does not prove global Hook bypass. The process-wide `automatic_hook.last_result` is removed. No raw task, path, session ID or credential is returned.
|
|
316
345
|
|
|
317
346
|
For direct recommendations, you can include repository and file URLs alongside a summary of the scope, size, and constraints derived from reading the documents. Sending a URL string differs from providing document contents. Aptly's classification request code does not fetch repository URLs or retrieve their contents. The caller performs any required retrieval and summarization.
|
|
318
347
|
|
package/docs/guide/ja.md
CHANGED
|
@@ -203,16 +203,17 @@ aptly remove --client all
|
|
|
203
203
|
|
|
204
204
|
## 自動 Hook
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
**以下の事前確認・推薦・観測の動作は Aptly 0.1.4 以降で利用できます。** インストールした `PreToolUse` matcher は Codex の `spawn_agent` / `collaborationspawn_agent` / `Agent` と Claude Code の `Agent` を、native 実行前にローカルの `route_spawn_hook` へ渡します。ホストによる Hook の読み込み・信頼承認と MCP 接続が必要です。未設定・未対応のホストや MCP 接続失敗時まで Aptly が介入を強制することはできず、実行はホストが担当します。
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
| Claude Code | モデル・effort・固定ロール・resume・履歴継承の指定がない、`subagent_type: "general-purpose"` の呼び出し |
|
|
208
|
+
ローカルの事前確認で明示フィールド・ロール・resume・ポリシー・キャッシュ・予算を評価します。呼び出しごとに新しい有料 Decisions 要求が必要なわけではありません。Codex のモデルまたは effort だけが指定された場合は、一致する許可済みの組み合わせに候補を絞り、未指定フィールドだけを補います。両方の指定、未対応値、固定ロール、resume は分類せず保持します。入力だけからユーザー指定かホストのデフォルトかを断定しません。
|
|
209
|
+
|
|
210
|
+
モデル・effort が未指定なら `fork_turns: "all"` や fork の省略も推薦を評価します。ただし**履歴は変更しません**。Codex のモデル・effort 適用には明示的な `fork_turns: "none"` が必要です。それ以外は `inherited_context_application_unverified` として元の引数を保持します。他の履歴フィールドは `history_semantics_unverified` で適用を止め、Claude の適用も履歴制約のない汎用呼び出しに限ります。推薦の生成と適用は別です。
|
|
212
211
|
|
|
213
|
-
|
|
212
|
+
Codex の本文が不透明な場合、`cleanup_merged_worktrees` のような具体的な短い作業名だけでも推薦できます。短い名前は cleanup/remove/prune + merged + worktrees/branches、または review/fix/test + failing/broken/flaky + tests/builds の組み合わせに限定し、他は従来の6単語チェックを維持します。本文は復号も送信もしません。詳細条件や削除権限は推測しません。履歴継承時の適用は対象ホストで未検証であり、全バージョンで不可能という意味ではありません。公開ソースだけでは実行環境の対応を確認できません。
|
|
214
213
|
|
|
215
|
-
|
|
214
|
+
独立した作業の場合だけ、呼び出し側が十分な単独のタスク情報を渡し、新しい子を明示的に選択してください。Aptly は `all` を `none` に変更せず、履歴の削除や明示モデル・effort の上書きもしません。[合成の継承・新規子の例](../../examples/spawn-preflight.codex.json)は別々の要求であり、自動再試行ではありません。結果不明の有料呼び出しを新しい ID で再試行しないでください。
|
|
215
|
+
|
|
216
|
+
`defaults` は互換性のある引数更新を、`advisory` は推薦だけを許可します。継承や一部だけ指定した呼び出しも、適用できなくても制限付きタスク抜粋を Decisions に送信する場合があります。履歴継承は共有の無効化ではありません。ポリシー無効・文脈不足・予算制限・失敗・キャンセルでは実行制約を保持します。入力・ポリシー・カタログの結合、重複防止、結果不明の保護を維持し、fixture の推薦で native のデフォルトを変更しません。自動ポリシーのない strict 証拠経路は別であり、ホスト内部のパッチは引き続き保留です。
|
|
216
217
|
|
|
217
218
|
| MCP ツール | 用途 |
|
|
218
219
|
|---|---|
|
|
@@ -220,6 +221,10 @@ aptly remove --client all
|
|
|
220
221
|
| `recommend_agent` | タスク要約から直接推薦を取得します |
|
|
221
222
|
| `get_routing_precedence` | 呼び出しを保持する根拠と、未確認の設定元を説明します |
|
|
222
223
|
| `route_spawn_hook` | インストールしたポリシーに応じて、対象呼び出しのデフォルト値を選択するか、推薦だけを伝えます |
|
|
224
|
+
| `get_spawn_routing_observation` | 一致する Hook 呼び出しを照会し、native 実行を証明しません |
|
|
225
|
+
| `prepare_spawn_context` | 正確に一致する予定呼び出しに上限付きの説明を登録します |
|
|
226
|
+
| `cancel_spawn_context` | 説明の対応付けを取り消します。native 実行や送信済みリクエストは取り消しません |
|
|
227
|
+
| `retry_spawn_recommendation` | Hook が返す retry_id を使い、タスク説明を一度補って再推薦します |
|
|
223
228
|
|
|
224
229
|
### 外部送信と自動共有の無効化
|
|
225
230
|
|
|
@@ -235,6 +240,30 @@ Decisions には `client`、`task.summary`、`task.operation`、`task.context_su
|
|
|
235
240
|
|
|
236
241
|
台帳と Hook バインディングにはリクエストのメタデータ・ハッシュ・キャッシュ結果を保存し、タスクの抜粋は保存しません。Aptly の診断にもタスク原文を含めません。ただし、ローカルの Hook の `updatedInput` は、ホストが実行を続けられるよう元のタスクを保持します。ホスト自身の会話やログの保存は Aptly の制御対象ではありません。
|
|
237
242
|
|
|
243
|
+
### 不透明な呼び出しへの明示的な説明(0.1.4 以降)
|
|
244
|
+
|
|
245
|
+
実際の予定セッション・呼び出し ID と元のイベントを知る連携は、Hook の前に同じ MCP プロセスで `prepare_spawn_context({client, event, description})` を呼べます。目的・範囲・出力・制約・複雑さを短く記述してください。URL の内容は取得しません。上限付き説明と固定接頭文だけが抜粋を置き換え、履歴・ファイル・不透明な本文は送信しません。`cancel_spawn_context({client, event})` で取り消せます。有効な自動ポリシーが必要で、`enabled: false` は共有を止めます。既知の秘密パターン検査は完全ではありません。
|
|
246
|
+
|
|
247
|
+
対応付けは5分間有効で変更不可、プロセスごとに最大128件です。入力変更・期限切れ・取消時は分類を止め、評価済みの呼び出しを説明変更で有料再試行しません。実際の予定イベントを取得できない呼び出し元は利用できません。標準 Hook は説明や呼び出し ID を作成しません。ローカルの `insufficient_context`、プロバイダーの `provider_needs_context`、適用時の `inherited_context_application_unverified` は別の結果です。限定的な native 説明受け渡しの検証は[契約](../SPAWN_CONTEXT.md)に記録しています。この検証は、説明の自動生成や推薦モデルの実行を証明するものではありません。
|
|
248
|
+
|
|
249
|
+
### 文脈を補って再推薦する(0.1.5 以降)
|
|
250
|
+
|
|
251
|
+
自動 Hook が `insufficient_context` または `provider_needs_context` を返すと、`retry_id` と補足手順を提示します。`defaults` ではその生成呼び出しを拒否し、`advisory` では案内だけを返します。親エージェントは既知の情報から目的・範囲・期待する出力・複雑さを短く説明し、5分以内に同じ MCP プロセスで `retry_spawn_recommendation({retry_id, description})` を呼んでください。将来の native 呼び出し ID は不要です。本当に情報が不足する場合だけユーザーに質問してください。
|
|
252
|
+
|
|
253
|
+
元の呼び出しごとに補足は一度だけです。同じ入力はキャッシュを再利用し、説明の変更は競合として拒否します。再推薦も文脈不足または失敗なら終了し、結果不明の有料要求を新しい ID で繰り返さないでください。`spawn_application` が `blocked` なら推薦を適用せず制約を報告してください。それ以外も親は明示的な選択・履歴・役割・権限を保ち、新しい互換 native 呼び出しに未指定のモデル・effort だけを渡す必要があります。Hook 自体が親の再要求や native 実行を行うわけではありません。元の `prepare_spawn_context` の対応付けは変更不可のままです。[制限・費用・検証契約](../SPAWN_CONTEXT.md#one-context-supplement-after-a-hook-response)を参照してください。
|
|
254
|
+
|
|
255
|
+
再推薦の応答は `next_call.set_if_unspecified` に次の native 呼び出しで補う具体的な未指定フィールドを返します。明示済みのモデル・effort は含めず、Claude に effort を追加しません。履歴などで適用できない結果には `next_call` を返しません。実行証拠や権限承認ではありません。
|
|
256
|
+
|
|
257
|
+
`context_retry_allowed: false` は追加の文脈補足を終了する意味です。互換性のある推薦の `caller_review_required` は親が引数を確認する意味であり、新しいユーザー承認の要求ではありません。既存の委任権限とホストの権限確認は引き続き適用されます。
|
|
258
|
+
|
|
259
|
+
### 自動ルーティングの保証範囲と拒否結果(0.1.5 以降)
|
|
260
|
+
|
|
261
|
+
保証は、有効かつ信頼済みの Hook が接続中の MCP で処理する対応呼び出しに限ります。`get_routing_capabilities.automatic_hook.guarantee` で範囲を確認してください。サーバーは未登録・未信頼・切断・ホスト側で失敗した Hook を検出したり強制したりできず、その後の処理はホストが決めます。MCP の接続表示だけでは個別呼び出しの経由を証明できません。
|
|
262
|
+
|
|
263
|
+
有効なポリシーと対象呼び出しを確認した後、`defaults` は適用不能・予算超過・分類失敗・結果不明を `deny` と安全な理由コードで返します。元の引数と制約は保持しますが、その生成は実行しません。継承履歴の互換性が未検証なら、親のデフォルトで黙って実行したり `none` に切り替えたりせず、制約を報告してください。`advisory` は拒否せず同じ制限を説明します。ポリシー未設定・無効、明示タプル・固定役割・resume は意図的なローカル保持経路であり、一律には拒否しません。
|
|
264
|
+
|
|
265
|
+
復旧 ID があれば、同じ MCP プロセスで `get_spawn_routing_observation({retry_id})` を呼べます。従来の `{client, event}` 形式も使えますが、混在や不完全な入力は拒否します。元の `awaiting_context` と `context_retry.outcome` は別の段階です。拒否した重複要求は `last_attempt` に記録し、以前の分類結果を上書きしません。照会は有料要求を発行せず、保持期限も延長しません。実行は常に `not_observed` であり、推薦や引数更新は実際の子の実行証拠ではありません。
|
|
266
|
+
|
|
238
267
|
## 直接推薦
|
|
239
268
|
|
|
240
269
|
`recommend_agent` MCP と CLI の `recommend` は、タスク要約を受け取ってプロファイルを推薦します。子エージェントを直接生成することはありません。以下の JSON を MCP ツールの引数として渡すか、ファイルに保存して CLI の標準入力に渡してください。
|
|
@@ -310,9 +339,9 @@ export APTLY_MODEL_INFO_PATH=/absolute/private-aptly-state/model-info.json
|
|
|
310
339
|
|
|
311
340
|
## コンテキストの提供
|
|
312
341
|
|
|
313
|
-
Codex が子エージェントの `message` を暗号文として Hook に渡す環境では、本文を読み取ったり復号したりしません。この場合は、十分に具体的な平文の `task_name` だけを要約として使用します。たとえば `sort_supplied_numbers_3_1_2_ascending_without_tools`
|
|
342
|
+
Codex が子エージェントの `message` を暗号文として Hook に渡す環境では、本文を読み取ったり復号したりしません。この場合は、十分に具体的な平文の `task_name` だけを要約として使用します。たとえば `sort_supplied_numbers_3_1_2_ascending_without_tools` のように、タスクの種類と範囲を表します。未対応または曖昧なタスク名の場合は、元のモデルを保持します。Claude Code と平文の本文が渡される呼び出しでは、提供された本文の要約を使用します。
|
|
314
343
|
|
|
315
|
-
`
|
|
344
|
+
同じ `client` と元の Hook `event` を指定して `get_spawn_routing_observation` で対象呼び出しを照会します。ハッシュ化した相関 ID と、事前確認・分類/キャッシュ結果・推薦・引数更新/適用停止・`execution: not_observed` を区別して返します。`arguments_updated` は Hook が出力した引数だけを意味し、実際の子モデルの観測ではありません。記録は当該 MCP プロセスの直近 128 件・10 分に限られます。`not_observed` は別プロセス・再起動・期限切れ・削除・入力不一致でも発生し、全体の Hook 迂回を証明しません。プロセス共通の `automatic_hook.last_result` は削除します。タスク原文・パス・セッション ID・資格情報は返しません。
|
|
316
345
|
|
|
317
346
|
直接推薦では、リポジトリ・ファイルの URL と、ドキュメントを読んで整理したタスクの範囲・規模・制約を、要約に含めて提供できます。URL の文字列を送ることと、ドキュメントの本文を提供することは異なります。現在の Aptly の分類リクエスト処理コードは、リポジトリ URL を GET したり、ドキュメントを収集したりしません。必要なドキュメントの取得と要約は、呼び出し元が行います。
|
|
318
347
|
|
package/docs/guide/ko.md
CHANGED
|
@@ -203,16 +203,17 @@ aptly remove --client all
|
|
|
203
203
|
|
|
204
204
|
## 자동 Hook
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
**다음 사전 검사·추천·관측 동작은 Aptly 0.1.4부터 지원합니다.** 설치한 `PreToolUse` matcher는 Codex의 `spawn_agent` / `collaborationspawn_agent` / `Agent`와 Claude Code의 `Agent` 호출을 native 실행 전에 로컬 `route_spawn_hook`으로 전달합니다. 호스트가 Hook을 로드·신뢰하고 MCP를 연결해야 합니다. 미설정·미지원 호스트나 MCP 연결 실패까지 Aptly가 가로채도록 강제할 수는 없으며, 실행은 호스트가 담당합니다.
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
| Claude Code | 모델·effort·고정 역할·resume·이력 상속을 지정하지 않은 `subagent_type: "general-purpose"` 호출 |
|
|
208
|
+
로컬 사전 검사에서 명시 필드·역할·resume·정책·캐시·예산을 평가합니다. 매번 유료 Decisions 요청이 필요한 것은 아닙니다. Codex에서 모델이나 effort만 지정하면 일치하는 허용 튜플로 후보를 제한하고 미지정 필드만 채웁니다. 둘 다 지정하거나 값이 미지원인 경우, 고정 역할과 resume은 분류 없이 보존합니다. 입력 필드만으로 사용자 선택인지 호스트 기본값인지 단정하지 않습니다.
|
|
209
|
+
|
|
210
|
+
모델·effort가 미지정이면 `fork_turns: "all"`이나 fork 생략도 추천을 평가합니다. **이력 변경은 허용하지 않습니다.** Codex의 모델·effort 적용에는 명시적인 `fork_turns: "none"`이 필요합니다. 그 외에는 `inherited_context_application_unverified`을 알리고 원래 인자를 보존합니다. 다른 이력 필드는 `history_semantics_unverified`로 적용을 차단하며, Claude 적용도 이력 제약 없는 일반 호출로 한정합니다. 추천 성공과 실제 적용은 다릅니다.
|
|
212
211
|
|
|
213
|
-
|
|
212
|
+
Codex 본문이 불투명할 때 `cleanup_merged_worktrees`처럼 구체적인 짧은 작업명만으로도 추천할 수 있습니다. 짧은 이름은 cleanup/remove/prune + merged + worktrees/branches 또는 review/fix/test + failing/broken/flaky + tests/builds 조합만 허용하며, 나머지는 기존 6단어 검사를 유지합니다. 본문은 복호화하거나 전송하지 않습니다. 작업의 세부 조건이나 삭제 권한을 추론하지 않습니다. 이력 상속 상태의 적용은 대상 호스트에서 미검증이며, 모든 버전에서 불가능하다는 뜻은 아닙니다. 공개 소스만으로 설치된 런타임의 지원을 확정하지 않습니다.
|
|
214
213
|
|
|
215
|
-
|
|
214
|
+
독립적인 작업일 때만 호출자가 충분한 독립 작업 맥락을 제공하고 새 자식을 명시적으로 선택하십시오. Aptly는 `all`을 `none`으로 바꾸거나 이력을 제거하거나 명시한 모델·effort를 덮어쓰지 않습니다. [합성 상속·새 자식 예제](../../examples/spawn-preflight.codex.json)는 별개의 호출이며 자동 재시도가 아닙니다. 결과 불명인 유료 호출을 새 ID로 재시도하지 마십시오.
|
|
215
|
+
|
|
216
|
+
`defaults`는 호환되는 인자 변경을, `advisory`는 추천만 허용합니다. 상속 호출과 일부 필드만 지정한 호출도 적용 차단 여부와 관계없이 제한된 작업 발췌문을 Decisions에 전송할 수 있습니다. 이력 상속은 공유 거부 설정이 아닙니다. 정책 비활성화·맥락 부족·예산 제한·실패·취소에서는 실행 제약을 보존합니다. 입력·정책·카탈로그 결합, 중복 방지와 결과 불명 보호는 유지하며 fixture 추천으로 native 기본값을 바꾸지 않습니다. 자동 정책 없는 strict 증거 경로는 별개이며 호스트 내부 패치는 계속 보류합니다.
|
|
216
217
|
|
|
217
218
|
| MCP 도구 | 용도 |
|
|
218
219
|
|---|---|
|
|
@@ -220,6 +221,10 @@ aptly remove --client all
|
|
|
220
221
|
| `recommend_agent` | 작업 요약으로 프로필 추천을 받습니다 |
|
|
221
222
|
| `get_routing_precedence` | 호출의 보존 근거와 미확인 설정 출처를 설명합니다 |
|
|
222
223
|
| `route_spawn_hook` | 설치한 정책에 따라 대상 호출의 기본값을 선택하거나 추천만 전달합니다 |
|
|
224
|
+
| `get_spawn_routing_observation` | 정확히 일치하는 Hook 호출을 조회하며 native 실행을 증명하지 않습니다 |
|
|
225
|
+
| `prepare_spawn_context` | 정확한 예정 호출에 제한된 설명을 등록합니다 |
|
|
226
|
+
| `cancel_spawn_context` | 등록한 설명의 연결을 취소하며 native 실행이나 이미 전송된 요청을 취소하지 않습니다 |
|
|
227
|
+
| `retry_spawn_recommendation` | Hook의 `retry_id`로 작업 설명을 한 번 보충해 재추천합니다 |
|
|
223
228
|
|
|
224
229
|
### 외부 전송과 자동 공유 끄기
|
|
225
230
|
|
|
@@ -235,6 +240,30 @@ Decisions에는 `client`, `task.summary`, `task.operation`, `task.context_suffic
|
|
|
235
240
|
|
|
236
241
|
원장과 Hook 바인딩에는 요청 메타데이터·해시·캐시 결과를 저장하며 작업 발췌문을 저장하지 않습니다. Aptly의 진단 결과에도 원문을 넣지 않습니다. 다만 로컬 호스트가 실행을 이어가도록 Hook의 `updatedInput`에는 원래 작업이 유지됩니다. 호스트 자체의 대화·로그 저장은 Aptly가 제어하지 않습니다.
|
|
237
242
|
|
|
243
|
+
### 불투명 호출에 명시적 설명 전달 (0.1.4부터)
|
|
244
|
+
|
|
245
|
+
실제 예정된 세션·호출 ID와 원래 이벤트를 아는 연동은 Hook 전에 같은 MCP 프로세스에 `prepare_spawn_context({client, event, description})`를 호출할 수 있습니다. 목적·범위·결과물·제약·복잡도를 짧게 적으세요. URL의 내용은 가져오지 않습니다. 제한된 설명과 고정 접두문만 작업 발췌문을 대체하며, 이력·파일·불투명 본문은 보내지 않습니다. `cancel_spawn_context({client, event})`로 취소합니다. 자동 정책이 활성화되어야 하며 `enabled: false`는 공유를 차단합니다. 알려진 비밀 패턴 검사만으로 완전한 보호를 보장하지 않습니다.
|
|
246
|
+
|
|
247
|
+
연결은 5분간 유효하고 변경할 수 없으며 프로세스당 최대 128개입니다. 입력 변경·만료·취소 시 분류를 중단하고, 이미 평가한 호출에 설명을 바꿔 유료 재시도하지 않습니다. 실제 예정 이벤트를 알 수 없는 호출자는 사용할 수 없습니다. 기본 Hook은 설명이나 호출 ID를 만들지 않습니다. 로컬 `insufficient_context`, 공급자 `provider_needs_context`, 실제 적용의 `inherited_context_application_unverified`는 서로 다릅니다. 제한된 native 설명 전달 검증은 [전달 계약](../SPAWN_CONTEXT.md)에 기록했습니다. 이 검증은 기본 설명의 자동 생성이나 추천 모델의 실행을 증명하지 않습니다.
|
|
248
|
+
|
|
249
|
+
### 맥락 보충 후 재추천 (0.1.5부터)
|
|
250
|
+
|
|
251
|
+
자동 Hook이 `insufficient_context` 또는 `provider_needs_context`를 반환하면 `retry_id`와 보충 안내를 제공합니다. `defaults`에서는 해당 스폰을 차단하고, `advisory`에서는 안내만 전달합니다. 부모 에이전트는 이미 아는 작업 목적·범위·결과물·복잡도를 짧게 작성해 같은 MCP 프로세스에서 5분 안에 `retry_spawn_recommendation({retry_id, description})`를 호출하십시오. 미래 native 호출 ID는 필요하지 않습니다. 실제로 정보가 없을 때만 사용자에게 질문하십시오.
|
|
252
|
+
|
|
253
|
+
보충은 원래 호출당 한 번이며 동일 입력은 캐시를 재사용하고 변경한 설명은 충돌로 거부합니다. 재추천도 `needs_context`이거나 실패하면 중단하십시오. 결과 불명인 요청을 새 ID로 반복하지 마십시오. `spawn_application`이 `blocked`이면 추천을 적용하지 말고 제약을 보고하십시오. 적용 가능한 추천도 부모가 명시 선택·이력·역할·권한을 보존하며 새 native 호출에 미지정 모델·effort만 전달해야 합니다. Hook이 부모의 재호출이나 실제 실행까지 자동 수행하지는 않습니다. 원래 `prepare_spawn_context` 연결은 여전히 변경할 수 없습니다. [한계·비용·검증 계약](../SPAWN_CONTEXT.md#one-context-supplement-after-a-hook-response)을 확인하십시오.
|
|
254
|
+
|
|
255
|
+
재추천 응답의 `next_call.set_if_unspecified`는 다음 native 호출에 넣을 미지정 필드만 제공합니다. 명시한 모델·effort는 포함하지 않으며 Claude에는 effort를 추가하지 않습니다. 이력 등으로 적용이 막히면 `next_call`을 제공하지 않습니다. 이 값은 실행 결과나 권한 승인이 아닙니다.
|
|
256
|
+
|
|
257
|
+
`context_retry_allowed: false`는 추가 설명 보충을 더 허용하지 않는다는 뜻입니다. 호환 가능한 추천에서 `caller_review_required`는 부모가 인자를 검토한다는 의미이며 새 사용자 승인을 요구하지 않습니다. 기존 위임 권한과 호스트 권한 검사는 그대로 유지됩니다.
|
|
258
|
+
|
|
259
|
+
### 자동 경유의 보장 범위와 차단 결과 (0.1.5부터)
|
|
260
|
+
|
|
261
|
+
활성화되고 신뢰된 Hook이 연결된 MCP에서 지원 호출을 처리하는 범위만 보장합니다. `get_routing_capabilities.automatic_hook.guarantee`로 이 범위를 확인하십시오. Hook 미등록·미신뢰·연결 해제·호스트 오류는 서버가 탐지하거나 강제로 차단할 수 없으며 호스트가 후속 처리를 결정합니다. MCP 연결 표시만으로 개별 호출의 경유를 판단하지 마십시오.
|
|
262
|
+
|
|
263
|
+
유효한 활성 정책과 지원 대상이 확인된 뒤, `defaults`는 추천 적용 불가·예산 초과·분류 실패·결과 불명 등을 `deny`와 안전한 사유 코드로 알립니다. 원래 인자와 제약은 유지하지만 해당 스폰은 진행하지 않습니다. 상속 이력이 미검증이면 부모 모델로 조용히 실행하거나 `none`으로 변경하지 말고 제약을 보고하십시오. `advisory`는 차단 없이 같은 한계를 설명합니다. 정책 미설정·비활성화, 명시 튜플·고정 역할·resume은 의도적인 로컬 보존 경로이며 일괄 차단하지 않습니다.
|
|
264
|
+
|
|
265
|
+
복구 ID가 있으면 `get_spawn_routing_observation({retry_id})`로 같은 MCP 프로세스의 관측을 조회할 수 있습니다. 또는 기존 `{client, event}`를 사용하십시오. 두 형식을 섞거나 일부만 보내면 거부합니다. 원래 `awaiting_context`와 `context_retry.outcome`은 별개이며, 거부된 중복 요청은 `last_attempt`에 표시해 이전 분류 결과를 덮어쓰지 않습니다. 조회는 유료 요청을 만들지 않고 보관 시간을 연장하지 않습니다. 실행은 항상 `not_observed`이므로 추천이나 인자 갱신을 실제 자식 실행으로 표현하지 마십시오.
|
|
266
|
+
|
|
238
267
|
## 직접 추천
|
|
239
268
|
|
|
240
269
|
`recommend_agent` MCP와 CLI `recommend`는 작업 요약을 받아 프로필을 추천합니다. 자식을 직접 생성하지 않습니다. 아래 JSON을 MCP 도구 인자로 전달하거나 파일에 저장해 CLI의 표준 입력으로 제공하십시오.
|
|
@@ -310,9 +339,9 @@ export APTLY_MODEL_INFO_PATH=/absolute/private-aptly-state/model-info.json
|
|
|
310
339
|
|
|
311
340
|
## 맥락 전달
|
|
312
341
|
|
|
313
|
-
Codex가 자식 `message`를 암호문으로 Hook에 전달하는 환경에서는 본문을 읽거나 해독하지 않습니다. 이 경우 충분히 구체적인 평문 `task_name`만 요약으로 사용합니다. 예를 들어 `sort_supplied_numbers_3_1_2_ascending_without_tools`처럼 작업 종류와 범위를 설명하십시오.
|
|
342
|
+
Codex가 자식 `message`를 암호문으로 Hook에 전달하는 환경에서는 본문을 읽거나 해독하지 않습니다. 이 경우 충분히 구체적인 평문 `task_name`만 요약으로 사용합니다. 예를 들어 `sort_supplied_numbers_3_1_2_ascending_without_tools`처럼 작업 종류와 범위를 설명하십시오. 지원하지 않거나 모호한 작업명은 원래 모델을 유지합니다. Claude Code와 평문 본문이 전달되는 호출은 제공된 본문 요약을 사용합니다.
|
|
314
343
|
|
|
315
|
-
`
|
|
344
|
+
동일한 `client`와 원래 Hook `event`로 `get_spawn_routing_observation`을 호출해 해당 호출을 조회하십시오. 식별자는 해시로 반환하며 사전 검사, 분류·캐시 결과, 추천, 인자 변경·적용 차단과 `execution: not_observed`를 구분합니다. `arguments_updated`는 Hook 출력 인자만 뜻하며 실제 자식 모델 관측이 아닙니다. 기록은 해당 MCP 프로세스의 최근 128개·10분으로 제한합니다. `not_observed`는 다른 프로세스·재시작·만료·퇴출·입력 불일치 때문일 수도 있으므로 전체 Hook 우회를 증명하지 않습니다. 프로세스 공용 `automatic_hook.last_result`는 제거합니다. 원문 작업·경로·세션 ID·자격 값은 반환하지 않습니다.
|
|
316
345
|
|
|
317
346
|
직접 추천에는 저장소·파일 URL과 문서를 읽고 정리한 작업 범위·규모·제약을 요약에 함께 제공할 수 있습니다. URL 문자열을 보내는 것과 문서 본문을 제공하는 것은 다릅니다. 현재 Aptly의 분류 요청 처리 코드는 저장소 URL을 GET하거나 문서를 수집하지 않습니다. 필요한 문서 조회와 요약은 호출자가 수행합니다.
|
|
318
347
|
|