ultra-builder-pro-cli 0.26.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.ultra-template/contexts/TEMPLATE.md +64 -29
  2. package/.ultra-template/north-star.md +36 -30
  3. package/.ultra-template/project-brief.md +28 -0
  4. package/.ultra-template/specs/product.md +4 -0
  5. package/.ultra-template/specs/research-distillate.md +8 -0
  6. package/.ultra-template/tasks.json +1 -0
  7. package/.ultra-template/test-report.json +18 -1
  8. package/CHANGELOG.md +227 -1
  9. package/README.md +161 -59
  10. package/adapters/_shared/host-profile.cjs +68 -12
  11. package/adapters/_shared/plugin-core.cjs +4 -5
  12. package/adapters/_shared/runtime-assets.cjs +11 -2
  13. package/adapters/zcode.js +375 -0
  14. package/bin/delegate-worker.cjs +20 -0
  15. package/bin/delegate.cjs +94 -25
  16. package/bin/install.js +11 -6
  17. package/docs/ARCHITECTURE.md +109 -25
  18. package/docs/ARTIFACT-AUTHORITY.md +204 -30
  19. package/docs/DECISIONS.md +141 -10
  20. package/docs/PHILOSOPHY.md +61 -8
  21. package/docs/PLUGIN-ISOLATION-CONTRACT.md +6 -0
  22. package/docs/RUNTIME-COMPAT-MATRIX.md +106 -13
  23. package/docs/SKILL-AUTHORING.md +14 -9
  24. package/docs/WORKFLOW-LIFECYCLE.md +211 -53
  25. package/docs/evals/adversarial-review-2026-08-14.md +84 -0
  26. package/docs/evals/zcode-automation-2026-08-14.md +103 -0
  27. package/hooks/README.md +31 -3
  28. package/hooks/_common.py +1699 -33
  29. package/hooks/adapters/zcode.py +227 -0
  30. package/hooks/compact_context.py +176 -17
  31. package/hooks/mid_workflow_recall.py +27 -5
  32. package/hooks/post_edit_guard.py +133 -23
  33. package/hooks/session_context.py +722 -11
  34. package/package.json +6 -3
  35. package/skills/ultra-change/SKILL.md +84 -64
  36. package/skills/ultra-change/references/change-contract.md +130 -32
  37. package/skills/ultra-change/references/execution-grant.md +109 -0
  38. package/skills/ultra-change/references/primary-transfer.md +273 -0
  39. package/skills/ultra-change/scripts/validate_primary_transfer.cjs +1928 -0
  40. package/skills/ultra-delegate/SKILL.md +38 -5
  41. package/skills/ultra-delegate/references/delegation-contract.md +21 -1
  42. package/skills/ultra-deliver/SKILL.md +123 -44
  43. package/skills/ultra-deliver/references/baseline-reconciliation.md +5 -3
  44. package/skills/ultra-dev/SKILL.md +173 -43
  45. package/skills/ultra-grilling/SKILL.md +19 -16
  46. package/skills/ultra-grilling/references/reframing.md +7 -3
  47. package/skills/ultra-init/SKILL.md +99 -87
  48. package/skills/ultra-init/references/brownfield-adoption.md +23 -40
  49. package/skills/ultra-init/scripts/init_project.cjs +968 -21
  50. package/skills/ultra-plan/SKILL.md +83 -46
  51. package/skills/ultra-plan/references/task-evidence-v2.md +300 -0
  52. package/skills/ultra-plan/scripts/validate_task_evidence.cjs +859 -0
  53. package/skills/ultra-research/SKILL.md +119 -68
  54. package/skills/ultra-research/references/{03-competitive-landscape.md → 03-alternatives.md} +6 -6
  55. package/skills/ultra-research/references/04-product-strategy.md +11 -2
  56. package/skills/ultra-research/references/21-features-scope.md +8 -0
  57. package/skills/ultra-research/references/22-success-metrics.md +9 -4
  58. package/skills/ultra-research/references/99-synthesis.md +25 -1
  59. package/skills/ultra-research/references/north-star-v2.md +168 -0
  60. package/skills/ultra-research/references/wayfinding.md +50 -0
  61. package/skills/ultra-research/scripts/validate_north_star.cjs +1174 -0
  62. package/skills/ultra-review/SKILL.md +201 -24
  63. package/skills/ultra-review/references/adversarial-evaluation.md +31 -0
  64. package/skills/ultra-review/references/spec.md +5 -0
  65. package/skills/ultra-review/references/unified-schema.md +146 -11
  66. package/skills/ultra-review/references/worker-packet.md +151 -8
  67. package/skills/ultra-review/scripts/review_wait.py +2653 -63
  68. package/skills/ultra-status/SKILL.md +146 -32
  69. package/skills/ultra-tdd/SKILL.md +14 -4
  70. package/skills/ultra-tdd/references/test-execution.md +6 -1
  71. package/skills/ultra-test/SKILL.md +157 -15
  72. package/skills/ultra-test/scripts/validate_review_transport.cjs +549 -0
  73. package/skills/ultra-test/scripts/worktree_digest.cjs +551 -29
  74. package/skills/ultra-think/SKILL.md +5 -10
  75. package/skills/ultra-think/references/interaction-boundary.md +2 -1
package/bin/install.js CHANGED
@@ -4,13 +4,13 @@
4
4
  * ultra-builder-pro-cli — multi-runtime installer.
5
5
  *
6
6
  * Distributes fourteen Skills and five hooks to Claude Code, OpenCode, Codex CLI,
7
- * Kimi Code, and Grok Build through runtime-specific adapters under adapters/.
7
+ * Kimi Code, Grok Build, and ZCode through runtime-specific adapters under adapters/.
8
8
  * Install is idempotent and atomic; uninstall removes only managed assets.
9
9
  *
10
10
  * Usage:
11
11
  * npx ultra-builder-pro-cli [options]
12
12
  *
