ultra-builder-pro-cli 0.19.1 → 0.21.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 (103) 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 +1 -1
  4. package/CHANGELOG.md +90 -1
  5. package/README.md +62 -29
  6. package/adapters/_shared/codex-assets.cjs +69 -11
  7. package/adapters/_shared/interaction-contract.cjs +60 -5
  8. package/adapters/_shared/runtime-assets.cjs +41 -1
  9. package/adapters/claude.js +7 -5
  10. package/adapters/codex.js +1 -1
  11. package/adapters/kimi.js +2 -8
  12. package/adapters/opencode.js +30 -28
  13. package/bin/orchestrator.js +64 -24
  14. package/commands/ultra-research.md +1 -1
  15. package/docs/AGENT-CONTEXT.md +79 -45
  16. package/docs/ARCHITECTURE.md +75 -38
  17. package/docs/ARTIFACT-AUTHORITY.md +234 -0
  18. package/docs/DECISIONS.md +20 -10
  19. package/docs/LEGACY-CLI-CROSSWALK.md +15 -11
  20. package/docs/PLUGIN-ISOLATION-CONTRACT.md +4 -3
  21. package/docs/ROADMAP.md +21 -6
  22. package/docs/RUNTIME-COMPAT-MATRIX.md +30 -13
  23. package/docs/STATE-DB-ACCESS-POLICY.md +11 -9
  24. package/docs/WORKFLOW-LIFECYCLE.md +105 -54
  25. package/hooks/README.md +6 -5
  26. package/hooks/active_task_context.py +97 -12
  27. package/hooks/context_spine.py +16 -4
  28. package/hooks/health_check.py +5 -4
  29. package/hooks/pre_stop_check.py +5 -2
  30. package/hooks/runtime_paths.py +396 -0
  31. package/hooks/subagent_tracker.py +5 -2
  32. package/hooks/workflow_checkpoint.py +16 -3
  33. package/hooks/workflow_context.py +11 -3
  34. package/hooks/workflow_resume.py +7 -4
  35. package/mcp-server/breadcrumb.cjs +20 -2
  36. package/mcp-server/lib/archive-journal.cjs +1026 -111
  37. package/mcp-server/lib/archive-mutation-worker.py +365 -0
  38. package/mcp-server/lib/artifact-registry.cjs +1126 -0
  39. package/mcp-server/lib/baseline-workflow.cjs +9 -4
  40. package/mcp-server/lib/change-packet.cjs +818 -0
  41. package/mcp-server/lib/change-workflow.cjs +932 -176
  42. package/mcp-server/lib/context-paths.cjs +111 -0
  43. package/mcp-server/lib/context-spine.cjs +511 -45
  44. package/mcp-server/lib/decision-dialogue.cjs +427 -12
  45. package/mcp-server/lib/delivery-transaction.cjs +471 -0
  46. package/mcp-server/lib/doctor-backup-worker.cjs +328 -0
  47. package/mcp-server/lib/doctor.cjs +375 -12
  48. package/mcp-server/lib/git-bootstrap.cjs +459 -47
  49. package/mcp-server/lib/init-project.cjs +190 -95
  50. package/mcp-server/lib/plan-publication-worker.cjs +830 -0
  51. package/mcp-server/lib/plan-store.cjs +700 -5
  52. package/mcp-server/lib/project-breadcrumb.cjs +23 -4
  53. package/mcp-server/lib/projector.cjs +174 -40
  54. package/mcp-server/lib/runtime-paths.cjs +1687 -0
  55. package/mcp-server/lib/safe-project-file.cjs +385 -0
  56. package/mcp-server/lib/spec-learning.cjs +28 -12
  57. package/mcp-server/lib/state-db.cjs +397 -13
  58. package/mcp-server/lib/state-ops.cjs +248 -49
  59. package/mcp-server/lib/telemetry.cjs +12 -3
  60. package/mcp-server/lib/workflow-state.cjs +614 -62
  61. package/mcp-server/server.cjs +282 -33
  62. package/orchestrator/daemon.cjs +2 -10
  63. package/orchestrator/parallel-orchestrator.cjs +314 -50
  64. package/orchestrator/planner/plan-builder.cjs +1 -1
  65. package/orchestrator/recovery.cjs +125 -7
  66. package/orchestrator/session-close-journal-worker.cjs +5 -0
  67. package/orchestrator/session-close-journal.cjs +1014 -0
  68. package/orchestrator/session-runner.cjs +679 -69
  69. package/orchestrator/worktree-manager.cjs +186 -35
  70. package/package.json +2 -3
  71. package/skills/cc-collab/SKILL.md +4 -1
  72. package/skills/codex-collab/SKILL.md +5 -2
  73. package/skills/ultra-change/SKILL.md +38 -13
  74. package/skills/ultra-deliver/SKILL.md +23 -11
  75. package/skills/ultra-dev/SKILL.md +33 -6
  76. package/skills/ultra-doctor/SKILL.md +6 -2
  77. package/skills/ultra-init/SKILL.md +4 -2
  78. package/skills/ultra-plan/SKILL.md +68 -18
  79. package/skills/ultra-research/SKILL.md +45 -32
  80. package/skills/ultra-review/SKILL.md +9 -5
  81. package/skills/ultra-status/SKILL.md +9 -4
  82. package/skills/ultra-test/SKILL.md +15 -7
  83. package/skills/ultra-think/SKILL.md +6 -0
  84. package/skills/ultra-think/references/decision-dialogue.md +61 -14
  85. package/skills/ultra-verify/SKILL.md +4 -1
  86. package/spec/cli-protocol.md +19 -7
  87. package/spec/mcp-tools.yaml +531 -46
  88. package/spec/schemas/change-delta.v1.schema.json +153 -0
  89. package/spec/schemas/documentation-reconciliation.v1.schema.json +106 -0
  90. package/spec/schemas/mcp-tools.schema.json +1 -1
  91. package/spec/schemas/state-db.sql +57 -17
  92. package/spec/schemas/tasks.v4.5.schema.json +1 -1
  93. package/ultra-tools/cli.cjs +3 -2
  94. package/ultra-tools/commands/db.cjs +76 -25
  95. package/ultra-tools/commands/migrate.cjs +995 -80
  96. package/ultra-tools/commands/session.cjs +34 -8
  97. package/ultra-tools/commands/status.cjs +34 -7
  98. package/ultra-tools/commands/system.cjs +129 -22
  99. package/commands/learn.md +0 -10
  100. package/orchestrator/skill-miner.cjs +0 -133
  101. package/output-styles/coding-vibes.md +0 -67
  102. package/output-styles/structural-thinking.md +0 -61
  103. package/skills/learn/SKILL.md +0 -58
