ultra-builder-pro-cli 0.20.0 → 0.22.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 (109) hide show
  1. package/.ultra-template/docs/research/README.md +26 -5
  2. package/.ultra-template/specs/discovery.md +1 -1
  3. package/.ultra-template/tasks/tasks.json +10 -3
  4. package/.ultra-template/templates/task-context.md +19 -0
  5. package/CHANGELOG.md +106 -0
  6. package/README.md +215 -41
  7. package/adapters/_shared/codex-assets.cjs +69 -11
  8. package/adapters/_shared/interaction-contract.cjs +36 -3
  9. package/adapters/_shared/runtime-assets.cjs +41 -1
  10. package/adapters/claude.js +7 -5
  11. package/adapters/codex.js +1 -1
  12. package/adapters/kimi.js +2 -8
  13. package/adapters/opencode.js +43 -30
  14. package/bin/orchestrator.js +64 -24
  15. package/docs/AGENT-CONTEXT.md +89 -49
  16. package/docs/ARCHITECTURE.md +112 -45
  17. package/docs/ARTIFACT-AUTHORITY.md +274 -0
  18. package/docs/COMMIT-HASH-BACKFILL.md +33 -90
  19. package/docs/DECISIONS.md +14 -6
  20. package/docs/LEGACY-CLI-CROSSWALK.md +16 -6
  21. package/docs/PLUGIN-ISOLATION-CONTRACT.md +6 -4
  22. package/docs/ROADMAP.md +20 -6
  23. package/docs/RUNTIME-COMPAT-MATRIX.md +29 -16
  24. package/docs/STATE-DB-ACCESS-POLICY.md +43 -13
  25. package/docs/WORKFLOW-LIFECYCLE.md +105 -50
  26. package/hooks/README.md +10 -8
  27. package/hooks/active_task_context.py +105 -18
  28. package/hooks/context_spine.py +16 -4
  29. package/hooks/health_check.py +5 -4
  30. package/hooks/pre_stop_check.py +5 -2
  31. package/hooks/runtime_paths.py +396 -0
  32. package/hooks/subagent_tracker.py +5 -2
  33. package/hooks/workflow_checkpoint.py +16 -3
  34. package/hooks/workflow_context.py +11 -3
  35. package/hooks/workflow_resume.py +7 -4
  36. package/mcp-server/breadcrumb.cjs +20 -2
  37. package/mcp-server/lib/archive-journal.cjs +1026 -111
  38. package/mcp-server/lib/archive-mutation-worker.py +365 -0
  39. package/mcp-server/lib/artifact-registry.cjs +1127 -0
  40. package/mcp-server/lib/baseline-workflow.cjs +69 -28
  41. package/mcp-server/lib/change-packet.cjs +818 -0
  42. package/mcp-server/lib/change-workflow.cjs +932 -176
  43. package/mcp-server/lib/context-paths.cjs +142 -0
  44. package/mcp-server/lib/context-spine.cjs +511 -45
  45. package/mcp-server/lib/decision-dialogue.cjs +345 -3
  46. package/mcp-server/lib/delivery-transaction.cjs +471 -0
  47. package/mcp-server/lib/doctor-backup-worker.cjs +328 -0
  48. package/mcp-server/lib/doctor.cjs +401 -11
  49. package/mcp-server/lib/git-bootstrap.cjs +458 -47
  50. package/mcp-server/lib/init-project.cjs +240 -95
  51. package/mcp-server/lib/plan-publication-worker.cjs +830 -0
  52. package/mcp-server/lib/plan-store.cjs +700 -5
  53. package/mcp-server/lib/project-breadcrumb.cjs +23 -4
  54. package/mcp-server/lib/projector.cjs +211 -42
  55. package/mcp-server/lib/runtime-paths.cjs +1687 -0
  56. package/mcp-server/lib/safe-project-file.cjs +385 -0
  57. package/mcp-server/lib/spec-learning.cjs +28 -12
  58. package/mcp-server/lib/state-authority.cjs +19 -3
  59. package/mcp-server/lib/state-db.cjs +263 -9
  60. package/mcp-server/lib/state-ops.cjs +254 -50
  61. package/mcp-server/lib/task-ledger.cjs +1342 -0
  62. package/mcp-server/lib/telemetry.cjs +12 -3
  63. package/mcp-server/lib/workflow-state.cjs +610 -58
  64. package/mcp-server/server.cjs +423 -42
  65. package/orchestrator/daemon.cjs +2 -10
  66. package/orchestrator/parallel-orchestrator.cjs +314 -50
  67. package/orchestrator/planner/plan-builder.cjs +1 -1
  68. package/orchestrator/recovery.cjs +125 -7
  69. package/orchestrator/session-close-journal-worker.cjs +5 -0
  70. package/orchestrator/session-close-journal.cjs +1014 -0
  71. package/orchestrator/session-runner.cjs +679 -69
  72. package/orchestrator/worktree-manager.cjs +186 -35
  73. package/package.json +2 -3
  74. package/skills/cc-collab/SKILL.md +4 -1
  75. package/skills/codex-collab/SKILL.md +5 -2
  76. package/skills/ultra-change/SKILL.md +34 -8
  77. package/skills/ultra-deliver/SKILL.md +26 -11
  78. package/skills/ultra-dev/SKILL.md +52 -10
  79. package/skills/ultra-doctor/SKILL.md +16 -3
  80. package/skills/ultra-init/SKILL.md +22 -11
  81. package/skills/ultra-plan/SKILL.md +58 -18
  82. package/skills/ultra-research/SKILL.md +37 -35
  83. package/skills/ultra-review/SKILL.md +14 -8
  84. package/skills/ultra-status/SKILL.md +18 -9
  85. package/skills/ultra-test/SKILL.md +11 -5
  86. package/skills/ultra-think/SKILL.md +6 -2
  87. package/skills/ultra-think/references/decision-dialogue.md +17 -6
  88. package/skills/ultra-verify/SKILL.md +4 -1
  89. package/spec/cli-protocol.md +21 -7
  90. package/spec/mcp-tools.yaml +629 -44
  91. package/spec/schemas/change-delta.v1.schema.json +153 -0
  92. package/spec/schemas/context-file.v4.5.schema.json +1 -1
  93. package/spec/schemas/documentation-reconciliation.v1.schema.json +106 -0
  94. package/spec/schemas/mcp-tools.schema.json +1 -1
  95. package/spec/schemas/state-db.sql +51 -14
  96. package/spec/schemas/task-ledger.v1.schema.json +217 -0
  97. package/spec/schemas/tasks.v4.5.schema.json +1 -1
  98. package/ultra-tools/cli.cjs +3 -2
  99. package/ultra-tools/commands/db.cjs +76 -25
  100. package/ultra-tools/commands/migrate.cjs +1000 -82
  101. package/ultra-tools/commands/session.cjs +34 -8
  102. package/ultra-tools/commands/status.cjs +32 -6
  103. package/ultra-tools/commands/system.cjs +129 -22
  104. package/.ultra-template/tasks/contexts/TEMPLATE.md +0 -19
  105. package/commands/learn.md +0 -10
  106. package/orchestrator/skill-miner.cjs +0 -133
  107. package/output-styles/coding-vibes.md +0 -67
  108. package/output-styles/structural-thinking.md +0 -61
  109. package/skills/learn/SKILL.md +0 -58
