ultra-builder-pro-cli 0.26.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/.ultra-template/contexts/TEMPLATE.md +70 -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 +235 -1
  6. package/README.md +210 -50
  7. package/README.zh-CN.md +440 -0
  8. package/adapters/_shared/host-profile.cjs +3 -95
  9. package/adapters/_shared/plugin-core.cjs +61 -5
  10. package/adapters/_shared/runtime-assets.cjs +66 -5
  11. package/adapters/zcode.js +375 -0
  12. package/bin/delegate-worker.cjs +2 -325
  13. package/bin/delegate.cjs +3 -461
  14. package/bin/install.js +11 -6
  15. package/docs/ARCHITECTURE.md +133 -31
  16. package/docs/ARTIFACT-AUTHORITY.md +185 -24
  17. package/docs/DECISIONS.md +153 -18
  18. package/docs/PHILOSOPHY.md +58 -7
  19. package/docs/PLUGIN-ISOLATION-CONTRACT.md +34 -12
  20. package/docs/RUNTIME-COMPAT-MATRIX.md +195 -23
  21. package/docs/SKILL-AUTHORING.md +19 -6
  22. package/docs/WORKFLOW-LIFECYCLE.md +196 -44
  23. package/docs/evals/adversarial-review-2026-08-14.md +84 -0
  24. package/docs/evals/ultra-5-0-journey-results.md +62 -0
  25. package/docs/evals/ultra-5-0-live-acp-conformance.md +93 -0
  26. package/docs/evals/ultra-5-0-route-journeys.md +145 -0
  27. package/docs/evals/zcode-automation-2026-08-14.md +103 -0
  28. package/hooks/README.md +27 -4
  29. package/hooks/_common.py +1678 -61
  30. package/hooks/adapters/zcode.py +227 -0
  31. package/hooks/compact_context.py +176 -17
  32. package/hooks/mid_workflow_recall.py +27 -5
  33. package/hooks/post_edit_guard.py +133 -23
  34. package/hooks/session_context.py +707 -22
  35. package/package.json +7 -3
  36. package/skills/ultra-change/SKILL.md +69 -12
  37. package/skills/ultra-change/references/change-contract.md +93 -27
  38. package/skills/ultra-change/references/execution-grant.md +109 -0
  39. package/skills/ultra-change/references/primary-transfer.md +273 -0
  40. package/skills/ultra-change/scripts/validate_primary_transfer.cjs +1928 -0
  41. package/skills/ultra-delegate/SKILL.md +103 -8
  42. package/skills/ultra-delegate/patches/zcode-acp-0.1.0-zcode-0.16.5.patch +184 -0
  43. package/skills/ultra-delegate/references/delegation-contract.md +80 -1
  44. package/skills/ultra-delegate/scripts/acp-conformance.cjs +287 -0
  45. package/skills/ultra-delegate/scripts/acp-driver.cjs +762 -0
  46. package/skills/ultra-delegate/scripts/agent-execution-driver.cjs +320 -0
  47. package/skills/ultra-delegate/scripts/cli-driver.cjs +61 -0
  48. package/skills/ultra-delegate/scripts/delegate-worker.cjs +328 -0
  49. package/skills/ultra-delegate/scripts/delegate.cjs +690 -0
  50. package/skills/ultra-delegate/scripts/host-profile.cjs +267 -0
  51. package/skills/ultra-deliver/SKILL.md +98 -11
  52. package/skills/ultra-dev/SKILL.md +188 -42
  53. package/skills/ultra-grilling/SKILL.md +10 -7
  54. package/skills/ultra-grilling/references/reframing.md +7 -3
  55. package/skills/ultra-init/SKILL.md +56 -7
  56. package/skills/ultra-init/scripts/init_project.cjs +968 -21
  57. package/skills/ultra-plan/SKILL.md +91 -47
  58. package/skills/ultra-plan/references/task-evidence-v2.md +300 -0
  59. package/skills/ultra-plan/scripts/validate_task_evidence.cjs +859 -0
  60. package/skills/ultra-research/SKILL.md +70 -14
  61. package/skills/ultra-research/references/04-product-strategy.md +11 -2
  62. package/skills/ultra-research/references/21-features-scope.md +8 -0
  63. package/skills/ultra-research/references/22-success-metrics.md +4 -3
  64. package/skills/ultra-research/references/99-synthesis.md +19 -2
  65. package/skills/ultra-research/references/north-star-v2.md +168 -0
  66. package/skills/ultra-research/references/wayfinding.md +8 -0
  67. package/skills/ultra-research/scripts/validate_north_star.cjs +1174 -0
  68. package/skills/ultra-review/SKILL.md +201 -27
  69. package/skills/ultra-review/references/adversarial-evaluation.md +31 -0
  70. package/skills/ultra-review/references/spec.md +5 -0
  71. package/skills/ultra-review/references/unified-schema.md +146 -11
  72. package/skills/ultra-review/references/worker-packet.md +151 -8
  73. package/skills/ultra-review/scripts/review_wait.py +2653 -63
  74. package/skills/ultra-status/SKILL.md +129 -15
  75. package/skills/ultra-status/references/route-contract.md +100 -0
  76. package/skills/ultra-tdd/SKILL.md +11 -4
  77. package/skills/ultra-tdd/references/test-execution.md +6 -1
  78. package/skills/ultra-test/SKILL.md +161 -18
  79. package/skills/ultra-test/scripts/validate_review_transport.cjs +549 -0
  80. package/skills/ultra-test/scripts/worktree_digest.cjs +518 -30
  81. /package/{adapters/_shared → skills/ultra-delegate/scripts}/delegate-profiles/kimi-read-only.md +0 -0
  82. /package/{adapters/_shared → skills/ultra-delegate/scripts}/delegate-profiles/kimi-write.md +0 -0
