ultra-builder-pro-cli 0.25.1 → 0.26.1

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 (243) hide show
  1. package/.ultra-template/changes/abandoned/.gitkeep +0 -0
  2. package/.ultra-template/contexts/TEMPLATE.md +94 -0
  3. package/.ultra-template/decisions/.gitkeep +1 -0
  4. package/.ultra-template/evidence/.gitkeep +1 -0
  5. package/.ultra-template/north-star.md +46 -0
  6. package/.ultra-template/research/.gitkeep +1 -0
  7. package/.ultra-template/specs/discovery.md +2 -2
  8. package/.ultra-template/tasks.json +3 -0
  9. package/.ultra-template/test-report.json +27 -0
  10. package/CHANGELOG.md +107 -1
  11. package/README.md +217 -579
  12. package/adapters/_shared/delegate-profiles/kimi-read-only.md +15 -0
  13. package/adapters/_shared/delegate-profiles/kimi-write.md +17 -0
  14. package/adapters/_shared/file-ops.cjs +76 -2
  15. package/adapters/_shared/host-profile.cjs +97 -0
  16. package/adapters/_shared/plugin-core.cjs +204 -0
  17. package/adapters/_shared/runtime-assets.cjs +31 -96
  18. package/adapters/claude.js +92 -291
  19. package/adapters/codex.js +309 -842
  20. package/adapters/grok.js +143 -1469
  21. package/adapters/kimi.js +124 -1053
  22. package/adapters/opencode.js +230 -742
  23. package/bin/delegate-worker.cjs +328 -0
  24. package/bin/delegate.cjs +463 -0
  25. package/bin/install.js +38 -11
  26. package/docs/ARCHITECTURE.md +125 -216
  27. package/docs/ARTIFACT-AUTHORITY.md +90 -268
  28. package/docs/DECISIONS.md +77 -87
  29. package/docs/PHILOSOPHY.md +208 -0
  30. package/docs/PLUGIN-ISOLATION-CONTRACT.md +65 -39
  31. package/docs/RUNTIME-COMPAT-MATRIX.md +140 -155
  32. package/docs/SKILL-AUTHORING.md +94 -73
  33. package/docs/WORKFLOW-LIFECYCLE.md +97 -189
  34. package/hooks/README.md +19 -37
  35. package/hooks/_common.py +113 -0
  36. package/hooks/adapters/codex.py +9 -16
  37. package/hooks/adapters/grok.py +5 -5
  38. package/hooks/adapters/kimi.py +8 -14
  39. package/hooks/block_dangerous_commands.py +201 -0
  40. package/hooks/compact_context.py +65 -0
  41. package/hooks/mid_workflow_recall.py +25 -0
  42. package/hooks/post_edit_guard.py +105 -0
  43. package/hooks/session_context.py +30 -0
  44. package/package.json +17 -52
  45. package/skills/ultra-change/SKILL.md +115 -50
  46. package/skills/ultra-change/references/change-contract.md +68 -3
  47. package/skills/ultra-delegate/SKILL.md +89 -0
  48. package/skills/ultra-delegate/references/delegation-contract.md +59 -0
  49. package/skills/ultra-delegate/scripts/delegate_wait.py +86 -0
  50. package/skills/ultra-deliver/SKILL.md +98 -42
  51. package/skills/ultra-deliver/references/baseline-reconciliation.md +39 -20
  52. package/skills/ultra-dev/SKILL.md +115 -62
  53. package/skills/ultra-dev/references/debugging.md +22 -0
  54. package/skills/ultra-domain-modeling/SKILL.md +79 -0
  55. package/skills/ultra-grilling/SKILL.md +118 -0
  56. package/skills/ultra-grilling/references/reframing.md +72 -0
  57. package/skills/ultra-init/SKILL.md +102 -37
  58. package/skills/ultra-init/references/brownfield-adoption.md +33 -83
  59. package/skills/ultra-init/scripts/init_project.cjs +84 -0
  60. package/skills/ultra-plan/SKILL.md +101 -68
  61. package/skills/ultra-research/SKILL.md +68 -48
  62. package/skills/ultra-research/references/00-problem-validation.md +5 -5
  63. package/skills/ultra-research/references/01-opportunity-discovery.md +3 -3
  64. package/skills/ultra-research/references/02-market-assessment.md +5 -4
  65. package/skills/ultra-research/references/03-competitive-landscape.md +3 -3
  66. package/skills/ultra-research/references/04-product-strategy.md +3 -3
  67. package/skills/ultra-research/references/05-assumptions-validation.md +5 -5
  68. package/skills/ultra-research/references/10-user-personas.md +3 -2
  69. package/skills/ultra-research/references/11-user-scenarios.md +3 -3
  70. package/skills/ultra-research/references/20-user-stories.md +4 -3
  71. package/skills/ultra-research/references/21-features-scope.md +3 -2
  72. package/skills/ultra-research/references/22-success-metrics.md +3 -3
  73. package/skills/ultra-research/references/30-architecture-context.md +3 -3
  74. package/skills/ultra-research/references/31-solution-strategy.md +3 -3
  75. package/skills/ultra-research/references/32-building-blocks.md +3 -3
  76. package/skills/ultra-research/references/40-deployment.md +3 -3
  77. package/skills/ultra-research/references/41-quality-risks.md +3 -3
  78. package/skills/ultra-research/references/99-synthesis.md +7 -7
  79. package/skills/ultra-review/SKILL.md +84 -32
  80. package/skills/ultra-review/references/code.md +17 -0
  81. package/skills/ultra-review/references/comments.md +12 -0
  82. package/skills/ultra-review/references/design.md +12 -0
  83. package/skills/ultra-review/references/errors.md +13 -0
  84. package/skills/ultra-review/references/spec.md +13 -0
  85. package/skills/ultra-review/references/tests.md +12 -0
  86. package/skills/ultra-review/references/worker-packet.md +40 -0
  87. package/skills/ultra-review/scripts/review_wait.py +26 -15
  88. package/skills/ultra-status/SKILL.md +61 -36
  89. package/skills/ultra-tdd/SKILL.md +81 -0
  90. package/skills/ultra-tdd/references/templates/README.md +20 -0
  91. package/skills/ultra-tdd/references/templates/feature-flag-default-audit.sh +79 -0
  92. package/skills/ultra-tdd/references/templates/persistence-real.ts +78 -0
  93. package/skills/ultra-tdd/references/templates/testcontainer-postgres.py +78 -0
  94. package/skills/ultra-tdd/references/templates/testcontainer-postgres.ts +73 -0
  95. package/skills/ultra-tdd/references/templates/vertical-slice.ts +66 -0
  96. package/skills/ultra-tdd/references/test-execution.md +18 -0
  97. package/skills/ultra-test/SKILL.md +75 -30
  98. package/skills/ultra-test/references/export-syntax.md +18 -0
  99. package/skills/ultra-test/scripts/worktree_digest.cjs +54 -0
  100. package/skills/ultra-think/SKILL.md +49 -27
  101. package/skills/ultra-think/references/autonomy-boundary.md +48 -0
  102. package/skills/ultra-think/references/interaction-boundary.md +18 -33
  103. package/.ultra-template/docs/research/README.md +0 -55
  104. package/.ultra-template/reports/templates/delivery-report.json +0 -17
  105. package/.ultra-template/reports/templates/test-report.json +0 -18
  106. package/.ultra-template/tasks/tasks.json +0 -15
  107. package/.ultra-template/templates/task-context.md +0 -19
  108. package/adapters/_shared/codex-assets.cjs +0 -725
  109. package/adapters/_shared/codex-ultra-tools-entry.cjs +0 -11
  110. package/adapters/_shared/interaction-contract.cjs +0 -129
  111. package/adapters/_shared/path-rewrite.cjs +0 -79
  112. package/adapters/_shared/runtime-native.cjs +0 -132
  113. package/adapters/_shared/settings-merge.cjs +0 -76
  114. package/agents/code-reviewer.md +0 -42
  115. package/agents/debugger.md +0 -40
  116. package/agents/review-code.md +0 -49
  117. package/agents/review-comments.md +0 -38
  118. package/agents/review-coordinator.md +0 -56
  119. package/agents/review-design.md +0 -40
  120. package/agents/review-errors.md +0 -43
  121. package/agents/review-spec.md +0 -39
  122. package/agents/review-tests.md +0 -40
  123. package/agents/tdd-runner.md +0 -38
  124. package/bin/orchestrator.js +0 -383
  125. package/commands/ultra-change.md +0 -10
  126. package/commands/ultra-deliver.md +0 -10
  127. package/commands/ultra-dev.md +0 -10
  128. package/commands/ultra-doctor.md +0 -10
  129. package/commands/ultra-init.md +0 -10
  130. package/commands/ultra-plan.md +0 -10
  131. package/commands/ultra-research.md +0 -10
  132. package/commands/ultra-review.md +0 -10
  133. package/commands/ultra-status.md +0 -10
  134. package/commands/ultra-test.md +0 -10
  135. package/commands/ultra-think.md +0 -10
  136. package/docs/AGENT-CONTEXT.md +0 -191
  137. package/docs/COMMIT-HASH-BACKFILL.md +0 -51
  138. package/docs/LEGACY-CLI-CROSSWALK.md +0 -175
  139. package/docs/ROADMAP.md +0 -101
  140. package/docs/STATE-DB-ACCESS-POLICY.md +0 -161
  141. package/hooks/active_task_context.py +0 -152
  142. package/hooks/context_envelope.py +0 -100
  143. package/hooks/health_check.py +0 -196
  144. package/hooks/pre_stop_check.py +0 -66
  145. package/hooks/runtime_paths.py +0 -396
  146. package/hooks/subagent_tracker.py +0 -88
  147. package/hooks/workflow_checkpoint.py +0 -76
  148. package/hooks/workflow_context.py +0 -48
  149. package/hooks/workflow_resume.py +0 -84
  150. package/mcp-server/hook-context.cjs +0 -38
  151. package/mcp-server/hook-event.cjs +0 -34
  152. package/mcp-server/lib/archive-journal.cjs +0 -1119
  153. package/mcp-server/lib/archive-mutation-worker.py +0 -365
  154. package/mcp-server/lib/artifact-registry.cjs +0 -1232
  155. package/mcp-server/lib/baseline-workflow.cjs +0 -1193
  156. package/mcp-server/lib/canonical-json.cjs +0 -19
  157. package/mcp-server/lib/change-authority.cjs +0 -26
  158. package/mcp-server/lib/change-packet.cjs +0 -790
  159. package/mcp-server/lib/change-workflow.cjs +0 -65
  160. package/mcp-server/lib/context-envelope.cjs +0 -581
  161. package/mcp-server/lib/context-paths.cjs +0 -142
  162. package/mcp-server/lib/decision-records.cjs +0 -423
  163. package/mcp-server/lib/delivery-transaction.cjs +0 -471
  164. package/mcp-server/lib/doctor-backup-worker.cjs +0 -328
  165. package/mcp-server/lib/doctor.cjs +0 -627
  166. package/mcp-server/lib/git-bootstrap.cjs +0 -651
  167. package/mcp-server/lib/init-project.cjs +0 -1021
  168. package/mcp-server/lib/kernel-change-workflow.cjs +0 -2029
  169. package/mcp-server/lib/legacy-change-workflow.cjs +0 -3032
  170. package/mcp-server/lib/managed-file-write.cjs +0 -172
  171. package/mcp-server/lib/plan-checkpoint.cjs +0 -177
  172. package/mcp-server/lib/plan-publication-worker.cjs +0 -830
  173. package/mcp-server/lib/plan-store.cjs +0 -794
  174. package/mcp-server/lib/prd-parser.cjs +0 -83
  175. package/mcp-server/lib/pricing.cjs +0 -44
  176. package/mcp-server/lib/project-context.cjs +0 -178
  177. package/mcp-server/lib/projector.cjs +0 -386
  178. package/mcp-server/lib/provider-refs.cjs +0 -42
  179. package/mcp-server/lib/runtime-paths.cjs +0 -1714
  180. package/mcp-server/lib/runtime-state.cjs +0 -222
  181. package/mcp-server/lib/safe-project-file.cjs +0 -385
  182. package/mcp-server/lib/stage-checkpoints.cjs +0 -463
  183. package/mcp-server/lib/state-authority.cjs +0 -95
  184. package/mcp-server/lib/state-db.cjs +0 -1580
  185. package/mcp-server/lib/state-ops.cjs +0 -1428
  186. package/mcp-server/lib/task-contract.cjs +0 -404
  187. package/mcp-server/lib/task-expander.cjs +0 -105
  188. package/mcp-server/lib/task-ledger.cjs +0 -1964
  189. package/mcp-server/lib/telemetry.cjs +0 -85
  190. package/mcp-server/lib/topo.cjs +0 -131
  191. package/mcp-server/lib/ultra-facade.cjs +0 -2684
  192. package/mcp-server/lib/worker-packet.cjs +0 -358
  193. package/mcp-server/server.cjs +0 -437
  194. package/orchestrator/auto-merge.cjs +0 -128
  195. package/orchestrator/daemon.cjs +0 -264
  196. package/orchestrator/dispatch-rules.cjs +0 -78
  197. package/orchestrator/parallel-orchestrator.cjs +0 -903
  198. package/orchestrator/planner/plan-builder.cjs +0 -125
  199. package/orchestrator/recovery.cjs +0 -188
  200. package/orchestrator/session-close-journal-worker.cjs +0 -5
  201. package/orchestrator/session-close-journal.cjs +0 -1014
  202. package/orchestrator/session-runner.cjs +0 -1153
  203. package/orchestrator/worktree-manager.cjs +0 -282
  204. package/settings.json +0 -7
  205. package/skills/cc-collab/SKILL.md +0 -42
  206. package/skills/code-review-expert/SKILL.md +0 -43
  207. package/skills/code-review-expert/references/correctness-reliability.md +0 -30
  208. package/skills/code-review-expert/references/design-boundaries.md +0 -26
  209. package/skills/code-review-expert/references/removal-plan.md +0 -24
  210. package/skills/codex-collab/SKILL.md +0 -49
  211. package/skills/codex-collab/evals/evals.json +0 -35
  212. package/skills/integration-rules/SKILL.md +0 -32
  213. package/skills/security-rules/SKILL.md +0 -38
  214. package/skills/testing-rules/SKILL.md +0 -32
  215. package/skills/ultra-doctor/SKILL.md +0 -41
  216. package/skills/ultra-plan/references/semantic-preflight.md +0 -20
  217. package/skills/ultra-verify/SKILL.md +0 -46
  218. package/skills/ultra-verify/evals/evals.json +0 -46
  219. package/skills/ultra-verify/references/cross-verify-modes.md +0 -28
  220. package/skills/ultra-verify/references/evidence-status.md +0 -21
  221. package/skills/ultra-verify/scripts/verify_wait.py +0 -94
  222. package/spec/cli-protocol.md +0 -102
  223. package/spec/mcp-tools.yaml +0 -312
  224. package/spec/schemas/baseline-reconciliation.v1.schema.json +0 -73
  225. package/spec/schemas/change-delta.v1.schema.json +0 -153
  226. package/spec/schemas/command-manifest.schema.json +0 -29
  227. package/spec/schemas/context-file.v4.5.schema.json +0 -54
  228. package/spec/schemas/delivery-report.v1.schema.json +0 -66
  229. package/spec/schemas/documentation-reconciliation.v1.schema.json +0 -106
  230. package/spec/schemas/mcp-tools.schema.json +0 -136
  231. package/spec/schemas/skill-manifest.schema.json +0 -24
  232. package/spec/schemas/state-db.sql +0 -641
  233. package/spec/schemas/task-ledger.v2.schema.json +0 -296
  234. package/spec/schemas/tasks.v4.5.schema.json +0 -96
  235. package/spec/schemas/test-report.v1.schema.json +0 -225
  236. package/ultra-tools/cli.cjs +0 -129
  237. package/ultra-tools/commands/db.cjs +0 -226
  238. package/ultra-tools/commands/legacy-memory.cjs +0 -159
  239. package/ultra-tools/commands/migrate.cjs +0 -1386
  240. package/ultra-tools/commands/session.cjs +0 -213
  241. package/ultra-tools/commands/status.cjs +0 -559
  242. package/ultra-tools/commands/system.cjs +0 -498
  243. package/ultra-tools/commands/task.cjs +0 -105
