ultra-builder-pro-cli 0.26.2 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.ultra-template/contexts/TEMPLATE.md +64 -29
  2. package/.ultra-template/north-star.md +35 -18
  3. package/.ultra-template/tasks.json +1 -0
  4. package/.ultra-template/test-report.json +17 -1
  5. package/CHANGELOG.md +163 -1
  6. package/README.md +108 -38
  7. package/adapters/_shared/host-profile.cjs +68 -12
  8. package/adapters/_shared/plugin-core.cjs +4 -5
  9. package/adapters/_shared/runtime-assets.cjs +11 -2
  10. package/adapters/zcode.js +375 -0
  11. package/bin/delegate-worker.cjs +20 -0
  12. package/bin/delegate.cjs +94 -25
  13. package/bin/install.js +11 -6
  14. package/docs/ARCHITECTURE.md +84 -23
  15. package/docs/ARTIFACT-AUTHORITY.md +167 -22
  16. package/docs/DECISIONS.md +131 -17
  17. package/docs/PHILOSOPHY.md +58 -7
  18. package/docs/PLUGIN-ISOLATION-CONTRACT.md +6 -0
  19. package/docs/RUNTIME-COMPAT-MATRIX.md +106 -13
  20. package/docs/SKILL-AUTHORING.md +4 -3
  21. package/docs/WORKFLOW-LIFECYCLE.md +126 -28
  22. package/docs/evals/adversarial-review-2026-08-14.md +84 -0
  23. package/docs/evals/zcode-automation-2026-08-14.md +103 -0
  24. package/hooks/README.md +27 -4
  25. package/hooks/_common.py +1678 -61
  26. package/hooks/adapters/zcode.py +227 -0
  27. package/hooks/compact_context.py +176 -17
  28. package/hooks/mid_workflow_recall.py +27 -5
  29. package/hooks/post_edit_guard.py +133 -23
  30. package/hooks/session_context.py +707 -22
  31. package/package.json +6 -3
  32. package/skills/ultra-change/SKILL.md +40 -9
  33. package/skills/ultra-change/references/change-contract.md +93 -27
  34. package/skills/ultra-change/references/execution-grant.md +109 -0
  35. package/skills/ultra-change/references/primary-transfer.md +273 -0
  36. package/skills/ultra-change/scripts/validate_primary_transfer.cjs +1928 -0
  37. package/skills/ultra-delegate/SKILL.md +24 -2
  38. package/skills/ultra-delegate/references/delegation-contract.md +21 -1
  39. package/skills/ultra-deliver/SKILL.md +85 -11
  40. package/skills/ultra-dev/SKILL.md +171 -41
  41. package/skills/ultra-grilling/SKILL.md +10 -7
  42. package/skills/ultra-grilling/references/reframing.md +7 -3
  43. package/skills/ultra-init/SKILL.md +44 -7
  44. package/skills/ultra-init/scripts/init_project.cjs +968 -21
  45. package/skills/ultra-plan/SKILL.md +70 -44
  46. package/skills/ultra-plan/references/task-evidence-v2.md +300 -0
  47. package/skills/ultra-plan/scripts/validate_task_evidence.cjs +859 -0
  48. package/skills/ultra-research/SKILL.md +38 -10
  49. package/skills/ultra-research/references/04-product-strategy.md +11 -2
  50. package/skills/ultra-research/references/21-features-scope.md +8 -0
  51. package/skills/ultra-research/references/22-success-metrics.md +4 -3
  52. package/skills/ultra-research/references/99-synthesis.md +19 -2
  53. package/skills/ultra-research/references/north-star-v2.md +168 -0
  54. package/skills/ultra-research/references/wayfinding.md +8 -0
  55. package/skills/ultra-research/scripts/validate_north_star.cjs +1174 -0
  56. package/skills/ultra-review/SKILL.md +201 -27
  57. package/skills/ultra-review/references/adversarial-evaluation.md +31 -0
  58. package/skills/ultra-review/references/spec.md +5 -0
  59. package/skills/ultra-review/references/unified-schema.md +146 -11
  60. package/skills/ultra-review/references/worker-packet.md +151 -8
  61. package/skills/ultra-review/scripts/review_wait.py +2653 -63
  62. package/skills/ultra-status/SKILL.md +95 -11
  63. package/skills/ultra-tdd/SKILL.md +11 -4
  64. package/skills/ultra-tdd/references/test-execution.md +6 -1
  65. package/skills/ultra-test/SKILL.md +145 -17
  66. package/skills/ultra-test/scripts/validate_review_transport.cjs +549 -0
  67. package/skills/ultra-test/scripts/worktree_digest.cjs +518 -30