@@ -7,26 +7,93 @@ description: Carry one planned task from a written implementation plan through r
7
7
 
8
8
  The model owns code reasoning and edits; repository files own the resumable contract.
9
9
 
10
+ ## Route modes
11
+
12
+ | Mode | Entry | Observable exit | Next |
13
+ |---|---|---|---|
14
+ | `execute` | Explicit task id or a valid Execution Grant covering one dependency-ready pending task | The named task has current acceptance evidence, final task review, completion context, and a read-back `completed` ledger row | Recommend the next exact `ultra-dev/execute` task or `ultra-test/audit` |
15
+ | `resume` | Explicit task id or a valid Execution Grant covering the unique in-progress task | Existing work is reconciled from Git, context, and Resume Note, then reaches the same completion evidence or a typed stop | Recommend the next exact task, `ultra-test/audit`, or the responsible repair route |
16
+ | `reopen` | Explicit task id or a valid Execution Grant after current evidence invalidates a completed task | The invalidated criteria are refreshed through a new review and the task is completed again, or the remaining gate is named | Recommend the next exact task or `ultra-test/reaudit` |
17
+
18
+ Follow `../ultra-status/references/route-contract.md`. Show a Route Card before the
19
+ first implementation edit, at material checkpoints or unavailable evidence, and after
20
+ the ledger readback. When context pressure threatens reliable continuation, finish the
21
+ nearest safe write, refresh the Resume Note, and recommend a fresh session rather than
22
+ pretending the task is still making invisible progress.
23
+
10
24
  ## Before you start
11
25
 
12
- 1. Resolve exactly one active `change_id`; more than one is a repository conflict. Read
13
- `.ultra/tasks.json`, choose one matching `in_progress` or dependency-ready task, then read
14
- its full `context_file`, especially `## Resume Note`.
15
- 2. Read `CONTEXT.md` for vocabulary, and the `.ultra/decisions/` entries the task
26
+ 1. If model-selected, verify the live execution grant in `../ultra-change/references/execution-grant.md` — a current session-local activation or a stably verified durable work-package grant; without either, stop.
27
+ 2. Read `../ultra-change/references/change-contract.md` and apply its **Active Change
28
+ authority resolution** before reading any active `intent.md` or resolving a current
29
+ `change_id`. Require its one valid authority; otherwise stop with its typed repair.
30
+ Then read `.ultra/tasks.json`. Without an exact task id in the owner invocation,
31
+ select only the uniquely current `in_progress` task and read its full
32
+ `context_file`, especially `## Resume Note`; if none exists, stop and ask
33
+ the owner to invoke Dev naming one exact task id — a `pending` row is a frontier
34
+ candidate, not active work, and Hooks will not have injected its acceptance or
35
+ Resume. An invocation that names one exact task id supplies invocation-local
36
+ selection authority for this Dev run only. If more than one row claims
37
+ `in_progress`, do not manufacture a unique current task; use the explicit recovery
38
+ below or stop with the Hook diagnostic. The ledger is the sole task-status authority;
39
+ legacy Status or Complexity never overrides it. A `completed` task with a current
40
+ invalidation observation may be selected only for the explicit reopen below; record
41
+ and read back that transition before repair.
42
+ 3. Read `CONTEXT.md` for vocabulary, and the `.ultra/decisions/` entries the task
16
43
  context names.
