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
@@ -9,20 +9,56 @@ This router is read-only. It separates verified files, model inference, and unav
9
9
  evidence, then recommends one explicit public capability without invoking it. It never
10
10
  persists a workflow-position field.
11
11
 
12
+ ## Route modes
13
+
14
+ | Mode | Entry | Observable exit | Next |
15
+ |---|---|---|---|
16
+ | `route` | Owner asks what is current or what to do next | One artifact-derived Route Card names the matched facts, unavailable evidence, and one recommended route | The named explicit route, or `idle` |
17
+ | `history` | Owner asks what changed, was rejected, or was superseded | Relevant decisions, Git revisions, archived/abandoned Changes, and unresolved contradictions are summarized without becoming authority | Return to `route` or the owner-selected revision route |
18
+ | `installation` | Owner asks whether Ultra is discovered and healthy on a Host | Installed version, provenance, Skill/hook discovery, drift, and reachable repair are reported read-only | Recommend the exact install/update/Doctor repair |
19
+ | `delegation` | Owner asks about a worker, handoff, ACP/CLI event, or terminal result | Transport observations and canonical authority are shown separately with a retry/cancel/integration path | Return to the requesting primary route |
20
+ | `recovery` | Authority is absent, ambiguous, stale, malformed, or temporarily unreadable | The earliest unsafe or unavailable fact and cheapest safe repair, retry, cancel, abandon, or fresh-session path are named | Recommend only the repair-capable explicit route |
21
+
22
+ Follow `references/route-contract.md` and use its `UBP Route Card` as the default output,
23
+ not an optional appendix. Expand history, installation, delegation, or recovery details
24
+ only when requested or needed to explain why the normal route is unavailable. Status is
25
+ a `router`: the Owner invokes it for read-only diagnosis, its Host implicit bit remains
26
+ off, and it supplies no continuation authority. Other public Skills derive their own
27
+ cards from the shared reference rather than invoking Status.
28
+
12
29
  ## Before you start
13
30
 
14
- 1. List directories containing `.ultra/changes/active/*/intent.md`. If exactly one
15
- exists, its directory name is the current `change_id`. Read `.ultra/tasks.json`,
16
- then tasks whose `change_id` matches it and the frontier task's `context_file` and
17
- `## Resume Note`. Historical and abandoned tasks never define the frontier.
18
- 2. Read `.ultra/project-brief.md`, `.ultra/north-star.md`, `CONTEXT.md`, relevant
19
- `.ultra/decisions/`, specifications, active, archived, or abandoned Changes, and
20
- evidence. An abandoned Change supplies historical boundary and recovery context;
21
- it never defines the current route.
31
+ 1. Read `../ultra-change/references/change-contract.md` and apply its **Active Change
32
+ authority resolution** before reading any active `intent.md` or relying on a current
33
+ `change_id`. A positively observed absent `.ultra` uses the existing `ultra-init`
34
+ route. Otherwise continue only from the rule's stable zero-or-one result. A typed
35
+ diagnostic stops semantic routing from an ambiguous active Change, but it does not
36
+ stop Status: switch to `recovery` mode and report the diagnostic plus safe Git and
37
+ directory observations without reading any ambiguous `intent.md` as authority. With
38
+ one valid active Change, read `.ultra/tasks.json`, then tasks whose `change_id` matches it and the
39
+ frontier task's `context_file` and `## Resume Note`. `.ultra/tasks.json` is the sole
40
+ task-status authority. A Status or Complexity header in a legacy context is a
41
+ migration diagnostic; the ledger wins. Historical and abandoned tasks never define
42
+ the frontier.
43
+ 2. After stable authority resolution, read `.ultra/project-brief.md`,
44
+ `.ultra/north-star.md`, `CONTEXT.md`, relevant `.ultra/decisions/`, specifications,
45
+ active, archived, or abandoned Changes, and evidence. In `recovery` mode, read only
46
+ unaffected canonical files and safe directory/Git observations; do not interpret an
47
+ ambiguous active intent. An abandoned Change supplies historical boundary and
48
+ recovery context; it never defines the current route.
22
49
  3. Inspect Git `HEAD`, worktree status, and installed host manifests without repair.
50
+ 4. When the active Change records a `durable work-package` Execution Grant, report it
51
+ as recorded authorization data — grant id, cited decision, and its recorded
52
+ subject, scope, topology, allowed effects, budgets, and invalidation — and state
53
+ plainly that stored grant text is inactive until a consuming Agent stably
54
+ verifies it per `../ultra-change/references/execution-grant.md`. Status itself
55
+ neither activates nor continues the grant; a `session-local` grant is reported as
56
+ requiring fresh owner activation.
23
57
 
24
58
  ## Definition of done
25
59
 
60
+ - Emit the current Route Card with an exact mode, observable exit, unfinished work, and
61
+ one next route or safe recovery path.
26
62
  - Evaluate the artifact route in order and name the evidence supporting the match.
27
63
  - Keep stale test evidence, dirty worktree state, baseline gaps, and task graph risks
28
64
  visible without converting them into semantic failure.
@@ -35,15 +71,21 @@ persists a workflow-position field.
35
71
  |---|---|
36
72
  | No `.ultra/` | `ultra-init` |