@@ -8,6 +8,12 @@ description: Delegate one bounded workflow segment to another installed CLI in a
8
8
  Delegation is an execution mode, not another workflow stage. The primary host keeps
9
9
  semantic synthesis and remains the only writer of `.ultra/tasks.json`.
10
10
 
11
+ Delegation is also not a primary transfer. A delegated worker never becomes the
12
+ work package's canonical writer, whatever its result says; moving that role to
13
+ another Agent requires the owner-directed OFFER → ACK → RESULT protocol in
14
+ `../ultra-change/references/primary-transfer.md`, which stays mutually exclusive
15
+ with this bounded-worker path.
16
+
11
17
  ## Before you start
12
18
 
13
19
  1. Resolve exactly one active `change_id`, then select one scope and name it in
@@ -54,7 +60,7 @@ worktrees collide in the very files every later session reads to resume. Worker
54
60
  and state changes travel back in `result.json` and are applied by the primary host.
55
61
  `external_effects` must be empty in this portable launcher: commit, push, publish,
56
62
  deployment and other effects stay with the primary host. There is no `readable_roots`
57
- claim because the five host sandboxes do not share one mechanically enforceable read
63
+ claim because the six host sandboxes do not share one mechanically enforceable read
58
64
  policy.
59
65
 
60
66
  Create `.ultra/.runtime/worktrees/<id>` as a real Git worktree and run:
@@ -63,6 +69,20 @@ Create `.ultra/.runtime/worktrees/<id>` as a real Git worktree and run:
63
69
  ubp delegate run --to <host> --instruction <file> --permission <file> --worktree <dir> --timeout <seconds>
64
70
  ```
65
71
 
72
+ `<host>` is `claude`, `codex`, `opencode`, `kimi`, `grok`, or `zcode`. Kimi accepts an
73
+ optional `--model <id>` when its account has no default headless model. A ZCode primary
74
+ host uses this same command to delegate to any other installed CLI; a different primary
75
+ host can select `--to zcode` through the ZCode headless profile.
76
+
77
+ The ZCode headless transport is `experimental`: it is an App-internal or PATH CLI with
78
+ no public stability contract, and it is **not** the documented ZCode Desktop
79
+ interactive surface. `delegate run --to zcode` refuses to launch until the invocation
80
+ explicitly carries `--ack-experimental`; every launch then prints a stderr warning and
81
+ records `transport_maturity: "experimental"`, the exact `transport_surface` wording,
82
+ and `experimental_ack: true` in the receipt, the worker spec, and the terminal result
83
+ (including failure and timeout recovery results), so no receipt can imply a documented
84
+ Desktop session. Promotion requires official documentation plus a full recovery drill.
85
+
66
86
  The command returns a receipt. Immediately run `scripts/delegate_wait.py`; read no
67
87
  intermediate output. Use `ubp delegate status --delegation <dir>` for a read-only state
68
88
  and `ubp delegate cancel --delegation <dir>` to request termination. Never delete a lock
@@ -71,7 +91,9 @@ to manufacture completion.
71
91
  The worker returns one schema-constrained JSON final response. The launcher extracts it
72
92
  from the host's native structured output, validates digests, process exit, exact schema,
73
93
  actual base-HEAD diff and writable roots, then atomically publishes `result.json`. The
74
- model never writes its own receipt. If owner input is needed, the worker terminates
94
+ launcher embeds the exact digest-bound instruction and permission packet in the prompt,
95
+ so a host that denies external-directory reads never needs authority outside the
96
+ worktree. The model never writes its own receipt. If owner input is needed, the worker terminates
75
97
  `blocked` with questions and evidence; start a new id and fresh packet after obtaining
76
98
  the answer.
77
99
 
@@ -23,6 +23,13 @@ reads to resume. Enforced twice: the launcher rejects a `.ultra` root before the
23
23
  delegation starts, and the worker fails an actual diff that touches it with
24
24
  `unauthorized_write`.
25
25
 
26
+ This boundary also separates delegation from a primary transfer: a delegation result
27
+ is a bounded observation returned to the primary host, and no delegation receipt can
28
+ serve as, upgrade into, or substitute for the OFFER/ACK/RESULT receipts of a primary
29
+ transfer (`../ultra-change/references/primary-transfer.md`). Widening a worker to write
30
+ `.ultra` in order to simulate a transfer is a contract violation, not an integration
31
+ shortcut.
32
+
26
33
  ## Model final response
27
34
 
28
35
  ```json