17
- 3. Read `.ultra/north-star.md` and the task's acceptance criteria. If you cannot
18
- state that acceptance in one sentence, you are not ready to start.
44
+ 4. Validate `.ultra/north-star.md` with the shipped Research structural sensor. Resolve
45
+ every listed `FP-*`, `NS-*`, and `HC-*` in the task and active Change against that
46
+ accepted authority. Compare the active Change's recorded **North Star revision** and
47
+ **North Star digest** with the accepted file's revision and current Git blob digest.
48
+ A missing ID, revision mismatch, or digest mismatch is a stale-plan observation: stop
49
+ before editing and recommend explicit owner invocation of `ultra-change` to reconcile
50
+ the active Change. Never inherit approval or silently rewrite the trace.
51
+ 5. Read the task's acceptance criteria. If you cannot state that acceptance in one
52
+ sentence, you are not ready to start.
53
+
54
+ ### Activating one named pending task
55
+
56
+ When the owner invocation names a dependency-ready `pending` task, perform its
57
+ canonical activation before any implementation work: write that row from
58
+ `pending` to `in_progress` in `.ultra/tasks.json` and read the row back before
59
+ the first implementation edit. This one canonical ledger write is what makes
60
+ the named task live for the task-aware Hooks; without it Hooks correctly remain
61
+ task-silent while you edit, because a trusted invocation is visible only to the
62
+ invocation that carried it. The activation adds no selector, activation flag,
63
+ or workflow state — the ledger row is the only authority — and it must respect
64
+ the single-writer boundary: resolve any conflicting `in_progress` rows through
65
+ the recovery below or an owner decision before writing.
66
+
67
+ ### Recover one exact task from an ambiguous ledger
68
+
69
+ An explicit owner invocation with one exact task id supplies invocation-local selection
70
+ authority for this Dev run even when multiple ledger rows claim `in_progress`. Before
71
+ editing, read that exact canonical ledger row and context, especially its Resume Note,
72
+ then inspect current Git/worktree evidence for the named task. Do not persist a new
73
+ current-task selector, status, or workflow state to manufacture uniqueness. Hooks remain
74
+ task-silent and progress-silent while the ledger is ambiguous.
75
+
76
+ Only an explicit owner/Plan correction that establishes a conflicting task never started
77
+ may return that row to `pending`. If multiple tasks contain real partial work, keep every
78
+ task with real partial work `in_progress` and preserve each task's bytes. Recover them by
79
+ separate exact task-id owner invocations or obtain owner-authorized Plan reconciliation;
80
+ use a separate worktree when needed to keep their writes isolated. Completing the
81
+ selected task still requires final review, canonical v2 evidence, context publication,
82
+ ledger write, and readback.
19
83
 
20
84
  When this task starts from an observed error, failing check or unexpected behavior,
21
85
  read `references/debugging.md` and establish the earliest incorrect state before editing.
22
86
 
23
87
  ## Definition of done
24
88
 
25
- - All six evidence dimensions answer the checkable rules below.
26
- - `tasks.json` and context status agree after write/read-back.
89
+ - All six evidence dimensions carry honest, current observations under the typed v2
90
+ evidence contract; a real limitation remains a gap rather than becoming a pass.
91
+ - `.ultra/tasks.json` remains the sole task-status authority after write/read-back.
27
92
  - The task still names the active `change_id`; historical unfinished work stays out.
28
93
  - The context file carries a Completion entry and a rewritten Resume Note.
29
- - A task-level review has run and its blocking findings are resolved.
94
+ - A task-level review runs while the ledger task remains `in_progress`; its blocking
95
+ findings are resolved or owner-dispositioned as required and affected evidence is
96
+ refreshed before the model writes `completed` to the ledger.
30
97
 
31
98
  ## Write the implementation plan before the code
32
99
 
@@ -38,30 +105,54 @@ buries the design decisions in the details.
38
105
  ## Develop through red then green
39
106
 
40
107
  Follow `../ultra-tdd/SKILL.md`, writing tests only on the seams the plan already
41
- confirmed, one slice at a time. Do no refactoring here — `ultra-review` owns it,
42
- because what is worth restructuring only becomes visible after several slices.
108
+ confirmed, one slice at a time. `ultra-review` owns evidence-backed refactoring when
109
+ observed duplication, coupling, or a boundary defect justifies it; a slice count does
110
+ not make that decision.
43
111
 
