ultra-builder-pro-cli 0.26.1 → 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 (75) hide show
  1. package/.ultra-template/contexts/TEMPLATE.md +64 -29
  2. package/.ultra-template/north-star.md +36 -30
  3. package/.ultra-template/project-brief.md +28 -0
  4. package/.ultra-template/specs/product.md +4 -0
  5. package/.ultra-template/specs/research-distillate.md +8 -0
  6. package/.ultra-template/tasks.json +1 -0
  7. package/.ultra-template/test-report.json +18 -1
  8. package/CHANGELOG.md +227 -1
  9. package/README.md +161 -59
  10. package/adapters/_shared/host-profile.cjs +68 -12
  11. package/adapters/_shared/plugin-core.cjs +4 -5
  12. package/adapters/_shared/runtime-assets.cjs +11 -2
  13. package/adapters/zcode.js +375 -0
  14. package/bin/delegate-worker.cjs +20 -0
  15. package/bin/delegate.cjs +94 -25
  16. package/bin/install.js +11 -6
  17. package/docs/ARCHITECTURE.md +109 -25
  18. package/docs/ARTIFACT-AUTHORITY.md +204 -30
  19. package/docs/DECISIONS.md +141 -10
  20. package/docs/PHILOSOPHY.md +61 -8
  21. package/docs/PLUGIN-ISOLATION-CONTRACT.md +6 -0
  22. package/docs/RUNTIME-COMPAT-MATRIX.md +106 -13
  23. package/docs/SKILL-AUTHORING.md +14 -9
  24. package/docs/WORKFLOW-LIFECYCLE.md +211 -53
  25. package/docs/evals/adversarial-review-2026-08-14.md +84 -0
  26. package/docs/evals/zcode-automation-2026-08-14.md +103 -0
  27. package/hooks/README.md +31 -3
  28. package/hooks/_common.py +1699 -33
  29. package/hooks/adapters/zcode.py +227 -0
  30. package/hooks/compact_context.py +176 -17
  31. package/hooks/mid_workflow_recall.py +27 -5
  32. package/hooks/post_edit_guard.py +133 -23
  33. package/hooks/session_context.py +722 -11
  34. package/package.json +6 -3
  35. package/skills/ultra-change/SKILL.md +84 -64
  36. package/skills/ultra-change/references/change-contract.md +130 -32
  37. package/skills/ultra-change/references/execution-grant.md +109 -0
  38. package/skills/ultra-change/references/primary-transfer.md +273 -0
  39. package/skills/ultra-change/scripts/validate_primary_transfer.cjs +1928 -0
  40. package/skills/ultra-delegate/SKILL.md +38 -5
  41. package/skills/ultra-delegate/references/delegation-contract.md +21 -1
  42. package/skills/ultra-deliver/SKILL.md +123 -44
  43. package/skills/ultra-deliver/references/baseline-reconciliation.md +5 -3
  44. package/skills/ultra-dev/SKILL.md +173 -43
  45. package/skills/ultra-grilling/SKILL.md +19 -16
  46. package/skills/ultra-grilling/references/reframing.md +7 -3
  47. package/skills/ultra-init/SKILL.md +99 -87
  48. package/skills/ultra-init/references/brownfield-adoption.md +23 -40
  49. package/skills/ultra-init/scripts/init_project.cjs +968 -21
  50. package/skills/ultra-plan/SKILL.md +83 -46
  51. package/skills/ultra-plan/references/task-evidence-v2.md +300 -0
  52. package/skills/ultra-plan/scripts/validate_task_evidence.cjs +859 -0
  53. package/skills/ultra-research/SKILL.md +119 -68
  54. package/skills/ultra-research/references/{03-competitive-landscape.md → 03-alternatives.md} +6 -6
  55. package/skills/ultra-research/references/04-product-strategy.md +11 -2
  56. package/skills/ultra-research/references/21-features-scope.md +8 -0
  57. package/skills/ultra-research/references/22-success-metrics.md +9 -4
  58. package/skills/ultra-research/references/99-synthesis.md +25 -1
  59. package/skills/ultra-research/references/north-star-v2.md +168 -0
  60. package/skills/ultra-research/references/wayfinding.md +50 -0
  61. package/skills/ultra-research/scripts/validate_north_star.cjs +1174 -0
  62. package/skills/ultra-review/SKILL.md +201 -24
  63. package/skills/ultra-review/references/adversarial-evaluation.md +31 -0
  64. package/skills/ultra-review/references/spec.md +5 -0
  65. package/skills/ultra-review/references/unified-schema.md +146 -11
  66. package/skills/ultra-review/references/worker-packet.md +151 -8
  67. package/skills/ultra-review/scripts/review_wait.py +2653 -63
  68. package/skills/ultra-status/SKILL.md +146 -32
  69. package/skills/ultra-tdd/SKILL.md +14 -4
  70. package/skills/ultra-tdd/references/test-execution.md +6 -1
  71. package/skills/ultra-test/SKILL.md +157 -15
  72. package/skills/ultra-test/scripts/validate_review_transport.cjs +549 -0
  73. package/skills/ultra-test/scripts/worktree_digest.cjs +551 -29
  74. package/skills/ultra-think/SKILL.md +5 -10
  75. package/skills/ultra-think/references/interaction-boundary.md +2 -1