@@ -43,12 +50,25 @@ delegation starts, and the worker fails an actual diff that touches it with
43
50
  Fields are exact. Status is `finished`, `blocked`, or `failed`; `blocked` requires a
44
51
  question. Check status is `passed`, `failed`, or `not_run`. Changed files are unique,
45
52
  normalized repository-relative paths and must exactly equal the launcher's Git diff.
53
+ `output_ref` is requested for every check and required in the native schema projection
54
+ used by hosts that accept one. The launcher remains compatible with hosts that return
55
+ the otherwise exact check without that optional evidence pointer.
46
56
 
47
- The launcher extracts this object from native structured output and adds
57
+ The launcher embeds the exact instruction and permission sources with their digests in
58
+ the host prompt, extracts this object from native structured output, and adds
48
59
  `delegation_id`, `host`, instruction, permission, and output-schema digests,
49
60
  `read_only`, `base_head`, `final_head`, timestamps, `exit_code`, and signal. Launcher
50
61
  failures also add `failure_type`. A nonzero process cannot publish `finished`.
51
62
 
63
+ Every receipt, worker spec, and terminal result also records the transport truth:
64
+ `transport_maturity` (from the shared host profile) and the exact `transport_surface`
65
+ wording. The ZCode headless transport is `experimental` with no public stability
66
+ contract and is not the documented ZCode Desktop interactive surface; launching it
67
+ requires the explicit `--ack-experimental` flag, prints a stderr warning, and stamps
68
+ `experimental_ack: true` on the receipt, so no delegation record can misrepresent an
69
+ internal CLI run as a documented Desktop session — including failure, cancellation,
70
+ and timeout recovery results.
71
+
52
72
  ## Recovery
53
73
 
54
74
  - `status` distinguishes running, cancelling, stalled, and terminal artifacts.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ultra-deliver
3
- description: Reconcile one Change whose matching tasks are complete, run aggregate review and refactoring, refresh release documentation, and archive the local workflow record. Use when the owner wants a delivery handoff or separately authorized release effects for the active Change.
3
+ description: Reconcile one Change whose matching tasks are complete, run aggregate review and refactoring, and report the delivery handoff. Use when the owner wants delivery reconciliation and reporting, or — by current explicit owner invocation only — the separately gated finalization that writes delivery.md, fixes version and package posture, and archives the local workflow record.
4
4
  ---
5
5
 
6
6
  # Turn current evidence into a recoverable delivery handoff
@@ -9,18 +9,61 @@ Delivery closes the local Change; readiness grants no commit, push, tag, publish
9
9
 
10
10
  ## Before you start
11
11
 
12
- 1. Resolve exactly one active `change_id`. Read `.ultra/tasks.json`; every matching task
13
- must be complete. Read each `context_file`'s Completion and closing Resume Note.
14
- 2. Read `CONTEXT.md`, relevant `.ultra/decisions/`, active Change intent and evidence.
15
- 3. Read `.ultra/test-report.json`, then run the Test Skill's `worktree_digest.cjs` with
12
+ 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. A model-selected Deliver run under that grant may reconcile, review, and report, and then MUST stop before finalization: its inputs, writes, and effects end at the report. Only a current explicit owner invocation of `ultra-deliver` may finalize — writing `delivery.md`, deciding the version decision and package posture, and archiving the stable Change id with `git mv` are owner-invocation-only in every grant mode, and a grant never covers them.
13
+ 2. Read `../ultra-change/references/change-contract.md` and apply its **Active Change
14
+ authority resolution** before reading any active `intent.md` or resolving a current
15
+ `change_id`. This workflow requires its one valid active authority; any zero result
16
+ or typed diagnostic stops before finalization input is read until the stated repair
17
+ or retry succeeds. Read `.ultra/tasks.json`; every matching task must be `completed`
18
+ in that sole task-status authority. Read each `context_file`'s Completion, Task
19
+ Review, and closing Resume Note. For every current Change task,
20
+ require current `ultra-task-evidence-v2` and task-review provenance under
21
+ `../ultra-plan/references/task-evidence-v2.md`, already consumed by the current Test
22
+ report. A legacy context Status or Complexity header and v1 evidence are migration
23
+ diagnostics only and cannot support current delivery.
24
+ 3. Read `CONTEXT.md`, relevant `.ultra/decisions/`, active Change intent and evidence.
25
+ Validate `.ultra/north-star.md`; resolve every recorded `FP-*`, `NS-*`, and `HC-*`
26
+ for the delivered Change, tasks, findings, and dispositions against that accepted
27
+ authority. Compare the active Change's recorded **North Star revision** and
28
+ **North Star digest** with the accepted file's revision and current Git blob digest. Any
29
+ missing ID or mismatch stops finalization and recommends explicit owner invocation of
30
+ `ultra-change` for reconciliation; delivery never silently rewrites the trace.
31
+ 4. Read `.ultra/test-report.json`, then run the Test Skill's `worktree_digest.cjs` with
16
32
  project root and `--change-id`. Require report `task_ids` for the current Change plus