44
112
  ## Converge on the task-scoped acceptance set
45
113
 
46
- Development ends when the task's acceptance commands pass, not when the code looks
114
+ Development ends when every task-scoped criterion has its required current evidence and
115
+ responsible semantic disposition, not merely when commands pass or the code looks
47
116
  finished. Resolve the context's **Change Acceptance IDs** against the active `intent.md`
48
- for `<change_id>`
49
- and use each named row's executable `Verification`. Commands under the context's
50
- Acceptance Criteria may add task-local checks; they do not replace the Change mapping.
117
+ for `<change_id>`. For each named row consume its exact `Verification type` and
118
+ `Required evidence`. When one outcome needs more than one authority, split it into
119
+ independent criteria with unique IDs and preserve each authority separately; every row
120
+ has exactly one verification type. Task-local acceptance may add evidence requirements,
121
+ but it does not replace or narrow the Change mapping.
122
+
123
+ Handle the four verification types without converting one authority into another:
124
+
125
+ - Execute only `command` observations. Record the exact command, working directory,
126
+ exit status, retained raw output reference, and its exact SHA-256.
127
+ - For `inspection`, cite the exact source and revision or digest, then refresh the
128
+ observation after any touched source changes.
129
+ - For `owner-judgment`, preserve the cited owner decision. The owner alone supplies its
130
+ semantic result; a model statement, validator, score, or command cannot proxy it.
131
+ - For `external-observation`, preserve the provider or system receipt without proxying it
132
+ with a local command, model claim, or synthetic fixture, and bind its exact bytes by
133
+ SHA-256.
51
134
 
52
- Run one baseline before repairing anything. Track the best-ever passing set of mapped
53
- IDs and task-local commands, the total repair rounds, and consecutive rounds that add
54
- nothing to that set. The loop has three explicit exits:
135
+ - Missing `owner-judgment` stops at its named owner gate.
136
+ - Missing `external-observation` stops at its named external or authorization gate.
137
+ - If an inspection exists but its semantic implication is unresolved, stop at the
138
+ responsible model or owner gate; a structural citation is not an automatic acceptance
139
+ verdict.
140
+
141
+ Run one baseline before repairing anything. Track a best-ever evidence set keyed by
142
+ criterion, verification type, and source identity to make progress visible, plus the
143
+ current evidence set used for convergence. Stale or regressed evidence remains history
144
+ but cannot satisfy the current set. Do not infer semantic progress or failure from a
145
+ round count. The loop has three explicit exits:
55
146
 
56
147
  | Exit | Condition | Action |
57
148
  |---|---|---|
58
- | Converged | Every mapped Change verification and task-local command exits zero | Close out below |
59
- | Stalled | Two consecutive repair rounds add no new item to the best-ever passing set, or three repair rounds finish without convergence | Stop; report the remaining criteria and what each repair tried |
60
- | Unreachable | A command did not start because its executable, fixture, service or declared environment prerequisite is unavailable | Stop that criterion; report the missing prerequisite and its repair path |
149
+ | Converged | Every mapped and task-local criterion has current required evidence of every named type, and the responsible model or owner has made any semantic disposition | Close out below |
150
+ | Stalled | An in-scope repair yields no new or refreshed evidence and no further evidence-producing repair is justified inside the approved task | Stop; report the missing evidence, the attempted repair, and the responsible next gate |
151
+ | Unreachable | Required evidence cannot be observed because an executable, fixture, provider, service, declared environment prerequisite, or required authorization is unavailable | Stop that criterion; report the unavailable prerequisite or gate and its reachable repair path |
61
152
 
62
- A nonzero exit normally means a failing criterion, not an unreachable one; inspect its
63
- output. A regression never shrinks the best-ever set, and the total round limit stops
64
- oscillation where different criteria alternate between pass and fail.
153
+ A nonzero command exit is an observation, not automatically `Unreachable`; inspect its
154
+ output and repair within scope when justified. None of these exits mechanically decides
155
+ semantic sufficiency, owner acceptance, or external truth.
65
156
 
66
157
  ## Answer the six evidence dimensions
67
158
 
@@ -76,14 +167,15 @@ Each has a rule you can check against the work rather than assert:
76
167
  | `vertical_slice` | One test's execution path runs from the entry point through to persistence |
77
168
  | `spec_trace` | The anchor the task's `trace_to` names exists in the specification |
78
169
 