@@ -3,12 +3,33 @@
3
3
  Store durable research evidence here only when it is too detailed for the baseline
4
4
  specification. Baseline decisions and accepted behavior remain in `.ultra/specs/`.
5
5
 
6
- ## Required step reports
6
+ ## Initialization modes
7
7
 
8
- Every selected `ultra-research` step writes one immutable report at
9
- `.ultra/docs/research/<workflow-id>/<step-id>.md`. Full and adoption research therefore
10
- produce seventeen reports. The shared specifications are updated during research but
11
- do not replace these per-step evidence records.
8
+ `ultra-init` creates the scaffold and records classification; it never runs research
9
+ or approves a baseline. A later explicit `ultra-research` invocation handles:
10
+
11
+ - greenfield baseline evidence with adaptive product and architecture coverage;
12
+ - brownfield adoption of observed product, runtime, quality, operations, known
13
+ failures, and documentation drift;
14
+ - migrated or damaged authority only after backup-first `ultra-doctor` recovery,
15
+ followed by evidence-backed brownfield adoption.
16
+
17
+ Blank templates are never baseline evidence. Existing authority is preserved rather
18
+ than replaced by this scaffold.
19
+
20
+ ## Included-area reports
21
+
22
+ Every included research area that executes, verifies, or reuses evidence writes one
23
+ immutable report at `.ultra/docs/research/<workflow-id>/<step-id>.md`. The accepted
24
+ coverage determines the report set; `full` and `adoption` describe baseline purpose,
25
+ not a requirement to execute all seventeen catalog areas. Omitted areas create no
26
+ report. The shared specifications are updated during research but do not replace these
27
+ per-area evidence records.
28
+
29
+ This directory is only for baseline establishment and adoption. Active Change research
30
+ writes below
31
+ `.ultra/changes/active/<change-id>/research/<workflow-id>/<step-id>.md`; it updates the
32
+ Change overlay and never edits accepted baseline specifications.
12
33
 
13
34
  ## Report contract
14
35
 
@@ -67,7 +67,7 @@ decision. Include source date, segment, geography, and assumptions when applicab
67
67
 
68
68
  ## Baseline Gaps
69
69
 
70
- Reference authoritative gap ids from `.ultra/state.db`.
70
+ Reference authoritative gap ids from `.ultra/.runtime/state.db`.
71
71
 