17
- matching `change_id`, `git_commit`, worktree digest, and intent digest; otherwise stop.
33
+ matching `change_id`, `git_commit`, worktree digest, intent digest, and review
34
+ `admission_digest`, `subject_digest`, and `summary_digest`; otherwise stop. Recheck
35
+ each projected task's declared review branch as recorded: strict-v4 items keep their
36
+ strict receipt and transport bindings, while `external-manual` items reverify their
37
+ receipt bytes and digest through the task-evidence sensor's
38
+ `--verify-external-receipt` mode and take the sensor's `--projection` output
39
+ verbatim — a strict SUMMARY never substitutes for an external receipt and neither
40
+ branch is rewritten into the other.
41
+ The product-worktree digest has one fixed boundary: it excludes `.ultra/evidence/**`,
42
+ whose command and external-observation entries bind raw bytes as
43
+ `raw_evidence_sha256` before stable exact record bytes are bound as `evidence_digest`
44
+ through the report's ordered `task_evidence` projection. For each projected record,
45
+ take every `raw_evidence_ref` to bounded stable repository-contained bytes from an
46
+ ordinary regular non-symlink file opened nonblocking and no-follow, with an 8 MiB
47
+ ceiling and path/descriptor identity checks around the read. Recompute
48
+ `raw_evidence_sha256` and require an exact match, then recompute the stable exact
49
+ `evidence.json` bytes as `evidence_digest` before comparing the projection. Recheck
50
+ the exact review receipts separately; never treat the product exclusion as permission
51
+ to ignore evidence drift or add another exclusion.
52
+ An intent digest changed by North Star reconciliation or any other intent edit always
53
+ requires a fresh `ultra-test` before Deliver can finalize, even if product bytes did
54
+ not change.
55
+ 5. Preserve every typed acceptance authority. The owner alone supplies the semantic
56
+ result for `owner-judgment`; Deliver may verify its cited source and freshness but no
57
+ model, command, digest, schema, or validator may replace it.
18
58
 
19
59
  ## Definition of done
20
60
 
21
61
  - Outcome, specs, tests, aggregate review, and every document match the actual diff.
22
62
  - Every changed export has a non-test consumer or a recorded owner disposition.
23
63
  - Every omitted stage is explicitly recorded with its evidence-based rationale.
64
+ - Delivery explains whether evidence realizes the traced first principles and outcome,
65
+ and preserves contradictions or stale trace as findings instead of mirroring or
66
+ silently revising North Star prose.
24
67
  - Build and release checks have exact commands and real results.
25
68
  - The Change is archived with `git mv`, and rollback remains a normal Git operation.
26
69
 
@@ -28,6 +71,12 @@ Delivery closes the local Change; readiness grants no commit, push, tag, publish
28
71
 
29
72
  Follow `../ultra-review/SKILL.md` across the aggregate Change; refactor only observed
30
73
  duplication, coupling, or boundary defects. Rerun affected checks and refresh the report.
74
+ After the aggregate review and the current Test report are consumed, Deliver does not
75
+ refactor product source: it reconciles delivery artifacts and documentation only. A
76
+ post-approval implementation issue routes as at most one new owner-approved Dev task
77
+ for a P0/P1, or as recorded backlog and residual risk for P2/P3; an unbounded
78
+ Test ↔ Deliver bounce is not a valid recovery path, and any re-entry through Test
79
+ requires an explicit owner disposition.
31
80
 
32
81
  ## Reconcile the handoff
33
82
 
@@ -51,11 +100,33 @@ Delivery has two observable passes, not a hidden state machine:
51
100
  specifications, maintained documentation, or `intent.md`, stop after writing the