@@ -1,230 +1,138 @@
1
1
  # Ultra Builder Pro workflow lifecycle
2
2
 
3
- Ultra is an adaptive capability graph, not an automatically chained pipeline. The
4
- current Skill inspects authority and recommends a next capability. The user explicitly
5
- starts that capability. Skills own semantic procedure; the seven-tool MCP kernel owns
6
- persistence and mechanical safety across Claude Code, Codex, OpenCode, Kimi Code, and
7
- Grok Build.
8
-
9
- ## Capability graph
10
-
11
- ```mermaid
12
- flowchart TD
13
- START["Project"] --> INIT["ultra-init"]
14
- INIT --> RESEARCH["ultra-research"]
15
- RESEARCH --> THINK["ultra-think when a material decision remains"]
16
- THINK --> RESEARCH
17
- RESEARCH --> CHANGE["ultra-change"]
18
- CHANGE --> ROUTE{"What does this Change actually need?"}
19
- ROUTE -->|"Evidence gap"| CR["bounded ultra-research"]
20
- CR --> ROUTE
21
- ROUTE -->|"Implementation"| PLAN["ultra-plan"]
22
- PLAN --> DEV["ultra-dev for one owned Task"]
23
- DEV --> MORE{"More executable Tasks?"}
24
- MORE -->|"Yes"| DEV
25
- MORE -->|"No"| ASSESS{"What evidence is still warranted?"}
26
- ROUTE -->|"No implementation; current evidence is sufficient"| ASSESS
27
- ASSESS -->|"Risk-selected verification"| TEST["ultra-test"]
28
- ASSESS -->|"Independent review"| REVIEW["ultra-review"]
29
- ASSESS -->|"Caller accepts current packet and explicit omissions"| DELIVER["ultra-deliver"]
30
- TEST -->|"implementation gap"| DEV
31
- TEST -->|"review warranted"| REVIEW
32
- TEST -->|"caller accepts evidence"| DELIVER
33
- REVIEW -->|"implementation issue"| DEV
34
- REVIEW -->|"contract issue"| PLAN
35
- REVIEW -->|"accepted"| DELIVER
36
- DELIVER --> CHANGE
37
- STATUS["ultra-status"] -.-> INIT
38
- STATUS -.-> CHANGE
39
- DOCTOR["ultra-doctor"] -.-> INIT
40
- DOCTOR -.-> CHANGE
41
- ```
3
+ Ultra v0.26 has no fixed runtime state machine. Skills define checkable entry and exit
4
+ criteria; repository files record facts; the host model chooses the route.
42
5
 
