ultra-builder-pro-cli 0.21.1 → 0.23.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 (58) hide show
  1. package/.ultra-template/tasks/tasks.json +10 -3
  2. package/.ultra-template/templates/task-context.md +19 -0
  3. package/CHANGELOG.md +78 -0
  4. package/README.md +210 -36
  5. package/adapters/_shared/codex-assets.cjs +8 -3
  6. package/adapters/_shared/interaction-contract.cjs +13 -6
  7. package/adapters/_shared/runtime-assets.cjs +1 -1
  8. package/adapters/claude.js +1 -1
  9. package/adapters/kimi.js +1 -1
  10. package/adapters/opencode.js +24 -13
  11. package/docs/AGENT-CONTEXT.md +58 -51
  12. package/docs/ARCHITECTURE.md +82 -51
  13. package/docs/ARTIFACT-AUTHORITY.md +83 -44
  14. package/docs/COMMIT-HASH-BACKFILL.md +33 -90
  15. package/docs/DECISIONS.md +9 -7
  16. package/docs/LEGACY-CLI-CROSSWALK.md +10 -2
  17. package/docs/PLUGIN-ISOLATION-CONTRACT.md +3 -2
  18. package/docs/ROADMAP.md +3 -3
  19. package/docs/RUNTIME-COMPAT-MATRIX.md +13 -10
  20. package/docs/STATE-DB-ACCESS-POLICY.md +47 -19
  21. package/docs/WORKFLOW-LIFECYCLE.md +79 -49
  22. package/hooks/README.md +5 -4
  23. package/hooks/active_task_context.py +41 -39
  24. package/mcp-server/lib/artifact-registry.cjs +32 -7
  25. package/mcp-server/lib/baseline-workflow.cjs +60 -24
  26. package/mcp-server/lib/change-workflow.cjs +42 -6
  27. package/mcp-server/lib/context-paths.cjs +34 -3
  28. package/mcp-server/lib/doctor.cjs +28 -0
  29. package/mcp-server/lib/git-bootstrap.cjs +0 -1
  30. package/mcp-server/lib/init-project.cjs +52 -2
  31. package/mcp-server/lib/projector.cjs +43 -8
  32. package/mcp-server/lib/state-authority.cjs +19 -3
  33. package/mcp-server/lib/state-ops.cjs +6 -1
  34. package/mcp-server/lib/task-ledger.cjs +1342 -0
  35. package/mcp-server/lib/ultra-facade.cjs +646 -0
  36. package/mcp-server/lib/workflow-state.cjs +166 -2
  37. package/mcp-server/server.cjs +214 -26
  38. package/package.json +1 -1
  39. package/skills/ultra-change/SKILL.md +38 -90
  40. package/skills/ultra-deliver/SKILL.md +42 -62
  41. package/skills/ultra-dev/SKILL.md +34 -73
  42. package/skills/ultra-doctor/SKILL.md +26 -39
  43. package/skills/ultra-init/SKILL.md +37 -69
  44. package/skills/ultra-plan/SKILL.md +52 -125
  45. package/skills/ultra-research/SKILL.md +41 -101
  46. package/skills/ultra-review/SKILL.md +25 -44
  47. package/skills/ultra-status/SKILL.md +21 -40
  48. package/skills/ultra-test/SKILL.md +25 -60
  49. package/skills/ultra-think/SKILL.md +29 -48
  50. package/skills/ultra-think/references/decision-dialogue.md +6 -4
  51. package/spec/cli-protocol.md +15 -0
  52. package/spec/mcp-tools.yaml +286 -0
  53. package/spec/schemas/context-file.v4.5.schema.json +1 -1
  54. package/spec/schemas/mcp-tools.schema.json +1 -1
  55. package/spec/schemas/state-db.sql +1 -1
  56. package/spec/schemas/task-ledger.v1.schema.json +217 -0
  57. package/ultra-tools/commands/migrate.cjs +5 -2
  58. package/.ultra-template/tasks/contexts/TEMPLATE.md +0 -19
@@ -15,23 +15,28 @@ payloads.
15
15
  Semantic and evidence artifacts under `.ultra/` are trackable so reviewed intent and
16
16
  verification can travel with the repository. `.ultra/.runtime/` is always ignored:
17
17
  the SQLite authority, leases, worktrees, local telemetry, and recovery snapshots remain
18
- checkout-local unless a team uses an explicit synchronization or artifact handoff.
18
+ checkout-local. `.ultra/tasks/tasks.json` is the narrow MCP-owned Git handoff for
19
+ portable baseline, Change, and durable task records; it is not a copy of live runtime
20
+ state.
19
21
 
20
22
  ## Artifact classes
21
23
 
22
24
  | Class | Examples | Authority |
23
25
  |---|---|---|