52
101
  reconciled files. The existing report is stale; recommend `ultra-test` and make no
53
102
  delivery or release claim.
54
- 2. After an unchanged pass or fresh Test, recheck Change/task/HEAD/product/intent
55
- identities. Apply the gate, run build and non-publishing package inspection, determine
56
- version impact, and use `references/baseline-reconciliation.md` for canonical
57
- `delivery.md`. Archive the Change. Excluded delivery metadata and the directory move
58
- cannot self-invalidate the product digest; intent stays independently bound.
103
+ 2. After an unchanged pass or fresh Test, resolve the report's canonical
104
+ `review.summary_ref` as `<validated-summary-path>` and run the current strict transport
105
+ consumer against the current report:
106
+
107
+ `node <ultra-test-skill-dir>/scripts/validate_review_transport.cjs --summary <validated-summary-path> --report .ultra/test-report.json`
108
+
109
+ Require exit 0 and a JSON `"valid": true` field. This one existing consumer verifies
110
+ the exact
111
+ retained `ADMISSION.json` and `SUMMARY.json`, then binds the report's
112
+ `admission_digest`, `subject_digest`, and `summary_digest` to those bytes. A missing or
113
+ invalid receipt, summary, or binding makes the current Test claim `INCOMPLETE`: start
114
+ a fresh Review and Test. Do not write `delivery.md`, archive the Change, create a
115
+ release package, or make a delivery claim while that receipt evidence is missing or
116
+ invalid. Never use `--legacy-v4` for this current-session check; v3 and pre-admission
117
+ v4 are read-only historical evidence, not current Test or Deliver evidence.
118
+
119
+ After the transport succeeds, recheck Change/task/HEAD/product/intent identities.
120
+ Apply the gate, run build and non-publishing package inspection, determine version
121
+ impact, and use `references/baseline-reconciliation.md` for canonical `delivery.md`.
122
+ Archive the Change. Excluded delivery metadata and the directory move cannot
123
+ self-invalidate the product digest; intent stays independently bound. Retain the
124
+ review session through this successful Deliver consumption; only then may its derived
125
+ artifacts be garbage-collected.
126
+
127
+ Transport and task-evidence validators establish exact structural, identity,
128
+ provenance, and freshness facts only. Their success never means that the Change is
129
+ semantically accepted or that its outcome is ready to describe as delivered.
59
130
 
60
131
  Do not draft a success narrative around stale evidence. A current `passed: false`
61
132
  report may still reach finalization only after every finding has an explicit owner
@@ -100,8 +171,11 @@ Without release authority, stop after the recoverable local archive and report i
100
171
 
101
172
  ## References
102
173
 
174
+ - `../ultra-change/references/change-contract.md` — canonical Active Change authority resolution.
103
175
  - `../ultra-review/SKILL.md` — read before aggregate review and refactoring.
176
+ - `../ultra-plan/references/task-evidence-v2.md` — canonical current task evidence and task-review contract.
104
177
  - `../ultra-think/SKILL.md` — read when version or release posture is a consequential
105
178
  trade-off rather than an established repository rule.
106
179
  - `../ultra-think/references/autonomy-boundary.md` — read before scope or evidence shrinks.
180
+ - `../ultra-change/references/execution-grant.md` — read only for grant-activated continuation.
107
181
  - `references/baseline-reconciliation.md` — exact `delivery.md` reconciliation contract.
@@ -9,24 +9,77 @@ The model owns code reasoning and edits; repository files own the resumable cont
9
9
 
10
10
  ## Before you start
11
11
 
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
12
+ 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.
13
+ 2. Read `../ultra-change/references/change-contract.md` and apply its **Active Change
14
+ authority resolution** before reading any active `intent.md` or resolving a current
15
+ `change_id`. Require its one valid authority; otherwise stop with its typed repair.
16
+ Then read `.ultra/tasks.json`. Without an exact task id in the owner invocation,
17
+ select only the uniquely current `in_progress` task and read its full
18
+ `context_file`, especially `## Resume Note`; if none exists, stop and ask
19
+ the owner to invoke Dev naming one exact task id — a `pending` row is a frontier
20
+ candidate, not active work, and Hooks will not have injected its acceptance or
21
+ Resume. An invocation that names one exact task id supplies invocation-local
22
+ selection authority for this Dev run only. If more than one row claims
23
+ `in_progress`, do not manufacture a unique current task; use the explicit recovery
24
+ below or stop with the Hook diagnostic. The ledger is the sole task-status authority;
25
+ legacy Status or Complexity never overrides it. A `completed` task with a current
26
+ invalidation observation may be selected only for the explicit reopen below; record
27
+ and read back that transition before repair.
28
+ 3. Read `CONTEXT.md` for vocabulary, and the `.ultra/decisions/` entries the task
16
29
  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.