43
- The graph is guidance, not database authorization. The host model selects the evidence
44
- needed by the actual Change route and records every deliberate omission in the delivery
45
- handoff. When implementation occurs, its Plan, Task contract, and Context remain
46
- mandatory execution authority; Research, Test, and Review are used according to the
47
- actual evidence and risk rather than as universal archive gates. `ultra-status` is
48
- read-only. `ultra-doctor` repairs mechanical authority only.
49
-
50
- ## Shared command contract
51
-
52
- Every public Skill follows the same boundary:
53
-
54
- 1. read the current `ultra.context`;
55
- 2. inspect checkout/runtime facts directly;
56
- 3. identify the smallest unresolved semantic choice;
57
- 4. recommend a route and ask only when user intent is not already explicit;
58
- 5. persist normalized facts through typed `ultra.record`;
59
- 6. update the owning semantic/evidence files;
60
- 7. save or accept the stage through `ultra.checkpoint`;
61
- 8. read back current authority;
62
- 9. report diagnostics and recommend, but do not launch, the next Skill.
63
-
64
- No command records ceremonial steps merely to satisfy SQLite.
65
-
66
- ## Capability ownership
67
-
68
- | Skill | Semantic owner | Durable output |
69
- |---|---|---|
70
- | `ultra-init` | repository classification, scope, Git/runtime bootstrap | initialized local authority and empty/imported team checkpoint |
71
- | `ultra-research` | adaptive evidence coverage and accepted baseline | baseline specs, research evidence, Decision Records, baseline checkpoint |
72
- | `ultra-think` | one load-bearing owner decision or bounded diagnosis | normalized Decision Record and applied references |
73
- | `ultra-change` | feature/fix/refactor/incident contract | active Change intent, classification, delta and decision scope |
74
- | `ultra-plan` | Task contracts, topology, ownership, acceptance coverage | accepted Plan checkpoint, deterministic plan files, team checkpoint |
75
- | `ultra-dev` | one owned vertical Task implementation | Worker Packet output, task outcome, implementation evidence checkpoint |
76
- | `ultra-test` | risk-selected executable validation | test report and accepted test checkpoint |
77
- | `ultra-review` | independent spec fidelity and engineering quality | specialist artifacts, coordinated summary, accepted review checkpoint |
78
- | `ultra-deliver` | documentation/spec reconciliation and local archive | delivery evidence, converged baseline, immutable archive, team checkpoint |
79
- | `ultra-status` | current Context rendering | no state mutation |
80
- | `ultra-doctor` | mechanical health, migration, backup and repair | diagnostic/repair report; no product decision |
81
-
82
- ## Context and decisions
83
-
84
- One canonical Context Envelope flows through Skill, Hook, Session, Agent, and compact
85
- recovery. Accepted Decision Records are always visible, including when no workflow is
86
- active. A new session therefore resumes from accepted intent rather than reconstructing
87
- it from conversation.
88
-
89
- Decision history is append-only through supersession:
6
+ ## Capability flow
90
7
 
