ultra-builder-pro-cli 0.26.2 → 3.0.2

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 (67) hide show
  1. package/.ultra-template/contexts/TEMPLATE.md +64 -29
  2. package/.ultra-template/north-star.md +35 -18
  3. package/.ultra-template/tasks.json +1 -0
  4. package/.ultra-template/test-report.json +17 -1
  5. package/CHANGELOG.md +163 -1
  6. package/README.md +108 -38
  7. package/adapters/_shared/host-profile.cjs +68 -12
  8. package/adapters/_shared/plugin-core.cjs +4 -5
  9. package/adapters/_shared/runtime-assets.cjs +11 -2
  10. package/adapters/zcode.js +375 -0
  11. package/bin/delegate-worker.cjs +20 -0
  12. package/bin/delegate.cjs +94 -25
  13. package/bin/install.js +11 -6
  14. package/docs/ARCHITECTURE.md +84 -23
  15. package/docs/ARTIFACT-AUTHORITY.md +167 -22
  16. package/docs/DECISIONS.md +131 -17
  17. package/docs/PHILOSOPHY.md +58 -7
  18. package/docs/PLUGIN-ISOLATION-CONTRACT.md +6 -0
  19. package/docs/RUNTIME-COMPAT-MATRIX.md +106 -13
  20. package/docs/SKILL-AUTHORING.md +4 -3
  21. package/docs/WORKFLOW-LIFECYCLE.md +126 -28
  22. package/docs/evals/adversarial-review-2026-08-14.md +84 -0
  23. package/docs/evals/zcode-automation-2026-08-14.md +103 -0
  24. package/hooks/README.md +27 -4
  25. package/hooks/_common.py +1678 -61
  26. package/hooks/adapters/zcode.py +227 -0
  27. package/hooks/compact_context.py +176 -17
  28. package/hooks/mid_workflow_recall.py +27 -5
  29. package/hooks/post_edit_guard.py +133 -23
  30. package/hooks/session_context.py +707 -22
  31. package/package.json +6 -3
  32. package/skills/ultra-change/SKILL.md +40 -9
  33. package/skills/ultra-change/references/change-contract.md +93 -27
  34. package/skills/ultra-change/references/execution-grant.md +109 -0
  35. package/skills/ultra-change/references/primary-transfer.md +273 -0
  36. package/skills/ultra-change/scripts/validate_primary_transfer.cjs +1928 -0
  37. package/skills/ultra-delegate/SKILL.md +24 -2
  38. package/skills/ultra-delegate/references/delegation-contract.md +21 -1
  39. package/skills/ultra-deliver/SKILL.md +85 -11
  40. package/skills/ultra-dev/SKILL.md +171 -41
  41. package/skills/ultra-grilling/SKILL.md +10 -7
  42. package/skills/ultra-grilling/references/reframing.md +7 -3
  43. package/skills/ultra-init/SKILL.md +44 -7
  44. package/skills/ultra-init/scripts/init_project.cjs +968 -21
  45. package/skills/ultra-plan/SKILL.md +70 -44
  46. package/skills/ultra-plan/references/task-evidence-v2.md +300 -0
  47. package/skills/ultra-plan/scripts/validate_task_evidence.cjs +859 -0
  48. package/skills/ultra-research/SKILL.md +38 -10
  49. package/skills/ultra-research/references/04-product-strategy.md +11 -2
  50. package/skills/ultra-research/references/21-features-scope.md +8 -0
  51. package/skills/ultra-research/references/22-success-metrics.md +4 -3
  52. package/skills/ultra-research/references/99-synthesis.md +19 -2
  53. package/skills/ultra-research/references/north-star-v2.md +168 -0
  54. package/skills/ultra-research/references/wayfinding.md +8 -0
  55. package/skills/ultra-research/scripts/validate_north_star.cjs +1174 -0
  56. package/skills/ultra-review/SKILL.md +201 -27
  57. package/skills/ultra-review/references/adversarial-evaluation.md +31 -0
  58. package/skills/ultra-review/references/spec.md +5 -0
  59. package/skills/ultra-review/references/unified-schema.md +146 -11
  60. package/skills/ultra-review/references/worker-packet.md +151 -8
  61. package/skills/ultra-review/scripts/review_wait.py +2653 -63
  62. package/skills/ultra-status/SKILL.md +95 -11
  63. package/skills/ultra-tdd/SKILL.md +11 -4
  64. package/skills/ultra-tdd/references/test-execution.md +6 -1
  65. package/skills/ultra-test/SKILL.md +145 -17
  66. package/skills/ultra-test/scripts/validate_review_transport.cjs +549 -0
  67. package/skills/ultra-test/scripts/worktree_digest.cjs +518 -30
