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
@@ -1,54 +1,111 @@
1
1
  ---
2
2
  name: ultra-init
3
- description: Create or recover Ultra project authority for a new repository, an existing codebase, or an older Ultra installation. Use when `.ultra` is absent, initialization is incomplete, or doctor reports a migration fault.
3
+ description: Establish a project's Ultra authority as files — the owner's one-line goal, hard constraints, the three specification skeletons, an empty task ledger, and Git. Use when a repository has no `.ultra` directory yet, or has a partial one left by an interrupted setup, whether the codebase is new or already carries years of history.
4
4
  ---
5
5
 
6
- # Initialize project authority
6
+ # Build the skeleton the rest of the workflow writes into
7
7
 
8
- Initialization creates the repository-local Ultra authority. It does not perform
9
- research, accept a product baseline, choose a Change, or start another public
10
- capability.
8
+ Initialization creates the repository-local authority and nothing else.
9
+ It does not perform research, accept a product baseline, choose a Change, or
10
+ start another capability — recommend the next one and stop; do not invoke it.
11
11
 
12
- ## Inspect and align
12
+ The dividing line against research is **authorization versus claim**. What the
13
+ owner authorizes comes out of their head and evidence cannot overturn it. What
14
+ research collects is a claim about the outside world, which evidence can confirm
15
+ or refute. A technology choice is a claim, so it is not initialization's business
16
+ — and a new project has no configuration files to read anyway.
13
17
 
14
- 1. Inspect the repository root, Git state, meaningful source, existing `.ultra`,
15
- monorepo boundaries, and the current request.
16
- 2. When authority already exists, call `ultra.doctor { repair: false }` and preserve
17
- healthy state. Never replace or delete it merely to obtain a clean init.
18
- 3. Classify the repository from evidence:
19
- - `greenfield`: no meaningful delivered behavior exists;
20
- - `brownfield`: source, runtime, API, data, deployment, or tests describe an
21
- existing maintained system;
22
- - `migrated`: older Ultra authority was preserved but is not yet a trusted baseline.
23
- 4. Ask the owner only when scope, healthy-authority replacement, destructive recovery,
24
- or another material choice cannot be derived. Reuse explicit intent.
18
+ ## Before you start
25
19
 
26
- Read `../ultra-think/references/interaction-boundary.md` before asking a material
27
- question.
20
+ 1. Read `.ultra/tasks.json` if it exists, along with the `context_file` of any
21
+ task it names — a partial `.ultra/` means an earlier attempt stopped midway.
22
+ 2. Read `CONTEXT.md` at the repository root for vocabulary already settled, and
23
+ `.ultra/decisions/` for any entries preserved by a partial setup.
24
+ 3. Establish the route's facts from the filesystem, not by asking.
28
25
 
29
- ## Initialize once
26
+ ## Definition of done
30
27
 
