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
@@ -18,16 +18,41 @@ ultra-status read-only router at any point
18
18
  ultra-delegate orthogonal bounded execution on another CLI
19
19
  ```
20
20
 
21
- Arrows are recommendations, not automatic invocation. The owner explicitly selects
22
- each public workflow. Delivery archives one stable `change_id`; the next request opens
23
- a new active id while prior task rows remain in the append-only ledger.
21
+ Arrows are recommendations, not automatic invocation by default. The owner explicitly
22
+ selects each public workflow unless a live owner-activated execution grant
23
+ (session-local activation or a stably verified durable work-package grant)
24
+ authorizes the host model to select only the covered Research,
25
+ Plan, Dev, Test, and reconcile-only Deliver routes. Init, Change, Delegate, Status,
26
+ final archive, and every external effect remain owner-selected. Delivery archives one
27
+ stable `change_id`; the next request opens a new active id while prior task rows remain
28
+ in the append-only ledger.
29
+
30
+ ## Topology and checkpoints
31
+
32
+ The owner chooses the Agent topology at every stage: one Agent or several, which
33
+ providers, which write scopes, serial or parallel. The unspecified default is the
34
+ current Agent continuing alone — no automatic spawning, delegation, or control-plane
35
+ enablement, and no provider permanently bound to a role. One primary writer owns the
36
+ canonical `.ultra` files in a worktree; parallel source writes use isolated worktrees
37
+ with explicit integration. Moving the primary-writer role itself to another Agent is
38
+ an owner-granted primary transfer — OFFER, verified ACK, sole-writer execution,
39
+ frozen terminal RESULT — and never a widened delegation
40
+ (`skills/ultra-change/references/primary-transfer.md`).
41
+
42
+ Every owner-facing checkpoint — a WIP at a stop, a closing Resume Note, a delivery
43
+ report — carries the eight fixed semantics defined in
44
+ [artifact authority](ARTIFACT-AUTHORITY.md#owner-checkpoint-semantics): why, outcome,
45
+ accepted boundary, delta, reality, decision needed, next bounded action, and not-done.
46
+ Checkpoints are cognitive interfaces, not stage markers; alignment failure stops work
47
+ until the owner re-accepts an outcome.
24
48
 
25
49
  ## Common entry contract
26
50
 
27
51
  Every user-invoked Skill reads, in order:
28
52
 
29
53
  1. zero or one `.ultra/changes/active/<change_id>/intent.md`; more than one is a conflict;
30
- 2. `.ultra/tasks.json`, selecting only tasks whose `change_id` matches that active id;
54
+ 2. `.ultra/tasks.json`, selecting only tasks whose `change_id` matches that active id
55
+ and treating its v2 row as the sole task-status authority;
31
56
  3. the matching frontier task's `context_file` and closing `## Resume Note`;
32
57
  4. `.ultra/project-brief.md`, the accepted `.ultra/north-star.md`, `CONTEXT.md`, and
33
58
  relevant `.ultra/decisions/`, where those artifacts already exist;
@@ -76,10 +101,11 @@ reconciliation before planning when the accepted contract needs an update.
76
101
 
77
102
  A micro edit that makes no specification sentence false stays outside the Ultra
78
103
  lifecycle and uses ordinary repository TDD/verification. Once an active Change exists,
79
- even a `quick` profile receives one minimal Plan task so evidence and delivery remain
80
- bound to its id. A separate request cannot open a second active Change: finish or
81
- deliver the current one, abandon it with owner authority, or explicitly reconcile the
82
- new request into the same stable id.
104
+ Plan creates the smallest graph justified by the real seams, evidence, review, and
105
+ recovery needs so delivery remains bound to its id; a profile never fixes task count. A
106
+ separate request cannot open a second active Change: finish or deliver the current one,
107
+ abandon it with owner authority, or explicitly reconcile the new request into the same
108
+ stable id.
83
109
 
84
110
  ## Planning
85
111
 