91
8
  ```text
92
- proposed -> accepted -> superseded
93
- -> rejected
94
- ```
9
+ ultra-init
10
+ ├─ unresolved external claims ─► ultra-research
11
+ └─ bounded requested outcome ──► ultra-change
95
12
 
96
- The status of a proposal never grants execution authority. The accepted record, its
97
- digest, applied references, and the owning checkpoint do.
13
+ ultra-change ─► ultra-plan ─► ultra-dev (per task) ─► ultra-test ─► ultra-deliver
14
+ ▲ │ │
15
+ └── replan ◄──────┘ └── findings return to owner/model
98
16
 
99
- ## Checkpoints, not fixed steps
17
+ ultra-status read-only router at any point
18
+ ultra-delegate orthogonal bounded execution on another CLI
19
+ ```
100
20
 
101
- Stage authority is revisioned:
21
+ Arrows are recommendations, not automatic invocation. The owner explicitly selects
22
+ each public workflow.
102
23
 
103
- ```text
104
- draft revision N
105
- -> accepted revision N
106
- -> accepted revision N+1 supersedes N
107
- ```
24
+ ## Common entry contract
108
25
 
109
- Semantic diagnostics remain recorded but do not reject the model's explicit
110
- checkpoint conclusion. A structural, digest, path, publication, or concurrency
111
- conflict keeps the same draft mutable. Plan export is part of Plan checkpoint
112
- publication, so changing a Task contract before acceptance cannot invalidate an
113
- already-recorded “export step.” There is no locked intermediate run to cancel or
114
- manually repair.
26
+ Every user-invoked Skill reads, in order:
115
27
 
116
- Accepted checkpoints are immutable evidence. New facts create a replacement draft.
117
- Only archive history is terminal; subsequent product work opens a new Change.
28
+ 1. `.ultra/tasks.json`;
29
+ 2. the unfinished task's `context_file` and closing `## Resume Note`;
30
+ 3. `CONTEXT.md` and relevant `.ultra/decisions/`;
31
+ 4. the active Change, specifications, evidence, and Git state relevant to its scope.
118
32
 
119
- ## Change lifecycle
33
+ Missing files produce a precise recovery or initialization recommendation. They do not
34
+ cause the Skill to invent a state transition.
120
35
 
121
- Live v0.24 writes only:
36
+ ## Initialization
122
37
 
123
- ```text
124
- active -> archived
125
- |
126
- -> cancelled
127
- ```
38
+ `ultra-init` distinguishes owner authorization from claims requiring evidence. It
39
+ creates the file skeleton, preserves unknowns as `[NEEDS CLARIFICATION]`, initializes
40
+ Git when absent, and records only repository-observable brownfield facts. It does not
41
+ perform research or launch another workflow.
128
42
 