30
+ 4. Validate `.ultra/north-star.md` with the shipped Research structural sensor. Resolve
31
+ every listed `FP-*`, `NS-*`, and `HC-*` in the task and active Change against that
32
+ accepted authority. Compare the active Change's recorded **North Star revision** and
33
+ **North Star digest** with the accepted file's revision and current Git blob digest.
34
+ A missing ID, revision mismatch, or digest mismatch is a stale-plan observation: stop
35
+ before editing and recommend explicit owner invocation of `ultra-change` to reconcile
36
+ the active Change. Never inherit approval or silently rewrite the trace.
37
+ 5. Read the task's acceptance criteria. If you cannot state that acceptance in one
38
+ sentence, you are not ready to start.
39
+
40
+ ### Activating one named pending task
41
+
42
+ When the owner invocation names a dependency-ready `pending` task, perform its
43
+ canonical activation before any implementation work: write that row from
44
+ `pending` to `in_progress` in `.ultra/tasks.json` and read the row back before
45
+ the first implementation edit. This one canonical ledger write is what makes
46
+ the named task live for the task-aware Hooks; without it Hooks correctly remain
47
+ task-silent while you edit, because a trusted invocation is visible only to the
48
+ invocation that carried it. The activation adds no selector, activation flag,
49
+ or workflow state — the ledger row is the only authority — and it must respect
50
+ the single-writer boundary: resolve any conflicting `in_progress` rows through
51
+ the recovery below or an owner decision before writing.
52
+
53
+ ### Recover one exact task from an ambiguous ledger
54
+
55
+ An explicit owner invocation with one exact task id supplies invocation-local selection
56
+ authority for this Dev run even when multiple ledger rows claim `in_progress`. Before
57
+ editing, read that exact canonical ledger row and context, especially its Resume Note,
58
+ then inspect current Git/worktree evidence for the named task. Do not persist a new
59
+ current-task selector, status, or workflow state to manufacture uniqueness. Hooks remain
60
+ task-silent and progress-silent while the ledger is ambiguous.
61
+
62
+ Only an explicit owner/Plan correction that establishes a conflicting task never started
63
+ may return that row to `pending`. If multiple tasks contain real partial work, keep every
64
+ task with real partial work `in_progress` and preserve each task's bytes. Recover them by
65
+ separate exact task-id owner invocations or obtain owner-authorized Plan reconciliation;
66
+ use a separate worktree when needed to keep their writes isolated. Completing the
67
+ selected task still requires final review, canonical v2 evidence, context publication,
68
+ ledger write, and readback.
19
69
 
20
70
  When this task starts from an observed error, failing check or unexpected behavior,
21
71
  read `references/debugging.md` and establish the earliest incorrect state before editing.
22
72
 
23
73
  ## Definition of done
24
74
 
25
- - All six evidence dimensions answer the checkable rules below.
26
- - `tasks.json` and context status agree after write/read-back.
75
+ - All six evidence dimensions carry honest, current observations under the typed v2
76
+ evidence contract; a real limitation remains a gap rather than becoming a pass.
77
+ - `.ultra/tasks.json` remains the sole task-status authority after write/read-back.
27
78
  - The task still names the active `change_id`; historical unfinished work stays out.
28
79
  - 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.
80
+ - A task-level review runs while the ledger task remains `in_progress`; its blocking
81
+ findings are resolved or owner-dispositioned as required and affected evidence is
82
+ refreshed before the model writes `completed` to the ledger.
30
83
 
31
84
  ## Write the implementation plan before the code
32
85
 
@@ -38,30 +91,54 @@ buries the design decisions in the details.
38
91
  ## Develop through red then green
39
92
 
40
93
  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.
94
+ confirmed, one slice at a time. `ultra-review` owns evidence-backed refactoring when
95
+ observed duplication, coupling, or a boundary defect justifies it; a slice count does
96
+ not make that decision.
43
97
 
44
98
  ## Converge on the task-scoped acceptance set
45
99
 
46
- Development ends when the task's acceptance commands pass, not when the code looks
100
+ Development ends when every task-scoped criterion has its required current evidence and
101
+ responsible semantic disposition, not merely when commands pass or the code looks
47
102
  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.