@@ -88,27 +114,75 @@ current-Change task graph and one context file per task without deleting histori
88
114
  rows. The model chooses ordinary technical seams; the owner is asked only when a seam
89
115
  changes a public contract, accepted risk, or another material trade-off. Every task
90
116
  stores the stable `change_id`; dependencies stay inside that Change and ids remain
91
- globally unique. Feature tasks are tracer bullets. A contract task precedes cross-process
92
- or cross-top-level-boundary implementations; integration checkpoints appear after
93
- several slices. Cycles and broken trace paths are repaired before handoff.
117
+ globally unique. Feature tasks are tracer bullets. A contract task precedes dependent
118
+ implementations when a shared contract must remain valid across independently changed
119
+ boundaries; integration checkpoints appear where slices first compose or observed
120
+ coupling and recovery risk justify a whole-path check. Cycles and broken trace paths are
121
+ repaired before handoff. Complexity, file, task, line, and context counts are
122
+ observations rather than plan-quality gates.
94
123
 
95
124
  ## Task development
96
125
 
97
126
  `ultra-dev` writes the implementation plan into the task context before code. It uses
98
- `ultra-tdd` on confirmed seams, records six evidence dimensions, and keeps ledger and
99
- context status synchronized. The closing Resume Note is rewritten even when work stops
100
- early.
101
-
102
- Task review uses six independent lenses. Findings move through stable JSON artifacts,
103
- not intermediate worker chatter. Refactoring happens after the evidence makes real
104
- duplication or coupling visible.
127
+ `ultra-tdd` on confirmed seams and records `ultra-task-evidence-v2`: typed acceptance,
128
+ six evidence dimensions, subject/context identity, limitations, and task-review
129
+ provenance. `.ultra/tasks.json` is the sole task-status authority; a new context has no
130
+ Status field, while legacy Status/Complexity values are migration diagnostics and the
131
+ ledger wins. The closing Resume Note is rewritten even when work stops early.
132
+ Before publishing that record, Dev hashes bounded stable repository-contained bytes for
133
+ every command or external `raw_evidence_ref` into `raw_evidence_sha256` and reads both
134
+ the raw receipt and written record back. Structural validation checks ref/digest shape
135
+ without dereferencing the receipt.
136
+
137
+ Task review selects lenses by risk and touched seams while the ledger row remains `in_progress`.
138
+ Its first admission binds the ledger, task context, immutable packet scope, and actual
139
+ pre-review evidence. It does not require a final v2 record or claim a task worktree
140
+ digest that Worker Packet v1 does not carry.
141
+ Findings move through stable JSON artifacts, not intermediate worker chatter. Verdicts
142
+ are terminal for the current subject: `APPROVE` ends the task review even when P2/P3
143
+ findings are retained — they become report entries or owner-selected backlog, never a
144
+ fresh review of the same subject. `REQUEST_CHANGES` routes only the exact current
145
+ P0/P1 findings as one in-scope repair set followed by one affected-lens delta review
146
+ per repair set inside the active review budget — an exact current owner grant
147
+ overrides the versioned product default of one initial review plus at most two
148
+ P0/P1 delta reviews per package; a `REQUEST_CHANGES` that would exceed the active
149
+ budget is an owner checkpoint, not another automatic repair, and the same root
150
+ surviving three failed fixes stops point-patching and reports an architecture
151
+ problem. Lens selection follows the review kind, never a fixed count: an initial task
152
+ review selects `review-spec` plus the lenses justified by risk and touched seams, a
153
+ delta review reruns only the affected lenses, and an aggregate Change review may
154
+ default to all six only when cross-task wiring justifies it. Budget exhaustion keeps the row `in_progress` and returns
155
+ `owner checkpoint` / `budget_exhausted` without any semantic verdict.
156
+ After the final summary validates, Dev independently captures the `subject`
157
+ as a completion-snapshot freshness observation and immediately writes the one canonical
158
+ v2 record; its `task_review` separately binds the retained strict summary, which does not
159
+ prove the subject worktree digest. Only then may the primary model write `completed` to
160
+ the ledger. Refactoring happens
161
+ when evidence makes real duplication, coupling, or a boundary defect visible, never
162
+ because a slice, finding, file, or repair-round count crossed a threshold.
163
+
164
+ If later work invalidates completed evidence, Dev records the affected criterion IDs and reason in the context Change Log and Resume Note before changing the
165
+ ledger-authoritative row from `completed` to `in_progress`; there is no silent demotion.
166
+ The old frozen review remains historical evidence while the reopened task refreshes the
167
+ affected observations, obtains a new final review, and captures a new completion subject.
105
168
 