72
72
  | Gap id | Category | Status | Evidence | Owner |
73
73
  |---|---|---|---|---|
@@ -1,6 +1,13 @@
1
1
  {
2
- "schema_version": "4.5",
3
- "generated_at": "1970-01-01T00:00:00.000Z",
4
- "source": ".ultra/state.db",
2
+ "kind": "ultra-team-task-ledger",
3
+ "schema_version": "1.0",
4
+ "generation": 0,
5
+ "parent_digest": null,
6
+ "ancestors": [],
7
+ "state_digest": "5bf27fb3627b711c97abf72f0aad150ba693d35bcebdd57c2d80e325f495de6d",
8
+ "published_at": null,
9
+ "reason": "scaffold",
10
+ "baseline": null,
11
+ "changes": [],
5
12
  "tasks": []
6
13
  }
@@ -0,0 +1,19 @@
1
+ <!-- Runtime task views are generated under .ultra/.runtime/projections/contexts/. -->
2
+
3
+ # Task Context Reference
4
+
5
+ Use this file only as a structure reference. Runtime task context views are generated
6
+ from SQLite authority and must not be edited by hand. Stable specification learning
7
+ must follow the Change workflow.
8
+
9
+ ## Implementation Notes
10
+
11
+ - [Evidence-backed note with a source reference]
12
+
13
+ ## Open Questions
14
+
15
+ - [Question, consequence, owner, and next evidence]
16
+
17
+ ## Recovery Notes
18
+
19
+ - [Current safe resume point and any external prerequisite]
package/CHANGELOG.md CHANGED
@@ -7,6 +7,112 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.22.0] — 2026-07-30
11
+
12
+ ### Added
13
+
14
+ - Added a versioned, digest-chained Git team checkpoint at
15
+ `.ultra/tasks/tasks.json` for portable baseline, Change, task-contract,
16
+ dependency, and durable task-status handoff.
17
+ - Added `task.ledger_get`, `task.ledger_publish`, and `task.ledger_import` with
18
+ per-record revisions, bounded ancestry, transactional fast-forward imports,
19
+ and typed baseline, Change, task, deletion, and active-session conflicts.
20
+ - Added exact-byte backup and deterministic upgrade of matching legacy v4.4
21
+ and v4.5 task projections during project resume.
22
+
23
+ ### Changed
24
+
25
+ - Moved generated task and context views under
26
+ `.ultra/.runtime/projections/`; SQLite remains checkout-local operational
27
+ authority while the Git checkpoint is the narrow team handoff.
28
+ - Updated all public workflow Skills, project templates, hooks, adapters, and
29
+ documentation to inspect and synchronize the team checkpoint without
30
+ turning hooks or host adapters into semantic authorities.
31
+ - Made imported ready baselines require checkout-local revalidation before
32
+ they may publish a descendant checkpoint.
33
+
34
+ ### Fixed
35
+
36
+ - Fixed tracked task projections creating a self-referential
37
+ `BASELINE_HEAD_STALE` treadmill after every Ultra operation or metadata-only
38
+ commit. Baseline freshness now uses scoped source content plus Git ancestry
39
+ while continuing to detect specification and source drift.
40
+ - Fixed task completion requiring a second bookkeeping commit. The completion
41
+ SHA is now backfilled only into local SQLite and generated views after the
42
+ single real completion commit.
43
+ - Fixed resume, doctor, status, and four-host install paths disagreeing about
44
+ legacy task projections, team checkpoints, generated views, and protected
45
+ files.
46
+ - Replaced the daemon's machine-speed-dependent 500ms release assertion with a
47
+ bounded observable-session wait while preserving the immediate-poll
48
+ behavior requirement.
49
+
50
+ ## [0.21.1] — 2026-07-29
51
+
52
+ ### Fixed
53
+
54
+ - Increased the packed four-host integration-test timeout to preserve the same
55
+ release gate on slower clean Linux runners instead of cancelling a healthy
56
+ tarball installation and MCP round-trip near the previous limit.
57
+
58
+ ## [0.21.0] — 2026-07-29
59
+
60
+ ### Added
61
+
62
+ - Added a trackable semantic artifact registry with digest, provenance,
63
+ ownership, freshness, and orphan detection while keeping mutable SQLite,
64
+ leases, telemetry, backups, and worktrees under the ignored
65
+ `.ultra/.runtime/` boundary.
66
+ - Added typed Change deltas, documentation reconciliation records, immutable
67
+ task and role context snapshots, transactional plan publication, and
68
+ self-contained delivery archives with crash-safe recovery journals.
69
+ - Added workflow revision and supersession contracts so accepted intent can
70
+ evolve without rewriting history or leaving active documents detached from
71
+ their owning workflow.
72
+ - Added schema 20 migration and backup-first recovery for legacy
73
+ `.ultra/state.db` projects, including safe runtime relocation and inode-pinned
74
+ archive finalization on supported POSIX platforms.
75
+
76
+ ### Changed
77
+
78
+ - Published one exact eleven-capability graph across all four host interaction
79
+ contracts. Every adapter now presents the same
80
+ `inspect -> suggest -> host-native ask -> normalize -> persist -> apply -> read back`
81
+ flow, owns no semantic authority, and waits for explicit invocation before another
82
+ public capability starts.
83
+ - Updated current workflow, authority, runtime, and project templates for the separate
84
+ greenfield, brownfield-adoption, and migrated-authority paths.
85
+ - Made every Change converge through a current plan, DB-backed task contract,
86
+ bounded context, risk-selected verification, review, documentation
87
+ reconciliation, and local delivery archive. Research remains adaptive and
88
+ may be omitted when current evidence is sufficient.
89
+ - Defined `.ultra/` as project-local cross-session workflow memory: registered
90
+ specifications and evidence carry semantic bodies, while MCP and SQLite own
91
+ lifecycle state, references, digests, legal transitions, and recovery.
92
+ - Extended packed-package conformance to cover prompt hygiene, native interaction
93
+ parity, exact public capabilities, user-handbook byte preservation, and project
94
+ inertness before `ultra-init`.
95
+
96
+ ### Fixed
97
+
98
+ - Fixed archive, plan, session-close, worktree, and migration mutations so
99
+ partial failures recover the prior files and state instead of reporting false
100
+ success or leaving split authority.
101
+ - Fixed context and delivery gates accepting stale, cross-project, symlinked,
102
+ malformed, unowned, or digest-mismatched artifacts.
103
+ - Fixed draft baselines exempting arbitrary files under `.ultra/specs/`; only
104
+ the four reserved baseline scaffold files are provisional before baseline
105
+ readiness, and every additional spec is diagnosed as an orphan immediately.
106
+ - Fixed host hooks and adapters resolving legacy state paths or becoming a
107
+ second semantic authority. Hooks now observe active workflow state, protect
108
+ projections, and surface recovery without forcing a semantic route.
109
+
110
+ ### Removed
111
+
112
+ - Removed the non-Ultra `learn` command and Skill, automatic session-to-Skill mining,
113
+ and both global output-style personas from source, host adapters, and npm
114
+ distribution. Ultra no longer creates user Skills or controls communication style.
115
+
10
116
  ## [0.20.0] — 2026-07-28