package/README.md CHANGED
@@ -1,12 +1,42 @@
1
1
  # Ultra Builder Pro
2
2
 
3
3
  Ultra Builder Pro is a file-first engineering workflow for Claude Code, Codex,
4
- OpenCode, Kimi Code, and Grok Build. It keeps product intent, specifications, task
5
- contracts, evidence, decisions, and recovery notes in the repository, so a different
6
- session or host can continue by reading files and Git.
4
+ OpenCode, Kimi Code, Grok Build, and ZCode. It implements the provider-neutral
5
+ **Ultra Core Protocol**: owner–agent cognitive alignment, per-fact canonical
6
+ authority, explicit session-local or durable work-package grants, exclusive
7
+ verified handover between Agents, typed evidence with recovery, and review that
8
+ terminates within an owner-visible budget. It keeps product
9
+ intent, specifications, task contracts, evidence, decisions, and recovery notes
10
+ in the repository, so a different session or host can continue by reading files
11
+ and Git.
7
12
 
8
13
  The host model remains the engineer. Ultra supplies reusable methods and checkable
9
- artifacts; it does not replace reasoning with a workflow engine.
14
+ artifacts; it does not replace reasoning with a workflow engine. Agent topology —
15
+ one Agent or several, which providers — is the owner's choice at every stage; the
16
+ default is the current Agent continuing alone, and handing the work package's
17
+ writing authority to a different Agent requires an explicit verified transfer
18
+ (OFFER → ACK → RESULT over the repository files and Git).
19
+
20
+ ## Ultra Builder Pro 3.0
21
+
22
+ Version `3.0.2` is the first published release of Ultra as a cognitive-alignment harness for
23
+ real software engineering. It is not a decentralized multi-agent platform and it
24
+ does not prescribe one Agent topology. Instead, it keeps five promises:
25
+
26
+ - establish the owner-accepted North Star before Research becomes a plan or code;
27
+ - let the owner choose one Agent or several, and the provider, at every stage;
28
+ - carry canonical intent, decisions, tasks, evidence, and recovery through files
29
+ under `.ultra/` plus Git so another session or host can resume from the same facts;
30
+ - automate mechanically verifiable authority, permissions, external effects,
31
+ evidence, physical limits, and recovery while leaving meaning and strategy to the
32
+ model and owner; and
33
+ - bound Review and repair so delivery converges instead of turning every observation
34
+ into another automatic implementation loop.
35
+
36
+ The portable protocol and native installation cover Claude Code, Codex, OpenCode,
37
+ Kimi Code, Grok Build, and ZCode. ZCode plugin installation is supported; its
38
+ App-bundled headless delegation transport remains explicitly `experimental` until an
39
+ official stable interface and recovery drill satisfy the support bar.
10
40
 
11
41
  ## Why it exists
12
42
 
@@ -51,14 +81,17 @@ The package installs exactly fourteen Skills in three roles.
51
81
  `ultra-status` is the single router. It infers the current route from project files,
52
82
  Git, and installation health without mutating the workflow.
53
83
 