24
- | Lifecycle and index | `.ultra/.runtime/state.db` | Sole authority for identifiers, normalized accepted intent, status, legal transitions, references, digests, freshness, provenance, locks, leases, transactions, recovery, and coordination |
26
+ | Checkout-local lifecycle and index | `.ultra/.runtime/state.db` | Operational authority for identifiers, normalized accepted intent, status, legal transitions, references, digests, freshness, provenance, locks, leases, transactions, recovery, and coordination in one checkout |
27
+ | Git team checkpoint | `.ultra/tasks/tasks.json` | MCP-published, digest-chained handoff of portable baseline, Change, task-contract, dependency, and durable status records; never live session or lease authority |
25
28
  | Digest-bound semantic artifacts | specifications, research reports, Change intent/delta/plan, context manifests | Authoritative semantic bodies only while registered by the owning DB row or workflow step and matching its recorded digest |
26
29
  | Digest-bound evidence artifacts | test, review, delivery, and verification reports | Authoritative evidence bodies only while registered, immutable where required, and matching the recorded digest and scope |
27
- | Generated projections | `tasks/tasks.json`, generated task-status headers, activity exports | Read-only views derived from DB authority; manual edits are overwritten and never become authority |
30
+ | Generated projections | `.ultra/.runtime/projections/tasks.json`, generated task contexts, activity exports | Checkout-local read-only views derived from DB authority; manual edits are overwritten and never become authority |
28
31
  | Advisory recovery | `.ultra/.runtime/checkpoint.json` | Compact recovery hint derived from DB authority; stale or missing content never overrides the DB |
29
32
  | Working scratch | `.ultra/.runtime/collab/`, temporary session output, incomplete drafts | Non-authoritative working material until verified and promoted through a supported workflow write |
30
33
  | External provider references | memory or code-graph provider name, scope, version, stable reference, freshness metadata | Metadata-only context stored by Ultra; the provider remains authority for its payload |
31
34
 
32
- The DB is not expected to contain every semantic paragraph. It owns the lifecycle and
33
- the binding between a fact and its current content. A digest-bound file owns the
34
- registered semantic or evidence body. Neither surface is a parallel lifecycle source.
35
+ The DB is not expected to contain every semantic paragraph. It owns checkout-local
36
+ lifecycle and the binding between a fact and its current content. A digest-bound file
37
+ owns the registered semantic or evidence body. The team checkpoint moves a reviewed
38
+ portable subset through Git and is merged into the receiving DB through MCP. None of
39
+ these surfaces independently owns all three roles.
35
40
 
36
41
  ## Human, model, and mechanical responsibilities
37
42
 
@@ -39,9 +44,9 @@ registered semantic or evidence body. Neither surface is a parallel lifecycle so
39
44
  |---|---|---|
40
45
  | Owner | Goals, acceptance, non-goals, material choices, risk acceptance, and authorization for irreversible or external effects | Supply facts the checkout or runtime can establish directly |
41
46
  | Host model | Inspect evidence, recommend a route, ask only for unresolved owner choices, normalize the answer, call the owning write, update semantic artifacts, read back the result, and present the next recommendation | Fabricate evidence, infer owner authorization, or bypass legal transitions |
42
- | Ultra MCP | Persist normalized inputs, validate structure and current digests, record lifecycle and provenance, enforce legal transitions, project views, and expose recovery | Choose product direction, prove a UI click, force a semantic route, or replace model judgment |
47
+ | Ultra MCP | Persist normalized inputs, validate structure and current digests, record lifecycle and provenance, enforce legal transitions, project local views, publish/import the Git checkpoint, and expose recovery | Choose product direction, prove a UI click, force a semantic route, or replace model judgment |
43
48
  | Host adapter | Render the shared interaction contract through the host-native question and tool surfaces | Become a second workflow authority |
44
- | Hook | Observe lifecycle, inject compact DB-derived recovery context, and protect generated projections | Select a semantic route or block ordinary development |
49
+ | Hook | Observe lifecycle, inject compact DB-derived recovery context, and protect MCP-owned checkpoint and generated projection paths | Select a semantic route or block ordinary development |
45
50
 
46
51
  ## Intent persistence
47
52
 
@@ -54,14 +59,12 @@ inspect -> suggest -> host-native ask -> normalize -> persist -> apply -> read b
54
59
  The host-native ask is conditional. An explicit owner instruction can already resolve
55
60
  a choice, so the model must not ask
56
61
  again merely to manufacture proof. When interaction is needed, the adapter uses the
57
- host-native question surface. Once the model writes the normalized result through
58
- `decision.resolve`, `decision.delegate`, or `decision.defer`, the DB treats that result
59
- as current cross-session intent authority. It does not store or verify a UI receipt,
60
- raw prompt, or transcript.
62
+ host-native question surface. Once the model batches the normalized result through
63
+ `ultra.record`, the DB treats that result as current cross-session intent authority. It
64
+ does not store or verify a UI receipt, raw prompt, or transcript.
61
65
 
62
66
  If the accepted decision changes another Ultra authority, the model applies that change
63
- through its owning MCP tool or digest-bound artifact, reads the result back, and passes
64
- typed `applied_refs` to `decision.complete`. A decision whose normalized record is
67
+ through `ultra.record` or a digest-bound artifact and reads the result back. A decision whose normalized record is
65
68
  itself the complete authority may have no applied reference. Breadcrumb and decision
66
69
  read paths recall accepted intent only after the dialogue thread is completed or
67
70
  confirmed. A row-backed applied reference names an exact field and canonical value,
