ultra-builder-pro-cli 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/.ultra-template/docs/research/README.md +11 -7
  2. package/.ultra-template/specs/architecture.md +36 -36
  3. package/.ultra-template/specs/discovery.md +46 -33
  4. package/.ultra-template/specs/product.md +38 -29
  5. package/.ultra-template/specs/research-distillate.md +48 -0
  6. package/.ultra-template/tasks/contexts/TEMPLATE.md +11 -28
  7. package/CHANGELOG.md +77 -1
  8. package/README.md +46 -24
  9. package/adapters/_shared/codex-assets.cjs +6 -2
  10. package/adapters/_shared/file-ops.cjs +6 -2
  11. package/adapters/_shared/handbook.cjs +2 -1
  12. package/adapters/claude.js +3 -2
  13. package/adapters/codex.js +1 -0
  14. package/adapters/kimi.js +3 -2
  15. package/adapters/opencode.js +3 -2
  16. package/agents/review-coordinator.md +9 -6
  17. package/commands/ultra-change.md +1 -1
  18. package/commands/ultra-plan.md +1 -1
  19. package/commands/ultra-research.md +1 -1
  20. package/commands/ultra-think.md +2 -2
  21. package/docs/AGENT-CONTEXT.md +43 -19
  22. package/docs/ARCHITECTURE.md +54 -13
  23. package/docs/PLAN.zh-CN.md +4 -2
  24. package/docs/ROADMAP.md +10 -4
  25. package/docs/RUNTIME-COMPAT-MATRIX.md +4 -4
  26. package/docs/STATE-DB-ACCESS-POLICY.md +33 -29
  27. package/docs/USER-HANDBOOK-CONTRACT.md +8 -2
  28. package/docs/WORKFLOW-LIFECYCLE.md +342 -0
  29. package/hooks/README.md +6 -1
  30. package/hooks/health_check.py +12 -3
  31. package/hooks/subagent_tracker.py +52 -77
  32. package/mcp-server/hook-event.cjs +34 -0
  33. package/mcp-server/lib/archive-journal.cjs +17 -5
  34. package/mcp-server/lib/baseline-workflow.cjs +158 -18
  35. package/mcp-server/lib/change-workflow.cjs +598 -85
  36. package/mcp-server/lib/context-spine.cjs +305 -25
  37. package/mcp-server/lib/decision-dialogue.cjs +713 -0
  38. package/mcp-server/lib/doctor.cjs +42 -3
  39. package/mcp-server/lib/init-project.cjs +210 -16
  40. package/mcp-server/lib/plan-store.cjs +4 -1
  41. package/mcp-server/lib/pricing.cjs +7 -10
  42. package/mcp-server/lib/project-breadcrumb.cjs +15 -0
  43. package/mcp-server/lib/projector.cjs +57 -3
  44. package/mcp-server/lib/spec-learning.cjs +79 -2
  45. package/mcp-server/lib/state-db.cjs +168 -8
  46. package/mcp-server/lib/state-ops.cjs +160 -9
  47. package/mcp-server/lib/workflow-state.cjs +2305 -0
  48. package/mcp-server/server.cjs +215 -15
  49. package/orchestrator/daemon.cjs +1 -2
  50. package/orchestrator/dispatch-rules.cjs +5 -31
  51. package/orchestrator/planner/plan-builder.cjs +21 -12
  52. package/package.json +13 -3
  53. package/skills/ultra-change/SKILL.md +94 -80
  54. package/skills/ultra-change/references/change-contract.md +36 -0
  55. package/skills/ultra-deliver/SKILL.md +76 -79
  56. package/skills/ultra-deliver/references/baseline-reconciliation.md +20 -0
  57. package/skills/ultra-dev/SKILL.md +62 -59
  58. package/skills/ultra-doctor/SKILL.md +61 -82
  59. package/skills/ultra-init/SKILL.md +101 -103
  60. package/skills/ultra-init/references/brownfield-adoption.md +2 -2
  61. package/skills/ultra-plan/SKILL.md +99 -85
  62. package/skills/ultra-plan/references/semantic-preflight.md +18 -0
  63. package/skills/ultra-research/SKILL.md +102 -60
  64. package/skills/ultra-research/references/00-problem-validation.md +36 -0
  65. package/skills/ultra-research/references/01-opportunity-discovery.md +33 -0
  66. package/skills/ultra-research/references/02-market-assessment.md +30 -0
  67. package/skills/ultra-research/references/03-competitive-landscape.md +31 -0
  68. package/skills/ultra-research/references/04-product-strategy.md +32 -0
  69. package/skills/ultra-research/references/05-assumptions-validation.md +31 -0
  70. package/skills/ultra-research/references/10-user-personas.md +29 -0
  71. package/skills/ultra-research/references/11-user-scenarios.md +28 -0
  72. package/skills/ultra-research/references/20-user-stories.md +30 -0
  73. package/skills/ultra-research/references/21-features-scope.md +29 -0
  74. package/skills/ultra-research/references/22-success-metrics.md +28 -0
  75. package/skills/ultra-research/references/30-architecture-context.md +30 -0
  76. package/skills/ultra-research/references/31-solution-strategy.md +28 -0
  77. package/skills/ultra-research/references/32-building-blocks.md +28 -0
  78. package/skills/ultra-research/references/40-deployment.md +29 -0
  79. package/skills/ultra-research/references/41-quality-risks.md +28 -0
  80. package/skills/ultra-research/references/99-synthesis.md +35 -0
  81. package/skills/ultra-review/SKILL.md +63 -73
  82. package/skills/ultra-review/references/review-modes.md +27 -0
  83. package/skills/ultra-review/references/unified-schema.md +25 -0
  84. package/skills/ultra-review/scripts/review_wait.py +40 -3
  85. package/skills/ultra-status/SKILL.md +41 -41
  86. package/skills/ultra-test/SKILL.md +54 -55
  87. package/skills/ultra-think/SKILL.md +26 -12
  88. package/skills/ultra-think/references/decision-dialogue.md +130 -0
  89. package/skills/ultra-verify/SKILL.md +1 -1
  90. package/skills/ultra-verify/references/{confidence-system.md → evidence-status.md} +3 -3
  91. package/spec/cli-protocol.md +17 -3
  92. package/spec/mcp-tools.yaml +683 -64
  93. package/spec/schemas/baseline-reconciliation.v1.schema.json +73 -0
  94. package/spec/schemas/delivery-report.v1.schema.json +111 -0
  95. package/spec/schemas/mcp-tools.schema.json +1 -1
  96. package/spec/schemas/state-db.sql +140 -1
  97. package/spec/schemas/tasks.v4.5.schema.json +8 -1
  98. package/spec/schemas/test-report.v1.schema.json +194 -0
  99. package/ultra-tools/cli.cjs +1 -1
  100. package/ultra-tools/commands/migrate.cjs +3 -3
  101. package/ultra-tools/commands/status.cjs +228 -12
  102. package/.ultra-template/delivery-report.json +0 -9
  103. package/.ultra-template/test-report.json +0 -8
  104. package/adapters/_shared/tests/file-ops.test.cjs +0 -54
  105. package/adapters/_shared/tests/frontmatter.test.cjs +0 -47
  106. package/adapters/_shared/tests/handbook.test.cjs +0 -101
  107. package/adapters/_shared/tests/path-rewrite.test.cjs +0 -60
  108. package/adapters/_shared/tests/provenance.test.cjs +0 -133
  109. package/adapters/_shared/tests/resolve-target.test.cjs +0 -75
  110. package/adapters/_shared/tests/runtime-assets.test.cjs +0 -149
  111. package/adapters/_shared/tests/settings-merge.test.cjs +0 -85
  112. package/adapters/_shared/tests/validate.test.cjs +0 -30
  113. package/adapters/tests/claude.test.cjs +0 -138
  114. package/adapters/tests/codex-hook.test.cjs +0 -142
  115. package/adapters/tests/codex.test.cjs +0 -430
  116. package/adapters/tests/kimi-hook.test.cjs +0 -149
  117. package/adapters/tests/kimi.test.cjs +0 -259
  118. package/adapters/tests/opencode.test.cjs +0 -357
  119. package/mcp-server/lib/archive-journal.test.cjs +0 -35
  120. package/mcp-server/lib/baseline-workflow.test.cjs +0 -477
  121. package/mcp-server/lib/change-workflow.test.cjs +0 -971
  122. package/mcp-server/lib/context-spine.test.cjs +0 -93
  123. package/mcp-server/lib/doctor.test.cjs +0 -148
  124. package/mcp-server/lib/plan-store.test.cjs +0 -132
  125. package/mcp-server/lib/prd-parser.test.cjs +0 -82
  126. package/mcp-server/lib/project-breadcrumb.test.cjs +0 -112
  127. package/mcp-server/lib/runtime-state.test.cjs +0 -92
  128. package/mcp-server/lib/spec-learning.test.cjs +0 -67
  129. package/mcp-server/lib/state-db.test.cjs +0 -314
  130. package/mcp-server/lib/task-expander.test.cjs +0 -169
  131. package/mcp-server/lib/topo.test.cjs +0 -158
  132. package/mcp-server/tests/circuit-breaker.test.cjs +0 -125
  133. package/mcp-server/tests/commit-hash-flow.test.cjs +0 -117
  134. package/mcp-server/tests/concurrency-update.test.cjs +0 -96
  135. package/mcp-server/tests/concurrency.test.cjs +0 -112
  136. package/mcp-server/tests/db-ops.test.cjs +0 -121
  137. package/mcp-server/tests/init-project.test.cjs +0 -393
  138. package/mcp-server/tests/migrate.test.cjs +0 -232
  139. package/mcp-server/tests/projector.test.cjs +0 -162
  140. package/mcp-server/tests/server-contract.test.cjs +0 -1467
  141. package/mcp-server/tests/staleness.test.cjs +0 -190
  142. package/mcp-server/tests/state-db.test.cjs +0 -106
  143. package/mcp-server/tests/state-ops.test.cjs +0 -449
  144. package/mcp-server/tests/tagged-tasks.test.cjs +0 -163
  145. package/mcp-server/tests/telemetry.test.cjs +0 -219
  146. package/orchestrator/planner/plan-builder.test.cjs +0 -165
  147. package/orchestrator/tests/auto-merge.test.cjs +0 -216
  148. package/orchestrator/tests/daemon.test.cjs +0 -311
  149. package/orchestrator/tests/dispatch-rules.test.cjs +0 -124
  150. package/orchestrator/tests/parallel-orchestrator.test.cjs +0 -233
  151. package/orchestrator/tests/phase-8b-gate.test.cjs +0 -183
  152. package/orchestrator/tests/recovery.test.cjs +0 -190
  153. package/orchestrator/tests/session-runner.test.cjs +0 -314
  154. package/orchestrator/tests/skill-miner.test.cjs +0 -147
  155. package/orchestrator/tests/worktree-manager.test.cjs +0 -148
  156. package/skills/ultra-research/references/architecture.md +0 -38
  157. package/skills/ultra-research/references/problem-product.md +0 -39
  158. package/skills/ultra-research/references/quality-delivery.md +0 -34
  159. package/skills/ultra-research/references/synthesis.md +0 -38
  160. package/skills/ultra-research/references/users-scope.md +0 -40
  161. package/ultra-tools/legacy-memory.test.cjs +0 -80
  162. package/ultra-tools/status-command.test.cjs +0 -181
  163. package/ultra-tools/system-command.test.cjs +0 -309
