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,40 +0,0 @@
1
- ---
2
- name: review-design
3
- description: Review one bounded diff for invariant, boundary, coupling, and complexity risks with concrete product or maintenance impact.
4
- tools: Read, Grep, Glob, Bash, Write
5
- model: opus
6
- maxTurns: 18
7
- ---
8
-
9
- # Design review worker
10
-
11
- Write findings to the assigned JSON file and return only a file acknowledgement.
12
-
13
- ## Workflow
14
-
15
- 1. Validate the immutable `WORKER_PACKET`, exact `PACKET_DIGEST`, `SESSION_PATH`,
16
- `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`, HEAD, and the supplied
17
- architecture and acceptance context. Stop incomplete when any value differs from
18
- the packet.
19
- 2. Trace changed types and modules through their real constructors, callers, state,
20
- side effects, and consumers.
21
- 3. Check whether important invariants can be bypassed, ownership is ambiguous, an
22
- abstraction leaks across a boundary, or coupling makes a required change unsafe.
23
- 4. Review complexity only when it creates a concrete correctness, testing, recovery,
24
- or maintenance cost. Function length, nesting, parameter count, primitive types,
25
- and data-only structures are signals, not defects by themselves.
26
- 5. Prefer a focused before/after remediation when simplification is supported by the
27
- current use cases. Do not propose speculative frameworks or abstractions.
28
- 6. Calibrate severity to the reachable impact and write
29
- `ultra-review-findings-v2` following `SCHEMA_PATH`, including the exact
30
- `packet_digest`.
31
-
32
- Use `axis: engineering_standards` and the narrowest applicable category, such as
33
- `architecture`, `type-design`, or `complexity`. After valid output, return exactly:
34
-
35
- ```text
36
- Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
37
- ```
38
-
39
- Do not modify source, call Ultra MCP write tools, change task state, or edit another
40
- worker's artifact.
@@ -1,43 +0,0 @@
1
- ---
2
- name: review-errors
3
- description: Trace changed failure paths for swallowed errors, false success, lost recovery, or unsafe fallback behavior and write a structured artifact.
4
- tools: Read, Grep, Glob, Bash, Write
5
- model: opus
6
- maxTurns: 15
7
- skills:
8
- - security-rules
9
- ---
10
-
11
- # Failure-path review worker
12
-
13
- Write findings to the assigned JSON file and return only a file acknowledgement.
14
-
15
- ## Workflow
16
-
17
- 1. Validate the immutable `WORKER_PACKET`, exact `PACKET_DIGEST`, `SESSION_PATH`,
18
- `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`, HEAD, and the supplied
19
- runtime and acceptance context. Stop incomplete when any value differs from the
20
- packet.
21
- 2. Trace changed exceptions, error results, retries, fallbacks, optional values,
22
- cancellation, timeouts, and asynchronous work from trigger to caller-visible state.
23
- 3. Identify handlers that swallow a required failure, report false success, lose
24
- diagnostic context, retry unsafely, expose sensitive details, or leave state
25
- inconsistent.
26
- 4. Do not require a particular syntax such as try/catch, Result, or logging. Confirm
27
- the language and framework propagation contract before reporting a defect.
28
- 5. Treat empty catches, null fallbacks, optional chaining, fire-and-forget work, and
29
- generic messages as investigation signals. Severity follows reachable impact, not
30
- the surface pattern.
31
- 6. Check the corresponding recovery and observability path, then write
32
- `ultra-review-findings-v2` following `SCHEMA_PATH`, including the exact
33
- `packet_digest`.
34
-
35
- Use `axis: engineering_standards` and category `error-handling` or `security`. After
36
- valid output, return exactly:
37
-
38
- ```text
39
- Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
40
- ```
41
-
42
- Do not modify source, call Ultra MCP write tools, change task state, or edit another
43
- worker's artifact.
@@ -1,39 +0,0 @@
1
- ---
2
- name: review-spec
3
- description: Independently review whether one bounded diff satisfies its accepted intent, delta, public contract, and documentation obligations.
4
- tools: Read, Grep, Glob, Bash, Write
5
- model: opus
6
- maxTurns: 15
7
- ---
8
-
9
- # Specification-fidelity review worker
10
-
11
- Write findings to the assigned JSON file and return only a file acknowledgement. Keep
12
- this axis independent from general engineering quality.
13
-
14
- ## Workflow
15
-
16
- 1. Validate the immutable `WORKER_PACKET`, exact `PACKET_DIGEST`, `SESSION_PATH`,
17
- `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`, HEAD, and the supplied
18
- intent, accepted delta, acceptance criteria, and public-seam context. Stop
19
- incomplete when any value differs from the packet.
20
- 2. Read the changed behavior and only the callers, tests, docs, and contracts needed to
21
- determine whether each accepted requirement is actually delivered.
22
- 3. Map every acceptance criterion to current executable or source evidence. Check for
23
- omitted behavior, unintended scope, stale specification or operational docs, and
24
- incompatible public contracts.
25
- 4. Do not report style, generic maintainability, or preferred architecture on this
26
- axis. Report only a concrete mismatch between accepted intent and delivered behavior.
27
- 5. Calibrate severity to the user-visible or delivery impact and write
28
- `ultra-review-findings-v2` following `SCHEMA_PATH`, including the exact
29
- `packet_digest`.
30
-
31
- Use `axis: spec_fidelity` and the narrowest category, such as `acceptance-gap`,
32
- `scope-drift`, `spec-drift`, or `public-contract`. After valid output, return exactly:
33
-
34
- ```text
35
- Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
36
- ```
37
-
38
- Do not modify source, call Ultra MCP write tools, change task state, specifications,
39
- or another worker's artifact.
@@ -1,40 +0,0 @@
1
- ---
2
- name: review-tests
3
- description: Review whether changed behavior has trustworthy and proportionate executable evidence, then write a structured engineering artifact.
4
- tools: Read, Grep, Glob, Bash, Write
5
- model: opus
6
- maxTurns: 18
7
- skills:
8
- - testing-rules
9
- ---
10
-
11
- # Test evidence review worker
12
-
13
- Write findings to the assigned JSON file and return only a file acknowledgement.
14
-
15
- ## Workflow
16
-
17
- 1. Validate the immutable `WORKER_PACKET`, exact `PACKET_DIGEST`, `SESSION_PATH`,
18
- `OUTPUT_FILE`, `SCHEMA_PATH`, `DIFF_RANGE`, `DIFF_FILES`, HEAD, and the supplied
19
- acceptance context. Stop incomplete when any value differs from the packet.
20
- 2. Map each changed behavior and acceptance claim to an executable test or check.
21
- 3. Follow `testing-rules` to determine what the evidence proves across functional,
22
- persistence, protocol, UI, and failure boundaries that matter to this diff.
23
- 4. Inspect test doubles for contract fidelity rather than banning them by name. Flag a
24
- double only when it bypasses the behavior under review or diverges from production
25
- semantics.
26
- 5. Detect missing error or state-transition coverage, ineffective assertions, hidden
27
- skips, flaky assumptions, and tests that never reach the changed code.
28
- 6. Calibrate severity to the escaped product risk and write
29
- `ultra-review-findings-v2` following `SCHEMA_PATH`, including the exact
30
- `packet_digest`.
31
-
32
- Use `axis: engineering_standards` and category `test-quality`. After valid output,
33
- return exactly:
34
-
35
- ```text
36
- Wrote N findings (P0:X P1:X P2:X P3:X) to <filepath>
37
- ```
38
-
39
- Do not modify tests or production code, call Ultra MCP write tools, change task state,
40
- or edit another worker's artifact.
@@ -1,38 +0,0 @@
1
- ---
2
- name: tdd-runner
3
- description: Run the repository's exact test or coverage command, isolate actionable failures, and return concise execution evidence without editing files.
4
- tools: Bash, Read, Grep, Glob
5
- model: opus
6
- maxTurns: 20
7
- skills:
8
- - testing-rules
9
- ---
10
-
11
- # Test execution specialist
12
-
13
- Run tests and analyze their evidence. This assignment is read-only.
14
-
15
- ## Workflow
16
-
17
- 1. Resolve the requested scope, checkout, repository guidance, and canonical command
18
- from package scripts, CI configuration, or framework files. Ask the parent to
19
- resolve ambiguity when different commands prove different contracts.
20
- For an Ultra delegation, validate the immutable Worker Packet and echo its exact
21
- `packet_digest` in the assigned output.
22
- 2. Run the exact command without weakening flags, skipping failures, or changing test
23
- configuration. Capture exit code, duration, pass/fail/skip counts, and coverage only
24
- when the runner reports it.
25
- 3. For each failure, identify the first useful error, tight source or test location,
26
- whether the failure reproduces, and the most likely boundary that is wrong. Separate
27
- product defects, test defects, environment failures, and flaky or nondeterministic
28
- evidence.
29
- 4. Evaluate test doubles only when relevant to the failed or requested behavior. Flag
30
- one only when it bypasses the contract under test or diverges materially from the
31
- production boundary.
32
- 5. Return a concise summary with the exact command, exit code, counts, actionable
33
- failures, environment limitations, and residual coverage gaps. Do not paste the full
34
- runner transcript unless the parent requests it.
35
-
36
- Do not edit tests or production code, call Ultra MCP write tools, change task state, or
37
- edit projections. Do not claim a green suite when the command did not complete
38
- successfully.
@@ -1,383 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * ubp-orchestrator — Phase 5.4 daemon CLI.
5
- *
6
- * Subcommands:
7
- * execute-plan resume the current plan through the first unfinished dependency wave.
8
- * run foreground daemon (debug / test).
9
- * start detached background daemon, writes .ultra/.runtime/orchestrator.pid.
10
- * stop reads pidfile, SIGTERM the process, deletes pidfile.
11
- * status prints pidfile + running session summary.
12
- *
13
- * Opt-in gate: `start` and `run` require settings.json
14
- * `orchestrator.auto_dispatch: true` — default off per PLAN Phase 5.4 AC.
15
- *
16
- * Dispatch requires both explicit opt-in and an explicit executable command.
17
- * A daemon may never reserve a session/worktree without a real worker process.
18
- */
19
-
20
- 'use strict';
21
-
22
- const fs = require('node:fs');
23
- const path = require('node:path');
24
- const { spawn } = require('node:child_process');
25
- const { isSupportedRuntime } = require('../adapters/_shared/runtime-assets.cjs');
26
- const runtimePaths = require('../mcp-server/lib/runtime-paths.cjs');
27
-
28
- const REPO_ROOT = process.env.UBP_REPO_ROOT || process.cwd();
29
- const RUNTIME_PATHS = runtimePaths.pathsFor(REPO_ROOT);
30
- const PIDFILE = RUNTIME_PATHS.orchestratorPidPath;
31
- const LOGFILE = RUNTIME_PATHS.orchestratorLogPath;
32
- const SETTINGS_FILES = [
33
- path.join(REPO_ROOT, 'settings.json'),
34
- path.join(REPO_ROOT, '.claude', 'settings.json'),
35
- ];
36
-
37
- function readSettings() {
38
- for (const f of SETTINGS_FILES) {
39
- if (fs.existsSync(f)) {
40
- try { return JSON.parse(fs.readFileSync(f, 'utf8')) || {}; }
41
- catch { /* fall through */ }
42
- }
43
- }
44
- return {};
45
- }
46
-
47
- function optInAllowed(settings) {
48
- return !!(settings && settings.orchestrator && settings.orchestrator.auto_dispatch === true);
49
- }
50
-
51
- function parseRuntimes() {
52
- const raw = process.env.UBP_ORCH_RUNTIMES || 'claude,opencode,codex,kimi,grok';
53
- const runtimes = [...new Set(raw.split(',').map((s) => s.trim()).filter(Boolean))];
54
- const invalid = runtimes.filter((runtime) => !isSupportedRuntime(runtime));
55
- if (invalid.length > 0) {
56
- throw new Error(`unsupported orchestrator runtime(s): ${invalid.join(', ')}`);
57
- }
58
- return runtimes;
59
- }
60
-
61
- function commandConfigError(code, message) {
62
- const error = new Error(message);
63
- error.code = code;
64
- return error;
65
- }
66
-
67
- function resolveDispatchCommand(settings, env = process.env) {
68
- const configured = settings?.orchestrator || {};
69
- const fromEnvironment = typeof env.UBP_ORCH_COMMAND === 'string'
70
- && env.UBP_ORCH_COMMAND.trim() !== '';
71
- const command = fromEnvironment
72
- ? env.UBP_ORCH_COMMAND.trim()
73
- : (typeof configured.command === 'string' ? configured.command.trim() : '');
74
- if (!command) {
75
- throw commandConfigError(
76
- 'ORCHESTRATOR_COMMAND_REQUIRED',
77
- 'orchestrator dispatch requires orchestrator.command or UBP_ORCH_COMMAND',
78
- );
79
- }
80
- if (/\s/.test(command) && !fs.existsSync(command)) {
81
- throw commandConfigError(
82
- 'ORCHESTRATOR_COMMAND_INVALID',
83
- 'orchestrator.command must contain only the executable; put arguments in command_args',
84
- );
85
- }
86
-
87
- let commandArgs;
88
- if (fromEnvironment && env.UBP_ORCH_ARGS_JSON !== undefined) {
89
- try {
90
- commandArgs = JSON.parse(env.UBP_ORCH_ARGS_JSON);
91
- } catch (error) {
92
- throw commandConfigError(
93
- 'ORCHESTRATOR_COMMAND_INVALID',
94
- `UBP_ORCH_ARGS_JSON must be a JSON array: ${error.message}`,
95
- );
96
- }
97
- } else {
98
- commandArgs = configured.command_args === undefined ? [] : configured.command_args;
99
- }
100
- if (!Array.isArray(commandArgs) || commandArgs.some((arg) => typeof arg !== 'string')) {
101
- throw commandConfigError(
102
- 'ORCHESTRATOR_COMMAND_INVALID',
103
- 'orchestrator command arguments must be an array of strings',
104
- );
105
- }
106
- return {
107
- command,
108
- commandArgs: commandArgs.slice(),
109
- source: fromEnvironment ? 'environment' : 'settings',
110
- };
111
- }
112
-
113
- function parseExecutePlanArgs(argv = []) {
114
- const options = {
115
- changeId: null,
116
- autoMerge: false,
117
- mergeBaseBranch: 'main',
118
- };
119
- for (let index = 0; index < argv.length; index += 1) {
120
- const arg = argv[index];
121
- if (arg === '--auto-merge') {
122
- options.autoMerge = true;
123
- continue;
124
- }
125
- if (arg === '--change' || arg === '--base-branch') {
126
- const value = argv[index + 1];
127
- if (!value || value.startsWith('--')) {
128
- throw commandConfigError(
129
- 'ORCHESTRATOR_ARGUMENT_INVALID',
130
- `${arg} requires a value`,
131
- );
132
- }
133
- if (arg === '--change') options.changeId = value;
134
- else options.mergeBaseBranch = value;
135
- index += 1;
136
- continue;
137
- }
138
- throw commandConfigError(
139
- 'ORCHESTRATOR_ARGUMENT_INVALID',
140
- `unknown execute-plan option: ${arg}`,
141
- );
142
- }
143
- return options;
144
- }
145
-
146
- function validateOrchestratorRuntime(rootDir = REPO_ROOT, {
147
- forMutation = false,
148
- } = {}) {
149
- return runtimePaths.validateProjectLayout(rootDir, {
150
- env: {},
151
- forMutation,
152
- validateRuntimeTree: true,
153
- });
154
- }
155
-
156
- function openNoFollow(file, flags) {
157
- const noFollow = fs.constants.O_NOFOLLOW || 0;
158
- return fs.openSync(file, flags | noFollow, 0o600);
159
- }
160
-
161
- async function cmdExecutePlan(argv = []) {
162
- const settings = readSettings();
163
- const dispatch = resolveDispatchCommand(settings);
164
- const options = parseExecutePlanArgs(argv);
165
- const { initStateDb, closeStateDb } = require('../mcp-server/lib/state-db.cjs');
166
- const parallelOrchestrator = require('../orchestrator/parallel-orchestrator.cjs');
167
- const { db } = initStateDb(runtimePaths.ensureRuntimeState(REPO_ROOT).stateDbPath);
168
- try {
169
- const result = await parallelOrchestrator.runPlan({
170
- db,
171
- repoRoot: REPO_ROOT,
172
- changeId: options.changeId,
173
- runtimes: parseRuntimes(),
174
- command: dispatch.command,
175
- commandArgs: dispatch.commandArgs,
176
- autoMerge: options.autoMerge,
177
- mergeBaseBranch: options.mergeBaseBranch,
178
- onError: (error) => process.stderr.write(`orchestrator error: ${error.message}\n`),
179
- });
180
- process.stdout.write(`${JSON.stringify({
181
- ok: true,
182
- data: {
183
- ...result,
184
- auto_merge: options.autoMerge,
185
- merge_base_branch: options.mergeBaseBranch,
186
- },
187
- })}\n`);
188
- return result;
189
- } finally {
190
- closeStateDb(db);
191
- }
192
- }
193
-
194
- function cmdRun(opts = {}) {
195
- const settings = readSettings();
196
- if (!opts.skipOptIn && !optInAllowed(settings)) {
197
- process.stderr.write(
198
- 'orchestrator.auto_dispatch is not enabled in settings.json.\n' +
199
- 'Set {"orchestrator":{"auto_dispatch":true}} to opt in.\n',
200
- );
201
- process.exit(2);
202
- }
203
- const { initStateDb } = require('../mcp-server/lib/state-db.cjs');
204
- const { runDaemon } = require('../orchestrator/daemon.cjs');
205
- const runtimes = parseRuntimes();
206
- const dispatch = resolveDispatchCommand(settings);
207
- const { db } = initStateDb(runtimePaths.ensureRuntimeState(REPO_ROOT).stateDbPath);
208
- const handle = runDaemon({
209
- db,
210
- repoRoot: REPO_ROOT,
211
- runtimes,
212
- command: dispatch.command,
213
- commandArgs: dispatch.commandArgs,
214
- pollMs: Number(process.env.UBP_ORCH_POLL_MS || 1000),
215
- onError: (err) => process.stderr.write(`orchestrator error: ${err.message}\n`),
216
- });
217
-
218
- const shutdown = (signal) => {
219
- process.stderr.write(`orchestrator received ${signal}, stopping\n`);
220
- handle.stop();
221
- try { db.close(); } catch (_) { /* ignore */ }
222
- process.exit(0);
223
- };
224
- process.on('SIGTERM', () => shutdown('SIGTERM'));
225
- process.on('SIGINT', () => shutdown('SIGINT'));
226
- process.stderr.write(
227
- `orchestrator running (pollMs=${Number(process.env.UBP_ORCH_POLL_MS || 1000)}, ` +
228
- `runtimes=${runtimes.join(',')}, worker=${dispatch.command}, source=${dispatch.source})\n`,
229
- );
230
- // Keep process alive while the setInterval is unref'd.
231
- setInterval(() => {}, 60000);
232
- }
233
-
234
- function cmdStart() {
235
- const settings = readSettings();
236
- if (!optInAllowed(settings)) {
237
- process.stderr.write('orchestrator.auto_dispatch is not enabled; refusing to start.\n');
238
- process.exit(2);
239
- }
240
- resolveDispatchCommand(settings);
241
- const layout = validateOrchestratorRuntime(REPO_ROOT, { forMutation: true });
242
- const pidfile = layout.orchestratorPidPath;
243
- const logfile = layout.orchestratorLogPath;
244
- if (fs.existsSync(pidfile)) {
245
- const existing = Number(fs.readFileSync(pidfile, 'utf8'));
246
- try { process.kill(existing, 0); }
247
- catch (_) { fs.unlinkSync(pidfile); }
248
- if (fs.existsSync(pidfile)) {
249
- process.stderr.write(`orchestrator already running (pid=${existing}).\n`);
250
- process.exit(1);
251
- }
252
- }
253
- fs.mkdirSync(layout.orchestratorDir, { recursive: true });
254
- const appendFlags = fs.constants.O_APPEND | fs.constants.O_CREAT | fs.constants.O_WRONLY;
255
- const out = openNoFollow(logfile, appendFlags);
256
- const err = openNoFollow(logfile, appendFlags);
257
- const child = spawn(process.execPath, [__filename, 'run'], {
258
- detached: true,
259
- stdio: ['ignore', out, err],
260
- env: { ...process.env, UBP_REPO_ROOT: REPO_ROOT },
261
- });
262
- child.unref();
263
- const pidFd = openNoFollow(
264
- pidfile,
265
- fs.constants.O_CREAT | fs.constants.O_TRUNC | fs.constants.O_WRONLY,
266
- );
267
- try { fs.writeFileSync(pidFd, String(child.pid)); }
268
- finally { fs.closeSync(pidFd); }
269
- process.stdout.write(`orchestrator started (pid=${child.pid}, log=${logfile})\n`);
270
- }
271
-
272
- function cmdStop() {
273
- const { orchestratorPidPath: pidfile } = validateOrchestratorRuntime(REPO_ROOT, {
274
- forMutation: true,
275
- });
276
- if (!fs.existsSync(pidfile)) {
277
- process.stderr.write('no pidfile found; orchestrator not running.\n');
278
- process.exit(1);
279
- }
280
- const pid = Number(fs.readFileSync(pidfile, 'utf8'));
281
- try { process.kill(pid, 'SIGTERM'); }
282
- catch (err) {
283
- if (err.code === 'ESRCH') {
284
- process.stderr.write(`pid ${pid} already dead; cleaning pidfile.\n`);
285
- fs.unlinkSync(pidfile);
286
- return;
287
- }
288
- throw err;
289
- }
290
- // Wait briefly for the process to exit, then clean up.
291
- setTimeout(() => {
292
- try { process.kill(pid, 0); }
293
- catch (_) { /* dead; good */ }
294
- if (fs.existsSync(pidfile)) fs.unlinkSync(pidfile);
295
- process.stdout.write(`orchestrator stopped (pid=${pid})\n`);
296
- }, 200);
297
- }
298
-
299
- function cmdStatus() {
300
- const { orchestratorPidPath: pidfile } = validateOrchestratorRuntime(REPO_ROOT);
301
- const out = { pidfile, running: false };
302
- if (fs.existsSync(pidfile)) {
303
- const pid = Number(fs.readFileSync(pidfile, 'utf8'));
304
- try { process.kill(pid, 0); out.pid = pid; out.running = true; }
305
- catch (_) { out.pid = pid; out.running = false; out.note = 'pidfile stale'; }
306
- }
307
- // Session summary.
308
- try {
309
- const Database = require('better-sqlite3');
310
- const dbPath = runtimePaths.locateStateDb(REPO_ROOT);
311
- if (fs.existsSync(dbPath)) {
312
- const db = new Database(dbPath, { readonly: true });
313
- const counts = db.prepare(
314
- "SELECT status, COUNT(*) AS n FROM sessions GROUP BY status",
315
- ).all();
316
- out.sessions = {};
317
- for (const r of counts) out.sessions[r.status] = r.n;
318
- db.close();
319
- }
320
- } catch (err) {
321
- out.session_error = err.message;
322
- }
323
- process.stdout.write(`${JSON.stringify(out, null, 2)}\n`);
324
- }
325
-
326
- function usage() {
327
- process.stderr.write(
328
- 'usage: ubp-orchestrator <execute-plan|run|start|stop|status>\n' +
329
- '\n' +
330
- ' execute-plan resume an accepted Change Plan [--change <id>] [--auto-merge] [--base-branch <name>]\n' +
331
- ' run foreground daemon (requires opt-in)\n' +
332
- ' start detached background daemon (requires opt-in)\n' +
333
- ' stop terminate running daemon\n' +
334
- ' status print pid + session counts\n',
335
- );
336
- }
337
-
338
- async function main(argv = process.argv.slice(2)) {
339
- const subcommand = argv[0];
340
- try {
341
- switch (subcommand) {
342
- case 'execute-plan': await cmdExecutePlan(argv.slice(1)); break;
343
- case 'run': cmdRun(); break;
344
- case 'start': cmdStart(); break;
345
- case 'stop': cmdStop(); break;
346
- case 'status': cmdStatus(); break;
347
- case '-h':
348
- case '--help':
349
- case 'help':
350
- usage(); process.exit(0);
351
- break;
352
- default:
353
- usage(); process.exit(1);
354
- }
355
- } catch (error) {
356
- process.stderr.write(
357
- `orchestrator configuration error${error.code ? ` [${error.code}]` : ''}: ${error.message}\n`,
358
- );
359
- process.exit(2);
360
- }
361
- }
362
-
363
- if (require.main === module) {
364
- main().catch((error) => {
365
- process.stderr.write(`orchestrator fatal error: ${error.message}\n`);
366
- process.exit(2);
367
- });
368
- }
369
-
370
- module.exports = {
371
- readSettings,
372
- optInAllowed,
373
- parseRuntimes,
374
- parseExecutePlanArgs,
375
- resolveDispatchCommand,
376
- validateOrchestratorRuntime,
377
- cmdExecutePlan,
378
- cmdRun,
379
- cmdStart,
380
- cmdStop,
381
- cmdStatus,
382
- main,
383
- };
@@ -1,10 +0,0 @@
1
- ---
2
- description: Capture or revise one bounded Change Contract without starting downstream workflows
3
- argument-hint: "[change-id-or-title] [quick|standard|major|incident]"
4
- workflow-ref: "@skills/ultra-change/SKILL.md"
5
- ---
6
-
7
- # Open or resume a change
8
-
9
- Read and follow `@skills/ultra-change/SKILL.md`, using `$ARGUMENTS` to identify and classify the change.
10
- Treat the referenced skill as the only workflow definition.
@@ -1,10 +0,0 @@
1
- ---
2
- description: Converge current evidence and archive local Ultra authority without external release effects
3
- argument-hint: "[change-id]"
4
- workflow-ref: "@skills/ultra-deliver/SKILL.md"
5
- ---
6
-
7
- # Converge and deliver
8
-
9
- Read and follow `@skills/ultra-deliver/SKILL.md`, using `$ARGUMENTS` only to select the change.
10
- Treat the referenced skill as the only workflow definition.
@@ -1,10 +0,0 @@
1
- ---
2
- description: Execute one authoritative Ultra task through implementation, verification, and review
3
- argument-hint: "[task-id]"
4
- workflow-ref: "@skills/ultra-dev/SKILL.md"
5
- ---
6
-
7
- # Execute one Ultra task
8
-
9
- Read and follow `@skills/ultra-dev/SKILL.md`, using `$ARGUMENTS` as the optional task id.
10
- Treat the referenced skill as the only workflow definition.
@@ -1,10 +0,0 @@
1
- ---
2
- description: Diagnose Ultra state and installed-plugin health with optional explicit repair
3
- argument-hint: "[--repair]"
4
- workflow-ref: "@skills/ultra-doctor/SKILL.md"
5
- ---
6
-
7
- # Diagnose Ultra health
8
-
9
- Read and follow `@skills/ultra-doctor/SKILL.md`; allow repair only when `$ARGUMENTS` explicitly contains `--repair`.
10
- Treat the referenced skill as the only workflow definition.
@@ -1,10 +0,0 @@
1
- ---
2
- description: Create or recover Ultra project authority without implicitly starting research
3
- argument-hint: "[name] [type] [stack] [auto|greenfield|brownfield] [--scope <path>]"
4
- workflow-ref: "@skills/ultra-init/SKILL.md"
5
- ---
6
-
7
- # Initialize or adopt an Ultra project
8
-
9
- Read and follow `@skills/ultra-init/SKILL.md`, using `$ARGUMENTS` as optional project metadata.
10
- Treat the referenced skill as the only workflow definition.
@@ -1,10 +0,0 @@
1
- ---
2
- description: Persist dependency-valid vertical task contracts from an accepted Change Contract
3
- argument-hint: "[scope]"
4
- workflow-ref: "@skills/ultra-plan/SKILL.md"
5
- ---
6
-
7
- # Plan executable slices
8
-
9
- Read and follow `@skills/ultra-plan/SKILL.md`, using `$ARGUMENTS` to select the requested scope.
10
- Treat the referenced skill as the only workflow definition.
@@ -1,10 +0,0 @@
1
- ---
2
- description: Build evidence with recommended, owner-selected semantic coverage and adaptive alignment
3
- argument-hint: "[scope-or-question]"
4
- workflow-ref: "@skills/ultra-research/SKILL.md"
5
- ---
6
-
7
- # Research one bounded question or baseline
8
-
9
- Read and follow `@skills/ultra-research/SKILL.md`, using `$ARGUMENTS` to bound the research scope.
10
- Treat the referenced skill as the only workflow definition.
@@ -1,10 +0,0 @@
1
- ---
2
- description: Review one plan, task diff, or aggregate change on independent specification and engineering axes
3
- argument-hint: "[plan|task|change] [id]"
4
- workflow-ref: "@skills/ultra-review/SKILL.md"
5
- ---
6
-
7
- # Review one bounded Ultra scope
8
-
9
- Read and follow `@skills/ultra-review/SKILL.md`, using `$ARGUMENTS` to select the review mode and authority.
10
- Treat the referenced skill as the only workflow definition.