31
- Call `ultra.record` with one typed entry:
28
+ - `.ultra/north-star.md` carries the owner's one-line goal in their own words.
29
+ - Every file listed under **What gets written** exists; you read each one back
30
+ after writing and stopped at the first one missing.
31
+ - `.git` exists. Any initial commit is a separately authorized delivery effect.
32
+ - Nothing is invented: what is unknown says `[NEEDS CLARIFICATION]`.
33
+
34
+ ## Which route
35
+
36
+ Check the filesystem in this order and take the first match:
37
+
38
+ | Check | Route | What changes |
39
+ |---|---|---|
40
+ | `docs/` holds two or more non-README `.md` files, or `docs/adr/` or `doc/` exists | Documented brownfield | Write everything; cite maintained documents as evidence and preserve their repository paths in `trace_to` when they remain authoritative |
41
+ | A language configuration file exists and the row above did not match | Brownfield | Write everything; record what a code scan shows in `architecture.md` and `discovery.md`, marked as observed and unverified |
42
+ | Neither | Greenfield | Write everything |
43
+
44
+ For either brownfield route, read `references/brownfield-adoption.md`. Existing docs
45
+ are evidence or an explicitly retained authority; they never justify omitting the
46
+ canonical specification skeleton that downstream workflows require.
47
+
48
+ ## Draw out the intent
49
+
50
+ Follow `../ultra-grilling/SKILL.md`. It is a loop, not a questionnaire, because
51
+ the owner cannot state what they want up front. Start from what they already said
52
+ when invoking you, restate it for confirmation, and ask only about what is
53
+ genuinely missing. Five things come out of it:
54
+
55
+ | What you draw out | Where it lands |
56
+ |---|---|
57
+ | What you want to build, in one sentence, their words | `north-star.md`, `## One-line` |
58
+ | What counts as success | `specs/product.md`, behavioral requirements and acceptance |
59
+ | What must never happen | `north-star.md`, `## Hard Constraints` |
60
+ | Who uses it, and how they cope today | `discovery.md`, marked as the owner's statement |
61
+ | **What you already know you are unsure about** | `discovery.md` — research's priority queue |
62
+
63
+ When the first domain terms appear, follow `../ultra-domain-modeling/SKILL.md`
64
+ and create `CONTEXT.md` at the repository root.
65
+
66
+ ## What gets written
67
+
68
+ Resolve this loaded Skill's directory, then run
69
+ `node <ultra-init-skill-dir>/scripts/init_project.cjs --project <repository-root>`. The script copies
70
+ only missing files from `assets/project-template`, preserves every existing authority
71
+ file byte-for-byte, and reads the resulting skeleton back. Then fill its semantic
72
+ placeholders from verified facts and owner decisions.
32
73
 
33
74
  ```text
34
- kind: baseline
35
- action: initialize
36
- data: { target_dir, project_name, mode=auto, git_mode=auto, optional scope }
37
- idempotency_key: <stable init attempt id>
75
+ .ultra/north-star.md ## One-line, ## Hard Constraints
76
+ .ultra/specs/{product,architecture,discovery}.md ## Observed, ## Decisions, ## Unknowns
77
+ .ultra/tasks.json {"tasks": []}
78
+ .ultra/test-report.json not-yet-run report with git_commit
79
+ .ultra/contexts/ .ultra/decisions/ .ultra/evidence/
80
+ CONTEXT.md repository root, once a term is settled
38
81
  ```
39
82
 
40
- This stateless bootstrap is the only `ultra.record` operation allowed before
41
- `state.db` exists. It must create or migrate `.ultra/.runtime/state.db`, preserve
42
- existing artifacts and Git history, install only missing scaffold assets on resume,
43
- validate or safely upgrade a legacy task ledger, and read back the result.
83
+ The copied `.ultra/.gitignore` excludes `.runtime/`, `progress/`, and `reviews/`
84
+ without editing the owner's root ignore file. Those paths are exact — hooks and later
85
+ skills read them by name. Every section left unfilled carries
86
+ `[NEEDS CLARIFICATION]`, and which of those you resolve now has a checkable rule:
87
+ **what can be read out of repository files, you fill; what needs investigation,
88
+ research fills.**
89
+
90
+ Git is not a preference. Reconciliation reads `git log` and `git diff`, staleness
91
+ detection compares against `HEAD`, archiving is a `git mv`, and rollback is Git.
92
+ If `.git` is absent, run `git init`. Report the uncommitted initialized files and ask
93
+ for commit authority only if the owner wants that separate effect now.
94
+
95
+ ## When the owner decides
96
+
97
+ Only the five things above, and only through the grilling loop. Replacing
98
+ authority that already exists and looks healthy is the owner's call, never a
99
+ convenience on the way to a clean start — preserve it and report what you found.
44
100
 
45
- An unborn Git repository may require a local initial commit, but init never creates a
46
- remote, tag, push, publish, or deployment. Corrupt DB/WAL/SHM and backups remain
47
- preserved until an explicit recovery choice is made.
101
+ Where the host cannot ask at all, leave the one-line goal empty and say plainly
102
+ that it is empty, that goal injection will therefore be empty, and that the next
103
+ skill asks again. Do not infer it from the directory name.
48
104
 