37
73
  | Project Brief has no usable one-line and no legacy `## One-line` exists | `ultra-init` |
38
- | Project Brief or legacy seed exists but no accepted North Star supports the current boundary | `ultra-research` |
74
+ | Project Brief or legacy seed exists and North Star status is `unresearched`, legacy, invalid, or not accepted for the current boundary | `ultra-research` |
39
75
  | A new request exists and no active Change exists | `ultra-change` |
40
76
  | More than one active Change exists | Diagnose the conflicting directories and ask the owner which one remains active; do not route or move either automatically |
77
+ | A primary-transfer handoff directory exists under `.ultra/.runtime/handoffs/` | Report its protocol state read-only (`offered`, `blocked`, `active`, or a terminal state) from `OFFER.json`/`ACK.json`/`RESULT.json`, verified with `node <ultra-change-skill-dir>/scripts/validate_primary_transfer.cjs <repository-root>`; receipts are derived observations, never authority |
78
+ | An ACK-ready handoff has no terminal RESULT | The accepted receiver is the sole canonical writer for that work package; report the in-flight transfer and never route canonical writes to another Agent |
79
+ | A handoff is `blocked` or its live re-verification is stale | Report the mismatched observation and the recovery path (fresh handoff id after owner re-confirmation); do not repair receipts |
41
80
  | The active intent is `draft` or has a blocking unresolved decision | `ultra-change` to finish and accept the contract |
42
81
  | The active `Research Disposition` names required exit evidence that is not satisfied | `ultra-research` for the named question and selected lenses |
43
82
  | Research evidence exists but the accepted intent has not reconciled it | `ultra-change` to update the bounded contract |
83
+ | The accepted North Star revision or digest differs from the active intent trace | `ultra-change`; report the stale observation, preserve old evidence, and reconcile IDs before execution |
44
84
  | An active Change exists and `.ultra/tasks.json` has no tasks whose `change_id` matches it | `ultra-plan` |
45
- | A matching task is pending or in progress with same-Change dependencies satisfied | `ultra-dev`, naming that task |
46
- | All matching tasks are completed and no current report matches this Change | `ultra-test` |
85
+ | The Change has exactly one `in_progress` task | `ultra-dev`, naming that task |
86
+ | Only `pending` tasks remain (the frontier) | Report them as frontier candidates with their unresolved dependencies and recommend one exact task id for an explicit owner invocation of `ultra-dev`; a pending row is not active work and never auto-selects a route |
87
+ | A ledger row says `completed` but its current `ultra-task-evidence-v2` record or task-review binding is missing, stale, or structurally invalid | `ultra-dev` to repair evidence and completion provenance; do not infer a context status or silently demote the row |
88
+ | All matching tasks are completed, each has current `ultra-task-evidence-v2` plus a consumed task review, and no current report matches this Change | `ultra-test` |
47
89
  | A current false report has implementation, test, or wiring findings selected for repair | `ultra-dev` after owner disposition |
48
90
  | A current false report has missing external or product evidence selected for collection | `ultra-research` after owner disposition |
49
91
  | A current false report has an acceptance, scope, or existing-promise change selected for reconciliation | `ultra-change` after owner disposition; use `ultra-think` internally for one consequential trade-off |
@@ -61,22 +103,92 @@ differs from `HEAD`, or its `worktree.diff_digest` or `intent_digest` differs fr
61
103
  running
62
104
  `node <ultra-test-skill-dir>/scripts/worktree_digest.cjs --project <repository-root> --change-id <change_id>`.
63
105
  A dirty worktree is a warning, not evidence of failure.
106
+ The product-worktree digest has one fixed boundary: it excludes `.ultra/evidence/**`,
107
+ whose command and external-observation entries bind raw bytes as
108
+ `raw_evidence_sha256` before stable exact record bytes are bound as `evidence_digest`.
109
+ Status must therefore use the exact ordered `task_evidence` projection and strict receipt
110
+ consumers below for evidence provenance; it never adds another exclusion or treats
111
+ excluded publication bytes as absent evidence.
112
+
113
+ Freshness also requires the exact ordered `task_evidence` projection. Its
114
+ `evidence_digest`, `task_review_session`, and `task_review_summary_digest` must match the
115
+ current record and retained review — or, for an `external-manual` record, its
116
+ `task_review_receipt_ref` and `task_review_receipt_digest` must match the current
117
+ record and the bounded stable receipt bytes reverified through the sensor's
118
+ `--verify-external-receipt` mode, and take its `--projection` output verbatim.
119
+ Recheck whichever branch the record declares and never rewrite one branch into the
120
+ other. For each item, take every command and
121
+ external-observation `raw_evidence_ref` to bounded stable
122
+ repository-contained bytes from an ordinary regular non-symlink file opened nonblocking
123
+ and no-follow, with an 8 MiB ceiling and path/descriptor identity checks around the read.
124
+ Recompute `raw_evidence_sha256` from that one snapshot and require an exact match, then
125
+ recompute the stable exact `evidence.json` bytes as `evidence_digest` before comparing
126
+ the projection. A raw or record mismatch routes to the owning task's explicit Dev repair.
127
+ Run
128
+ `node <ultra-plan-skill-dir>/scripts/validate_task_evidence.cjs <evidence-ref>`, and
129
+ compare `task_id`, `schema`, `evidence_ref`, `task_review_session`, and
130
+ `task_review_summary_digest` with the current ledger row, final evidence record, and
131
+ retained strict task-review summary. The task evidence `subject` is an independently
132
+ captured completion-snapshot freshness observation made after validated task Review and
133
+ immediately before evidence publication. Its `task_review` separately binds the retained strict summary; neither Worker Packet v1 nor its nullable summary worktree digest proves
134
+ the subject. Do not require that earlier observation to equal the report's later
135
+ aggregate worktree digest. Recheck current Acceptance, criterion and verification type,
136
+ owner record, review summary, and cited affected artifacts independently.
137
+
138
+ Replay the report's strict aggregate review summary with the existing Review summary
139
+ waiter, then run
140
+ `node <ultra-test-skill-dir>/scripts/validate_review_transport.cjs --summary <summary-path> --report .ultra/test-report.json`.
141
+ Require the exact `packet_digest`, `admission_digest`, `subject_digest`, and `summary_digest` bindings, plus session, summary path, execution mode, ordered findings, and report root subject.
142
+ Each structural validator or sensor reports identity and provenance observations and never decides semantic acceptance, review quality, or `passed`.
143
+ Any mismatch makes the report stale and routes repair to the responsible workflow.
64
144
 