106
169
  ## Whole-system audit
107
170
 
108
- `ultra-test` runs once after tasks for the active Change are complete. It checks anti-patterns, coverage,
171
+ `ultra-test` runs once after tasks for the active Change are completed in the ledger
172
+ with current v2 evidence and retained task-review provenance. Historical v1 evidence is
173
+ a migration diagnostic, not current Test input. It checks anti-patterns, coverage,
109
174
  wiring, E2E behavior, performance, and security. It names the exact Git commit and
110
175
  binds the report to `change_id`, exact current task ids, intent SHA-256, and the
111
- product-worktree digest. `passed: true` implies complete current tasks and no required
176
+ product-worktree digest for the current whole Change. Each task evidence subject remains
177
+ its independently captured completion-snapshot freshness observation rather than being
178
+ rebound to this aggregate identity. Test independently rechecks current Acceptance bytes,
179
+ criterion IDs and verification types, retained task-review summary, durable owner record,
180
+ and cited affected artifacts. For command and external evidence it independently takes
181
+ the bounded stable non-symlink raw bytes, recomputes `raw_evidence_sha256`, then recomputes
182
+ the containing record's `evidence_digest`. `.ultra/evidence/**` is excluded from the
183
+ product-worktree digest, so these separate exact bindings prevent a self-referential
184
+ receipt. An invalidated task returns to the explicit Dev reopen
185
+ path. `passed: true` implies complete current tasks and no required
112
186
  area left `not_run`; task completion does not force a pass, and dispositioned gaps stay
113
187
  visible. It never turns an orphan,
114
188
  failed command, stub, or omission into permission to alter scope.
@@ -139,13 +213,21 @@ effects. Readiness grants none automatically.
139
213
  - draft or blocking active intent → change;
140
214
  - unsatisfied Research Disposition → research;
141
215
  - active Change without matching executable tasks → plan;
142
- - matching pending or in-progress task → dev;
143
- - completed current-Change tasks without a matching fresh report → test;
216
+ - the unique matching `in_progress` task → dev;
217
+ - only `pending` tasks remaining → report them as frontier candidates and recommend
218
+ one exact task id for an explicit owner invocation of dev;
219
+ - a completed ledger row with missing, stale, or invalid v2 evidence/task review → dev
220
+ to record affected criteria and reason, explicitly reopen, and repair provenance;
221
+ - completed current-Change tasks with current v2 evidence and no matching fresh report → test;
144
222
  - false report → route by finding and owner disposition, not by the boolean alone;
145
223
  - fresh, dispositioned report and unarchived Change → deliver.
146
224
 
147
- It also checks installation provenance, stale reports, old in-progress work, and
148
- unresolved markers. It does not mutate artifacts.
225
+ It also checks installation provenance, unresolved markers, broken resume paths, and
226
+ report freshness by root Change identity, exact ordered v2 task-evidence/review
227
+ identities, and strict aggregate Review packet/admission/subject/summary bindings. It
228
+ replays the existing structural validators; they observe transport and freshness but
229
+ never decide semantic acceptance. Age, complexity, and file/task counts may be reported
230
+ as context but never decide staleness or quality. It does not mutate artifacts.
149
231
 
150
232
  ## Delegation
151
233
 
@@ -170,14 +252,19 @@ Every durable output has a later reader:
170
252
  planning, development, audit, review, status, and delivery; an abandoned intent has