49
- ## Return control
105
+ ## References
50
106
 
51
- Report classification, scope, schema and backup result, Git state, imported team
52
- checkpoint state, and any mechanical blocker. Recommend the next useful capability
53
- from current evidence, usually `ultra-research`, `ultra-change`, `ultra-status`, or
54
- `ultra-doctor`; do not invoke it automatically.
107
+ - `../ultra-grilling/SKILL.md` — the loop; read it before the first question.
108
+ - `../ultra-domain-modeling/SKILL.md` — read when the first term needs writing.
109
+ - `references/brownfield-adoption.md` — read for either existing-code route.
110
+ - `../ultra-think/references/autonomy-boundary.md` — read before touching
111
+ authority that already exists.
@@ -1,99 +1,49 @@
1
1
  # Brownfield adoption
2
2
 
3
- Execute this procedure for a detected brownfield repository, a migrated compatibility
4
- baseline, or an existing adoption in `adopting` or `blocked` state.
3
+ Use this procedure only when `ultra-init` detects an existing codebase without a
4
+ healthy `.ultra/` authority surface. Initialization records the observable baseline;
5
+ it does not redesign the application or accept claims the repository cannot support.
5
6
 
6
7
  ## Bind the repository boundary
7
8
 
8
- Record the repository root, selected scope, workspace roots, branch, HEAD, dirty files,
9
- generated and vendored exclusions, manifests, verification commands, and public seams.
10
- Use `.` for a whole-repository adoption. Use selected workspace roots only when the
11
- user's requested ownership is narrower than the monorepo.
9
+ Record the repository root, selected workspace roots, branch, `HEAD`, dirty files,
10
+ generated and vendored exclusions, manifests, verification commands, and public
11
+ seams. Keep out-of-scope dirty files visible as context without treating them as part
12
+ of the selected baseline.
12
13
 
13
- The authoritative worktree snapshot contains only selected-scope paths. Report dirty
14
- files outside that scope separately as repository context, but do not include them in
15
- the baseline digest. Require `accept_dirty_worktree: true` only after the owner confirms
16
- the exact in-scope `worktree_files` returned by the server.
14
+ ## Inspect the maintained system
17
15
 
18
- ## Build the evidence model
16
+ Trace product behavior through real entry points, runtime consumers, persistence,
17
+ integrations, permissions, failure paths, tests, deployment, observability, and
18
+ recovery. Classify every material statement as `Observed`, `Verified`, `Decided`, or
19
+ `Unknown`. Record maintained-document conflicts as drift.
19
20
 
20
- Inspect the maintained system through its live boundaries:
21
+ ## Write the baseline once
21
22
 
22
- - product behavior, actors, entry points, and public acceptance;
23
- - runtime modules, consumers, data flow, persistence, and authority;
24
- - APIs, events, integrations, permissions, security, and failure paths;
25
- - build, test, lint, typecheck, deployment, migration, observability, and recovery;
26
- - maintained documents and every detected source-to-document conflict.
23
+ - Update `.ultra/specs/product.md` with delivered behavior and acceptance.
24
+ - Update `.ultra/specs/architecture.md` with boundaries, authority, consumers,
25
+ permissions, failures, and recovery.
26
+ - Update `.ultra/specs/discovery.md` with scope evidence, known defects, drift, and
27
+ unresolved questions.
28
+ - Initialize `.ultra/tasks.json` and `.ultra/test-report.json` from the packaged
29
+ templates without manufacturing passing results.
27
30
 
28
- Classify each material statement as `Observed`, `Verified`, `Decided`, or `Unknown`.
29
- Record document/source conflicts as drift. Keep provider payloads outside Ultra and
30
- record only bounded metadata references.
31
+ Use the specifications as the canonical representation. Do not create a second
32
+ baseline ledger, database projection, or generated semantic mirror.
31
33
 