11
117
 
12
118
  ### Added
package/README.md CHANGED
@@ -43,9 +43,11 @@ Ultra Builder Pro addresses those gaps with four ideas:
43
43
  2. **Low-load user alignment.** The agent investigates observable facts itself
44
44
  and asks the user only for material intent, scope, risk, or authorization
45
45
  decisions—normally one dependent decision at a time.
46
- 3. **Durable project authority.** `.ultra/state.db` records baselines, changes,
47
- decisions, workflows, tasks, evidence digests, sessions, incidents, and
48
- recovery state across hosts and sessions.
46
+ 3. **Durable project authority.** `.ultra/.runtime/state.db` records checkout-local
47
+ lifecycle, decisions, workflows, evidence digests, sessions, incidents, and
48
+ recovery state across host sessions. Tracked semantic artifacts plus the
49
+ MCP-published `.ultra/tasks/tasks.json` checkpoint carry reviewed project intent
50
+ across Git checkouts without committing SQLite, leases, or telemetry.
49
51
  4. **Convergent delivery.** Research, plans, implementation, tests, review, and
50
52
  specification updates must agree before a change is archived.
51
53
 
@@ -59,14 +61,40 @@ session resumes from that authority instead of reconstructing it from chat.
59
61
  ## The mental model
60
62
 