@@ -7,9 +7,9 @@ and Kimi Code plugins.
7
7
 
8
8
  Ultra Builder Pro owns only:
9
9
 
10
- - twelve public workflows: `learn`, `ultra-init`, `ultra-research`, `ultra-plan`,
11
- `ultra-dev`, `ultra-test`, `ultra-review`, `ultra-deliver`, `ultra-status`, and
12
- `ultra-think`, plus the daily `ultra-change` and diagnostic `ultra-doctor`;
10
+ - eleven public capabilities: `ultra-init`, `ultra-research`, `ultra-plan`,
11
+ `ultra-dev`, `ultra-test`, `ultra-review`, `ultra-deliver`, `ultra-status`,
12
+ `ultra-think`, `ultra-change`, and `ultra-doctor`;
13
13
  - four internal agent-only rule skills: `code-review-expert`, `security-rules`,
14
14
  `integration-rules`, and `testing-rules`;
15
15
  - the host-specific collaboration companions, `ultra-verify`, and host-native
@@ -25,7 +25,7 @@ not put it in a plugin until that allowlist classifies it.
25
25
  ## 2. Three-layer architecture
26
26
 
27
27
  ```text
28
- native command or skill -> MCP workflow-state operation -> .ultra/state.db
28
+ native command or skill -> MCP workflow-state operation -> .ultra/.runtime/state.db
29
29
  ^
30
30
  |
31
31
  selected CLI init / doctor / diagnostics / orchestration
@@ -34,34 +34,41 @@ native command or skill -> MCP workflow-state operation -> .ultra/state.db
34
34
  | Layer | Artifact | Contract |
35
35
  |---|---|---|
36
36
  | Skill/command | `skills/*/SKILL.md`, `commands/*.md` | Model-facing workflow and host-native entry point |
37
- | MCP | `mcp-server/server.cjs` | Authoritative typed operations over `.ultra/state.db` |
37
+ | MCP | `mcp-server/server.cjs` | Authoritative typed operations over `.ultra/.runtime/state.db` |
38
38
  | CLI | `ultra-tools`, `ubp-orchestrator` | Selected initialization, backup-first recovery, automation, and diagnostics; not a change-state mirror |
39
39
 
40
- `.ultra/state.db` is the only durable Ultra authority for baselines, changes, decisions, tasks,
41
- workflow runs/steps, sessions, events, incidents, projection jobs/cursors, telemetry, review evidence,
42
- and circuit-breaker state. `tasks.json`, context Markdown, execution plans, and
43
- reports are projections or workflow artifacts.
40
+ `.ultra/` is project-local cross-session workflow memory for normalized intent,
41
+ progress, tasks, bounded context, specifications, evidence, provenance, and recovery.
42
+ `.ultra/.runtime/state.db` is the only lifecycle, index, transition, freshness, and
43
+ coordination authority for baselines, changes, decisions, tasks, workflow runs/steps,
44
+ sessions, events, incidents, projection jobs/cursors, telemetry, review evidence, and
45
+ circuit-breaker state. Registered digest-bound specifications and reports carry
46
+ semantic or evidence bodies. `tasks.json`, generated task-context files, runtime
47
+ checkpoints, and collaboration scratch are not independent authority. See
48
+ [`ARTIFACT-AUTHORITY.md`](./ARTIFACT-AUTHORITY.md).
44
49
 
45
50
  ## 3. Live MCP and declared contracts
46
51
 
47
- `spec/mcp-tools.yaml` declares and the bundled server registers 50 tools across
48
- eight families:
52
+ `spec/mcp-tools.yaml` declares and the bundled server registers 57 tools across
53
+ nine families:
49
54
 
50
55
  | Family | Live tools |
51
56
  |---|---|
52
57
  | `baseline.*` | start, record, get, converge |
53
58
  | `task.*` | create, update, list, get, switch_tag, delete, init_project, expand, parse_prd, dependency_topo, append_event, subscribe_events |
54
59
  | `session.*` | spawn, close, get, list, admission_check, heartbeat, subscribe_events |
55
- | `change.*` | create, update, get, list, context, breadcrumb, learning_propose, learning_resolve, converge, archive |
56
- | `decision.*` | thread_start, get, list, open, resolve, delegate, defer, supersede, checkpoint |
57
- | `workflow.*` | start, get, list, step, complete |
60
+ | `change.*` | create, update, delta, documentation_reconcile, get, list, context, breadcrumb, learning_propose, learning_resolve, converge, archive |
61
+ | `decision.*` | thread_start, get, list, open, resolve, delegate, defer, supersede, complete, checkpoint |
62
+ | `workflow.*` | start, get, list, step, revise, supersede, complete |
63
+ | `artifact.*` | record, get |
58
64
  | `system.*` | doctor |
59
65
  | `plan.*` | export, get |
60
66
 
61
67
  Review, repository impact discovery, skill loading, and decision presentation remain
62
68
  host-native capabilities rather than fake MCP contracts. MCP stores only normalized
63
- decision authority and checkpoints; it never generates questions or retains prompts
64
- and transcripts. The generated Codex capability map documents host replacements.
69
+ decision authority, pending-question recovery state, lifecycle completion, and optional
70
+ checkpoints; it never generates questions or retains prompts and transcripts. The
71
+ generated Codex capability map documents host replacements.
65
72
 
66
73
  The complete write, transition, invalidation, and recovery contract lives in
67
74
  [`WORKFLOW-LIFECYCLE.md`](./WORKFLOW-LIFECYCLE.md).
@@ -79,34 +86,56 @@ review, and deliver route back to the same thread instead of deciding for the ow
79
86
 
80
87
  One partial unique index permits only one open item per thread. `decision.resolve`,
81
88
  `decision.delegate`, and `decision.defer` preserve the source of authority;
82
- `decision.supersede` preserves history when evidence or intent changes. Prepare and
83
- confirm checkpointing bind a material accepted cluster to current artifact digests
84
- when interruption recovery needs that boundary. Status and breadcrumb return only the
85
- current question plus allowed and mechanically required transitions, so recovery does
86
- not require replaying conversation history.
89
+ `decision.supersede` preserves history when evidence or intent changes.
90
+ After normalization, the host applies accepted intent through the owning MCP operation
91
+ or digest-bound artifact, reads it back, and records typed `applied_refs` when another
92
+ authority changed. Row-backed references require the exact field and canonical value;
93
+ specification and artifact references require the exact file digest. Active proposals
94
+ are never recalled as accepted intent. `decision.complete` then closes settled state without manufacturing
95
+ an approval receipt. Prepare and confirm checkpointing remain optional and bind only a
96
+ material accepted cluster to current artifact digests when interruption recovery needs
97
+ that boundary. Status and breadcrumb return the current unresolved question, accepted
98
+ intent relevant to the active authority, and allowed or mechanically required
99
+ transitions, so recovery does not require replaying conversation history.
87
100
 
88
101
  ## 5. Context Spine contract
89
102
 
90
103
  Context Manifest v3 is an immutable DB-backed role handoff, not a static codebase summary.
91
104
  `change.context` compiles required references, digests, readiness, context budget,
92
105
  public seam, exact verification command, Change/task authority digests, and valid
93
- transitions for `plan`, `implement`, `check`, or `review`. The default 12-file,
94
- about 12k-token, and 40%
106
+ transitions for `plan`, `implement`, `check`, or `review`. Compilation never updates
107
+ Change or provider authority; provider metadata changes through `change.update`.
108
+ Snapshots are selected exactly by `change_id`, nullable `task_id`, `role`, and `gate`,
109
+ so a review packet cannot satisfy implementation or planning evidence.
110
+
111
+ Implementation packets inline only the selected task, direct dependency/integration
112
+ neighborhood, and the restored task-context contract. Referenced file bodies remain
113
+ lazy. The token estimate includes inline Change/task authority plus referenced-file
114
+ estimates. Context refs preserve `expected_digest`, `anchor`, `scope`, and one of
115
+ `digest`, `existence`, or `advisory` freshness. Current consumers revalidate these
116
+ policies instead of trusting an old manifest.
117
+
118
+ The default 12-file, about 12k-token, and 40%
95
119
  fresh-context values are attention guidance. Overflow produces warnings; it does
96
120
  not block work or require raising a threshold. Prefer direct reads, bounded
97
121
  excerpts, or a smaller slice when they preserve correctness, and retain all
98
122
  necessary context when they do not.
99
123
 
100
124
  `change.breadcrumb` is the only compact router. Hooks may inject its change/task,
101
- role, gate, readiness, blockers, `allowed_transitions`, and `required_transition`.
102
- They must not inject intent
103
- bodies, transcripts, external memory, or graph payloads. Missing references,
104
- digest drift, HEAD drift, or a missing execution seam blocks readiness. Context
125
+ role, gate, readiness, blockers, bounded normalized accepted intent,
126
+ `allowed_transitions`, and `required_transition`. They must not inject raw prompts,
127
+ interaction transcripts, external-memory payloads, or graph payloads. Missing references,
128
+ required digest drift, HEAD drift, or a missing execution seam blocks readiness. Context
105
129
  size and baseline drift are advisory for a change that is already active. New ordinary
106
130
  work requires a healthy baseline. Only an explicitly approved incident break-glass may
107
131
  start without it; incident archive records a blocking reconciliation gap. Revision and
108
132
  tracked-spec integrity are reconciled and rechecked atomically for ordinary archive.
109
133
 
134
+ The plan workflow records a `plan/planning` manifest before design and exports only
135
+ `<artifact_root>/plan.json` plus deterministic `plan.md`. Both bind the planning
136
+ snapshot digest. The global `.ultra/execution-plan.json` is legacy read-only
137
+ compatibility and must not receive new plan writes.
138
+
110
139
  Stable discoveries use `change.learning_propose`; they reach the baseline only
111
140
  through approve/reject/apply transitions in `change.learning_resolve`. Unresolved
112
141
  learning blocks convergence. Review contributes two independent axes,
@@ -116,10 +145,14 @@ learning blocks convergence. Review contributes two independent axes,
116
145
 
117
146
  | Host | Plugin form | Workflow entry | Hook form | Collaboration companions |
118
147
  |---|---|---|---|---|
119
- | Claude Code | `.claude-plugin/plugin.json`, native commands/skills/agents, `.mcp.json` | `/ultra-*`, `/learn` | native `hooks/hooks.json` | `codex-collab`, `ultra-verify` |
120
- | Codex | personal plugin with `.codex-plugin/plugin.json`, namespaced skills, TOML agents, `.mcp.json` | `$ultra-builder-pro:ultra-*`, `$ultra-builder-pro:learn` | native `hooks/hooks.json` through the Codex wire adapter | `cc-collab`, `ultra-verify` |
121
- | OpenCode | config bundle plus native JavaScript plugin | `/ultra-*`, `/learn` | `event`, system transform, compaction, and tool lifecycle handlers | `cc-collab`, `codex-collab`, `ultra-verify` |
122
- | Kimi Code 0.26+ | managed `kimi.plugin.json` plugin with commands, skills, hooks, and MCP | `/ultra-builder-pro:ultra-*`, `/ultra-builder-pro:learn` | native hooks through the Kimi wire adapter | `cc-collab`, `codex-collab`, `ultra-verify` |
148
+ | Claude Code | `.claude-plugin/plugin.json`, native commands/skills/agents, `.mcp.json` | `/ultra-builder-pro:ultra-*` | native `hooks/hooks.json` | `codex-collab`, `ultra-verify` |
149
+ | Codex | personal plugin with `.codex-plugin/plugin.json`, namespaced skills, TOML agents, `.mcp.json` | `$ultra-builder-pro:ultra-*` | native `hooks/hooks.json` through the Codex wire adapter | `cc-collab`, `ultra-verify` |
150
+ | OpenCode | config bundle plus native JavaScript plugin | `/ultra-*` | `event`, system transform, compaction, and tool lifecycle handlers | `cc-collab`, `codex-collab`, `ultra-verify` |
151
+ | Kimi Code 0.26+ | managed `kimi.plugin.json` plugin with commands, skills, hooks, and MCP | `/ultra-builder-pro:ultra-*` | native hooks through the Kimi wire adapter | `cc-collab`, `codex-collab`, `ultra-verify` |
152
+
153
+ `spec/interaction-contract.json` carries the same exact public-capability graph for
154
+ every host. Adapters translate the question and invocation surfaces; they never own
155
+ semantic selection or durable state.
123
156
 
124
157
  The current host remains primary. Collaboration skills call another runtime
125
158
  only when explicitly requested, use it as a read-only advisor, and return the
@@ -153,12 +186,13 @@ reject an edit, stop, or tool call.
153
186
  Generic command blocking, post-edit governance, and unrelated user hooks are not
154
187
  copied into Ultra Builder Pro.
155
188
 
156
- ## 8. Memory boundary
189
+ ## 8. Workflow-memory boundary
157
190
 
158
- Ultra Builder Pro has no memory MCP family, recall skill, prompt capture,
159
- transcript capture, observation journal, or session-summary hook. Persistent
160
- cross-session memory belongs to a separately installed provider such as
161
- cloud-mem/claude-mem. Code graph content is equally external. A change context
191
+ Ultra Builder Pro has no general memory MCP family, general recall skill, prompt
192
+ capture, transcript capture, observation journal, or session-summary hook. It does
193
+ retain its own project-local cross-session workflow memory under `.ultra/`.
194
+ General conversational or episodic memory belongs to a separately installed provider
195
+ such as cloud-mem/claude-mem. Code-graph content is equally external. A change context
162
196
  may contain only provider metadata references, never provider payload content.
163
197
 
164
198
  Old Ultra data is never deleted during install. The explicit migration path is:
@@ -170,25 +204,25 @@ ultra-tools legacy-memory prune --confirm DELETE_ULTRA_LEGACY_MEMORY
170
204
  ```
171
205
 
172
206
  Archive before prune; the confirmation token is intentionally required.
207
+ This CLI is an operator-invoked migration cleanup surface only. Hooks, MCP, and
208
+ sessions never call it, and it cannot collect, recall, or reflect memory.
173
209
 
174
210
  ## 9. Project state layout
175
211
 
176
212
  ```text
177
213
  .ultra/
178
- ├── state.db # authoritative SQLite store
179
- ├── runtime/
214
+ ├── .runtime/
215
+ │ ├── state.db # authoritative SQLite lifecycle/index store
180
216
  │ └── checkpoint.json # advisory breadcrumb recovery projection
181
217
  ├── changes/
182
- │ ├── active/<id>/ # intent, delta, plan, context v3, learning, verification
218
+ │ ├── active/<id>/ # all Change semantics and evidence
219
+ │ │ ├── intent.md, findings.md, progress.md
220
+ │ │ ├── research/, delta/, documentation/, plan.json, plan.md
221
+ │ │ └── contexts/, test/, review/, delivery/
183
222
  │ └── archive/ # converged packets after baseline reconciliation
184
223
  ├── tasks/ # projections and task contexts
185
224
  ├── specs/ # research/product/architecture artifacts
186
- ├── sessions/ # bounded runtime artifacts
187
- ├── reviews/ # immutable review evidence by session id
188
- └── reports/
189
- ├── templates/ # blank report schemas; never evidence
190
- ├── tests/<workflow-id>.json
191
- └── delivery/<workflow-id>.json
225
+ └── reports/templates/ # blank report schemas; never evidence
192
226
  ```
193
227
 
194
228
  ## 10. Plugin and user-instruction isolation
@@ -10,10 +10,11 @@
10
10
  Ultra Builder Pro engineering loop (skills + commands + workflow hooks) as
11
11
  native Claude Code, OpenCode, Codex, and Kimi Code plugins, and
12
12
  **runs** that loop with isolated sessions sharing one authoritative state
13
- store (`.ultra/state.db`).
13
+ store (`.ultra/.runtime/state.db`).
14
14
 
15
- It is not an agent and it is not a memory provider. It is the workflow substrate
16
- the supported hosts share.
15
+ It is not an agent or a general conversational-memory provider. It is the workflow
16
+ substrate the supported hosts share, including project-local cross-session workflow
17
+ memory under `.ultra/`.
17
18
 
18
19
  ## 2. Three layers
19
20
 
@@ -38,20 +39,20 @@ the supported hosts share.
38
39
  └────────────┬───────┴──────────────────┘
39
40
  ▼
40
41
  ┌─────────────────────┐
41
- │ .ultra/state.db │
42
- │ (SQLite + WAL) │ ← single authoritative store
42
+ │ .ultra/.runtime/state.db │
43
+ │ (SQLite + WAL) │ ← lifecycle + index authority
43
44
  └──────────┬──────────┘
44
45
  │ projector (Phase 2.6)
45
46
  ▼
46
47
  .ultra/tasks/tasks.json (read-only view)
47
- .ultra/tasks/contexts/*.md (read-only header)
48
+ .ultra/tasks/contexts/*.md (fully generated read-only view)
48
49
  .ultra/activity-log.json (optional dump)
49
50
  ```
50
51
 
51
52
  | Layer | Role | Form |
52
53
  |--------------|----------------------------------------------|-------------------------------------------------------|
53
54
  | **skill** | knowledge carrier; tells the runtime *what to do* | `skills/<name>/SKILL.md` discovered natively by all supported runtimes |
54
- | **MCP** | authoritative workflow-state, decision, and Context Spine API | stdio MCP server exposing 50 live tools across task/session/baseline/change/decision/workflow/system/plan families in [`spec/mcp-tools.yaml`](../spec/mcp-tools.yaml) |
55
+ | **MCP** | authoritative workflow-state, decision, artifact, and Context Spine API | stdio MCP server exposing 57 live tools across task/session/baseline/change/decision/workflow/artifact/system/plan families in [`spec/mcp-tools.yaml`](../spec/mcp-tools.yaml) |
55
56
  | **CLI** | explicit initialization, recovery, diagnostics, and orchestration | `ultra-tools` / `ubp-orchestrator`; only commands listed by `--help` are executable (see [`spec/cli-protocol.md`](../spec/cli-protocol.md)) |
56
57
 
57
58
  Why three: skills give us behavior portability across runtimes; MCP gives
@@ -64,10 +65,19 @@ The skill layer is **read-only by design** (D29) and is discovered directly by
64
65
  each host. Ultra exposes no `skill.*` MCP family: skills are documentation, not
65
66
  RPC, and host-native loaders own resolution and invocation.
66
67
 
67
- ## 3. Authoritative state — `.ultra/state.db`
68
+ ## 3. Workflow memory and authoritative state
68
69
 
69
- All durable Ultra workflow state lives in one SQLite file with WAL enabled. Schema is
70
- fixed in [`spec/schemas/state-db.sql`](../spec/schemas/state-db.sql) and
70
+ Together, `.ultra/` retains project-local cross-session workflow memory:
71
+ normalized intent, progress, tasks, bounded context, specifications, evidence,
72
+ provenance, and recovery. `.ultra/.runtime/state.db` is the sole authority for lifecycle,
73
+ indexing, transitions, freshness, and coordination. Registered digest-bound files
74
+ carry semantic and evidence bodies. Generated projections and working scratch do
75
+ not become authority merely because they live under `.ultra/`. The complete
76
+ classification and promotion contract is
77
+ [`ARTIFACT-AUTHORITY.md`](./ARTIFACT-AUTHORITY.md).
78
+
79
+ All durable Ultra lifecycle and index state lives in one SQLite file with WAL enabled.
80
+ Schema is fixed in [`spec/schemas/state-db.sql`](../spec/schemas/state-db.sql) and
71
81
  covers twenty-one tables:
72
82
 
73
83
  | Table | Holds | Phase |
@@ -82,7 +92,8 @@ covers twenty-one tables:
82
92
  | `specs_refs` | spec change tracking → staleness propagation | 5 |
83
93
  | `circuit_breaker` | bounded retry and halt state for failed tasks | 5 |
84
94
  | `changes` | continuous feature/fix/incident lifecycle, alignment-thread link, and incident baseline bypass | 12→16 |
85
- | `artifacts` | intent/context/verification artifact registry | 8C |
95
+ | `artifacts` | typed semantic/evidence ownership, digest, status, and provenance | 8C→20 |
96
+ | `artifact_edges` | normalized source and consumer dependency graph | 20 |
86
97
  | `context_snapshots`| role/gate context, readiness, budget, execution seam, hashes, git head, provider refs | 10 |
87
98
  | `spec_learning_candidates` | approval-gated implementation discoveries for baseline convergence | 10 |
88
99
  | `trace_links` | task/spec/change traceability | 8C |
@@ -91,21 +102,22 @@ covers twenty-one tables:
91
102
  | `event_consumers` | durable monotonic consumer cursors | 8C |
92
103
  | `workflow_runs` | init/research/plan/change/dev/test/review/deliver run authority, position, blockers, approval, and derived summary | 13 |
93
104
  | `workflow_steps` | ordered step state, evidence, decisions, immutable output paths, and recorded SHA-256 digests | 13 |
94
- | `decision_threads` | baseline/change/workflow-bound owner-agent alignment, interaction mode, normalized summary, and checkpoint authority | 16 |
105
+ | `decision_threads` | baseline/change/workflow-bound owner-agent alignment, interaction mode, normalized completion, and optional checkpoint authority | 16/19 |
95
106
  | `decision_items` | one-at-a-time owner choices, evidence, recommendations, durable effects, resolutions, delegation, deferral, and supersession history | 16 |
96
107
 
97
108
  Two rules make this work:
98
109
 
99
110
  1. **No double source (D32).** lease/heartbeat live only in `sessions`,
100
111
  not in a `lease.json` file. Activity log lives only in `events`, not
101
- in JSON files. `tasks.json` and the status header in
102
- `contexts/task-*.md` are **projections** generated by the projector;
112
+ in JSON files. `tasks.json` and the complete
113
+ `contexts/task-*.md` files are **projections** generated by the projector;
103
114
  manual edits are overwritten on the next state.db change.
104
115
 
105
116
  2. **Single writer for mutable tables, multi-writer for `events`.**
106
- `.ultra/state.db` opens in WAL with `busy_timeout=5000`. The MCP
117
+ `.ultra/.runtime/state.db` opens in WAL with `busy_timeout=5000`. The MCP
107
118
  server holds the single writer connection for `baselines`, `tasks`, `sessions`,
108
- `changes`, `decision_threads`, `decision_items`, `workflow_runs`, `workflow_steps`, `artifacts`, `context_snapshots`,
119
+ `changes`, `decision_threads`, `decision_items`, `workflow_runs`, `workflow_steps`,
120
+ `artifacts`, `artifact_edges`, `context_snapshots`,
109
121
  `spec_learning_candidates`, `incidents`, `projection_jobs`, `telemetry`,
110
122
  `specs_refs`, and `migration_history`; the CLI calls
111
123
  those tools over stdio rather than opening its own writer. The
@@ -123,14 +135,18 @@ Two rules make this work:
123
135
  Subscribers always pull `events.id > since_id` rather than `max(ts)`,
124
136
  because two events may share the same millisecond timestamp (D31).
125
137
 
126
- ### Memory ownership is outside Ultra Builder Pro
138
+ ### General memory and graph ownership remain outside Ultra Builder Pro
127
139
 
128
140
  Ultra Builder Pro does not retain prompts, transcripts, tool observations,
129
- session summaries, or cross-session memory. It ships no `memory.*` MCP family,
130
- no recall skill, and no memory-capture hook. A separately installed provider
131
- such as cloud-mem/claude-mem owns persistent memory and its own lifecycle. The
132
- only related migration surface is the explicit `ultra-tools legacy-memory`
133
- archive/prune command for data created by older releases.
141
+ session summaries, general conversational memory, or code-graph payloads. It ships
142
+ no `memory.*` MCP family, general recall skill, or memory-capture hook. A separately
143
+ installed provider such as cloud-mem/claude-mem owns general persistent memory and
144
+ its own lifecycle. Ultra stores only bounded provider metadata references needed by
145
+ workflow context. The only related migration surface is the explicit
146
+ `ultra-tools legacy-memory` inspect/archive/confirmed-prune command for general memory
147
+ data created by older releases. It is never called by a hook, MCP operation, or
148
+ session lifecycle; it does not collect, recall, reflect, or remove Ultra workflow
149
+ authority.
134
150
 
135
151
  ### Project baseline adoption
136
152
 
@@ -141,9 +157,13 @@ same authoritative state shape without rewriting application code.
141
157
 
142
158
  Initialization completes after local authority, classification, Git/scaffold setup,
143
159
  and read-back verification. It does not start or complete research. An explicit
144
- `ultra-research` invocation then records the model-selected semantic coverage and
145
- executes, verifies, or reuses only the evidence needed to converge the baseline.
146
- Omitted catalog areas create no workflow row.
160
+ `ultra-research` invocation lets the model inspect evidence and recommend a semantic
161
+ route. The owner selects, modifies, delegates, or defers through the host-native
162
+ question surface unless current intent already resolves the route. The normalized
163
+ accepted coverage is then recorded, and research executes, verifies, or reuses only
164
+ the evidence needed to converge the baseline. Omitted catalog areas create no
165
+ workflow row. MCP validates the stored state and evidence, not the preceding user
166
+ interaction.
147
167
 
148
168
  Auto initialization preserves an existing Git repository and HEAD. When Git is absent,
149
169
  it initializes `main`, adds the symlink-safe `.ultra` rule to `.gitignore`, and persists
@@ -193,12 +213,16 @@ alternatives, evidence refs, and durable effects; a partial unique index guarant
193
213
  current question per thread. The host ends that turn and waits.
194
214
 
195
215
  The next response becomes a normalized owner decision, explicit reversible delegation,
196
- or consequence-bearing deferral. Prompts and transcripts are never persisted. A coherent
197
- cluster moves through prepare/confirm checkpointing, which binds an owner-approved
198
- decision digest to the current specification, Change Contract, alignment, or plan artifact.
199
- Matching workflow steps and completion fail closed until the checkpoint is confirmed.
200
- Supersession preserves prior history and reopens alignment instead of silently editing an
201
- old decision. The shared procedure lives in
216
+ or consequence-bearing deferral. Prompts and transcripts are never persisted. The host
217
+ applies accepted intent through the owning MCP operation or digest-bound artifact,
218
+ reads it back, and records typed `applied_refs` when another authority changed. Routine
219
+ settled state then closes through `decision.complete`, which is lifecycle completion
220
+ rather than another approval. The breadcrumb recalls normalized accepted intent after
221
+ the thread closes. Only a coherent cluster that needs an artifact-bound recovery
222
+ boundary moves through prepare/confirm checkpointing. Matching workflow steps fail
223
+ closed while a blocking question, blocking deferral, prepared checkpoint, or stale
224
+ checkpoint artifact remains. Supersession preserves prior history and reopens alignment
225
+ instead of silently editing an old decision. The shared procedure lives in
202
226
  `skills/ultra-think/references/decision-dialogue.md`; status, breadcrumb, and doctor expose
203
227
  only the current recovery surface.
204
228
 
@@ -210,10 +234,11 @@ is represented by a `changes` row and an inspectable packet:
210
234
  ```text
211
235
  active -> blocked -> active -> ready -> archived
212
236
  | |
213
- ├─ intent + delta + plan └─ verification + baseline reconciliation
214
- ├─ linked tasks
215
- ├─ immutable context snapshots (role + gate + readiness + execution seam)
216
- └─ spec-learning candidates (proposed -> approved/rejected -> applied)
237
+ ├─ intent + adaptive research + findings
238
+ ├─ typed delta + documentation reconciliation + deterministic progress
239
+ ├─ plan + linked tasks + immutable contexts
240
+ ├─ Change-scoped test/review/delivery evidence
241
+ └─ atomic baseline apply + self-contained archive
217
242
  ```
218
243
 
219
244
  `quick`, `standard`, `major`, and `incident` kinds require different evidence,
@@ -221,6 +246,18 @@ but all require completed linked tasks, current context, declared documentation
221
246
  impact, and no open incident. Memory and graph payloads never enter Ultra;
222
247
  `context_snapshots.provider_refs_json` stores metadata references only.
223
248
 
249
+ Baseline files are immutable while a Change is active. `change.delta` registers
250
+ overlay payloads against exact baseline revision and specification digests.
251
+ `change.documentation_reconcile` records exact document before/after evidence and
252
+ consumer trace. Standard and major convergence requires both current authorities.
253
+ `change.archive` preflights the whole write set and uses a recoverable transaction;
254
+ only after all writes and baseline reconciliation succeed does it rebind the complete
255
+ Change root into the archive.
256
+
257
+ Workflow revisions preserve prior accepted runs. A candidate becomes current only
258
+ through `workflow.supersede`; the artifact graph then invalidates the prior run's true
259
+ transitive consumers without staling unrelated tasks.
260
+
224
261
  ### Context Spine
225
262
 
226
263
  Context Manifest v3 is the immutable handoff contract between planning,
@@ -291,7 +328,7 @@ swallowed warning. `system.doctor` is read-only by default. Explicit repair perf
291
328
  backup-first schema upgrade, archive-journal recovery, session and projection
292
329
  recovery, and regenerated projections. It cannot approve a baseline or replace a
293
330
  corrupt SQLite file silently. `system restore` accepts only a verified SQLite backup
294
- inside `.ultra/backups`, quarantines the corrupt authority, and rolls back on failure.
331
+ inside `.ultra/.runtime/backups`, quarantines the corrupt authority, and rolls back on failure.
295
332
  When no valid backup exists, confirmed `system rebaseline` preserves both corrupt
296
333
  authority and the legacy task projection before creating a new brownfield adoption.
297
334
 
@@ -304,7 +341,7 @@ A **session** is the standard unit of execution across all four runtimes
304
341
  - an isolated `git worktree` created by `session.spawn`,
305
342
  - an ignored `.ultra` link from that checkout to the one central authority,
306
343
  - a lease + heartbeat row in `sessions` (D32),
307
- - an `artifact_dir` under `.ultra/sessions/<sid>/` for logs and scratch;
344
+ - an `artifact_dir` under `.ultra/.runtime/sessions/<sid>/` for logs and scratch;
308
345
  - either the active host operating in that exact worktree or an explicitly configured
309
346
  worker process.
310
347
 
@@ -366,7 +403,7 @@ rejects corrupt, non-object, schema-mismatched, or terminal candidates, and
366
403
  selects the newest valid state. A newer live state wins; a newer checkpoint can
367
404
  atomically restore a missing or older live state before context is re-injected.
368
405
  The checkpoint is therefore a recovery artifact and consumer, never a second
369
- durable authority alongside `.ultra/state.db`.
406
+ durable authority alongside `.ultra/.runtime/state.db`.
370
407
 
371
408
  ## 7. Installation provenance — read-only cross-host diagnosis
372
409