32
- ## Write baseline artifacts
33
-
34
- Update `.ultra/specs/product.md` with current delivered behavior and acceptance. Update
35
- `.ultra/specs/architecture.md` with real boundaries, owners, writers, consumers,
36
- consistency rules, permissions, failures, and recovery. Use `discovery.md` for scope
37
- evidence, decisions, and unresolved questions.
38
-
39
- Capture current facts without redesigning the application or manufacturing product
40
- narratives that are absent from evidence.
41
-
42
- ## Run characterization verification
34
+ ## Characterize verification
43
35
 
44
36
  Run the repository's existing verification commands. Record each result as `pass`,
45
- `known_red`, or `not_run`. A known-red item needs evidence and a rationale; a missing
46
- command is not a passing result. Record a characterization gap for a critical public
47
- seam that has no stable verification signal; create its ordinary task only after the
48
- baseline is ready.
49
-
50
- ## Maintain the gap ledger
51
-
52
- Record every adoption gap with a stable id, evidence references, owner, blocking flag,
53
- and one category:
54
-
55
- - `baseline_blocker`: the model should recommend against adoption until resolved or
56
- the owner explicitly accepts the recorded risk;
57
- - `documentation_drift`: maintained prose conflicts with observed behavior;
58
- - `known_defect`: reproducible incorrect behavior;
59
- - `technical_debt`: accepted maintainability or quality cost;
60
- - `unknown`: evidence is insufficient;
61
- - `future_change`: desired behavior outside the current baseline.
62
-
63
- Use `open` for unresolved gaps, `accepted` for owner-accepted debt,
64
- `resolved` when evidence closes the gap, and `deferred` for explicitly postponed
65
- work. Keep every open `baseline_blocker` visible as a semantic warning. It does not
66
- become a SQLite hard gate: the model explains the risk, recommends resolution, and may
67
- record owner-authorized adoption without erasing the gap. Do not convert the ledger
68
- into hundreds of application tasks.
69
-
70
- ## Record authority
71
-
72
- Use `ultra.record` with `kind: baseline`, `action: observe`, and full replacement
73
- arrays for:
74
-
75
- - scope and repository revision;
76
- - repository classification;
77
- - product and architecture specification paths;
78
- - bounded source, documentation, runtime, test, deployment, or external references;
79
- - verification results;
80
- - blocking and non-blocking unknowns;
81
- - the complete gap ledger;
82
- - external provider metadata references, when supplied.
83
-
84
- Use the server-returned revision, branch, worktree digest, and specification digests.
37
+ `known_red`, or `not_run`; a missing command is not a pass. A critical public seam
38
+ without a stable signal is an explicit gap, not an excuse to invent completion.
85
39
 
86
- ## Obtain approval and converge
40
+ ## Converge
87
41
 
88
- Present scope, observed behavior, drift, known-red verification, unknowns, gaps, dirty
89
- worktree state, and material decisions to the owner. Use `ultra.record` with
90
- `kind: baseline`, `action: accept` only after explicit approval. Set
91
- `accept_known_red` and `accept_dirty_worktree` only for the exact items the owner
92
- accepted.
42
+ Read every written file back, show the owner the selected scope, observed behavior,
43
+ drift, known-red verification, unknowns, and material decisions, and leave unresolved
44
+ items marked `[NEEDS CLARIFICATION]`. Adoption is ready when the file set is complete,
45
+ the recorded revision matches the inspected checkout, and every material gap remains
46
+ visible with its evidence and owner decision where one exists.
93
47
 