129
- `blocked`, `ready`, and `needs_attention` are derived diagnostics, not absorbing Change
130
- states. An active Change may be revised. The Deliver Skill inspects the relevant Task,
131
- Context, test, review, documentation, and delivery evidence, decides semantic
132
- sufficiency, and records deliberate omissions. Archive validates the explicit handoff,
133
- current authority, reconciliation structure, and safe recoverable filesystem/DB
134
- transaction without enforcing a fixed stage sequence. Archived bytes remain immutable.
43
+ ## Research
135
44
 
136
- Older `ready` or `blocked` rows are readable migration history. They do not authorize
137
- new work until migration/revalidation derives current checkpoint authority.
45
+ `ultra-research` maps unresolved claims to the smallest useful subset of seventeen
46
+ focused references. Reports are written immediately. Three material checkpoints can
47
+ change later scope; the owner resolves those checkpoints. The final distillate records
48
+ Git blob hashes of the specifications it summarizes.
138
49
 
139
- ## Task and Session lifecycle
50
+ ## Change reconciliation
140
51
 
141
- Task durable outcomes remain portable:
52
+ `ultra-change` first compares requested behavior with product truth and current code.
53
+ It classifies changes by the resulting commitments:
142
54
 
143
- ```text
144
- pending -> in_progress -> completed
145
- | | |
146
- | -> blocked -> in_progress (explicit reopen)
147
- -> blocked
148
- -> cancelled
149
- ```
55
+ - expansion and correction may proceed inside accepted intent;
56
+ - a reduction waits for explicit owner authority.
57
+
58
+ The output is one active Change intent with observable outcome, acceptance, seams,
59
+ non-goals, and trace anchors.
150
60
 
151
- `in_progress`, Worker ownership, leases, PIDs, heartbeats, worktrees, and completion
152
- commit backfill are checkout-local. They are not published to Git.
153
- Reopening a completed Task clears the local completion/session fields, preserves the
154
- prior completion commit in an append-only `task_reopened` event, and requires a new
155
- durable outcome before it can be completed again.
61
+ ## Planning
156
62
 
157
- `ultra.session acquire` atomically:
63
+ `ultra-plan` confirms the scope posture and public seams, then writes a task graph and
64
+ one context file per task. Feature tasks are tracer bullets. A contract task precedes
65
+ cross-process or cross-top-level-boundary implementations; integration checkpoints
66
+ appear after several slices. Cycles and broken trace paths are repaired before handoff.
158
67
 
159
- 1. checks a real lease/CAS conflict;
160
- 2. compiles or reuses the exact Context Envelope;
161
- 3. creates an immutable Worker Packet;
162
- 4. allocates the lease/worktree;
163
- 5. returns packet path/digest and exact execution boundary.
68
+ ## Task development
164
69
 
165
- A missing semantic detail is diagnostic, not a transport failure. A genuine lease,
166
- digest, unsafe path, or concurrent authority conflict fails closed. Optional
167
- orchestration can dispatch only a Change-owned Task with an accepted Plan checkpoint
168
- and assigned Worker Packet.
70
+ `ultra-dev` writes the implementation plan into the task context before code. It uses
71
+ `ultra-tdd` on confirmed seams, records six evidence dimensions, and keeps ledger and
72
+ context status synchronized. The closing Resume Note is rewritten even when work stops
73
+ early.
169
74
 
170
- ## Team sync
75
+ Task review uses six independent lenses. Findings move through stable JSON artifacts,
76
+ not intermediate worker chatter. Refactoring happens after the evidence makes real
77
+ duplication or coupling visible.
171
78
 
172
- `.ultra/tasks/tasks.json` is a tracked, digest-chained team checkpoint. It carries
173
- portable baseline, Change, Decision summary/reference, accepted Stage Checkpoint, Task
174
- contract, dependency, and durable outcome records. It excludes local execution state.
79
+ ## Whole-system audit
175
80
 
176
- `ultra.sync` supports:
81
+ `ultra-test` runs once after the ledger is complete. It checks anti-patterns, coverage,
82
+ wiring, E2E behavior, performance, and security. It names the exact Git commit and
83
+ never turns an orphan, failed command, stub, or omission into permission to alter scope.
177
84
 
178
- - `inspect`: side-effect-free condition and migration advice;
179
- - `migrate`: exact-byte backup-first legacy conversion;
180
- - `import`: schema/digest/ancestry/CAS validation and clean fast-forward;
181
- - `publish`: reconcile incoming Git authority, then publish one new generation.
85
+ ## Delivery
182
86
 
183
- Same-record concurrent edits return a typed conflict. Ultra does not silently choose
184
- one intent. Imported accepted baseline authority requires checkout-local source/spec
185
- revalidation before descendant publication.
87
+ `ultra-deliver` reconciles actual outcome, specifications, documentation, current test
88
+ report, aggregate review, build, version impact, omissions, and rollback. It archives
89
+ the Change with `git mv` after local reconciliation.
186
90
 
187
- Metadata-only Ultra commits do not make a baseline stale. Source or specification
188
- drift remains visible and may require revalidation.
91
+ Commit, push, tag, publication, release, and deployment are independent external
92
+ effects. Readiness grants none automatically.
189
93
 
190
- ## Hook lifecycle
94
+ ## Status routing
191
95
 
192
- Hooks do not drive the capability graph. They:
96
+ `ultra-status` infers the smallest next route from observable files:
193
97
 
194
- - inject a bounded Context Envelope where the host consumes it;
195
- - protect the team checkpoint and generated projections from direct writes;
196
- - save/restore minimal compact recovery state;
197
- - record minimal lifecycle identifiers;
198
- - return advisory Stop context.
98
+ - no healthy skeleton → init;
99
+ - unresolved evidence-bearing claim → research;
100
+ - requested outcome without active Change → change;
101
+ - active Change without executable ledger → plan;
102
+ - pending or in-progress task → dev;
103
+ - completed ledger without current report → test;
104
+ - current report and unarchived Change → deliver.
199
105
 
200
- When a host ignores Hook stdout, the adapter records health/events only and every Skill
201
- reads `ultra.context` explicitly. Hook limitations are never presented as successful
202
- context injection.
106
+ It also checks installation provenance, stale reports, old in-progress work, and
107
+ unresolved markers. It does not mutate artifacts.
203
108
 