61
63
  ```mermaid
62
- flowchart LR
63
- U["User<br/>intent and material decisions"] <--> H["Host agent<br/>reasoning and implementation"]
64
- H <--> S["Ultra skills<br/>task-specific workflows"]
65
- S <--> M["Ultra MCP<br/>state, evidence, freshness, recovery"]
66
- M <--> D[(".ultra/state.db")]
67
- H --> A["Code, specifications,<br/>tests and review artifacts"]
68
- A --> M
69
- K["Lifecycle hooks<br/>breadcrumb and projection protection"] --> M
64
+ flowchart TB
65
+ U["User<br/>goals, acceptance, trade-offs, risk, and external authorization"]
66
+
67
+ subgraph HOST["Supported coding host"]
68
+ UI["Host-native interaction<br/>Claude Code / Codex / OpenCode / Kimi Code"]
69
+ MODEL["Host agent<br/>inspect, recommend, implement, test, and review"]
70
+ ADAPTER["Host adapter<br/>native questions, commands, tools, and lifecycle wiring"]
71
+ end
72
+
73
+ SKILLS["Eleven explicit Ultra Skills<br/>init / research / think / change / plan / dev<br/>test / review / deliver / status / doctor"]
74
+ MCP["Ultra MCP<br/>60 typed tools across nine families"]
75
+ DB[(".ultra/.runtime/state.db<br/>SQLite lifecycle and index authority")]
76
+ LEDGER[".ultra/tasks/tasks.json<br/>Git team checkpoint for portable baseline, Change, and task state"]
77
+ VIEWS[".ultra/.runtime/projections<br/>checkout-local generated views"]
78
+ FILES["Digest-bound .ultra artifacts<br/>specification / research / change / plan / context<br/>test / review / delivery"]
79
+ HOOKS["Lifecycle hooks<br/>health, breadcrumbs, recovery hints, and managed-file protection"]
80
+ OPS["Operational tools<br/>ubp / ultra-tools / optional orchestrator"]
81
+ EXTERNAL["External memory and graph providers"]
82
+
83
+ U <-->|"intent, recommendation, and owner choice"| UI
84
+ UI <--> MODEL
85
+ ADAPTER --> UI
86
+ ADAPTER -.->|"discovers and presents"| SKILLS
87
+ MODEL -->|"explicit invocation"| SKILLS
88
+ SKILLS -->|"typed operations"| MCP
89
+ MCP <--> DB
90
+ MCP -->|"publish / validate / import"| LEDGER
91
+ MCP -->|"regenerate"| VIEWS
92
+ MODEL -->|"writes semantic and evidence bodies"| FILES
93
+ MCP <-->|"registers owner, digest, provenance, and freshness"| FILES
94
+ HOOKS -->|"observes and records lifecycle events"| MCP
95
+ OPS -->|"installation"| ADAPTER
96
+ OPS -->|"diagnosis, recovery, and approved dispatch"| MCP
97
+ EXTERNAL -.->|"bounded provider references only"| DB
70
98
  ```
71
99
 
72
100
  The responsibility split is deliberate:
@@ -75,14 +103,37 @@ The responsibility split is deliberate:
75
103
  |---|---|
76
104
  | **User** | Product intent, semantic route selection, material scope and trade-offs, risk acceptance, destructive actions, publishing and deployment authorization |
77
105
  | **Host model** | Fact-finding, synthesis, research-coverage and route recommendations, reversible implementation decisions |
78
- | **Ultra MCP** | Durable state, evidence references, digests, freshness, locks, valid transitions and hard recovery |
106
+ | **Ultra MCP** | Checkout-local state, evidence references, digests, freshness, locks, valid transitions, hard recovery, and Git checkpoint publish/import |
79
107
  | **Host adapter** | Native Skill discovery, user questions, tool invocation, installation, and runtime wiring |
80
- | **Hooks** | Fast lifecycle observation, current breadcrumb injection, and protection of generated projections |
108
+ | **Hooks** | Fast lifecycle observation, current breadcrumb injection, and protection of MCP-owned checkpoint and generated projection paths |
81
109
 
82
110
  The MCP does not replace the model's judgment. A hook does not decide product
83
111
  strategy. A prompt does not become durable authority merely because it appeared
84
112
  in a conversation.
85
113
 
114
+ ### How owner intent becomes durable authority
115
+
116
+ ```mermaid
117
+ flowchart TD
118
+ CURRENT["Current Ultra workflow"] --> INSPECT["Host model inspects code, documents, and current authority"]
119
+ INSPECT --> SUGGEST["Model recommends a route and explains its consequences"]
120
+ SUGGEST --> CLEAR{"Is current owner intent already explicit?"}
121
+ CLEAR -->|"Yes"| NORMALIZE["Normalize the accepted intent"]
122
+ CLEAR -->|"No: a material choice remains"| ASK["Ask one dependent question through the host-native question tool"]
123
+ ASK --> NORMALIZE
124
+ NORMALIZE --> DECISION["Persist the normalized result through decision.*"]
125
+ DECISION --> APPLY["Apply it through the owning MCP operation or digest-bound artifact"]
126
+ APPLY --> AUTHORITY["Bind state, artifact digest, provenance, and downstream effects"]
127
+ AUTHORITY --> READBACK["Read back the authoritative result"]
128
+ READBACK --> RESUME["Resume the exact workflow step and recommend the next explicit capability"]
129
+ ```
130
+
131
+ The interaction before the write establishes owner intent. Once the host model
132
+ normalizes and persists that intent, MCP treats the stored result as current
133
+ authority; it does not try to prove that the owner clicked a particular UI
134
+ control. Ultra stores the accepted result and its scope, evidence, provenance,
135
+ and effects—not chain-of-thought, raw prompts, transcripts, or UI receipts.
136
+
86
137
  ## What you get
87
138
 
88
139
  - Native plugins for **Claude Code**, **OpenCode**, **Codex**, and **Kimi Code**.
@@ -121,6 +172,8 @@ Requirements:
121
172
 
122
173
  - Node.js 22 or newer;