@@ -72,7 +75,7 @@ the exact file digest. Row existence alone never proves that intent was applied.
72
75
 
73
76
  Working material becomes durable only when all applicable conditions hold:
74
77
 
75
- 1. the active workflow permits the write;
78
+ 1. the current Change and owner authority permit the write;
76
79
  2. consequential claims are verified against the checkout, runtime, test result, or
77
80
  primary source;
78
81
  3. the model writes through the owning MCP operation or immutable artifact path;
@@ -117,9 +120,9 @@ as delivered.
117
120
 
118
121
  ## Context and plan authority
119
122
 
120
- `change.context` is a pure compiler. It reads accepted Change, task, baseline, checkout,
121
- and provider-reference authority and writes one immutable manifest plus its DB snapshot
122
- row. It never updates provider references or semantic Change fields. Each snapshot is
123
+ The Context compiler used by `ultra.checkpoint` reads accepted Change, task, baseline,
124
+ checkout, and provider-reference authority and writes one immutable manifest plus its
125
+ DB snapshot row. It never updates provider references or semantic Change fields. Each snapshot is
123
126
  identified exactly by `change_id`, nullable `task_id`, `role`, and `gate`; consumers
124
127
  must not substitute a newer snapshot from a different tuple.
125
128
 
@@ -136,8 +139,8 @@ A current plan is a Change-owned pair:
136
139
  - `<artifact_root>/plan.md` is the deterministic human projection of the same plan and
137
140
  task contracts.
138
141
 
139
- `plan.export` selects both paths from the owning Change and accepts no arbitrary output
140
- path. `verify-plan` binds the JSON digest and the preceding `plan/planning` snapshot;
142
+ The Plan checkpoint selects both paths from the owning Change and accepts no arbitrary
143
+ output path. It binds the JSON digest and the preceding `plan/planning` snapshot;
141
144
  the artifact registry records both plan files with that context provenance. Publication
142
145
  preflights both path authorities and prior digests, rejects symlinked ancestors or
143
146
  targets, and journals the two file replacements so a registry or event failure restores
@@ -147,7 +150,7 @@ never current write or dispatch authority.
147
150
 
148
151
  ## Registry contract
149
152
 
150
- `artifact.record` is the public writer for a semantic or evidence file that is not
153
+ `ultra.record` is the public writer for a semantic or evidence file that is not
151
154
  already registered by its owning workflow operation. Every managed registry row has:
152
155
 
153
156
  - a typed `owner_type` and `owner_id`;
@@ -169,8 +172,8 @@ rejected without changing prior authority. A caller can provide
169
172
  `artifact.get` reads by unique ID or unambiguous path. It fails closed when a path
170
173
  has multiple active authorities and reports whether the row satisfies the managed
171
174
  registry contract. A canonical path can have only one non-archived authority across
172
- all owners and kinds. Runtime, scratch, `tasks.json`, and generated task contexts
173
- cannot be promoted through this API.
175
+ all owners and kinds. Runtime, scratch, the MCP-owned team checkpoint, and generated
176
+ task contexts cannot be promoted through this API.
174
177
 
175
178
  Owning internal writers use the same transaction contract. Change intent, delta and
176
179
  documentation packets, contexts, adaptive research, findings, incident diagnosis,
@@ -185,7 +188,7 @@ pretending that an old row satisfies the current registry contract.
185
188
 
186
189
  ## Dependency and orphan diagnosis
187
190
 
188
- `system.doctor` compares the registry, dependency graph, filesystem, and owner
191
+ `ultra.doctor` compares the registry, dependency graph, filesystem, and owner
189
192
  tables. It reports:
190
193
 
191
194
  - unregistered semantic or evidence files;
@@ -196,11 +199,13 @@ tables. It reports:
196
199
  - graph cycles that cannot become consumer evidence;
197
200
  - more than one active authority for the same canonical path;
198
201
  - legacy compatibility rows that remain unmanaged;
199
- - generated task contexts whose task no longer exists.
202
+ - legacy generated task contexts left outside the runtime projection root.
200
203
 
201
204
  `.ultra/.runtime/**`, `.ultra/scratch/**`, and fixed scaffold support files are outside
202
- orphan diagnosis. Current generated projections are recognized from the DB task set,
203
- not from a blanket directory exemption. Before a baseline is ready, only the reserved
205
+ orphan diagnosis. Current generated projections are local runtime files and are not
206
+ semantic artifacts. A retired `.ultra/tasks/contexts/**` entry is diagnosed and any
207
+ generated marker is reported as a ghost projection. Before a baseline is ready, only
208
+ the reserved
204
209
  `discovery.md`, `product.md`, `architecture.md`, and `research-distillate.md` scaffold
205
210
  paths under `.ultra/specs/` are provisional; every additional specification is subject
206
211
  to orphan diagnosis immediately. Completion cannot be manufactured by registering
@@ -208,25 +213,59 @@ empty templates. Doctor and status expose registered, managed, and unmanaged cou
208
213
  and compatibility remains unhealthy until every retained row is deliberately promoted
209
214
  or retired.
210
215
 