94
- Resolve hard authority blockers, then present semantic warnings for evidence or an
95
- owner decision. Adoption is complete when `ultra.context` reports a current accepted
96
- baseline, every material open gap is visible with its owner/risk and any acceptance is
97
- explicit in the approval note, and project doctor has no mechanical authority failure.
98
- Route all selected work through `ultra-change`, including work described by a legacy
99
- plan. Import its accepted intent into a current Change Contract before planning.
48
+ Recommend `ultra-change` for subsequent work and stop; public skills do not invoke one
49
+ another.
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+
7
+ function usage() {
8
+ return 'usage: init_project.cjs --project <repository-root>';
9
+ }
10
+
11
+ function parseArgs(argv) {
12
+ if (argv.length !== 2 || argv[0] !== '--project' || !argv[1]) {
13
+ throw new Error(usage());
14
+ }
15
+ return path.resolve(argv[1]);
16
+ }
17
+
18
+ function listFiles(root) {
19
+ const files = [];
20
+ (function walk(directory) {
21
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
22
+ const file = path.join(directory, entry.name);
23
+ if (entry.isDirectory()) walk(file);
24
+ else if (entry.isFile()) files.push(path.relative(root, file));
25
+ }
26
+ }(root));
27
+ return files.sort();
28
+ }
29
+
30
+ function templateRoot() {
31
+ const installed = path.resolve(__dirname, '..', 'assets', 'project-template');
32
+ if (fs.existsSync(installed)) return installed;
33
+ const checkout = path.resolve(__dirname, '..', '..', '..', '.ultra-template');
34
+ if (fs.existsSync(checkout)) return checkout;
35
+ throw new Error('ultra-init project template is missing');
36
+ }
37
+
38
+ function ensurePlainDirectory(directory, label) {
39
+ const stat = fs.lstatSync(directory);
40
+ if (!stat.isDirectory() || stat.isSymbolicLink()) {
41
+ throw new Error(`${label} must be a real directory: ${directory}`);
42
+ }
43
+ }
44
+
45
+ function initialize(project) {
46
+ if (!fs.existsSync(project)) throw new Error(`project does not exist: ${project}`);
47
+ ensurePlainDirectory(project, 'project');
48
+ const source = templateRoot();
49
+ const ultra = path.join(project, '.ultra');
50
+ if (fs.existsSync(ultra)) ensurePlainDirectory(ultra, '.ultra');
51
+ else fs.mkdirSync(ultra);
52
+
53
+ const created = [];
54
+ const preserved = [];
55
+ for (const relative of listFiles(source)) {
56
+ const target = path.join(ultra, relative);
57
+ if (fs.existsSync(target)) {
58
+ preserved.push(relative);
59
+ continue;
60
+ }
61
+ fs.mkdirSync(path.dirname(target), { recursive: true });
62
+ fs.copyFileSync(path.join(source, relative), target, fs.constants.COPYFILE_EXCL);
63
+ created.push(relative);
64
+ }
65
+ for (const relative of [...created, ...preserved]) {
66
+ if (!fs.existsSync(path.join(ultra, relative))) {
67
+ throw new Error(`initialization read-back failed: ${relative}`);
68
+ }
69
+ }
70
+ return {
71
+ $schema: 'ultra-init-result-v1',
72
+ project,
73
+ template: source,
74
+ created,
75
+ preserved,
76
+ };
77
+ }
78
+
79
+ try {
80
+ process.stdout.write(`${JSON.stringify(initialize(parseArgs(process.argv.slice(2))), null, 2)}\n`);
81
+ } catch (error) {
82
+ process.stderr.write(`${error.message}\n`);
83
+ process.exitCode = 1;
84
+ }
@@ -1,72 +1,92 @@
1
1
  ---
2
2
  name: ultra-plan
3
- description: Turn an accepted Ultra Change Contract into dependency-valid, DB-backed vertical task contracts. Use when research obligations are resolved and implementation needs an executable plan.
3
+ description: Turn an evidenced Change intent into a dependency-valid task ledger, confirmed test seams, and resumable task contexts. Use when implementation needs decomposition, a wide refactor needs an expand-contract route, or an interrupted plan must be reconstructed from repository files.
4
4
  ---
5
5
 