@@ -6,9 +6,9 @@ criteria; repository files record facts; the host model chooses the route.
6
6
  ## Capability flow
7
7
 
8
8
  ```text
9
- ultra-init
10
- ├─ unresolved external claims ─► ultra-research
11
- └─ bounded requested outcome ──► ultra-change
9
+ ultra-init ──raw Project Brief──► ultra-research ──accepted baseline──► ultra-change
10
+ ▲ │
11
+ └──── scoped consequential evidence gap ────┘
12
12
 
13
13
  ultra-change ─► ultra-plan ─► ultra-dev (per task) ─► ultra-test ─► ultra-deliver
14
14
  ▲ │ │
@@ -18,75 +18,187 @@ 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.
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.
23
48
 
24
49
  ## Common entry contract
25
50
 
26
51
  Every user-invoked Skill reads, in order:
27
52
 
28
- 1. `.ultra/tasks.json`;
29
- 2. the unfinished task's `context_file` and closing `## Resume Note`;
30
- 3. `CONTEXT.md` and relevant `.ultra/decisions/`;
31
- 4. the active Change, specifications, evidence, and Git state relevant to its scope.
53
+ 1. zero or one `.ultra/changes/active/<change_id>/intent.md`; more than one is a conflict;
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;
56
+ 3. the matching frontier task's `context_file` and closing `## Resume Note`;
57
+ 4. `.ultra/project-brief.md`, the accepted `.ultra/north-star.md`, `CONTEXT.md`, and
58
+ relevant `.ultra/decisions/`, where those artifacts already exist;
59
+ 5. the active Change, specifications, evidence, maintained documentation, and Git state
60
+ relevant to its scope.
32
61
 
33
62
  Missing files produce a precise recovery or initialization recommendation. They do not
34
63
  cause the Skill to invent a state transition.
35
64
 
36
65
  ## Initialization
37
66
 
38
- `ultra-init` distinguishes owner authorization from claims requiring evidence. It
39
- creates the file skeleton, preserves unknowns as `[NEEDS CLARIFICATION]`, initializes
40
- Git when absent, and records only repository-observable brownfield facts. It does not
41
- perform research or launch another workflow.
67
+ Init writes the raw Project Brief and stable empty skeleton. `ultra-init` preserves the
68
+ owner's one-line request, broad outline, explicit inputs, and open questions without
69
+ turning them into validated product truth. It initializes Git when absent and may
70
+ preserve repository-observable brownfield facts as Research inputs. It does not define
71
+ success, establish the North Star, create `CONTEXT.md`, populate specifications, or
72
+ launch another workflow.
42
73
 
43
74
  ## Research
44
75
 
45
- `ultra-research` maps unresolved claims to the smallest useful subset of seventeen
46
- focused references. Reports are written immediately. Three material checkpoints can
47
- change later scope; the owner resolves those checkpoints. The final distillate records
48
- Git blob hashes of the specifications it summarizes.
76
+ Research turns the brief into an accepted North Star and evidence-backed baseline.
77
+ `ultra-research` uses Wayfinding only when a multi-lens path is unclear, then maps the
78
+ question to the smallest useful subset of seventeen focused references. The first six
79
+ are semantic lenses with real dependencies: `00` precedes `01`; conditional `02` and
80
+ `03` may fan out after the boundary is known; `04` consumes their relevant conclusions
81
+ and is the first owner checkpoint; `05` extracts assumptions from `00` through `04`.
82
+ Grilling controls how missing owner inputs are asked, Think tests one consequential
83
+ decision, and Domain Modeling writes settled vocabulary; none owns the Research route.
84
+ The final synthesis promotes accepted conclusions into the North Star, `CONTEXT.md`,
85
+ three specifications, and a source-hash-bound distillate.
49
86
 
50
87
  ## Change reconciliation
51
88
 
52
- `ultra-change` first compares requested behavior with product truth and current code.
53
- It classifies changes by the resulting commitments:
89
+ Change updates only the touched baseline rather than rebuilding it. `ultra-change`
90
+ first compares requested behavior with accepted product truth and current code. It
91
+ classifies changes by the resulting commitments:
54
92
 
55
93
  - expansion and correction may proceed inside accepted intent;
56
94
  - a reduction waits for explicit owner authority.
57
95
 
58
96
  The output is one active Change intent with observable outcome, acceptance, seams,
