aptly 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,126 @@
1
+ # Explicit spawn context handoff (Aptly 0.1.4)
2
+
3
+ Available from Aptly 0.1.4, following the pre-spawn routing changes in #60.
4
+ It does not decode opaque messages, inspect conversations or modify host
5
+ internals. It provides an explicit caller protocol, not an automatic description
6
+ producer for the shipped Hook templates.
7
+
8
+ ## Supported caller contract
9
+
10
+ A caller/integration that knows the **real upcoming** client, session ID, native
11
+ call ID and exact original invocation can call these tools on the same MCP
12
+ server process, in order:
13
+
14
+ 1. `prepare_spawn_context({client, event, description})`: register a short
15
+ description before the installed PreToolUse Hook runs. Check for
16
+ `status: "registered"`. Registration makes no provider request.
17
+ 2. The existing Hook calls `route_spawn_hook({client, event})` with that exact
18
+ event. It can use the registered description instead of the label/excerpt.
19
+ 3. `get_spawn_routing_observation({client, event})` reports the result separately
20
+ from native application/execution. Use `cancel_spawn_context({client, event})`
21
+ to revoke the association if the intended spawn is abandoned.
22
+
23
+ Do not manually route and then invoke an unrelated native call: an MCP response
24
+ does not prove that a host Hook intercepted or updated it. The caller description
25
+ is untrusted task data, not permissions, policy, host capability or verified user
26
+ intent. Explicit pins, roles, resume and inherited history remain protected.
27
+
28
+ The shipped Hook templates do not produce descriptions or preassign native call
29
+ IDs. If an integration cannot obtain the exact event before preflight, or connects
30
+ to a different MCP process, this handoff cannot be used. In particular, a parent
31
+ agent cannot invent IDs or add unsupported fields to a native spawn to make this
32
+ work. Such paths retain the existing label/excerpt behavior. No automatic
33
+ integration with the original Mac host is claimed.
34
+
35
+ ## What to describe and what is shared
36
+
37
+ Use purpose, bounded scope, expected output, constraints and relevant complexity.
38
+ For example:
39
+
40
+ > Inspect three synthetic merged branches and their worktrees. Return a short
41
+ > table proposing which could be cleaned up. Do not delete files or run commands.
42
+ > No repository contents are needed.
43
+
44
+ Only this description, prefixed as caller-supplied untrusted task data, is sent as
45
+ task text. The existing client/catalog/provider contract is also sent. Neither
46
+ the opaque body, original label, history, event metadata, files nor raw errors are
47
+ added. References can supplement the description; URLs are not fetched and do
48
+ not substitute for describing the task.
49
+
50
+ Descriptions are at most `min(3800, max_summary_bytes - 96)` UTF-8 bytes, with a
51
+ small minimum length/word check. The prefixed summary must also satisfy
52
+ `min(4000, max_summary_bytes)`. Known key/Bearer patterns are rejected; this is
53
+ not complete secret detection or anonymization. Review text before registration.
54
+ An enabled automatic policy is required; `enabled: false` blocks registration
55
+ and transmission even if an association already exists.
56
+
57
+ ## Association, expiry and costs
58
+
59
+ The process keeps at most 128 immutable associations. Five-minute expiry starts
60
+ at first registration; a duplicate does not extend it. Changed payloads for the
61
+ same client/session/call are rejected, not rebound. Cancellation and expiry
62
+ leave tombstones until process exit; capacity rejects new registrations rather
63
+ than evicting a binding and silently falling back. Expired text is discarded
64
+ when the store is accessed; nothing is enumerated or written to disk as text.
65
+ A restart loses the handoff. The persistent paid-call binding still prevents a
66
+ context-free request from replacing an already evaluated context-bound call.
67
+
68
+ A summary hash joins the existing immutable input/policy/catalog binding before
69
+ classification. Duplicate calls use the same request/cache identity and budgets;
70
+ changed or missing context cannot replace it. Context is checked before and
71
+ after the asynchronous provider call. Expiry/cancellation prevents output but
72
+ cannot refund or erase a provider request already sent. Revocation does not
73
+ cancel native execution; the host controls execution.
74
+
75
+ There is no richer-summary retry mechanism in this change. Register before the
76
+ first evaluation. If a label-only or description-bound evaluation already
77
+ started, adding/changing the description fails closed (`call_conflict`);
78
+ unknown paid outcomes remain unknown. Do not change IDs to bypass this guard.
79
+ A future deliberate re-evaluation workflow needs its own explicit association
80
+ and accounting design.
81
+
82
+ ## Outcomes and evidence
83
+
84
+ - `insufficient_context`: local description/size/context checks failed.
85
+ - `provider_needs_context`: a valid provider abstention; its rationale is not
86
+ inferred, and useful-looking text does not guarantee a recommendation.
87
+ - `inherited_context_application_unverified`: advice can be available while
88
+ the native model/history update remains unverified and blocked.
89
+
90
+ Automated tests use synthetic opaque strings, injected providers, mocked
91
+ Decisions HTTP and in-memory MCP transport. They verify shared summaries,
92
+ identity, cancellation, bounds and cache/unknown protections. The separate
93
+ native observation below does not turn those fixtures into native evidence.
94
+
95
+ ### Bounded native protocol verification — 2026-11-06
96
+
97
+ A macOS Codex CLI 0.167.0 test used product commit
98
+ `efae8211f6d92b9a9619886c80792d4e1b737d4d`. The installed Hook was enabled and
99
+ trusted without changing its trust settings. A test-only MCP transport adapter
100
+ captured the real host event, registered the description on the same product
101
+ server, and then forwarded the original `route_spawn_hook` request. It did not
102
+ invent IDs, decode the opaque body, alter Hook responses or patch host code.
103
+
104
+ The safe synthetic description requested extraction of a nonsecret marker
105
+ from earlier conversation history and output of `[1, 2, 3]`, with no tools,
106
+ files, network access, settings changes or real worktree deletion. An HTTP
107
+ boundary recorder confirmed exactly one forwarded Decisions request whose task
108
+ text was the labelled description, with no opaque body or native event fields.
109
+ Registration and observation correlation matched the actual invocation.
110
+
111
+ The provider selected `codex-simple` (`gpt-6-luna` / `max`). Application remained
112
+ blocked as `inherited_context_application_unverified` for `fork_turns: "all"`.
113
+ The native child's final context remained `gpt-6.1-sol` / `low`, matching the
114
+ parent. Parent linkage, exact copying of the marker-bearing parent user payload,
115
+ and the child's final marker/list response were independently checked.
116
+
117
+ This is one protocol and payload verification, not a provider-quality benchmark,
118
+ a causal comparison with label-only advice, or successful application of the
119
+ recommended model. The test used two parent turns and one child; temporary
120
+ files were removed and persistent host configuration was unchanged.
121
+
122
+ This validates a caller that can capture the exact event before product
123
+ preflight. The adapter does not ship an automatic description producer, and
124
+ ordinary parent agents still cannot invent the required IDs. PR #60's separate
125
+ history/model application acceptance and merge order must be resolved before
126
+ merging this dependent change. No richer-summary retry workflow is enabled.
package/docs/guide/en.md CHANGED
@@ -13,7 +13,7 @@ Requires Node.js 24 or later and Claude Code or Codex. Install the latest stable
13
13
  **Before upgrading an existing persistent ledger to 0.1.2 or later**, stop every host, MCP server, standalone CLI, and older process that can access it. The persistent gate cannot coexist with older writers. Fresh installations need no legacy-lock quarantine. If an old empty lock remains, follow the [ledger transition procedure](#interrupted-processes-and-ledger-locks): quarantine only a confirmed legacy lock while offline and preserve the JSON ledger, `unknown` records, costs, and completed cache.
14
14
 
15
15
  ```sh
16
- npm install -g aptly@latest
16
+ npm install -g aptly@latest --allow-scripts=aptly
17
17
  aptly setup --client all --mode defaults
18
18
  aptly --version
19
19
  ```
@@ -24,6 +24,41 @@ Use `aptly --version` to check the installed version. Switching Node.js environm
24
24
 
25
25
  New registrations set `ROUTER_PROVIDER=decisions`, the Hook's `defaults` policy, and a private ledger for each host. Other settings and Hooks, and existing Aptly commands, environments, providers, and ledger paths, are preserved. Existing fixture settings are not automatically switched to paid mode.
26
26
 
27
+ ### npm install-script approval
28
+
29
+ The installation command above uses `--allow-scripts=aptly` to explicitly allow Aptly's `postinstall` for that installation. Support was checked with npm 11.19.1; the command does not change user-wide npm approval settings. See the [official npm guidance](https://docs.npmjs.com/cli/v11/commands/npm-rebuild/#allow-scripts).
30
+
31
+ `npm warn install-scripts ... not yet covered by allowScripts` reports an unreviewed policy entry. In npm 11.19.1, this warning alone does not mean scripts were blocked. Behavior depends on npm version, strict policy, and `ignore-scripts`; installation success alone does not verify MCP or Hook registration. npm may hide postinstall output.
32
+
33
+ For npm versions without this option, or to configure explicitly instead of automatic registration, run:
34
+
35
+ ```sh
36
+ npm install -g aptly@latest --ignore-scripts
37
+ aptly setup --client all --mode defaults
38
+ ```
39
+
40
+ Explicit `setup` works regardless of lifecycle execution. It preserves existing launchers; use the recovery steps below for stale paths. Key setup, MCP restart, and Codex `/hooks` trust review remain separate steps.
41
+
42
+ ### Package updates
43
+
44
+ `aptly update` requires **Aptly 0.1.3 or later**. It requires a verified global npm installation and installs `aptly@latest` into the same verified prefix as the running package. Local installations, source checkouts, and unverified paths are rejected. If the effective npm configuration has `dry-run=true`, the command refuses with `update_dry_run_enabled` before starting installation. If configuration cannot be verified, it stops with `update_configuration_unverified`. A dry-run is never reported as a successful update.
45
+
46
+ Stop other host, MCP, and CLI processes using the ledger before updating, following the transition steps above. The command skips lifecycle scripts; explicitly configure afterward and restart hosts:
47
+
48
+ ```sh
49
+ aptly update
50
+ aptly setup --client all --mode defaults
51
+ aptly --version
52
+ ```
53
+
54
+ Existing MCP launchers and user wrappers are not automatically migrated. Follow the launcher recovery instructions below if old paths remain. Key setup and Codex `/hooks` trust review remain separate. For npm authentication, network, or permission failures, use the manual installation instructions. Updates are never installed automatically.
55
+
56
+ ### New-version notifications
57
+
58
+ **Aptly 0.1.3 or later** checks the latest stable version during interactive human-facing CLI commands and suggests `aptly update` on stderr when a newer version exists. All three standard streams must be terminals. MCP serving, automatic setup, recommendation/classification paths, pipes, and CI skip checks. JSON stdout and MCP/Hook payloads stay unchanged.
59
+
60
+ Only public Aptly version metadata is requested from the npm registry; no key, task summary, or host configuration is sent. Network and body reads are limited to 800ms and 16KiB. Results are cached at `~/.cache/aptly/update-check.json` for 24 hours, with a one-hour cooldown after failure. Network/cache errors cannot fail the requested command. Set `APTLY_NO_UPDATE_NOTIFIER=1` in the CLI environment to disable checks; it is not a supported key for `aptly set env`. Notifications never install updates.
61
+
27
62
  ### Configure with the CLI
28
63
 
29
64
  The `set` commands require 0.1.1 or later. Commands do not automatically switch existing launch paths. API-key setup accepts only the current package’s standard Node/server registration with a verified OS-source-compatible runtime. Custom wrappers, older versions, and other installation prefixes are rejected with `credential_launcher_unverified`; explicitly switch the registration or upgrade it before trying again.
@@ -75,6 +110,15 @@ aptly set env OPENAI_API_KEY --client claude
75
110
 
76
111
  `--dry-run` makes no changes. Migration replaces the Node/server paths of a receipt-matching, Aptly-owned standard registration with the current build. It preserves environment settings, Hooks, policy and other hosts, accesses no credentials, and never executes the old launcher. Custom wrappers and missing or modified ownership records are rejected. Review such registrations locally; use the wrapper's secure environment or a separately reviewed standard registration. Do not edit or delete ownership records to bypass validation.
77
112
 
113
+ If `launcher_migration_not_owned` refers to a preserved registration (`mcp_created: false`), **Aptly 0.1.3 or later** offers the explicit `--include-existing` opt-in. Install 0.1.3 or later, then run:
114
+
115
+ ```sh
116
+ aptly setup --client claude --migrate-launcher --include-existing --dry-run
117
+ aptly setup --client claude --migrate-launcher --include-existing
118
+ ```
119
+
120
+ Review the local registration first. A valid existing Aptly ownership receipt and matching managed environment additions, Hook, and policy are required. Only an absolute Node path with a single standard server path is accepted; wrappers and registrations without a receipt remain unsupported. This does not make the entire MCP registration Aptly-owned: later removal preserves the migrated launcher and original user settings. The option applies only to explicit single-client migration, never automatic installation.
121
+
78
122
  A successful Codex configuration needs no reset. Retry only the affected host and restart MCP. Codex still requires `/hooks` trust review. Changes after diagnosis stop with `concurrent_configuration_change`. If recovery observes another key or cannot read the current key, it leaves the store unchanged and reports `credential_rollback_failed`. Files and the OS store do not form an atomic transaction; avoid concurrent configuration operations.
79
123
 
80
124
  ### Keys and restarting
@@ -159,16 +203,17 @@ aptly remove --client all
159
203
 
160
204
  ## Automatic Hook
161
205
 
162
- Connected, eligible calls automatically pass through `route_spawn_hook` → Decisions. The `defaults` policy lets an operator authorize Aptly's choice to take precedence over host defaults within this scope. It is not a claim that all host configuration sources have been observed.
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.
163
207
 
164
- | Host | Calls eligible for automatic selection |
165
- |---|---|
166
- | Codex | Fresh, general-purpose calls with no explicit model, effort, fixed role, or resume target, and `fork_turns: "none"` |
167
- | 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.
168
211
 
169
- Explicit choices, roles, fork and resume settings, approvals, sandboxing, and MCP permissions are preserved. Fixture results never automatically change the default model. Insufficient context, unsupported responses, cancellation, or a changed call preserve the original arguments. Each call is bound to its input, policy, and catalog, and checked again after an asynchronous response.
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.
170
213
 
171
- The CLI without additional configuration, and existing manual configurations, default to fixture / shadow. The older host-evidence-based path without an automatic policy is distinct from the installed default-selection policy. Host-internal patches remain on hold and are not a prerequisite for direct recommendations.
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.
172
217
 
173
218
  | MCP tool | Purpose |
174
219
  |---|---|
@@ -176,6 +221,9 @@ The CLI without additional configuration, and existing manual configurations, de
176
221
  | `recommend_agent` | Returns a direct recommendation for a task summary |
177
222
  | `get_routing_precedence` | Explains preserved choices and unverified configuration sources for a call |
178
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 |
179
227
 
180
228
  ### Outbound data and disabling automatic sharing
181
229
 
@@ -191,6 +239,12 @@ For control over the shared summary, disable automatic sharing and write only th
191
239
 
192
240
  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.
193
241
 
242
+ ### Explicit description for opaque spawns (0.1.4+)
243
+
244
+ 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.
245
+
246
+ 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
+
194
248
  ## Direct recommendations
195
249
 
196
250
  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.
@@ -266,9 +320,9 @@ Refresh only reads the fixed [Claude model documentation](https://code.claude.co
266
320
 
267
321
  ## Providing context
268
322
 
269
- 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`. Short or ambiguous names preserve the original model. Claude Code calls and calls that expose a plaintext body use a summary of the provided body.
323
+ 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.
270
324
 
271
- Use `automatic_hook.last_result` in `get_routing_capabilities` to check the last application or preservation reason for that MCP process. `null` means it has not yet processed an automatic Hook call. Task bodies and personal configuration values are not returned.
325
+ 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.
272
326
 
273
327
  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.
274
328
 
package/docs/guide/ja.md CHANGED
@@ -13,7 +13,7 @@ Node.js 24 以上と Claude Code または Codex が必要です。npm の最新
13
13
  **既存の永続台帳を 0.1.2 以降に更新する前に**、その台帳にアクセスする可能性があるすべてのホスト、MCP サーバー、単独 CLI、旧版プロセスを停止してください。新しい永続ロックは旧版の書き込み側と併用できません。新規インストールでは旧ロックの隔離は不要です。旧版の空のロックが残る場合は、[台帳の移行手順](#プロセス中断と台帳ロック)に従い、確認済みの旧ロックだけをオフラインで隔離し、JSON 台帳、`unknown` 記録、費用、完了済みキャッシュを保持してください。
14
14
 
15
15
  ```sh
16
- npm install -g aptly@latest
16
+ npm install -g aptly@latest --allow-scripts=aptly
17
17
  aptly setup --client all --mode defaults
18
18
  aptly --version
19
19
  ```
@@ -24,6 +24,41 @@ aptly --version
24
24
 
25
25
  新規登録では `ROUTER_PROVIDER=decisions`、Hook の `defaults` ポリシー、ホストごとの非公開台帳を指定します。他の既存設定・Hook と、既存の Aptly のコマンド・環境・provider・台帳パスは保持します。既存の fixture 設定を自動で有料モードに切り替えることはありません。
26
26
 
27
+ ### npm インストールスクリプトの許可
28
+
29
+ 上記の `--allow-scripts=aptly` は、そのインストールで Aptly の `postinstall` を明示的に許可します。npm 11.19.1 で対応を確認しており、ユーザー全体の npm 許可設定は変更しません。[npm 公式ガイド](https://docs.npmjs.com/cli/v11/commands/npm-rebuild/#allow-scripts)を参照してください。
30
+
31
+ `npm warn install-scripts ... not yet covered by allowScripts` は、許可ポリシーに未登録であることを示します。npm 11.19.1 では、この警告だけでスクリプトがブロックされたとは判断できません。npm のバージョン・厳格なポリシー・`ignore-scripts` によって挙動が異なり、インストール成功だけでは MCP・Hook の登録成功を確認できません。postinstall の出力は npm によって非表示になる場合があります。
32
+
33
+ このオプションに未対応の npm を使う場合や、自動登録の代わりに手動設定する場合は、次を実行してください。
34
+
35
+ ```sh
36
+ npm install -g aptly@latest --ignore-scripts
37
+ aptly setup --client all --mode defaults
38
+ ```
39
+
40
+ スクリプトの実行にかかわらず、明示的な `setup` を利用できます。既存の起動パスは保持するため、旧パスのエラーは以下の復旧手順に従ってください。キー設定・MCP の再起動と Codex の `/hooks` 信頼確認は別途必要です。
41
+
42
+ ### パッケージの更新
43
+
44
+ `aptly update` は **Aptly 0.1.3 以降で利用できます**。確認済みの npm グローバルインストールが必要で、実行中のパッケージと一致する確認済み prefix に `aptly@latest` をインストールします。ローカルインストール・ソースチェックアウト・確認できないパスは拒否します。 npm の有効な設定が `dry-run=true` の場合は、インストール前に `update_dry_run_enabled` で拒否します。設定を確認できない場合は `update_configuration_unverified` で停止し、試行のみの実行を更新成功とは報告しません。
45
+
46
+ 更新前に、上記の台帳移行手順に従い、台帳を使用する他のホスト・MCP・CLI プロセスを停止してください。インストールスクリプトは実行しないため、更新後に明示的に設定し、ホストを再起動してください。
47
+
48
+ ```sh
49
+ aptly update
50
+ aptly setup --client all --mode defaults
51
+ aptly --version
52
+ ```
53
+
54
+ 既存の MCP 起動パスやユーザーラッパーは自動移行しません。旧パスが残る場合は以下の復旧手順に従ってください。キー設定と Codex の `/hooks` 信頼確認は別途必要です。npm の認証・ネットワーク・権限エラーが発生した場合は手動インストールの案内を使用してください。更新の自動インストールは行いません。
55
+
56
+ ### 新しいバージョンの通知
57
+
58
+ **Aptly 0.1.3 以降では**、対話形式の通常 CLI コマンドで最新の安定版を確認し、新版があれば stderr に `aptly update` を案内します。 標準入出力と標準エラー出力がすべてターミナルの場合のみ動作し、MCP サーバー・自動 setup・推薦や分類の経路・パイプ・CI では確認しません。JSON stdout と MCP・Hook の応答は変更しません。
59
+
60
+ 公開 npm レジストリから Aptly のバージョン情報のみを取得し、キー・タスク要約・ホスト設定は送信しません。ネットワークと応答読み取りは 800ms・16KiB に制限し、結果を `~/.cache/aptly/update-check.json` に 24 時間キャッシュします。失敗後は 1 時間待機し、通信・キャッシュエラーで元のコマンドを失敗させません。CLI の環境に `APTLY_NO_UPDATE_NOTIFIER=1` を設定すると確認を停止できます。この変数は `aptly set env` の対象ではありません。通知による自動更新は行いません。
61
+
27
62
  ### CLI による設定
28
63
 
29
64
  `set` コマンドは 0.1.1 以降で利用できます。既存の起動パスは自動で切り替えません。API キー設定は、現在のパッケージの標準 Node/サーバー登録で、OS 資格情報の参照に対応する実行環境だと確認できた場合にのみ使用できます。独自ラッパー、旧バージョン、別のインストール先は `credential_launcher_unverified` で拒否します。登録を明示的に切り替えるかアップグレードしてから、再度実行してください。
@@ -75,6 +110,15 @@ aptly set env OPENAI_API_KEY --client claude
75
110
 
76
111
  `--dry-run` は変更しません。移行は所有記録と一致する Aptly の標準登録に限り、Node・サーバーパスを現在のビルドへ更新します。環境設定・Hook・ポリシー・他のホストを保持し、資格情報へのアクセスや古い起動プログラムの実行は行いません。独自ラッパー、所有記録のない登録、変更済みの登録は拒否します。その場合は登録をローカルで確認し、ラッパーの安全な環境変数受け渡しを使うか、別途確認した標準登録へ切り替えてください。検証を回避するために所有記録を編集・削除しないでください。
77
112
 
113
+ `launcher_migration_not_owned` が既存の登録を保持した状態(`mcp_created: false`)を指す場合、**Aptly 0.1.3 以降では** `--include-existing` を明示して移行できます。0.1.3 以降をインストールし、次を実行してください。
114
+
115
+ ```sh
116
+ aptly setup --client claude --migrate-launcher --include-existing --dry-run
117
+ aptly setup --client claude --migrate-launcher --include-existing
118
+ ```
119
+
120
+ 実行前にローカルの登録を確認してください。有効な既存の Aptly 所有記録と、記録に一致する管理対象の環境変数・Hook・ポリシーが必要です。絶対 Node パスと単一の標準サーバーパスのみを許可し、ラッパーや記録のない登録は拒否します。MCP 登録全体を Aptly 所有には変更しないため、その後の削除でも移行後の起動パスと元のユーザー設定を保持します。明示的な単一ホストの移行専用で、自動インストールには適用されません。
121
+
78
122
  成功した Codex の再設定は不要です。失敗したホストだけを指定して再試行し、MCP を再起動してください。Codex では引き続き `/hooks` の信頼確認が必要です。診断後の設定変更は `concurrent_configuration_change` で中断します。復旧時に別のキーを検出した場合や現在値を読めない場合は上書きせず、`credential_rollback_failed` を返します。ファイルと OS ストアは原子的なトランザクションではないため、設定操作を同時に実行しないでください。
79
123
 
80
124
  ### キーと再起動
@@ -159,16 +203,17 @@ aptly remove --client all
159
203
 
160
204
  ## 自動 Hook
161
205
 
162
- 接続済みの対象呼び出しは、`route_spawn_hook` → Decisions を自動で経由します。`defaults` は、対象範囲でホストのデフォルトモデルより Aptly の選択を優先することを、運用者が許可するポリシーです。このポリシーは、ホストのすべての設定元を確認したことを示すものではありません。
206
+ **以下の事前確認・推薦・観測の動作は Aptly 0.1.4 以降で利用できます。** インストールした `PreToolUse` matcher は Codex の `spawn_agent` / `collaborationspawn_agent` / `Agent` と Claude Code の `Agent` を、native 実行前にローカルの `route_spawn_hook` へ渡します。ホストによる Hook の読み込み・信頼承認と MCP 接続が必要です。未設定・未対応のホストや MCP 接続失敗時まで Aptly が介入を強制することはできず、実行はホストが担当します。
163
207
 
164
- | ホスト | 自動選択の対象 |
165
- |---|---|
166
- | Codex | モデル・effort・固定ロール・resume の指定がなく、`fork_turns: "none"` の新しい汎用呼び出し |
167
- | 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 の適用も履歴制約のない汎用呼び出しに限ります。推薦の生成と適用は別です。
168
211
 
169
- 明示的な指定とロール・fork・resume、承認・サンドボックス・MCP 権限は保持します。fixture の結果でデフォルトモデルを自動変更することはありません。コンテキスト不足・未対応の応答・キャンセル・呼び出しの変更がある場合は、元の引数を変更しません。同じ呼び出しの入力・ポリシー・カタログを結び付け、非同期応答後に再確認します。
212
+ Codex の本文が不透明な場合、`cleanup_merged_worktrees` のような具体的な短い作業名だけでも推薦できます。短い名前は cleanup/remove/prune + merged + worktrees/branches、または review/fix/test + failing/broken/flaky + tests/builds の組み合わせに限定し、他は従来の6単語チェックを維持します。本文は復号も送信もしません。詳細条件や削除権限は推測しません。履歴継承時の適用は対象ホストで未検証であり、全バージョンで不可能という意味ではありません。公開ソースだけでは実行環境の対応を確認できません。
170
213
 
171
- 別途設定せずに実行する CLI と既存の手動設定は、fixture / shadow がデフォルトです。ホスト設定の証拠(host-evidence)に基づく従来の経路は、自動ポリシーがない場合のものです。インストールしたデフォルト値選択ポリシーとは区別してください。ホスト内部のパッチは保留中で、直接推薦の前提条件ではありません。
214
+ 独立した作業の場合だけ、呼び出し側が十分な単独のタスク情報を渡し、新しい子を明示的に選択してください。Aptly は `all` を `none` に変更せず、履歴の削除や明示モデル・effort の上書きもしません。[合成の継承・新規子の例](../../examples/spawn-preflight.codex.json)は別々の要求であり、自動再試行ではありません。結果不明の有料呼び出しを新しい ID で再試行しないでください。
215
+
216
+ `defaults` は互換性のある引数更新を、`advisory` は推薦だけを許可します。継承や一部だけ指定した呼び出しも、適用できなくても制限付きタスク抜粋を Decisions に送信する場合があります。履歴継承は共有の無効化ではありません。ポリシー無効・文脈不足・予算制限・失敗・キャンセルでは実行制約を保持します。入力・ポリシー・カタログの結合、重複防止、結果不明の保護を維持し、fixture の推薦で native のデフォルトを変更しません。自動ポリシーのない strict 証拠経路は別であり、ホスト内部のパッチは引き続き保留です。
172
217
 
173
218
  | MCP ツール | 用途 |
174
219
  |---|---|
@@ -176,6 +221,9 @@ aptly remove --client all
176
221
  | `recommend_agent` | タスク要約から直接推薦を取得します |
177
222
  | `get_routing_precedence` | 呼び出しを保持する根拠と、未確認の設定元を説明します |
178
223
  | `route_spawn_hook` | インストールしたポリシーに応じて、対象呼び出しのデフォルト値を選択するか、推薦だけを伝えます |
224
+ | `get_spawn_routing_observation` | 一致する Hook 呼び出しを照会し、native 実行を証明しません |
225
+ | `prepare_spawn_context` | 正確に一致する予定呼び出しに上限付きの説明を登録します |
226
+ | `cancel_spawn_context` | 説明の対応付けを取り消します。native 実行や送信済みリクエストは取り消しません |
179
227
 
180
228
  ### 外部送信と自動共有の無効化
181
229
 
@@ -191,6 +239,12 @@ Decisions には `client`、`task.summary`、`task.operation`、`task.context_su
191
239
 
192
240
  台帳と Hook バインディングにはリクエストのメタデータ・ハッシュ・キャッシュ結果を保存し、タスクの抜粋は保存しません。Aptly の診断にもタスク原文を含めません。ただし、ローカルの Hook の `updatedInput` は、ホストが実行を続けられるよう元のタスクを保持します。ホスト自身の会話やログの保存は Aptly の制御対象ではありません。
193
241
 
242
+ ### 不透明な呼び出しへの明示的な説明(0.1.4 以降)
243
+
244
+ 実際の予定セッション・呼び出し ID と元のイベントを知る連携は、Hook の前に同じ MCP プロセスで `prepare_spawn_context({client, event, description})` を呼べます。目的・範囲・出力・制約・複雑さを短く記述してください。URL の内容は取得しません。上限付き説明と固定接頭文だけが抜粋を置き換え、履歴・ファイル・不透明な本文は送信しません。`cancel_spawn_context({client, event})` で取り消せます。有効な自動ポリシーが必要で、`enabled: false` は共有を止めます。既知の秘密パターン検査は完全ではありません。
245
+
246
+ 対応付けは5分間有効で変更不可、プロセスごとに最大128件です。入力変更・期限切れ・取消時は分類を止め、評価済みの呼び出しを説明変更で有料再試行しません。実際の予定イベントを取得できない呼び出し元は利用できません。標準 Hook は説明や呼び出し ID を作成しません。ローカルの `insufficient_context`、プロバイダーの `provider_needs_context`、適用時の `inherited_context_application_unverified` は別の結果です。限定的な native 説明受け渡しの検証は[契約](../SPAWN_CONTEXT.md)に記録しています。この検証は、説明の自動生成や推薦モデルの実行を証明するものではありません。
247
+
194
248
  ## 直接推薦
195
249
 
196
250
  `recommend_agent` MCP と CLI の `recommend` は、タスク要約を受け取ってプロファイルを推薦します。子エージェントを直接生成することはありません。以下の JSON を MCP ツールの引数として渡すか、ファイルに保存して CLI の標準入力に渡してください。
@@ -266,9 +320,9 @@ export APTLY_MODEL_INFO_PATH=/absolute/private-aptly-state/model-info.json
266
320
 
267
321
  ## コンテキストの提供
268
322
 
269
- Codex が子エージェントの `message` を暗号文として Hook に渡す環境では、本文を読み取ったり復号したりしません。この場合は、十分に具体的な平文の `task_name` だけを要約として使用します。たとえば `sort_supplied_numbers_3_1_2_ascending_without_tools` のように、タスクの種類と範囲を表します。短い名前や曖昧な名前の場合は、元のモデルを保持します。Claude Code と平文の本文が渡される呼び出しでは、提供された本文の要約を使用します。
323
+ Codex が子エージェントの `message` を暗号文として Hook に渡す環境では、本文を読み取ったり復号したりしません。この場合は、十分に具体的な平文の `task_name` だけを要約として使用します。たとえば `sort_supplied_numbers_3_1_2_ascending_without_tools` のように、タスクの種類と範囲を表します。未対応または曖昧なタスク名の場合は、元のモデルを保持します。Claude Code と平文の本文が渡される呼び出しでは、提供された本文の要約を使用します。
270
324
 
271
- `get_routing_capabilities` の `automatic_hook.last_result` で、その MCP プロセスによる最後の適用・保持の理由を確認できます。`null` は、まだ自動 Hook の処理記録がないことを意味します。タスクの本文や個人の設定値は返しません。
325
+ 同じ `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・資格情報は返しません。
272
326
 
273
327
  直接推薦では、リポジトリ・ファイルの URL と、ドキュメントを読んで整理したタスクの範囲・規模・制約を、要約に含めて提供できます。URL の文字列を送ることと、ドキュメントの本文を提供することは異なります。現在の Aptly の分類リクエスト処理コードは、リポジトリ URL を GET したり、ドキュメントを収集したりしません。必要なドキュメントの取得と要約は、呼び出し元が行います。
274
328
 
package/docs/guide/ko.md CHANGED
@@ -13,7 +13,7 @@ Node.js 24 이상과 Claude Code 또는 Codex가 필요합니다. npm의 최신
13
13
  **기존 영속 원장을 0.1.2 이상으로 업그레이드하기 전에**, 해당 원장을 사용하는 모든 호스트·MCP 서버·별도 CLI와 구버전 프로세스를 정지하십시오. 새 영구 잠금은 구버전 writer와 함께 사용할 수 없습니다. 새 설치에는 기존 잠금 격리가 필요하지 않습니다. 이전 빈 잠금이 남았다면 [원장 잠금 전환 절차](#중단된-프로세스와-원장-잠금)를 따라 확인된 기존 잠금만 오프라인으로 격리하고, JSON 원장·`unknown`·비용·완료 캐시는 보존하십시오.
14
14
 
15
15
  ```sh
16
- npm install -g aptly@latest
16
+ npm install -g aptly@latest --allow-scripts=aptly
17
17
  aptly setup --client all --mode defaults
18
18
  aptly --version
19
19
  ```
@@ -24,6 +24,41 @@ aptly --version
24
24
 
25
25
  새 등록은 `ROUTER_PROVIDER=decisions`, Hook `defaults` 정책과 호스트별 비공개 원장을 지정합니다. 기존 다른 설정·Hook, 기존 Aptly의 실행 명령·환경·분류 방식·원장 경로는 보존합니다. 기존 fixture 설정을 자동으로 유료 모드로 바꾸지 않습니다.
26
26
 
27
+ ### npm 설치 스크립트 허용
28
+
29
+ 위 설치 명령의 `--allow-scripts=aptly`는 해당 설치에서 Aptly의 `postinstall`을 명시적으로 허용합니다. npm 11.19.1에서 지원을 확인했으며, 사용자 전체의 npm 허용 설정은 변경하지 않습니다. [npm 공식 안내](https://docs.npmjs.com/cli/v11/commands/npm-rebuild/#allow-scripts)를 참고하십시오.
30
+
31
+ `npm warn install-scripts ... not yet covered by allowScripts`는 허용 정책에 아직 등록되지 않았다는 안내입니다. npm 11.19.1에서는 이 경고만으로 스크립트가 차단됐다고 판단할 수 없습니다. npm 버전·엄격 정책·`ignore-scripts`에 따라 동작이 달라지며, 설치 성공만으로 MCP·Hook 등록 성공을 확인할 수는 없습니다. `postinstall`은 npm 출력에 표시되지 않을 수도 있습니다.
32
+
33
+ 옵션을 지원하지 않는 npm이거나 자동 등록 대신 직접 설정하려면 다음 명령을 사용하십시오:
34
+
35
+ ```sh
36
+ npm install -g aptly@latest --ignore-scripts
37
+ aptly setup --client all --mode defaults
38
+ ```
39
+
40
+ 명시적 `setup`은 설치 스크립트 실행 여부와 관계없이 사용할 수 있습니다. 기존 실행 경로는 보존하므로 구버전 경로 오류는 아래 복구 절차를 따르십시오. 키 설정·MCP 재시작과 Codex의 `/hooks` 신뢰 승인은 별도로 필요합니다.
41
+
42
+ ### 패키지 업데이트
43
+
44
+ `aptly update`는 **Aptly 0.1.3부터 지원합니다**. 검증된 전역 npm 설치에서만 현재 실행 중인 패키지와 동일한 prefix의 `aptly@latest`를 설치합니다. 로컬 설치·소스 체크아웃·확인할 수 없는 경로는 거절합니다. npm의 유효 설정에서 `dry-run=true`이면 실제 설치를 시작하기 전에 `update_dry_run_enabled`로 거절합니다. 설정을 확인할 수 없으면 `update_configuration_unverified`로 중단합니다. 시험 실행을 업데이트 성공으로 보고하지 않습니다.
45
+
46
+ 업데이트 전에 위 원장 전환 절차에 따라 다른 호스트·MCP·CLI 프로세스를 중지하십시오. 명령은 설치 스크립트를 실행하지 않으므로 업데이트 후 명시적으로 설정하고 호스트를 재시작하십시오:
47
+
48
+ ```sh
49
+ aptly update
50
+ aptly setup --client all --mode defaults
51
+ aptly --version
52
+ ```
53
+
54
+ 기존 MCP 실행 경로와 사용자 래퍼를 자동으로 전환하지 않습니다. 이전 경로가 남으면 아래 실행 경로 복구 안내를 따르십시오. 키 설정과 Codex의 `/hooks` 신뢰 검토는 별도 단계입니다. npm 인증·네트워크·권한 오류로 실패하면 수동 설치 안내를 사용하십시오. 자동 업데이트는 수행하지 않습니다.
55
+
56
+ ### 새 버전 알림
57
+
58
+ **Aptly 0.1.3부터** 일반 CLI의 대화형 실행에서 최신 안정 버전을 확인하고, 더 새 버전이 있으면 stderr에 `aptly update`를 안내합니다. stdin·stdout·stderr가 모두 터미널일 때만 동작하며, MCP 서버·자동 setup·추천/분류 경로·파이프·CI에서는 확인하지 않습니다. 기존 JSON stdout과 MCP·Hook 응답은 유지합니다.
59
+
60
+ 공개 npm 레지스트리의 Aptly 버전 메타데이터만 조회하며 키·작업 요약·호스트 설정은 보내지 않습니다. 네트워크와 응답 읽기는 최대 800ms·16KiB로 제한하고, 결과는 `~/.cache/aptly/update-check.json`에 24시간 캐시합니다. 실패 후에는 1시간 대기하며, 조회·캐시 오류로 원래 명령을 실패시키지 않습니다. 버전 조회를 끄려면 CLI 실행 환경에 `APTLY_NO_UPDATE_NOTIFIER=1`을 설정하십시오. 이 변수는 MCP 키 설정용 `aptly set env`의 지원 대상이 아닙니다. 알림은 업데이트를 설치하지 않습니다.
61
+
27
62
  ### CLI로 설정하기
28
63
 
29
64
  `set` 명령은 0.1.1부터 지원합니다. 명령은 기존 실행 경로를 자동 전환하지 않습니다. API 키 설정은 현재 패키지의 표준 Node/서버 등록과 OS 자격 저장소 참조 지원이 확인된 실행 경로에만 허용됩니다. 사용자 지정 래퍼·구버전·다른 설치 위치는 `credential_launcher_unverified`로 거절하며, 등록을 명시적으로 전환하거나 업그레이드한 뒤 다시 실행해야 합니다.
@@ -75,6 +110,15 @@ aptly set env OPENAI_API_KEY --client claude
75
110
 
76
111
  `--dry-run`은 변경하지 않습니다. 이전 명령은 소유 기록과 일치하는 Aptly 표준 등록의 Node·서버 경로를 현재 빌드로 바꿉니다. 기존 환경·Hook·정책·다른 호스트는 보존하며 키를 읽거나 저장하지 않습니다. 오래된 실행 파일을 실행하지 않습니다. 사용자 래퍼, 소유 기록이 없거나 수정된 등록은 거절합니다. 이 경우 로컬에서 등록을 검토하고 래퍼의 안전한 환경 전달을 사용하거나 별도로 검토한 표준 등록으로 전환하십시오. 소유 기록을 삭제하거나 편집해 검증을 우회하지 마십시오.
77
112
 
113
+ `launcher_migration_not_owned`가 나오고 기존 등록을 보존한 상태(`mcp_created: false`)라면, **Aptly 0.1.3부터** `--include-existing`으로 명시적으로 이전할 수 있습니다. 0.1.3 이상을 설치한 뒤 다음 명령을 실행하십시오:
114
+
115
+ ```sh
116
+ aptly setup --client claude --migrate-launcher --include-existing --dry-run
117
+ aptly setup --client claude --migrate-launcher --include-existing
118
+ ```
119
+
120
+ 실행 전에 로컬 등록을 검토하십시오. 유효한 기존 Aptly 소유 기록과 일치하는 관리 환경변수·Hook·정책이 필요하며, 절대 Node 경로와 단일 표준 서버 경로만 허용합니다. 사용자 래퍼나 기록이 없는 등록은 이 옵션으로도 이전하지 않습니다. 기존 MCP 전체를 Aptly 소유로 바꾸지 않으므로, 이후 `remove`도 이전한 MCP 실행 경로와 원래 사용자 설정을 보존합니다. 이 옵션은 단일 호스트의 명시적 이전에만 사용할 수 있고 자동 설치에는 적용되지 않습니다.
121
+
78
122
  이미 성공한 Codex는 재설정할 필요가 없습니다. 실패한 호스트만 지정해 재시도하고 MCP를 재시작하십시오. Codex를 대상으로 하면 `/hooks` 신뢰 검토가 계속 필요합니다. 진단 이후 설정 변경은 `concurrent_configuration_change`로 중단합니다. 저장 실패 후 다른 키가 관찰되거나 현재 키를 읽지 못하면 덮어쓰지 않고 `credential_rollback_failed`를 반환합니다. 파일과 OS 저장소 사이의 원자적 트랜잭션은 아니므로 다른 설정 작업을 동시에 실행하지 마십시오.
79
123
 
80
124
  ### 키와 재시작
@@ -159,16 +203,17 @@ aptly remove --client all
159
203
 
160
204
  ## 자동 Hook
161
205
 
162
- 연결된 대상 호출은 `route_spawn_hook` → Decisions를 자동 경유합니다. `defaults`는 해당 범위에서 호스트 기본 모델보다 Aptly의 선택을 우선하도록 운영자가 허용하는 정책입니다. 호스트의 모든 설정 출처를 관측했다는 선언은 아닙니다.
206
+ **다음 사전 검사·추천·관측 동작은 Aptly 0.1.4부터 지원합니다.** 설치한 `PreToolUse` matcher는 Codex의 `spawn_agent` / `collaborationspawn_agent` / `Agent`와 Claude Code의 `Agent` 호출을 native 실행 전에 로컬 `route_spawn_hook`으로 전달합니다. 호스트가 Hook을 로드·신뢰하고 MCP를 연결해야 합니다. 미설정·미지원 호스트나 MCP 연결 실패까지 Aptly가 가로채도록 강제할 수는 없으며, 실행은 호스트가 담당합니다.
163
207
 
164
- | 호스트 | 자동 선택 대상 |
165
- |---|---|
166
- | Codex | 모델·effort·고정 역할·resume을 지정하지 않고 `fork_turns: "none"`인 새 일반 호출 |
167
- | 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 적용도 이력 제약 없는 일반 호출로 한정합니다. 추천 성공과 실제 적용은 다릅니다.
168
211
 
169
- 명시 선택과 역할·fork·resume, 승인·샌드박스·MCP 권한은 보존합니다. fixture 결과로 기본 모델을 자동 변경하지 않습니다. 불충분한 맥락·지원하지 않는 응답·취소·변경된 호출에서는 기존 인자를 유지합니다. 각 호출의 입력·정책·후보 정보가 일치하는지 확인하고, 비동기 응답 후 다시 확인합니다.
212
+ Codex 본문이 불투명할 때 `cleanup_merged_worktrees`처럼 구체적인 짧은 작업명만으로도 추천할 수 있습니다. 짧은 이름은 cleanup/remove/prune + merged + worktrees/branches 또는 review/fix/test + failing/broken/flaky + tests/builds 조합만 허용하며, 나머지는 기존 6단어 검사를 유지합니다. 본문은 복호화하거나 전송하지 않습니다. 작업의 세부 조건이나 삭제 권한을 추론하지 않습니다. 이력 상속 상태의 적용은 대상 호스트에서 미검증이며, 모든 버전에서 불가능하다는 뜻은 아닙니다. 공개 소스만으로 설치된 런타임의 지원을 확정하지 않습니다.
170
213
 
171
- 별도 설정 없이 실행하는 CLI와 기존 수동 설정은 fixture / shadow가 기본입니다. 자동 정책이 없는 기존 호스트 설정 증거에 기반한 경로와 설치한 기본값 선택 정책은 구분합니다. 호스트 내부 패치는 보류 상태이며 직접 추천의 선행 조건이 아닙니다.
214
+ 독립적인 작업일 때만 호출자가 충분한 독립 작업 맥락을 제공하고 새 자식을 명시적으로 선택하십시오. Aptly는 `all`을 `none`으로 바꾸거나 이력을 제거하거나 명시한 모델·effort를 덮어쓰지 않습니다. [합성 상속·새 자식 예제](../../examples/spawn-preflight.codex.json)는 별개의 호출이며 자동 재시도가 아닙니다. 결과 불명인 유료 호출을 새 ID로 재시도하지 마십시오.
215
+
216
+ `defaults`는 호환되는 인자 변경을, `advisory`는 추천만 허용합니다. 상속 호출과 일부 필드만 지정한 호출도 적용 차단 여부와 관계없이 제한된 작업 발췌문을 Decisions에 전송할 수 있습니다. 이력 상속은 공유 거부 설정이 아닙니다. 정책 비활성화·맥락 부족·예산 제한·실패·취소에서는 실행 제약을 보존합니다. 입력·정책·카탈로그 결합, 중복 방지와 결과 불명 보호는 유지하며 fixture 추천으로 native 기본값을 바꾸지 않습니다. 자동 정책 없는 strict 증거 경로는 별개이며 호스트 내부 패치는 계속 보류합니다.
172
217
 
173
218
  | MCP 도구 | 용도 |
174
219
  |---|---|
@@ -176,6 +221,9 @@ aptly remove --client all
176
221
  | `recommend_agent` | 작업 요약으로 프로필 추천을 받습니다 |
177
222
  | `get_routing_precedence` | 호출의 보존 근거와 미확인 설정 출처를 설명합니다 |
178
223
  | `route_spawn_hook` | 설치한 정책에 따라 대상 호출의 기본값을 선택하거나 추천만 전달합니다 |
224
+ | `get_spawn_routing_observation` | 정확히 일치하는 Hook 호출을 조회하며 native 실행을 증명하지 않습니다 |
225
+ | `prepare_spawn_context` | 정확한 예정 호출에 제한된 설명을 등록합니다 |
226
+ | `cancel_spawn_context` | 등록한 설명의 연결을 취소하며 native 실행이나 이미 전송된 요청을 취소하지 않습니다 |
179
227
 
180
228
  ### 외부 전송과 자동 공유 끄기
181
229
 
@@ -191,6 +239,12 @@ Decisions에는 `client`, `task.summary`, `task.operation`, `task.context_suffic
191
239
 
192
240
  원장과 Hook 바인딩에는 요청 메타데이터·해시·캐시 결과를 저장하며 작업 발췌문을 저장하지 않습니다. Aptly의 진단 결과에도 원문을 넣지 않습니다. 다만 로컬 호스트가 실행을 이어가도록 Hook의 `updatedInput`에는 원래 작업이 유지됩니다. 호스트 자체의 대화·로그 저장은 Aptly가 제어하지 않습니다.
193
241
 
242
+ ### 불투명 호출에 명시적 설명 전달 (0.1.4부터)
243
+
244
+ 실제 예정된 세션·호출 ID와 원래 이벤트를 아는 연동은 Hook 전에 같은 MCP 프로세스에 `prepare_spawn_context({client, event, description})`를 호출할 수 있습니다. 목적·범위·결과물·제약·복잡도를 짧게 적으세요. URL의 내용은 가져오지 않습니다. 제한된 설명과 고정 접두문만 작업 발췌문을 대체하며, 이력·파일·불투명 본문은 보내지 않습니다. `cancel_spawn_context({client, event})`로 취소합니다. 자동 정책이 활성화되어야 하며 `enabled: false`는 공유를 차단합니다. 알려진 비밀 패턴 검사만으로 완전한 보호를 보장하지 않습니다.
245
+
246
+ 연결은 5분간 유효하고 변경할 수 없으며 프로세스당 최대 128개입니다. 입력 변경·만료·취소 시 분류를 중단하고, 이미 평가한 호출에 설명을 바꿔 유료 재시도하지 않습니다. 실제 예정 이벤트를 알 수 없는 호출자는 사용할 수 없습니다. 기본 Hook은 설명이나 호출 ID를 만들지 않습니다. 로컬 `insufficient_context`, 공급자 `provider_needs_context`, 실제 적용의 `inherited_context_application_unverified`는 서로 다릅니다. 제한된 native 설명 전달 검증은 [전달 계약](../SPAWN_CONTEXT.md)에 기록했습니다. 이 검증은 기본 설명의 자동 생성이나 추천 모델의 실행을 증명하지 않습니다.
247
+
194
248
  ## 직접 추천
195
249
 
196
250
  `recommend_agent` MCP와 CLI `recommend`는 작업 요약을 받아 프로필을 추천합니다. 자식을 직접 생성하지 않습니다. 아래 JSON을 MCP 도구 인자로 전달하거나 파일에 저장해 CLI의 표준 입력으로 제공하십시오.
@@ -266,9 +320,9 @@ export APTLY_MODEL_INFO_PATH=/absolute/private-aptly-state/model-info.json
266
320
 
267
321
  ## 맥락 전달
268
322
 
269
- Codex가 자식 `message`를 암호문으로 Hook에 전달하는 환경에서는 본문을 읽거나 해독하지 않습니다. 이 경우 충분히 구체적인 평문 `task_name`만 요약으로 사용합니다. 예를 들어 `sort_supplied_numbers_3_1_2_ascending_without_tools`처럼 작업 종류와 범위를 설명하십시오. 짧거나 모호한 이름은 원래 모델을 유지합니다. Claude Code와 평문 본문이 전달되는 호출은 제공된 본문 요약을 사용합니다.
323
+ Codex가 자식 `message`를 암호문으로 Hook에 전달하는 환경에서는 본문을 읽거나 해독하지 않습니다. 이 경우 충분히 구체적인 평문 `task_name`만 요약으로 사용합니다. 예를 들어 `sort_supplied_numbers_3_1_2_ascending_without_tools`처럼 작업 종류와 범위를 설명하십시오. 지원하지 않거나 모호한 작업명은 원래 모델을 유지합니다. Claude Code와 평문 본문이 전달되는 호출은 제공된 본문 요약을 사용합니다.
270
324
 
271
- `get_routing_capabilities`의 `automatic_hook.last_result`에서 해당 MCP 프로세스가 마지막으로 기본값을 적용하거나 원래 호출을 유지한 사유를 확인할 수 있습니다. `null`은 아직 자동 Hook 처리 기록이 없다는 뜻입니다. 작업 본문이나 개인 설정 값은 반환하지 않습니다.
325
+ 동일한 `client`와 원래 Hook `event`로 `get_spawn_routing_observation`을 호출해 해당 호출을 조회하십시오. 식별자는 해시로 반환하며 사전 검사, 분류·캐시 결과, 추천, 인자 변경·적용 차단과 `execution: not_observed`를 구분합니다. `arguments_updated`는 Hook 출력 인자만 뜻하며 실제 자식 모델 관측이 아닙니다. 기록은 해당 MCP 프로세스의 최근 128개·10분으로 제한합니다. `not_observed`는 다른 프로세스·재시작·만료·퇴출·입력 불일치 때문일 수도 있으므로 전체 Hook 우회를 증명하지 않습니다. 프로세스 공용 `automatic_hook.last_result`는 제거합니다. 원문 작업·경로·세션 ID·자격 값은 반환하지 않습니다.
272
326
 
273
327
  직접 추천에는 저장소·파일 URL과 문서를 읽고 정리한 작업 범위·규모·제약을 요약에 함께 제공할 수 있습니다. URL 문자열을 보내는 것과 문서 본문을 제공하는 것은 다릅니다. 현재 Aptly의 분류 요청 처리 코드는 저장소 URL을 GET하거나 문서를 수집하지 않습니다. 필요한 문서 조회와 요약은 호출자가 수행합니다.
274
328