65
145
  `passed: false` does not itself select a repair. Preserve each finding, ask for owner
66
146
  disposition where scope or risk changes, then route by the accepted response above.
67
- Likewise, task completion is necessary for `passed: true` but never sufficient to
68
- manufacture it.
147
+ For a current task-review `REQUEST_CHANGES`, consume the exact validated current
148
+ `SUMMARY.json.findings` array and preserve every finding id. Route every current P0/P1
149
+ to resolution or authoritative disposition and refresh its affected evidence; never
150
+ reuse a finding count or list from an older summary. P2 and P3 findings remain report
151
+ entries or owner-selected backlog and never re-open a task on their own.
152
+ Likewise, ledger completion and structurally valid v2 evidence are necessary for a
153
+ current Test claim but never sufficient to manufacture `passed: true`. A validator
154
+ reports schema, identity, provenance, and freshness observations only. It cannot decide
155
+ whether an inspection supports a criterion, supply an `owner-judgment`, or turn an
156
+ external receipt into product truth.
157
+
158
+ Status remains read-only when later work invalidates a completed task. It names the
159
+ affected criterion IDs and reason and recommends Dev. Dev records both in the context
160
+ Change Log and Resume Note before the ledger-authoritative `completed` to `in_progress`
161
+ transition; Status never silently demotes a task.
162
+
163
+ A budget stop or `owner checkpoint` is displayed as-is: report the exhausted budget,
164
+ the in-progress task it stopped, and the reachable owner decision (extend, retry,
165
+ cancel, or abandon). Status never infers continuation, extension, or any semantic
166
+ verdict from a budget stop, and never treats a pending frontier row as the active
167
+ task behind one.
69
168
 
70
169
  The repository has one primary writer for canonical `.ultra` files. Native review
71
170
  workers and delegated CLIs may inspect or write isolated source roots, but their results
72
171
  return to that writer. Concurrent canonical writes require separate worktrees and
73
172
  explicit integration; this router does not invent locks or silently merge ledgers.
74
173
 
174
+ Report the accepted North Star revision and digest, every active Change trace mismatch,
175
+ and unresolved `FP-*`/`NS-*`/`HC-*` reference. A mismatch is stale evidence, never a
176
+ mechanical verdict about truth or permission; supersession does not delete prior task,
177
+ review, Test, or delivery evidence.
178
+
179
+ On a fresh session, use the current Change's exact matching contexts and closing Resume
180
+ Note to reconstruct the card. Do not rerun completed Research or infer route from chat
181
+ memory. In `history` mode, distinguish mutable draft edits from superseding accepted
182
+ decision records and keep rejected or abandoned alternatives visible when they explain
183
+ the current boundary.
184
+
75
185
  ## Surface risk and installation health
76
186
 
77
187
  List unmet task dependencies, more than one matching `in_progress` task under the
78
- single-writer contract, any `in_progress` task older than 3 days, complexity
79
- concentration, and broken `trace_to` or `context_file` paths. These are sensors.
188
+ single-writer contract, broken `trace_to` or `context_file` paths, stale subject or
189
+ acceptance identities, unresolved task-review findings, and concrete evidence that a
190
+ task can no longer resume reliably. A timestamp, complexity value, file count, or task
191
+ count is context for the model, never a staleness or quality verdict.
80
192
 
81
193
  Compare the selected host's plugin path, skill inventory, version, provenance, and hook
82
194
  manifest with installed files. Recommend `ubp install` or `ubp update` as the repair;
@@ -89,6 +201,8 @@ Contradictory facts remain visible instead of being resolved by routing heuristi
89
201
 
90
202
  ## References
91
203
 
204
+ - `../ultra-change/references/change-contract.md` — canonical Active Change authority resolution.
205
+ - `references/route-contract.md` — canonical Route Card, checkpoint, continuation, and recovery contract.
92
206
  - `../ultra-think/SKILL.md` — read only when contradictory evidence creates one real