171
253
  an exact `## Abandonment` closure consumed by future Change reconciliation and Status;
172
254
  - the append-only task ledger and contexts are the common resume input after filtering
173
- by active `change_id`, while task evidence feeds
174
- review, whole-system audit, and delivery;
255
+ by active `change_id`, while typed v2 task evidence and retained task-review
256
+ provenance feed review, whole-system audit, and delivery;
175
257
  - the current test report is consumed by status and delivery;
176
258
  - delivery moves with the Change into archive and remains historical evidence.
177
259
 
178
260
  `ultra-status` intentionally writes nothing. Review, Hook, compact, and delegation
179
- files are derived observations with explicit rebuild or rerun paths. No route creates
180
- an unowned drift log, Change plan, technical-debt report, or second delivery summary.
261
+ files are derived observations rather than semantic authority. A current strict review
262
+ session contains `WORKER-PACKET.json`, `ADMISSION.json`, every selected specialist
263
+ artifact, and `SUMMARY.json`; retain it until aggregate Test and Deliver have both consumed it
264
+ successfully, then it may be garbage-collected. Premature loss requires a fresh Review
265
+ and Test; never reconstruct the old receipt. Other derived observations keep their
266
+ explicit rebuild or rerun paths. No route creates an unowned drift log, Change plan,
267
+ technical-debt report, or second delivery summary.
181
268
 
182
269
  ## Interruption and cross-host continuation
183
270
 
@@ -193,6 +280,17 @@ the common entry contract and compares the working tree with those claims.
193
280
  This path remains valid when hooks and `ubp` are disabled. A compact snapshot may be
194
281
  used as a hint, then checked against canonical files and Git.
195
282
 
283
+ Continuing on a different Agent — not merely a different host — additionally
284
+ requires a primary transfer: an exact owner grant, a derived OFFER binding the
285
+ canonical refs, HEAD, and worktree digest, the receiver's stable-read ACK, and a
286
+ frozen terminal RESULT (`skills/ultra-change/references/primary-transfer.md`).
287
+ Receipts are derived state; when they are lost, the owner confirms and a fresh
288
+ handoff id is issued rather than reconstructing an old ACK. The post-review
289
+ task closeout never refreshes that RESULT or opens a handoff for itself: beside
290
+ a newest completed v2 RESULT it publishes the handoff's CLOSEOUT receipt — the
291
+ one prescribed, uncommitted, review-and-handoff-free closeout transition of the
292
+ same contract.
293
+
196
294
  An authenticated Claude-to-Codex continuation using this path passed on 2026-08-03;
197
295
  the exact scope, provenance, results, and limitations are recorded in the