216
+ ## Team checkpoint
217
+
218
+ `.ultra/tasks/tasks.json` has kind `ultra-team-task-ledger` and a versioned schema. It
219
+ contains:
220
+
221
+ - one portable baseline record, when present;
222
+ - every Change summary, including a Change that has not yet produced tasks;
223
+ - durable task contracts, dependencies, acceptance mappings, and statuses;
224
+ - per-record revisions, parent digests, the checkpoint state digest, and bounded
225
+ checkpoint ancestry.
226
+
227
+ It excludes `in_progress` ownership, session ids, leases, worktrees, telemetry,
228
+ projection jobs, recovery scratch, and `completion_commit`. Those fields are meaningful
229
+ only in the checkout that owns the active process or Git object.
230
+
231
+ MCP publishes a new generation at semantic handoff points: baseline convergence,
232
+ Change creation or update, plan acceptance, durable task-contract or status change,
233
+ task expansion or deletion, and Change convergence or archive. A direct edit is
234
+ rejected by host hooks and fails digest validation even without hooks.
235
+
236
+ `ultra.sync { action: import }` validates schema, full and per-record digests, bounded ancestry,
237
+ Change ownership, task parents, and local active sessions. A clean record fast-forwards.
238
+ A record changed on both sides, a non-descendant checkpoint, or a remote update to a
239
+ locally active task stops with a typed conflict. Re-importing the same checkpoint
240
+ performs no DB write. A ready imported baseline becomes `draft` or `adopting` with a
241
+ blocking checkout-local revalidation gap; Git cannot prove the receiving checkout's
242
+ HEAD, scope bytes, verification, or accepted dirty state. Publication remains blocked
243
+ until that local baseline converges, preventing one unvalidated checkout from
244
+ downgrading team authority.
245
+
246
+ Legacy v4.4/v4.5 projections are replaced only through
247
+ `ultra.sync { action: publish }`. The
248
+ publisher first compares every available durable field with SQLite, writes the exact
249
+ legacy bytes to `.ultra/.runtime/backups/task-ledger/`, and refuses any mismatch.
250
+ Doctor diagnoses this state but never performs the semantic replacement.
251
+
211
252
  ## Task-context projection
212
253
 
213
- `.ultra/tasks/contexts/<task-id>.md` is fully generated from current DB authority.
214
- The projector replaces the whole file, including its execution contract and stale
215
- banner, and marks it with `generated_by: ultra-projector`. It never preserves arbitrary
216
- prose inserted into an earlier projection.
217
-
218
- Before replacing an existing authored context, the projector promotes the exact legacy
219
- body bytes once into a digest-bound `legacy_context_findings` artifact owned and
220
- consumed by the task. Legacy frontmatter, stale banners, and generated contract marker
221
- regions are removed first; any remaining authored body is retained exactly, even when
222
- an older projector had preserved it after a generated contract. Replacement is skipped
223
- without promotion only when no authored content remains. If promotion cannot be
224
- registered, projection fails without deleting the authored body. A context target must
225
- remain lexically and physically below
226
- `.ultra/tasks/contexts/`; traversal and symlink ancestors are rejected by projection and
227
- migration. When a task disappears, only an orphan carrying the generated marker may be
228
- pruned, and the removal emits `projection_pruned`; unknown authored files are retained
229
- for diagnosis.
254
+ `.ultra/.runtime/projections/contexts/<task-id>.md` is fully generated from current DB
255
+ authority. The projector replaces the whole file, including its execution contract and
256
+ stale banner, and marks it with `generated_by: ultra-projector`. It never preserves
257
+ arbitrary prose inserted into an earlier projection.
258
+
259
+ Before retiring an existing `.ultra/tasks/contexts/<task-id>.md`, the projector
260
+ promotes its exact authored body bytes once into a digest-bound
261
+ `legacy_context_findings` artifact owned and consumed by the task. Legacy frontmatter,
262
+ stale banners, and generated contract marker regions are removed first; any remaining
263
+ authored body is retained exactly, even when an older projector had preserved it after
264
+ a generated contract. Migration fails without deleting the authored body if promotion
265
+ cannot be registered. Both legacy reads and runtime projection writes reject traversal,
266
+ symlink ancestors, and path escape. When a task disappears, only a runtime projection
267
+ carrying the generated marker may be pruned, and the removal emits
268
+ `projection_pruned`.
230
269
 
231
270
  Model findings, decisions, or evidence discovered during development must be written
232
271
  below the owning Change root and registered through the workflow or `artifact.record`.
@@ -1,101 +1,44 @@
1
- # Commit-hash backfill — two-commit completion flow
1
+ # Commit-hash backfill
2
2
 
3
- > Phase 2.8 contract. Replaces the v4.4 `git commit --amend` step with an
4
- > append-only flow that survives the SQLite authority model.
5
- > Hook wiring lives in Phase 3 (`skills/ultra-dev/SKILL.md` Step 6).
3
+ `tasks.completion_commit` is checkout-local integration evidence. It lives in
4
+ `.ultra/.runtime/state.db` and may appear in checkout-local projections, but it is
5
+ deliberately absent from the Git-facing team ledger.
6
6
 
