ultra-builder-pro-cli 0.25.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/.ultra-template/contexts/TEMPLATE.md +87 -0
  2. package/.ultra-template/decisions/.gitkeep +1 -0
  3. package/.ultra-template/evidence/.gitkeep +1 -0
  4. package/.ultra-template/north-star.md +46 -0
  5. package/.ultra-template/research/.gitkeep +1 -0
  6. package/.ultra-template/specs/discovery.md +2 -2
  7. package/.ultra-template/tasks.json +3 -0
  8. package/.ultra-template/test-report.json +27 -0
  9. package/CHANGELOG.md +40 -0
  10. package/README.md +217 -579
  11. package/adapters/_shared/delegate-profiles/kimi-read-only.md +15 -0
  12. package/adapters/_shared/delegate-profiles/kimi-write.md +17 -0
  13. package/adapters/_shared/file-ops.cjs +76 -2
  14. package/adapters/_shared/host-profile.cjs +97 -0
  15. package/adapters/_shared/plugin-core.cjs +204 -0
  16. package/adapters/_shared/runtime-assets.cjs +31 -96
  17. package/adapters/claude.js +92 -291
  18. package/adapters/codex.js +309 -842
  19. package/adapters/grok.js +143 -1469
  20. package/adapters/kimi.js +124 -1053
  21. package/adapters/opencode.js +230 -742
  22. package/bin/delegate-worker.cjs +323 -0
  23. package/bin/delegate.cjs +456 -0
  24. package/bin/install.js +38 -11
  25. package/docs/ARCHITECTURE.md +122 -216
  26. package/docs/ARTIFACT-AUTHORITY.md +90 -268
  27. package/docs/DECISIONS.md +75 -87
  28. package/docs/PHILOSOPHY.md +177 -0
  29. package/docs/PLUGIN-ISOLATION-CONTRACT.md +62 -39
  30. package/docs/RUNTIME-COMPAT-MATRIX.md +99 -156
  31. package/docs/SKILL-AUTHORING.md +94 -73
  32. package/docs/WORKFLOW-LIFECYCLE.md +93 -189
  33. package/hooks/README.md +17 -37
  34. package/hooks/_common.py +113 -0
  35. package/hooks/adapters/codex.py +9 -16
  36. package/hooks/adapters/grok.py +5 -5
  37. package/hooks/adapters/kimi.py +8 -14
  38. package/hooks/block_dangerous_commands.py +95 -0
  39. package/hooks/compact_context.py +65 -0
  40. package/hooks/mid_workflow_recall.py +25 -0
  41. package/hooks/post_edit_guard.py +105 -0
  42. package/hooks/session_context.py +30 -0
  43. package/package.json +17 -52
  44. package/skills/ultra-change/SKILL.md +97 -50
  45. package/skills/ultra-change/references/change-contract.md +40 -1
  46. package/skills/ultra-delegate/SKILL.md +82 -0
  47. package/skills/ultra-delegate/references/delegation-contract.md +51 -0
  48. package/skills/ultra-delegate/scripts/delegate_wait.py +86 -0
  49. package/skills/ultra-deliver/SKILL.md +61 -42
  50. package/skills/ultra-deliver/references/baseline-reconciliation.md +39 -20
  51. package/skills/ultra-dev/SKILL.md +96 -62
  52. package/skills/ultra-dev/references/debugging.md +22 -0
  53. package/skills/ultra-domain-modeling/SKILL.md +79 -0
  54. package/skills/ultra-grilling/SKILL.md +79 -0
  55. package/skills/ultra-init/SKILL.md +94 -37
  56. package/skills/ultra-init/references/brownfield-adoption.md +33 -83
  57. package/skills/ultra-init/scripts/init_project.cjs +84 -0
  58. package/skills/ultra-plan/SKILL.md +88 -68
  59. package/skills/ultra-research/SKILL.md +62 -48
  60. package/skills/ultra-research/references/00-problem-validation.md +5 -5
  61. package/skills/ultra-research/references/01-opportunity-discovery.md +3 -3
  62. package/skills/ultra-research/references/02-market-assessment.md +5 -4
  63. package/skills/ultra-research/references/03-competitive-landscape.md +3 -3
  64. package/skills/ultra-research/references/04-product-strategy.md +3 -3
  65. package/skills/ultra-research/references/05-assumptions-validation.md +5 -5
  66. package/skills/ultra-research/references/10-user-personas.md +3 -2
  67. package/skills/ultra-research/references/11-user-scenarios.md +3 -3
  68. package/skills/ultra-research/references/20-user-stories.md +4 -3
  69. package/skills/ultra-research/references/21-features-scope.md +3 -2
  70. package/skills/ultra-research/references/22-success-metrics.md +3 -3
  71. package/skills/ultra-research/references/30-architecture-context.md +3 -3
  72. package/skills/ultra-research/references/31-solution-strategy.md +3 -3
  73. package/skills/ultra-research/references/32-building-blocks.md +3 -3
  74. package/skills/ultra-research/references/40-deployment.md +3 -3
  75. package/skills/ultra-research/references/41-quality-risks.md +3 -3
  76. package/skills/ultra-research/references/99-synthesis.md +7 -7
  77. package/skills/ultra-review/SKILL.md +59 -32
  78. package/skills/ultra-review/references/code.md +17 -0
  79. package/skills/ultra-review/references/comments.md +12 -0
  80. package/skills/ultra-review/references/design.md +12 -0
  81. package/skills/ultra-review/references/errors.md +13 -0
  82. package/skills/ultra-review/references/spec.md +13 -0
  83. package/skills/ultra-review/references/tests.md +12 -0
  84. package/skills/ultra-review/references/worker-packet.md +40 -0
  85. package/skills/ultra-review/scripts/review_wait.py +26 -15
  86. package/skills/ultra-status/SKILL.md +61 -36
  87. package/skills/ultra-tdd/SKILL.md +81 -0
  88. package/skills/ultra-tdd/references/templates/README.md +20 -0
  89. package/skills/ultra-tdd/references/templates/feature-flag-default-audit.sh +79 -0
  90. package/skills/ultra-tdd/references/templates/persistence-real.ts +78 -0
  91. package/skills/ultra-tdd/references/templates/testcontainer-postgres.py +78 -0
  92. package/skills/ultra-tdd/references/templates/testcontainer-postgres.ts +73 -0
  93. package/skills/ultra-tdd/references/templates/vertical-slice.ts +66 -0
  94. package/skills/ultra-tdd/references/test-execution.md +18 -0
  95. package/skills/ultra-test/SKILL.md +70 -30
  96. package/skills/ultra-test/references/export-syntax.md +18 -0
  97. package/skills/ultra-test/scripts/worktree_digest.cjs +54 -0
  98. package/skills/ultra-think/SKILL.md +49 -27
  99. package/skills/ultra-think/references/autonomy-boundary.md +48 -0
  100. package/skills/ultra-think/references/interaction-boundary.md +18 -33
  101. package/.ultra-template/docs/research/README.md +0 -55
  102. package/.ultra-template/reports/templates/delivery-report.json +0 -17
  103. package/.ultra-template/reports/templates/test-report.json +0 -18
  104. package/.ultra-template/tasks/tasks.json +0 -15
  105. package/.ultra-template/templates/task-context.md +0 -19
  106. package/adapters/_shared/codex-assets.cjs +0 -725
  107. package/adapters/_shared/codex-ultra-tools-entry.cjs +0 -11
  108. package/adapters/_shared/interaction-contract.cjs +0 -129
  109. package/adapters/_shared/path-rewrite.cjs +0 -79
  110. package/adapters/_shared/runtime-native.cjs +0 -132
  111. package/adapters/_shared/settings-merge.cjs +0 -76
  112. package/agents/code-reviewer.md +0 -42
  113. package/agents/debugger.md +0 -40
  114. package/agents/review-code.md +0 -49
  115. package/agents/review-comments.md +0 -38
  116. package/agents/review-coordinator.md +0 -56
  117. package/agents/review-design.md +0 -40
  118. package/agents/review-errors.md +0 -43
  119. package/agents/review-spec.md +0 -39
  120. package/agents/review-tests.md +0 -40
  121. package/agents/tdd-runner.md +0 -38
  122. package/bin/orchestrator.js +0 -383
  123. package/commands/ultra-change.md +0 -10
  124. package/commands/ultra-deliver.md +0 -10
  125. package/commands/ultra-dev.md +0 -10
  126. package/commands/ultra-doctor.md +0 -10
  127. package/commands/ultra-init.md +0 -10
  128. package/commands/ultra-plan.md +0 -10
  129. package/commands/ultra-research.md +0 -10
  130. package/commands/ultra-review.md +0 -10
  131. package/commands/ultra-status.md +0 -10
  132. package/commands/ultra-test.md +0 -10
  133. package/commands/ultra-think.md +0 -10
  134. package/docs/AGENT-CONTEXT.md +0 -191
  135. package/docs/COMMIT-HASH-BACKFILL.md +0 -51
  136. package/docs/LEGACY-CLI-CROSSWALK.md +0 -175
  137. package/docs/ROADMAP.md +0 -101
  138. package/docs/STATE-DB-ACCESS-POLICY.md +0 -161
  139. package/hooks/active_task_context.py +0 -152
  140. package/hooks/context_envelope.py +0 -100
  141. package/hooks/health_check.py +0 -196
  142. package/hooks/pre_stop_check.py +0 -66
  143. package/hooks/runtime_paths.py +0 -396
  144. package/hooks/subagent_tracker.py +0 -88
  145. package/hooks/workflow_checkpoint.py +0 -76
  146. package/hooks/workflow_context.py +0 -48
  147. package/hooks/workflow_resume.py +0 -84
  148. package/mcp-server/hook-context.cjs +0 -38
  149. package/mcp-server/hook-event.cjs +0 -34
  150. package/mcp-server/lib/archive-journal.cjs +0 -1119
  151. package/mcp-server/lib/archive-mutation-worker.py +0 -365
  152. package/mcp-server/lib/artifact-registry.cjs +0 -1232
  153. package/mcp-server/lib/baseline-workflow.cjs +0 -1193
  154. package/mcp-server/lib/canonical-json.cjs +0 -19
  155. package/mcp-server/lib/change-authority.cjs +0 -26
  156. package/mcp-server/lib/change-packet.cjs +0 -790
  157. package/mcp-server/lib/change-workflow.cjs +0 -65
  158. package/mcp-server/lib/context-envelope.cjs +0 -581
  159. package/mcp-server/lib/context-paths.cjs +0 -142
  160. package/mcp-server/lib/decision-records.cjs +0 -423
  161. package/mcp-server/lib/delivery-transaction.cjs +0 -471
  162. package/mcp-server/lib/doctor-backup-worker.cjs +0 -328
  163. package/mcp-server/lib/doctor.cjs +0 -627
  164. package/mcp-server/lib/git-bootstrap.cjs +0 -651
  165. package/mcp-server/lib/init-project.cjs +0 -1021
  166. package/mcp-server/lib/kernel-change-workflow.cjs +0 -2029
  167. package/mcp-server/lib/legacy-change-workflow.cjs +0 -3032
  168. package/mcp-server/lib/managed-file-write.cjs +0 -172
  169. package/mcp-server/lib/plan-checkpoint.cjs +0 -177
  170. package/mcp-server/lib/plan-publication-worker.cjs +0 -830
  171. package/mcp-server/lib/plan-store.cjs +0 -794
  172. package/mcp-server/lib/prd-parser.cjs +0 -83
  173. package/mcp-server/lib/pricing.cjs +0 -44
  174. package/mcp-server/lib/project-context.cjs +0 -178
  175. package/mcp-server/lib/projector.cjs +0 -386
  176. package/mcp-server/lib/provider-refs.cjs +0 -42
  177. package/mcp-server/lib/runtime-paths.cjs +0 -1714
  178. package/mcp-server/lib/runtime-state.cjs +0 -222
  179. package/mcp-server/lib/safe-project-file.cjs +0 -385
  180. package/mcp-server/lib/stage-checkpoints.cjs +0 -463
  181. package/mcp-server/lib/state-authority.cjs +0 -95
  182. package/mcp-server/lib/state-db.cjs +0 -1580
  183. package/mcp-server/lib/state-ops.cjs +0 -1428
  184. package/mcp-server/lib/task-contract.cjs +0 -404
  185. package/mcp-server/lib/task-expander.cjs +0 -105
  186. package/mcp-server/lib/task-ledger.cjs +0 -1964
  187. package/mcp-server/lib/telemetry.cjs +0 -85
  188. package/mcp-server/lib/topo.cjs +0 -131
  189. package/mcp-server/lib/ultra-facade.cjs +0 -2684
  190. package/mcp-server/lib/worker-packet.cjs +0 -358
  191. package/mcp-server/server.cjs +0 -437
  192. package/orchestrator/auto-merge.cjs +0 -128
  193. package/orchestrator/daemon.cjs +0 -264
  194. package/orchestrator/dispatch-rules.cjs +0 -78
  195. package/orchestrator/parallel-orchestrator.cjs +0 -903
  196. package/orchestrator/planner/plan-builder.cjs +0 -125
  197. package/orchestrator/recovery.cjs +0 -188
  198. package/orchestrator/session-close-journal-worker.cjs +0 -5
  199. package/orchestrator/session-close-journal.cjs +0 -1014
  200. package/orchestrator/session-runner.cjs +0 -1153
  201. package/orchestrator/worktree-manager.cjs +0 -282
  202. package/settings.json +0 -7
  203. package/skills/cc-collab/SKILL.md +0 -42
  204. package/skills/code-review-expert/SKILL.md +0 -43
  205. package/skills/code-review-expert/references/correctness-reliability.md +0 -30
  206. package/skills/code-review-expert/references/design-boundaries.md +0 -26
  207. package/skills/code-review-expert/references/removal-plan.md +0 -24
  208. package/skills/codex-collab/SKILL.md +0 -49
  209. package/skills/codex-collab/evals/evals.json +0 -35
  210. package/skills/integration-rules/SKILL.md +0 -32
  211. package/skills/security-rules/SKILL.md +0 -38
  212. package/skills/testing-rules/SKILL.md +0 -32
  213. package/skills/ultra-doctor/SKILL.md +0 -41
  214. package/skills/ultra-plan/references/semantic-preflight.md +0 -20
  215. package/skills/ultra-verify/SKILL.md +0 -46
  216. package/skills/ultra-verify/evals/evals.json +0 -46
  217. package/skills/ultra-verify/references/cross-verify-modes.md +0 -28
  218. package/skills/ultra-verify/references/evidence-status.md +0 -21
  219. package/skills/ultra-verify/scripts/verify_wait.py +0 -94
  220. package/spec/cli-protocol.md +0 -102
  221. package/spec/mcp-tools.yaml +0 -312
  222. package/spec/schemas/baseline-reconciliation.v1.schema.json +0 -73
  223. package/spec/schemas/change-delta.v1.schema.json +0 -153
  224. package/spec/schemas/command-manifest.schema.json +0 -29
  225. package/spec/schemas/context-file.v4.5.schema.json +0 -54
  226. package/spec/schemas/delivery-report.v1.schema.json +0 -66
  227. package/spec/schemas/documentation-reconciliation.v1.schema.json +0 -106
  228. package/spec/schemas/mcp-tools.schema.json +0 -136
  229. package/spec/schemas/skill-manifest.schema.json +0 -24
  230. package/spec/schemas/state-db.sql +0 -641
  231. package/spec/schemas/task-ledger.v2.schema.json +0 -296
  232. package/spec/schemas/tasks.v4.5.schema.json +0 -96
  233. package/spec/schemas/test-report.v1.schema.json +0 -225
  234. package/ultra-tools/cli.cjs +0 -129
  235. package/ultra-tools/commands/db.cjs +0 -226
  236. package/ultra-tools/commands/legacy-memory.cjs +0 -159
  237. package/ultra-tools/commands/migrate.cjs +0 -1386
  238. package/ultra-tools/commands/session.cjs +0 -213
  239. package/ultra-tools/commands/status.cjs +0 -559
  240. package/ultra-tools/commands/system.cjs +0 -498
  241. package/ultra-tools/commands/task.cjs +0 -105
