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,54 +1,119 @@
1
1
  ---
2
2
  name: ultra-change
3
- description: Capture or revise one bounded feature, fix, redesign, or incident contract against a ready Ultra baseline. Use when post-baseline work needs accepted intent before research, planning, or implementation.
3
+ description: Open one bounded unit of work by first reconciling what the specifications promise against what the code actually does, then writing the intent that closes the gap. Use when nothing is in flight and something new is being asked for — a feature, a fix, a redesign, or an incident response.
4
4
  ---
5
5
 
6
- # Capture accepted Change intent
7
-
8
- A Change is the durable unit connecting research, plan, implementation, verification,
9
- review, documentation, and delivery. Its draft stays editable until a semantic
10
- checkpoint accepts the downstream authority.
11
-
12
- ## Inspect and align
13
-
14
- 1. Call `ultra.context { stage: project, detail: full }`.
15
- 2. Inspect or import the team checkpoint with `ultra.sync`. Stop only on a real
16
- baseline, Change, task, ancestry, or active-session conflict.
17
- 3. Reuse an existing matching Change. Do not duplicate authority.
18
- 4. Convert the request into observable outcome, executable acceptance, non-goals,
19
- public seams, recovery, verification, documentation impact, risk, and research
20
- disposition.
21
- 5. Recommend `quick`, `standard`, `major`, or `incident` from evidence, or record a
22
- clearer bounded repository-specific kind when those profiles lose meaning. These
23
- are model-owned labels, not SQLite enums. Ask only when
24
- a choice changes accepted product intent, compatibility, security, material cost,
25
- external effects, or recovery.
26
-
27
- Read `../ultra-think/references/interaction-boundary.md` before asking. MCP may report
28
- contradictory risk fields, but the model and owner choose the semantic correction.
29
-
30
- ## Record the contract
31
-
32
- Use one `ultra.record` batch with `change_contract / open` or
33
- `change_contract / revise`, relevant `decision / accept`, and `artifact / bind` for
34
- an already-known typed delta. Every entry carries a stable idempotency key. Read the
35
- result through `ultra.context`.
36
-
37
- Keep every Change-owned semantic artifact below
38
- `.ultra/changes/active/<change-id>/`. Standard and major Changes require a typed delta
39
- before planning. A true no-semantic-change case records an explicit reason instead of
40
- manufacturing a mutation.
41
-
42
- Changing accepted intent creates a new accepted checkpoint revision and makes only
43
- genuinely dependent evidence stale. Readiness is derived, not a stored absorbing
44
- state. Semantic diagnostics remain advisory; structural, digest, path, or concurrency
45
- conflicts require repair and retry of the same draft.
46
- Use `change_contract / cancel` only when the owner intentionally abandons the Change.
47
- An archived or cancelled Change remains immutable history. When new evidence requires
48
- continued work, use `change_contract / supersede` to create one linked active successor;
49
- never patch SQLite, reopen the historical row, or duplicate the relationship manually.
50
-
51
- Publish the durable Change contract with `ultra.sync { action: publish }` when it is a
52
- useful team handoff. Recommend bounded `ultra-research` for a real evidence gap or
53
- `ultra-plan` when the contract is sufficiently evidenced. Do not invoke the next
54
- capability automatically.
6
+ # Reconcile first, then write down what this Change commits to
7
+
8
+ A Change is the durable unit connecting research, plan, implementation,
9
+ verification, review and delivery. Reconciliation comes first because writing new
10
+ intent on top of specifications that already disagree with the code buries the
11
+ disagreement instead of resolving it.
12
+
13
+ ## Before you start
14
+
15
+ 1. Read `.ultra/tasks.json`, and the `context_file` of any task not yet finished.
16
+ 2. Read `CONTEXT.md` for vocabulary and `.ultra/decisions/` for entries in scope.
17
+ 3. Read `.ultra/north-star.md` — a Change that does not serve it is worth
18
+ questioning out loud before it is written down.
19
+ 4. Grep `.ultra/changes/archive/` for Changes that already touched this area. Read
20
+ `delivery.md` when present; otherwise read `archive-summary.md`, `verification.md` and
21
+ remaining owner-readable Markdown. A missing `delivery.md` does not mean no history;
22
+ a module that keeps reappearing is an architecture signal.
23
+
24
+ ## Whether this skill applies at all
25
+
26
+ | Situation | Where it goes |
27
+ |---|---|
28
+ | No pending or in-progress task, and something new is asked for | Here |
29
+ | A task is in progress and the specification turns out not to match reality | Not here — the dual-write path inside `ultra-dev` |
30
+ | The change makes no sentence in the specifications false | Neither — just make the change |
31
+
32
+ That third row is the checkable answer to "how small is too small to deserve a
33
+ Change file": if nothing the specifications say becomes untrue, there is nothing
34
+ to reconcile and nothing to record.
35
+
36
+ ## Definition of done
37
+
38
+ - `.ultra/changes/active/<id>/intent.md` states the observable outcome, the
39
+ executable acceptance, the non-goals, and the public seams touched.
40
+ - Each of the three reconciliation buckets is either empty or dispositioned, with
41
+ the owner's answer recorded for every bucket that was not empty.
42
+ - The draft stays editable until then; the owner's acceptance is what turns it
43
+ into authority.
44
+
45
+ ## Reconcile against a bounded scope
46
+
47
+ A whole-repository diff is unusable, so derive the scope with four steps anyone
48
+ can rerun:
49
+
50
+ 1. Decide which specification sections this request touches.
51
+ 2. For each section, collect the past tasks whose `trace_to` points at it, and
52
+ from those the set of code files they changed.
53
+ 3. `git log -- .ultra/specs/<file>` gives the commit where that specification
54
+ last changed.
55
+ 4. `git diff <that commit>..HEAD -- <those code files>` is the reconciliation
56
+ scope.
57
+
58
+ Sort what you find into three buckets, each with your recommended disposition:
59
+
60
+ | Bucket | Meaning |
61
+ |---|---|
62
+ | Specification says it, code does not implement it | Promised and missing |
63
+ | Code implements it, no specification says so | Built and unpromised |
64
+ | Both speak and they conflict | Contradictory |
65
+
66
+ Take the buckets to the owner — confirmed rather than assumed, because a
67
+ disposition can quietly withdraw a commitment. Sort by risk first and match the
68
+ asking to it: anything that touches a `HC-<n>` hard constraint or removes
69
+ something already promised goes one at a time with your recommendation; the
70
+ remaining low-risk rows go as a single list with a recommended disposition each,
71
+ for one confirmation. Twenty separate questions about rows that change nothing
72
+ spends the owner's attention where it was not needed, and trains them to approve
73
+ without reading.
74
+
75
+ ## Write the intent
76
+
77
+ Read `references/change-contract.md` and use its exact `intent.md` headings. The active
78
+ Change directory contains only this accepted contract until planning or delivery adds
79
+ its defined artifacts; do not invent a parallel semantic record.
80
+
81
+ Follow `../ultra-grilling/SKILL.md` to settle the boundary — one question at a
82
+ time, each with your recommendation. New domain terms go through
83
+ `../ultra-domain-modeling/SKILL.md`.
84
+
85
+ When the work is too large *and* the path itself is unclear, follow
86
+ `../ultra-think/SKILL.md` for a decision ticket instead of forcing a task
87
+ breakdown. What comes out is a question whose answer is a decision, not an
88
+ implementation slice.
89
+
90
+ When reconciliation proves the request is a directly executable one-slice correction,
91
+ follow `../ultra-tdd/SKILL.md` at the confirmed public seam instead of manufacturing a
92
+ task graph merely to satisfy ceremony.
93
+
94
+ Output is `.ultra/changes/active/<id>/intent.md`, the specification patches
95
+ reconciliation justified, possibly a `.ultra/decisions/<id>.md`, and any
96
+ vocabulary update. Recommend `ultra-research` for a real evidence gap or
97
+ `ultra-plan` once the contract is evidenced enough; do not invoke either.
98
+
99
+ ## Abandoning a Change
100
+
101
+ A Change that turns out to be the wrong thing to build exits by
102
+ `git mv .ultra/changes/active/<id> .ultra/changes/abandoned/<id>`, plus one line in
103
+ its `intent.md` saying why. Completed tasks keep their evidence; the work is
104
+ unlinked from the frontier, not deleted. This is the owner's call and a cheap one —
105
+ a Change kept alive to avoid admitting it was wrong poisons every later
106
+ reconciliation, which then measures the code against promises nobody intends to keep.
107
+
108
+ ## When the owner decides
109
+
110
+ Every non-empty bucket, the Change boundary, abandonment, and anything
111
+ reconciliation turns up that shrinks a prior commitment. A change that makes no
112
+ specification sentence false needs no permission at all.
113
+
114
+ ## References
115
+
116
+ - `../ultra-grilling/SKILL.md` — the loop for settling the boundary.
117
+ - `references/change-contract.md` — exact `intent.md` structure and profile fields.
118
+ - `../ultra-think/references/autonomy-boundary.md` — read before removing a promise.
119
+ - `../ultra-tdd/SKILL.md` — read for an evidenced one-slice correction.
@@ -3,11 +3,56 @@
3
3
  Create one contract before planning. Keep every field specific enough to verify and
