aptly 0.1.5 → 0.1.7

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.
@@ -1,5 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { automaticCallIdentity } from './automatic-hook.js';
3
+ import { hasSufficientTaskText } from './context-sufficiency.js';
3
4
  const sensitive = (text) => /\bsk-[A-Za-z0-9_-]{12,}|\bBearer\s+[A-Za-z0-9._~+\/-]{8,}={0,2}/i.test(text);
4
5
  /** Explicit, process-local handoff. Tombstones prevent expiry/cancellation fallback. */
5
6
  export class SpawnContexts {
@@ -17,7 +18,7 @@ export class SpawnContexts {
17
18
  if (!identity)
18
19
  return { status: 'rejected', reason: 'invalid_event' };
19
20
  if (typeof description !== 'string' || Buffer.byteLength(description) > Math.min(3800, maxBytes - 96) ||
20
- description.trim().length < 12 || description.trim().split(/\s+/u).length < 3)
21
+ !hasSufficientTaskText(description))
21
22
  return { status: 'rejected', reason: 'insufficient_context' };
22
23
  if (sensitive(description))
23
24
  return { status: 'rejected', reason: 'sensitive_input' };
@@ -23,7 +23,7 @@ function newer(candidate, current) {
23
23
  }
24
24
  function eligible(o) {
25
25
  return o.stdinIsTTY && o.stderrIsTTY && o.stdoutIsTTY !== false && !o.env.CI && o.env.APTLY_NO_UPDATE_NOTIFIER !== '1' && !!version(o.currentVersion) &&
26
- ['help', '--help', '-h', '--version', 'config', 'setup', 'remove', 'set', 'report'].includes(o.command) && !o.args.includes('--automatic');
26
+ ['help', '--help', '-h', '--version', 'config', 'setup', 'remove', 'set', 'report'].includes(o.command) && !o.args.includes('--automatic') && !(o.command === 'set' && o.args[0] === 'transmission' && o.args.includes('--show'));
27
27
  }
28
28
  function directory(path) {
29
29
  if (!isAbsolute(path))
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.5";
1
+ export declare const VERSION = "0.1.7";
@@ -1 +1 @@
1
- export const VERSION = '0.1.5';
1
+ export const VERSION = '0.1.7';
@@ -1,6 +1,7 @@
1
- type Runner = (executable: string, args: readonly string[], input: string) => string;
1
+ type Runner = (executable: string, args: readonly string[], input: string, timeoutMs: number) => string;
2
2
  interface WindowsPrivateOptions {
3
3
  execute?: Runner;
4
+ timeoutMs?: number;
4
5
  }
5
6
  /** Preserve the existing file DACL, including inheritance protection, before writing stage content. */
6
7
  export declare function copyWindowsFilePermissions(source: string, target: string, options?: WindowsPrivateOptions): void;
@@ -8,15 +8,15 @@ $ErrorActionPreference = 'Stop'
8
8
  try {
9
9
  $request = [Console]::In.ReadToEnd() | ConvertFrom-Json
10
10
  $path = [string]$request.path
11
- if ([string]::IsNullOrWhiteSpace($path) -or ![IO.Path]::IsPathRooted($path)) { throw 'invalid' }
11
+ if ([string]::IsNullOrWhiteSpace($path) -or ![IO.Path]::IsPathRooted($path)) { throw 'aptly_acl_rejected' }
12
12
  $attributes = [IO.File]::GetAttributes($path)
13
- if (($attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'invalid' }
13
+ if (($attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'aptly_acl_rejected' }
14
14
  $isDirectory = ($attributes -band [IO.FileAttributes]::Directory) -ne 0
15
15
  $sidType = [Security.Principal.SecurityIdentifier]
16
16
  $current = [Security.Principal.WindowsIdentity]::GetCurrent().User
17
17
  $allowed = @($current.Value, 'S-1-5-18', 'S-1-5-32-544')
18
18
  if ($request.action -eq 'protect-new-directory') {
19
- if (!$isDirectory) { throw 'invalid' }
19
+ if (!$isDirectory) { throw 'aptly_acl_rejected' }
20
20
  $acl = [Security.AccessControl.DirectorySecurity]::new()
21
21
  $acl.SetOwner($current)
22
22
  $acl.SetAccessRuleProtection($true, $false)
@@ -26,19 +26,19 @@ try {
26
26
  $acl.AddAccessRule($rule)
27
27
  }
28
28
  [IO.Directory]::SetAccessControl($path, $acl)
29
- } elseif ($request.action -ne 'assert-private') { throw 'invalid' }
29
+ } elseif ($request.action -ne 'assert-private') { throw 'aptly_acl_rejected' }
30
30
  $acl = if ($isDirectory) { [IO.Directory]::GetAccessControl($path) } else { [IO.File]::GetAccessControl($path) }
31
- if ($allowed -notcontains $acl.GetOwner($sidType).Value) { throw 'invalid' }
31
+ if ($allowed -notcontains $acl.GetOwner($sidType).Value) { throw 'aptly_acl_rejected' }
32
32
  $descriptor = [Security.AccessControl.RawSecurityDescriptor]::new($acl.GetSecurityDescriptorBinaryForm(), 0)
33
- if ($null -eq $descriptor.DiscretionaryAcl) { throw 'invalid' }
33
+ if ($null -eq $descriptor.DiscretionaryAcl) { throw 'aptly_acl_rejected' }
34
34
  foreach ($rule in $acl.GetAccessRules($true, $true, $sidType)) {
35
- if ($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow -and $allowed -notcontains $rule.IdentityReference.Value) { throw 'invalid' }
35
+ if ($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow -and $allowed -notcontains $rule.IdentityReference.Value) { throw 'aptly_acl_rejected' }
36
36
  }
37
37
  [Console]::Out.Write('private')
38
- } catch { [Console]::Out.Write('rejected'); exit 1 }
38
+ } catch { if ($_.Exception.Message -eq 'aptly_acl_rejected') { [Console]::Out.Write('rejected') } else { [Console]::Out.Write('error') }; exit 1 }
39
39
  `;
40
- const run = (executable, args, input) => execFileSync(executable, [...args], {
41
- input, encoding: 'utf8', windowsHide: true, timeout: 10000, maxBuffer: 4096, stdio: ['pipe', 'pipe', 'pipe']
40
+ const run = (executable, args, input, timeoutMs) => execFileSync(executable, [...args], {
41
+ input, encoding: 'utf8', windowsHide: true, timeout: timeoutMs, maxBuffer: 4096, stdio: ['pipe', 'pipe', 'pipe']
42
42
  });
43
43
  const copyScript = String.raw `
44
44
  $ErrorActionPreference = 'Stop'
@@ -47,13 +47,13 @@ try {
47
47
  $request = [Console]::In.ReadToEnd() | ConvertFrom-Json
48
48
  $source = [string]$request.source
49
49
  $target = [string]$request.target
50
- if (![IO.Path]::IsPathRooted($source) -or ![IO.Path]::IsPathRooted($target)) { throw 'invalid' }
50
+ if (![IO.Path]::IsPathRooted($source) -or ![IO.Path]::IsPathRooted($target)) { throw 'aptly_acl_rejected' }
51
51
  $source = [IO.Path]::GetFullPath($source)
52
52
  $target = [IO.Path]::GetFullPath($target)
53
- if ([string]::Equals($source, $target, [StringComparison]::OrdinalIgnoreCase) -or ![string]::Equals([IO.Path]::GetDirectoryName($source), [IO.Path]::GetDirectoryName($target), [StringComparison]::OrdinalIgnoreCase)) { throw 'invalid' }
53
+ if ([string]::Equals($source, $target, [StringComparison]::OrdinalIgnoreCase) -or ![string]::Equals([IO.Path]::GetDirectoryName($source), [IO.Path]::GetDirectoryName($target), [StringComparison]::OrdinalIgnoreCase)) { throw 'aptly_acl_rejected' }
54
54
  foreach ($path in @($source, $target)) {
55
55
  $attributes = [IO.File]::GetAttributes($path)
56
- if (($attributes -band [IO.FileAttributes]::Directory) -ne 0 -or ($attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'invalid' }
56
+ if (($attributes -band [IO.FileAttributes]::Directory) -ne 0 -or ($attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'aptly_acl_rejected' }
57
57
  }
58
58
  $sections = [Security.AccessControl.AccessControlSections]::Access
59
59
  $sourceAcl = [IO.File]::GetAccessControl($source, $sections)
@@ -66,20 +66,37 @@ try {
66
66
  $acl.SetSecurityDescriptorSddlForm($expected, $sections)
67
67
  [IO.File]::SetAccessControl($target, $acl)
68
68
  $actual = [IO.File]::GetAccessControl($target, $sections).GetSecurityDescriptorSddlForm($sections)
69
- if ($expected -cne $actual) { throw 'invalid' }
69
+ if ($expected -cne $actual) { throw 'aptly_acl_rejected' }
70
70
  [Console]::Out.Write('private')
71
- } catch { [Console]::Out.Write('rejected'); exit 1 }
71
+ } catch { if ($_.Exception.Message -eq 'aptly_acl_rejected') { [Console]::Out.Write('rejected') } else { [Console]::Out.Write('error') }; exit 1 }
72
72
  `;
73
73
  function runScript(scriptText, input, options) {
74
+ const started = Date.now();
75
+ const timeoutMs = options.timeoutMs === undefined ? 10000 : options.timeoutMs;
76
+ if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 30000)
77
+ throw new Error('windows_private_permissions');
78
+ let category = 'process';
74
79
  try {
75
80
  const executable = windowsPowerShellPath();
76
- const result = (options.execute ?? run)(executable, ['-NoLogo', '-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(scriptText, 'utf16le').toString('base64')], JSON.stringify(input));
77
- if (result !== 'private')
78
- throw new Error();
81
+ const result = (options.execute ?? run)(executable, ['-NoLogo', '-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(scriptText, 'utf16le').toString('base64')], JSON.stringify(input), timeoutMs);
82
+ if (result === 'private')
83
+ return;
84
+ category = result === 'rejected' ? 'rejected' : result === 'error' ? 'process' : 'unexpected_output';
79
85
  }
80
- catch {
81
- throw new Error('windows_private_permissions');
86
+ catch (error) {
87
+ // Inspect only bounded process metadata; never propagate stderr or input.
88
+ const failure = error;
89
+ if (failure?.code === 'ETIMEDOUT')
90
+ category = 'timeout';
91
+ else if (failure?.stdout === 'rejected')
92
+ category = 'rejected';
93
+ else if (typeof failure?.code === 'string' && ['ENOENT', 'EACCES', 'EPERM', 'ENOEXEC', 'ENOTDIR'].includes(failure.code) && failure?.status == null)
94
+ category = 'launch';
82
95
  }
96
+ const failure = new Error('windows_private_permissions');
97
+ failure.category = category;
98
+ failure.elapsed_ms = Math.max(0, Date.now() - started);
99
+ throw failure;
83
100
  }
84
101
  function invoke(path, action, options) {
85
102
  if (typeof path !== 'string' || !path || path.includes('\0'))
@@ -2,7 +2,8 @@
2
2
 
3
3
  The original exact-event handoff is available from Aptly 0.1.4, following the
4
4
  pre-spawn routing changes in #60. Context recovery and visible routing outcomes
5
- are available from Aptly 0.1.5.
5
+ are available from Aptly 0.1.5. Intentional fresh-delegation preparation is
6
+ available from Aptly 0.1.6.
6
7
  It does not decode opaque messages, inspect conversations or modify host
7
8
  internals. It provides an explicit caller protocol, not an automatic description
8
9
  producer for the shipped Hook templates.
@@ -324,3 +325,101 @@ unpinned state. These trials are not a model-quality or cost comparison.
324
325
  This verifies one caller-driven Claude recovery under explicit unpinned task
325
326
  semantics. It does not guarantee every parent model follows feedback, change
326
327
  host permission decisions, or establish inherited Codex application support.
328
+
329
+
330
+ ## Intentional fresh delegation
331
+
332
+ Available from Aptly 0.1.6.
333
+
334
+ `prepare_fresh_delegation` is a caller protocol for a separate Codex invocation,
335
+ not a rewrite of the original inherited invocation. An enabled defaults Hook can
336
+ provide a routing reference named `retry_id` after direct completed inherited
337
+ advice, or the caller can use the existing context-retry reference after a
338
+ completed recommendation. Direct-advice references cannot request another paid
339
+ context supplement. Advisory paths are excluded because the original invocation
340
+ may already execute.
341
+
342
+ The caller supplies `task_name`, a bounded `standalone_task`, and a declaration:
343
+ `independent_task: true`, `same_task: true`, `original_call_outcome: "blocked"`,
344
+ `history_requirement: "not_required"`,
345
+ `standalone_context_complete: true`. Required/unknown history, undeclared
346
+ independence, incomplete context and changed scope reject without preparing a
347
+ call. These declarations are not verified user-intent provenance. The caller
348
+ must not make them when the user explicitly requires inheritance.
349
+
350
+ Only original native inputs with the supported task/model/effort/fork fields
351
+ qualify. Unknown additional execution fields are rejected rather than silently
352
+ dropped. Fixed roles/resume remain locally preserved before advice. Explicit
353
+ partial model/effort choices still constrain the completed allowlisted profile.
354
+ The current policy/catalog, original event/context and completed ledger result
355
+ are revalidated. Unknown results and missing/abstaining recommendations cannot
356
+ prepare a child. No new classification occurs.
357
+
358
+ A successful response provides separate `next_call.arguments` including explicit
359
+ `fork_turns: "none"`, the validated profile and the caller's standalone task.
360
+ A deny was returned for the original input, which was not rewritten. Server
361
+ observation does not certify that the host enforced it. The caller must have a
362
+ host-reported blocked tool outcome; executed/unknown declarations reject.
363
+ The caller reviews and submits a
364
+ new native call under unchanged host permissions and existing delegation
365
+ authorization. Neither preparation nor argument output proves dispatch/execution.
366
+ The process does not own native spawn or guarantee caller compliance.
367
+
368
+ The original five-minute lifetime and process/capacity boundaries apply. One
369
+ immutable preparation digest binds task, declaration, profile and original
370
+ reference; text/history are not persisted. Duplicate identical preparation is
371
+ idempotent; changed input conflicts. Expiry, cancellation, original-event or
372
+ policy/catalog changes prevent preparation. `fresh_delegation` observations
373
+ separate the prepared outcome from the latest rejected attempt and always keep
374
+ execution `not_observed`. The eventual new native call has its own identity;
375
+ server evidence does not automatically certify its relationship to this plan.
376
+
377
+
378
+ ### Bounded native fresh-delegation verification — 2026-11-07
379
+
380
+ Codex CLI 0.167.0 used its existing trusted Hook with an ephemeral product-server
381
+ override. One standalone sorting task specified an initial inherited caller
382
+ default while explicitly requiring no inherited history. The original opaque
383
+ call stayed blocked; the parent supplied context, obtained one real Decisions
384
+ recommendation, declared independent same-task intent and called the preparation
385
+ API. It then submitted a separate native call with `fork_turns: "none"` and the
386
+ returned Luna/max profile. The actual linked child recorded `gpt-6-luna` / `max`,
387
+ returned the expected list and contained no copied parent message payloads.
388
+ Approval/sandbox constraints matched the parent. Preparation added no paid call.
389
+
390
+ A separate two-turn test explicitly required inherited history. It obtained one
391
+ real recommendation, preserved `fork_turns: "all"`, made no fresh preparation and
392
+ created no child. Both tests preserved persistent configuration/trust, used no
393
+ response-modifying adapter and removed their temporary files. These are bounded
394
+ caller-driven checks, not universal model compliance or verified user provenance.
395
+
396
+
397
+ Captured event/context checks are process-local and do not observe later native
398
+ host-setting changes or host cancellation unless forwarded through the request
399
+ signal or explicit registered-context revocation. The reused profile was chosen
400
+ from the original classification summary; `same_task` is a caller declaration,
401
+ not a semantic comparison of the standalone task. Do not reuse it for different
402
+ work. Repeated preparation is idempotent, not an exactly-once spawn mechanism.
403
+ The host still owns each actual invocation and its permissions.
404
+
405
+ Private preparation digests are intentionally immutable once written, including
406
+ when a final currentness check rejects the response. This fail-closed binding
407
+ prevents changing a task under a consumed reference; it is not a plaintext backup
408
+ and is not deleted to permit a different-task retry. The advisory read-only hint
409
+ means no user file, host configuration or native execution is changed; like the
410
+ existing recommendation/cache tools, private query bookkeeping is still written.
411
+ It is not a statelessness or permission-approval claim.
412
+
413
+
414
+ The final instruction-contract candidate was also checked with explicit session
415
+ owner authorization for Aptly to choose model/effort defaults for the independent
416
+ task. The original caller-default all was denied, the caller used the declared
417
+ preparation API, and a separate none invocation ran the recommended Luna/max
418
+ child with the expected output. Exactly one Decisions request was forwarded.
419
+ A final explicit-history case preserved all and created no child. Persistent
420
+ configuration/trust stayed unchanged. An intervening candidate stopped after
421
+ recommendation when the parent treated original-fork preservation as a blanket
422
+ ban; that run remains a failed caller-follow-through observation, not successful
423
+ execution. This motivated the stricter instruction distinguishing original-call
424
+ resubmission from the only supported separate preparation protocol. These results
425
+ remain bounded and do not guarantee arbitrary parent-model compliance.
package/docs/guide/en.md CHANGED
@@ -14,7 +14,7 @@ Requires Node.js 24 or later and Claude Code or Codex. Install the latest stable
14
14
 
15
15
  ```sh
16
16
  npm install -g aptly@latest --allow-scripts=aptly
17
- aptly setup --client all --mode defaults
17
+ aptly set default
18
18
  aptly --version
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ For npm versions without this option, or to configure explicitly instead of auto
34
34
 
35
35
  ```sh
36
36
  npm install -g aptly@latest --ignore-scripts
37
- aptly setup --client all --mode defaults
37
+ aptly setup --client all
38
38
  ```
39
39
 
40
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.
@@ -47,7 +47,7 @@ Stop other host, MCP, and CLI processes using the ledger before updating, follow
47
47
 
48
48
  ```sh
49
49
  aptly update
50
- aptly setup --client all --mode defaults
50
+ aptly setup --client all
51
51
  aptly --version
52
52
  ```
53
53
 
@@ -225,16 +225,44 @@ For genuinely independent work, the caller can intentionally choose a fresh chil
225
225
  | `prepare_spawn_context` | Registers a bounded description for one exact upcoming invocation |
226
226
  | `cancel_spawn_context` | Revokes the description association, not native execution or a request already sent |
227
227
  | `retry_spawn_recommendation` | Accepts one task-description supplement using a Hook-issued retry_id |
228
+ | `prepare_fresh_delegation` | Prepares a separate independent Codex call from completed inherited advice; never executes it |
229
+
230
+ ### Confidence and abstention
231
+
232
+ `confidence` is metadata and has not been validated here as a calibrated probability of correctness. It is not currently used as an automatic-application threshold. Zero and low values are currently allowed when other application conditions hold. A missing value in a live Decisions response is rejected as an error; it remains optional in generic Router and stored results. `keep_current` and `needs_context` are separate outcomes with existing abstention and context-recovery rules. Explicit model, effort, history and permissions are preserved. A small classification pilot does not establish improved child-task quality or total cost.
233
+
234
+ <a id="outbound-data-and-disabling-automatic-sharing"></a>
235
+
236
+ ### Decisions API transmission scope
237
+
238
+ The transmission commands in this section are supported from Aptly 0.1.7.
239
+
240
+ Transmission means **sending local task information to the OpenAI Decisions API**, not providing tasks to Aptly developers. Application mode `defaults/advisory` and transmission scope are independent. New registrations use v2 policy with `unselected` scope and make no automatic transmission. Interactive `aptly set default` asks only for unselected hosts; Enter selects `none`. Noninteractive runs and postinstall neither prompt nor count as consent.
241
+
242
+ ```sh
243
+ aptly set transmission --show
244
+ aptly set transmission none
245
+ aptly set transmission description
246
+ aptly set transmission excerpt
247
+ ```
228
248
 
229
- ### Outbound data and disabling automatic sharing
249
+ The change commands above show alternatives; run only the one you want. Use `--client codex|claude|all` to select hosts. `none` disables automatic transmission and preserves the original call. `description` permits only a parent-supplied description. Without one, it requests context before calling the API and never falls back to native body or label. `defaults` denies the unresolved spawn; `advisory` supplies feedback only. `excerpt` permits existing native excerpts and explicit descriptions. Source, size and known-secret checks establish neither non-sensitive content nor user consent.
230
250
 
231
- For automatic classification, `summary` is an **excerpt assembled from an accepted task label and the clipped first paragraph** of the body. It is not a semantic rewrite or anonymization. Its UTF-8 size is at most `min(4000, max_summary_bytes)`; this is not a limit on the whole HTTP request. The opaque-message fallback in Codex uses only a sufficiently descriptive `task_name`, without decoding or transmitting that body. Labels can also contain sensitive information.
251
+ Existing v1 policies remain byte-identical and report `excerpt` with `legacy` provenance. An explicit change migrates the policy to v2 and updates its ownership receipt together. Modified policies and custom launchers are not silently adopted; conflicts preserve them. Keys, ledgers and unknown records are not deleted. Restart MCP after changes. Already-started transmission cannot be recalled; changed policy prevents in-flight results, retry and fresh preparation from applying. Do not bypass an old call-binding conflict with a new paid identity. Explicit `recommend_agent` and `aptly recommend` requests remain separate and are not prohibited by this automatic-transmission setting.
252
+
253
+ Manually setting `enabled: false` remains an emergency stop, but can conflict with ownership records. Use the commands above for normal changes and never edit ownership receipts to bypass checks.
254
+
255
+ ### Outbound content and filtering limits
256
+
257
+ Under `excerpt` scope, Without prepared context, automatic classification `summary` is an **excerpt assembled from an accepted task label and the clipped first paragraph** of the body. It is not a semantic rewrite or anonymization. Its UTF-8 size is at most `min(4000, max_summary_bytes)`; this is not a limit on the whole HTTP request. The opaque-message fallback in Codex uses only a sufficiently descriptive `task_name`, without decoding or transmitting that body. Labels can also contain sensitive information.
258
+
259
+ A valid `prepare_spawn_context` description and fixed prefix replace the native excerpt for classification; registration itself makes no API call. After a needs-context response, `retry_spawn_recommendation` can classify one new supplement with a fixed prefix, without appending the earlier body. Both paths limit the raw description to `min(3800, max_summary_bytes - 96)` bytes and the prefixed summary to `min(4000, max_summary_bytes)` bytes. `prepare_fresh_delegation` itself reuses completed advice without another classification and returns standalone instructions as local next-call arguments. A Codex call submitted with the returned explicit model and effort is currently preserved by the Hook as `explicit_model`, without classification. Checking a later call does not imply another classification. None of these paths establishes that descriptions are non-sensitive or automatically anonymized.
232
260
 
233
261
  Decisions receives `client`, `task.summary`, `task.operation`, `task.context_sufficient`, candidate profile IDs, model/effort descriptions, and configured model facts. The classification API key is sent in `Authorization`; the request ID is sent in `X-Client-Request-Id`. Automatic IDs are hashes; direct recommendation IDs are caller-supplied. Do not put secrets in IDs or candidate descriptions.
234
262
 
235
263
  To disable automatic sharing, change **only `enabled` to `false`** in the existing private policy file referenced by `APTLY_HOOK_POLICY_PATH`. Preserve the other fields and ownership record. Subsequent automatic Hook calls preserve the original call before classification or creation of a call-binding file. This cannot undo a transmission already started or recall information received by the server. Editing a generated policy can cause ownership conflicts in setup, configuration, or removal commands; those commands do not overwrite the disabled policy. Do not edit ownership records to bypass the checks.
236
264
 
237
- `mode: advisory` still transmits classification data; it is not a privacy opt-out. Removing `APTLY_HOOK_POLICY_PATH` can activate the older strict path, so do not use removal as an alternative. `enabled: false` does not block explicit `recommend_agent` or `aptly recommend` requests.
265
+ When the transmission scope permits it, `mode: advisory` still transmits classification data; it is not a privacy opt-out. Removing `APTLY_HOOK_POLICY_PATH` can activate the older strict path, so do not use removal as an alternative. `enabled: false` does not block explicit `recommend_agent` or `aptly recommend` requests.
238
266
 
239
267
  For control over the shared summary, disable automatic sharing and write only the information needed for a direct recommendation. Aptly does not automatically fetch documents at URLs or attach source files mentioned in the summary. Checks for known key and Bearer patterns do not provide complete secret detection or establish that text is safe to transmit.
240
268
 
@@ -254,6 +282,8 @@ One supplement is allowed per original call. Duplicate input reuses the cache; c
254
282
 
255
283
  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
284
 
285
+ Cache reuse requires a completed first result. An unknown outcome remains `outcome_unknown`; do not repeat a paid call with a new ID.
286
+
257
287
  `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
288
 
259
289
  ### Automatic routing guarantees and blocked outcomes (0.1.5+)
@@ -264,6 +294,14 @@ After a valid enabled policy and eligible call are established, `defaults` retur
264
294
 
265
295
  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
296
 
297
+ ### Prepare a separate independent delegation (0.1.6+)
298
+
299
+ After a defaults Hook blocks inherited application, the caller may use `prepare_fresh_delegation` only when it can declare **the same independent task, no user-required inherited history, and complete standalone instructions**. Supply the Hook/retry `retry_id`, `task_name`, `standalone_task`, and `declaration: {independent_task:true, same_task:true, original_call_outcome:"blocked", history_requirement:"not_required", standalone_context_complete:true}` on the same process. It revalidates completed allowlisted advice without another classification.
300
+
301
+ The original inherited invocation stays blocked. Review the separate `next_call.arguments` and submit it under existing delegation authorization and normal host permission checks. It includes `fork_turns: "none"` and preserves model/effort choices. This is caller-declared intent, not verified user intent or execution evidence. Do not use it for required/unknown history, fixed roles, resume or unverified additional execution arguments. A reference binds one task; five-minute expiry, cancellation, policy/catalog changes and changes to the original invocation block preparation. It is not offered for nonblocking advisory paths. See the [contract and limits](../SPAWN_CONTEXT.md#intentional-fresh-delegation).
302
+
303
+ Use this only after the host reports the original call blocked. `original_call_outcome` values `executed` and `unknown` reject preparation. This is caller-declared, not server execution observation. Repeated identical preparation does not guarantee single child execution. The profile was selected from the original classification summary and must not be reused for a different task.
304
+
267
305
  ## Direct recommendations
268
306
 
269
307
  The `recommend_agent` MCP tool and CLI `recommend` accept a task summary and recommend a profile. They do not spawn subagents. Pass this JSON as MCP tool arguments, or save it to a file and provide it to the CLI through standard input.
package/docs/guide/ja.md CHANGED
@@ -14,7 +14,7 @@ Node.js 24 以上と Claude Code または Codex が必要です。npm の最新
14
14
 
15
15
  ```sh
16
16
  npm install -g aptly@latest --allow-scripts=aptly
17
- aptly setup --client all --mode defaults
17
+ aptly set default
18
18
  aptly --version
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ aptly --version
34
34
 
35
35
  ```sh
36
36
  npm install -g aptly@latest --ignore-scripts
37
- aptly setup --client all --mode defaults
37
+ aptly setup --client all
38
38
  ```
39
39
 
40
40
  スクリプトの実行にかかわらず、明示的な `setup` を利用できます。既存の起動パスは保持するため、旧パスのエラーは以下の復旧手順に従ってください。キー設定・MCP の再起動と Codex の `/hooks` 信頼確認は別途必要です。
@@ -47,7 +47,7 @@ aptly setup --client all --mode defaults
47
47
 
48
48
  ```sh
49
49
  aptly update
50
- aptly setup --client all --mode defaults
50
+ aptly setup --client all
51
51
  aptly --version
52
52
  ```
53
53
 
@@ -225,16 +225,44 @@ Codex の本文が不透明な場合、`cleanup_merged_worktrees` のような
225
225
  | `prepare_spawn_context` | 正確に一致する予定呼び出しに上限付きの説明を登録します |
226
226
  | `cancel_spawn_context` | 説明の対応付けを取り消します。native 実行や送信済みリクエストは取り消しません |
227
227
  | `retry_spawn_recommendation` | Hook が返す retry_id を使い、タスク説明を一度補って再推薦します |
228
+ | `prepare_fresh_delegation` | 完了済みの継承推薦から別の独立 Codex 呼び出し引数を準備し、実行はしません |
229
+
230
+ ### confidence と推薦の保留
231
+
232
+ `confidence` はメタデータであり、校正された正解確率としては検証されていません。現在、自動適用の閾値としては使用しません。現在は他の適用条件を満たせば、0 や低い値も許容します。実際の Decisions 応答で値が欠けている場合はエラーとして拒否しますが、汎用 Router と保存結果では任意項目です。`keep_current` と `needs_context` は数値とは別の結果であり、既存の保留・文脈補足規則に従います。明示されたモデル・effort・履歴・権限は保持します。小規模な分類評価だけで、子タスクの品質や総費用の改善を主張しません。
233
+
234
+ <a id="外部送信と自動共有の無効化"></a>
235
+
236
+ ### Decisions API への送信範囲
237
+
238
+ この節の送信範囲コマンドは Aptly 0.1.7 以降で利用できます。
239
+
240
+ ここでの送信は、**ローカルのタスク情報を OpenAI Decisions API に送ること**であり、Aptly の開発者にタスクを提供する機能ではありません。適用モード `defaults/advisory` と送信範囲は別の設定です。新規登録は v2 ポリシーの `unselected` となり、自動送信しません。対話形式の `aptly set default` は未選択のホストだけに範囲を尋ね、Enter では `none` を選択します。非対話実行と postinstall は質問せず、同意したものとして扱いません。
241
+
242
+ ```sh
243
+ aptly set transmission --show
244
+ aptly set transmission none
245
+ aptly set transmission description
246
+ aptly set transmission excerpt
247
+ ```
228
248
 
229
- ### 外部送信と自動共有の無効化
249
+ 変更コマンドは選択肢を示しています。希望する一つだけを実行してください。`--client codex|claude|all` で対象を選べます。`none` は自動送信を停止し、元の呼び出しを保持します。`description` は親エージェントが提供した説明だけを許可します。説明がなければ API 呼び出し前に文脈補足を求め、native 本文やラベルには自動で切り替えません。`defaults` は未解決の spawn を拒否し、`advisory` は案内のみを返します。`excerpt` は既存の native 抜粋と明示的な説明を許可します。出所・サイズ・既知の秘密パターンの検査は、非機密性やユーザーの同意を証明しません。
230
250
 
231
- 自動分類の `summary` は、有効なタスクラベルと本文の**最初の段落を切り詰めて組み合わせた抜粋**です。意味を再要約したものでも、匿名化したものでもありません。UTF-8 のサイズは `min(4000, max_summary_bytes)` 以下ですが、HTTP リクエスト全体の上限ではありません。Codex の opaque メッセージへのフォールバックでは、本文を復号・送信せず、十分に具体的な `task_name` だけを使用します。ラベルにも機密情報が含まれる可能性があります。
251
+ 既存の v1 ポリシーはバイト単位で保持され、出所 `legacy` の `excerpt` と表示されます。明示的な変更時だけ v2 に移行し、所有権記録も同時に更新します。変更済みポリシーや独自ランチャーを自動で引き継がず、競合時は保持します。キー・台帳・不明な記録は削除しません。変更後は MCP を再起動してください。開始済みの送信は回収できず、ポリシー変更前の処理中結果・retry・fresh 準備は適用されません。既存の結合競合を新しい有料 ID で回避しないでください。明示的な `recommend_agent` と `aptly recommend` は別の要求であり、この自動送信設定では禁止しません。
252
+
253
+ 手動の `enabled: false` は緊急停止として有効ですが、所有権記録と競合する場合があります。通常の変更には上記コマンドを使い、検査を回避するために所有権記録を編集しないでください。
254
+
255
+ ### 送信内容とフィルターの限界
256
+
257
+ `excerpt` の範囲では、事前登録された説明がない場合、自動分類の `summary` は、有効なタスクラベルと本文の**最初の段落を切り詰めて組み合わせた抜粋**です。意味を再要約したものでも、匿名化したものでもありません。UTF-8 のサイズは `min(4000, max_summary_bytes)` 以下ですが、HTTP リクエスト全体の上限ではありません。Codex の opaque メッセージへのフォールバックでは、本文を復号・送信せず、十分に具体的な `task_name` だけを使用します。ラベルにも機密情報が含まれる可能性があります。
258
+
259
+ 有効な `prepare_spawn_context` の説明は、固定の接頭辞とともに native の抜粋に代わって分類に使用されます。登録自体は API を呼び出しません。文脈不足の応答後、`retry_spawn_recommendation` は以前の本文を付け加えず、固定の接頭辞と新しい補足説明で一度だけ再推薦できます。両経路とも説明原文は `min(3800, max_summary_bytes - 96)` バイト以下、接頭辞を含む説明は `min(4000, max_summary_bytes)` バイト以下です。`prepare_fresh_delegation` 自体は完了済みの推薦を再利用し、追加の分類を呼び出さず、独立した指示をローカルの次回呼び出し引数として返します。返されたモデルと effort をそのまま明示した Codex 呼び出しは、現在の Hook で `explicit_model` として分類せずに保持されます。後続の呼び出しを検査することは、追加の分類を意味しません。どの経路も、説明に機密情報が含まれないことや自動的な匿名化を保証しません。
232
260
 
233
261
  Decisions には `client`、`task.summary`、`task.operation`、`task.context_sufficient` と、候補プロファイル ID・モデルと effort の説明・設定したモデル特性を送信します。分類用 API キーは `Authorization` ヘッダー、リクエスト ID は `X-Client-Request-Id` ヘッダーで送信します。自動経路の ID はハッシュで、直接推薦の ID は呼び出し元が指定します。ID や候補の説明にも秘密情報を含めないでください。
234
262
 
235
263
  自動共有を無効にするには、`APTLY_HOOK_POLICY_PATH` が指す既存の非公開ポリシーファイルで、**`enabled` だけを `false` に変更**してください。他のフィールドと所有権の記録は保持してください。その後の自動 Hook 呼び出しは、分類や呼び出しバインディングファイルの作成前に元の呼び出しを保持します。開始済みの送信を取り消したり、サーバーが受信した情報を回収したりすることはできません。生成済みのポリシーを変更すると、登録・設定・削除コマンドの所有権検査で競合する場合があり、それらのコマンドは無効化したポリシーを上書きしません。検査を回避するために所有権の記録を編集しないでください。
236
264
 
237
- `mode: advisory` でも分類データは送信されるため、プライバシー上の共有停止にはなりません。`APTLY_HOOK_POLICY_PATH` を削除すると従来の strict 経路が有効になる場合があるため、共有停止の代わりにしないでください。`enabled: false` は、明示的な `recommend_agent` や `aptly recommend` のリクエストを止めるものではありません。
265
+ 送信範囲で許可されていれば `mode: advisory` でも分類データは送信されるため、プライバシー上の共有停止にはなりません。`APTLY_HOOK_POLICY_PATH` を削除すると従来の strict 経路が有効になる場合があるため、共有停止の代わりにしないでください。`enabled: false` は、明示的な `recommend_agent` や `aptly recommend` のリクエストを止めるものではありません。
238
266
 
239
267
  共有する要約を自分で選ぶ場合は、自動共有を無効にしてから直接推薦に必要な情報だけを記述してください。Aptly は要約中の URL の文書や、言及されたソースファイルを自動取得・添付しません。既知のキーや Bearer のパターン検査は、完全な秘密情報の検出や送信の安全性を保証しません。
240
268
 
@@ -254,6 +282,8 @@ Decisions には `client`、`task.summary`、`task.operation`、`task.context_su
254
282
 
255
283
  再推薦の応答は `next_call.set_if_unspecified` に次の native 呼び出しで補う具体的な未指定フィールドを返します。明示済みのモデル・effort は含めず、Claude に effort を追加しません。履歴などで適用できない結果には `next_call` を返しません。実行証拠や権限承認ではありません。
256
284
 
285
+ キャッシュを再利用できるのは最初の結果が完了した場合です。結果が不明なら `outcome_unknown` を保持し、新しい ID で有料呼び出しを繰り返さないでください。
286
+
257
287
  `context_retry_allowed: false` は追加の文脈補足を終了する意味です。互換性のある推薦の `caller_review_required` は親が引数を確認する意味であり、新しいユーザー承認の要求ではありません。既存の委任権限とホストの権限確認は引き続き適用されます。
258
288
 
259
289
  ### 自動ルーティングの保証範囲と拒否結果(0.1.5 以降)
@@ -264,6 +294,14 @@ Decisions には `client`、`task.summary`、`task.operation`、`task.context_su
264
294
 
265
295
  復旧 ID があれば、同じ MCP プロセスで `get_spawn_routing_observation({retry_id})` を呼べます。従来の `{client, event}` 形式も使えますが、混在や不完全な入力は拒否します。元の `awaiting_context` と `context_retry.outcome` は別の段階です。拒否した重複要求は `last_attempt` に記録し、以前の分類結果を上書きしません。照会は有料要求を発行せず、保持期限も延長しません。実行は常に `not_observed` であり、推薦や引数更新は実際の子の実行証拠ではありません。
266
296
 
297
+ ### 別の独立した委任を準備する(0.1.6 以降)
298
+
299
+ defaults Hook が継承呼び出しへの適用を拒否した後、呼び出し元が**同じ独立タスクであり、ユーザーが継承履歴を要求せず、完全な独立指示を渡せる**と宣言できる場合だけ `prepare_fresh_delegation` を使えます。同じプロセスで Hook または再推薦の `retry_id`、`task_name`、`standalone_task` と `declaration: {independent_task:true, same_task:true, original_call_outcome:"blocked", history_requirement:"not_required", standalone_context_complete:true}` を渡してください。完了済みの許可プロファイルを再確認し、分類を追加で呼びません。
300
+
301
+ 元の継承呼び出しは拒否されたままです。別の `next_call.arguments` を確認し、既存の委任権限と通常のホスト権限確認の下で新しい呼び出しを送ってください。`fork_turns: "none"` と、元の選択を保つモデル・effort を含みます。呼び出し元の宣言であり、ユーザー意図や実行を検証するものではありません。履歴が必要・不明、固定役割、resume、未検証の追加実行引数がある場合は使わないでください。参照は一つのタスクだけに結び付き、5分の期限・取消・ポリシー/候補/元の呼び出しの変更で準備を止めます。元の実行を許す advisory 経路には提供しません。[契約と制限](../SPAWN_CONTEXT.md#intentional-fresh-delegation)を確認してください。
302
+
303
+ ホストが元の呼び出しの拒否を報告した後だけ使ってください。`original_call_outcome` が `executed` または `unknown` なら準備を拒否します。これは呼び出し元の宣言で、サーバーの実行観測ではありません。同じ準備の反復は子の一回実行を保証しません。プロファイルは元の分類要約に基づくため別タスクに再利用しないでください。
304
+
267
305
  ## 直接推薦
268
306
 
269
307
  `recommend_agent` MCP と CLI の `recommend` は、タスク要約を受け取ってプロファイルを推薦します。子エージェントを直接生成することはありません。以下の JSON を MCP ツールの引数として渡すか、ファイルに保存して CLI の標準入力に渡してください。
package/docs/guide/ko.md CHANGED
@@ -14,7 +14,7 @@ Node.js 24 이상과 Claude Code 또는 Codex가 필요합니다. npm의 최신
14
14
 
15
15
  ```sh
16
16
  npm install -g aptly@latest --allow-scripts=aptly
17
- aptly setup --client all --mode defaults
17
+ aptly set default
18
18
  aptly --version
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ aptly --version
34
34
 
35
35
  ```sh
36
36
  npm install -g aptly@latest --ignore-scripts
37
- aptly setup --client all --mode defaults
37
+ aptly setup --client all
38
38
  ```
39
39
 
40
40
  명시적 `setup`은 설치 스크립트 실행 여부와 관계없이 사용할 수 있습니다. 기존 실행 경로는 보존하므로 구버전 경로 오류는 아래 복구 절차를 따르십시오. 키 설정·MCP 재시작과 Codex의 `/hooks` 신뢰 승인은 별도로 필요합니다.
@@ -47,7 +47,7 @@ aptly setup --client all --mode defaults
47
47
 
48
48
  ```sh
49
49
  aptly update
50
- aptly setup --client all --mode defaults
50
+ aptly setup --client all
51
51
  aptly --version
52
52
  ```
53
53
 
@@ -225,16 +225,44 @@ Codex 본문이 불투명할 때 `cleanup_merged_worktrees`처럼 구체적인
225
225
  | `prepare_spawn_context` | 정확한 예정 호출에 제한된 설명을 등록합니다 |
226
226
  | `cancel_spawn_context` | 등록한 설명의 연결을 취소하며 native 실행이나 이미 전송된 요청을 취소하지 않습니다 |
227
227
  | `retry_spawn_recommendation` | Hook의 `retry_id`로 작업 설명을 한 번 보충해 재추천합니다 |
228
+ | `prepare_fresh_delegation` | 완료된 상속 추천으로 별도의 독립 Codex 호출 인자를 준비하며 실행하지 않습니다 |
229
+
230
+ ### confidence와 추천 보류
231
+
232
+ `confidence`는 메타데이터이며 보정된 정답 확률로 검증되지 않았습니다. 현재 자동 적용 임계값으로 사용하지 않습니다. 현재 0과 낮은 값도 다른 적용 조건을 만족하면 허용합니다. 실제 Decisions 응답에서 값이 누락되면 오류로 거절하지만, 일반 Router·저장 결과에서는 선택 항목입니다. `keep_current`·`needs_context`는 숫자와 별개의 결과이며 기존 보류·문맥 보충 규칙을 따릅니다. 명시한 모델·effort·이력·권한은 보존합니다. 소규모 분류 평가만으로 자식 작업의 품질·총비용 개선을 주장하지 않습니다.
233
+
234
+ <a id="외부-전송과-자동-공유-끄기"></a>
235
+
236
+ ### Decisions API 전송 범위
237
+
238
+ 이 절의 전송 범위 명령은 Aptly 0.1.7부터 지원합니다.
239
+
240
+ 여기서 전송은 **로컬 작업 정보를 OpenAI Decisions API에 보내는 것**이며 Aptly 개발자에게 작업을 제공하는 기능이 아닙니다. 적용 모드 `defaults/advisory`와 전송 범위는 별개입니다. 신규 등록은 v2 정책의 `unselected` 상태이며 자동 전송하지 않습니다. 대화형 `aptly set default`는 미선택 호스트에만 범위를 묻고 Enter의 기본 선택은 `none`입니다. 비대화형 실행·postinstall은 묻거나 동의한 것으로 처리하지 않습니다.
241
+
242
+ ```sh
243
+ aptly set transmission --show
244
+ aptly set transmission none
245
+ aptly set transmission description
246
+ aptly set transmission excerpt
247
+ ```
228
248
 
229
- ### 외부 전송과 자동 공유 끄기
249
+ 위 변경 명령은 세 가지 대안을 보여 줍니다. 원하는 하나만 실행하십시오. `--client codex|claude|all`로 대상을 고를 수 있습니다. `none`은 자동 전송을 끄고 원래 호출을 보존합니다. `description`은 부모 에이전트가 제공한 설명만 허용합니다. 설명이 없으면 API 호출 전에 문맥 보충을 요청하며 native 본문·라벨로 자동 대체하지 않습니다. `defaults`는 해결 전 스폰을 차단하고 `advisory`는 안내만 제공합니다. `excerpt`는 기존 native 발췌와 명시 설명을 허용합니다. 설명의 출처·크기·민감 패턴 검사는 비민감성이나 사용자 동의를 인증하지 않습니다.
230
250
 
231
- 자동 분류의 `summary`는 허용된 작업 라벨과 본문의 **첫 문단을 잘라 붙인 발췌문**입니다. 의미를 새로 요약하거나 익명화하지 않습니다. UTF-8 크기는 `min(4000, max_summary_bytes)` 이하이며 전체 HTTP 요청의 크기 제한은 아닙니다. Codex의 opaque 메시지 fallback은 본문을 해독·전송하지 않고 충분히 구체적인 `task_name`만 사용합니다. 라벨에도 민감한 정보가 들어갈 수 있습니다.
251
+ 기존 v1은 `legacy` 출처의 `excerpt`로 표시하고 바이트 그대로 유지합니다. 명시 변경은 정책을 v2로 전환하고 소유권 기록을 함께 갱신합니다. 운영자가 수정한 정책·다른 실행 래퍼는 자동으로 인수하지 않으며 충돌 시 보존합니다. 키·원장·불명 기록은 삭제하지 않습니다. 변경 후 MCP를 재시작하십시오. 이미 시작된 전송을 회수하지 못하며 진행 중 결과·retry·fresh는 변경된 정책으로 적용되지 않습니다. 이전 호출 ID의 결합 충돌은 새 유료 ID로 우회하지 마십시오. 명시적 `recommend_agent`·`aptly recommend`는 별도 요청이며 이 자동 전송 설정으로 금지하지 않습니다.
252
+
253
+ 수동으로 `enabled: false`를 편집하는 기존 긴급 중단도 유효하지만 소유권 충돌이 생길 수 있습니다. 일반 변경에는 위 명령을 사용하고 소유권 기록을 직접 편집하지 마십시오.
254
+
255
+ ### 전송 내용과 필터 한계
256
+
257
+ `excerpt` 범위에서 사전 등록 설명이 없는 자동 분류의 `summary`는 허용된 작업 라벨과 본문의 **첫 문단을 잘라 붙인 발췌문**입니다. 의미를 새로 요약하거나 익명화하지 않습니다. UTF-8 크기는 `min(4000, max_summary_bytes)` 이하이며 전체 HTTP 요청의 크기 제한은 아닙니다. Codex의 opaque 메시지 fallback은 본문을 해독·전송하지 않고 충분히 구체적인 `task_name`만 사용합니다. 라벨에도 민감한 정보가 들어갈 수 있습니다.
258
+
259
+ `prepare_spawn_context`에 유효한 설명을 등록하면 고정 접두사와 그 설명이 native 발췌 대신 분류에 사용됩니다. 등록 자체는 API를 호출하지 않습니다. `retry_spawn_recommendation`은 문맥 부족 응답 이후 고정 접두사와 새 보충 설명으로 한 번 재추천하며, 이전 본문을 덧붙이지 않습니다. 두 경로 모두 원시 설명은 `min(3800, max_summary_bytes - 96)` 바이트 이하이고 접두사 포함 설명은 `min(4000, max_summary_bytes)` 바이트 이하입니다. `prepare_fresh_delegation` 자체는 완료된 추천을 재사용해 추가 분류를 호출하지 않으며, 독립 지시를 로컬의 다음 호출 인자로 반환합니다. 반환된 모델·effort를 그대로 명시한 Codex 호출은 현재 Hook에서 `explicit_model`로 분류 없이 보존됩니다. 이후 호출의 경유 검사가 추가 분류를 뜻하지는 않습니다. 어느 경로도 설명의 비민감성이나 자동 익명화를 보장하지 않습니다.
232
260
 
233
261
  Decisions에는 `client`, `task.summary`, `task.operation`, `task.context_sufficient`와 후보 프로필 ID·모델·effort 설명 및 설정된 모델 특성이 전달됩니다. 분류용 API 키는 `Authorization` 헤더로, 요청 ID는 `X-Client-Request-Id` 헤더로 전송됩니다. 자동 경로의 ID는 해시이며 직접 추천의 ID는 호출자가 지정합니다. ID나 후보 설명에도 비밀을 넣지 마십시오.
234
262
 
235
263
  자동 공유를 끄려면 `APTLY_HOOK_POLICY_PATH`가 가리키는 기존 비공개 정책 파일에서 **`enabled`만 `false`로 변경**하십시오. 나머지 필드와 소유권 기록은 유지하십시오. 이후 자동 Hook 호출은 분류 API나 호출 바인딩 파일을 만들기 전에 원래 호출을 보존합니다. 이미 시작한 전송을 되돌리거나 서버가 받은 내용을 회수하지는 못합니다. 생성된 정책을 바꾸면 설치·설정·제거 명령의 소유권 검사에서 충돌할 수 있으며, 해당 명령은 끄기 설정을 덮어쓰지 않습니다. 소유권 기록을 수정해 검사를 우회하지 마십시오.
236
264
 
237
- `mode: advisory`도 분류 정보를 전송하므로 개인정보 보호용 비활성화가 아닙니다. `APTLY_HOOK_POLICY_PATH`를 지우면 기존 strict 경로로 전환될 수 있으므로 공유 끄기의 대안으로 사용하지 마십시오. `enabled: false`는 명시적인 `recommend_agent`·`aptly recommend` 요청까지 차단하지 않습니다.
265
+ 전송 범위가 허용하면 `mode: advisory`도 분류 정보를 전송하므로 개인정보 보호용 비활성화가 아닙니다. `APTLY_HOOK_POLICY_PATH`를 지우면 기존 strict 경로로 전환될 수 있으므로 공유 끄기의 대안으로 사용하지 마십시오. `enabled: false`는 명시적인 `recommend_agent`·`aptly recommend` 요청까지 차단하지 않습니다.
238
266
 
239
267
  공유할 요약을 직접 선택하려면 자동 공유를 끈 뒤 직접 추천에 필요한 정보만 작성하십시오. Aptly는 요약에 적은 URL의 문서나 소스 파일을 자동으로 읽어 첨부하지 않습니다. 알려진 키·Bearer 패턴을 거르는 검사는 완전한 비밀 탐지나 전송 안전성 보장이 아닙니다.
240
268
 
@@ -254,6 +282,8 @@ Decisions에는 `client`, `task.summary`, `task.operation`, `task.context_suffic
254
282
 
255
283
  재추천 응답의 `next_call.set_if_unspecified`는 다음 native 호출에 넣을 미지정 필드만 제공합니다. 명시한 모델·effort는 포함하지 않으며 Claude에는 effort를 추가하지 않습니다. 이력 등으로 적용이 막히면 `next_call`을 제공하지 않습니다. 이 값은 실행 결과나 권한 승인이 아닙니다.
256
284
 
285
+ 캐시 재사용은 첫 결과가 완료된 경우에 한합니다. 결과가 불명이면 `outcome_unknown`으로 유지하며 새 ID로 유료 호출을 반복하지 마십시오.
286
+
257
287
  `context_retry_allowed: false`는 추가 설명 보충을 더 허용하지 않는다는 뜻입니다. 호환 가능한 추천에서 `caller_review_required`는 부모가 인자를 검토한다는 의미이며 새 사용자 승인을 요구하지 않습니다. 기존 위임 권한과 호스트 권한 검사는 그대로 유지됩니다.
258
288
 
259
289
  ### 자동 경유의 보장 범위와 차단 결과 (0.1.5부터)
@@ -264,6 +294,14 @@ Decisions에는 `client`, `task.summary`, `task.operation`, `task.context_suffic
264
294
 
265
295
  복구 ID가 있으면 `get_spawn_routing_observation({retry_id})`로 같은 MCP 프로세스의 관측을 조회할 수 있습니다. 또는 기존 `{client, event}`를 사용하십시오. 두 형식을 섞거나 일부만 보내면 거부합니다. 원래 `awaiting_context`와 `context_retry.outcome`은 별개이며, 거부된 중복 요청은 `last_attempt`에 표시해 이전 분류 결과를 덮어쓰지 않습니다. 조회는 유료 요청을 만들지 않고 보관 시간을 연장하지 않습니다. 실행은 항상 `not_observed`이므로 추천이나 인자 갱신을 실제 자식 실행으로 표현하지 마십시오.
266
296
 
297
+ ### 상속 추천에서 별도 독립 위임 준비 (0.1.6부터)
298
+
299
+ `defaults`가 상속 적용을 차단한 뒤에도 호출자가 **같은 독립 작업이며 사용자에게 필요한 상속 이력이 없고 완전한 독립 지시를 제공할 수 있음**을 선언하면, 같은 프로세스에서 `prepare_fresh_delegation`을 호출할 수 있습니다. Hook 또는 재추천에서 받은 `retry_id`, `task_name`, `standalone_task`와 `declaration: {independent_task:true, same_task:true, original_call_outcome:"blocked", history_requirement:"not_required", standalone_context_complete:true}`를 전달하십시오. API는 이미 완료된 허용 프로필을 재검증하고 분류를 추가 호출하지 않습니다.
300
+
301
+ 원래 상속 호출은 차단된 채 유지됩니다. 응답의 별도 `next_call.arguments`를 검토한 뒤 기존 위임 권한과 호스트 권한 검사에 따라 새 호출을 제출하십시오. `fork_turns: "none"`과 기존 선택을 보존한 모델·effort를 포함합니다. 이 API가 사용자 의도나 실제 실행을 확인한 것은 아닙니다. 이력이 필요하거나 불명확한 경우, 역할·resume·검증하지 않은 추가 실행 인자가 있는 경우에는 사용하지 마십시오. 같은 참조는 같은 작업에만 재사용할 수 있으며 5분 만료·취소·정책/후보 변경과 원래 호출 변경은 준비를 막습니다. `advisory`처럼 원래 실행을 허용한 경로에는 제공하지 않습니다. [계약과 한계](../SPAWN_CONTEXT.md#intentional-fresh-delegation)를 확인하십시오.
302
+
303
+ 이 경로는 호스트가 원래 호출의 차단 결과를 돌려준 뒤에만 사용하십시오. `original_call_outcome`이 `executed` 또는 `unknown`이면 준비를 거절합니다. 이는 호출자 선언이며 서버의 실행 관측이 아닙니다. 동일 준비 응답을 여러 번 받는 것이 자식 실행 1회를 보장하지 않으며, 프로필은 원래 분류 요약을 기준으로 선택됐으므로 다른 작업에 재사용하면 안 됩니다.
304
+
267
305
  ## 직접 추천
268
306
 
269
307
  `recommend_agent` MCP와 CLI `recommend`는 작업 요약을 받아 프로필을 추천합니다. 자식을 직접 생성하지 않습니다. 아래 JSON을 MCP 도구 인자로 전달하거나 파일에 저장해 CLI의 표준 입력으로 제공하십시오.