51
-
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:
103
+ for `<change_id>`. For each named row consume its exact `Verification type` and
104
+ `Required evidence`. When one outcome needs more than one authority, split it into
105
+ independent criteria with unique IDs and preserve each authority separately; every row
106
+ has exactly one verification type. Task-local acceptance may add evidence requirements,
107
+ but it does not replace or narrow the Change mapping.
108
+
109
+ Handle the four verification types without converting one authority into another:
110
+
111
+ - Execute only `command` observations. Record the exact command, working directory,
112
+ exit status, retained raw output reference, and its exact SHA-256.
113
+ - For `inspection`, cite the exact source and revision or digest, then refresh the
114
+ observation after any touched source changes.
115
+ - For `owner-judgment`, preserve the cited owner decision. The owner alone supplies its
116
+ semantic result; a model statement, validator, score, or command cannot proxy it.
117
+ - For `external-observation`, preserve the provider or system receipt without proxying it
118
+ with a local command, model claim, or synthetic fixture, and bind its exact bytes by
119
+ SHA-256.
120
+
121
+ - Missing `owner-judgment` stops at its named owner gate.
122
+ - Missing `external-observation` stops at its named external or authorization gate.
123
+ - If an inspection exists but its semantic implication is unresolved, stop at the
124
+ responsible model or owner gate; a structural citation is not an automatic acceptance
125
+ verdict.
126
+
127
+ Run one baseline before repairing anything. Track a best-ever evidence set keyed by
128
+ criterion, verification type, and source identity to make progress visible, plus the
129
+ current evidence set used for convergence. Stale or regressed evidence remains history
130
+ but cannot satisfy the current set. Do not infer semantic progress or failure from a
131
+ round count. The loop has three explicit exits:
55
132
 
56
133
  | Exit | Condition | Action |
57
134
  |---|---|---|
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 |
135
+ | 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 |
136
+ | 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 |
137
+ | 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
138
 
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.
139
+ A nonzero command exit is an observation, not automatically `Unreachable`; inspect its
140
+ output and repair within scope when justified. None of these exits mechanically decides
141
+ semantic sufficiency, owner acceptance, or external truth.
65
142
 
66
143
  ## Answer the six evidence dimensions
67
144
 
@@ -76,14 +153,15 @@ Each has a rule you can check against the work rather than assert:
76
153
  | `vertical_slice` | One test's execution path runs from the entry point through to persistence |
77
154
  | `spec_trace` | The anchor the task's `trace_to` names exists in the specification |
78
155
 
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.
156
+ Before task review, retain the actual criterion evidence, raw logs, owner records,
157
+ external receipts, and cited artifacts without inventing another completion record.
158
+ Do not write `evidence.json` before the task's validated final `SUMMARY.json` exists.
159
+ The review packet admits those actual pre-review observations together with the ledger,
160
+ context acceptance, and packet-defined task scope. A structural validator may check
161
+ exact fields, types, digests, paths, and freshness observations. It never supplies an
162
+ acceptance disposition, turns a model claim into command evidence, or decides semantic pass.
163
+ Evidence is a sensor: a gap or legacy v1 record is reported with a migration
164
+ diagnostic, never rewritten as v2 truth.
87
165
 
88
166
  ## When implementation and the specification disagree
89
167
 
@@ -95,10 +173,60 @@ classification in the context file's Change Log.
95
173
 
96
174
  ## Close out