54
- Public workflows are explicitly selected by the owner. One public workflow can
55
- recommend the next one, but does not launch it. Model-invoked disciplines remain
56
- available to the host model and are not separate user routes. The model selects one
57
- when the active task presents its trigger: incomplete intent uses grilling, competing
58
- terms use domain modeling, an accepted seam uses TDD, review-ready evidence uses
59
- review, and a consequential unresolved decision uses think. A host with native bounded
60
- subagents may parallelize review lenses; another host runs the same lens assets
61
- sequentially.
84
+ Public workflows are explicitly selected by the owner by default. Outside a live,
85
+ owner-activated execution grant (session-local, or a durable work-package grant), one public workflow can recommend the
86
+ next one but does not launch it. Inside that grant, the host model may select only
87
+ the covered Research, Plan, Dev, Test, and reconcile-only Deliver routes; Init, Change,
88
+ Delegate, Status, final archive, and every external effect remain owner-selected.
89
+ Model-invoked disciplines remain available to the host model and are not separate user
90
+ routes. The model selects one when the active task presents its trigger: incomplete
91
+ intent uses grilling, competing terms use domain modeling, an accepted seam uses TDD,
92
+ review-ready evidence uses review, and a consequential unresolved decision uses think.
93
+ A host with native bounded subagents may parallelize review lenses; another host runs
94
+ the same lens assets sequentially.
62
95
 
63
96
  Inside `ultra-research`, the first six references are six semantic lenses, not six
64
97
  extra Skills: problem validation, opportunity discovery, market assessment,
@@ -70,12 +103,12 @@ map, evidence convergence, owner checkpoints, and baseline promotion.
70
103
 
71
104
  ### What happened to the original Agents
72
105
 
73
- v0.26 does not install a custom `agents/` projection. The old review workers became the
106
+ Version 3.0.2 does not install a custom `agents/` projection. The old review workers became the
74
107
  six focused files under `ultra-review/references/`; review coordination and synthesis
75
108
  belong to the parent `ultra-review` Skill. The old debugger procedure lives under
76
109
  `ultra-dev/references/debugging.md`, and test execution lives under
77
110
  `ultra-tdd/references/test-execution.md`. These are assets of their Skills and therefore
78
- travel to all five hosts. They preserve a bounded role without pretending that every
111
+ travel to all six hosts. They preserve a bounded role without pretending that every
79
112
  host exposes the same custom-agent API.
80
113
 
81
114
  ## Project authority
@@ -101,7 +134,7 @@ CONTEXT.md
101
134
  │ ├── active/<change-id>/{intent.md,delivery.md}
102
135
  │ ├── archive/<change-id>/{intent.md,delivery.md}
103
136
  │ └── abandoned/<change-id>/intent.md # includes exact Abandonment closure
104
- ├── contexts/<task-id>.md
137
+ ├── contexts/task-<task-id>.md
105
138
  ├── decisions/<decision-id>.md
106
139
  ├── evidence/<task-id>/...
107
140
  └── research/<run-id>/{brief.md,<step-id>.md}
@@ -110,7 +143,7 @@ CONTEXT.md
110
143
  The optional `brief.md` is derived navigation; the selected step reports are cited
111
144
  evidence, and promoted semantic facts live in the other canonical files. Git provides
112
145
  history, comparison, rollback, and archive moves. The following additional paths are
113
- derived and can be deleted or rebuilt:
146
+ derived:
114
147
 
115
148
  ```text
116
149
  .ultra/.runtime/
@@ -118,6 +151,12 @@ derived and can be deleted or rebuilt:
118
151
  .ultra/reviews/
119
152
  ```
120
153
 
154
+ `.ultra/.runtime/` and `.ultra/progress/` can be deleted or rebuilt from current
155
+ authority. Retain the exact current strict review session until both Test and Deliver
156
+ have successfully consumed it; only then may that session be garbage-collected. If it
157
+ is lost before both consumers finish, run a fresh Review and Test and never reconstruct
158
+ the old receipt.
159
+
121
160
  See [Artifact Authority](docs/ARTIFACT-AUTHORITY.md) for writer, reader, promotion,
122
161
  staleness, and recovery rules.
123
162
 
@@ -129,7 +168,7 @@ staleness, and recovery rules.
129
168
  | `ultra-research` | accepted North Star, first domain baseline, selected cited reports, reconciled specifications, and distillate | change, plan, and delivery |
130
169
  | `ultra-change` | one active `intent.md` with stable `change_id`, Research Disposition, and only the accepted baseline sections touched by that delta; or an exact Abandonment closure before an owner-authorized move | active: research through delivery; abandoned: future Change history and status |