93
207
  decision rather than a mechanical repair.
94
208
  - `../ultra-think/references/autonomy-boundary.md` — read before recommending a route
@@ -0,0 +1,100 @@
1
+ # Route Contract
2
+
3
+ This reference defines the owner-visible navigation surface shared by every public
4
+ Ultra Skill. A Route Card is a derived observation from canonical project files, Git,
5
+ and the current run. It is not workflow authority, a stage marker, or permission to
6
+ continue.
7
+
8
+ ## Route Card
9
+
10
+ Show a compact `UBP Route Card` at entry, at a material checkpoint, when pausing or
11
+ blocked, at the observable exit, and before moving to another public Skill. Keep an
12
+ unchanged field short, but never omit an unresolved decision or unfinished obligation.
13
+
14
+ | Field | Meaning |
15
+ |---|---|
16
+ | `Route` | The current public Skill, or `idle` when no workflow is active |
17
+ | `Mode` | One mode declared by that Skill |
18
+ | `Why` | The current problem or evidence gap |
19
+ | `Outcome` | The owner-visible result this route is trying to produce |
20
+ | `Accepted boundary` | Accepted scope, exclusions, and authority that cover this run |
21
+ | `Position` | Artifact-derived navigation such as selected reports or remaining tasks |
22
+ | `Exit condition` | Observable evidence or owner decision that ends this mode |
23
+ | `Delta` | Material facts changed since the prior card |
24
+ | `Reality` | Live path, verification state, fakes, limitations, and unknowns |
25
+ | `Decision needed` | One material owner decision, or `none` |
26
+ | `Next` | The smallest covered continuation or one recommended public route |
27
+ | `Not done` | Obligations left at a pause or exit |
28
+
29
+ `Position` may report exact mechanical observations such as selected lenses with
30
+ reports, dependency-ready tasks, or an ACP session waiting for permission. Never turn a
31
+ count, validator result, finding total, or transport event into semantic progress or a
32
+ numeric completion score.
33
+
34
+ ## Material checkpoints
35
+
36
+ Stop and obtain the Owner's current decision before any of these changes or effects:
37
+
38
+ 1. a new or reduced North Star, specification, or Change commitment;
39
+ 2. a material delta to an active Change outcome, acceptance, non-goal, or public seam;
40
+ 3. evidence that materially changes the feasible direction or product boundary;
41
+ 4. wider Execution Grant scope, effects, budget, expiry, or Agent/provider topology;
42
+ 5. transfer of the canonical writer;
43
+ 6. unresolved P0/P1, risk acceptance, or the same root cause surviving three failed fixes;
44
+ 7. finalization, archive, commit, push, tag, publication, deployment, real installation,
45
+ credentials, provider spend, or another external or irreversible effect.
46
+
47
+ Naming, internal design, ordinary technical choices, task decomposition, covered local
48
+ edits and tests, and non-material evidence reconciliation remain model-owned inside the
49
+ accepted boundary. Do not ask for confirmation when `Decision needed` is `none`.
50
+
51
+ ## Continuation
52
+
53
+ Public modes belong to one of three invocation classes; model-only disciplines form a
54
+ fourth class:
55
+
56
+ | Invocation class | Owner entry | Model continuation |
57
+ |---|---:|---:|
58
+ | `explicit-entry` | yes | no |
59
+ | `grant-continuable` | yes | only under a valid Execution Grant covering that mode |
60
+ | `router` | yes | no; the Owner invokes read-only diagnosis explicitly |
61
+ | `model-discipline` | no | only as an internal method of a covered workflow |
62
+
63
+ Host metadata is only a coarse discovery bit. Before continuing, the Skill itself must
64
+ verify its selected mode, the same active `change_id`, the valid Execution Grant,
65
+ allowed local effects, stop conditions, and any material checkpoint. A coarse Host bit
66
+ never permits an explicit-entry mode. Without a covering grant, stop with a Route Card
67
+ and recommend the exact explicit route; never invoke another public Skill merely because
68
+ its files appear ready.
69
+
70
+ Within an accepted Change and valid grant, show the Route Card before each public Skill
71
+ transition and continue without a confirmation question only when the next mode and all
72
+ effects are covered. A material checkpoint still pauses. `Next` is either `continue:
73
+ <route>/<mode>` when covered or `recommend: <route>/<mode>` when owner invocation is
74
+ required.
75
+
76
+ Execution events such as tool calls, plans, usage, permission requests, worker output,
77
+ ACP updates, and process termination are transport observations. They may populate
78
+ `Position`, `Delta`, or `Reality`; they never decide acceptance, task completion, or the
79
+ next semantic route.
80
+
81
+ ## Recovery and degraded diagnosis
82
+
83
+ On a fresh session or Host, reconstruct the card from the accepted North Star, Project
84
+ Brief, active Change authority, task ledger and matching contexts, decisions, evidence,
85
+ Git, and current installation/runtime observations. Read the closing `## Resume Note`
86
+ for only the current work package. Do not rerun completed Research or create a route
87
+ ledger to remember where the conversation stopped.
88
+
89
+ If authority is absent, ambiguous, stale, malformed, or temporarily unreadable, stop
90
+ semantic writes but keep read-only diagnosis reachable. Report the exact fact that
91
+ prevents a normal route and the cheapest safe repair, retry, cancel, abandon, or fresh
92
+ session path. Never describe a blocked route as an endless in-progress workflow.
93
+
94
+ Owner revisions remain recoverable: edit a draft in place, supersede an accepted
95
+ decision with a new owner record, and preserve Git/history. Status may summarize that
96
+ history on request, but no event log becomes a second source of truth.
97
+
98
+ When context pressure threatens reliable continuation, finish the nearest safe write,
99
+ refresh the canonical context's Resume Note, show a final card, and recommend a fresh
100
+ session. Context size is an observation, not a hard semantic gate.
@@ -10,8 +10,14 @@ the loop that supplies it, and it serves Goal 3, Production-Ready.
10
10
 