123
174
  - Git for the normal project workflow;
175
+ - Python 3 on a POSIX platform with `dir_fd` filesystem operations for
176
+ inode-pinned archive finalization and recovery;
124
177
  - one or more supported coding-agent hosts.
125
178
 
126
179
  Install globally into all detected host configuration directories:
@@ -189,7 +242,7 @@ Initialization:
189
242
  - identifies the repository root and scope;
190
243
  - classifies the repository as greenfield, brownfield, or migrated;
191
244
  - initializes Git when needed;
192
- - creates `.ultra/` and schema 19 project authority;
245
+ - creates `.ultra/` and schema 20 project authority;
193
246
  - verifies that the scaffold and database can be read back;
194
247
  - completes without silently starting research, creating a commit, adding a
195
248
  remote, or pushing anything.
@@ -205,16 +258,18 @@ The common path after baseline approval is:
205
258
  ```text
206
259
  ultra-change
207
260
  -> optional ultra-think or bounded ultra-research
208
- -> ultra-plan when planning is needed
261
+ -> ultra-plan
209
262
  -> ultra-dev
210
263
  -> risk-selected ultra-test
211
264
  -> ultra-review
212
265
  -> ultra-deliver
213
266
  ```
214
267
 
215
- That diagram is a common path, not a mandatory pipeline. A small current task
216
- can take a shorter valid route; a high-risk or unclear change can require more
217
- research, planning, checking, or user alignment.
268
+ Each public workflow is explicitly invoked rather than auto-chained. Thinking and
269
+ research coverage are adaptive, and verification depth is risk-selected, but every
270
+ Change reaches a current plan, DB-backed task contract, and role-scoped context before
271
+ development. “Direct Build” skips Research only; it does not bypass Plan, Task, or
272
+ Context authority.
218
273
 
219
274
  ### 2. Adopt an existing project
220
275
 
@@ -235,7 +290,7 @@ During `ultra-research`, the host model inspects current evidence and recommends
235
290
  the smallest sufficient route. The owner selects, modifies, delegates, or
236
291
  defers it through the host-native question surface unless the current request
237
292
  already resolves the route. The normalized accepted coverage is then stored in
238
- `.ultra/state.db`. Every included area receives one explicit disposition:
293
+ `.ultra/.runtime/state.db`. Every included area receives one explicit disposition:
239
294
 
240
295
  - `execute` — produce fresh evidence;
241
296
  - `verify_existing` — validate an existing artifact;
@@ -249,8 +304,11 @@ that rationale is useful. MCP validates state, evidence, and transitions; it
249
304
  does not store or prove the preceding UI interaction.
250
305
 
251
306
  Older projection-only Ultra projects are preserved and routed through a
252
- backup-first migration or rebaseline. Use `ultra-doctor` when initialization
253
- reports migration or authority damage; do not overwrite old state manually.
307
+ backup-first migration or rebaseline. The first supported checkpoint publication
308
+ replaces a v4.4/v4.5 task projection only when its ids and durable fields match
309
+ SQLite, after copying its exact bytes to `.ultra/.runtime/backups/task-ledger/`.
310
+ Use `ultra-doctor` when initialization reports migration, mismatch, or authority
311
+ damage; do not overwrite old state manually.
254
312
 
255
313
  ### 3. Make daily changes
256
314
 
@@ -266,8 +324,8 @@ The host then recommends one valid capability:
266
324
 
267
325
  - `ultra-think` for a material unresolved decision or diagnosis;
268
326
  - bounded `ultra-research` for a real evidence gap;
269
- - `ultra-plan` for task decomposition and dependency planning;
270
- - `ultra-dev` when a current task contract is already executable;
327
+ - `ultra-plan` for the required task decomposition and dependency planning boundary;
328
+ - `ultra-dev` after the current plan has produced an executable task contract;
271
329
  - `ultra-status` when the user needs the current authority and available routes;
272
330
  - `ultra-doctor` when state or installation health is degraded.
273
331
 
@@ -302,32 +360,145 @@ The next piece of daily work starts with a new `ultra-change`.
302
360
  | `ultra-deliver` | Reconcile specifications, close local authority, and archive the change |
303
361
  | `ultra-status` | Read the current breadcrumb, blockers, evidence, and allowed transitions |
304
362
  | `ultra-doctor` | Diagnose installation or project-state faults and expose safe recovery |