131
170
  | `ultra-plan` | append-only `tasks.json` rows for the active `change_id`, one context per task, and Planning Posture in the active intent | dev and every resume path |
132
- | `ultra-dev` | source/tests, task evidence, synchronized task/context status, Completion and Resume Note | review, test, status, delivery |
171
+ | `ultra-dev` | source/tests, typed task evidence, ledger-only task status, Completion, Task Review, and Resume Note | review, test, status, delivery |
133
172
  | `ultra-test` | the one current `test-report.json` bound to Change id, current task ids, intent digest, HEAD, and product-worktree digest | status and delivery |
134
173
  | `ultra-deliver` | first reconciled specs/docs, then after a fresh Test snapshot one `delivery.md` and the archived Change directory | owner and future Change history |
135
174
  | `ultra-status` | none | recommends the smallest explicit route from current files |
@@ -145,16 +184,17 @@ Node.js 22 or newer is required.
145
184
 
146
185
  ```bash
147
186
  # Current project, one host
148
- npx ultra-builder-pro-cli --claude --local
149
- npx ultra-builder-pro-cli --codex --local
187
+ npx ultra-builder-pro-cli@3.0.2 --claude --local
188
+ npx ultra-builder-pro-cli@3.0.2 --codex --local
150
189
 
151
190
  # Global installation
152
- npx ultra-builder-pro-cli --opencode --global
153
- npx ultra-builder-pro-cli --kimi --global
154
- npx ultra-builder-pro-cli --grok --global
191
+ npx ultra-builder-pro-cli@3.0.2 --opencode --global
192
+ npx ultra-builder-pro-cli@3.0.2 --kimi --global
193
+ npx ultra-builder-pro-cli@3.0.2 --grok --global
194
+ npx ultra-builder-pro-cli@3.0.2 --zcode --global
155
195
 
156
196
  # All supported hosts
157
- npx ultra-builder-pro-cli --all --global
197
+ npx ultra-builder-pro-cli@3.0.2 --all --global
158
198
  ```
159
199
 
160
200
  Use the host's native Skill picker or invocation syntax to select an owner workflow.
@@ -167,13 +207,13 @@ Installation is managed, atomic, and provenance-checked.
167
207
 
168
208
  ```bash
169
209
  # Re-running install updates the managed artifact
170
- npx ultra-builder-pro-cli --codex --global
210
+ npx ultra-builder-pro-cli@3.0.2 --codex --global
171
211
 
172
212
  # Read-only diagnosis
173
- npx ultra-builder-pro-cli --all --global --doctor --json
213
+ npx ultra-builder-pro-cli@3.0.2 --all --global --doctor --json
174
214
 
175
215
  # Remove only managed Ultra assets
176
- npx ultra-builder-pro-cli --all --global --uninstall
216
+ npx ultra-builder-pro-cli@3.0.2 --all --global --uninstall
177
217
  ```
178
218
 
179
219
  `--config-dir <path>` isolates both the primary config and host-owned sidecars. It is
@@ -185,9 +225,9 @@ Uninstall removes the managed plugin and prunes only empty config shells that we
185
225
  absent before the first install. Pre-existing registries, directories, symlinks, and
186
226
  any path containing owner data are preserved.
187
227
 
188
- Kimi Code and Grok Build currently expose user-scoped plugins only, so `--local`
228
+ Kimi Code, Grok Build, and ZCode currently expose user-scoped plugins only, so `--local`
189
229
  rejects them before mutation. Claude Code, Codex, and OpenCode support project-local
190
- installation; all five support managed global installation and isolated
230
+ installation; all six support managed global installation and isolated
191
231
  `--config-dir` verification.
192
232
 
193
233
  ## Typical workflow
@@ -203,21 +243,38 @@ installation; all five support managed global installation and isolated
203
243
  the delta touches before planning; it does not rebuild the project baseline. Its
204
244
  Research Disposition either cites sufficient evidence or names the bounded question
205
245
  and exit evidence that must return through Research. A micro edit that makes no