6
- # Build an executable plan
7
-
8
- The model owns decomposition and technical design. MCP commits the accepted task graph,
9
- digests, context, and team checkpoint in one semantic operation.
10
-
11
- ## Bind and design
12
-
13
- 1. Call `ultra.context { stage: plan, scope: { change_id }, detail: full }`.
14
- 2. Inspect or import the team checkpoint with `ultra.sync`. Resolve real concurrent
15
- record conflicts; do not merge authority by editing JSON.
16
- 3. Require an accepted Change contract and its current typed delta. Direct Build skips
17
- extra research, never Plan or task contracts.
18
- 4. Read `references/semantic-preflight.md`; inspect real consumers, source, tests,
19
- deployment, and recovery.
20
- 5. Recommend `EXPAND`, `SELECTIVE`, `HOLD`, or `REDUCE` only when posture changes
21
- accepted scope. Reuse an explicit posture and ask through the host-native UI only
22
- for a material unresolved choice.
23
- 6. Design a walking skeleton and vertical slices. Each task owns an observable outcome,
24
- public seam, verification command, acceptance mapping, target seams, bounded
25
- context refs, documentation impact, recovery, owner, and dependencies. Set the
26
- published `type`, `priority`, optional bounded `complexity`/`estimated_days`,
27
- `slice_kind`, and string-array `deps`/`files_modified` deliberately. Prefer the
28
- shared vocabulary when it communicates the work, but use a bounded
29
- repository-specific label when it is clearer; SQLite validates structure and does
30
- not choose business taxonomy.
31
-
32
- Large sources stay lazy. Use digest freshness for accepted inputs that must remain
33
- byte-current, existence for expected implementation targets, and advisory only when
34
- drift must be visible without blocking.
35
-
36
- Read `../ultra-think/references/interaction-boundary.md` before asking a material
37
- question.
38
-
39
- ## Record and checkpoint
40
-
41
- Use one `ultra.record` batch with `task_contract / define` for new tasks and
42
- `task_contract / revise` for corrected contracts, including a wrong `title` or `type`,
43
- before accepting the Plan checkpoint. Read back the draft with `ultra.context`.
44
- Never write status, session, freshness, runtime tag, generated Context, or
45
- completion-commit fields through a Task Contract; Task outcomes and the runtime own
46
- them.
47
- Never read or write `.ultra/tasks/tasks.json`; use `ultra.sync` for the Git team
48
- checkpoint, and never edit the local runtime projection directly.
49
-
50
- Call exactly one `ultra.checkpoint`:
51
-
52
- ```text
53
- stage: plan
54
- scope: { change_id }
55
- payload: planning posture, optional approval already obtained, context budget/refs
56
- idempotency_key: stable semantic Plan checkpoint id
57
- ```
58
-
59
- The model decides whether decomposition, acceptance coverage, and context are
60
- sufficient and records any deliberate omission. Missing semantic detail remains a
61
- visible warning and does not deny an otherwise safe Session lease. The checkpoint compiles or reuses the
62
- content-addressed Context Envelope, reports advisory coverage diagnostics, exports
63
- `plan.json` and `plan.md` inside the same recoverable publication, accepts one Plan
64
- revision, and publishes the team checkpoint. Do not export separately.
65
-
66
- If rejected, the same Plan draft stays mutable. Fix only the reported structural,
67
- digest, path, or concurrency conflict and retry. To replace an accepted Plan, submit a
68
- new checkpoint revision; never edit SQLite or open a parallel run to escape a
69
- diagnostic.
70
-
71
- Return topology, executable slices, public seams, exact checks, checkpoint result, and
72
- the model's recommended execution order. Do not invoke `ultra-dev` automatically.
6
+ # Turn one Change into executable tracer bullets
7
+
8
+ Planning owns decomposition and technical design. Files carry the result across
9
+ sessions and hosts; no runtime state decides whether the plan is meaningful.
10
+
11
+ ## Before you start
12
+
13
+ 1. Read `.ultra/tasks.json`; if a task is unfinished, read its `context_file` and
14
+ closing `## Resume Note` before replacing or extending anything.
15
+ 2. Read `CONTEXT.md` for vocabulary and the relevant `.ultra/decisions/` entries.
16
+ 3. Read the active Change intent, its `trace_to` specification anchors, and the
17
+ source, tests, consumers and recovery paths those anchors describe.
18
+
19
+ ## Definition of done
20
+
21
+ - `.ultra/tasks.json` and one `.ultra/contexts/task-<id>.md` per task agree on
22
+ identifiers, status, dependencies and trace anchors.
23
+ - The owner confirmed the scope posture and the seam list.
24
+ - Every feature task is a tracer bullet touching at least two layers, unless the
25
+ Change itself demonstrably touches only one layer.
26
+ - Coverage, dependency, trace, scope and context-budget checks have concrete results.
27
+
28
+ ## Fix the planning posture
29
+
30
+ Choose `EXPAND`, `SELECTIVE`, `HOLD` or `REDUCE`; default to `SELECTIVE`. Once
31
+ chosen, keep that posture visible in the active Change intent rather than silently drifting.
32
+ Write it to the active Change `intent.md` under `## Planning Posture`; there is no
33
+ separate `plan.md` authority.
34
+ Use `../ultra-grilling/SKILL.md` through the host-native question surface when the
35
+ choice remains material, one question with a recommendation at a time.
36
+
37
+ If the work cannot fit in one session *and* the path itself is still unclear, use
38
+ `../ultra-think/SKILL.md` to resolve decision tickets before decomposing tasks.
39
+
40
+ ## Choose the plan shape
41
+
42
+ Use tracer bullets for ordinary work: each slice delivers one observable path through
43
+ the layers it changes. Use expand–contract only when one mechanical change has a
44
+ repository-wide blast radius and no vertical slice can keep the checkout green:
45
+ expand with old and new forms, migrate bounded batches, then contract the old form.
46
+
47
+ Build the graph with these structural defences:
48
+
49
+ - **Walking Skeleton**: Task 1 traverses every layer this Change touches through one
50
+ real request and real data. A genuinely one-layer Change does not invent one.
51
+ - **Contract task**: create it before both implementations when targets cross two top-
52
+ level source directories or two processes/services.
53
+ - **Integration Checkpoint**: insert one after every three or four feature tasks.
54
+ - A feature task that touches only one of several affected layers is merged or split
55
+ into a tracer bullet; moving a whole layer into one task is horizontal slicing.
56
+
57
+ Confirm the seam list before tests are written. Reuse an existing public seam and use
58
+ the highest seam that observes the behavior; one seam is ideal when it covers the path.
59
+
60
+ ## Write the files
61
+
62
+ Each task records `id`, `title`, `type`, `priority`, `complexity`, `status`,
63
+ `dependencies`, `context_file`, `trace_to` and `change_ref`. Complexity is only a
64
+ splitting and context signal: 1–2 is local, 3–5 is bounded, 6–7 crosses a boundary,
65
+ and complexity > 7 must split.
66
+
67
+ Each context records Acceptance, confirmed seams, layers touched, target files,
68
+ Implementation, verification commands, Definition of Drift, Change Log, Completion
69
+ and Resume Note. Read every file back; task count and context count must match.
70
+
71
+ ## Verify the plan
72
+
73
+ 1. Map every in-scope user story or acceptance anchor to at least one task.
74
+ 2. Walk dependencies and repair every cycle with the exact cycle chain visible.
75
+ 3. Resolve every `trace_to` path and heading against a real file.
76
+ 4. Surface complexity, more than eight target files, or more than twenty tasks as
77
+ scope warnings; they are observations, not semantic verdicts.
78
+ 5. Estimate context at roughly `complexity × 5%`; surface anything above 40%.
79
+
80
+ Report the graph, frontier, seams, warnings and first task. Recommend the next explicit
81
+ capability from the files; do not invoke it.
82
+
83
+ ## When the owner decides
84
+
85
+ The owner chooses the posture, confirms seams, resolves reductions and accepts material
86
+ omissions. Mechanical cycles and broken paths are repaired before handoff because they
87
+ make the written graph impossible to execute.
88
+
89
+ ## References
90
+
91
+ - `../ultra-grilling/SKILL.md` — read before a material posture or seam question.
92
+ - `../ultra-think/SKILL.md` — read when fog of war requires decision tickets.