package/package.json CHANGED
@@ -1,21 +1,14 @@
1
1
  {
2
2
  "name": "ultra-builder-pro-cli",
3
- "version": "0.25.1",
4
- "description": "Explicitly invoked Ultra Builder Pro workflows for Claude Code, OpenCode, Codex CLI, Kimi Code, and Grok Build, with a project-local MCP persistence and safety kernel.",
3
+ "version": "0.26.0",
4
+ "description": "File-first Ultra Builder Pro workflows for Claude Code, OpenCode, Codex CLI, Kimi Code, and Grok Build.",
5
5
  "bin": {
6
6
  "ultra-builder-pro-cli": "bin/install.js",
7
- "ubp": "bin/install.js",
8
- "ubp-orchestrator": "bin/orchestrator.js",
9
- "ultra-tools": "ultra-tools/cli.cjs"
7
+ "ubp": "bin/install.js"
10
8
  },
11
9
  "files": [
12
10
  "bin",
13
11
  "adapters",
14
- "ultra-tools",
15
- "mcp-server",
16
- "orchestrator",
17
- "commands",
18
- "agents",
19
12
  "skills/ultra-init",
20
13
  "skills/ultra-research",
21
14
  "skills/ultra-plan",
@@ -26,47 +19,30 @@
26
19
  "skills/ultra-status",
27
20
  "skills/ultra-think",
28
21
  "skills/ultra-change",
29
- "skills/ultra-doctor",
30
- "skills/code-review-expert",
31
- "skills/security-rules",
32
- "skills/integration-rules",
33
- "skills/testing-rules",
34
- "skills/cc-collab",
35
- "skills/codex-collab",
36
- "skills/ultra-verify",
22
+ "skills/ultra-delegate",
23
+ "skills/ultra-grilling",
24
+ "skills/ultra-domain-modeling",
25
+ "skills/ultra-tdd",
26
+ "hooks/_common.py",
37
27
  "hooks/*.py",
38
28
  "hooks/adapters/*.py",
39
29
  "hooks/README.md",
40
- "spec/mcp-tools.yaml",
41
- "spec/cli-protocol.md",
42
- "spec/schemas",
43
30
  "LICENSE",
44
31
  "CHANGELOG.md",
45
- "settings.json",
46
32
  ".ultra-template",
47
- "docs/ROADMAP.md",
33
+ "docs/PHILOSOPHY.md",
48
34
  "docs/ARCHITECTURE.md",
49
35
  "docs/ARTIFACT-AUTHORITY.md",
50
36
  "docs/WORKFLOW-LIFECYCLE.md",
51
- "docs/LEGACY-CLI-CROSSWALK.md",
52
- "docs/AGENT-CONTEXT.md",
53
37
  "docs/SKILL-AUTHORING.md",
54
- "docs/COMMIT-HASH-BACKFILL.md",
55
38
  "docs/DECISIONS.md",
56
- "docs/STATE-DB-ACCESS-POLICY.md",
57
39
  "docs/PLUGIN-ISOLATION-CONTRACT.md",
58
40
  "docs/RUNTIME-COMPAT-MATRIX.md",
59
- "!**/__pycache__/**",
60
41
  "!**/*.pyc",
61
42
  "!**/*.pyo",
62
43
  "!**/*.test.cjs",
63
44
  "!**/tests/**",
64
- "!mcp-server/test-support/**",
65
- "!mcp-server/lib/workflow-state.cjs",
66
- "!mcp-server/lib/decision-dialogue.cjs",
67
- "!mcp-server/lib/context-spine.cjs",
68
- "!mcp-server/lib/project-breadcrumb.cjs",
69
- "!mcp-server/lib/spec-learning.cjs"
45
+ "!**/__pycache__/**"
70
46
  ],
71
47
  "keywords": [
72
48
  "claude-code",
@@ -78,7 +54,7 @@
78
54
  "cli",
79
55
  "multi-runtime",
80
56
  "ultra-builder-pro",
81
- "mcp",
57
+ "file-first",
82
58
  "meta-prompting",
83
59
  "context-engineering"
84
60
  ],
@@ -97,28 +73,17 @@
97
73
  },