97
175
 
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.
176
+ Keep the ledger row `in_progress` while running task review through
177
+ `../ultra-review/SKILL.md`. Build its immutable packet from the ledger, task context,
178
+ packet-defined task scope, and actual pre-review evidence; the final v2 record is not an
179
+ admission prerequisite. Route only the exact current P0/P1 findings (or a P2 the owner
180
+ explicitly promoted) as one in-scope repair set, followed by one affected-lens delta
181
+ review per repair set inside the active review budget — an exact current owner grant
182
+ overrides the versioned product default of one initial review plus at most two
183
+ P0/P1 delta reviews per package. When another `REQUEST_CHANGES` would exceed the
184
+ active budget, return to the owner checkpoint with the exact blocking set instead of
185
+ an automatic repair; the same root surviving three failed fixes stops point-patching
186
+ and reports an architecture problem. Budget exhaustion stops execution at `owner checkpoint` /
187
+ `budget_exhausted` and keeps the ledger row `in_progress`.
188
+ It never yields `APPROVE`, `REQUEST_CHANGES`, `INCOMPLETE`, pass, fail, accept, or
189
+ abandon. If a repair changes implementation or evidence in review scope, use a new
190
+ immutable packet and validated review summary before closeout rather than rebinding the
191
+ old review. Worker Packet v1 and its summary do not bind a task worktree digest.
192
+
193
+ After the final validated `SUMMARY.json`, write one canonical `ultra-task-evidence-v2` record only after completing the raw-receipt binding below.
194
+ When the task's owner-designated review mode is external manual, the final review
195
+ product is instead the external reviewer's real receipt, bound through the
196
+ `review_mode: "external-manual"` branch of
197
+ `../ultra-plan/references/task-evidence-v2.md`: publish that receipt under
198
+ `.ultra/evidence/<task-id>/`, record its exact stable-byte SHA-256, and verify it
199
+ with the sensor's `--verify-external-receipt` mode instead of inventing a strict
200
+ session. Never fabricate one branch's artifacts to satisfy the other's shape.
201
+ The `subject` is an independently captured completion-snapshot freshness observation.
202
+ Before writing `evidence.json`, resolve every
203
+ command and external-observation `raw_evidence_ref` below the real repository root and
204
+ take bounded stable repository-contained bytes from an ordinary regular non-symlink file
205
+ opened nonblocking and no-follow. Reject a missing, escaped, symlinked, special,
206
+ oversized, or replaced file; otherwise compute `raw_evidence_sha256` from that one byte
207
+ snapshot. Publish that canonical record at `.ultra/evidence/<task-id>/evidence.json`,
208
+ read back the stable record and each raw ref,
209
+ and require the same ref bytes and digest before continuing.
210
+ Follow `../ultra-plan/references/task-evidence-v2.md`: `task_review` separately binds the retained strict summary; record one typed acceptance entry per criterion, all
211
+ six dimensions, the exact Execution Packet and review identities, blocking-finding
212
+ dispositions, evidence refresh refs, artifacts, limitations, and retention without
213
+ claiming that the review summary proves `subject.worktree_digest`. Read the record back, then update context
214
+ `## Task Review`, Completion, and `## Resume Note`; the context has no second status.
215
+ Only after those facts are durable may the primary model write `completed` to the
216
+ ledger and read the row back. When the task's work package sits under an
217
+ ACK-ready primary transfer whose newest terminal receipt is a completed v2
218
+ RESULT, this sequence is that contract's prescribed closeout: publish the
219
+ handoff's `CLOSEOUT.json` beside the frozen RESULT — citing the review receipt,
220
+ the closeout-start/end observations, and any recorded owner-authorized
221
+ continuation — instead of refreshing the RESULT or opening a new handoff; the
222
+ closeout starts no review and no repair round
223
+ (`../ultra-change/references/primary-transfer.md`).
224
+
225
+ If later work invalidates a completed task's criterion evidence, Dev performs an
226
+ explicit reopen. A reopen changes the ledger row from `completed` to `in_progress`;
227
+ 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
228
+ historical evidence, then write and read back the ledger transition. Refresh the named
229
+ evidence, run task review for the new snapshot, and repeat this closeout sequence.
102
230
 
103
231
  Report the changed paths, the seam, the exact checks run, the review result, the
104
232
  evidence gaps and the residual risk. Recommend the next capability from what the
@@ -106,14 +234,16 @@ files now say; do not invoke it.
106
234
 
107
235
  ## When the owner decides
108
236
 
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.
237
+ The owner decides any REDUCTION and each external effect separately. At most one
238
+ authorized local task commit happens here; push, tag, publish and deploy need separate
239
+ authority. An interruption leaves the worktree as-is and names it in the Resume Note.
113
240
 
114
241
  ## References
115
242
 
243
+ - `../ultra-change/references/change-contract.md` — canonical Active Change authority resolution.
116
244
  - `../ultra-tdd/SKILL.md` — read before the first test, for the seam and mock boundary.
117
245
  - `../ultra-think/references/autonomy-boundary.md` — read when spec and code disagree.
118
246
  - `../ultra-review/SKILL.md` — read when implementation evidence is ready for review.
247
+ - `../ultra-change/references/execution-grant.md` — read only for grant-activated continuation.
248
+ - `../ultra-plan/references/task-evidence-v2.md` — canonical evidence, disposition, and task-review shape.
119
249
  - `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
  |---|---|