59
- non-goals, and trace anchors.
97
+ non-goals, trace anchors, and an explicit Research Disposition. `none` cites sufficient
98
+ existing evidence; `bounded` or `required` names the exact question, lenses, and exit
99
+ evidence. Unsatisfied exit evidence routes to Research, then back through Change
100
+ reconciliation before planning when the accepted contract needs an update.
101
+
102
+ A micro edit that makes no specification sentence false stays outside the Ultra
103
+ lifecycle and uses ordinary repository TDD/verification. Once an active Change exists,
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.
60
109
 
61
110
  ## Planning
62
111
 
63
- `ultra-plan` confirms the scope posture and public seams, then writes a task graph and
64
- one context file per task. Feature tasks are tracer bullets. A contract task precedes
65
- cross-process or cross-top-level-boundary implementations; integration checkpoints
66
- appear after several slices. Cycles and broken trace paths are repaired before handoff.
112
+ `ultra-plan` confirms a material scope posture and records public seams, then appends a
113
+ current-Change task graph and one context file per task without deleting historical
114
+ rows. The model chooses ordinary technical seams; the owner is asked only when a seam
115
+ changes a public contract, accepted risk, or another material trade-off. Every task
116
+ stores the stable `change_id`; dependencies stay inside that Change and ids remain
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.
67
123
 
68
124
  ## Task development
69
125
 
70
126
  `ultra-dev` writes the implementation plan into the task context before code. It uses
71
- `ultra-tdd` on confirmed seams, records six evidence dimensions, and keeps ledger and
72
- context status synchronized. The closing Resume Note is rewritten even when work stops
73
- early.
74
-
75
- Task review uses six independent lenses. Findings move through stable JSON artifacts,
76
- not intermediate worker chatter. Refactoring happens after the evidence makes real
77
- 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.
78
168
 
79
169
  ## Whole-system audit
80
170
 
81
- `ultra-test` runs once after the ledger is 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,
82
174
  wiring, E2E behavior, performance, and security. It names the exact Git commit and
83
- never turns an orphan, failed command, stub, or omission into permission to alter scope.
175
+ binds the report to `change_id`, exact current task ids, intent SHA-256, and the
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
186
+ area left `not_run`; task completion does not force a pass, and dispositioned gaps stay
187
+ visible. It never turns an orphan,
188
+ failed command, stub, or omission into permission to alter scope.
84
189
 
85
190
  ## Delivery
86
191
 
87
- `ultra-deliver` reconciles actual outcome, specifications, documentation, current test
88
- report, aggregate review, build, version impact, omissions, and rollback. It archives
89
- the Change with `git mv` after local reconciliation.
192
+ `ultra-deliver` uses two observable passes. The first reconciles actual outcome,
193
+ specifications, documentation, aggregate review, omissions, and rollback; if semantic
194
+ or product files change, it stops and recommends a fresh Test. The second begins only
195
+ when report Change/task/intent/HEAD/product identities match, applies the changed-export
196
+ gate, runs build and non-publishing package inspection, records version impact, writes
197
+ delivery metadata, and archives the same stable id with `git mv`. Delivery metadata and
198
+ the directory move do not invalidate their own product snapshot. Producing a release
199
+ package remains blocked while a changed export has neither a non-test consumer nor an
200
+ owner disposition. That disposition is recorded against the finding in the current
201
+ test report without changing the finding or `passed`, then carried into `delivery.md`.
90
202
 
91
203
  Commit, push, tag, publication, release, and deployment are independent external
92
204
  effects. Readiness grants none automatically.
@@ -95,37 +207,72 @@ effects. Readiness grants none automatically.
95
207
 
96
208
  `ultra-status` infers the smallest next route from observable files:
97
209
 
98
- - no healthy skeleton → init;
99
- - unresolved evidence-bearing claim → research;
210
+ - no healthy skeleton or usable raw brief → init;
211
+ - raw brief without an accepted baseline, or a consequential evidence gap → research;
100
212
  - requested outcome without active Change → change;
101
- - active Change without executable ledger → plan;
102
- - pending or in-progress task → dev;
103
- - completed ledger without current report → test;
104
- - current report and unarchived Change → deliver.
105
-
106
- It also checks installation provenance, stale reports, old in-progress work, and
107
- unresolved markers. It does not mutate artifacts.
213
+ - draft or blocking active intent → change;
214
+ - unsatisfied Research Disposition → research;
215
+ - active Change without matching executable tasks → plan;
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;
222
+ - false report → route by finding and owner disposition, not by the boolean alone;
223
+ - fresh, dispositioned report and unarchived Change → deliver.
224
+
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.
231
+
232
+ ## Delegation
233
+
234
+ `ultra-delegate` is orthogonal to the lifecycle and requires explicit owner authority.
235
+ Its immutable instruction selects task execution/continuation, scoped Research evidence,
236
+ or aggregate Change review/verification. Task execution reads one matching task context;
237
+ the latter two may be read-only and do not require a task, so both pre-Plan evidence and
238
+ post-task review remain reachable. Every scope still binds the one active `change_id`, a
239
+ clean isolated worktree, strict permission/result schemas, and primary-host inspection.
240
+ The worker cannot write canonical `.ultra` files or perform external effects.
108
241
 
