axstack 0.59.1 → 0.60.0

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.
Files changed (35) hide show
  1. package/docs/ceremony-baseline-20261103.md +96 -0
  2. package/docs/workflows.md +34 -13
  3. package/package.json +1 -1
  4. package/skills/axstack/references/automations.md +4 -3
  5. package/skills/axstack/references/autopilot.md +7 -3
  6. package/skills/axstack/references/candidate-publication.md +19 -3
  7. package/skills/axstack/references/contracts.md +8 -2
  8. package/skills/axstack/references/diligence.md +37 -0
  9. package/skills/axstack/references/fleet-dispatch.md +111 -9
  10. package/skills/axstack/references/fleet-route-schema.md +80 -3
  11. package/skills/axstack/references/fleet-verification.md +43 -1
  12. package/skills/axstack/references/lifecycle.md +29 -12
  13. package/skills/axstack/references/pr-chain.md +4 -1
  14. package/skills/axstack/references/role-roster.md +5 -2
  15. package/skills/axstack/references/run-record.md +23 -0
  16. package/skills/axstack/references/t3-runtime.md +48 -10
  17. package/skills/axstack/scripts/dispatch-plan.js +68 -18
  18. package/skills/axstack/scripts/fleet-route-cli.js +18 -9
  19. package/skills/axstack/scripts/fleet-route-plan.js +138 -0
  20. package/skills/axstack/scripts/fleet-route.js +6 -2
  21. package/skills/axstack-align/SKILL.md +17 -1
  22. package/skills/axstack-audit/SKILL.md +17 -2
  23. package/skills/axstack-cleanup/SKILL.md +13 -4
  24. package/skills/axstack-implement/SKILL.md +59 -13
  25. package/skills/axstack-implement/references/step-back.md +9 -1
  26. package/skills/axstack-review/SKILL.md +8 -3
  27. package/skills/axstack-review/references/candidate-brief.md +3 -1
  28. package/skills/axstack-review/references/review-candidate.md +20 -7
  29. package/skills/axstack-review/references/review-receipt.md +5 -1
  30. package/skills/axstack-spec/SKILL.md +23 -7
  31. package/skills/axstack-watch/SKILL.md +5 -0
  32. package/skills/axstack-watch/references/escalation.md +4 -2
  33. package/skills/axstack-watch/references/proven-verification.md +5 -2
  34. package/skills/axstack-watch/references/readiness.md +20 -8
  35. package/src/instructions.js +6 -4
@@ -14,7 +14,49 @@ options/full-access, repository/project identities, exact candidate/base, explic
14
14
  start/end times and a maximum of one harmless nonwriter per distinct route config.
15
15
  No overload stress, installation, global policy edits, raw provider CLI or production
16
16
  writes belong to this procedure. Exclude any unverified route from enabled coverage.
17
- No top-level thread without an explicit new-thread request.
17
+ No top-level thread without an explicit new-thread request, including only a
18
+ runtime-accepted user standing intake grant for its one whole-task hand-off.
19
+
20
+ ## Whole-task intake pilot (CR-3)
21
+
22
+ T4 ships helpers/rules only. Keep `intakeRouting` off (missing = false) until
23
+ the separate rollout completes. First release these rules, then add the user's
24
+ worker-host intake exception and standing explicit new-thread grant on all five
25
+ hosts, then pilot one real small task per pool host by explicitly naming it.
26
+ Only T8 flips the account-local switch. Rollback is `intakeRouting:false`.
27
+
28
+ From a successful named-host pilot outcome, the driver must write a support
29
+ record for the launching host and provider in `fleet-routing.json`, with
30
+ `supported:true` and evidence.
31
+ On pilot failure, the driver must remove the named destination host from the
32
+ pool list and write no support record.
33
+ A named-host pilot needs no pre-existing support record and bypasses the
34
+ automatic switch.
35
+ An explicit named host (pilot) ignores `intakeSupport`, including malformed
36
+ values; all other pre-launch, staffing and sole-driver checks still apply.
37
+ Unnamed automatic hand-offs without a record stay local with `routing unsupported`.
38
+ Authority, destination checks, staffing and sole-driver ownership apply to both paths.
39
+ Unreachable/failing pool hosts leave eligibility; one failure does not block
40
+ the other pilots. Record iosatellite's actual provisioning and closed-lid proof
41
+ separately from attended reachability. No credential copying is authorized.
42
+
43
+ Retain exact facts-directory bytes (sample, links, projects and destination
44
+ catalogs), config pin/time, plan, dispatch-plan output and native thread reads.
45
+ Verify reachable destination, correct project, T3 clone-if-missing (failed clone
46
+ excludes that host, next host else local), isolation, pinned driver and local
47
+ author/different-provider reviewer plus needed advisers. Use `dispatch-plan
48
+ --verify` on native thread/recentRuns; missing fields remain unknown.
49
+
50
+ Prove acceptance-only first run, exact single marker, origin ownership until
51
+ accept, link recording and one proceed with stable clientRequestId. Both waits
52
+ follow native `next`, holding while active or unconfirmed. Verify the origin
53
+ stops and all later workers run locally at the destination without rerouting.
54
+ Exercise hand-back and local staffing holds, then one owned lost-reply retry
55
+ with the same launch key across hosts. Reconcile by fully paginated destination
56
+ `t3_thread_list` including subagents. Offline controls cover multiple/zero
57
+ matches, missing pages, wrong readback, never-started and silent first runs;
58
+ all hold rather than creating a second driver. Do not create real orphaned
59
+ production tasks for these negative controls. Mark unobserved live rows UNKNOWN.
18
60
 
19
61
  Create a fresh 0700 scratch outside HOME on each participating host; record each