11
11
  ## Before you start
12
12
 
13
- 1. When called from a planned Change, resolve the unique active `change_id` and read the
14
- matching current task context for the seams already confirmed during planning. For a
13
+ 1. When called from a planned Change, read
14
+ `../ultra-change/references/change-contract.md` and apply its **Active Change
15
+ authority resolution** before reading any active `intent.md`, resolving the current
16
+ `change_id` or task, reading its context, running the baseline, or executing red-green
17
+ product edits. A stable zero result stops with no current task; any typed diagnostic,
18
+ including non-unique authority, stops with its repair before the baseline, red-green,
19
+ or any product write. After one valid authority, read its intent, `.ultra/tasks.json`,
20
+ and the matching current task context for the seams confirmed during planning. For a
15
21
  micro edit outside the Ultra lifecycle, no active task context is required; use the
16
22
  accepted request, maintained specification, and an existing repository seam, and
17
23
  create no Ultra task or delivery claim.
@@ -43,8 +49,8 @@ Write the failing test first and run it, so that red is observed rather than
43
49
  assumed. Then write the smallest code that turns it green. Predict no later
44
50
  tests and add no speculative capability. Then take the next slice.
45
51
 
46
- Refactoring is not part of this loop; `ultra-review` owns it, because the
47
- restructuring worth doing only becomes visible after three or four slices.
52
+ Refactoring is not part of this loop; `ultra-review` owns it when observed duplication,
53
+ coupling, or a boundary defect supplies evidence that restructuring is worthwhile.
48
54
 
49
55
  ## Three patterns that produce tests worth deleting
50
56
 
@@ -77,6 +83,7 @@ goes to the owner as one.
77
83
 
78
84
  ## References
79
85
 
86
+ - `../ultra-change/references/change-contract.md` — canonical Active Change authority resolution.
80
87
  - `../ultra-think/references/autonomy-boundary.md` — read before replacing a real
81
88
  dependency with a fake, or when a test stands between the work and green.
82
89
  - `references/templates/README.md` — read when choosing which enabling template
@@ -11,8 +11,13 @@ For every baseline, red, and green run record:
11
11
  - runner-reported pass, fail, skip, and coverage counts when available;
12
12
  - first useful failure with tight source or test location;
13
13
  - whether it reproduces and whether it is product, test, environment, or flaky evidence;
14
- - raw output path under `.ultra/evidence/<task-id>/` when the output matters.
14
+ - raw output path under `.ultra/evidence/<task-id>/` and the lowercase SHA-256 of its
15
+ exact bounded stable bytes when the output matters.
15
16
 
16
17
  Do not weaken flags, skip a relevant failure, edit test configuration to obtain green,
17
18
  or claim success when the command did not finish with exit zero. A concise evidence
18
19
  record may cite the raw log; it must not copy an entire transcript into task context.
20
+ Before citing one, require a repository-contained ordinary regular non-symlink file,
21
+ opened nonblocking and no-follow with an 8 MiB ceiling and unchanged path/descriptor
22
+ identity around the read. Hash that one snapshot; a missing, escaped, special, symlinked,
23
+ oversized, or replaced receipt is a typed evidence gap, not a successful run record.
@@ -9,22 +9,54 @@ This is the one end-of-change sensor allowed by PHILOSOPHY C4: an export cannot
9
9
  called orphaned while a later task may still wire it. It is a terminal sensor, never a gate;
10
10
  the owner decides what to fix or accept.
11
11
 
12
+ ## Route modes
13
+
14
+ | Mode | Entry | Observable exit | Next |
15
+ |---|---|---|---|
16
+ | `audit` | Explicit invocation or a valid Execution Grant after every matching task has current completion evidence | One current whole-Change report and aggregate review preserve all six audit areas, findings, omissions, identities, and dispositions | Recommend `ultra-deliver/reconcile` when current, or the owner-selected responsible route |
17
+ | `reaudit` | Explicit invocation or a valid Execution Grant after an owner-dispositioned repair invalidates the prior report | A fresh report binds the repaired Change snapshot without hiding earlier findings | Recommend `ultra-deliver/reconcile` when current, or another bounded owner disposition |
18
+
19
+ Follow `../ultra-status/references/route-contract.md`. Show a Route Card at audit entry,
20
+ before asking for finding disposition, and at the report exit. Audit counts and review
21
+ events populate `Position` or `Reality`; they never choose repair, convergence, or risk
22
+ acceptance. Test does not call its own repair route.
23
+
12
24
  ## Before you start