79
- Record one canonical `.ultra/evidence/<task-id>/evidence.json` with
80
- `$schema: "ultra-task-evidence-v1"`, `task_id`, `git_head`, `commands`, the six-key
81
- `dimensions` object, `artifacts`, `limitations`, and `timestamp`. Raw logs and cited
82
- files stay beside it; no second summary restates the same evidence. Each command has
83
- `command`, `exit_code`, and `evidence_ref`. Each dimension has `status` (`satisfied`,
84
- `gap`, or `not_applicable`), `evidence_refs`, and a non-empty `rationale`. Evidence is a
85
- sensor, not a gate: a gap is reported and handed over, never used to block the work — a
86
- gate that can be escaped by damaging the work gets escaped by damaging the work.
170
+ Before task review, retain the actual criterion evidence, raw logs, owner records,
171
+ external receipts, and cited artifacts without inventing another completion record.
172
+ Do not write `evidence.json` before the task's validated final `SUMMARY.json` exists.
173
+ The review packet admits those actual pre-review observations together with the ledger,
174
+ context acceptance, and packet-defined task scope. A structural validator may check
175
+ exact fields, types, digests, paths, and freshness observations. It never supplies an
176
+ acceptance disposition, turns a model claim into command evidence, or decides semantic pass.
177
+ Evidence is a sensor: a gap or legacy v1 record is reported with a migration
178
+ diagnostic, never rewritten as v2 truth.
87
179
 
88
180
  ## When implementation and the specification disagree
89
181
 
@@ -95,25 +187,79 @@ classification in the context file's Change Log.
95
187
 
96
188
  ## Close out
97
189
 
98
- Write the status to both places and read both back. Add the Completion entry and
99
- rewrite the Resume Note to say where the next session picks up. Then run the
100
- task-level review through `../ultra-review/SKILL.md`, resolve blocking findings, and refresh
101
- the evidence they touched.
190
+ Keep the ledger row `in_progress` while running task review through
191
+ `../ultra-review/SKILL.md`. Build its immutable packet from the ledger, task context,
192
+ packet-defined task scope, and actual pre-review evidence; the final v2 record is not an
193
+ admission prerequisite. Route only the exact current P0/P1 findings (or a P2 the owner
194
+ explicitly promoted) as one in-scope repair set, followed by one affected-lens delta
195
+ review per repair set inside the active review budget — an exact current owner grant
196
+ overrides the versioned product default of one initial review plus at most two
197
+ P0/P1 delta reviews per package. When another `REQUEST_CHANGES` would exceed the
198
+ active budget, return to the owner checkpoint with the exact blocking set instead of
199
+ an automatic repair; the same root surviving three failed fixes stops point-patching
200
+ and reports an architecture problem. Budget exhaustion stops execution at `owner checkpoint` /
201
+ `budget_exhausted` and keeps the ledger row `in_progress`.
202
+ It never yields `APPROVE`, `REQUEST_CHANGES`, `INCOMPLETE`, pass, fail, accept, or
203
+ abandon. If a repair changes implementation or evidence in review scope, use a new
204
+ immutable packet and validated review summary before closeout rather than rebinding the
205
+ old review. Worker Packet v1 and its summary do not bind a task worktree digest.
206
+
207
+ After the final validated `SUMMARY.json`, write one canonical `ultra-task-evidence-v2` record only after completing the raw-receipt binding below.
208
+ When the task's owner-designated review mode is external manual, the final review
209
+ product is instead the external reviewer's real receipt, bound through the
210
+ `review_mode: "external-manual"` branch of
211
+ `../ultra-plan/references/task-evidence-v2.md`: publish that receipt under
212
+ `.ultra/evidence/<task-id>/`, record its exact stable-byte SHA-256, and verify it
213
+ with the sensor's `--verify-external-receipt` mode instead of inventing a strict
214
+ session. Never fabricate one branch's artifacts to satisfy the other's shape.
215
+ The `subject` is an independently captured completion-snapshot freshness observation.
216
+ Before writing `evidence.json`, resolve every
217
+ command and external-observation `raw_evidence_ref` below the real repository root and
218
+ take bounded stable repository-contained bytes from an ordinary regular non-symlink file
219
+ opened nonblocking and no-follow. Reject a missing, escaped, symlinked, special,
220
+ oversized, or replaced file; otherwise compute `raw_evidence_sha256` from that one byte
221
+ snapshot. Publish that canonical record at `.ultra/evidence/<task-id>/evidence.json`,
222
+ read back the stable record and each raw ref,
223
+ and require the same ref bytes and digest before continuing.
224
+ Follow `../ultra-plan/references/task-evidence-v2.md`: `task_review` separately binds the retained strict summary; record one typed acceptance entry per criterion, all
225
+ six dimensions, the exact Execution Packet and review identities, blocking-finding
226
+ dispositions, evidence refresh refs, artifacts, limitations, and retention without
227
+ claiming that the review summary proves `subject.worktree_digest`. Read the record back, then update context
228
+ `## Task Review`, Completion, and `## Resume Note`; the context has no second status.
229
+ Only after those facts are durable may the primary model write `completed` to the
230
+ ledger and read the row back. When the task's work package sits under an
231
+ ACK-ready primary transfer whose newest terminal receipt is a completed v2
232
+ RESULT, this sequence is that contract's prescribed closeout: publish the
233
+ handoff's `CLOSEOUT.json` beside the frozen RESULT — citing the review receipt,
234
+ the closeout-start/end observations, and any recorded owner-authorized
235
+ continuation — instead of refreshing the RESULT or opening a new handoff; the
236
+ closeout starts no review and no repair round
237
+ (`../ultra-change/references/primary-transfer.md`).
238
+
239
+ If later work invalidates a completed task's criterion evidence, Dev performs an
240
+ explicit reopen. A reopen changes the ledger row from `completed` to `in_progress`;
241
+ Dev must never silently demote the row. Before that write, record the affected criterion IDs and reason in both the context Change Log and Resume Note, preserve the prior review as
242
+ historical evidence, then write and read back the ledger transition. Refresh the named
243
+ evidence, run task review for the new snapshot, and repeat this closeout sequence.
102
244
 