4
4
  stable enough to survive a fresh session.
5
5
 
6
- ## Contract
6
+ ## Exact `intent.md` structure
7
+
8
+ ```markdown
9
+ # Change <id>: <title>
10
+
11
+ > **Status**: draft | accepted
12
+ > **Profile**: quick | standard | major | incident
13
+
14
+ ## Outcome
15
+ <one externally observable result>
16
+
17
+ ## Acceptance
18
+ | ID | Criterion | Verification | Trace |
19
+ |---|---|---|---|
20
+
21
+ ## Non-goals
22
+ - <explicit boundary>
23
+
24
+ ## Public Seams
25
+ - <entry point or output>
26
+
27
+ ## Reconciliation
28
+ ### Promised and Missing
29
+ ### Built and Unpromised
30
+ ### Contradictory
31
+
32
+ ## Planning Posture
33
+ <EXPAND | SELECTIVE | HOLD | REDUCE, rationale, and owner confirmation>
34
+ <!-- Scope for this Change only. Not the commitment classification: REDUCE here
35
+ means "plan less work now", while a REDUCTION in a Change Log means "a
36
+ promise the specification already made no longer holds". -->
37
+
38
+
39
+ ## Recovery
40
+ <reversal or recovery path and its verification>
41
+
42
+ ## Unresolved Decisions
43
+ - <stable id, summary, blocking state, owner>
44
+ ```
45
+
46
+ Use `[NEEDS CLARIFICATION]` for missing semantic content. Do not silently omit a
47
+ heading, and do not add another file that restates the same contract.
48
+
49
+ ## Contract fields
7
50
 