7
- ## Why we changed
7
+ This removes the old self-referential two-commit loop. Recording a commit hash no
8
+ longer changes any tracked file.
8
9
 
9
- In v4.4 the per-task `context md` carried a `completion_commit` field
10
- in its frontmatter. The legacy flow was:
10
+ ## Direct task completion
11
11
 
12
- 1. `git commit -m "feat: …"` to land the implementation
13
- 2. read the freshly-created commit hash
14
- 3. edit `contexts/task-N.md` to write the hash into the header
15
- 4. `git commit --amend --no-edit` to fold the edit into the same commit
12
+ After implementation, verification, and review are current:
16
13
 
17
- That last step makes the commit non-atomic (the second write produces
18
- a new SHA, invalidating the value we just stamped). It also fights the
19
- v4.5 authority rule (D32) — the projector is the only writer to
20
- `contexts/task-N.md`, so any handwritten edit gets stomped.
14
+ 1. Update the task to `completed`. The MCP publishes its durable status and contract to
15
+ `.ultra/tasks/tasks.json`.
16
+ 2. Create one local task commit containing the implementation, semantic Ultra
17
+ artifacts, and the team ledger checkpoint.
18
+ 3. Read the resulting `HEAD` and update only `completion_commit` through `task.update`.
19
+ 4. Verify the task worktree `HEAD`, integration ancestry, review evidence, and public
20
+ seam; then close the session and complete the dev workflow.
21
21
 
22
- ## The new flow
22
+ The third step changes only ignored runtime state. Repeating it with the same hash is
23
+ byte-idempotent and leaves Git clean.
23
24
 
24
- ```
25
- ┌──────────────────────────────────┐
26
- │ 1. feat commit │ context md still has empty
27
- │ git add … && git commit │ completion_commit (projector
28
- │ -m "feat: task-N — title" │ emitted it from a NULL row)
29
- └──────────────────┬───────────────┘
30
- ▼
31
- ┌──────────────────────────────────┐
32
- │ 2. read the new SHA │ hash = `git rev-parse HEAD`
33
- └──────────────────┬───────────────┘
34
- ▼
35
- ┌──────────────────────────────────┐
36
- │ 3. update state.db │ ops.patchTask(db, id,
37
- │ │ { completion_commit: hash })
38
- └──────────────────┬───────────────┘
39
- ▼
40
- ┌──────────────────────────────────┐
41
- │ 4. projector regenerates the │ projector.projectContext(db, id)
42
- │ context md header with the │ writes a new contexts/task-N.md
43
- │ completion_commit value │ whose YAML now contains the hash
44
- └──────────────────┬───────────────┘
45
- ▼
46
- ┌──────────────────────────────────┐
47
- │ 5. chore commit │ git add contexts/task-N.md
48
- │ │ git commit -m
49
- │ │ "chore: record task-N hash"
50
- └──────────────────────────────────┘
51
- ```
25
+ If the commit fails after step 1, transition the still-session-owned task from
26
+ `completed` to `blocked`, preserve the worktree, and record the failure. This recovery
27
+ transition is accepted only while `completion_commit` is absent. A task with a recorded
28
+ completion commit remains terminal.
52
29
 
53
- The result in `git log --oneline`:
30
+ ## Parent-supervised workers
54
31
 
55
- ```
56
- 2222222 chore: record task-N completion hash
57
- 1111111 feat: task-N — <title>
58
- ```
32
+ A worker records evidence and exits without finalizing the parent-owned task. The
33
+ primary host verifies and integrates the worker commit, publishes the task completion
34
+ checkpoint, records the integrated commit hash locally, and settles the lease.
59
35
 
60
- Both commits are immutable. The chore commit is small (only the
61
- projection file changed) and is trivial to revert if the wrong task is
62
- recorded.
36
+ ## Why the hash is local
63
37
 
64
- ## Why two commits, not amend
65
-
66
- - **Atomic history.** Each SHA is final the moment it is written.
67
- - **Idempotent.** Re-running the chore commit on the same hash is a
68
- no-op (projector emits the same bytes).
69
- - **Survives the projector contract.** The projection is the only
70
- writer to `contexts/task-N.md`; this flow keeps that promise.
71
- - **Audit trail.** Reviewers can see the implementation diff (commit 1)
72
- separately from the bookkeeping diff (commit 2).
73
-
74
- ## Hook integration (Phase 3)
75
-
76
- The post-commit hook installed by `skills/ultra-dev/` will invoke this
77
- flow as soon as a feat commit lands on a task branch:
78
-
79
- ```
80
- post-commit workflow → if commit message starts with "feat:" and the
81
- working tree contains contexts/task-N.md →
82
- MCP task.update {id: task-N,
83
- patch: {completion_commit: $(git rev-parse HEAD)}} &&
84
- git add contexts/task-N.md &&
85
- git commit -m "chore: record task-N completion hash"
86
- ```
87
-
88
- Until that hook lands, contributors run the two commits manually. The
89
- contract above is what the hook will codify.
90
-
91
- ## Verification
92
-
93
- `mcp-server/tests/commit-hash-flow.test.cjs` builds a throwaway git
94
- repo, walks the five steps in-process, and asserts:
95
-
96
- - `git log --oneline -2` shows `chore: record task-N completion hash`
97
- on top of `feat: task-N — …`.
98
- - The post-projection `contexts/task-N.md` frontmatter contains the
99
- exact SHA produced by the feat commit.
100
- - Re-running step 4 + step 5 against the same SHA is a no-op (the
101
- chore commit is empty and skipped).
38
+ - A Git file cannot contain the hash of the commit that contains that same file.
39
+ - Runtime integration evidence is checkout-specific and does not belong in a shared
40
+ semantic merge surface.
41
+ - The team ledger needs the durable task outcome and status, not a self-referential
42
+ commit identifier.
43
+ - Baseline freshness uses scoped content plus Git ancestry, so a metadata-only Ultra
44
+ checkpoint commit does not invalidate an otherwise unchanged baseline.
package/docs/DECISIONS.md CHANGED
@@ -11,16 +11,18 @@ release-version authority.
11
11
  |---|---|---|