13
- * --claude / --opencode / --codex / --kimi / --grok select runtime(s)
13
+ * --claude / --opencode / --codex / --kimi / --grok / --zcode select runtime(s)
14
14
  * --all install to all supported runtimes
15
15
  * -g, --global install to runtime's global config dir
16
16
  * -l, --local project scope where the host supports it
@@ -57,7 +57,7 @@ function printBanner() {
57
57
  paint('cyan', ' ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝╚══════╝╚═╝'),
58
58
  '',
59
59
  ` ${paint('bold', 'Ultra Builder Pro CLI')} ${paint('dim', 'v' + pkg.version)}`,
60
- ` ${paint('dim', 'Multi-runtime installer for Claude Code, OpenCode, Codex, Kimi Code, and Grok Build')}`,
60
+ ` ${paint('dim', 'Multi-runtime installer for Claude Code, OpenCode, Codex, Kimi Code, Grok Build, and ZCode')}`,
61
61
  '',
62
62
  ];
63
63
  console.log(banner.join('\n'));
@@ -72,6 +72,7 @@ function printHelp() {
72
72
  ${paint('cyan', '--codex')} Codex CLI (OpenAI)
73
73
  ${paint('cyan', '--kimi')} Kimi Code (Moonshot AI)
74
74
  ${paint('cyan', '--grok')} Grok Build (xAI)
75
+ ${paint('cyan', '--zcode')} ZCode (Z.AI)
75
76
  ${paint('cyan', '--all')} all supported runtimes
76
77
 
77
78
  ${paint('yellow', 'Scope:')}
@@ -90,7 +91,7 @@ function printHelp() {
90
91
  ${paint('dim', '# Install to Claude Code globally')}
91
92
  npx ultra-builder-pro-cli --claude --global
92
93
 
93
- ${paint('dim', '# Install all five native plugins in their user scopes')}
94
+ ${paint('dim', '# Install all six native plugins in their user scopes')}
94
95
  npx ultra-builder-pro-cli --all --global
95
96
 
96
97
  ${paint('dim', '# Uninstall from OpenCode')}
@@ -102,6 +103,9 @@ function printHelp() {
102
103
  ${paint('dim', '# Install to Grok Build globally')}
103
104
  npx ultra-builder-pro-cli --grok --global
104
105
 
106
+ ${paint('dim', '# Install to ZCode globally')}
107
+ npx ultra-builder-pro-cli --zcode --global
108
+
105
109
  ${paint('dim', '# Verify all host installations without changing them')}
106
110
  npx ultra-builder-pro-cli --all --global --doctor
107
111
  `);
@@ -129,6 +133,7 @@ function parseArgs(argv) {
129
133
  case '--codex': runtimes.add('codex'); break;
130
134
  case '--kimi': runtimes.add('kimi'); break;
131
135
  case '--grok': runtimes.add('grok'); break;
136
+ case '--zcode': runtimes.add('zcode'); break;
132
137
  case '--all':
133
138
  SUPPORTED_RUNTIMES.forEach(r => runtimes.add(r));
134
139
  break;
@@ -213,13 +218,13 @@ async function main() {
213
218
  if (flags.json && !flags.doctor) bail('--json is available only with --doctor');
214
219
 
215
220
  if (runtimes.length === 0) {
216
- bail('no runtime selected; use --claude / --opencode / --codex / --kimi / --grok / --all');
221
+ bail('no runtime selected; use --claude / --opencode / --codex / --kimi / --grok / --zcode / --all');
217
222
  }
218
223
 
219
224
  const scope = resolveScope(flags);
220
225
  const repoRoot = path.resolve(__dirname, '..');
221
226
  const configDir = flags.configDir ? expandTilde(flags.configDir) : null;
222
- const userScopedOnly = runtimes.filter((runtime) => ['kimi', 'grok'].includes(runtime));
227
+ const userScopedOnly = runtimes.filter((runtime) => ['kimi', 'grok', 'zcode'].includes(runtime));
223
228
  if (scope === 'local' && !configDir && userScopedOnly.length) {
224
229
  bail(`${userScopedOnly.join(', ')} plugins are user-scoped by their hosts; use --global or an isolated --config-dir`);
225
230
  }
@@ -1,17 +1,20 @@
1
1
  # Ultra Builder Pro architecture
2
2
 
3
- Ultra Builder Pro v0.26 is a file-first workflow asset package for five coding-agent
4
- hosts. Its architecture is deliberately asymmetric: the host model owns meaning and
5
- strategy; Ultra mechanizes only portable prompts, observable files, bounded effects,
6
- and recovery.
3
+ Ultra Builder Pro is a file-first workflow asset package for six coding-agent hosts,
4
+ implementing the provider-neutral **Ultra Core Protocol**: cognitive alignment,
5
+ per-fact authority, explicit work-package grants, typed evidence, bounded effects,
6
+ checkpoints, and terminal review convergence — carried entirely by Skills,
7
+ owner-readable files, Git, host adapters, and optional Hooks. The host model owns
8
+ meaning and strategy; Ultra mechanizes only portable prompts, observable files,
9
+ bounded effects, and recovery.
7
10
 
8
11
  ## System boundary
9
12
 
10
13
  ```text
11
14
  Owner request
12
- │ explicit selection
15
+ │ explicit selection or verified execution grant (session-local / durable)
13
16
  ▼
14
- User-invoked Skill ──────── recommends next public route and stops
17
+ User-invoked Skill ──────── stops at the next owner boundary
15
18
  │
16
19
  ├── model-invoked disciplines (reasoning methods)
17
20
  ├── source / tests / runtime / primary documentation
@@ -35,23 +38,66 @@ Fourteen `skills/*/SKILL.md` files carry the workflow:
35
38
  - one read-only router.
36
39
 
37
40
  The exact allowlists live in `adapters/_shared/runtime-assets.cjs`. Public workflows
38
- never invoke another public workflow. They may use model-invoked disciplines and then
39
- recommend the next owner route.
41
+ are explicit by default. The narrow exception is an accepted Change-scoped `Execution
42
+ Grant` in one of two modes. `session-local`: Research, Plan, Dev, Test, and Deliver
43
+ reconciliation may be selected by the model only while the same session still contains
44
+ the owner's activation and approved task ledger; once that conversation activation is
45
+ lost, the work stops. `durable work-package`: a fresh Agent or host may continue one
46
+ exact work package, but only after stably verifying the recorded grant. Stored text
47
+ alone grants nothing, and neither mode grants finalization or archive; owner
48
+ checkpoints, final delivery effects, and every external effect still stop.
49
+
50
+ Research's seventeen references are workflow-owned semantic lenses. Its optional
51
+ `wayfinding.md` maps a multi-lens question without becoming a new Skill or authority.
52
+ The reusable mechanics remain separate: Grilling owns the interaction loop, Think owns
53
+ one consequential decision, and Domain Modeling owns vocabulary promotion.
40
54
 
41
55
  ### Authority plane
42
56
 
43
57
  Canonical semantic authority consists of:
44
58
 
45
- - `.ultra/north-star.md` for owner wording and hard constraints;
59
+ - `.ultra/project-brief.md` for raw owner intake and the initial outline;
60
+ - `.ultra/north-star.md` for the accepted direction, outcome or metric decision, hard
61
+ constraints, and exclusions established by Research;
46
62
  - `.ultra/specs/*.md` for product, architecture, discovery, and research distillate;
47
- - `.ultra/changes/{active,archive}/<id>/intent.md` for bounded outcomes;
48
- - `.ultra/tasks.json` plus each task's `context_file`;
49
- - `.ultra/decisions/*.md`, `.ultra/evidence/`, `.ultra/test-report.json`, and research;
63
+ - `.ultra/changes/{active,archive,abandoned}/<id>/intent.md` for bounded outcomes, North
64
+ Star Trace, and a required Execution Grant (`session-local` and inert without current-
65
+ session activation by default) with one stable id across directory moves;
66
+ - append-only `.ultra/tasks.json` v2 rows carrying `change_id` and the sole task status,
67
+ plus each task's status-free `context_file`;
68
+ - `.ultra/decisions/*.md`, typed `.ultra/evidence/`, `.ultra/test-report.json`, and research;
50
69
  - repository-root `CONTEXT.md` for ubiquitous language;
51
70
  - Git for revision identity, history, moves, diff, and rollback.
52
71
 
53
72
  Each semantic fact has one canonical representation. A summary can point to authority,
54
73
  but cannot become a second authority merely because it is convenient to read.
74
+ Task status therefore lives only in `.ultra/tasks.json`. Legacy context Status and
75
+ Complexity fields are migration observations; readers report them and the ledger wins.
76
+ Current task evidence uses `ultra-task-evidence-v2`, whose typed command, inspection,
77
+ owner-judgment, and external-observation entries retain distinct authorities. Only the
78
+ owner can supply an owner-judgment result. Structural validators report exact facts and
79
+ never decide semantic acceptance. Command and external evidence store a safe
80
+ repository-relative raw ref plus `raw_evidence_sha256`; structural validation does not
81
+ open that ref. Dev binds bounded stable ordinary non-symlink receipt bytes before record
82
+ publication, while Test, Status, and Deliver recheck the raw digest and then the exact
83
+ record `evidence_digest`. The product-worktree digest excludes `.ultra/evidence/**`, so
84
+ evidence publication cannot invalidate the freshness value it records.
85
+
86
+ One primary host model writes this authority in a worktree. Native subagents are
87
+ read-only sensors; delegated CLIs write isolated non-`.ultra` roots and return receipts.
88
+ Sequential Changes share the ledger by stable id, while current readers filter by the
89
+ one unique active Change. This keeps concurrency explicit in Git instead of adding a
90
+ semantic lock service or workflow engine. When the canonical writer itself changes
91
+ Agent, an owner-granted primary transfer moves the role exclusively — a derived
92
+ OFFER binding canonical refs/hashes, HEAD, and worktree digest; a receiver ACK that
93
+ is ready only on full stable-read match; sole-writer execution; a frozen terminal
94
+ RESULT — with receipts under `.ultra/.runtime/handoffs/` kept as rebuildable
95
+ observations and delegated workers never acquiring canonical write authority
96
+ (`skills/ultra-change/references/primary-transfer.md`).
97
+
98
+ Autonomous coding uses the host's existing model-tool loop, one canonical writer, and
99
+ the same task/evidence/review files. Ultra adds no persisted route position: budgets are
100
+ hard ceilings, while the model interprets whether acceptance and stop conditions hold.
55
101
 
56
102
  ### Adaptation plane
57
103
 
@@ -63,14 +109,14 @@ but cannot become a second authority merely because it is convenient to read.
63
109
  - atomic managed installation, provenance, doctor, and uninstall behavior.
64
110
 
65
111
  `adapters/_shared/plugin-core.cjs` owns the common copy and managed-publication
66
- mechanics. `host-profile.cjs` owns the five non-interactive delegation argv contracts.
112
+ mechanics. `host-profile.cjs` owns the six non-interactive delegation argv contracts.
67
113
  Adapters never rewrite workflow meaning.
68
114
 
69
115
  ### Why the old Agents are Skill assets now
70
116
 
71
117
  The retired custom-agent files did not own product authority. They contained reusable
72
118
  review lenses, debugging, test execution, and review coordination. v0.26 keeps those
73
- methods on the common surface all five hosts actually share:
119
+ methods on the common surface all six hosts actually share:
74
120
 
75
121
  - six review workers map to `ultra-review/references/{code,design,errors,tests,spec,comments}.md`;
76
122
  - review coordination and the former general code reviewer map to the parent
@@ -85,9 +131,14 @@ the parent model runs the same references sequentially.
85
131
  ### Observation plane
86
132
 
87
133
  Five hooks read canonical files and emit bounded context or observations. Their output
88
- under `.ultra/.runtime/`, `.ultra/progress/`, or `.ultra/reviews/` is derived and
89
- disposable. The dangerous-command hook is the only hard effect guard; it classifies a
90
- small named destructive set and provides an exact-command authorization repair.
134
+ under `.ultra/.runtime/` and `.ultra/progress/`, and review artifacts under
135
+ `.ultra/reviews/`, are derived rather than semantic authority. A current strict review
136
+ session contains `WORKER-PACKET.json`, `ADMISSION.json`, every selected specialist
137
+ artifact, and `SUMMARY.json`; retain it until aggregate Test and Deliver have both consumed it
138
+ successfully, then it may be garbage-collected. Premature loss requires a fresh Review
139
+ and Test; never reconstruct the old receipt. The dangerous-command hook is the only
140
+ hard effect guard; it classifies a small named destructive set and provides an
141
+ exact-command authorization repair.
91
142
  Additive protected-branch publication remains advisory when portable host wiring cannot
92
143
  project a trusted owner-approval receipt; history rewrites and branch deletion remain
93
144
  guarded.
@@ -95,15 +146,20 @@ guarded.
95
146
  ## Completion and recovery
96
147
 
97
148
  An operation is complete only when its accepted user outcome works through the real
98
- public seam. Route/schema/UI shells, local unit green, or an edited task status are not
99
- end-to-end evidence by themselves.
149
+ public seam. Route/schema/UI shells, local unit green, or an edited ledger status are not
150
+ end-to-end evidence by themselves. A task remains `in_progress` through its task review;
151
+ only after blocking findings are resolved or authoritatively dispositioned and affected
152
+ v2 evidence is refreshed may the primary model write `completed` to the ledger.
100
153
 
101
154
  Every user Skill starts by reading:
102
155
 
103
- 1. `.ultra/tasks.json`;
104
- 2. the unfinished task's `context_file` and closing `## Resume Note`;
105
- 3. `CONTEXT.md` and relevant decisions;
106
- 4. the active Change, specifications, evidence, and current Git state.
156
+ 1. zero or one active `change_id`, diagnosing more than one;
157
+ 2. `.ultra/tasks.json` tasks whose `change_id` matches it, treating that ledger as the
158
+ sole task-status authority;
159
+ 3. the matching frontier task's `context_file` and closing `## Resume Note`;
160
+ 4. `CONTEXT.md` and relevant decisions;
161
+ 5. the active Change, specifications, current v2 task evidence and retained task-review
162
+ provenance, and current Git state.
107
163
 
108
164
  That same sequence works after compaction, a fresh process, disabled hooks, or a host
109
165
  change. Compact snapshots can accelerate recovery but never outrank the source files.
@@ -112,10 +168,13 @@ change. Compact snapshots can accelerate recovery but never outrank the source f
112
168
 
113
169
  Three independent Skills protect the vertical path:
114
170
 
115
- 1. `ultra-plan` confirms seams and rejects horizontal feature tasks.
171
+ 1. `ultra-plan` records model-selected technical seams, asks the owner only for a
172
+ public-contract or material trade-off, and rejects horizontal feature tasks.
116
173
  2. `ultra-dev` records six separate evidence dimensions, including real persistence,
117
174
  default-on behavior, vertical execution, and spec trace.
118
- 3. `ultra-test` searches exports for real consumers and exercises the primary flow.
175
+ 3. `ultra-test` searches exports for real consumers, exercises the primary flow, and
176
+ binds the result to Change id, task ids, intent, HEAD, product-worktree digest, exact
177
+ raw receipt SHA-256 values, and the containing task-evidence digests.
119
178
 
120
179
  These are independent sensors. None rewrites a finding into product truth.
121
180
 
@@ -131,9 +190,34 @@ schema-constrained final response; the Node worker validates `finished`, `blocke
131
190
  writes its own receipt; stdout, stderr, native final output, and the launch receipt
132
191
  remain diagnostic files.
133
192
 
193
+ The instruction binds the active `change_id` and one of three semantic scopes: task
194
+ execution/continuation, scoped Research evidence, or aggregate Change
195
+ review/verification. Only task execution requires a task row. The read-only Research
196
+ and aggregate scopes preserve the same process boundary without inventing work merely
197
+ to make delegation reachable.
198
+
134
199
  Delegation does not grant authority or copy semantic state into another store. The
135
200
  worker reads and writes the same repository files in the specified worktree.
136
201
 
202
+ ## Optional Graph/Loop control plane
203
+
204
+ Long-running, multi-Agent, cross-Host work can justify an external coordination
205
+ layer (for example a LoopX-style kernel) that owns goal/todo identity, claims and
206
+ leases, attention queues, quotas, human-gate records, handoff receipts, and
207
+ append-only run/effect observations. Such a layer is **optional and currently not
208
+ integrated**: no adapter, dependency, daemon, or scaffold for one ships in this
209
+ package, and the Ultra Core Protocol remains fully usable on files plus Git with
210
+ every optional layer absent.
211
+
212
+ The boundary is fixed regardless of future integration: the control plane may
213
+ observe and coordinate — it may never own the North Star, product meaning,
214
+ acceptance, semantic severity, architecture or scope decisions, a "quality is
215
+ sufficient" verdict, or the authority to start an unauthorized Agent. Enabling it
216
+ requires a real coordination problem the owner accepts (multi-session parallel
217
+ frontiers, claim/write conflicts, long external waits, explicit quotas, cross-Host
218
+ handoff) plus an adapter with a live consumer; deleting or disabling it must always
219
+ leave canonical project truth and human recovery intact.
220
+
137
221
  ## Deliberate absences
138
222
 
139
223
  The architecture does not include:
@@ -1,7 +1,10 @@
1
1
  # Ultra artifact authority
2
2
 
3
3
  This document defines which project artifacts carry semantic authority, who may change
4
- them, how staleness is detected, and how recovery works in Ultra Builder Pro v0.26.
4
+ them, how staleness is detected, and how recovery works in Ultra Builder Pro. Since the
5
+ accepted 3.0 design it is the per-fact expression of the Ultra Core Protocol: one
6
+ canonical representation per semantic fact, explicit authorization, bounded effects,
7
+ and reachable recovery, on files plus Git alone.
5
8
 
6
9
  ## Rules
7
10
 
@@ -10,50 +13,200 @@ them, how staleness is detected, and how recovery works in Ultra Builder Pro v0.
10
13
  3. The model may interpret, decompose, investigate, and edit inside the authorized frame.
11
14
  4. Generated observations are disposable and never silently promoted.
12
15
  5. Git supplies revision identity, history, archive moves, comparison, and rollback.
16
+ 6. A Change keeps one stable `change_id`; directory position records lifecycle, not identity.
17
+
18
+ ## Routing precedence
19
+
20
+ When workflow-route signals conflict, consumers resolve them in this order:
21
+
22
+ 1. the current explicit owner instruction, accepted decisions, and external-effect
23
+ authorization;
24
+ 2. the current accepted North Star and the active Change intent;
25
+ 3. the current owner-issued Execution Grant — `session-local` while its conversation
26
+ activation is live, or a `durable work-package` grant a fresh Agent has stably
27
+ verified — its scope, budget, and allowed workflows;
28
+ 4. the task ledger, task acceptance, planned paths, and dependencies;
29
+ 5. the current validated Review SUMMARY verdict;
30
+ 6. current evidence and Test observations;
31
+ 7. the Resume Note;
32
+ 8. Hooks, progress records, compact snapshots, historical reviews, and other
33
+ derived observations.
34
+
35
+ A lower layer never overrides a higher one. A conflict produces a typed diagnostic,
36
+ preserves the original bytes, and routes to the nearest repair or owner checkpoint;
37
+ nothing silently selects the "safer" semantic result. The Resume Note is
38
+ navigational context — the current checkpoint, the next action a higher authority
39
+ has already allowed, unresolved prerequisites, and the cheapest safe resume command
40
+ or path — and never route authority: it cannot rewrite acceptance, a Review verdict,
41
+ scope, or budget, and it cannot promote P2/P3 findings into blockers or reopen a
42
+ review that returned a current verdict. Historical reviews, progress records, and
43
+ Hook observations are provenance only.
44
+
45
+ A formal terminal outcome — an accepted result, an owner decision, an external
46
+ blocker, a review-budget stop, or an abandonment — outranks every Resume, Hook, or
47
+ Status suggestion that appears to continue the same work. Review stays inside the
48
+ budget accepted for the work package, under one precedence rule: an exact current
49
+ owner grant overrides the versioned product default — the released default is one
50
+ initial Review plus two P0/P1 delta Reviews. Budget exhaustion with a remaining
51
+ blocker returns the choice to the owner instead of another round; no Agent,
52
+ reviewer, Hook, or control plane extends a budget itself, and the same root
53
+ surviving three failed fixes stops point-patching and reports an architecture
54
+ problem.
55
+
56
+ ## Effect classes
57
+
58
+ Every action belongs to exactly one class, and the class fixes who may perform it:
59
+
60
+ | Effect class | Examples | Default rule |
61
+ |---|---|---|
62
+ | `observation` | read-only source inspection, search, test listing | an Agent may act freely inside its task scope |
63
+ | `local-reversible` | editing files inside the authorized worktree, running local tests, creating deletable temporary files | allowed inside an accepted work package with a recovery point |
64
+ | `canonical-authority` | modifying the North Star, an active intent, task status, or an evidence verdict | one designated writer per fact; material semantic deltas return to the owner |
65
+ | `external-or-irreversible` | commit, push, tag, publish, deploy, real installation, provider spend, credential or production mutation | one separate owner authorization per effect; capability or readiness never implies permission |
66
+
67
+ A durable work-package grant may cover exact `local-reversible` execution and the
68
+ canonical status writes it names explicitly. It never inherits
69
+ `external-or-irreversible` effects by default; those require the owner to list each
70
+ one in the grant and the consuming Agent to verify the listing is current.
71
+
72
+ ## Owner checkpoint semantics
73
+
74
+ Every owner-facing checkpoint — the WIP at a stop, a task's closing Resume Note, a
75
+ delivery report, or a review's owner handoff — answers eight fixed semantics, in
76
+ whatever length keeps the owner able to judge:
77
+
78
+ 1. **Why** — the real problem being solved.
79
+ 2. **Outcome** — what difference the owner will see.
80
+ 3. **Accepted boundary** — what is accepted, and what explicitly is not.
81
+ 4. **Delta** — what materially changed since the last checkpoint.
82
+ 5. **Reality** — how far the live path actually works; what is still fake, unknown,
83
+ or unverified.
84
+ 6. **Decision needed** — what the owner must decide now; omit the section when
85
+ nothing is genuinely blocking.
86
+ 7. **Next bounded action** — the smallest authorized next step.
87
+ 8. **Not done** — what remains owed when stopping or pausing.
88
+
89
+ A checkpoint is a cognitive interface, not a mechanical stage marker: no line count,
90
+ token budget, or coverage percentage gates it, and alignment failure ("I don't know
91
+ what you are doing", or the same concept re-explained repeatedly) stops execution and
92
+ review until the owner re-accepts an outcome.
13
93
 
14
94
  ## Canonical artifacts
15
95
 
16
96
  | Artifact | Canonical content | Primary writer | Required readers | Staleness or conflict signal |
17
97
  |---|---|---|---|---|
18
- | `.ultra/north-star.md` | Owner's one-line goal and hard constraints | `ultra-init`, owner | every workflow; session Hook | owner correction or explicit replacement |
19
- | `.ultra/specs/product.md` | Product behavior and acceptance | research/change/delivery reconciliation | change, plan, dev, test, review, delivery | source/evidence conflict or unresolved marker |
20
- | `.ultra/specs/architecture.md` | Boundaries, authority, consumers, failure and recovery | research/change/delivery reconciliation | change, plan, dev, test, review, delivery | live-path evidence conflicts with text |
21
- | `.ultra/specs/discovery.md` | observations, unknowns, drift, and evidence queue | init/research | research, change, status | evidence resolves or overturns an entry |
98
+ | `.ultra/project-brief.md` | Raw owner intake, broad outline, explicit inputs, and open Research questions | `ultra-init`, owner correction | research, status; session Hook before an accepted baseline exists | owner correction or a recovered legacy one-line; never rewritten as researched truth |
99
+ | `.ultra/north-star.md` | Accepted project direction, outcome or metric decision, hard constraints, and exclusions | `ultra-research` after owner acceptance; owner correction | every workflow; session Hook | accepted correction, superseding decision, or evidence conflict |
100
+ | `.ultra/specs/product.md` | Product behavior and acceptance | research establishes; change/delivery reconcile touched sections | change, plan, dev, test, review, delivery | source/evidence conflict or unresolved marker |
101
+ | `.ultra/specs/architecture.md` | Boundaries, authority, consumers, failure and recovery | research establishes; change/delivery reconcile touched sections | change, plan, dev, test, review, delivery | live-path evidence conflicts with text |
102
+ | `.ultra/specs/discovery.md` | observations, unknowns, drift, and evidence queue | research; change for its scoped delta | research, change, status | evidence resolves or overturns an entry |
22
103
  | `.ultra/specs/research-distillate.md` | bounded synthesis of specification state | `ultra-research` | change, plan, delivery | stored source blob hash differs from Git blob hash |
23
- | `CONTEXT.md` | ubiquitous language and relationships | `ultra-domain-modeling` | every workflow and test naming | source/product use reveals ambiguity |
24
- | `.ultra/changes/active/<id>/intent.md` | one bounded requested outcome | `ultra-change`; Planning Posture by `ultra-plan` | plan, dev, test, review, status, delivery | acceptance or scope changes |
25
- | `.ultra/tasks.json` | task identity, graph, status, trace, and context path | `ultra-plan` / `ultra-dev` | every user workflow and context Hook | ledger and context status disagree |
26
- | task `context_file` | acceptance, seams, implementation, evidence pointers, Completion, Resume Note | plan/dev | dev, test, review, status, delivery, resume | differs from ledger or current implementation |
104
+ | `CONTEXT.md` | ubiquitous language and relationships | `ultra-domain-modeling`, first called by research and later by any qualifying workflow | every workflow and test naming | source/product use reveals ambiguity |
105
+ | `.ultra/changes/{active,archive,abandoned}/<id>/intent.md` | one bounded requested outcome, reconciliation, Research Disposition, stable identity, and exact Abandonment closure when abandoned | `ultra-change`; Planning Posture by `ultra-plan` | active: research through delivery; all states: status and future Change history | more than one active Change, duplicate id across positions, missing Abandonment closure, or acceptance/scope change |
106
+ | `.ultra/tasks.json` | `ultra-task-ledger-v2`: append-only task identity, stable `change_id`, same-Change graph, sole task status, trace, and context path | `ultra-plan` / `ultra-dev` | every user workflow and context Hook | dependency crosses Change, row shape is invalid, or a named context cannot be resolved |
107
+ | task `context_file` | typed acceptance, seams, implementation, evidence pointers, Completion, Task Review, Resume Note; no v2 task status | plan/dev | dev, test, review, status, delivery, resume | acceptance identity, evidence pointer, or implementation differs from current source; a legacy Status or Complexity field is a migration diagnostic |
27
108
  | `.ultra/decisions/<id>.md` | durable consequential owner decision | `ultra-think` after acceptance | every workflow in scope | superseded by a newer decision file |
28
- | `.ultra/evidence/<task-id>/...` | command output and bounded task evidence | `ultra-dev` | review, test, delivery | evidence revision differs from affected code |
29
- | `.ultra/test-report.json` | whole-system audit at one Git commit and worktree digest | `ultra-test` | status and delivery | `git_commit` or worktree digest differs from current checkout |
109
+ | active Change `## Execution Grant` | the current work package's execution authorization: mode (`session-local` default or `durable work-package`), scope, Agent topology, allowed local effects, budgets/expiry, invalidation, and revoke; the exact durable grant bytes live in the cited owner decision, never in a second prose mirror | owner issues; `ultra-change` records the exact reference and fields; no workflow may widen it | executor, handoff, Status | a new Change, a recorded owner revocation, or a fired invalidation condition; stored grant text alone never activates |
110
+ | `.ultra/evidence/<task-id>/...` | one final `ultra-task-evidence-v2` record: typed acceptance evidence, six dimensions, independent completion-snapshot freshness observation, separate task-review provenance, raw-output refs, and limitations | `ultra-dev` after validated task review | test, delivery; review consumes actual pre-review evidence instead | context acceptance, completion observation, cited artifacts, or review binding differs, or a legacy record has not been migrated |
111
+ | `.ultra/test-report.json` | whole-system audit, ordered task-evidence identities, strict aggregate-review provenance, findings, and owner disposition for one Change/task/intent/product snapshot | `ultra-test`; `ultra-deliver` may add owner disposition without changing findings or `passed` | status and delivery | root identity, ordered task-evidence projection, or packet/admission/subject/summary review binding differs |
30
112
  | `.ultra/changes/active/<id>/delivery.md` | outcome, docs, verification, review, debt, risk, recovery, effects | `ultra-deliver` | owner and archived Change history | active evidence or accepted scope changes |
31
- | `.ultra/research/<run-id>/...` | cited investigation reports | `ultra-research` | specs, change, plan, delivery | newer sources or later superseding run |
113
+ | `.ultra/research/<run-id>/<step-id>.md` | cited investigation report for one selected lens | `ultra-research` | specs, change, plan, delivery | newer sources or later superseding run |
32
114
 
33
115
  The repository files may use prose, tables, or JSON as appropriate. The format is not
34
116
  authority by itself; the canonical path and accepted writer contract are.
35
117
 
36
- Every completed task has exactly one `.ultra/evidence/<task-id>/evidence.json` with
37
- schema `ultra-task-evidence-v1`. It records `task_id`, forty-character `git_head`, exact
38
- commands (`command`, `exit_code`, `evidence_ref`), all six evidence dimensions,
39
- artifact paths, limitations, and timestamp. Each dimension uses `status` of
40
- `satisfied`, `gap`, or `not_applicable`, plus `evidence_refs` and a non-empty rationale.
41
- Optional raw logs live beside that record; they do not create another summary.
118
+ The append-only task ledger preserves sequential Change history. Current readers select
119
+ only rows whose `change_id` matches the one unique active Change. Moving its directory
120
+ to archive or abandoned never rewrites task identity, and an unfinished historical row
121
+ never becomes current merely because of its status. Before an abandoned move,
122
+ `ultra-change` appends `## Abandonment` with the owner decision, reason, reusable
123
+ evidence, and recovery or successor. Future Change reconciliation and Status consume
124
+ that record as history, not as accepted current intent.
125
+
126
+ Every current completed task has exactly one final
127
+ `.ultra/evidence/<task-id>/evidence.json` with schema `ultra-task-evidence-v2`. The
128
+ canonical field and type contract lives in
129
+ `skills/ultra-plan/references/task-evidence-v2.md`; this document does not duplicate it.
130
+ The record binds the task and Change, context acceptance bytes, typed acceptance
131
+ evidence and dispositions, all six evidence dimensions,
132
+ task-review provenance, artifacts, limitations, and timestamp. `command`, `inspection`,
133
+ `owner-judgment`, and `external-observation` retain separate evidence authorities. The
134
+ owner alone supplies an owner-judgment result. The CLI establishes only JSON shape,
135
+ token syntax, and authority designation; it does not prove current identity, provenance,
136
+ freshness, or semantic acceptance. Test takes stable bytes independently, recomputes the
137
+ Acceptance-section SHA-256, aligns exact criterion IDs and verification types with the
138
+ current context, and aligns task-review session and summary digest with the retained strict summary. The `subject` is an independently captured completion-snapshot freshness observation made after the final strict task Review validates and immediately before
139
+ evidence publication. Its `task_review` separately binds the retained strict summary.
140
+ Worker Packet v1 and its summary's null `worktree_digest` do not prove or
141
+ cryptographically bind the completion subject. Test separately binds its report to the
142
+ current whole Change, then rechecks the current Acceptance, criterion IDs and verification
143
+ types, owner record, review summary, and cited affected artifacts instead of demanding
144
+ digest equality with the earlier task observation.
145
+ For `owner-judgment`, the durable owner record must exist and its cited statement and
146
+ disposition must remain readable. Any mismatch is an evidence gap returned to Dev or,
147
+ for missing owner judgment, to the owner. Optional raw logs live beside the record and
148
+ do not create another summary. Historical v1 records stay readable evidence but produce
149
+ a migration diagnostic and cannot satisfy a current Change's Test or Deliver input.
150
+
151
+ Task-review provenance has two discriminated branches with one authority rule: a
152
+ strict-v4 record binds its retained strict session artifacts, while an
153
+ `external-manual` record binds a real external-reviewer receipt under
154
+ `.ultra/evidence/<task-id>/` by exact stable bytes and SHA-256 through the task
155
+ evidence sensor's verify mode. The external receipt is a reconstructable observation
156
+ of reviewer identity, reviewed subject, verdict, and exact findings — never semantic
157
+ authority, never owner acceptance, and never a substitute strict
158
+ SUMMARY/ADMISSION/session. Consumers recheck whichever branch a record declares and
159
+ never rewrite one into the other.
42
160
 
43
161
  ## Mutable workflow state
44
162
 
45
163
  Pure file state uses three mechanisms:
46
164
 
47
165
  - directory position, such as `changes/active/` versus `changes/archive/`;
48
- - an explicit field, such as a task or context status;
166
+ - an explicit field, such as task status in `.ultra/tasks.json`;
49
167
  - an on-the-spot model judgment that is not persisted as state.
50
168
 
51
169
  A state field records a mechanically checkable fact. Route selection remains a model
52
170
  judgment. Do not add a workflow-position field merely to decide which Skill should run.
53
171
 
54
- Task completion uses a dual write: `.ultra/tasks.json` and the task context header must
55
- agree. The writer reads both back. A mismatch is a visible recovery diagnostic; neither
56
- side silently wins.
172
+ At most one Change is active in one worktree. Zero active Changes is valid before a new
173
+ request and after delivery; completed current tasks may remain active while awaiting
174
+ Test or Deliver. More than one active directory is a conflict for owner/model repair,
175
+ not a reason for code to select the first entry.
176
+
177
+ Task status has one writer and one authority: `.ultra/tasks.json`. New contexts carry no
178
+ Status field. A legacy context Status or Complexity header is preserved as a migration
179
+ diagnostic, but the ledger wins. During implementation the row remains `in_progress`.
180
+ Task-review admission uses that row, task context, an immutable review packet, and
181
+ actual pre-review evidence; it does not require the final record it is helping create.
182
+ After the final summary validates, Dev writes the one canonical evidence record with
183
+ every blocking finding, resolution or authoritative disposition, and affected evidence
184
+ refresh. Only after that record and the context review facts are current may the primary
185
+ model write `completed` to the ledger and read the row back. A validator may check this
186
+ ordering and its references; it cannot decide that a finding is semantically resolved.
187
+
188
+ Later invalidation uses one explicit recovery edge. The ledger-authoritative row changes
189
+ from `completed` to `in_progress`; Dev must never silently demote it. Before the write,
190
+ Dev records the affected criterion IDs and reason in the task context Change Log and Resume Note.
191
+ It preserves the old frozen review as history, then writes and reads back the ledger
192
+ transition. New evidence and review close the task again through the same path.
193
+
194
+ ## Single-writer boundary
195
+
196
+ One primary host model writes canonical `.ultra` files in a worktree. Native review
197
+ workers are read-only sensors, and delegated CLIs write only declared non-`.ultra`
198
+ roots in isolated registered worktrees; their findings return to the primary writer.
199
+ Parallel implementation uses separate worktrees and explicit Git integration. Ultra
200
+ does not add a lock service or semantic state machine to make concurrent canonical
201
+ writes appear safe.
202
+
203
+ The primary writer of a work package changes only through an owner-granted primary
204
+ transfer (`skills/ultra-change/references/primary-transfer.md`): a derived OFFER
205
+ binding canonical refs/hashes, HEAD, and worktree digest; a receiver ACK that is
206
+ ready only on full stable-read match; sole-writer execution; and a frozen terminal
207
+ RESULT. A delegated worker never becomes the canonical writer, and a delegation
208
+ receipt never serves as an ACK or RESULT. While an ACK-ready transfer is open, at
209
+ most that one receiver may write canonical files.
57
210
 
58
211
  ## Decisions and reductions
59
212
 
@@ -80,7 +233,18 @@ and provenance support the claim. The evidence is retained or cited; it is not c
80
233
  into a second semantic ledger.
81
234
 
82
235
  A test result is current only for the code and environment it exercised. A report must
83
- carry the exact command, exit code, and Git commit. Missing or stale evidence remains
236
+ carry the exact command, exit code, stable Change id, exact current task ids, intent
237
+ SHA-256, Git commit, product-worktree digest, ordered v2 task-evidence identities, and
238
+ strict aggregate-review packet, admission, subject, and summary bindings. Delivery
239
+ metadata and moving the same Change between active and archive do not alter the product
240
+ digest. The product-worktree digest has one fixed boundary: it excludes
241
+ `.ultra/evidence/**`, whose command and external-observation entries bind exact raw bytes
242
+ as `raw_evidence_sha256` before stable record bytes are bound as `evidence_digest`
243
+ through the ordered task-evidence projection. Test, Status, and Deliver independently
244
+ recompute both bindings from bounded stable repository-contained regular non-symlink
245
+ files; exact review receipts retain their own digest and consumer checks. No writer may
246
+ add a caller-selected exclusion. Changing intent bytes does alter `intent_digest`.
247
+ Missing or stale evidence remains
84
248
  `not_run`, `unknown`, or `stale`; it is never inferred as passing.
85
249
 
86
250
  ## Derived artifacts
@@ -89,26 +253,36 @@ These paths are intentionally non-authoritative:
89
253
 
90
254
  | Path | Purpose | Recovery |
91
255
  |---|---|---|
256
+ | `.ultra/research/<run-id>/brief.md` | optional Wayfinding question map for a multi-lens Research run | rebuild from Project Brief, accepted authority, evidence needs, and owner checkpoints |
92
257
  | `.ultra/.runtime/compact-snapshot.md` | compaction acceleration | rebuild from files and Git |
93
258
  | `.ultra/.runtime/delegations/` | delegated process receipts and logs | inspect result or rerun with new id |
259
+ | `.ultra/.runtime/handoffs/` | primary-transfer OFFER/ACK/RESULT receipts, plus the optional CLOSEOUT receipt of the one prescribed post-review closeout | create a fresh handoff id from canonical authority; never reconstruct an old ACK or RESULT; close out a newest completed v2 RESULT by publishing its CLOSEOUT receipt, never by refreshing the RESULT or opening a handoff for the closeout |
94
260
  | `.ultra/.runtime/worktrees/` | delegated checkout locations | inspect Git worktrees and remove safely |
95
261
  | `.ultra/progress/<task-id>.json` | mechanical evidence observations | rerun sensors or inspect current diff |
96
- | `.ultra/reviews/<session>/` | bounded lens packets and findings | rerun review at a named revision |
262
+ | `.ultra/reviews/<session>/` | `WORKER-PACKET.json`, `ADMISSION.json`, selected specialist artifacts, and `SUMMARY.json` | retain a current strict session through successful aggregate Test and Deliver consumption; after premature loss, run a fresh Review and Test and never reconstruct the old receipt |
97
263
 
98
264
  The canonical template's nested `.ultra/.gitignore` ignores `.runtime/`, `progress/`,
99
- and `reviews/` without rewriting the owner's repository-level ignore rules. Deleting
100
- those paths cannot delete accepted product intent, task contracts, or decisions.
265
+ and `reviews/` without rewriting the owner's repository-level ignore rules. A current
266
+ strict review session contains `WORKER-PACKET.json`, `ADMISSION.json`, every selected
267
+ specialist artifact, and `SUMMARY.json`; it may be garbage-collected only after aggregate Test and
268
+ Deliver have both consumed it successfully. Premature loss requires a fresh Review and
269
+ Test, never reconstruction of the old receipt. Subject to that retention window,
270
+ deleting derived paths cannot delete accepted product intent, task contracts, or
271
+ decisions.
101
272
 
102
273
  ## Recovery order
103
274
 
104
275
  After interruption or host change:
105
276
 
106
277
  1. identify the repository root and current `HEAD`;
107
- 2. read `.ultra/tasks.json`;
108
- 3. read the unfinished task's full context and closing Resume Note;
109
- 4. read `CONTEXT.md`, relevant decisions, active Change, specifications, and evidence;
278
+ 2. resolve zero or one active `change_id`, then read `.ultra/tasks.json`;
279
+ 3. select only matching tasks and read the frontier task's full context and closing Resume Note;
280
+ 4. read the Project Brief, accepted North Star, `CONTEXT.md`, relevant decisions, active
281
+ Change, specifications, and evidence;
110
282
  5. inspect the working tree and compare it with Completion and evidence claims;
111
- 6. repair any ledger/context mismatch explicitly before relying on status;
283
+ 6. rely only on ledger task status; preserve any legacy context Status or Complexity as
284
+ a migration diagnostic, and use the explicit recorded reopen before repairing an
285
+ invalid completed task's current v2 evidence or task-review bindings;
112
286
  7. continue through the next observable acceptance boundary.
113
287
 
114
288
  Hooks and the `ubp` executable may be unavailable. Recovery must still work through