198
296
  [runtime compatibility matrix](RUNTIME-COMPAT-MATRIX.md#authenticated-cross-host-continuation-evidence).
@@ -0,0 +1,84 @@
1
+ # 对抗性审查盲测记录 — 2026-08-14
2
+
3
+ ## 结论
4
+
5
+ 本轮证据不支持增加永久第七个 `premise` lens。当前 `review-spec` 在明确要求校验
6
+ North Star 因果贡献后,已经覆盖候选 lens 的五类已知缺陷;候选 lens 没有稳定找到
7
+ 当前 roster 漏掉的 consequential defect class。
8
+
9
+ 因此保留六 lens roster,把 premise challenge 固化到 `review-spec`,并把独立
10
+ `premise` 角色保留为 Plan 与 aggregate Test 的 blind cross-family probe。这个 probe
11
+ 是隔离采样,不参与投票,也不能用无效结果替代六 lens findings。
12
+
13
+ ## 评估边界
14
+
15
+ - Fixture revision: `37c07dc8596cda64a93aac260917b3c091ad1b58`
16
+ - Hidden seeds: `tests/evals/adversarial-review-seeds.json`
17
+ - Current prompt: `tests/evals/prompts/current-spec-lens.md`
18
+ - Candidate prompt: `tests/evals/prompts/candidate-premise-lens.md`
19
+ - Six-lens probe: `tests/evals/prompts/current-six-lens-probe.md`
20
+ - Permission: read-only、无 external effects、独立 Git worktree
21
+ - Claude Code: `2.1.232`
22
+ - Kimi Code: `0.31.1`,显式模型 `kimi-code/k3`
23
+ - Grok Build: `1.0.3 (1a29d5bc12d4)`
24
+ - ZCode CLI: `0.16.3`,临时非持久化 provider 配置,GLM-5.3
25
+
26
+ Seed manifest 从所有 Worker Packet 中隐藏。所有有效结果都通过
27
+ `ultra-delegation-result-v1`、packet digest、只读 diff 和 launcher strict validation;
28
+ 模型陈述“未修改文件”本身不算权限证据。
29
+
30
+ ## Seed 映射
31
+
32
+ | Run | Premise | Correctness | Test coverage | Recovery | Documentation | 可计分 |
33
+ |---|---:|---:|---:|---:|---:|---:|
34
+ | `spec-claude` / current spec | yes | yes | yes | yes | yes | yes |
35
+ | `premise-claude` / candidate | yes | yes | yes | yes | yes | yes |
36
+ | `six-kimi` / current six concerns | yes | yes | yes | yes | yes | yes |
37
+ | `spec-zcode-3` / current spec | yes | yes | yes | yes | yes | yes |
38
+ | `spec-grok-4` / current spec | partial raw text | partial raw text | partial | no stable result | partial | no |
39
+ | `premise-grok-4` / candidate | partial raw text | partial raw text | partial | partial | partial | no |
40
+
41
+ Claude 的 candidate 产生了比 current spec 更多的表述和风险拆分,但没有新增 seed class。
42
+ Kimi 的完整六关注面与 ZCode 的 current spec 都再次找到五类 seed,说明 premise/causal
43
+ 挑战可以被最窄地放进 specification fidelity,而不必增加一个永久 lens。
44
+
45
+ Grok 四轮尝试均以 exit code 0 结束,但输出被 host wrapper 截断或混入重复、畸形 JSON,
46
+ launcher 正确发布 `failure_type: missing_result`。原始片段里出现若干真实缺陷不能算成功
47
+ findings;这证明的是 Grok 1.0.3 的 structured-result conformance 缺口,不是 lens 语义结论。
48
+
49
+ ## 原始观察
50
+
51
+ 原始 receipt、worker spec、stdout、stderr 与 terminal result 保存在可重建观察区:
52
+
53
+ `.ultra/.runtime/adversarial-eval/2026-08-14/delegations/`
54
+
55
+ 关键 terminal result SHA-256:
56
+
57
+ - `spec-claude/result.json`: `14156c2fd86936a725fe5e9e42b90e8cb9e80e2d3045304046bd9791baa5caaf`
58
+ - `premise-claude/result.json`: `bf39a38b5893f53a18f95f55932b28e381edbf2f4a8bae9b1dd1180b61267bbd`
59
+ - `six-kimi/result.json`: `ca523134aa30f2ad39ebf539dd2b31b74b06c966c37d4cee4feae17574bf6aaf`
60
+ - `spec-zcode-3/result.json`: `f9409cdd62a5e41a5b183cbed155e25e097ec9a27d0d0bfae0f9e74d87468956`
61
+ - `spec-grok-4/result.json`: `0d33a9f5f4a80d75b0ebb908d30f6d12d9e26be1f3122b976dfd126fba8a34de`
62
+ - `premise-grok-4/result.json`: `6e33fd9fc6a17313151a640717ad257efbfb780417044f8b9d92cc46acd128b5`
63
+
64
+ 该目录是 disposable evidence,不是项目语义权威;可由 tracked fixture、prompts 和当前
65
+ delegate launcher 重建。
66
+
67
+ ## 产品决定
68
+
69
+ 1. 六 lens roster 不变。
70
+ 2. `review-spec` 必须同时验证 accepted behavior、North Star Trace、因果链、contradiction
71
+ disposition,以及“全部 acceptance 通过但 outcome 仍失败”的路径。
72
+ 3. Plan review 与 aggregate Test review 必须产出六 lens session;没有 findings artifact
73
+ 不得声称阶段完成。
74
+ 4. 可用不同 model family 时追加一次 blind premise probe;不可用时记录缺失,不伪造独立性。
75
+ 5. `execution_mode` 和每个 worker 的 coverage refs 必须落盘。顺序角色扮演只能记录为
76
+ `sequential_fallback`,不能声称 isolated multi-agent。
77
+ 6. 只有 fresh blind fixture 反复证明 current roster 漏掉独立 consequential class 时,
78
+ 才重新讨论第七 lens。
79
+
80
+ ## 最便宜复测
81
+
82
+ 先运行 `node --test tests/adversarial-review-eval.test.cjs`,确认 green-test trap 与五个
83
+ hidden seed 仍存在;然后在新的隔离上下文中用相同 permission 分别运行 current spec 与
84
+ candidate premise prompts。不得向 worker 暴露 seed manifest 或本报告。
@@ -0,0 +1,103 @@
1
+ # ZCode 自动编码与双向委派实测 — 2026-08-14
2
+
3
+ ## 结论
4
+
5
+ 当前实现已经证明两条不同的 live path:ZCode 可以作为第六个目标 Host 被 Ultra
6
+ 委派,也可以作为发起 Host 调用另一个 CLI;在 owner 明确激活的 Change-scoped
7
+ Autonomy Envelope 内,它还可以在同一会话连续完成 Plan、Dev/TDD 和 Test,而不需要
8
+ daemon、数据库、MCP 或语义状态机。
9
+
10
+ 这不是无限授权。实测 envelope 只覆盖一个任务、零次委派、零 external effects,并在
11
+ through-test stop condition 后停止;Deliver finalization、archive、commit、push、publish
12
+ 和 deploy 都没有获得授权,也没有发生。
13
+
14
+ ## ZCode 原生插件
15
+
16
+ - ZCode CLI: `0.16.3`
17
+ - Managed plugin: `ultra-builder-pro@inline`
18
+ - Native inventory: 14 Skills、5 Hooks、0 Commands、0 MCP
19
+ - Activation: managed local marketplace 加 owner-configured `plugins.dirs` entry
20
+ - Hook bridge: `hooks/adapters/zcode.py`
21
+
22
+ 安装后 `zcode plugins list` 报告插件 enabled,并能枚举全部十四个 qualified Skills。
23
+ 一次真实 no-op Bash tool call 在修复 hook transport 后以 exit 0 完成;无动作 adapter
24
+ 现在不再把 `{}` 发送给 ZCode 的 strict hook parser,而是保持 stdout 为空。
25
+
26
+ ## 同会话自动编码
27
+
28
+ - Fixture: `/tmp/ubp-zcode-autonomy-20260814`
29
+ - Seed HEAD: `7292d7654d228ac3dc7f9b07b2e28d226c6f6104`
30
+ - Change: `C-AUTO`
31
+ - Task: `T-AUTO-1`
32
+ - ZCode session: `sess_49caffcb-1d8e-44be-825d-ec607d21b1e3`
33
+ - Envelope: through-test、max tasks 1、max repairs 2、review budgets 1 each、delegations 0
34
+
35
+ ZCode 读取 accepted intent 和 exact North Star revision 后完成:
36
+
37
+ 1. 写入一个 tracer-bullet task,并生成 Plan review;
38
+ 2. 通过 public seam 写出可发现的 failing test,再做最小实现修复;
39
+ 3. 生成 task review 和六维 evidence;
40
+ 4. 运行 whole-change Test、真实 consumer E2E 和 aggregate review;
41
+ 5. 写入 fresh `.ultra/test-report.json`,然后按 envelope 停止。
42
+
43
+ 独立复核命令 `npm test` exit 0,3 tests、3 pass、0 skipped。三份
44
+ `SUMMARY.json` 都通过当前 `review_wait.py` 校验:Plan 为 APPROVE/0 findings,Task 和
45
+ aggregate Change 均为 APPROVE/1 P3。Test 报告保留两个 P3 residual risk:finite-number
46
+ 合同缺少非整数例子,以及作为 library 的 export 没有仓内非测试 consumer。
47
+
48
+ 原会话第一次在所有产品工作完成后,因 no-op hook 把 `{}` 写到 stdout 而在最后一个
49
+ benign Bash 验证上 exit 1。修复 adapter 并重装插件后,先独立复现该 Bash 为 exit 0,
50
+ 再 resume 同一个 session 做只读终检;resume exit 0,HEAD 仍是 seed commit,未生成
51
+ commit。这条失败没有被隐藏,它直接产生了当前 hook 修复。
52
+
53
+ ## ZCode 作为目标 Host
54
+
55
+ 对抗性 fixture seed HEAD 为 `37c07dc8596cda64a93aac260917b3c091ad1b58`。一次
56
+ `--to zcode` 的 read-only delegation 通过 instruction、permission、output-schema
57
+ digest、空 diff 和 terminal-result 校验,并找到五类 hidden seed。terminal result
58
+ SHA-256 为:
59
+
60
+ `f9409cdd62a5e41a5b183cbed155e25e097ec9a27d0d0bfae0f9e74d87468956`
61
+
62
+ 语义评测与 six-lens 决定见 `docs/evals/adversarial-review-2026-08-14.md`。
63
+
64
+ 随后又专门验证了当前 macOS 上 `zcode` 不在 `PATH` 的默认路径。未设置
65
+ `UBP_DELEGATE_ZCODE_BIN`,共享 profile 自动选择
66
+ `/Applications/ZCode.app/Contents/Resources/glm/zcode.cjs`。第一次调用真实完成审查但
67
+ 省略 `$schema`;原因是共享 prompt 先要求该字段、随后列举“exact fields”时又漏掉它。
68
+ launcher 按设计发布 `failed/missing_result`,没有把不合约输出算作成功。补上 prompt
69
+ contract 回归并重新安装后,以新 delegation id 再跑:
70
+
71
+ - Delegation id: `spec-zcode-default-fallback-2`
72
+ - ZCode session: `sess_a985dc31-0eb5-4521-988d-97e92bee2c9a`
73
+ - Selected command: `/Applications/ZCode.app/Contents/Resources/glm/zcode.cjs`
74
+ - Override: absent
75
+ - Result: `finished`、5 findings、empty diff、exit 0、stderr 为空
76
+ - Result SHA-256: `71d973723b9317fe2ad31d3216a4f65e933d8ac18a8275244c94b84623dae852`
77
+
78
+ 这把“ZCode 可以作为 target”从手工 binary override 提升为当前安装形态下的默认真实
79
+ 路径,并同时验证了不合约结果的可恢复失败路径。
80
+
81
+ ## ZCode 作为发起 Host
82
+
83
+ 同一 fixture 上,ZCode session `sess_3ba3e9b2-6e3a-492d-876e-5e1a5e817d77`
84
+ 执行 `ubp delegate run --to claude`,等待 terminal artifact,再读取并汇报结果。Claude
85
+ worker 只读定位到 `timeout-after-charge` 后无幂等键重试造成重复扣款的缺陷;worktree
86
+ 保持空 diff,result status 为 `finished`,exit code 0。
87
+
88
+ - Delegation id: `zcode-to-claude-2`
89
+ - Result SHA-256: `f2a9d9d88def969a0dc52ce494f0226e4c0f17f48c049c301e01241d449890da`
90
+ - Instruction digest: `0d4a958db8c903eb6f5da6b8a6e6932a67398ad520424b32c8e4f83972618dd4`
91
+ - Permission digest: `96f7f8ed4ddb77e4569519d8d20d2e29595c74a06b119d0dee8f3a7dd2cb`
92
+ - Schema digest: `723230a485136ef52d0ef6f6fcbe804fc9b13544a11b93aefb2a75fe7ce3887d`
93
+
94
+ 这证明的是 ZCode→Ultra launcher→Claude 的真实 source path,不只是“ZCode 能被别的
95
+ Host 调用”。第一次尝试也如实暴露了隔离 `HOME` 隐藏 Claude 登录的问题;第二次仅把
96
+ 已授权的真实 `HOME` 交给 nested launcher,未复制或打印任何凭据。
97
+
98
+ ## 六目标 Host 当前边界
99
+
100
+ Claude、Codex、OpenCode、Kimi 和 ZCode 均完成了 schema-valid read-only target run。
101
+ Grok Build 1.0.3 多轮 exit 0 但 terminal output 截断或畸形,launcher 正确发布
102
+ `failed/missing_result`;其 partial text 不计入 findings。这个残余是当前 Grok 输出
103
+ conformance ceiling,不能通过放松 result contract 来伪造成成功。
package/hooks/README.md CHANGED
@@ -16,11 +16,34 @@ progress observations live under ignored `.ultra/.runtime/` or `.ultra/progress/
16
16
  canonical semantic facts remain the owner-readable files and Git.
17
17
  Legacy task rows with no `change_id` remain readable from an active-path `change_ref`
18
18
  during migration; a present canonical `change_id` always wins, and archived or
19
- abandoned paths are never revived as current work. Task
20
- selection prefers the single `in_progress` row, then the first `pending` row whose
21
- same-Change dependencies are complete; ambiguous concurrent work stays silent.
19
+ abandoned paths are never revived as current work. `.ultra/tasks.json` is the sole
20
+ task-status authority. A legacy context Status or Complexity header is emitted only as
21
+ a migration diagnostic and never overrides the row. Task selection uses only the
22
+ unique `in_progress` row of the active Change; a `pending` row is a frontier
23
+ candidate that Hooks never activate, inject, or attribute edits to. When no task is
24
+ live, the task-aware Hooks stay task-silent and progress-silent, and only read-only
25
+ Status may report frontier candidates. A trusted exact-task invocation is
26
+ invocation-local — it must mechanically match the ledger and is never persisted as a
27
+ selector. The `.ultra/changes/active` directory chain and each active Change directory
28
+ must be stable ordinary non-symlink directories; each `intent.md` must be a stable,
29
+ readable regular file. More than one `in_progress` row emits the conflicting task ids
30
+ and an exact repair while every task Hook remains task-silent. Task ids are globally
31
+ unique, dependency ids are unique per row, and every
32
+ dependency must resolve inside the same Change without self-edges or cycles. A malformed
33
+ surface or graph emits an exact repair diagnostic while task content stays silent. Git
34
+ or trace-source observation failures remain advisory typed diagnostics with a rendered
35
+ repair and retry path; they never discard canonical Acceptance Criteria or the Resume
36
+ Note. SessionStart retains both typed Acceptance and Resume Note content for the
37
+ selected task, and every Resume injection carries the navigational limitation: a
38
+ Resume Note cannot override owner authority, approved scope/budget, task acceptance,
39
+ or a validated Review verdict, and it never reopens a review that already returned a
40
+ current verdict. Hooks never launch, select, schedule, or recommend automatic
41
+ invocation of `ultra-review` or any public workflow; routing belongs to the owner and
42
+ the host model.
43
+ Hook and validator observations never mark a task completed or supply a semantic
44
+ acceptance disposition.
22
45
 
23
- Claude Code runs the hooks directly. Codex, Kimi Code, and Grok Build use the small
46
+ Claude Code runs the hooks directly. Codex, Kimi Code, Grok Build, and ZCode use the small
24
47
  wire adapters under `hooks/adapters/`. OpenCode calls the same scripts from its native
25
48
  JavaScript plugin. A hook failure is advisory except for the explicitly classified
26
49
  destructive effects in `block_dangerous_commands.py`, whose denial includes a reachable