98
74
  "scripts": {
99
75
  "test": "npm run test:all",
100
- "test:state": "node --test 'mcp-server/**/*.test.cjs'",
101
- "test:orch": "node --test 'orchestrator/**/*.test.cjs'",
102
- "test:spec": "node spec/scripts/test-all.cjs",
103
- "test:rest": "node --test adapters/_shared/tests/*.test.cjs adapters/tests/*.test.cjs ultra-tools/*.test.cjs tests/conformance/**/*.test.cjs tests/*.test.cjs",
104
- "test:all": "npm run test:state && npm run test:orch && npm run test:spec && npm run test:rest",
76
+ "test:node": "node --test adapters/_shared/tests/*.test.cjs tests/*.test.cjs",
77
+ "test:all": "npm run test:node && npm run test:hooks",
105
78
  "test:hooks": "pytest hooks/tests -q",
106
- "verify:release": "npm run test:all && npm run test:hooks && npm audit --omit=dev --audit-level=high",
79
+ "verify:release": "npm run test:all && npm audit --omit=dev --audit-level=high",
107
80
  "prepublishOnly": "npm run verify:release",
108
81
  "install:claude": "node bin/install.js --claude --local",
109
- "install:kimi": "node bin/install.js --kimi --local",
110
- "install:grok": "node bin/install.js --grok --local",
111
- "install:all": "node bin/install.js --all --local"
82
+ "install:kimi": "node bin/install.js --kimi --global",
83
+ "install:grok": "node bin/install.js --grok --global",
84
+ "install:all": "node bin/install.js --all --global"
112
85
  },