8
51
  - `outcome`: one externally observable result.
9
- - `acceptance`: stable ids with a criterion and exact verification for each accepted
10
- behavior.
52
+ - `acceptance`: stable ids, one criterion each, and a `Verification` that is an
53
+ **executable command** — something with an exit code, not a description of an
54
+ intention. `curl -sf localhost:3000/health` qualifies; "check that the endpoint
55
+ responds" does not.
11
56
  - `non_goals`: explicit boundaries that prevent accidental scope growth.
12
57
  - `public_seams`: entry points or outputs through which acceptance is observed.
13
58
  - `recovery`: a bounded reversal or recovery strategy and its verification.
@@ -16,6 +61,26 @@ stable enough to survive a fresh session.
16
61
  Resolve every blocking decision before planning. Keep non-blocking uncertainty visible
17
62
  in the task and verification contracts.
18
63
 
64
+ ## Why verification has to be executable
65
+
66
+ A criterion whose verification cannot be run is not acceptance, it is a wish. Three
67
+ consumers downstream depend on it being runnable:
68
+
69
+ - task development can treat passing acceptance as an exit condition only when
70
+ something can actually decide "passing";
71
+ - the review tests lens maps each acceptance claim to executable evidence, and can
72
+ only report an honest gap when there is something to map onto;
73
+ - delivery cannot otherwise separate "shipped" from "believed shipped".
74
+
75
+ Writing the command is also the cheapest way to find out that a criterion is vague.
76
+ "The feature is wired up" resists a command until it becomes "this export has a
77
+ non-test importer", which is a `grep`.
78
+
79
+ Where a criterion is genuinely a judgement call — visual polish, wording, feel — it
80
+ does not belong in Acceptance at all. Record it as a taste decision for the owner and
81
+ keep Acceptance to what a machine can settle. Mixing the two is what makes an
82
+ acceptance set undecidable.
83
+
19
84
  ## Profile