206
- specification sentence false stays outside Ultra; an accepted quick Change still
207
- receives one Plan task. While that Change remains active, reconcile its same stable
208
- id; never open a second active Change for a separate request.
246
+ specification sentence false stays outside Ultra; every accepted Change receives the
247
+ smallest Plan graph justified by its real seams, evidence, review, and recovery needs.
248
+ A profile never fixes task count. While that Change remains active, reconcile its
249
+ same stable id; never open a second active Change for a separate request.
209
250
  4. Select `ultra-plan` to record public seams and produce resumable tracer-bullet tasks.
210
251
  The model owns ordinary technical seams; the owner decides only a seam that changes
211
252
  the public contract or another material trade-off.
212
- 5. Select `ultra-dev` for one task at a time. Each task leaves a Completion entry,
213
- evidence, and a closing Resume Note.
214
- 6. Select `ultra-test` once tasks for the active Change are complete. Historical ledger
215
- rows do not enter this audit. Local green tests do not substitute for wiring and E2E proof.
253
+ 5. Select `ultra-dev` for one task at a time. `.ultra/tasks.json` is the sole task-status
254
+ authority. Dev records typed v2 evidence and completes task review while the row is
255
+ still `in_progress`; only after blocking findings and affected evidence are resolved
256
+ does it write `completed`, add Completion, and rewrite the Resume Note.
257
+ 6. Select `ultra-test` once tasks for the active Change are completed with current v2
258
+ evidence and retained task-review provenance. Historical ledger rows and legacy
259
+ context Status fields do not enter this audit. Local green tests do not substitute
260
+ for wiring and E2E proof.
216
261
  7. Select `ultra-deliver` to run aggregate review and reconcile documentation. If that
217
262
  changes product or semantic files, rerun Test; re-enter Deliver on the fresh snapshot
218
263
  to write delivery metadata and archive the stable Change id. Commit, push, tag,
219
264
  publication, and deployment remain separately authorized effects.
220
265
 
266
+ For one accepted Change, the owner may activate its exact `Execution Grant` in either
267
+ mode. A `session-local` grant lives only in the current conversation: when that
268
+ activation is lost — a fresh session, another host, or compaction — the work stops and
269
+ waits for a new owner activation. A `durable work-package` grant lets a fresh Agent or
270
+ host continue one exact work package, but only after the Agent stably verifies the
271
+ recorded grant itself. In both modes the model may select the covered Research, Plan,
272
+ Dev, Test, and reconcile-only Deliver routes until the next semantic stop or declared
273
+ budget, and neither mode grants finalization or archive: writing `delivery.md`, version
274
+ or package posture, and archiving always require a current explicit owner invocation,
275
+ as do commit, push, publication, deployment, installation, and every other external
276
+ effect.
277
+
221
278
  At any point, `ultra-status` can reconstruct the current position. A fresh session or
222
279
  different host resumes by reading `.ultra/tasks.json`, the selected `context_file`, its
223
280
  `## Resume Note`, `CONTEXT.md`, relevant decisions, the active Change, and Git. It first
@@ -249,7 +306,7 @@ Five optional hooks accelerate file reading and protect a narrow effect boundary
249
306
  | `post_edit_guard.py` | Record mechanical evidence observations after edits |
250
307
  | `block_dangerous_commands.py` | Advise on additive protected-branch publication; deny history rewrites and named destructive shell effects until the exact command is authorized |
251
308
 
252
- All five exit silently when `.ultra/` is absent. Details are in
309
+ All five hooks exit silently when `.ultra/` is absent. Details are in
253
310
  [Plugin Isolation](docs/PLUGIN-ISOLATION-CONTRACT.md).
254
311
 
255
312
  ## Delegation
@@ -259,7 +316,8 @@ selected CLI in the background. Empty writable roots select native read-only mod
259
316
  declared roots select bounded write mode. The model returns one schema-constrained final
260
317
  response; the launcher extracts it from native structured output, validates the actual
261
318
  Git diff, and atomically publishes a terminal `finished`, `blocked`, or `failed` result
262
- beside the instruction.
319
+ beside the instruction. The digest-bound packet is embedded in the worker prompt, so a
320
+ strict host need not read instruction files outside its isolated worktree.
263
321
 