12
12
  | User intent | Goals, acceptance, non-goals, semantic route selection, material product trade-offs, risk acceptance, and authorization for irreversible or external effects | Facts that the current checkout or runtime can establish directly |
13
13
  | Host model | Classification and route recommendations, investigation, solution design, task decomposition, context, test and review strategy, documentation impact, intent normalization, and next-action recommendations | Fabricated evidence, bypassed authorization, or durable lifecycle state |
14
- | Ultra MCP | IDs, state, digests, provenance, freshness, locks, leases, transactions, recovery, and legal state transitions | Product direction, a fixed research route, technology selection, or business decisions |
14
+ | Ultra MCP | IDs, checkout-local state, digests, provenance, freshness, locks, leases, transactions, recovery, legal state transitions, and Git checkpoint publish/import | Product direction, a fixed research route, technology selection, or business decisions |
15
15
  | Host adapter | Native Skill discovery, user-question surfaces, tool invocation, installation, and runtime wiring | A second project-state authority |
16
- | Hook | Lifecycle observation, compact DB-derived context, recovery hints, and generated-projection protection | Ordinary development blocking or semantic route selection |
16
+ | Hook | Lifecycle observation, compact DB-derived context, recovery hints, and protection of MCP-owned checkpoint/projection paths | Ordinary development blocking or semantic route selection |
17
17
 
18
18
  `.ultra/` is project-local cross-session workflow memory. `.ultra/.runtime/state.db` is
19
- the only lifecycle, index, transition, freshness, and coordination authority.
20
- Registered digest-bound files carry semantic or evidence bodies; generated
21
- projections and working scratch are not authority. Prompt text, chat history,
22
- general external-memory payloads, and code-graph payloads are not Ultra
23
- authority. See [`ARTIFACT-AUTHORITY.md`](./ARTIFACT-AUTHORITY.md).
19
+ checkout-local lifecycle, index, transition, freshness, and coordination authority.
20
+ Registered digest-bound files carry semantic or evidence bodies.
21
+ `.ultra/tasks/tasks.json` is the MCP-published Git handoff for portable baseline,
22
+ Change, and durable task records, never live session state. Generated projections and
23
+ working scratch are not authority. Prompt text, chat history, general external-memory
24
+ payloads, and code-graph payloads are not Ultra authority. See
25
+ [`ARTIFACT-AUTHORITY.md`](./ARTIFACT-AUTHORITY.md).
24
26
 
25
27
  ## Research coverage
26
28
 
@@ -53,6 +53,9 @@ The following are deliberate extensions built on the original spine:
53
53
  9. Native adapters for Claude Code, OpenCode, Codex, and Kimi Code.
54
54
  10. Explicit worktree admission, leases, heartbeats, crash evidence, circuit breaking,
55
55
  dependency waves, and optional verified cleanup.
56
+ 11. A digest-chained Git team checkpoint that keeps the original shareable task-ledger
57
+ benefit without committing SQLite, leases, sessions, or live `in_progress`
58
+ ownership.
56
59
 
57
60
  ## Intentionally retired original baggage
58
61
 
@@ -85,6 +88,7 @@ route only for a unique mechanical recovery invariant.
85
88
  task.init_project
86
89
  -> greenfield classification
87
90
  -> Git bootstrap when absent
91
+ -> empty or imported team checkpoint
88
92
  -> init read-back and completion
89
93
  -> explicit full research with a model-recommended, owner-selected route
90
94
  -> selected execute/verify/reuse work and synthesis
@@ -101,6 +105,7 @@ task.init_project
101
105
  task.init_project
102
106
  -> brownfield classification and selected scope
103
107
  -> preserve current Git HEAD and dirty-state evidence
108
+ -> import portable team state and require local baseline revalidation when cloned
104
109
  -> init read-back and completion
105
110
  -> explicit adoption research with a model-recommended, owner-selected route
106
111
  -> characterization verification + known-red/gap ledger
@@ -123,13 +128,13 @@ doctor/migrate with backup
123
128
 