103
245
  Report the changed paths, the seam, the exact checks run, the review result, the
104
- evidence gaps and the residual risk. Recommend the next capability from what the
105
- files now say; do not invoke it.
246
+ evidence gaps and the residual risk. Recommend the next capability from what the files
247
+ now say. Continue only when its exact mode and effects remain inside the valid grant and
248
+ after showing the transition Route Card; otherwise do not invoke it.
106
249
 
107
250
  ## When the owner decides
108
251
 
109
- Any REDUCTION, and each external effect separately.
110
- At most one authorized local task commit happens here; push, tag, publish and
111
- deploy each need their own authorization. An interrupted task leaves its worktree
112
- as it stands and says so in the Resume Note instead of tidying it away.
252
+ The owner decides any REDUCTION and each external effect separately. At most one
253
+ authorized local task commit happens here; push, tag, publish and deploy need separate
254
+ authority. An interruption leaves the worktree as-is and names it in the Resume Note.
113
255
 
114
256
  ## References
115
257
 
258
+ - `../ultra-change/references/change-contract.md` — canonical Active Change authority resolution.
116
259
  - `../ultra-tdd/SKILL.md` — read before the first test, for the seam and mock boundary.
117
260
  - `../ultra-think/references/autonomy-boundary.md` — read when spec and code disagree.
118
261
  - `../ultra-review/SKILL.md` — read when implementation evidence is ready for review.
262
+ - `../ultra-change/references/execution-grant.md` — read only for grant-activated continuation.
263
+ - `../ultra-status/references/route-contract.md` — owner-visible route, checkpoint, and recovery output.
264
+ - `../ultra-plan/references/task-evidence-v2.md` — canonical evidence, disposition, and task-review shape.
119
265
  - `references/debugging.md` — read for a reproduced failure before selecting a repair.
@@ -67,10 +67,11 @@ Order questions so that answering one unlocks the next. Ask the framing question
67
67
  before the detail questions — a detail settled inside the wrong frame has to be
68
68
  asked again.
69
69
 
70
- **Framing questions** come first — at most five, from the table in
71
- `references/reframing.md`. They refuse the owner's framing on purpose, which is
72
- how they surface what the request left out. Stop early once the frame stops
73
- moving.
70
+ **Framing questions** come first, selecting only prompts from
71
+ `references/reframing.md` that can change the current frame. They refuse the owner's
72
+ framing on purpose, which is how they surface what the request left out. Stop once the
73
+ owner confirms the frame or further prompts cannot distinguish a materially different
74
+ build; a question count never decides that.
74
75
 
75
76
  **Detail questions** fill in the confirmed frame:
76
77
 
@@ -100,8 +101,10 @@ the options rejected and the reason they lost. The caller alone chooses the cano
100
101
  destination; Grilling never promotes an answer into project authority by itself.
101
102
 
102
103
  - **Resolved** — every required field answered or explicitly deferred.