204
- ## Recovery
109
+ ## Artifact closure
205
110
 
206
- Use `ultra.context` first; legacy input must return a discoverable migration action
207
- instead of blocking diagnosis. Use `ultra.sync migrate` for semantic conversion and
208
- `ultra.doctor { repair: true }` for mechanical backup/recovery.
111
+ Every durable output has a later reader:
209
112
 
210
- Migration supports v4.4/v4.5 projections and v0.22/v0.23 database/ledger authority.
211
- It is exact-byte backup-first, transactional, and fail-closed on conflict. Legacy
212
- workflow/dialogue rows survive as history but do not authorize current work.
113
+ - init's north star and specification skeletons are read by all later workflows;
114
+ - research reports are traced into specifications, Change reconciliation, planning,
115
+ and delivery;
116
+ - Change intent is consumed through planning, development, audit, review, status, and
117
+ delivery;
118
+ - task ledger and contexts are the common resume input, while task evidence feeds
119
+ review, whole-system audit, and delivery;
120
+ - the current test report is consumed by status and delivery;
121
+ - delivery moves with the Change into archive and remains historical evidence.
213
122
 
214
- Repair never invents a product choice, edits a semantic artifact to make it pass, or
215
- asks the user to hand-edit SQLite.
123
+ `ultra-status` intentionally writes nothing. Review, Hook, compact, and delegation
124
+ files are derived observations with explicit rebuild or rerun paths. No route creates
125
+ an unowned drift log, Change plan, technical-debt report, or second delivery summary.
216
126
 
217
- ## Hard-error boundary
127
+ ## Interruption and cross-host continuation
218
128
 
219
- Only these classes fail the tool call:
129
+ Before stopping, the active task context records current facts, exact verification,
130
+ open questions, Completion, and a closing Resume Note. The next session or host repeats
131
+ the common entry contract and compares the working tree with those claims.
220
132
 
221
- - database/schema corruption;
222
- - unsafe path, symlink, or identity swap;
223
- - actual digest, CAS, or lease concurrency conflict;
224
- - missing/incompatible native runtime;
225
- - permission failure;
226
- - archive/publish/deploy or another irreversible external-effect failure.
133
+ This path remains valid when hooks and `ubp` are disabled. A compact snapshot may be
134
+ used as a hint, then checked against canonical files and Git.
227
135
 