package/README.md CHANGED
@@ -8,7 +8,7 @@ authoritative `.ultra/state.db`.
8
8
 
9
9
  <div align="center">
10
10
 
11
- [![Version](https://img.shields.io/badge/version-0.14.0-blue)](./CHANGELOG.md)
11
+ [![Version](https://img.shields.io/badge/version-0.16.0-blue)](./CHANGELOG.md)
12
12
  [![Tests](https://img.shields.io/badge/tests-passing-brightgreen)](#verification)
13
13
  [![License: MIT](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
14
14
  [![Node](https://img.shields.io/badge/node-%E2%89%A522-informational)](./package.json)
@@ -25,9 +25,14 @@ authoritative `.ultra/state.db`.
25
25
  Install and uninstall are symmetric on every supported host; `ubp --doctor`
26
26
  verifies the installed asset hashes and host entry points without mutation.
27
27
  - **Shares state across runtimes.** `.ultra/state.db` (SQLite + WAL) is the
28
- authoritative source for baselines, changes, tasks, sessions, events, incidents,
29
- projection jobs, and telemetry. `tasks.json` and context markdown are
28
+ authoritative source for baselines, changes, decision threads, workflows, tasks,
29
+ sessions, events, incidents, projection jobs, and telemetry. `tasks.json` and context markdown are
30
30
  generated projections, not handwritten.
31
+ - **Aligns the owner and agent without questionnaire overload.** The host resolves
32
+ observable facts first, then presents exactly one load-bearing decision with
33
+ evidence, a recommendation, credible alternatives, and the durable effect. The
34
+ normalized answer and owner-approved artifact checkpoint live in the DB; prompts
35
+ and transcripts do not. Matching workflows stop until that authority is current.
31
36
  - **Keeps memory ownership explicit.** Ultra Builder Pro does not collect
32
37
  prompts, transcripts, observations, summaries, or cross-session memory.
33
38
  Install cloud-mem/claude-mem separately if persistent memory is wanted.
@@ -35,10 +40,13 @@ authoritative `.ultra/state.db`.
35
40
  host derives task objects; `task.parse_prd` validates them → `lib/topo.cjs` waves →
36
41
  `.ultra/execution-plan.json` → parallel worktree sessions → auto-merge back.
37
42
  - **Keeps daily work convergent.** `/ultra-change` creates a bounded delta and
38
- Context Manifest v2; the Context Spine assigns a role/gate, verifies required
43
+ complete Change Contract, classifies risk, records whether bounded research is
44
+ required, and creates immutable Context Manifest v2 snapshots; the Context Spine assigns a role/gate, verifies required
39
45
  references, reports fresh-context budget pressure as advisory warnings, exposes one DB-derived breadcrumb, and
40
- routes a single next action. `/ultra-deliver` requires applied specification
41
- learning plus docs/test/two-axis review evidence before archive. `/ultra-doctor` reports incidents,
46
+ routes a single next action. Research stores typed, source-digested semantic records;
47
+ planning proves Change acceptance coverage; `/ultra-deliver` requires applied specification
48
+ learning plus docs/test/mode-bound two-axis review evidence and a schema-validated
49
+ baseline reconciliation manifest before archive. `/ultra-doctor` reports incidents,
42
50
  projection lag, orphan sessions, and backup-first mechanical recovery.
43
51
  Incident changes additionally require a five-section `diagnosis.md` covering
44
52
  reproduction, hypotheses, root cause, regression test, and recovery.
@@ -86,13 +94,22 @@ install or update.
86
94
  See [`docs/RUNTIME-COMPAT-MATRIX.md`](./docs/RUNTIME-COMPAT-MATRIX.md)
87
95
  for per-runtime capabilities.
88
96
 
89
- Start with `ultra-init` in both new and existing projects. An empty project opens
90
- a `draft` greenfield baseline. An existing codebase opens an `adopting`
91
- brownfield baseline; inspect current behavior, call `baseline.record`, then
92
- approve it through `baseline.converge` before normal planning or delivery. Existing
93
- active work may continue while adoption drift is visible. A new incident requires an
94
- explicit break-glass approver and leaves a blocking reconciliation gap at archive;
95
- new ordinary work always requires a healthy ready baseline.
97
+ Start with `ultra-init` in both new and existing projects. Auto classification is
98
+ based on delivered-system evidence: application source, tests, deployment, or
99
+ persisted-state/schema signals make a repository brownfield; a Git repository,
100
+ manifest, README, or starter documentation alone remains greenfield. An empty project
101
+ opens a `draft` greenfield baseline and an existing system opens an `adopting`
102
+ brownfield baseline. Both execute all seventeen research steps before
103
+ `baseline.record` and explicit `baseline.converge`; initialization never treats blank
104
+ templates as a trusted baseline and never selects an MVP. Existing active work may
105
+ continue only when its durable change workflow was bound to a healthy ready baseline;
106
+ the expected HEAD, worktree, spec, and source-evidence drift created by that change is
107
+ advisory until delivery reconciliation. Loss of approved-ready status or structural
108
+ baseline evidence blocks ordinary work. An incident requires an explicit break-glass
109
+ approver and leaves a blocking reconciliation gap at archive; new ordinary work always
110
+ requires a healthy ready baseline. See
111
+ [`docs/WORKFLOW-LIFECYCLE.md`](./docs/WORKFLOW-LIFECYCLE.md) for exact write,
112
+ transition, invalidation, and recovery semantics.
96
113
 
97
114
  ## Three-layer architecture
98
115
 
@@ -105,10 +122,11 @@ new ordinary work always requires a healthy ready baseline.
105
122
  The layers share one `.ultra/state.db`, but the CLI is not a mirror of every MCP
106
123
  tool: continuous change mutations are MCP-only and fail closed. See
107
124
  [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md) for the full contract and
108
- [`spec/cli-protocol.md`](./spec/cli-protocol.md) for the 36 live contracts.
109
- Review, impact discovery, skill resolution, and user interaction stay on each
110
- Host's native surfaces; the generated Codex capability map documents those
111
- replacements without advertising non-existent MCP tools.
125
+ [`spec/cli-protocol.md`](./spec/cli-protocol.md) for the 50 live contracts.
126
+ Review, impact discovery, skill resolution, and decision presentation stay on each
127
+ host's native surfaces; MCP stores normalized decision authority but never generates
128
+ questions. The generated Codex capability map documents those replacements without
129
+ advertising non-existent MCP tools.
112
130
 
113
131
  The package boundary is deliberate: twelve public Ultra workflow skills, four
114
132
  internal review-rule skills, host-specific collaboration companions, and the
@@ -138,10 +156,12 @@ ultra-tools task init-project --project-name myapp --mode auto
138
156
 
139
157
  # Projection-only projects from prior releases use one backup-first import:
140
158
  ultra-tools migrate --from=4.4 --to=4.5 --source-dir .
141
- ultra-tools migrate --from=4.5 --to=12.0 --source-dir .
159
+ ultra-tools migrate --from=4.5 --to=16.0 --source-dir .
142
160
 
143
- # 2. Record and converge the greenfield/brownfield baseline, then turn accepted
144
- # behavior into a task graph (normally driven by ultra-init/research/plan)
161
+ # 2. Complete all 17 research steps. When owner judgment is required, the host asks
162
+ # one evidence-backed decision at a time and checkpoints the accepted artifacts.
163
+ # Record current evidence, obtain explicit baseline approval, then open and align
164
+ # an initial change before persisting its task contracts.
145
165
 
146
166
  # 3. Run the plan — parallel sessions, auto-merge back to main on success
147
167
  ubp-orchestrator run
@@ -154,10 +174,11 @@ ultra-tools system doctor
154
174
  ```
155
175
 
156
176
  Or let the skills drive it. In Codex, invoke
157
- `$ultra-builder-pro:ultra-init` → `$ultra-builder-pro:ultra-plan` → `$ultra-builder-pro:ultra-dev` →
158
- `$ultra-builder-pro:ultra-test` → `$ultra-builder-pro:ultra-review` →
159
- `$ultra-builder-pro:ultra-deliver`; after the baseline is delivered, daily work
160
- starts with `$ultra-builder-pro:ultra-change`, while
177
+ `$ultra-builder-pro:ultra-init` → `$ultra-builder-pro:ultra-research` →
178
+ `$ultra-builder-pro:ultra-change` → `$ultra-builder-pro:ultra-plan` →
179
+ `$ultra-builder-pro:ultra-dev` → `$ultra-builder-pro:ultra-test` →
180
+ `$ultra-builder-pro:ultra-review` → `$ultra-builder-pro:ultra-deliver`; after the
181
+ baseline is delivered, daily work starts with `$ultra-builder-pro:ultra-change`, while
161
182
  `$ultra-builder-pro:ultra-status` reads the compact authoritative breadcrumb.
162
183
  Kimi uses the corresponding
163
184
  `/ultra-builder-pro:ultra-*` namespace. Other runtimes retain their native
@@ -239,6 +260,7 @@ Individual suites: `test:state`, `test:orch`, `test:spec`, `test:rest`.
239
260
  | [`docs/PLAN.zh-CN.md`](./docs/PLAN.zh-CN.md) | Historical 12-phase plan and decision log with a current-boundary overlay |
240
261
  | [`docs/ROADMAP.md`](./docs/ROADMAP.md) | One-page English roadmap + phase status |
241
262
  | [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md) | Single-page system architecture |
263
+ | [`docs/WORKFLOW-LIFECYCLE.md`](./docs/WORKFLOW-LIFECYCLE.md) | Baseline classification, DB writes, status machines, gates, invalidation, and recovery |
242
264
  | [`docs/AGENT-CONTEXT.md`](./docs/AGENT-CONTEXT.md) | Canonical runtime context contract |
243
265
  | [`docs/USER-HANDBOOK-CONTRACT.md`](./docs/USER-HANDBOOK-CONTRACT.md) | Shared user-handbook policy and host renderings |
244
266
  | [`docs/RUNTIME-COMPAT-MATRIX.md`](./docs/RUNTIME-COMPAT-MATRIX.md) | Per-runtime capability matrix |
@@ -89,8 +89,8 @@ function replaceSlashCommand(text, command, replacement) {
89
89
  function adaptCodexPrimaryText(input, skillName) {
90
90
  let text = String(input);
91
91
  if (skillName === 'ultra-review') {
92
- text = text.replaceAll(
93
- "the current host's native bounded-worker mechanism",
92
+ text = text.replace(
93
+ /the current host's native bounded-worker\s+mechanism/g,
94
94
  'native Codex custom agents installed for the selected review workers',
95
95
  );
96
96
  }
@@ -396,6 +396,10 @@ main().catch((error) => {
396
396
  path.join(repoRoot, 'mcp-server', 'breadcrumb.cjs'),
397
397
  path.join(runtimeRoot, 'breadcrumb.cjs'),
398
398
  );
399
+ fs.copyFileSync(
400
+ path.join(repoRoot, 'mcp-server', 'hook-event.cjs'),
401
+ path.join(runtimeRoot, 'hook-event.cjs'),
402
+ );
399
403
 
400
404
  const sourceToolsFile = path.join(repoRoot, 'spec', 'mcp-tools.yaml');
401
405
  const upstreamManifest = yaml.load(fs.readFileSync(sourceToolsFile, 'utf8'));
@@ -8,7 +8,11 @@ const fs = require('node:fs');
8
8
  const path = require('node:path');
9
9
  const crypto = require('node:crypto');
10
10
 
11
- const DEFAULT_EXCLUDES = new Set(['.DS_Store', 'Thumbs.db']);
11
+ const DEFAULT_EXCLUDES = new Set(['.DS_Store', 'Thumbs.db', '__pycache__']);
12
+
13
+ function isExcluded(name, exclude) {
14
+ return exclude.has(name) || name.endsWith('.pyc') || name.endsWith('.pyo');
15
+ }
12
16
 
13
17
  function ensureDir(dir) {
14
18
  fs.mkdirSync(dir, { recursive: true });
@@ -27,7 +31,7 @@ function listRelative(root, { exclude = DEFAULT_EXCLUDES } = {}) {
27
31
  const out = [];
28
32
  (function walk(dir) {
29
33
  for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
30
- if (exclude.has(entry.name)) continue;
34
+ if (isExcluded(entry.name, exclude)) continue;
31
35
  const full = path.join(dir, entry.name);
32
36
  if (entry.isDirectory()) walk(full);
33
37
  else if (entry.isFile()) out.push(path.relative(root, full));
@@ -59,8 +59,9 @@ function renderHandbook(runtime) {
59
59
  `- Workflow entry points: ${value.invocation}.`,
60
60
  `- Collaboration boundary: ${value.collaboration}. The current host remains primary and owns final verification.`,
61
61
  `- Coordination boundary: ${value.coordination}.`,
62
- '- Authority: `.ultra/state.db` is the only durable Ultra authority for baselines, changes, tasks, sessions, events, incidents, projection state, telemetry, and review evidence. Generated JSON and Markdown are projections or workflow artifacts.',
62
+ '- Authority: `.ultra/state.db` is the only durable Ultra authority for baselines, changes, decision threads, tasks, sessions, events, incidents, projection state, telemetry, and review evidence. Generated JSON and Markdown are projections or workflow artifacts.',
63
63
  '- Baseline boundary: `task.init_project` classifies greenfield or brownfield work and records repository scope. Projection-only prior state uses the exact supported backup-first import returned by the authority check; migrated compatibility rows require explicit brownfield re-adoption. `baseline.record` owns evidence, verification, repository snapshot, and the gap ledger; `baseline.converge` requires explicit owner approval. New ordinary changes require a healthy ready baseline. Existing active work may continue with warnings, but baseline readiness blocks change convergence; normal drift reconciliation is health-checked atomically at archive. Only an explicitly approved incident break-glass may start without baseline readiness, and its archive creates a blocking reconciliation gap.',
64
+ '- Decision boundary: project-bound owner choices use one resumable DB-backed decision thread. The host resolves observable facts autonomously, presents only the earliest unresolved decision with evidence and a recommendation, waits for the owner, and records the normalized decision rather than prompts or transcripts. A linked workflow cannot advance until blocking decisions are resolved and its owner-approved checkpoint is current.',
64
65
  '- Context Spine boundary: `change.context` compiles role/gate readiness, required references, a fresh-context budget, public seam, verification command, and one next action. File, token, and context-share budgets are advisory attention signals, not refusal gates. Hooks inject only the DB-derived `change.breadcrumb`; missing required evidence or stale execution context must be recompiled.',
65
66
  '- Specification learning boundary: stable implementation discoveries use approval-gated propose/approve-or-reject/apply transitions. Unresolved learning blocks convergence; review requires independent specification-fidelity and engineering-standards evidence.',
66
67
  '- Memory and graph boundary: Ultra Builder Pro does not capture prompts, transcripts, observations, summaries, cross-session memory, or code-graph content. Separately installed providers own that data; Ultra may store only their metadata references in a change context manifest.',
@@ -63,8 +63,8 @@ function copySkills(repoRoot, target, names) {
63
63
  adaptedBody = adaptedBody.replaceAll("current host's user skill directory", '`~/.claude/skills`');
64
64
  }
65
65
  if (name === 'ultra-review') {
66
- adaptedBody = adaptedBody.replaceAll(
67
- "the current host's native bounded-worker mechanism",
66
+ adaptedBody = adaptedBody.replace(
67
+ /the current host's native bounded-worker\s+mechanism/g,
68
68
  'Claude Code Task workers using the installed review agent definitions',
69
69
  );
70
70
  }
@@ -194,6 +194,7 @@ function install(ctx = {}) {
194
194
  plugin_manifest: { root: 'plugin', path: '.claude-plugin/plugin.json' },
195
195
  mcp_registration: { root: 'plugin', path: '.mcp.json' },
196
196
  mcp_launcher: { root: 'plugin', path: 'runtime/launch.cjs' },
197
+ hook_event_helper: { root: 'plugin', path: 'runtime/hook-event.cjs' },
197
198
  hooks_manifest: { root: 'plugin', path: 'hooks/hooks.json' },
198
199
  checkpoint_hook: { root: 'plugin', path: 'hooks/workflow_checkpoint.py' },
199
200
  resume_hook: { root: 'plugin', path: 'hooks/workflow_resume.py' },
package/adapters/codex.js CHANGED
@@ -375,6 +375,7 @@ function install(ctx = {}) {
375
375
  plugin_manifest: { root: 'plugin', path: '.codex-plugin/plugin.json' },
376
376
  mcp_registration: { root: 'plugin', path: '.mcp.json' },
377
377
  mcp_launcher: { root: 'plugin', path: 'runtime/launch.cjs' },
378
+ hook_event_helper: { root: 'plugin', path: 'runtime/hook-event.cjs' },
378
379
  hooks_manifest: { root: 'plugin', path: 'hooks/hooks.json' },
379
380
  hook_adapter: { root: 'plugin', path: HOOK_ADAPTER_RELATIVE },
380
381
  runtime_manifest: { root: 'config', path: path.join(RUNTIME_MANIFEST_DIR, RUNTIME_MANIFEST_FILE) },
package/adapters/kimi.js CHANGED
@@ -94,8 +94,8 @@ function kimiTextTransform(input, assetName = '') {
94
94
  text = text.replaceAll('current host', 'Kimi Code');
95
95
  }
96
96
  if (assetName === 'ultra-review') {
97
- text = text.replaceAll(
98
- "the current host's native bounded-worker mechanism",
97
+ text = text.replace(
98
+ /the current host's native bounded-worker\s+mechanism/g,
99
99
  'Kimi `AgentSwarm` for parallel reviewers or one foreground Kimi `Agent` for a single reviewer, using the worker prompt files under `$KIMI_PLUGIN_ROOT/agents/`',
100
100
  );
101
101
  }
@@ -349,6 +349,7 @@ function writePluginProvenance(repoRoot, target) {
349
349
  contracts: {
350
350
  plugin_manifest: { root: 'plugin', path: 'kimi.plugin.json' },
351
351
  mcp_launcher: { root: 'plugin', path: path.join('runtime', 'launch.cjs') },
352
+ hook_event_helper: { root: 'plugin', path: path.join('runtime', 'hook-event.cjs') },
352
353
  hook_adapter: { root: 'plugin', path: path.join('hooks', 'adapters', 'kimi.py') },
353
354
  session_bootstrap: {
354
355
  root: 'plugin', path: path.join('skills', BOOTSTRAP_SKILL, 'SKILL.md'),
@@ -86,8 +86,8 @@ function openCodeTextTransform(input, assetName = '') {
86
86
  text = text.replaceAll('current host', 'OpenCode');
87
87
  }
88
88
  if (assetName === 'ultra-review') {
89
- text = text.replaceAll(
90
- "the current host's native bounded-worker mechanism",
89
+ text = text.replace(
90
+ /the current host's native bounded-worker\s+mechanism/g,
91
91
  'the OpenCode `task` tool using the installed bounded review agents',
92
92
  );
93
93
  }
@@ -454,6 +454,7 @@ function install(ctx = {}) {
454
454
  host_plugin: { root: 'config', path: path.join('plugins', 'ultra-builder-pro.js') },
455
455
  mcp_config: { root: 'config', path: 'opencode.json' },
456
456
  mcp_launcher: { root: 'config', path: path.join(BUNDLE_DIR, 'runtime', 'launch.cjs') },
457
+ hook_event_helper: { root: 'config', path: path.join(BUNDLE_DIR, 'runtime', 'hook-event.cjs') },
457
458
  },
458
459
  });
459
460
  report.provenance.file = provenanceFile;
@@ -13,7 +13,8 @@ rewrite a specialist's severity.
13
13
 
14
14
  ## Required input
15
15
 
16
- - `SESSION_PATH`, reviewed HEAD, diff range, and expected worker list;
16
+ - `SESSION_PATH`, review mode, reviewed HEAD, diff range, and expected worker list with
17
+ selection or skip rationale;
17
18
  - `SCHEMA_PATH` resolved by the parent from the active review Skill;
18
19
  - one complete `spec_fidelity` artifact;
19
20
  - every selected `engineering_standards` artifact.
@@ -24,10 +25,9 @@ rewrite a specialist's severity.
24
25
  2. Parse every expected artifact. Reject stale HEAD or range, malformed JSON, wrong
25
26
  axis, duplicate finding ids, and missing required fields. Record missing or invalid
26
27
  workers as limitations instead of silently continuing as complete.
27
- 3. Deduplicate only findings on the same axis that describe the same root cause in the
28
- same path with overlapping evidence. Preserve all source ids and agents, keep the
29
- highest source severity, and retain the clearest trigger, impact, evidence, and
30
- remediation. Similar symptoms with different causes remain separate.
28
+ 3. Preserve every specialist finding unchanged in `SUMMARY.json`. Group duplicate
29
+ root causes only in the human-readable `SUMMARY.md`; never drop, merge, rewrite, or
30
+ renumber their machine-readable source records.
31
31
  4. Order findings by severity, path, and line. Do not use confidence scores, reviewer
32
32
  counts, or finding-count thresholds to change severity or verdict.
33
33
  5. Set each axis to `PASS` only when its required current artifacts are complete and no
@@ -36,7 +36,10 @@ rewrite a specialist's severity.
36
36
  6. Set the overall verdict to `INCOMPLETE` when either axis is incomplete,
37
37
  `REQUEST_CHANGES` when either complete axis fails, and `APPROVE` only when both
38
38
  axes pass.
39
- 7. Write `SUMMARY.json` as `ultra-review-summary-v2` and a concise `SUMMARY.md` with
39
+ 7. Record the review mode and every selected or skipped worker with its supplied
40
+ scope-specific rationale. The selection must match completed, failed, and skipped
41
+ worker state exactly.
42
+ 8. Write `SUMMARY.json` as `ultra-review-summary-v2` and a concise `SUMMARY.md` with
40
43
  the two axis verdicts, blocking findings, limitations, positive observations, and
41
44
  artifact paths. Validate both files before acknowledging completion.
42
45
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Open or resume a bounded continuous change with linked authoritative tasks and context
2
+ description: Align, open, and route one bounded continuous change through research, plan, and delivery
3
3
  argument-hint: "[change-id-or-title] [quick|standard|major|incident]"
4
4
  workflow-ref: "@skills/ultra-change/SKILL.md"
5
5
  ---
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Convert validated requirements into dependency-valid Ultra tasks with bounded context and exact verification
2
+ description: Interactively review and persist dependency-valid tasks with bounded context and exact verification
3
3
  argument-hint: "[scope]"
4
4
  workflow-ref: "@skills/ultra-plan/SKILL.md"
5
5
  ---
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Research unresolved product or architecture decisions and update the authoritative baseline specifications
2
+ description: Build complete research evidence while presenting only one load-bearing owner decision at a time
3
3
  argument-hint: "[scope-or-question]"
4
4
  workflow-ref: "@skills/ultra-research/SKILL.md"
5
5
  ---
@@ -1,10 +1,10 @@
1
1
  ---
2
- description: Analyze a consequential question with evidence, uncertainty, and proportionate stress testing
2
+ description: Resolve a consequential question through evidence or one-decision-at-a-time alignment
3
3
  argument-hint: "[question]"
4
4
  workflow-ref: "@skills/ultra-think/SKILL.md"
5
5
  ---
6
6
 
7
- # Analyze a consequential question
7
+ # Align on a consequential question
8
8
 
9
9
  Read and follow `@skills/ultra-think/SKILL.md`, treating `$ARGUMENTS` as the question to resolve.
10
10
  Treat the referenced skill as the only workflow definition.
@@ -37,15 +37,15 @@ native command or skill -> MCP workflow-state operation -> .ultra/state.db
37
37
  | MCP | `mcp-server/server.cjs` | Authoritative typed operations over `.ultra/state.db` |
38
38
  | CLI | `ultra-tools`, `ubp-orchestrator` | Selected initialization, backup-first recovery, automation, and diagnostics; not a change-state mirror |
39
39
 
40
- `.ultra/state.db` is the only durable Ultra authority for baselines, changes, tasks,
41
- sessions, events, incidents, projection jobs/cursors, telemetry, review evidence,
40
+ `.ultra/state.db` is the only durable Ultra authority for baselines, changes, decisions, tasks,
41
+ workflow runs/steps, sessions, events, incidents, projection jobs/cursors, telemetry, review evidence,
42
42
  and circuit-breaker state. `tasks.json`, context Markdown, execution plans, and
43
43
  reports are projections or workflow artifacts.
44
44
 
45
45
  ## 3. Live MCP and declared contracts
46
46
 
47
- `spec/mcp-tools.yaml` declares and the bundled server registers 36 tools across
48
- six families:
47
+ `spec/mcp-tools.yaml` declares and the bundled server registers 50 tools across
48
+ eight families:
49
49
 
50
50
  | Family | Live tools |
51
51
  |---|---|
@@ -53,19 +53,40 @@ six families:
53
53
  | `task.*` | create, update, list, get, switch_tag, delete, init_project, expand, parse_prd, dependency_topo, append_event, subscribe_events |
54
54
  | `session.*` | spawn, close, get, list, admission_check, heartbeat, subscribe_events |
55
55
  | `change.*` | create, update, get, list, context, breadcrumb, learning_propose, learning_resolve, converge, archive |
56
+ | `decision.*` | thread_start, get, list, open, resolve, delegate, defer, supersede, checkpoint |
57
+ | `workflow.*` | start, get, list, step, complete |
56
58
  | `system.*` | doctor |
57
59
  | `plan.*` | export, get |
58
60
 
59
- Review, repository impact discovery, skill loading, and user interaction remain
60
- host-native capabilities rather than fake MCP contracts. The generated Codex
61
- capability map documents those replacements.
61
+ Review, repository impact discovery, skill loading, and decision presentation remain
62
+ host-native capabilities rather than fake MCP contracts. MCP stores only normalized
63
+ decision authority and checkpoints; it never generates questions or retains prompts
64
+ and transcripts. The generated Codex capability map documents host replacements.
65
+
66
+ The complete write, transition, invalidation, and recovery contract lives in
67
+ [`WORKFLOW-LIFECYCLE.md`](./WORKFLOW-LIFECYCLE.md).
62
68
 
63
69
  Any new MCP contract starts in `spec/mcp-tools.yaml` with valid and invalid
64
70
  fixtures. Do not add an ad-hoc server handler first.
65
71
 
66
- ## 4. Context Spine contract
72
+ ## 4. Human-agent alignment contract
73
+
74
+ `skills/ultra-think/references/decision-dialogue.md` is the single reusable prompt
75
+ contract for load-bearing owner choices. Research, change, and plan read it at their
76
+ decision boundaries. They inspect evidence first, expose only the earliest unresolved
77
+ choice, include a recommendation and durable effects, and stop the turn. Dev, test,
78
+ review, and deliver route back to the same thread instead of deciding for the owner.
79
+
80
+ One partial unique index permits only one open item per thread. `decision.resolve`,
81
+ `decision.delegate`, and `decision.defer` preserve the source of authority;
82
+ `decision.supersede` preserves history when evidence or intent changes. Prepare and
83
+ confirm checkpointing bind the accepted cluster to current artifact digests before a
84
+ matching workflow may advance. Status and breadcrumb return only the current question
85
+ and one route, so recovery does not require replaying conversation history.
86
+
87
+ ## 5. Context Spine contract
67
88
 
68
- Context Manifest v2 is a DB-backed role handoff, not a static codebase summary.
89
+ Context Manifest v2 is an immutable DB-backed role handoff, not a static codebase summary.
69
90
  `change.context` compiles required references, digests, readiness, context budget,
70
91
  public seam, exact verification command, and one next action for `plan`,
71
92
  `implement`, `check`, or `review`. The default 12-file, about 12k-token, and 40%
@@ -88,7 +109,7 @@ through approve/reject/apply transitions in `change.learning_resolve`. Unresolve
88
109
  learning blocks convergence. Review contributes two independent axes,
89
110
  `spec_fidelity` and `engineering_standards`; neither can replace the other.
90
111
 
91
- ## 5. Native host presentation
112
+ ## 6. Native host presentation
92
113
 
93
114
  | Host | Plugin form | Workflow entry | Hook form | Collaboration companions |
94
115
  |---|---|---|---|---|
@@ -101,7 +122,7 @@ The current host remains primary. Collaboration skills call another runtime
101
122
  only when explicitly requested, use it as a read-only advisor, and return the
102
123
  evidence to the primary host for final verification.
103
124
 
104
- ## 6. Hook boundary
125
+ ## 7. Hook boundary
105
126
 
106
127
  The canonical Python hook bundle contains seven executable workflow hooks plus
107
128
  the shared read-only `context_spine.py` breadcrumb helper:
@@ -111,7 +132,8 @@ the shared read-only `context_spine.py` breadcrumb helper:
111
132
  - `workflow_checkpoint.py` before compaction;
112
133
  - `workflow_resume.py` after compaction/resume;
113
134
  - `pre_stop_check.py` reports unfinished workflow position at stop without denial;
114
- - `subagent_tracker.py` for bounded worker lifecycle evidence.
135
+ - `subagent_tracker.py` for minimal DB event evidence containing only lifecycle ids
136
+ and types, never transcript paths or messages.
115
137
 
116
138
  `workflow_context.py`, `active_task_context.py`, `workflow_resume.py`, and the
117
139
  OpenCode plugin invoke the same bundled JavaScript `change.breadcrumb` reader
@@ -128,7 +150,7 @@ reject an edit, stop, or tool call.
128
150
  Generic command blocking, post-edit governance, and unrelated user hooks are not
129
151
  copied into Ultra Builder Pro.
130
152
 
131
- ## 7. Memory boundary
153
+ ## 8. Memory boundary
132
154
 
133
155
  Ultra Builder Pro has no memory MCP family, recall skill, prompt capture,
134
156
  transcript capture, observation journal, or session-summary hook. Persistent
@@ -146,7 +168,7 @@ ultra-tools legacy-memory prune --confirm DELETE_ULTRA_LEGACY_MEMORY
146
168
 
147
169
  Archive before prune; the confirmation token is intentionally required.
148
170
 
149
- ## 8. Project state layout
171
+ ## 9. Project state layout
150
172
 
151
173
  ```text
152
174
  .ultra/
@@ -159,12 +181,14 @@ Archive before prune; the confirmation token is intentionally required.
159
181
  ├── tasks/ # projections and task contexts
160
182
  ├── specs/ # research/product/architecture artifacts
161
183
  ├── sessions/ # bounded runtime artifacts
162
- ├── reviews/ # review evidence
163
- ├── test-report.json
164
- └── delivery-report.json
184
+ ├── reviews/ # immutable review evidence by session id
185
+ └── reports/
186
+ ├── templates/ # blank report schemas; never evidence
187
+ ├── tests/<workflow-id>.json
188
+ └── delivery/<workflow-id>.json
165
189
  ```
166
190
 
167
- ## 9. User handbook integration
191
+ ## 10. User handbook integration
168
192
 
169
193
  General engineering doctrine remains user-owned in `CLAUDE.md` or `AGENTS.md`.
170
194
  Ultra Builder Pro contributes one managed section only. Preview or apply it with:
@@ -179,7 +203,7 @@ timestamped backup, replaces only the marked block, and can migrate the old
179
203
  Codex `## Ultra Builder Pro Runtime Contract` section without touching the next
180
204
  user section. Plugin adapters themselves do not silently overwrite handbooks.
181
205
 
182
- ## 10. Verification
206
+ ## 11. Verification
183
207
 
184
208
  Run `npm run test:all`, `python3 -m pytest hooks/tests -q`, and `npm audit`.
185
209
  Adapter tests assert the allowlisted assets, native manifests, hook boundary,