103
- - **Stalled** — two consecutive turns add no newly confirmed decision. Hand back
104
- the open fields and what each one blocks.
104
+ - **Stalled** — the evidence shows that another in-scope question cannot produce a new
105
+ decision without unavailable owner input or a newly framed choice. Hand back the open
106
+ fields, the attempted distinctions, and what each one blocks; do not infer this from
107
+ a turn count.
105
108
  - **Unavailable** — the host cannot ask, or the owner stopped answering. Hand back
106
109
  the last confirmed state, every unanswered field named.
107
110
 
@@ -113,6 +116,6 @@ question per turn instead.
113
116
  ## References
114
117
 
115
118
  - `references/reframing.md` — read before the first question: when to reframe,
116
- how it fails, the five framing questions, and what counts as an answer.
119
+ how it fails, the framing prompts, and what counts as an answer.
117
120
  - `../ultra-think/references/autonomy-boundary.md` — read when an answer removes
118
121
  something the specification already promised, or otherwise crosses C5.
@@ -36,13 +36,17 @@ Rules that keep this honest:
36
36
  a constraint you did not have a minute ago. Record it as a decision.
37
37
  - **Never reframe toward what is easier to build.** If your reinterpretation
38
38
  happens to shrink the work, say that out loud and let the owner weigh it.
39
- - **Stop after two rejected reframes.** A third is no longer listening. Take the
40
- owner's framing as given and move to the framing questions below.
39
+ - **Stop when the owner rejects the proposed role and confirms their original frame.**
40
+ Do not keep producing cosmetic reinterpretations. If a materially different reading
41
+ later becomes evidenced, present that new distinction rather than counting prior
42
+ attempts.
41
43
 
42
44
  ## Framing questions
43
45
 
44
46
  These refuse the owner's framing on purpose, which is how they surface what the
45
- request left out. Ask at most five, and stop early once the frame stops moving.
47
+ request left out. Ask only the prompts that can distinguish a materially different
48
+ build, and stop when the owner confirms the frame or the remaining prompts cannot
49
+ change it.
46
50
 
47
51
  | Question | What it recovers |
48
52
  |---|---|
@@ -9,6 +9,17 @@ Initialization establishes places for later authority and records raw owner inta
9
9
  does not validate the problem, establish a North Star, build a product or architecture
10
10
  baseline, settle domain language, choose a Change, or start another public workflow.
11
11
 
12
+ ## Route modes
13
+
14
+ | Mode | Entry | Observable exit | Next |
15
+ |---|---|---|---|
16
+ | `create` | Explicit owner invocation when `.ultra/` is absent | Missing skeleton files and raw Project Brief are published and read back; Git exists | Recommend `ultra-research` in `baseline` mode |
17
+ | `recover` | Explicit owner invocation when the skeleton is partial or uncertain | Missing files are restored, preserved authority is byte-identical, and every unresolved repair is named | Recommend `ultra-research` in `baseline` mode when the brief is usable; otherwise resume `ultra-init/recover` |
18
+
19
+ Follow `../ultra-status/references/route-contract.md`. Derive a Route Card before the
20
+ first write and at the exit or any repair stop. Init never continues into Research on
21
+ its own, and its `Position` reports observed files rather than semantic progress.
22
+
12
23
  ## Before you start
13
24
 
14
25
  1. If `.ultra/changes/active/` exists, resolve at most one active `change_id`. Read
@@ -24,9 +35,10 @@ baseline, settle domain language, choose a Change, or start another public workf
24
35
 
25
36
  - `.ultra/project-brief.md` contains raw owner intake: one line, a broad outline,
26
37
  explicit inputs already supplied, and open questions handed to Research.
27
- - For a new skeleton, an empty North Star and the three specification skeletons exist.
28
- Recovery preserves any populated authority; Init does not fill semantic sections or
29
- create `CONTEXT.md`.
38
+ - For a new skeleton, a structurally complete North Star v2 with status `unresearched`
39
+ and the three specification skeletons exist. Init does not populate `FP-*`, `NS-*`,
40
+ or `HC-*`; recovery preserves any populated authority, and Init does not create
41
+ `CONTEXT.md`.
30
42
  - Every packaged path was read back after copying, while every pre-existing file stayed
31
43
  byte-identical.
32
44
  - `.git` exists. Commit, push, remote creation, and publication remain separate effects.
@@ -59,12 +71,44 @@ unless evidence conflicts with it.
59
71
 
60
72
  Resolve this loaded Skill's directory, then run
61
73
  `node <ultra-init-skill-dir>/scripts/init_project.cjs --project <repository-root>`.