228
- Evidence gaps, incomplete exploration, stale optional context, missing reports, or
229
- other semantic insufficiency are structured diagnostics. The model remains responsible
230
- for investigating, revising, accepting, or explicitly recording an omission.
136
+ An authenticated Claude-to-Codex continuation using this path passed on 2026-08-03;
137
+ the exact scope, provenance, results, and limitations are recorded in the
138
+ [runtime compatibility matrix](RUNTIME-COMPAT-MATRIX.md#authenticated-cross-host-continuation-evidence).
package/hooks/README.md CHANGED
@@ -1,42 +1,24 @@
1
- # Ultra Builder Pro workflow hooks
1
+ # Ultra Builder Pro hooks
2
2
 
3
- These Hooks observe only Ultra-owned state. Session health/context recognizes an
4
- initialized `.ultra/.runtime/state.db` and reads the canonical Context Envelope.
5
- Direct writes to the MCP-owned Git checkpoint and checkout-local projections remain
6
- blocked; context, compact, stop, and agent lifecycle behavior is recovery-oriented and
7
- does not turn semantic diagnostics into refusal gates.
3
+ Ultra ships five small file-first hooks. Every hook first looks for a `.ultra/`
4
+ directory and exits silently when the workflow is not active.
8
5
 
9
- | Lifecycle | Hook | Purpose |
6
+ | Hook | Lifecycle | Purpose |
10
7
  |---|---|---|
11
- | Session start | `health_check.py` | Read-only integrity, incident, projection, session, and change-artifact checks |
12
- | Shared helper | `context_envelope.py` | Read the same bounded Context Envelope used by MCP, Skills, Sessions, and Workers |
13
- | Session start | `workflow_context.py` | Inject the compact envelope with accepted intent, never raw interaction or provider payloads |
14
- | Before edit | `active_task_context.py` | Protect `.ultra/tasks/tasks.json` (Git team checkpoint) and `.ultra/.runtime/projections/tasks.json` (local view), then restate the same DB-derived task breadcrumb |
15
- | Before compact | `workflow_checkpoint.py` | Validate and atomically save a minimal workflow checkpoint |
16
- | After compact/resume | `workflow_resume.py` | Prefer the DB breadcrumb; restore the minimal file checkpoint only when no active change owns recovery |
17
- | Stop | `pre_stop_check.py` | Report an incomplete workflow boundary and allow stop |
18
- | Subagent lifecycle | `subagent_tracker.py` | Append minimal start/stop metadata to the authoritative DB event stream |
8
+ | `session_context.py` | Session start | Inject the one-line north star and current acceptance criteria |
9
+ | `mid_workflow_recall.py` | Before source reads or edits | Restate current acceptance only |
10
+ | `compact_context.py` | Before/after compaction | Save and restore a disposable snapshot derived from files and Git |
11
+ | `post_edit_guard.py` | After edits | Record mechanical evidence observations without deciding completion |
12
+ | `block_dangerous_commands.py` | Before shell execution | Advise on additive protected-branch publication; block history rewrites and a narrow destructive set until the exact command is owner-authorized |
19
13
 
20
- The plugin deliberately does not capture prompts, tool observations, transcripts, summaries, general
21
- conversational memory, or code-graph payloads. It does retain project-local Ultra workflow memory in
22
- `.ultra/`. Generic command blocking and post-edit policy are user/repository governance. General
23
- memory and graph content belongs to separately installed providers.
14
+ `_common.py` is a shared library, not a lifecycle registration. Compact snapshots and
15
+ progress observations live under ignored `.ultra/.runtime/` or `.ultra/progress/`; the
16
+ canonical semantic facts remain the owner-readable files and Git.
24
17
 
25
- `subagent_tracker.py` passes only agent id/type and the host session id to the bundled
26
- `hook-event.cjs` helper. The helper binds the current change/task and appends
27
- `subagent_started` or `subagent_stopped` to `state.db`; it never stores transcript
28
- paths, messages, or a parallel JSONL lifecycle log.
29
-
30
- `context_envelope.py` is an imported library, not an additional lifecycle registration.
31
- Registering it separately would duplicate hook execution. The checkpoint is a recovery artifact, not a second authority. A valid newer
32
- live workflow wins; a newer valid checkpoint may restore a missing or older
33
- live file; corrupt, non-object, or terminal checkpoints are ignored.
34
-
35
- Runtime wiring:
36
-
37
- - Claude Code: native `hooks/hooks.json` with `${CLAUDE_PLUGIN_ROOT}` paths.
38
- - Codex: native `hooks/hooks.json` through `hooks/adapters/codex.py` for wire normalization.
39
- - OpenCode: native JavaScript plugin events; the Python hook suite is not copied.
40
- - Kimi Code: native lifecycle events through its wire adapter.
41
- - Grok Build: camelCase lifecycle events; ignored stdout channels are used for
42
- observation only, and every Skill rereads authoritative Context at entry.
18
+ Claude Code runs the hooks directly. Codex, Kimi Code, and Grok Build use the small
19
+ wire adapters under `hooks/adapters/`. OpenCode calls the same scripts from its native
20
+ JavaScript plugin. A hook failure is advisory except for the explicitly classified
21
+ destructive effects in `block_dangerous_commands.py`, whose denial includes a reachable
22
+ SHA-256-scoped authorization path. Additive protected-branch publication stays advisory
23
+ because portable hooks cannot consume every host's trusted owner-approval receipt;
24
+ history rewrites and branch deletion remain guarded.
@@ -0,0 +1,113 @@
1
+ """Small file-first helpers shared by Ultra hooks."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ import re
8
+ import sys
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+
13
+ def read_payload() -> dict[str, Any]:
14
+ try:
15
+ value = json.loads(sys.stdin.read() or "{}")
16
+ except json.JSONDecodeError:
17
+ return {}
18
+ return value if isinstance(value, dict) else {}
19
+
20
+
21
+ def project_root(payload: dict[str, Any]) -> Path | None:
22
+ candidate = payload.get("cwd") or payload.get("workspace_root") or os.getcwd()
23
+ path = Path(str(candidate)).resolve()
24
+ if path.is_file():
25
+ path = path.parent
26
+ for current in (path, *path.parents):
27
+ if (current / ".ultra").is_dir():
28
+ return current
29
+ return None
30
+
31
+
32
+ def markdown_section(text: str, heading: str) -> str:
33
+ pattern = re.compile(
34
+ rf"^##\s+{re.escape(heading)}\s*$\n(?P<body>.*?)(?=^##\s+|\Z)",
35
+ re.MULTILINE | re.DOTALL | re.IGNORECASE,
36
+ )
37
+ match = pattern.search(text)
38
+ return match.group("body").strip() if match else ""
39
+
40
+
41
+ def read_tasks(root: Path) -> list[dict[str, Any]]:
42
+ try:
43
+ value = json.loads((root / ".ultra" / "tasks.json").read_text(encoding="utf-8"))
44
+ except (OSError, json.JSONDecodeError):
45
+ return []
46
+ tasks = value.get("tasks", []) if isinstance(value, dict) else value
47
+ return [item for item in tasks if isinstance(item, dict)] if isinstance(tasks, list) else []
48
+
49
+
50
+ def current_task(root: Path) -> dict[str, Any] | None:
51
+ tasks = read_tasks(root)
52
+ for status in ("in_progress", "pending"):
53
+ for task in tasks:
54
+ if task.get("status") == status:
55
+ return task
56
+ return None
57
+
58
+
59
+ def project_file(root: Path, value: str, *, ultra_default: bool = False) -> Path | None:
60
+ relative = Path(value)
61
+ if relative.is_absolute():
62
+ return None
63
+ ultra_shorthands = {"changes", "contexts", "decisions", "evidence", "progress", "reviews", "specs"}
64
+ first = relative.parts[0] if relative.parts else ""
65
+ if first == ".ultra":
66
+ base = root
67
+ elif ultra_default and first in ultra_shorthands:
68
+ base = root / ".ultra"
69
+ else:
70
+ base = root
71
+ candidate = (base / relative).resolve()
72
+ try:
73
+ candidate.relative_to(root.resolve())
74
+ except ValueError:
75
+ return None
76
+ return candidate
77
+
78
+
79
+ def context_path(root: Path, task: dict[str, Any]) -> Path | None:
80
+ value = task.get("context_file")
81
+ if not isinstance(value, str) or not value:
82
+ return None
83
+ return project_file(root, value, ultra_default=True)
84
+
85
+
86
+ def task_sections(root: Path, task: dict[str, Any]) -> dict[str, str]:
87
+ file = context_path(root, task)
88
+ try:
89
+ text = file.read_text(encoding="utf-8") if file else ""
90
+ except OSError:
91
+ text = ""
92
+ return {
93
+ "acceptance": markdown_section(text, "Acceptance Criteria"),
94
+ "resume": markdown_section(text, "Resume Note"),
95
+ }
96
+
97
+
98
+ def emit_context(event: str, text: str) -> None:
99
+ if not text.strip():
100
+ return
101
+ print(json.dumps({
102
+ "hookSpecificOutput": {
103
+ "hookEventName": event,
104
+ "additionalContext": text.strip(),
105
+ }
106
+ }))
107
+
108
+
109
+ def write_json_atomic(file: Path, payload: dict[str, Any]) -> None:
110
+ file.parent.mkdir(parents=True, exist_ok=True)
111
+ temporary = file.with_suffix(f"{file.suffix}.tmp-{os.getpid()}")
112
+ temporary.write_text(f"{json.dumps(payload, indent=2)}\n", encoding="utf-8")
113
+ temporary.replace(file)
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env python3
2
- """Codex wire adapter for Ultra Builder Pro hooks.
2
+ """Codex wire adapter for Ultra Builder Pro's five file-first hooks.
3
3
 
4
4
  Codex and Claude Code share the JSON-on-stdin command-hook shape, but differ
5
5
  at three important boundaries:
6
6
 
7
7
  - Codex emits ``apply_patch`` with the patch text in ``tool_input.command``;
8
- legacy Ultra edit hooks expect one ``Edit`` event per ``file_path``.
8
+ the post-edit sensor expects one ``Edit`` event per ``file_path``.
9
9
  - Codex rejects ``permissionDecision: ask`` in PreToolUse output. Ultra warning
10
10
  decisions therefore become advisory ``systemMessage`` values.
11
11
  - Each event has a strict output schema. This adapter removes foreign fields
@@ -30,13 +30,11 @@ from typing import Any
30
30
 
31
31
  HOOK_ROOT = Path(__file__).resolve().parent.parent
32
32
  ALLOWED_FEATURES = {
33
- "active_task_context.py",
34
- "health_check.py",
35
- "pre_stop_check.py",
36
- "subagent_tracker.py",
37
- "workflow_checkpoint.py",
38
- "workflow_context.py",
39
- "workflow_resume.py",
33
+ "block_dangerous_commands.py",
34
+ "compact_context.py",
35
+ "mid_workflow_recall.py",
36
+ "post_edit_guard.py",
37
+ "session_context.py",
40
38
  }
41
39
  UNIVERSAL_OUTPUT_FIELDS = {"continue", "stopReason", "suppressOutput", "systemMessage"}
42
40
  PATCH_FILE_RE = re.compile(r"^\*\*\* (?:Add|Update|Delete) File: (.+?)\s*$", re.MULTILINE)
@@ -58,7 +56,7 @@ def _patch_paths(tool_input: Any) -> list[str]:
58
56
 
59
57
 
60
58
  def normalize_inputs(payload: dict[str, Any]) -> list[dict[str, Any]]:
61
- """Return legacy-compatible input(s) for one Codex hook payload."""
59
+ """Return file-first hook input(s) for one Codex hook payload."""
62
60
  normalized = copy.deepcopy(payload)
63
61
  if normalized.get("tool_response") is not None and normalized.get("tool_output") is None:
64
62
  normalized["tool_output"] = normalized["tool_response"]
@@ -90,7 +88,7 @@ def _universal(output: dict[str, Any]) -> dict[str, Any]:
90
88
 
91
89
 
92
90
  def adapt_output(output: dict[str, Any], event: str) -> dict[str, Any]:
93
- """Convert a legacy hook result to the strict Codex event output schema."""
91
+ """Convert a shared hook result to the strict Codex event output schema."""
94
92
  if not isinstance(output, dict):
95
93
  return {}
96
94
  result = _universal(output)
@@ -239,11 +237,6 @@ def run_feature(feature: str, payload: dict[str, Any], feature_args: list[str])
239
237
  return {"systemMessage": f"Ultra hook feature is missing: {feature}"}
240
238
 
241
239
  event = str(payload.get("hook_event_name") or "")
242
- if feature == "workflow_resume.py" and event == "PostCompact":
243
- payload = dict(payload)
244
- payload["hook_event_name"] = "SessionStart"
245
- payload["source"] = "compact"
246
-
247
240
  env = os.environ.copy()
248
241
  env["UBP_HOOK_RUNTIME"] = "codex"
249
242
  plugin_data = env.get("PLUGIN_DATA") or env.get("CLAUDE_PLUGIN_DATA")
@@ -14,11 +14,11 @@ from typing import Any
14
14
 
15
15
  HOOK_ROOT = Path(__file__).resolve().parent.parent
16
16
  ALLOWED_FEATURES = {
17
- "active_task_context.py",
18
- "health_check.py",
19
- "pre_stop_check.py",
20
- "subagent_tracker.py",
21
- "workflow_checkpoint.py",
17
+ "block_dangerous_commands.py",
18
+ "compact_context.py",
19
+ "mid_workflow_recall.py",
20
+ "post_edit_guard.py",
21
+ "session_context.py",
22
22
  }
23
23
 
24
24
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
- """Kimi Code wire adapter for Ultra Builder Pro lifecycle hooks.
2
+ """Kimi Code wire adapter for Ultra Builder Pro's five file-first hooks.
3
3
 
4
- Kimi 0.26 uses snake_case JSON input compatible with the workflow hooks, but
4
+ Kimi uses snake_case JSON input compatible with the shared hooks, but
5
5
  its output contract accepts only ``message`` plus an optional structured deny.
6
6
  This adapter preserves explicit projection denials and optional Stop decisions, converts foreign context
7
7
  fields into Kimi messages, and fails open with diagnostic evidence.
@@ -20,18 +20,16 @@ from typing import Any
20
20
 
21
21
  HOOK_ROOT = Path(__file__).resolve().parent.parent
22
22
  ALLOWED_FEATURES = {
23
- "active_task_context.py",
24
- "health_check.py",
25
- "pre_stop_check.py",
26
- "subagent_tracker.py",
27
- "workflow_checkpoint.py",
28
- "workflow_context.py",
29
- "workflow_resume.py",
23
+ "block_dangerous_commands.py",
24
+ "compact_context.py",
25
+ "mid_workflow_recall.py",
26
+ "post_edit_guard.py",
27
+ "session_context.py",
30
28
  }
31
29
 
32
30
 
33
31
  def normalize_input(payload: dict[str, Any]) -> dict[str, Any]:
34
- """Add only the legacy aliases required by the shared workflow hooks."""
32
+ """Add only aliases required by the shared file-first hooks."""
35
33
  normalized = copy.deepcopy(payload)
36
34
  agent_name = normalized.get("agent_name")
37
35
  if isinstance(agent_name, str) and agent_name:
@@ -101,10 +99,6 @@ def run_feature(feature: str, payload: dict[str, Any], feature_args: list[str])
101
99
 
102
100
  event = str(payload.get("hook_event_name") or "")
103
101
  normalized = normalize_input(payload)
104
- if feature == "workflow_resume.py" and event == "PostCompact":
105
- normalized["hook_event_name"] = "SessionStart"
106
- normalized["source"] = "compact"
107
-
108
102
  env = os.environ.copy()
109
103
  env["UBP_HOOK_RUNTIME"] = "kimi"
110
104
  plugin_data = env.get("PLUGIN_DATA") or env.get("KIMI_PLUGIN_ROOT")