20
62
  literal path with hostId/environmentId. Before use validate owner, realpath and
@@ -18,8 +18,12 @@ For a logical Coordinator coordinating project drivers, follow
18
18
  Workers launch no recursive teams.
19
19
  - Reviewers: first peer review = two configured roles with the same brief and isolated first
20
20
  pass. Peer follow-up uses one reviewer under [Peer mode](../../axstack-review/SKILL.md#peer-mode-colleague-pr);
21
- authored = one eligible role from author provenance. Each uses a
22
- separate driver-made detached checkout and private per-attempt evidence folder. Owner and author never review.
21
+ authored = one eligible role from author provenance. Peer reviewers each use a
22
+ separate driver-made detached checkout and private per-attempt evidence folder.
23
+ Authored reviewers use native
24
+ `isolation:"worktree"`, verify their own worktree differs from the driver's,
25
+ and check out and verify the exact candidate SHA and base inside it, with
26
+ a private per-attempt evidence folder. Owner and author never review.
23
27
  - Automation review manager: see
24
28
  [Review automation health](#review-automation-health).
25
29
  - Auditor (`axstack-auditor`): report-only; never edits, merges, activates, or
@@ -145,8 +149,10 @@ unresolved launch receipts and stalls through native state. Idle is not complete
145
149
  thread/run identity mismatches rather than borrowing identities. Retain a
146
150
  user-taken-over thread without cleanup commands.
147
151
 
148
- After accepting task or run completion, the driver invokes
149
- [axstack-cleanup](../../axstack-cleanup/SKILL.md) inline; it never dispatches cleanup work.
152
+ At [run checkpoints](../../axstack-cleanup/SKILL.md#run-checkpoints), the driver invokes
153
+ [axstack-cleanup](../../axstack-cleanup/SKILL.md) inline to batch eligible cleanup,
154
+ including reviewer worktree retirement, preserving and reading back evidence first
155
+ with every existing per-resource guard; it never dispatches cleanup work.
150
156
  Axstack creates no heartbeat or substitute scheduler.
151
157
  Tracking grants no merge, release, model-substitution, or scope authority.
152
158
 
@@ -165,9 +171,13 @@ complete a provider continuation. Driver-only forge/cleanup ownership is unchang
165
171
 
166
172
  The default 24-hour deadline covers standalone task-owned timers. Stop them at
167
173
  deadline and preserve remaining work; the review automation has no task-owned
168
- deadline. Merge-ready requires applicable review receipt(s) and current diligence
169
- `PASS` at the exact head; CI/tests alone are insufficient. Merge-ready
170
- differs from merged.
174
+ deadline. Follow the [applicable diligence gate](diligence.md#applicable-diligence-gate).
175
+ Merge-ready requires applicable review receipt(s) and current diligence evidence
176
+ at the exact head and base: same cross-provider reviewer's `APPROVE` plus
177
+ `Scope: PASS` for eligible small non-risk-path work, otherwise separate diligence
178
+ `PASS`; CI/tests alone are insufficient. `Scope: FINDINGS` or `Scope: UNKNOWN`
179
+ blocks merge-ready, and any head or base change requires refreshed receipts.
180
+ Merge-ready differs from merged.
171
181
 
172
182
  ## Review automation health
173
183
 
@@ -181,9 +191,14 @@ Build no custom scheduler, state engine or legacy fallback. See
181
191
 
182
192
  ## Audit hook (close-out and meaningful checkpoints)
183
193
 
184
- Audit measurement is enabled by default for every substantive run; dispatch
185
- follows [Close-out](#close-out) or a material-deviation/repeated-repair
186
- checkpoint. An `axstack-audit` run is excluded; it launches no children.
194
+ Auditing is enabled for every substantive run by default, except small-path runs.
195
+ Small-path runs dispatch audit only on request, on a material deviation or
196
+ after repeated repairs. Dispatch follows [Close-out](#close-out) or a
197
+ material-deviation/repeated-repair checkpoint.
198
+ Never dispatch audit on every small run. Record the small-path trigger or its
199
+ absence in the run record; non-zero counts alone do not require a small-path
200
+ audit. An `axstack-audit` run is
201
+ excluded; it launches no children.
187
202
  For supported nonrepo report runs, keep the originating workflow and inherited
188
203
  auditor roles in [Local artifacts](local-artifacts.md); standalone audit uses
189
204
  workflow audit and never audits itself. Conditional advice uses that matrix
@@ -197,7 +212,9 @@ nothing without tested independent review.
197
212
  Close-out requires the [close-out acceptance table](run-record.md#close-out-acceptance).
198
213
 
199
214
  PRs merge by forge state; close out: (1) settle every T3 worker run and archive eligible threads. Settle each worker thread with `t3_thread_organize` only if needed and read back `settled: true`, because a finished task does not count. For merged or closed PR authors, follow the [native/manual read-first path](t3-runtime.md#native-pr-links-and-watches); (2) compact record with counts and denominators—user
200
- interventions/deviations from plan/repairs; (3) `axstack-auditor`: settle
215
+ interventions/deviations from plan/repairs; (3) `axstack-auditor`: for small-path runs, settle
216
+ when an audit-hook trigger applies. Otherwise record `not triggered` with the counts
217
+ (`counts zero` when all are zero). All other substantive runs settle
201
218
  non-zero/requested, else `counts zero`. A base auditor preflight rejection
202
219
  (no delegated task started) records `auditor: UNKNOWN (unlaunchable)` with the
203
220
  attempted route and error as the archive receipt; no substitution. A launched
@@ -207,7 +224,7 @@ use `axstack-cleanup`, remove the run's own scheduled tasks under
207
224
  (5) mark the
208
225
  [Run record](run-record.md) `Archived`. `Archived`—one each:
209
226
  settlement receipt; compact record path; close-out acceptance table; auditor decision plus settlement
210
- receipt, `counts zero`, or the unlaunchable UNKNOWN archive receipt; scheduled-task,
227
+ receipt, `counts zero`, small-path `not triggered` with counts, or the unlaunchable UNKNOWN archive receipt; scheduled-task,
211
228
  release, and ticket receipts; archive timestamp.
212
229
  `active`/receipt-incomplete record: close-out pending, never done. One-step
213
230
  lookups exempt.
@@ -36,7 +36,10 @@ rewritten parents, external squash or rebase, and missing ancestry hold dependen
36
36
 
37
37
  Bind evidence to PR, head, base branch identity and base SHA. Base-only retarget
38
38
  or base update needs fresh applicable review, diligence, shape, CI and
39
- approval evaluation. Check new-base workflow coverage at unchanged heads;
39
+ approval evaluation. Follow the [applicable diligence gate](diligence.md#applicable-diligence-gate):
40
+ refresh combined `Scope` with authored review for eligible small non-risk-path
41
+ work; otherwise refresh the separate diligence receipt.
42
+ Check new-base workflow coverage at unchanged heads;
40
43
  never reuse old-base receipts. Carryover compares stable patch-id at both recorded
41
44
  head/base
42
45
  identities and requires a forge-counted human approval under watch §5. Never
@@ -38,8 +38,11 @@ Engineering authors and code reviewers cannot acquire this artifact authority.
38
38
  - `axstack-explainer-review` always reviews every visual; `codex/terra` high in mixed.
39
39
  Consequential or complex driver-written prose keeps its review rule; every
40
40
  whiteboard defense is consequential, in chat too.
41
- - `axstack-diligence`: read-only [diligence checks](diligence.md) for every authored PR
42
- review round and bounded research, spec, ticket, receipt, and release claims.
41
+ - `axstack-diligence`: read-only [diligence checks](diligence.md) for authored PR
42
+ review rounds and bounded research, spec, ticket, receipt, and release claims.
43
+ Follow the [applicable diligence gate](diligence.md#applicable-diligence-gate):
44
+ only eligible small non-risk-path PRs combine these checks into the same
45
+ cross-provider reviewer's Scope receipt, without a separate diligence dispatch.
43
46
  - `axstack-ui-verifier`: owns the inline page interaction pass under [UI checks](ui-verification.md)
44
47
  for every interactive page, bound to the exact bytes and SHA-256.
45
48
  - `axstack-ui-verifier-sonnet`: `claude/sonnet` high in mixed, read-only;
@@ -83,6 +83,27 @@ owner stops.
83
83
  deleted.
84
84
  The driver records `paused` on a user request or a hold; idle alone is neither.
85
85
 
86
+ ## Per-PR cost
87
+
88
+ Record one cost line per PR with dispatches, review rounds, spec revisions,
89
+ active time, wait time, driver tokens and worker tokens.
90
+ Missing cost values are `unknown`; never replace missing cost values with zero.
91
+ A dispatch counts one native task or launch.
92
+ A review round counts one authored-review pass at one head.
93
+ Count distinct task/launch IDs once, including interrupted attempts, rather
94
+ than counting status reads, messages or retries of the same native task.
95
+ Cost review rounds include passing rounds and are separate from the failing
96
+ `rounds` budget below; diligence and spec-adviser passes are separate work.
97
+ Count distinct recorded spec revisions attributable to the PR, including its
98
+ first draft. Keep shared run costs unallocated rather than copying them to
99
+ each PR. Give durations their units and token totals their receipt basis
100
+ (including any cache accounting); wall-clock elapsed time alone proves neither
101
+ active time nor wait time. Attach evidence for each measured value.
102
+ These measurements never gate work.
103
+
104
+ Repository baseline: `docs/ceremony-baseline-20261103.md` in the Axstack repo.
105
+ Record that baseline path with the cost lines for later compatible comparisons.
106
+
86
107
  ## Review-round budgets
87
108
 
88
109
  Each PR membership entry carries `rounds: <n>` and `step-back: unused | used r<n>`.
@@ -222,6 +243,8 @@ Schedules: <scheduledTaskIds of every watch and manager schedule>
222
243
  Watch: <member publication/adoption receipts + cadence + last PR event + native lifetime + update/re-arm/stop receipts>
223
244
  Worktrees in other repositories: <per-run repository and worktree IDs or none>
224
245
  Evidence: <check/review/submission/audit receipt pointers>
246
+ Cost baseline: docs/ceremony-baseline-20261103.md
247
+ PR cost: <PR URL> | dispatches: unknown | review rounds: unknown | spec revisions: unknown | active time: unknown | wait time: unknown | driver tokens: unknown | worker tokens: unknown | evidence: <per-value refs>
225
248
  Pending: <launch/acceptance/external receipts + scheduledTaskIds + runIds + deadline>
226
249
  Unresolved: <decision -> next owner + next action>
227
250
  Learnings: <root cause, gotcha, or pattern -> evidence ref>
@@ -13,6 +13,9 @@ When this run lacks a reference read or the installed version differs from
13
13
  the version recorded at the last reference read, the driver must re-read
14
14
  the installed phase SKILL.md and every shared reference it will use before any
15
15
  dispatch, receipt consumption, settlement or merge.
16
+ Re-read only the files used by the current path: its installed phase entry and
17
+ every shared reference it will use, rather than unrelated phases or branches.
18
+ When the path changes, read newly needed references before using them.
16
19
  After re-reading, the driver must record the installed version and reference
17
20
  read time in the run record.
18
21
  The driver must never rely on an in-context copy from an earlier run or an
@@ -37,8 +40,8 @@ For plan generation, run
37
40
  `scripts/dispatch-plan.js --role <id> --roles <roles.json> --capabilities <saved.json> --kind task|launch`
38
41
  using the recorded role snapshot and saved capabilities.
39
42
  Plan JSON carries `inputs`, which callers omit when copying `target`/`modelSelection` and `runtimeMode` plus `isolation` when present into `delegate_task`/`t3_thread_launch`; large plan output requires `--out`.
40
- For configuration verification, run `scripts/dispatch-plan.js --verify <configuration.json>`
41
- with the same plan inputs and saved `t3_thread_configuration` read-back.
43
+ For configuration verification, run `scripts/dispatch-plan.js --verify <native-reads.json>`
44
+ with the same plan inputs and saved native task status and thread reads (shape in `--help`).
42
45
 
43
46
  Stored permission intent is neither effective parity nor a security boundary.
44
47
 
@@ -61,9 +64,12 @@ Advertising Grok alone does not prove that its CLI runs.
61
64
  No OpenCode role enters this migration.
62
65
 
63
66
  The dispatch echo must match the requested provider and model; verify options
64
- and `runtimeMode` by `t3_thread_configuration` read-back. Record requested and
67
+ and `runtimeMode` using `task_status` and `t3_thread_read` settings readback. Record requested and
65
68
  effective values separately; a worker self-report is not configuration proof.
66
69
 
70
+ Unreturned effective fields must stay unknown.
71
+ Use `t3_thread_configure` only in read-only form with an explicit child thread ID
72
+ (`{threadId:<child>}` without `modelSelection`), when a supplementary read is needed.
67
73
  Missing effort read-back must hold roles requiring effort; never record it as
68
74
  satisfied. Other providers' effort read-back remains unverified until exercised.
69
75
 
@@ -83,7 +89,13 @@ drivers, each using T3 delegation for multiple scoped Workers. Reuse a suitable
83
89
  current Coordinator. Suggest a new Coordinator only when useful.
84
90
  Every top-level thread launch requires an explicit user request, including a
85
91
  new Coordinator, project driver or launch fallback. On resume, preserve existing
86
- explicit accepted authorization within its scope. This skill never grants
92
+ explicit accepted authorization within its scope. For a one-time whole-task
93
+ intake hand-off, the user's standing grant may supply that explicit request
94
+ only where the active runtime accepts it, with support recorded per launching
95
+ host and provider. An explicit named host (pilot) needs no support record.
96
+ Follow [intake routing](fleet-dispatch.md#intake-boundary-cr-3)
97
+ for acceptance-only launch, native verification and sole-driver ownership.
98
+ This skill never grants
87
99
  blanket launch permission. Missing launch authorization holds only the affected
88
100
  launch. After a blocked launch, continue independent authorized work, subject
89
101
  to its dependencies and scoped holds under [Autopilot](autopilot.md#advance-and-hold).
@@ -195,10 +207,15 @@ directed C5 write-link proof exist; never redirect or relay outside native T3.
195
207
  | Roles | Mechanism and permitted workspace | Completion |
196
208
  |---|---|---|
197
209
  | Advisers, research, read-only explorers, explainers, diligence, checker, auditor, arena prose candidates and judges, escalation | Must use async `delegate_task` in the driver worktree, title = role-labelled dispatch key; tracked and untracked files stay untouched; writes only `<run>/evidence/<key>/` | Native notification followed by persisted `task_status` |
198
- | Reviewers (peer/authored), release checks, debug investigators, execution investigators (`axstack-explore-execution`), UI verifier candidate checks (`axstack-ui-verifier`, `axstack-ui-verifier-sonnet`) | Must use async `delegate_task`, title = role-labelled dispatch key; driver makes a disposable detached checkout of candidate SHA and pinned base with `git worktree add --detach <run>/checkouts/<key> <sha>` (plus pinned debug patch); brief requires `cd` into it; only disposable probes write there, outputs go to `<run>/evidence/<key>/` | Same delegated terminal checks |
210
+ | Reviewers (authored) | Authored reviewers must use async `delegate_task` with native `isolation:"worktree"`, title = role-labelled dispatch key. Authored reviewers must `cd` into their own worktree and verify its resolved path differs from the driver's before inspecting the pinned revision. Authored reviewers must check out and verify the exact candidate SHA and pinned base inside that worktree; tracked candidate files stay read-only and outputs go to `<run>/evidence/<key>/` | Same delegated terminal checks |
211
+ | Peer reviewers, codebase reviewers, release checks, debug investigators, execution investigators (`axstack-explore-execution`), UI verifier candidate checks (`axstack-ui-verifier`, `axstack-ui-verifier-sonnet`) | Must use async `delegate_task`, title = role-labelled dispatch key; driver makes a disposable detached checkout of candidate SHA and pinned base with `git worktree add --detach <run>/checkouts/<key> <sha>` (plus pinned debug patch); brief requires `cd` into it; only disposable probes write there, outputs go to `<run>/evidence/<key>/` | Same delegated terminal checks |
199
212
  | Author and repairs | Fresh authors must use async `delegate_task` with `isolation:"worktree"`, title = role-labelled dispatch key, stable `clientRequestId` in their own worktree, kept until PR merges or closes; repairs use `t3_thread_send` to the same child | Delegated terminal checks plus verified candidate |
200
213
  | Owner | Driver thread in Driver worktree; never writes tracked candidate source or tests; planning artifacts allowed only for repository Markdown; scope, integration, forge mutations and record | No worker launch |
201
214
 
215
+ Before authored reviewer dispatch, the driver must include its resolved absolute worktree path in the brief.
216
+ Authored reviewers record their resolved worktree path and exact revision checks in the receipt;
217
+ a missing or equal path holds review.
218
+
202
219
  The UI verifier checkout row applies to candidate checks, while a page without
203
220
  a candidate follows [UI verification](ui-verification.md).
204
221
 
@@ -208,8 +225,8 @@ For supported non-repository report-only workflows only,
208
225
  [Local artifacts](local-artifacts.md) supplies the artifact branch of this table:
209
226
  Only the matrix's direct and inherited roles use local shared native delegates
210
227
  with separate owned folders and exact SHA-256 snapshots.
211
- Its role allowlist excludes engineering authors and code reviewers; their native
212
- Git worktree rules above remain mandatory. Null repository alone grants nothing.
228
+ Its role allowlist excludes engineering authors and code reviewers; their role-specific
229
+ Git workspace rules above remain mandatory. Null repository alone grants nothing.
213
230
 
214
231
  The driver may write planning artifacts (spec, ticket map) in its own worktree when the selected store is repository Markdown.
215
232
  Repairs return to that author. Missing or idle sessions grant no ownership transfer.
@@ -544,7 +561,27 @@ For own PRs, automatic merge is the default under the
544
561
  The recorded owning watch thread merges; a missing or idle owner requires
545
562
  lifecycle reconciliation and explicit transfer first.
546
563
 
547
- ## Fleet nonwriter boundary (C3a)
564
+ ## Whole-task routing and legacy fleet nonwriter boundary (C3a)
565
+
566
+ At a new task's intake, use one `fleet-route.js plan` decision under
567
+ [Fleet dispatch and receipts](fleet-dispatch.md). Scheduled/status/follow-up
568
+ work stays local; named hosts bypass automatic selection and routed tasks
569
+ cannot route again. All workers inside that task dispatch locally on its host.
570
+ C3a below is retained for explicitly scoped legacy use, not a per-dispatch
571
+ requirement. The remote author coordinator stays disabled.
572
+
573
+ An intake launch binds destination environment/project, full-access driver
574
+ model/options, origin `delegatedFrom` including title, and one task-unique
575
+ `clientRequestId` in its title. Its first run checks acceptance only and returns
576
+ exactly `AXSTACK-ACCEPT` or `AXSTACK-HANDBACK <reason>`. The origin waits with
577
+ `t3_thread_wait` and retains ownership until acceptance, then records the link,
578
+ sends one idempotent `proceed` and stops. Follow native wait `next` for acceptance
579
+ and proceed; active or unconfirmed waits hold. No launch means stay local;
580
+ hand-back means continue locally without rerouting. For a lost reply retry once
581
+ with the same key, then search every destination thread-list page with
582
+ `includeSubagents:true`. One verified match is awaited. Doubt, multiple or zero
583
+ matches, incomplete pages, mismatched readback, no started run or a silent first
584
+ run holds the origin; never start a second driver while the first may exist.
548
585
 
549
586
  Before dispatch, the driver must capture capability, project, settings and access
550
587
  through native forwarded APIs on the selected destination, following
@@ -552,7 +589,7 @@ through native forwarded APIs on the selected destination, following
552
589
  assertions alone cannot establish destination readiness. Preserve exact catalog
553
590
  bytes/digest, explicit observation/evaluation times, config digest and recommendation.
554
591
 
555
- `t3_thread_configuration` is currently unavailable in the advertised tools.
592
+ Child settings readback uses native task status and thread reads.
556
593
  Unavailable effective fields remain unknown; the driver must not invent an API,
557
594
  readiness or effective settings. Use advertised dispatch/thread facts, keep requested
558
595
  and effective values separate, and hold any required unobserved field.
@@ -561,7 +598,8 @@ For ambiguous submission, reconcile the exact clientRequestId/attempt and remote
561
598
  before any retry. Unknown liveness prohibits replacement. A confirmed not-submitted
562
599
  failure may exclude that route and recompute from current facts; it never permits
563
600
  model or permission substitution. No hidden SSH agent or new top-level thread is
564
- an execution fallback; a new thread requires an explicit user request.
601
+ an execution fallback. A new thread requires an explicit user request, including
602
+ only the runtime-accepted standing grant for a whole-task intake hand-off above.
565
603
 
566
604
  The driver must read task_status on the origin and terminal/thread facts on the
567
605
  actual destination for the latest run. Pending children or an unanswered question
@@ -2,22 +2,24 @@ import { readFileSync, writeFileSync } from 'node:fs';
2
2
  import { inspectFleetReceipt } from './fleet-receipt.js';
3
3
  import { bindFleet } from './fleet-dispatch.js';
4
4
  import { canonical } from './fleet-config.js';
5
+ import { bindIntakePlan } from './fleet-route-plan.js';
5
6
 
6
7
  const fleetFlags = ['--recommendation', '--fleet-input', '--now', '--config-digest'];
7
8
  const flags = ['--role', '--roles', '--capabilities', '--kind', '--verify', '--out', ...fleetFlags];
8
9
  const nonempty = (value) => typeof value === 'string' && value.trim().length > 0;
9
10
  const help = `Usage: bun dispatch-plan.js --role <id> --roles <roles.json>
10
11
  --capabilities <saved.json> --kind task|launch
11
- [--verify <configuration.json>] [--out <report.json>]
12
+ [--verify <native-reads.json>] [--out <report.json>]
12
13
  Example: bun dispatch-plan.js --role axstack-author --roles roles.json --capabilities capabilities.json --kind task
13
14
 
14
15
  --role Role ID from the supplied snapshot
15
16
  --roles Installed-style roles.json (version 1, roles array)
16
17
  --capabilities Saved orchestrator_capabilities JSON; reuse the run's saved snapshot
17
18
  --kind task emits target and, for axstack-author, isolation:"worktree"; launch emits modelSelection
18
- --verify Compare t3_thread_configuration JSON; print evidence then MATCH or each mismatch
19
+ --verify Compare saved native thread/task reads; print evidence then MATCH or each mismatch
19
20
  --out Save the payload as full JSON here; stdout is an input/path/omitted-count summary
20
21
  --recommendation Saved fleet-route recommendation; requires all following fleet flags
22
+ Also accepts a fleet-route plan result for a driver intake launch
21
23
  --fleet-input Saved complete selector input, including exact reviewed config bytes
22
24
  --now Injected nonnegative epoch-ms evaluation time matching the recommendation
23
25
  --config-digest Run-pinned config SHA-256; must match facts and recommendation
@@ -29,11 +31,20 @@ Results name input paths. Plan output over 4096 bytes requires --out.
29
31
  Large verification retains its exit code, prints mismatches and advises --out on stderr.
30
32
  An unwritable --out still prints verification mismatches and retains exit 2.
31
33
  An omitted provider label is unknown; exact instance/model/options/mode checks still apply.
34
+ Verification input: {"thread": <t3_thread_read.thread>, "task": <task_status (optional)>}.
35
+ Save structured native data, not message text or requested dispatch settings.
36
+ thread fields: threadId (required non-empty ID), providerInstanceId, model, runtimeMode, options (if returned).
37
+ task fields: childThreadId (or remoteChild.threadId), providerInstanceId, model, options (if returned).
38
+ When task is supplied, its child thread ID must equal thread.threadId.
39
+ Local and remote child IDs must agree when both are returned.
40
+ Remote reads also require envelope environmentId matching task.remoteChild.environmentId.
41
+ Compare every returned setting; conflicting reads hold. Unreturned fields are unknown
42
+ and hold required checks; never fill them from the plan or catalog.
32
43
  Never dispatches or changes snapshots. Reuse recorded exact model pins as given.
33
44
  Fleet --capabilities is the selected destination's raw saved catalog, digest-bound
34
45
  by its destination facts. It is never the origin catalog by default.
35
46
  Fleet verification requires environmentId/projectId and fleetBinding alongside
36
- the effective T3 configuration. C3 collects that host-qualified evidence envelope.
47
+ the native thread/task reads. C3 collects that host-qualified evidence envelope.
37
48
  Optional input.nativeDestination validates saved native forwarded reads.
38
49
  Explicit local-artifact scope requires those reads and kind task; emits isolation:"shared".
39
50
  artifactScope is preserved evidence only, never a native tool argument.
@@ -41,6 +52,11 @@ Artifact verification also requires artifactScope and independently checked isol
41
52
  Optional --verify fleetAttempt/fleetReceipt validates host-qualified terminal facts;
42
53
  --out retains per-term receipt evidence. Synthetic bindings cannot authenticate reads.
43
54
  Coordinator routes remain unsupported here. A plan grants no launch authority.
55
+ Driver intake launches emit environmentId/projectId, delegatedFrom (including title),
56
+ clientRequestId, title and an acceptance-only message from the checked intake plan.
57
+ Driver --verify additionally uses native thread.title/projectId/latestRunId and
58
+ recentRuns from t3_thread_read (runId and nonempty startedAt); missing stays unknown.
59
+ Terms report pass/fail/unknown/n/a with evidence; never an authority verdict.
44
60
  Exit codes: 0 ok, 1 error, 2 hold (including incomplete read-back).
45
61
  `;
46
62
 
@@ -84,24 +100,54 @@ function normalizedOptions(options) {
84
100
 
85
101
  function verify(configuration, provider, model, options, fleet) {
86
102
  const mismatches = [];
87
- const selection = configuration?.modelSelection;
103
+ const terms = [];
104
+ const { thread, task } = configuration ?? {};
105
+ const sources = [thread, task].filter((source) => source && typeof source === 'object');
88
106
  const compare = (field, expected, observed, equal = expected === observed) => {
89
- if (!equal) mismatches.push(`${field}: ${observed == null ? 'unknown' : 'fail'}; `
107
+ if (fleet?.launch) terms.push({ code: field, state: equal ? 'pass' : observed == null || expected == null ? 'unknown' : 'fail',
108
+ evidence: { expected, observed: observed ?? null } });
109
+ if (!equal) mismatches.push(`${field}: ${observed == null || expected == null ? 'unknown' : 'fail'}; `
90
110
  + `expected ${JSON.stringify(expected)}; observed ${JSON.stringify(observed) ?? 'missing'}`);
91
111
  };
92
- // T3 may omit the legacy provider field: the exact instance ID is its binding.
93
- if (selection?.provider != null) {
94
- compare('provider', provider, selection.provider,
95
- (selection.provider === 'claude' ? 'claudeAgent' : selection.provider) === provider);
112
+ compare('threadId', 'non-empty native thread ID', thread?.threadId, nonempty(thread?.threadId));
113
+ // A field is unknown only when neither native read returns it.
114
+ for (const [field, nativeField, expected] of [
115
+ ['instanceId', 'providerInstanceId', provider], ['model', 'model', model],
116
+ ['options', 'options', options], ['runtimeMode', 'runtimeMode', 'full-access'],
117
+ ]) {
118
+ const observed = sources.map((source) => source[nativeField]).filter((value) => value != null);
119
+ if (!observed.length) compare(field, expected, undefined);
120
+ for (const value of observed) compare(field, expected, value,
121
+ field === 'options' ? normalizedOptions(expected) === normalizedOptions(value) : expected === value);
96
122
  }
97
- compare('instanceId', provider, selection?.instanceId);
98
- compare('model', model, selection?.model);
99
- compare('options', options, selection?.options,
100
- normalizedOptions(options) === normalizedOptions(selection?.options));
101
- compare('runtimeMode', 'full-access', configuration?.runtimeMode);
123
+ if (task != null) {
124
+ if (task.childThreadId != null && task.remoteChild?.threadId != null) {
125
+ compare('childThreadId', task.remoteChild.threadId, task.childThreadId);
126
+ }
127
+ if (task.remoteChild != null) {
128
+ compare('remoteChild.environmentId', configuration?.environmentId, task.remoteChild.environmentId,
129
+ nonempty(configuration?.environmentId) && task.remoteChild.environmentId === configuration.environmentId);
130
+ }
131
+ const childId = task.remoteChild?.threadId ?? task.childThreadId;
132
+ compare('childThreadId', thread?.threadId, childId,
133
+ nonempty(thread?.threadId) && childId === thread.threadId);
134
+ }
135
+ // T3 may omit the provider label: the exact instance ID is its binding.
136
+ const labels = sources.map((source) => source.provider).filter((value) => value != null);
137
+ for (const label of labels) compare('provider', provider, label,
138
+ (label === 'claude' ? 'claudeAgent' : label) === provider);
102
139
  if (fleet) {
103
140
  for (const [field, expected] of Object.entries(fleet.destination)) compare(field, expected, configuration?.[field]);
104
141
  for (const [field, expected] of Object.entries(fleet.fleetBinding)) compare(field, expected, configuration?.fleetBinding?.[field]);
142
+ if (fleet.launch) {
143
+ compare('launch-title', fleet.launch.title, thread?.title);
144
+ compare('launch-project', fleet.destination.projectId, thread?.projectId);
145
+ const runs = configuration?.recentRuns;
146
+ const run = Array.isArray(runs) ? runs.find((r) => r.runId === thread?.latestRunId) : null;
147
+ const runEvidence = thread?.latestRunId === undefined || (run && run.startedAt === undefined) ? undefined : runs;
148
+ compare('run-started', 'native latest run with startedAt', runEvidence,
149
+ nonempty(thread?.latestRunId) && nonempty(run?.startedAt));
150
+ }
105
151
  if (fleet.artifactScope) {
106
152
  compare('artifactScope', fleet.artifactScope, configuration?.artifactScope,
107
153
  canonical(fleet.artifactScope) === canonical(configuration?.artifactScope));
@@ -116,7 +162,7 @@ function verify(configuration, provider, model, options, fleet) {
116
162
  });
117
163
  for (const term of receiptTerms) if (term.state !== 'pass') mismatches.push(`${term.code}: ${term.state}; evidence ${JSON.stringify(term.evidence)}`);
118
164
  }
119
- return { mismatches, ...(receiptTerms ? { receiptTerms } : {}), ...(selection?.provider == null ? {
165
+ return { mismatches, ...(fleet?.launch ? { terms } : {}), ...(receiptTerms ? { receiptTerms } : {}), ...(!labels.length ? {
120
166
  providerEvidence: `provider: unknown; expected ${JSON.stringify(provider)}; observed missing; `
121
167
  + 'provider binding checked via instanceId and saved capabilities',
122
168
  } : {}) };
@@ -132,7 +178,8 @@ function plan(argv, io) {
132
178
  const emit = (result) => {
133
179
  const full = { inputs, ...result };
134
180
  const inline = result.mismatches
135
- ? `${[JSON.stringify({ inputs }), result.providerEvidence, result.mismatches.join('\n') || 'MATCH'].filter(Boolean).join('\n')}\n`
181
+ ? `${[JSON.stringify({ inputs }), result.terms ? JSON.stringify({ terms: result.terms }) : null,
182
+ result.providerEvidence, result.mismatches.join('\n') || 'MATCH'].filter(Boolean).join('\n')}\n`
136
183
  : `${JSON.stringify(full)}\n`;
137
184
  if (!args['--out']) {
138
185
  if (new TextEncoder().encode(inline).length > 4096) {
@@ -182,9 +229,10 @@ function plan(argv, io) {
182
229
  if (!/^\d+$/.test(args['--now'])) throw new Error('evaluation-time');
183
230
  const recommendationJSON = readFileSync(args['--recommendation'], 'utf8');
184
231
  const recommendation = JSON.parse(recommendationJSON);
185
- fleet = bindFleet(readJSON(args['--fleet-input']), recommendation,
232
+ const binder = recommendation?.kind === 'intake-plan' ? bindIntakePlan : bindFleet;
233
+ fleet = binder(readJSON(args['--fleet-input']), recommendation,
186
234
  args['--config-digest'], Number(args['--now']), readFileSync(args['--capabilities'], 'utf8'),
187
- resolution, role.id === 'axstack-author', role.id, args['--kind']);
235
+ resolution, ...(binder === bindIntakePlan ? [args['--kind']] : [role.id === 'axstack-author', role.id, args['--kind']]));
188
236
  fleet.recommendation = recommendation;
189
237
  fleet.recommendationJSON = recommendationJSON;
190
238
  fleet.now = Number(args['--now']);
@@ -198,6 +246,8 @@ function plan(argv, io) {
198
246
  const selection = { [args['--kind'] === 'launch' ? 'instanceId' : 'providerInstanceId']: providerInstanceId,
199
247
  model, options, ...(args['--kind'] === 'task' ? fleet?.destination : {}) };
200
248
  emit({ [args['--kind'] === 'launch' ? 'modelSelection' : 'target']: selection, runtimeMode: 'full-access',
249
+ ...(fleet?.launch ?? {}),
250
+ ...(fleet?.planTerms ? { terms: fleet.planTerms } : {}),
201
251
  ...(fleet?.artifactScope ? { artifactScope: fleet.artifactScope, isolation: fleet.isolation } : {}),
202
252
  ...(fleet ? { fleetBinding: fleet.fleetBinding, ...(args['--kind'] === 'launch' ? fleet.destination : {}) } : {}),
203
253
  ...(args['--kind'] === 'task' && role.id === 'axstack-author' ? { isolation: 'worktree' } : {}) });
@@ -1,11 +1,15 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import { sampleMain, sampleHelp } from './fleet-sample-cli.js';
3
3
  import { recommend, parseFleetConfig } from './fleet-route.js';
4
+ import { planIntake } from './fleet-route-plan.js';
4
5
 
5
6
  const help = `Usage: bun fleet-route.js recommend --input <snapshot.json> --now <epoch-ms> [--json]
6
7
  [--task <name>] [--config <fleet-routing.json>] [--config-digest <sha256>]
8
+ bun fleet-route.js plan --facts <directory> --now <epoch-ms> [--json]
9
+ [--config <fleet-routing.json>] [--config-digest <sha256>]
7
10
 
8
11
  --input Saved schema-1 facts; no collection or dispatch
12
+ --facts Intake facts directory containing input.json (sample + saved native reads)
9
13
  --now Required nonnegative integer evaluation time; no ambient clock
10
14
  --task Override the saved request's task preference
11
15
  --config Reviewed account-local config (default: ~/.config/haoshoku/fleet-routing.json)
@@ -19,7 +23,9 @@ Required session capabilities must be proven on the actual destination session;
19
23
  an origin catalog or transferred credentials cannot establish them.
20
24
  Exclusions with reasons are supplied in input.exclusions.hosts/routes.
21
25
  Use sample or sample-recommend for bounded collection.
22
- Exit codes: 0 recommendation/help, 1 input/config error, 2 no executable route.
26
+ Plan reports each term pass/fail/unknown/n/a with evidence; counts only, no authority.
27
+ intakeRouting gates automatic decisions only; missing means false.
28
+ Exit codes: 0 recommendation/plan/help, 1 input/config error, 2 no executable route or hold.
23
29
  `;
24
30
 
25
31
  const fail = (code) => { throw new Error(code); };
@@ -35,26 +41,29 @@ function defaultConfigPath() {
35
41
 
36
42
  export async function main(argv) {
37
43
  try {
38
- if (argv.length === 1 && argv[0] === '--help') {
44
+ if ((argv.length === 1 && argv[0] === '--help')
45
+ || (argv.length === 2 && argv[0] === 'plan' && argv[1] === '--help')) {
39
46
  process.stdout.write(help + sampleHelp);
40
47
  return 0;
41
48
  }
42
49
  if (['sample', 'sample-recommend'].includes(argv[0])) return await sampleMain(argv, defaultConfigPath());
43
- if (argv[0] !== 'recommend') fail('unexpected-command');
50
+ if (!['recommend', 'plan'].includes(argv[0])) fail('unexpected-command');
51
+ const planning = argv[0] === 'plan';
44
52
  const args = {};
45
53
  for (let i = 1; i < argv.length; i++) {
46
54
  const flag = argv[i];
47
- if (!['--input', '--now', '--task', '--config', '--config-digest', '--json'].includes(flag)) fail('unexpected-argument');
55
+ if (!['--input', '--facts', '--now', '--task', '--config', '--config-digest', '--json'].includes(flag)) fail('unexpected-argument');
48
56
  if (Object.hasOwn(args, flag)) fail('duplicate-argument');
49
57
  if (flag === '--json') { args[flag] = true; continue; }
50
58
  const value = argv[++i];
51
59
  if (!value?.trim() || value.startsWith('--')) fail('missing-argument');
52
60
  args[flag] = value;
53
61
  }
54
- if (!args['--input'] || !args['--now']) fail('missing-argument');
62
+ if (!(planning ? args['--facts'] : args['--input']) || !args['--now']) fail('missing-argument');
63
+ if (planning ? args['--input'] || args['--task'] : args['--facts']) fail('unexpected-argument');
55
64
  if (!/^\d+$/.test(args['--now'])) fail('evaluation-time');
56
65
  const now = Number(args['--now']);
57
- const input = readInput(args['--input']);
66
+ const input = readInput(planning ? `${args['--facts']}/input.json` : args['--input']);
58
67
  if (!input || typeof input !== 'object' || Array.isArray(input) || input.schemaVersion !== 1) fail('schema-version: input');
59
68
  let configText;
60
69
  const configPath = args['--config'] ?? defaultConfigPath();
@@ -66,11 +75,11 @@ export async function main(argv) {
66
75
  parseFleetConfig(configText, configDigest);
67
76
  if (input.configDigest !== undefined && input.configDigest !== configDigest) fail('config-digest-mismatch');
68
77
  if (input.configText !== undefined && input.configText !== configText) fail('config-snapshot-mismatch');
69
- const result = recommend({ ...input, configText, configDigest,
78
+ const result = (planning ? planIntake : recommend)({ ...input, configText, configDigest,
70
79
  request: args['--task'] ? { ...input.request, task: args['--task'] } : input.request }, now);
71
- process.stdout.write(args['--json'] ? `${JSON.stringify(result)}\n`
80
+ process.stdout.write(args['--json'] || planning ? `${JSON.stringify(result)}\n`
72
81
  : `${result.stage}: ${result.selected?.hostId ?? 'no host'} (${result.reason})\n`);
73
- return result.selected ? 0 : 2;
82
+ return planning ? result.disposition === 'hold' ? 2 : 0 : result.selected ? 0 : 2;
74
83
  } catch (error) {
75
84
  process.stderr.write(`${JSON.stringify({ error: { code: error.message.split(':')[0], message: error.message } })}\n`);
76
85
  return 1;