264
322
  ```bash
265
323
  ubp delegate run --to codex \
@@ -286,6 +344,7 @@ reachable without inventing ledger work.
286
344
  | OpenCode | 14 | 5 through native JS plugin | bundle + skill directories |
287
345
  | Kimi Code | 14 | 5 through wire adapter | managed plugin registry |
288
346
  | Grok Build | 14 | 5 through wire adapter | native plugin registration when available |
347
+ | ZCode | 14 | 5 through wire adapter | inline plugin + local marketplace + reversible config registration |
289
348
 
290
349
  See [Runtime Compatibility](docs/RUNTIME-COMPAT-MATRIX.md) for exact paths and host
291
350
  limitations.
@@ -308,10 +367,19 @@ npm pack --dry-run --json
308
367
 
309
368
  Every changed Skill is also validated with the Codex Skill Creator validator. A changed
310
369
  Codex manifest is validated against the Plugin Creator schema. No release effect is
311
- implied by a green verification run.
370
+ implied by a green verification run, and validator success establishes structural
371
+ conformance rather than semantic acceptance.
312
372
 
313
373
  ## Documentation
314
374
 
375
+ - [Current authority](.ultra/north-star.md) — this repository's accepted
376
+ North Star, revision `north-star-v2-r3`, is the canonical current authority;
377
+ `.ultra/tasks.json` and the stable Change under `.ultra/changes/active/` or
378
+ `.ultra/changes/archive/` record the current or delivered work frontier.
379
+ - Frozen design history (immutable accepted records, not live status):
380
+ [3.0 North Star R3](docs/ULTRA-BUILDER-PRO-3.0-NORTH-STAR-R3.zh-CN.md) —
381
+ the hash-bound accepted r3 design — and
382
+ [3.0 design](docs/ULTRA-BUILDER-PRO-3.0.zh-CN.md), superseded by r3.
315
383
  - [Philosophy](docs/PHILOSOPHY.md)
316
384
  - [Architecture](docs/ARCHITECTURE.md)
317
385
  - [Artifact Authority](docs/ARTIFACT-AUTHORITY.md)
@@ -319,6 +387,8 @@ implied by a green verification run.
319
387
  - [Skill Authoring](docs/SKILL-AUTHORING.md)
320
388
  - [Plugin Isolation](docs/PLUGIN-ISOLATION-CONTRACT.md)
321
389
  - [Runtime Compatibility](docs/RUNTIME-COMPAT-MATRIX.md)
390
+ - [Adversarial Review Evaluation](docs/evals/adversarial-review-2026-08-14.md)
391
+ - [ZCode Automation Evaluation](docs/evals/zcode-automation-2026-08-14.md)
322
392
 
323
393
  ## License
324
394
 
@@ -1,8 +1,28 @@
1
1
  'use strict';
2
2
 
3
+ const fs = require('node:fs');
3
4
  const path = require('node:path');
4
5
 
5
6
  const KIMI_PROFILE_ROOT = path.join(__dirname, 'delegate-profiles');
7
+ const ZCODE_BUNDLED_CLI = '/Applications/ZCode.app/Contents/Resources/glm/zcode.cjs';
8
+
9
+ // The ZCode app-bundled CLI is a verified-local surface, not a provider
10
+ // stability promise: official documentation plus a full recovery drill must
11
+ // both hold before any transport may claim 'supported'.
12
+ const TRANSPORT_MATURITY = Object.freeze({
13
+ claude: 'documented+verified',
14
+ codex: 'documented+verified',
15
+ opencode: 'documented+verified',
16
+ kimi: 'documented+verified',
17
+ grok: 'documented+verified',
18
+ zcode: 'experimental',
19
+ });
20
+
21
+ function zcodeBinary({ platform = process.platform, exists = fs.existsSync } = {}) {
22
+ return platform === 'darwin' && exists(ZCODE_BUNDLED_CLI)
23
+ ? ZCODE_BUNDLED_CLI
24
+ : 'zcode';
25
+ }
6
26
 
7
27
  function opencodePermission(writableRoots) {
8
28
  const edit = { '*': 'deny' };
@@ -39,7 +59,6 @@ const PROFILES = Object.freeze({
39
59
  '--permission-mode', options.readOnly ? 'plan' : 'acceptEdits',
40
60
  '--no-session-persistence',
41
61
  '--output-format', 'json',
42
- '--json-schema', options.schemaJson,
43
62
  '--tools', options.readOnly ? 'Read,Grep,Glob' : 'Read,Write,Edit,Grep,Glob',
44
63
  ],
45
64
  }),
@@ -66,14 +85,19 @@ const PROFILES = Object.freeze({
66
85
  }),
67
86
  kimi: Object.freeze({
68
87
  binary: 'kimi',
69
- delegateArgv: (prompt, _cwd, options) => [
70
- '-p', prompt,
71
- '--output-format', 'stream-json',
72
- '--agent-file', path.join(
73
- KIMI_PROFILE_ROOT,
74
- options.readOnly ? 'kimi-read-only.md' : 'kimi-write.md',
75
- ),
76
- ],
88
+ supportsModelSelection: true,
89
+ delegateArgv: (prompt, _cwd, options) => {
90
+ const args = ['-p', prompt, '--output-format', 'stream-json'];
91
+ if (options.model) args.push('--model', options.model);
92
+ args.push(
93
+ '--agent-file',
94
+ path.join(
95
+ KIMI_PROFILE_ROOT,
96
+ options.readOnly ? 'kimi-read-only.md' : 'kimi-write.md',
97
+ ),
98
+ );
99
+ return args;
100
+ },
77
101
  }),
78
102
  grok: Object.freeze({
79
103
  binary: 'grok',
@@ -82,16 +106,48 @@ const PROFILES = Object.freeze({
82
106
  '--permission-mode', options.readOnly ? 'plan' : 'acceptEdits',
83
107
  '--sandbox', options.readOnly ? 'read-only' : 'workspace',
84
108
  '--no-memory', '--no-subagents', '--disable-web-search',
85
- '--json-schema', options.schemaJson,
109
+ '--verbatim',
110
+ '--max-turns', '12',
86
111
  '--output-format', 'json',
87
112
  ],
88
113
  }),
114
+ zcode: Object.freeze({
115
+ binary: zcodeBinary(),
116
+ delegateArgv: (prompt, cwd, options) => [
117
+ '--cwd', cwd,
118
+ '--mode', options.readOnly ? 'plan' : 'edit',
119
+ '--json', '--no-color',
120
+ '--disallowedTools', options.readOnly
121
+ ? 'Bash Write Edit ApplyPatch Agent WebFetch WebSearch'
122
+ : 'Bash Agent WebFetch WebSearch',
123
+ '--prompt', prompt,
124
+ ],
125
+ }),
89
126
  });
90
127
 
91
128
  function hostProfile(runtime) {
92
129
  const profile = PROFILES[runtime];
93
130
  if (!profile) throw new Error(`unsupported delegate host: ${runtime}`);
94
- return profile;
131
+ return { ...profile, transportMaturity: TRANSPORT_MATURITY[runtime] };
132
+ }
133
+
134
+ // The live delegate surface names honestly what a run actually used. The ZCode
135
+ // headless transports are app-internal surfaces, never the documented ZCode
136
+ // Desktop interactive primary path, so every receipt that records one says so.
137
+ function transportSurface(runtime, binary = PROFILES[runtime] ? PROFILES[runtime].binary : undefined) {
138
+ if (runtime === 'zcode') {
139
+ const source = binary === ZCODE_BUNDLED_CLI ? 'the App-bundled headless CLI' : 'the zcode headless CLI on PATH';
140
+ return `${source} (experimental; not the documented ZCode Desktop interactive surface)`;
141
+ }
142
+ return 'documented non-interactive CLI';
95
143
  }
96
144
 
97
- module.exports = { PROFILES, hostProfile, opencodePermission };
145
+ module.exports = {
146
+ PROFILES,
147
+ TRANSPORT_MATURITY,
148
+ ZCODE_BUNDLED_CLI,
149
+ hostProfile,
150
+ opencodePermission,
151
+ transportSurface,
152
+ zcodeBinary,
153
+ };
@@ -15,7 +15,6 @@ const {
15
15
  const { parse, serialize } = require('./frontmatter.cjs');
16
16
  const provenance = require('./provenance.cjs');
17
17
  const {
18
- MODEL_INVOKED_SKILLS,
19
18
  WORKFLOW_HOOK_FILES,
20
19
  skillPolicy,
21
20
  skillsForRuntime,
@@ -34,13 +33,13 @@ function skillFrontmatter(runtime, name, fm) {
34
33
  return {
35
34
  ...base,
36
35
  'user-invocable': policy.userInvocable,
37
- ...(policy.userInvocable ? { 'disable-model-invocation': true } : {}),
36
+ ...(!policy.allowImplicitInvocation ? { 'disable-model-invocation': true } : {}),
38
37
  };
39
38
  }
40
39
  if (runtime === 'kimi') {
41
40
  return {
42
41
  ...base,
43
- ...(policy.userInvocable ? { disableModelInvocation: true } : {}),
42
+ ...(!policy.allowImplicitInvocation ? { disableModelInvocation: true } : {}),
44
43
  };
45
44
  }
46
45
  return base;
@@ -54,7 +53,7 @@ function codexMetadata(name, description) {
54
53
  ` short_description: ${JSON.stringify(short || titleCase(name))}`,
55
54
  ` default_prompt: ${JSON.stringify(`Use $ultra-builder-pro:${name} and follow its workflow.`)}`,
56
55
  'policy:',
57
- ` allow_implicit_invocation: ${MODEL_INVOKED_SKILLS.includes(name) ? 'true' : 'false'}`,
56
+ ` allow_implicit_invocation: ${skillPolicy(name).allowImplicitInvocation ? 'true' : 'false'}`,
58
57
  '',
59
58
  ].join('\n');
60
59
  }
@@ -99,7 +98,7 @@ function copyHooks({ runtime, repoRoot, hookRoot, hooksManifest }) {
99
98
  if (!fs.existsSync(source)) throw new Error(`missing allowlisted hook: ${name}`);
100
99
  fs.copyFileSync(source, path.join(hookRoot, name));
101
100
  }
102
- if (['codex', 'kimi', 'grok'].includes(runtime)) {
101
+ if (['codex', 'kimi', 'grok', 'zcode'].includes(runtime)) {
103
102
  ensureDir(path.join(hookRoot, 'adapters'));
104
103
  fs.copyFileSync(
105
104
  path.join(repoRoot, 'hooks', 'adapters', `${runtime}.py`),
@@ -27,7 +27,14 @@ const MODEL_INVOKED_SKILLS = Object.freeze([
27
27
  ]);
28
28
 
29
29
  const ROUTER_SKILLS = Object.freeze(['ultra-status']);
30
- const SUPPORTED_RUNTIMES = Object.freeze(['claude', 'opencode', 'codex', 'kimi', 'grok']);
30
+ const GRANT_CONTINUABLE_SKILLS = Object.freeze([
31
+ 'ultra-research',
32
+ 'ultra-plan',
33
+ 'ultra-dev',
34
+ 'ultra-test',
35
+ 'ultra-deliver',
36
+ ]);
37
+ const SUPPORTED_RUNTIMES = Object.freeze(['claude', 'opencode', 'codex', 'kimi', 'grok', 'zcode']);
31
38
 
32
39
  const WORKFLOW_HOOK_FILES = Object.freeze([
33
40
  'session_context.py',
@@ -53,13 +60,15 @@ function skillPolicy(name) {
53
60
  throw new Error(`unknown packaged Ultra skill: ${name}`);
54
61
  }
55
62
  const modelInvoked = MODEL_INVOKED_SKILLS.includes(name);
63
+ const grantContinuable = GRANT_CONTINUABLE_SKILLS.includes(name);
56
64
  return {
57
65
  userInvocable: !modelInvoked,
58
- allowImplicitInvocation: modelInvoked,
66
+ allowImplicitInvocation: modelInvoked || grantContinuable,
59
67
  };
60
68
  }
61
69
 
62
70
  module.exports = {
71
+ GRANT_CONTINUABLE_SKILLS,
63
72
  USER_INVOKED_SKILLS,
64
73
  MODEL_INVOKED_SKILLS,
65
74
  ROUTER_SKILLS,