13
25
 
14
- 1. Resolve exactly one `.ultra/changes/active/<change_id>/intent.md`. Read
15
- `.ultra/tasks.json` and only tasks whose `change_id` matches the active Change. Every
16
- matching task must be complete; read each task's `context_file` Acceptance, Completion and
17
- closing `## Resume Note`. Historical tasks are not part of this audit snapshot.
18
- 2. Read `CONTEXT.md` for vocabulary and the relevant `.ultra/decisions/` entries.
19
- 3. Read the active Change intent, the task evidence directories and the current Git
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`. This workflow requires its one valid active authority; any zero result
30
+ or typed diagnostic stops before audit input is read until the stated repair or retry
31
+ succeeds. Read `.ultra/tasks.json` and only tasks whose `change_id` matches the active
32
+ Change. Every matching task must be `completed` in that sole task-status authority.
33
+ Read each task's `context_file` Acceptance, Completion, Task Review and closing
34
+ `## Resume Note`.
35
+ Historical tasks are not part of this audit snapshot. For every current Change task,
36
+ require a current `ultra-task-evidence-v2` record whose context, subject, acceptance,
37
+ and task-review bindings satisfy `../ultra-plan/references/task-evidence-v2.md`.
38
+ A legacy context Status or Complexity header and v1 evidence remain migration
39
+ diagnostics only; recommend Dev repair rather than treating them as current Test input.
40
+ 3. Read `CONTEXT.md` for vocabulary and the relevant `.ultra/decisions/` entries.
41
+ 4. Read the active Change intent, the task evidence directories and the current Git
20
42
  `HEAD`; old output is evidence only for the commit it names.
21
- 4. Resolve this loaded Skill's directory and run
43
+ Resolve Change and task `FP-*`, `NS-*`, and `HC-*` IDs against the accepted North
44
+ Star revision. A stale trace is an explicit finding requiring reconciliation, not a
45
+ silent rewrite or automatic failure verdict.
46
+ 5. Resolve this loaded Skill's directory and run
22
47
  `node <ultra-test-skill-dir>/scripts/worktree_digest.cjs --project <repository-root> --change-id <change_id>`
23
48
  before and after the audit. It returns the stable Change id, exact intent SHA-256,
24
- HEAD, and product-worktree digest. The product digest excludes the report and all
25
- active/archive/abandoned Change-directory metadata; intent freshness is checked
26
- separately, so writing delivery metadata or moving the same Change cannot invalidate
27
- its tested product snapshot.
49
+ HEAD, and product-worktree digest. The product-worktree digest has one fixed boundary:
50
+ it excludes `.ultra/evidence/**`, whose command and external-observation entries bind
51
+ raw bytes as `raw_evidence_sha256` before stable exact record bytes are bound as
52
+ `evidence_digest`. It also excludes the report and
53
+ all active/archive/abandoned Change-directory metadata. Intent freshness is checked
54
+ separately, so publishing or refreshing evidence, writing delivery metadata, or moving
55
+ the same Change cannot self-invalidate its tested product snapshot. Exact task-evidence
56
+ and review-receipt digests remain mandatory through their existing consumers; this is
57
+ not a caller-configurable exclusion. This digest defines the aggregate Change subject
58
+ for the current whole Change; it is distinct from each task's earlier
59
+ completion-snapshot freshness observation.
28
60
 
29
61
  ## Definition of done
30
62
 
@@ -34,6 +66,15 @@ the owner decides what to fix or accept.
34
66
  - `.ultra/test-report.json` records `change_id`, the exact current-Change `task_ids`,
35
67
  `intent_digest`, `git_commit`, commands, findings, omissions and the owner's
36
68
  disposition without rewriting a finding into a pass.
69
+ - Every current task's v2 evidence and retained task-review summary is consumed; blocking
70
+ findings, resolutions, disagreements, and refresh references remain attributable.
71
+ - One current aggregate Change review is referenced by session, packet digest, exact
72
+ admission and subject digests, execution mode, coverage, summary path, exact summary
73
+ SHA-256, and verdict.
74
+ - The report names `ultra-review-findings-v4` and copies every review finding unchanged,
75
+ including `north_star_trace.first_principles`, `.serves`, and `.touches`, so each
76
+ finding carries its resolving `FP-*`/`NS-*`/`HC-*` IDs and Deliver can
77
+ test evidence against outcome without copying the North Star prose.
37
78
 
38
79
  ## Audit six areas
39
80
 
@@ -59,6 +100,95 @@ file is how a report loses findings.
59
100
  Read `references/export-syntax.md` before collecting exports. The table finds
60
101
  candidates; repository conventions and real consumers decide what is public.
61
102
 