305
- | `learn` | Turn one approved, verified reusable procedure into a portable user skill |
363
+
364
+ These eleven capabilities are the complete public Ultra command graph. Each capability
365
+ returns current `allowed_transitions`; the host may recommend one, but another public
366
+ capability starts only after an explicit user command or skill invocation.
367
+
368
+ ### Command interaction graph
369
+
370
+ Every solid handoff below means: the current capability returns
371
+ `allowed_transitions`, the model recommends a route, and the owner explicitly
372
+ invokes the next public capability. It does not mean that one public command
373
+ silently launches another.
374
+
375
+ ```mermaid
376
+ flowchart TD
377
+ START["Project entry"] --> INIT["ultra-init"]
378
+ INIT --> CLASSIFY{"Repository classification"}
379
+
380
+ CLASSIFY -->|"Greenfield"| GREEN["Create scaffold<br/>verify Git and project authority"]
381
+ CLASSIFY -->|"Brownfield"| BROWN["Preserve the delivered system<br/>bootstrap adoption authority"]
382
+ CLASSIFY -->|"Legacy or damaged authority"| REPAIR["ultra-doctor<br/>migrate, recover, or rebaseline"]
383
+ REPAIR --> BROWN
384
+
385
+ GREEN --> RESEARCH["Explicit ultra-research"]
386
+ BROWN --> RESEARCH
387
+ RESEARCH --> BASELINE{"Has the baseline converged?"}
388
+ BASELINE -->|"Material decision gap"| THINK_BASE["ultra-think"]
389
+ THINK_BASE --> RESEARCH
390
+ BASELINE -->|"Evidence gap"| RESEARCH
391
+ BASELINE -->|"Approved and current"| CHANGE["Explicit ultra-change"]
392
+
393
+ CHANGE --> ROUTE{"Model recommends a route<br/>owner selects or modifies it"}
394
+ ROUTE -->|"Material intent remains unresolved"| THINK_CHANGE["ultra-think"]
395
+ THINK_CHANGE --> ROUTE
396
+ ROUTE -->|"Real evidence gap"| CHANGE_RESEARCH["Bounded ultra-research<br/>owned by the active Change"]
397
+ CHANGE_RESEARCH --> PLAN["ultra-plan"]
398
+ ROUTE -->|"Evidence is sufficient: Direct Build"| PLAN
399
+
400
+ PLAN --> DEV["ultra-dev<br/>one dependency-ready vertical task"]
401
+ DEV --> TASKS{"More executable tasks?"}
402
+ TASKS -->|"Yes"| DEV
403
+ TASKS -->|"No"| TEST["ultra-test<br/>risk-selected formal verification"]
404
+ TEST -->|"Failed or incomplete"| DEV
405
+ TEST -->|"Passing"| REVIEW["ultra-review<br/>specification fidelity and engineering quality"]
406
+ REVIEW -->|"Changes required"| DEV
407
+ REVIEW -->|"Approved"| DELIVER["ultra-deliver"]
408
+ DELIVER --> ARCHIVE["Reconcile specifications<br/>apply the Change overlay and archive evidence"]
409
+ ARCHIVE --> NEXT{"Continue"}
410
+ NEXT -->|"Next outcome"| CHANGE
411
+ NEXT -->|"Inspect current authority"| STATUS["ultra-status"]
412
+
413
+ ANY["Any active stage"] -.->|"read-only routing"| STATUS
414
+ ANY -.->|"mechanical health fault"| DOCTOR["ultra-doctor"]
415
+ ```
416
+
417
+ “Direct Build” skips additional Research only. It still requires
418
+ `ultra-plan`, current DB-backed task contracts, dependency ownership, and an
419
+ immutable role-scoped Context Manifest before `ultra-dev`. `ultra-status` is a
420
+ read-only side route, while `ultra-doctor` diagnoses and repairs mechanical
421
+ health without selecting product intent.
306
422
 
307
423
  ## What lives in `.ultra/`
308
424
 
309
425
  ```text
310
426
  .ultra/
311
- state.db # sole durable Ultra authority
312
- specs/ # current product and architecture baseline
427
+ .runtime/ # local mutable state; ignored by Git
428
+ state.db # lifecycle, index, transition, and freshness authority
429
+ checkpoint.json # advisory recovery projection
430
+ projections/ # generated local task and task-context views
431
+ backups/ # verified migration and recovery snapshots
432
+ collab/ # local collaboration scratch
433
+ sessions/ # local leases and session runtime
434
+ worktrees/ # registered local Git worktrees
435
+ telemetry/ # local operational telemetry
436
+ specs/ # digest-bound product and architecture baseline
313
437
  changes/
314
- active/ # current Change artifacts
438
+ active/<id>/ # all current Change semantics and evidence
439
+ intent.md # accepted Change Contract
440
+ findings.md # durable Change findings
441
+ progress.md # generated human-readable projection
442
+ research/ # Change-only findings and research reports
443
+ delta/ # typed baseline overlay and semantic payloads
444
+ documentation/ # documentation overlay and reconciliation evidence
445
+ plan.json # machine-readable task topology
446
+ plan.md # deterministic human plan projection
447
+ contexts/ # immutable role/task context snapshots
448
+ test/ # Change-scoped test reports
449
+ review/ # Change-scoped review workers and summary
450
+ delivery/ # Change-scoped delivery evidence
315
451
  archive/ # immutable delivered Change artifacts
316
- docs/research/ # evidence reports for selected research areas
317
- reports/ # test, review, and delivery evidence
452
+ docs/research/ # baseline-only research evidence
453
+ reports/templates/ # blank report schemas; never delivery evidence
318
454
  tasks/
319
- tasks.json # generated projection, never the authority
320
- contexts/ # bounded role/task context artifacts
455
+ tasks.json # MCP-published Git team checkpoint; never hand-edited
456
+ templates/
457
+ task-context.md # authored template, not a generated task context
321
458
  ```