124
129
  ```text
125
130
  status
126
- -> change intent capture
131
+ -> checkpoint condition + change intent capture
127
132
  -> material alignment only when unresolved
128
133
  -> model-recommended, owner-selected or delegated bounded research, plan,
129
134
  current dev work, think, or status
130
135
  -> session.spawn creates the real task worktree
131
136
  -> red/green/verify/review
132
- -> local task commit and verified integration
137
+ -> durable task checkpoint + one local task commit + local hash backfill
133
138
  -> safe session close
134
139
  -> aggregate test -> review -> deliver
135
140
  -> atomic baseline reconciliation
@@ -156,6 +161,9 @@ status
156
161
  | Failure returned a task to pending without recovery evidence | Exit and spawn failures become `blocked` and record session-linked circuit-breaker evidence. |
157
162
  | A late resume failure could leave refreshed DB metadata behind | Resume snapshots DB authority and generated projections, then restores both together with Git rollback. |
158
163
  | A legacy schema migrated before a later resume failure | Resume restores the pre-migration backup, not the partially completed upgraded intermediate state. |
164
+ | Tracked `tasks.json` made every Ultra write dirty and every metadata commit stale the baseline | Live projections moved below ignored `.ultra/.runtime/projections/`; the tracked file became a low-frequency MCP checkpoint, and baseline freshness excludes `.ultra` while still checking scoped source bytes plus Git ancestry. |
165
+ | A local SQLite DB could not hand baseline, Change, and task authority to another checkout | The Git checkpoint carries portable records with per-record digests and ancestry; import fast-forwards clean records, rejects concurrency, and revalidates every ready baseline locally. |
166
+ | A completed task needed a second commit to record its own commit hash | Durable task outcome enters the same task commit; the resulting hash is backfilled only into local SQLite/projections, so no self-referential metadata commit is created. |
159
167
 
160
168
  ## Advancement rule
161
169
 
@@ -13,7 +13,7 @@ An adapter may write only:
13
13
 
14
14
  The first command allowed to create project authority is `ultra-init`. Once invoked,
15
15
  Ultra owns only the repository-local `.ultra/` workflow-memory envelope and its
16
- generated projections.
16
+ MCP-published checkpoint plus generated local projections.
17
17
 
18
18
  ## Surfaces Ultra does not own
19
19
 
@@ -48,7 +48,8 @@ Internal review-rule skills remain available only to their bounded workers.
48
48
  Outside a repository containing `.ultra/.runtime/state.db`, all Ultra hooks are silent. Inside
49
49
  an initialized repository they remain silent unless a DB-authoritative workflow is
50
50
  active, blocked, or ready. The sole idle-time enforcement is protection against direct
51
- writes to generated Ultra projections; the DB remains authoritative.
51
+ writes to the MCP-owned team checkpoint or generated Ultra projections; the DB remains
52
+ checkout-local operational authority.
52
53
 
53
54
  Installation tests preserve byte-for-byte snapshots of all supported user handbook
54
55
  paths. Runtime tests cover explicit activation, idle silence, active recovery, and
package/docs/ROADMAP.md CHANGED
@@ -57,14 +57,14 @@ sharing one authoritative workflow store.
57
57
 
58
58
  ```
59
59
  spec/ ← Phase 1 single source of truth
60
- ├── mcp-tools.yaml (57 live tools across 9 families)
60
+ ├── mcp-tools.yaml (7 public kernel tools + 60 hidden compatibility operations)
61
61
  ├── cli-protocol.md (CLI ↔ MCP mapping table)
62
62
  ├── schemas/ (state-db.sql + 4 JSON schemas)
63
63
  ├── fixtures/{valid,invalid}/ (+ v4.4-project for migration)
64
64
  └── scripts/test-all.cjs (npm run test:spec — 7 validation stages)
65
65
 
66
66
  mcp-server/ ← Phase 2 authoritative state layer
67
- ├── server.cjs (stdio MCP server, 57 task/session/baseline/change/decision/workflow/artifact/system/plan tools)
67
+ ├── server.cjs (stdio MCP server with a 7-tool public façade)
68
68
  ├── lib/
69
69
  │ ├── state-db.cjs (SQLite + WAL + pragmas)
70
70
  │ ├── state-ops.cjs (full write API, status state machine)
@@ -106,7 +106,7 @@ docs/
106
106
  ├── PLUGIN-ISOLATION-CONTRACT.md install, activation, idle, and ownership contract
107
107
  ├── RUNTIME-COMPAT-MATRIX.md Phase 4 runtime capability matrix
108
108
  ├── STATE-DB-ACCESS-POLICY.md Phase 2 multi-process write contract
109
- ├── COMMIT-HASH-BACKFILL.md Phase 2.8 two-commit completion flow
109
+ ├── COMMIT-HASH-BACKFILL.md Checkout-local completion commit evidence
110
110
  └── ROADMAP.md this file