20
85
 
21
86
  - `quick`: one low-risk task, no material risk flags, and no research dependency.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: ultra-delegate
3
+ description: Delegate one bounded workflow segment to another installed CLI in an isolated worktree and return only its stable result artifact. Use when the owner asks for another model or host to execute, review, verify, or continue a specific slice of current work.
4
+ ---
5
+
6
+ # Run a bounded worker without giving it project authority
7
+
8
+ Delegation is an execution mode, not another workflow stage. The primary host keeps
9
+ semantic synthesis and remains the only writer of `.ultra/tasks.json`.
10
+
11
+ ## Before you start
12
+
13
+ 1. Read `.ultra/tasks.json`, the delegated task's `context_file` and `## Resume Note`.
14
+ 2. Read `CONTEXT.md`, relevant `.ultra/decisions/`, acceptance and current evidence.
15
+ 3. Define one bounded instruction, permission set, clean Git worktree and result.
16
+ 4. Read `references/delegation-contract.md` before writing either JSON artifact.
17
+
18
+ ## Definition of done
19
+
20
+ - The worktree is a clean registered Git worktree; instruction, permission and worker
21
+ spec digests remain unchanged.
22
+ - The worker terminates as `finished`, `blocked` or `failed` in a schema-valid
23
+ `result.json`; declared paths equal the actual Git diff and stay in writable roots.
24
+ - No `writable_roots` entry is `.ultra/` or sits under it, and the actual diff touches
25
+ nothing there.
26
+ - Timeout and cancellation reach a terminal failed result and release `run.lock`.
27
+ - The primary host verifies the result against the delegated workflow's acceptance.
28
+
29
+ ## Prepare and run
30
+
31
+ Write under `.ultra/.runtime/delegations/<id>/`:
32
+
33
+ - `instruction.md`: bounded goal, sources, acceptance and forbidden effects;
34
+ - `permission.json`: the exact file-local boundary in the contract reference;
35
+ - `result.json`: launcher-published terminal artifact only.
36
+
37
+ `writable_roots` is an array of existing worktree-relative directories. An empty array
38
+ selects native read-only mode; one or more roots selects bounded write mode.
39
+ **Neither `.ultra/` nor any path under it may appear in it.** The worktree carries a
40
+ checkout of `.ultra` because Git tracks it, but the project's memory has exactly one
41
+ writer. Two workers appending to `tasks.json`, `progress/` or `evidence/` in separate
42
+ worktrees collide in the very files every later session reads to resume. Worker findings
43
+ and state changes travel back in `result.json` and are applied by the primary host.
44
+ `external_effects` must be empty in this portable launcher: commit, push, publish,
45
+ deployment and other effects stay with the primary host. There is no `readable_roots`
46
+ claim because the five host sandboxes do not share one mechanically enforceable read
47
+ policy.
48
+
49
+ Create `.ultra/.runtime/worktrees/<id>` as a real Git worktree and run:
50
+
51
+ ```text
52
+ ubp delegate run --to <host> --instruction <file> --permission <file> --worktree <dir> --timeout <seconds>
53
+ ```
54
+
55
+ The command returns a receipt. Immediately run `scripts/delegate_wait.py`; read no
56
+ intermediate output. Use `ubp delegate status --delegation <dir>` for a read-only state
57
+ and `ubp delegate cancel --delegation <dir>` to request termination. Never delete a lock
58
+ to manufacture completion.
59
+
60
+ The worker returns one schema-constrained JSON final response. The launcher extracts it
61
+ from the host's native structured output, validates digests, process exit, exact schema,
62
+ actual base-HEAD diff and writable roots, then atomically publishes `result.json`. The
63
+ model never writes its own receipt. If owner input is needed, the worker terminates
64
+ `blocked` with questions and evidence; start a new id and fresh packet after obtaining
65
+ the answer.
66
+
67
+ After `finished`, inspect the isolated diff, rerun acceptance checks, and integrate via
68
+ the repository's normal Git workflow with ordinary authorization. Delegation never
69
+ auto-merges or writes canonical task/evidence files.
70
+
71
+ ## Synthesize multiple results
72
+
73
+ Three agreeing results are Consensus. Two of three are Majority and require examining
74
+ the dissent. Three different results are No Consensus: narrow the question or add
75
+ evidence. A failed external CLI does not block the underlying workflow; report the
76
+ missing evidence rather than turning a vote or score into truth.
77
+
78
+ ## When the owner decides
79
+
80
+ The owner authorizes delegation. External effects cannot be delegated by this launcher;
81
+ the primary host obtains their separate authorization. The primary host owns result
82
+ interpretation, risk acceptance, integration and task state.
83
+
84
+ ## References
85
+
86
+ - `references/delegation-contract.md` — strict permission, receipt and result schemas.
87
+ - `scripts/delegate_wait.py` — run immediately after the launch receipt.
88
+ - `../ultra-think/SKILL.md` — read when No Consensus exposes a consequential decision.
89
+ - `../ultra-think/references/autonomy-boundary.md` — read before granting write effects.
@@ -0,0 +1,59 @@
1
+ # Delegation artifact contract
2
+
3
+ ## Permission
4
+
5
+ ```json
6
+ {
7
+ "$schema": "ultra-delegation-permission-v1",
8
+ "writable_roots": ["src", "test"],
9
+ "external_effects": []
10
+ }
11
+ ```
12
+
13
+ Fields are exact. Roots are normalized worktree-relative directories that already
14
+ exist. An empty array selects native read-only mode; `.` deliberately grants the whole
15
+ isolated checkout except `.ultra/`. Absolute paths, symlink escapes, unknown fields,
16
+ `readable_roots`, `.ultra` or any path beneath it, and non-empty external effects are
17
+ rejected.
18
+
19
+ `.ultra/` is never writable by a worker under any root, `.` included. The project's
20
+ memory has exactly one writer — the primary host — because two worktrees appending to
21
+ `tasks.json`, `progress/` or `evidence/` collide in precisely the files a later session
22
+ reads to resume. Enforced twice: the launcher rejects a `.ultra` root before the
23
+ delegation starts, and the worker fails an actual diff that touches it with
24
+ `unauthorized_write`.
25
+
26
+ ## Model final response
27
+
28
+ ```json
29
+ {
30
+ "$schema": "ultra-delegation-result-v1",
31
+ "status": "finished",
32
+ "summary": "Implemented the bounded slice.",
33
+ "changed_files": ["src/example.ts"],
34
+ "checks": [
35
+ {"command": "npm test -- example", "status": "passed", "output_ref": "stdout.log"}
36
+ ],
37
+ "evidence": ["src/example.ts"],
38
+ "questions": [],
39
+ "residual_risks": []
40
+ }
41
+ ```
42
+
43
+ Fields are exact. Status is `finished`, `blocked`, or `failed`; `blocked` requires a
44
+ question. Check status is `passed`, `failed`, or `not_run`. Changed files are unique,
45
+ normalized repository-relative paths and must exactly equal the launcher's Git diff.
46
+
47
+ The launcher extracts this object from native structured output and adds
48
+ `delegation_id`, `host`, instruction, permission, and output-schema digests,
49
+ `read_only`, `base_head`, `final_head`, timestamps, `exit_code`, and signal. Launcher
50
+ failures also add `failure_type`. A nonzero process cannot publish `finished`.
51
+
52
+ ## Recovery
53
+
54
+ - `status` distinguishes running, cancelling, stalled, and terminal artifacts.
55
+ - `cancel` writes `cancel.request`; the worker terminates its host process, publishes a
56
+ failed result with `failure_type: cancelled`, and removes `run.lock`.
57
+ - `--timeout` does the same with `failure_type: timeout`.
58
+ - A stopped worker with no result is recoverable through `cancel`, which finalizes the
59
+ stale run. Retry under a new delegation id and fresh digests.
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env python3
2
+ """Wait for one delegated result to become non-empty and stable."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import json
8
+ import re
9
+ import time
10
+ from pathlib import Path
11
+
12
+
13
+ RESULT_SCHEMA = "ultra-delegation-result-v1"
14
+ STATUSES = {"finished", "blocked", "failed"}
15
+ CHECK_STATUSES = {"passed", "failed", "not_run"}
16
+
17
+
18
+ def nonempty(value) -> bool:
19
+ return isinstance(value, str) and bool(value.strip())
20
+
21
+
22
+ def validate_result(payload: dict) -> None:
23
+ if not isinstance(payload, dict):
24
+ raise ValueError("result must be a JSON object")
25
+ if payload.get("$schema") != RESULT_SCHEMA:
26
+ raise ValueError(f"result $schema must be {RESULT_SCHEMA}")
27
+ if payload.get("status") not in STATUSES:
28
+ raise ValueError("result status must be finished, blocked, or failed")
29
+ if not nonempty(payload.get("summary")):
30
+ raise ValueError("result summary must be non-empty")
31
+ for field in ("changed_files", "checks", "evidence", "questions", "residual_risks"):
32
+ if not isinstance(payload.get(field), list):
33
+ raise ValueError(f"result {field} must be an array")
34
+ for field in ("changed_files", "evidence", "questions", "residual_risks"):
35
+ if not all(nonempty(item) for item in payload[field]):
36
+ raise ValueError(f"result {field} must contain non-empty strings")
37
+ for check in payload["checks"]:
38
+ if not isinstance(check, dict) or not nonempty(check.get("command")):
39
+ raise ValueError("result checks require a command")
40
+ if check.get("status") not in CHECK_STATUSES:
41
+ raise ValueError("result check status is invalid")
42
+ if payload["status"] == "blocked" and not payload["questions"]:
43
+ raise ValueError("blocked result requires a question")
44
+ for field in ("delegation_id", "host", "base_head", "final_head", "started_at", "finished_at"):
45
+ if not nonempty(payload.get(field)):
46
+ raise ValueError(f"result {field} must be non-empty")
47
+ for field in ("instruction_digest", "permission_digest", "output_schema_digest"):
48
+ if not isinstance(payload.get(field), str) or not re.fullmatch(r"[0-9a-f]{64}", payload[field]):
49
+ raise ValueError(f"result {field} must be a SHA-256 digest")
50
+ if not isinstance(payload.get("read_only"), bool):
51
+ raise ValueError("result read_only must be a boolean")
52
+ if payload.get("exit_code") is not None and not isinstance(payload["exit_code"], int):
53
+ raise ValueError("result exit_code must be an integer or null")
54
+
55
+
56
+ def wait_for_result(path: Path, interval: float, timeout: float) -> dict:
57
+ deadline = time.monotonic() + timeout
58
+ previous_size = -1
59
+ stable_reads = 0
60
+ while time.monotonic() < deadline:
61
+ size = path.stat().st_size if path.exists() else 0
62
+ if size > 0 and size == previous_size:
63
+ stable_reads += 1
64
+ if stable_reads >= 1:
65
+ payload = json.loads(path.read_text(encoding="utf-8"))
66
+ validate_result(payload)
67
+ return payload
68
+ else:
69
+ stable_reads = 0
70
+ previous_size = size
71
+ time.sleep(interval)
72
+ raise TimeoutError(f"result did not stabilize within {timeout:g}s: {path}")
73
+
74
+
75
+ def main() -> int:
76
+ parser = argparse.ArgumentParser()
77
+ parser.add_argument("result", type=Path)
78
+ parser.add_argument("--interval", type=float, default=1.0)
79
+ parser.add_argument("--timeout", type=float, default=1800.0)
80
+ args = parser.parse_args()
81
+ print(json.dumps(wait_for_result(args.result, args.interval, args.timeout)))
82
+ return 0
83
+
84
+
85
+ if __name__ == "__main__":
86
+ raise SystemExit(main())
@@ -1,46 +1,102 @@
1
1
  ---
2
2
  name: ultra-deliver
3
- description: Reconcile and archive an explicitly accepted Ultra Change with recoverable local evidence. Use when the caller is ready to make a local delivery handoff with current managed evidence and an explicit rationale for any omitted capability.
3
+ description: Reconcile one completed Change, run aggregate review and refactoring, refresh release documentation, and archive the local workflow record. Use when the task ledger is complete and the owner wants a delivery handoff or separately authorized release effects.
4
4
  ---
5
5
 
6
- # Converge and archive local authority
7
-
8
- Delivery closes local Ultra authority. It never grants commit, push, tag, registry
9
- publication, deployment, or another external effect.
10
-
11
- ## Prepare the packet
12
-
13
- 1. Call `ultra.context { stage: deliver, scope: { change_id }, detail: full }`.
14
- 2. Import a newer team checkpoint with `ultra.sync`; stop on a real conflict.
15
- 3. Inspect current task outcomes, tests, both review axes, accepted decisions, typed
16
- delta, documentation reconciliation, and checkout evidence. Decide whether the
17
- actual Change is sufficiently complete; explicitly record any omitted stage and its
18
- evidence-based rationale instead of inventing a fixed recipe.
19
- 4. Resolve every specification-learning candidate. Keep updates inside the Change
20
- overlay until archive.
21
- 5. Write and register documentation reconciliation and an
22
- `ultra-delivery-report-v1` report. The report binds Change, baseline, HEAD,
23
- worktree/context digests, local checks, rollback guidance, and timestamp; it contains
24
- no release decision.
25
-
26
- Use one typed `ultra.record` batch for `artifact / bind`, any normalized
27
- `decision / accept`, and bounded `event / append` facts.
28
-
29
- ## Archive once
30
-
31
- Call `ultra.archive` once with the Change id, stable idempotency key, archive summary,
32
- reconciliation fields, delivery evidence steps, explicit omissions, and report output.
33
- The model's report is the semantic handoff. MCP validates its current registered
34
- authority, paths, digests, reconciliation structure, and idempotency; applies the
35
- overlay and archive through the recoverable filesystem/DB transaction; rebinds
36
- registered artifacts into a self-contained archive; and publishes the updated team
37
- checkpoint. It does not require a hard-coded Plan/Dev/Test/Review/Deliver sequence.
38
-
39
- Semantic warnings remain in the archive history but do not reject an explicit local
40
- handoff. Corruption, unsafe paths, digest/CAS conflicts, permissions, or recovery
41
- failure remain fail-closed and route to `ultra-doctor`.
42
-
43
- Verify the archived packet, baseline, checkpoint, and rollback state. Handle any
44
- separately authorized Git or release effect only after local delivery and report it as
45
- external evidence, not Ultra delivery authority. Do not invoke another capability
46
- automatically.
6
+ # Turn current evidence into a recoverable delivery handoff
7
+
8
+ Delivery closes the local Change. Commit, push, tag, publication and deployment remain
9
+ separate effects; local readiness grants none of them automatically.
10
+
11
+ ## Before you start
12
+
13
+ 1. Read `.ultra/tasks.json` and each completed task's `context_file`, Completion and
14
+ closing `## Resume Note`.
15
+ 2. Read `CONTEXT.md`, relevant `.ultra/decisions/`, active Change intent and evidence.
16
+ 3. Read `.ultra/test-report.json` and current `HEAD`. If `git_commit` differs from HEAD,
17
+ label the report stale and obtain current evidence before a release recommendation.
18
+
19
+ ## Definition of done
20
+
21
+ - Actual outcome, specifications, docs, tests and aggregate review have been reconciled,
22
+ with every documentation file checked against the actual diff rather than from memory.
23
+ - Every changed export has a non-test consumer or a recorded owner disposition.
24
+ - Every omitted stage is explicitly recorded with its evidence-based rationale.
25
+ - Build and release checks have exact commands and real results.
26
+ - The Change is archived with `git mv`, and rollback remains a normal Git operation.
27
+
28
+ ## Review and refactor
29
+
30
+ Follow `../ultra-review/SKILL.md` across the aggregate Change. This is where useful
31
+ refactoring occurs: several completed slices now reveal real duplication, coupling and
32
+ deep-module boundaries. Rerun every check affected by a refactor and refresh the report
33
+ against the resulting HEAD.
34
+
35
+ ## Reconcile the handoff
36
+
37
+ 1. Compare accepted intent and task traces with delivered behavior.
38
+ 2. Apply justified specification corrections; route any REDUCTION to the owner.
39
+ 3. Reconcile every document against the actual diff, not only the ones you remember
40
+ touching. List the repository's documentation files, read the Change's full diff, and
41
+ repair each place a document now describes behavior that no longer exists. CHANGELOG
42
+ and README are the usual ones, but a stale example in a guide, a renamed flag in a
43
+ runbook and an obsolete field in an API note drift the same way and are found the
44
+ same way. Record bounded debt only in the active Change `delivery.md` under
45
+ `## Technical Debt`.
46
+ 4. Run the repository's build and packaging checks.
47
+ 5. Determine the version impact from the public contract and project convention.
48
+ 6. Follow `references/baseline-reconciliation.md` and write the one canonical active
49
+ Change `delivery.md` with exact checks, residual risks, omissions and rollback.
50
+
51
+ Step 3 is the **exit** reconciliation and does not duplicate `ultra-change`'s entry
52
+ reconciliation. Entry asks whether the specifications already disagreed with the code
53
+ before this Change was written; exit asks which documents this Change just made wrong.
54
+ One keeps the intent from inheriting drift, the other keeps the Change from leaving new
55
+ drift behind.
56
+
57
+ ## The one delivery gate
58
+
59
+ This gate applies only after the owner explicitly invokes `ultra-deliver`; it does not
60
+ attach itself to ordinary repository packaging outside this workflow.
61
+
62
+ Everything else in this workflow reports and hands over. This is the exception, and it
63
+ is deliberately narrow:
64
+
65
+ **Do not package while an export this Change added or changed has no non-test consumer
66
+ and no recorded owner disposition.**
67
+
68
+ | | |
69
+ |---|---|
70
+ | Invariant | Every changed export is either reachable from a non-test caller or explicitly declared internal |
71
+ | Fact source | The Wiring Verification results in `.ultra/test-report.json`, bound to the current HEAD — the audit already found these; this is not a fresh opinion |
72
+ | Blocked effect | Packaging and the release effects after it. Local commit and archival are untouched |
73
+ | Repair | Wire the export to its caller, or record the owner's disposition in `delivery.md` naming it internal-only and why. Either one clears the gate |
74
+
75
+ "Written but never connected" is the single defect that passes every other check: tests
76
+ green, review clean, evidence complete, feature absent. An advisory here would be
77
+ ignored exactly when it matters, because everything else already reads as done. The gate
78
+ sits at the last step rather than at edit time on purpose — a gate early in the loop
79
+ gets escaped by damaging the work.
80
+
81
+ ## Archive locally
82
+
83
+ Move `.ultra/changes/active/<id>` to `.ultra/changes/archive/<id>` with `git mv` only
84
+ after local reconciliation. Do not create a second standalone delivery report: archived
85
+ `delivery.md`, test report, evidence and Git history are the handoff.
86
+
87
+ For separately authorized effects, perform and verify each independently. Ask for
88
+ authority at the point of effect: commit, then push, then tag, package publication and
89
+ deployment as applicable. A failure in one does not imply permission to attempt another.
90
+
91
+ ## When the owner decides
92
+
93
+ The owner accepts residual risk, reductions, the version, and every external effect.
94
+ Without release authority, stop after the recoverable local archive and report it.
95
+
96
+ ## References
97
+
98
+ - `../ultra-review/SKILL.md` — read before aggregate review and refactoring.
99
+ - `../ultra-think/SKILL.md` — read when version or release posture is a consequential
100
+ trade-off rather than an established repository rule.
101
+ - `../ultra-think/references/autonomy-boundary.md` — read before scope or evidence shrinks.
102
+ - `references/baseline-reconciliation.md` — exact `delivery.md` reconciliation contract.