322
459
 
323
- The host agent writes semantic specifications and evidence artifacts. MCP
324
- validates their references and digests, records workflow state, and rejects
325
- stale or illegal transitions. Generated Markdown and JSON help humans and tools
326
- inspect the project, but `.ultra/state.db` remains authoritative.
327
-
328
- Ultra does not store chain-of-thought, raw prompts, transcripts, cross-session
329
- memory, or code-graph content. Memory and graph systems remain separate
330
- providers; Ultra may store only bounded metadata references to them.
460
+ Together, `.ultra/` is Ultra's project-local cross-session workflow memory. The
461
+ host model writes semantic specifications and evidence through the active
462
+ workflow. MCP records lifecycle state, references, digests, provenance, and
463
+ accepted intent, then rejects stale or illegal transitions. The DB is the
464
+ lifecycle and index authority for one checkout; registered digest-bound files carry
465
+ the semantic or evidence bodies that the DB references. The Git checkpoint is a
466
+ portable, digest-chained handoff of baseline, Change, and durable task records. It is
467
+ not a second live session authority. Generated projections and working scratch are
468
+ not authority.
469
+
470
+ Ultra does not store chain-of-thought, raw prompts, transcripts, general
471
+ conversational or episodic memory, or code-graph payloads. External memory and
472
+ graph systems remain separate providers; Ultra may store bounded metadata
473
+ references to them as workflow context. Only `.ultra/.runtime/` is ignored by
474
+ Git: semantic and evidence artifacts can travel with the repository, while
475
+ SQLite, leases, telemetry, and recovery scratch remain checkout-local.
476
+
477
+ ### Team checkpoint protocol
478
+
479
+ MCP publishes `.ultra/tasks/tasks.json` at durable boundaries: baseline convergence,
480
+ Change creation or revision, accepted plan export, durable task-contract or status
481
+ changes, task expansion or deletion, and Change convergence or archive. The file
482
+ contains per-record revisions and digests plus checkpoint ancestry. It excludes
483
+ `in_progress` ownership, session ids, leases, worktrees, telemetry, and
484
+ `completion_commit`.
485
+
486
+ After a pull or on a fresh checkout, MCP validates and imports the checkpoint. Clean
487
+ records fast-forward independently. A baseline imported as `ready` is downgraded to
488
+ checkout-local revalidation until its scope, files, verification, and HEAD are proven
489
+ again. Concurrent edits to the same baseline, Change, or task, a non-descendant
490
+ checkpoint, or remote modification of an active local task fail with a typed conflict;
491
+ Ultra never silently picks a side. Re-importing the same checkpoint is read-only, and
492
+ an imported ready baseline cannot publish another checkpoint until local revalidation
493
+ converges.
494
+
495
+ Baseline freshness does not use the checkpoint commit as a self-referential marker.
496
+ It combines Git ancestry with a scoped content digest that excludes `.ultra/`.
497
+ Consequently, a commit containing only Ultra metadata does not make the baseline stale,
498
+ while a descendant commit that changes scoped application content does.
499
+
500
+ See [Artifact authority](./docs/ARTIFACT-AUTHORITY.md) for the promotion and
501
+ evidence rules.
331
502
 
332
503
  ## Optional orchestration
333
504
 
@@ -379,8 +550,11 @@ host's existing model session.
379
550
  reinstall only the degraded host.
380
551
  - **Project state is unhealthy:** invoke `ultra-doctor` or run
381
552
  `ultra-tools system doctor`. Repairs and schema migrations are backup-first.
382
- - **A projection disagrees with MCP:** trust `.ultra/state.db`; do not repair
383
- `tasks.json` or generated context Markdown by hand.
553
+ - **The team checkpoint disagrees with local state:** run `ultra-status`, inspect the
554
+ typed ledger condition, then use the recommended `task.ledger_import` or
555
+ `task.ledger_publish` path. Never edit `.ultra/tasks/tasks.json` by hand.
556
+ - **A generated view disagrees with MCP:** trust `.ultra/.runtime/state.db`; never edit
557
+ `.ultra/.runtime/projections/` by hand.
384
558
  - **A workflow appears blocked:** use `ultra-status` to read the exact current
385
559
  workflow, blocker, owner decision, and mechanically valid transitions.
386
560
  - **Kimi reports a native-module ABI error:** ensure an external Node.js 22+