111
111
  ```
112
112
 
@@ -46,17 +46,18 @@ not presented as nonexistent custom agents.
46
46
 
47
47
  | Lifecycle | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
48
48
  |---|---|---|---|---|
49
- | Session context/health | FULL, active-workflow breadcrumb on native `SessionStart` | FULL, native JS plugin injects only an active-workflow breadcrumb; health via `system.doctor` | FULL, active-workflow breadcrumb on native `SessionStart` | FULL, active-workflow breadcrumb via native hooks |
50
- | Active edit boundary | FULL, `PreToolUse Edit|Write` | FULL, `tool.execute.before` rejects projection writes | FULL, `PreToolUse Edit|Write|apply_patch` | FULL, native `PreToolUse Edit|Write` deny contract |
49
+ | Session context/health | FULL, active-workflow breadcrumb on native `SessionStart` | FULL, native JS plugin injects only an active-workflow breadcrumb; health via `ultra.doctor` | FULL, active-workflow breadcrumb on native `SessionStart` | FULL, active-workflow breadcrumb via native hooks |
50
+ | Active edit boundary | FULL, `PreToolUse Edit|Write` | FULL, `tool.execute.before` rejects managed checkpoint/projection writes | FULL, `PreToolUse Edit|Write|apply_patch` | FULL, native `PreToolUse Edit|Write` deny contract |
51
51
  | Pre-compact checkpoint | FULL | FULL | FULL | FULL, native `PreCompact` |
52
52
  | Post-compact context injection | FULL | FULL, native compacting context | FULL, native `PostCompact` restore | DEGRADED; checkpoint restoration runs, but Kimi 0.26/0.27 does not reinject fire-and-forget hook text |
53
53
  | Stop lifecycle advisory | FULL, native non-blocking `Stop` | N/A, no equivalent stop event needed | FULL, native non-blocking `Stop` | FULL, native non-blocking `Stop` |
54
54
  | Subagent lifecycle evidence | FULL | DEGRADED, no equivalent packaged event | FULL | FULL, native `SubagentStart` / `SubagentStop` |
55
55
 
56
56
  Health/context, compact, stop, and subagent hooks remain silent unless
57
- `.ultra/.runtime/state.db` proves an active, blocked, or ready workflow. Projection
58
- protection applies to every initialized project because generated projections
59
- must never become a second authority. No host receives prompt capture, transcript capture,
57
+ `.ultra/.runtime/state.db` proves an active, blocked, or ready workflow. Managed-file
58
+ protection applies to every initialized project because neither a hand-edited team
59
+ checkpoint nor generated local projection may become a second authority. No host
60
+ receives prompt capture, transcript capture,
60
61
  observation journaling, session-summary memory, generic command blocking, or
61
62
  generic post-edit policy.
62
63
  Baseline-adoption and context-budget warnings are injected as advisory context;
@@ -67,7 +68,8 @@ they do not deny edits or stop active incident work.
67
68
  | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
68
69
  |---|---|---|---|---|
69
70
  | stdio MCP registration | plugin `.mcp.json` | `opencode.json` local MCP entry | plugin `.mcp.json` | plugin `mcpServers` entry |
70
- | Live/declared contracts | 57 | 57 | 57 | 57 |
71
+ | Public discovered MCP tools | 7 | 7 | 7 | 7 |
72
+ | Hidden 0.22 compatibility operations | 60 | 60 | 60 | 60 |
71
73
  | Structured user alignment | `AskUserQuestion` in interactive sessions | `question` when permission is not denied | `request_user_input` when the current mode exposes it | `AskUserQuestion` outside auto mode |
72
74
  | Greenfield/brownfield baseline adoption | FULL | FULL | FULL | FULL |
73
75
  | Context Manifest v3 / breadcrumb | FULL | FULL, same bundled read-only DB reader as every hook | FULL | FULL |
@@ -75,12 +77,13 @@ they do not deny edits or stop active incident work.
75
77
  | Host-native review/discovery/ask | native | native | documented in `codex-capability-map.json` | native Kimi tools and workers |
76
78
  | Workflow-memory envelope | project `.ultra/` | project `.ultra/` | project `.ultra/` | project `.ultra/` |
77
79
  | Lifecycle/index authority | project `.ultra/.runtime/state.db` | project `.ultra/.runtime/state.db` | project `.ultra/.runtime/state.db` | project `.ultra/.runtime/state.db` |
80
+ | Git team checkpoint | `.ultra/tasks/tasks.json` | `.ultra/tasks/tasks.json` | `.ultra/tasks/tasks.json` | `.ultra/tasks/tasks.json` |
78
81
  | General memory-provider API | N/A | N/A | N/A | N/A |
79
82
 
80
- All 57 `task.*`, `session.*`, `baseline.*`, `change.*`, `decision.*`,
81
- `workflow.*`, `artifact.*`, `system.*`, and `plan.*` operations
82
- registered by `mcp-server/server.cjs` are live. Review, impact discovery, skill
83
- loading, and user interaction remain host-native surfaces.
83
+ All hosts discover the seven `ultra.*` persistence and safety tools. The sixty
84
+ fine-grained 0.22 operations remain callable but undiscoverable for one compatibility
85
+ release; new Skills do not call them. Review, impact discovery, skill loading, model
86
+ reasoning, and user interaction remain host-native surfaces.
84
87
 
85
88
  When a native structured question surface is unavailable, the shared interaction
86
89
  contract permits one concise direct question only if ordinary conversation is still