103
+ After the six areas, follow `../ultra-review/SKILL.md` for an aggregate Change review.
104
+ Read only its validated summary, preserve its findings, and carry the review session,
105
+ packet digest, admission digest, subject digest, execution mode, coverage refs, summary
106
+ ref, verdict, and limitations into the report. Record
107
+ `review.finding_schema: "ultra-review-findings-v4"`; copy each finding
108
+ object unchanged from the v4 summary, including `north_star_trace`. An incomplete review
109
+ stays an omission; it never becomes a silent pass. Historical v3 review is evidence only:
110
+ run a fresh v4 aggregate review before a current Test claim.
111
+
112
+ Before accepting copied review metadata or findings, replay the exact frozen
113
+ `SUMMARY.json` through the sibling `ultra-review/scripts/review_wait.py` v4 summary
114
+ validator. Strict v4 replay is the default and requires the same session's valid
115
+ `ADMISSION.json`; `--legacy-v4` is an explicit read mode only for immutable historical
116
+ pre-admission evidence and cannot support a current Test claim. Then bind its
117
+ `change_id`, ordered `task_ids`, `head`, `admission_digest`, `subject_digest`,
118
+ `context_digest`, and
119
+ honest nullable `worktree_digest` to the Test report's root identity and `review`
120
+ provenance fields. The transport sensor accepts only canonical
121
+ `.ultra/test-report.json` and the normalized repository-relative
122
+ `.ultra/reviews/<session>/SUMMARY.json` it names. Both use the same bounded stable
123
+ raw-byte snapshot rule: every managed path component below the real repository root is
124
+ non-symlink, the final entry is a repository-contained regular file, and an 8 MiB + 1
125
+ byte observation returns a typed oversize diagnostic before JSON parsing or hashing.
126
+ The final file is opened with `O_NONBLOCK` and `O_NOFOLLOW`; its descriptor is
127
+ immediately required to be a regular file with the inspected path identity. A type or
128
+ identity replacement returns the existing retryable snapshot diagnostic instead of
129
+ waiting on a special file.
130
+ The sensor uses one report snapshot for report parsing and subject comparisons, and one
131
+ summary snapshot for summary parsing, SHA-256, comparisons, and the waiter's stdin
132
+ validation. After writing those exact values and findings, run
133
+ `node <ultra-test-skill-dir>/scripts/validate_review_transport.cjs --summary <validated-summary-path> --report .ultra/test-report.json`.
134
+ Record that exact command, exit code, and evidence reference in `commands`. A nonzero
135
+ result is a typed transport observation: repair the report copy and rerun it; never drop,
136
+ merge, inject, or rewrite a finding to obtain a pass. This sensor compares exact summary
137
+ bytes, review metadata, and finding objects only. It does not reinterpret a finding or
138
+ decide the audit verdict.
139
+
140
+ Validate each task evidence record with the shipped v2 structural sensor before using
141
+ it. For every record whose `task_review.review_mode` is `external-manual`, rerun the
142
+ sensor with `--verify-external-receipt` and recheck the declared receipt branch — the
143
+ bounded stable receipt bytes, its recorded SHA-256, and its task/change/subject
144
+ identity — instead of replaying a strict summary; strict-v4 records keep their exact
145
+ waiter and transport replay. A task's declared branch is preserved as-is in the
146
+ ordered `task_evidence` projection, consuming each item from the sensor's
147
+ `--projection` output verbatim: an external-manual item carries `task_review_mode`,
148
+ `task_review_receipt_ref`, and `task_review_receipt_digest` where a strict item
149
+ carries its session and summary digest. Never rewrite one branch into the other. The CLI establishes only JSON shape, token syntax, and
150
+ authority designation; it does not prove current identity, provenance, freshness,
151
+ or semantic acceptance. Test
152
+ takes each command and external-observation `raw_evidence_ref` to bounded stable
153
+ repository-contained bytes from an ordinary regular non-symlink file opened nonblocking
154
+ and no-follow, with an 8 MiB ceiling and path/descriptor identity checks around the read.
155
+ Recompute `raw_evidence_sha256` from that one snapshot and require an exact match. Then
156
+ recompute the stable exact `evidence.json` bytes as `evidence_digest` before copying the
157
+ ordered `task_evidence` projection; a raw or record mismatch is an evidence gap returned
158
+ to Dev.
159
+ Test
160
+ takes stable bytes independently, then rechecks and recomputes the current Acceptance-section SHA-256, aligns exact criterion IDs and verification types with the current context, and aligns the task-review session and summary digest with the retained strict summary. For `owner-judgment`, require that the durable owner record exists with its cited statement and disposition readable before rechecking all cited affected artifacts.
161
+ The `subject` is an independently captured completion-snapshot freshness observation made after the final strict task Review validates and immediately before evidence publication; `task_review` separately binds the retained strict summary. Worker Packet v1 carries no task worktree digest and its summary records `worktree_digest: null`, so Test never claims that those review artifacts prove or cryptographically bind `subject.worktree_digest`. It also never replaces that earlier observation with the later aggregate Change digest.
162
+ The owner alone supplies an owner-judgment result. A later task may change the aggregate
163
+ worktree without invalidating an earlier task, but any changed acceptance, owner record,
164
+ review binding, or cited artifact that no longer supports its criterion is a mismatch.
165
+ Any mismatch is an evidence gap: return the affected task and criterion IDs to Dev, or
166
+ return a missing owner judgment to the owner. Test never edits task status. Dev records the reason and performs
167
+ the explicit ledger `completed` to `in_progress` reopen; no silent demotion is allowed.
168
+ Never turn structural sensor success into any of those consumer conclusions.
169
+
170
+ This is a cooperative-workspace drift sensor, not an operating-system isolation
171
+ primitive. Use one fixed closing protocol: one complete primary observation followed by
172
+ one terminal seal. A persistent mismatch observed inside or before that terminal seal
173
+ returns typed `ULTRA_SNAPSHOT_CHANGED_DURING_OBSERVATION` recovery instead of publishing
174
+ the tuple. A cooperative write after the completed terminal seal belongs to the next
175
+ consumer, which must perform a fresh recapture before using the tuple. Hostile writers or
176
+ interleavings require a native Host sandbox or an isolated worktree. Never add an
177
+ unbounded success-seeking replay.
178
+
179
+ Aggregate finding disposition is bounded: P2 and P3 findings are recorded as backlog or
180
+ residual risk and never automatically returned to Dev, and this audit writes
181
+ non-blocking refactor observations into the report instead of reopening a completed
182
+ task. An implementation P0/P1 found here returns to Dev as at most one new
183
+ owner-approved repair task; there is no unbounded Test ↔ Deliver bounce, and any
184
+ re-entry through Test after a report is consumed requires an explicit owner
185
+ disposition.
186
+
187
+ The receipt is non-authoritative derived evidence, but retain it until both Test and
188
+ Deliver have consumed the review. If it is missing, the current session and Test claim
189
+ are `INCOMPLETE`; start a fresh review session. Do not reconstruct it or use
190
+ `--legacy-v4` to bypass loss from a current strict session.
191
+
62
192
  ## Detect substantive stubs