113
86
  "dependencies": {
114
- "@modelcontextprotocol/server": "2.0.0-beta.5",
115
- "@vercel/ncc": "0.38.4",
116
- "ajv": "^8.17.1",
117
- "ajv-formats": "^3.0.1",
118
- "better-sqlite3": "^11.5.0",
119
87
  "js-yaml": "^4.1.0"
120
- },
121
- "devDependencies": {
122
- "@modelcontextprotocol/client": "2.0.0-beta.5"
123
88
  }
124
89
  }
@@ -1,54 +1,101 @@
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
+
20
+ ## Whether this skill applies at all
21
+
22
+ | Situation | Where it goes |
23
+ |---|---|
24
+ | No pending or in-progress task, and something new is asked for | Here |
25
+ | A task is in progress and the specification turns out not to match reality | Not here — the dual-write path inside `ultra-dev` |
26
+ | The change makes no sentence in the specifications false | Neither — just make the change |
27
+
28
+ That third row is the checkable answer to "how small is too small to deserve a
29
+ Change file": if nothing the specifications say becomes untrue, there is nothing
30
+ to reconcile and nothing to record.
31
+
32
+ ## Definition of done
33
+
34
+ - `.ultra/changes/active/<id>/intent.md` states the observable outcome, the
35
+ executable acceptance, the non-goals, and the public seams touched.
36
+ - Each of the three reconciliation buckets is either empty or dispositioned, with
37
+ the owner's answer recorded for every bucket that was not empty.
38
+ - The draft stays editable until then; the owner's acceptance is what turns it
39
+ into authority.
40
+
41
+ ## Reconcile against a bounded scope
42
+
43
+ A whole-repository diff is unusable, so derive the scope with four steps anyone
44
+ can rerun:
45
+
46
+ 1. Decide which specification sections this request touches.
47
+ 2. For each section, collect the past tasks whose `trace_to` points at it, and
48
+ from those the set of code files they changed.
49
+ 3. `git log -- .ultra/specs/<file>` gives the commit where that specification
50
+ last changed.
51
+ 4. `git diff <that commit>..HEAD -- <those code files>` is the reconciliation
52
+ scope.
53
+
54
+ Sort what you find into three buckets, each with your recommended disposition:
55
+
56
+ | Bucket | Meaning |
57
+ |---|---|
58
+ | Specification says it, code does not implement it | Promised and missing |
59
+ | Code implements it, no specification says so | Built and unpromised |
60
+ | Both speak and they conflict | Contradictory |
61
+
62
+ Take the buckets to the owner. This is confirmed rather than assumed, because a
63
+ disposition can quietly be a REDUCTION.
64
+
65
+ ## Write the intent
66
+
67
+ Read `references/change-contract.md` and use its exact `intent.md` headings. The active
68
+ Change directory contains only this accepted contract until planning or delivery adds
69
+ its defined artifacts; do not invent a parallel semantic record.
70
+
71
+ Follow `../ultra-grilling/SKILL.md` to settle the boundary — one question at a
72
+ time, each with your recommendation. New domain terms go through
73
+ `../ultra-domain-modeling/SKILL.md`.
74
+
75
+ When the work is too large *and* the path itself is unclear, follow
76
+ `../ultra-think/SKILL.md` for a decision ticket instead of forcing a task
77
+ breakdown. What comes out is a question whose answer is a decision, not an
78
+ implementation slice.
79
+
80
+ When reconciliation proves the request is a directly executable one-slice correction,
81
+ follow `../ultra-tdd/SKILL.md` at the confirmed public seam instead of manufacturing a
82
+ task graph merely to satisfy ceremony.
83
+
84
+ Output is `.ultra/changes/active/<id>/intent.md`, the specification patches
85
+ reconciliation justified, possibly a `.ultra/decisions/<id>.md`, and any
86
+ vocabulary update. Recommend `ultra-research` for a real evidence gap or
87
+ `ultra-plan` once the contract is evidenced enough; do not invoke either.
88
+
89
+ ## When the owner decides
90
+
91
+ Every non-empty bucket, the Change boundary, and anything reconciliation turns up
92
+ that shrinks a prior commitment. A change that makes no specification sentence
93
+ false needs no permission at all.
94
+
95
+ ## References
96
+
97
+ - `../ultra-grilling/SKILL.md` — the loop for settling the boundary.
98
+ - `references/change-contract.md` — exact `intent.md` structure and profile fields.
99
+ - `../ultra-think/references/autonomy-boundary.md` — read before dispositioning a
100
+ bucket in a way that removes something already promised.
101
+ - `../ultra-tdd/SKILL.md` — read for an evidenced one-slice correction.
@@ -3,7 +3,46 @@
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
+
35
+ ## Recovery
36
+ <reversal or recovery path and its verification>
37
+
38
+ ## Unresolved Decisions
39
+ - <stable id, summary, blocking state, owner>
40
+ ```
41
+
42
+ Use `[NEEDS CLARIFICATION]` for missing semantic content. Do not silently omit a
43
+ heading, and do not add another file that restates the same contract.
44
+
45
+ ## Contract fields
7
46
 
8
47
  - `outcome`: one externally observable result.
9
48
  - `acceptance`: stable ids with a criterion and exact verification for each accepted
@@ -0,0 +1,82 @@
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
+ - Timeout and cancellation reach a terminal failed result and release `run.lock`.
25
+ - The primary host verifies the result against the delegated workflow's acceptance.
26
+
27
+ ## Prepare and run
28
+
29
+ Write under `.ultra/.runtime/delegations/<id>/`:
30
+
31
+ - `instruction.md`: bounded goal, sources, acceptance and forbidden effects;
32
+ - `permission.json`: the exact file-local boundary in the contract reference;
33
+ - `result.json`: launcher-published terminal artifact only.
34
+
35
+ `writable_roots` is an array of existing worktree-relative directories. An empty array
36
+ selects native read-only mode; one or more roots selects bounded write mode.
37
+ `external_effects` must be empty in this portable launcher: commit, push, publish,
38
+ deployment and other effects stay with the primary host. There is no `readable_roots`
39
+ claim because the five host sandboxes do not share one mechanically enforceable read
40
+ policy.
41
+
42
+ Create `.ultra/.runtime/worktrees/<id>` as a real Git worktree and run:
43
+
44
+ ```text
45
+ ubp delegate run --to <host> --instruction <file> --permission <file> --worktree <dir> --timeout <seconds>
46
+ ```
47
+
48
+ The command returns a receipt. Immediately run `scripts/delegate_wait.py`; read no
49
+ intermediate output. Use `ubp delegate status --delegation <dir>` for a read-only state
50
+ and `ubp delegate cancel --delegation <dir>` to request termination. Never delete a lock
51
+ to manufacture completion.
52
+
53
+ The worker returns one schema-constrained JSON final response. The launcher extracts it
54
+ from the host's native structured output, validates digests, process exit, exact schema,
55
+ actual base-HEAD diff and writable roots, then atomically publishes `result.json`. The
56
+ model never writes its own receipt. If owner input is needed, the worker terminates
57
+ `blocked` with questions and evidence; start a new id and fresh packet after obtaining
58
+ the answer.
59
+
60
+ After `finished`, inspect the isolated diff, rerun acceptance checks, and integrate via
61
+ the repository's normal Git workflow with ordinary authorization. Delegation never
62
+ auto-merges or writes canonical task/evidence files.
63
+
64
+ ## Synthesize multiple results
65
+
66
+ Three agreeing results are Consensus. Two of three are Majority and require examining
67
+ the dissent. Three different results are No Consensus: narrow the question or add
68
+ evidence. A failed external CLI does not block the underlying workflow; report the
69
+ missing evidence rather than turning a vote or score into truth.
70
+
71
+ ## When the owner decides
72
+
73
+ The owner authorizes delegation. External effects cannot be delegated by this launcher;
74
+ the primary host obtains their separate authorization. The primary host owns result
75
+ interpretation, risk acceptance, integration and task state.
76
+
77
+ ## References
78
+
79
+ - `references/delegation-contract.md` — strict permission, receipt and result schemas.
80
+ - `scripts/delegate_wait.py` — run immediately after the launch receipt.
81
+ - `../ultra-think/SKILL.md` — read when No Consensus exposes a consequential decision.
82
+ - `../ultra-think/references/autonomy-boundary.md` — read before granting write effects.
@@ -0,0 +1,51 @@
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. Absolute paths, symlink escapes, unknown fields, `readable_roots`,
16
+ and non-empty external effects are rejected.
17
+
18
+ ## Model final response
19
+
20
+ ```json
21
+ {
22
+ "$schema": "ultra-delegation-result-v1",
23
+ "status": "finished",
24
+ "summary": "Implemented the bounded slice.",
25
+ "changed_files": ["src/example.ts"],
26
+ "checks": [
27
+ {"command": "npm test -- example", "status": "passed", "output_ref": "stdout.log"}
28
+ ],
29
+ "evidence": ["src/example.ts"],
30
+ "questions": [],
31
+ "residual_risks": []
32
+ }
33
+ ```
34
+
35
+ Fields are exact. Status is `finished`, `blocked`, or `failed`; `blocked` requires a
36
+ question. Check status is `passed`, `failed`, or `not_run`. Changed files are unique,
37
+ normalized repository-relative paths and must exactly equal the launcher's Git diff.
38
+
39
+ The launcher extracts this object from native structured output and adds
40
+ `delegation_id`, `host`, instruction, permission, and output-schema digests,
41
+ `read_only`, `base_head`, `final_head`, timestamps, `exit_code`, and signal. Launcher
42
+ failures also add `failure_type`. A nonzero process cannot publish `finished`.
43
+
44
+ ## Recovery
45
+
46
+ - `status` distinguishes running, cancelling, stalled, and terminal artifacts.
47
+ - `cancel` writes `cancel.request`; the worker terminates its host process, publishes a
48
+ failed result with `failure_type: cancelled`, and removes `run.lock`.
49
+ - `--timeout` does the same with `failure_type: timeout`.
50
+ - A stopped worker with no result is recoverable through `cancel`, which finalizes the
51
+ 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())