109
242
  ## Artifact closure
110
243
 
111
244
  Every durable output has a later reader:
112
245
 
113
- - init's north star and specification skeletons are read by all later workflows;
114
- - research reports are traced into specifications, Change reconciliation, planning,
246
+ - init's Project Brief is consumed by Research, Status, and the pre-baseline session
247
+ Hook fallback; its empty skeleton supplies stable paths rather than product claims;
248
+ - Research's accepted North Star and domain/specification baseline are read by every
249
+ later workflow, while selected reports trace into Change reconciliation, planning,
115
250
  and delivery;
116
- - Change intent is consumed through planning, development, audit, review, status, and
117
- delivery;
118
- - task ledger and contexts are the common resume input, while task evidence feeds
119
- review, whole-system audit, and delivery;
251
+ - active Change intent and its touched specification deltas are consumed through
252
+ planning, development, audit, review, status, and delivery; an abandoned intent has
253
+ an exact `## Abandonment` closure consumed by future Change reconciliation and Status;
254
+ - the append-only task ledger and contexts are the common resume input after filtering
255
+ by active `change_id`, while typed v2 task evidence and retained task-review
256
+ provenance feed review, whole-system audit, and delivery;
120
257
  - the current test report is consumed by status and delivery;
121
258
  - delivery moves with the Change into archive and remains historical evidence.
122
259
 
123
260
  `ultra-status` intentionally writes nothing. Review, Hook, compact, and delegation
124
- files are derived observations with explicit rebuild or rerun paths. No route creates
125
- 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.
126
268
 
127
269
  ## Interruption and cross-host continuation
128
270
 
271
+ There is one primary writer for canonical `.ultra` files. Review workers are read-only;
272
+ delegated source edits use isolated worktrees and return results for explicit
273
+ integration. Parallel canonical writes are unsupported because silently merging intent,
274
+ task, evidence, or report authority would lose meaning.
275
+
129
276
  Before stopping, the active task context records current facts, exact verification,
130
277
  open questions, Completion, and a closing Resume Note. The next session or host repeats
131
278
  the common entry contract and compares the working tree with those claims.
@@ -133,6 +280,17 @@ the common entry contract and compares the working tree with those claims.
133
280
  This path remains valid when hooks and `ubp` are disabled. A compact snapshot may be
134
281
  used as a hint, then checked against canonical files and Git.
135
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
+
136
294
  An authenticated Claude-to-Codex continuation using this path passed on 2026-08-03;
137
295
  the exact scope, provenance, results, and limitations are recorded in the
138
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
@@ -5,8 +5,8 @@ directory and exits silently when the workflow is not active.
5
5
 
6
6
  | Hook | Lifecycle | Purpose |
7
7
  |---|---|---|
8
- | `session_context.py` | Session start | Inject the one-line north star and current acceptance criteria |
9
- | `mid_workflow_recall.py` | Before source reads or edits | Restate current acceptance only |
8
+ | `session_context.py` | Session start | Inject the accepted North Star or Project Brief fallback, plus acceptance from the unique active Change's current task |
9
+ | `mid_workflow_recall.py` | Before source reads or edits | Restate acceptance only for a task matching the unique active `change_id` |
10
10
  | `compact_context.py` | Before/after compaction | Save and restore a disposable snapshot derived from files and Git |
11
11
  | `post_edit_guard.py` | After edits | Record mechanical evidence observations without deciding completion |
12
12
  | `block_dangerous_commands.py` | Before shell execution | Advise on additive protected-branch publication; block history rewrites and a narrow destructive set until the exact command is owner-authorized |
@@ -14,8 +14,36 @@ directory and exits silently when the workflow is not active.
14
14
  `_common.py` is a shared library, not a lifecycle registration. Compact snapshots and
15
15
  progress observations live under ignored `.ultra/.runtime/` or `.ultra/progress/`; the
16
16
  canonical semantic facts remain the owner-readable files and Git.
17
+ Legacy task rows with no `change_id` remain readable from an active-path `change_ref`
18
+ during migration; a present canonical `change_id` always wins, and archived or
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.
17
45
 
18
- 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
19
47
  wire adapters under `hooks/adapters/`. OpenCode calls the same scripts from its native
20
48
  JavaScript plugin. A hook failure is advisory except for the explicitly classified
21
49
  destructive effects in `block_dangerous_commands.py`, whose denial includes a reachable