63
193
 
64
194
  Report an empty return with no IO, a log-only function, a handler that only prevents
@@ -73,19 +203,27 @@ findings with paths, verified seams, material omissions, residual risk, and `pas
73
203
  the model's evidence-derived summary in the one canonical
74
204
  `.ultra/test-report.json`. Each command records `command`, `exit_code`, and an
75
205
  `evidence_ref`; each area records `status`, `evidence_refs`, and `omissions`. Copy the
76
- script's `head`, `dirty`, `diff_digest`, and `intent_digest` into the report. A stale
206
+ worktree script's `head`, `dirty`, `diff_digest`, and `intent_digest` into the report.
207
+ That worktree identity binds the current whole Change, while ordered `task_evidence`
208
+ items preserve each task's distinct completion-snapshot freshness observation and
209
+ separate task-review identity.
210
+ Copy the validated review summary's exact SHA-256 into `review.summary_digest`; the
211
+ transport validator recomputes it before the report can be current evidence. A stale
77
212
  commit, product digest, intent digest, Change id, or task-id snapshot is labelled stale;
78
213
  it is never reused as current proof.
79
214
 
80
- `passed` is a one-way claim: `true` requires every current-Change task complete and no
81
- required area left `not_run`. Completed tasks do not force `passed: true`; findings,
82
- omitted evidence, or a failed command may keep it false, while an explicitly
83
- dispositioned gap remains visible even if the model's evidence summary passes. Preserve
84
- the finding and the owner's disposition as separate fields.
215
+ `passed` is a one-way claim: `true` requires every current-Change task completed in the
216
+ ledger, current v2 task evidence and task-review provenance, and no required area left
217
+ `not_run`. Completed rows do not force `passed: true`; findings, omitted evidence, or a
218
+ failed command may keep it false, while an explicitly dispositioned gap remains visible
219
+ even if the model's evidence summary passes. Preserve the finding and the owner's
220
+ disposition as separate fields. No validator result is itself semantic acceptance.
85
221
 
86
222
  Present the findings by consequence and recommend the highest-leverage response. The
87
223
  owner may fix all, fix selected findings, accept recorded risk, or reduce scope through
88
- the normal REDUCTION decision. Recommend the next capability; do not invoke it.
224
+ the normal REDUCTION decision. Recommend the next capability. Continue only when the
225
+ owner disposition or existing grant covers its exact mode and effects, and show the
226
+ transition Route Card first; Test itself never manufactures that coverage.
89
227
 
90
228
  ## When the owner decides
91
229
 
@@ -94,8 +232,13 @@ an observation, not permission to auto-fix, weaken a test or silently change sco
94
232
 
95
233
  ## References
96
234
 
235
+ - `../ultra-change/references/change-contract.md` — canonical Active Change authority resolution.
97
236
  - `references/export-syntax.md` — read during Wiring Verification to find exported
98
237
  symbol candidates in TypeScript/JavaScript, Python, Go, Rust and Java.
99
238
  - `scripts/worktree_digest.cjs` — deterministic HEAD plus worktree evidence identity.
239
+ - `../ultra-review/SKILL.md` — read for aggregate Change review after the six-area audit.
240
+ - `../ultra-plan/references/task-evidence-v2.md` — canonical current task evidence and task-review contract.
241
+ - `../ultra-change/references/execution-grant.md` — read only for grant-activated continuation.
242
+ - `../ultra-status/references/route-contract.md` — owner-visible route, checkpoint, and recovery output.
100
243
  - `../ultra-think/references/autonomy-boundary.md` — read when a proposed response
101
244
  would make an existing specification commitment stop holding.