62
- The script copies only missing files from `assets/project-template`, preserves every
63
- existing file, and reads the complete result back.
74
+ The script stages and reads back only missing files from `assets/project-template`,
75
+ validates the staged North Star from its raw bytes, and then publishes a complete new
76
+ `.ultra/` by atomic rename. Partial recovery publishes each staged file atomically
77
+ without clobbering a concurrent or existing path. A validation or publication failure
78
+ removes a published path only while its current stable identity and digest still match
79
+ this invocation's recorded publication. A workspace edit is preserved and returns the
80
+ typed retryable `initialization_snapshot_changed` diagnostic. Init binds every preserved
81
+ file to one nonblocking, no-follow descriptor/path identity and SHA-256 digest, then
82
+ rechecks all of them before staging, before publication, and before success. It likewise
83
+ captures every staged digest before publication and compares it with a stable target
84
+ snapshot before success. Each file publication takes fresh no-symlink parent-chain and
85
+ resolved-root identity snapshots before and after the effect; detectable directory drift
86
+ stops publication. A failed snapshot `lstat`, `open`, `fstat`, or `read` with no observed
87
+ identity, type, size, or digest change instead returns the typed retryable
88
+ `initialization_snapshot_io_error`; its sanitized `operation`, symbolic `errno`, and
89
+ actionable permission, descriptor-limit, or storage recovery remain in the
90
+ `ultra-init-error-v1` result. The North Star compatibility diagnostic remains
91
+ `preserved_north_star_changed`. A malformed packaged placeholder stops before publication
92
+ with an `ultra-init-error-v1` payload whose `code` is `north_star_template_invalid` and
93
+ whose `diagnostics` preserve the canonical validator entries, including
94
+ `invalid_unresearched_placeholder` for an exact-byte mismatch.
95
+
96
+ This recovery contract assumes a cooperative local workspace. It detects observable
97
+ path-identity or byte drift and preserves the current bytes for retry; it does not claim
98
+ that Node filesystem calls can defeat a malicious operating-system-level replacement.
99
+ Init also binds the root identity of its staging directory. Cleanup recursively removes
100
+ that path only after a fresh no-symlink root rewalk proves the same device and inode. If
101
+ the path was replaced, Init leaves it untouched and returns the retryable typed
102
+ `initialization_cleanup_conflict` diagnostic with the owned identity and manual recovery
103
+ instruction. If a typed initialization failure is already pending, that primary
104
+ diagnostic remains the top-level `ultra-init-error-v1` result and the cleanup diagnostic
105
+ is retained under `cleanup_conflict`, including its identity-bound manual recovery.
106
+ On success every existing file stayed byte-identical and every new file matches its
107
+ packaged digest.
64
108
 
65
109
  ```text
66
110
  .ultra/project-brief.md raw intake and initial outline
67
- .ultra/north-star.md empty Research-owned steering contract
111
+ .ultra/north-star.md unresearched Research-owned placeholder
68
112
  .ultra/specs/{product,architecture,discovery}.md empty specification skeletons
69
113
  .ultra/specs/research-distillate.md empty Research synthesis skeleton
70
114
  .ultra/{tasks.json,test-report.json} empty or not-yet-run ledgers
@@ -72,7 +116,11 @@ existing file, and reads the complete result back.
72
116
  .ultra/changes/{active,archive,abandoned}/
73
117
  ```
74
118
 
75
- For a legacy `north-star.md` containing `## One-line`, keep that file byte-identical.
119
+ The script reports `created_unresearched` for a new placeholder. For a preserved file it
120
+ reports exactly `preserved_unresearched`, `preserved_accepted`, `preserved_legacy`, or
121
+ `preserved_unknown`; unknown or malformed content is never described as authority. For
122
+ a legacy `north-star.md` containing the actual v0.26 headings or the older `## One-line`
123
+ form, keep that file byte-identical.
76
124
  When the new Project Brief is still unresolved, copy the legacy one-line verbatim into
77
125
  it and list legacy hard constraints under Explicit Inputs without assigning new IDs.
78
126
  Research later proposes the accepted North Star; it never rewrites history silently.
@@ -91,4 +139,5 @@ usable brief exists, but do not invoke it.
91
139
 
92
140
  - `../ultra-grilling/SKILL.md` — read before the first missing brief field.
93
141
  - `references/brownfield-adoption.md` — read when maintained behavior already exists.
142
+ - `../ultra-status/references/route-contract.md` — owner-visible route, checkpoint, and recovery output.
94
143
  - `../ultra-think/references/autonomy-boundary.md` — read before replacing authority.