ultra-builder-pro-cli 0.21.1 → 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 (47) 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 +40 -0
  4. package/README.md +166 -22
  5. package/adapters/opencode.js +23 -12
  6. package/docs/AGENT-CONTEXT.md +22 -13
  7. package/docs/ARCHITECTURE.md +59 -24
  8. package/docs/ARTIFACT-AUTHORITY.md +70 -30
  9. package/docs/COMMIT-HASH-BACKFILL.md +33 -90
  10. package/docs/DECISIONS.md +9 -7
  11. package/docs/LEGACY-CLI-CROSSWALK.md +10 -2
  12. package/docs/PLUGIN-ISOLATION-CONTRACT.md +3 -2
  13. package/docs/ROADMAP.md +3 -3
  14. package/docs/RUNTIME-COMPAT-MATRIX.md +8 -6
  15. package/docs/STATE-DB-ACCESS-POLICY.md +35 -7
  16. package/docs/WORKFLOW-LIFECYCLE.md +40 -16
  17. package/hooks/README.md +5 -4
  18. package/hooks/active_task_context.py +41 -39
  19. package/mcp-server/lib/artifact-registry.cjs +7 -6
  20. package/mcp-server/lib/baseline-workflow.cjs +60 -24
  21. package/mcp-server/lib/context-paths.cjs +34 -3
  22. package/mcp-server/lib/doctor.cjs +28 -0
  23. package/mcp-server/lib/git-bootstrap.cjs +0 -1
  24. package/mcp-server/lib/init-project.cjs +52 -2
  25. package/mcp-server/lib/projector.cjs +43 -8
  26. package/mcp-server/lib/state-authority.cjs +19 -3
  27. package/mcp-server/lib/state-ops.cjs +6 -1
  28. package/mcp-server/lib/task-ledger.cjs +1342 -0
  29. package/mcp-server/server.cjs +145 -9
  30. package/package.json +1 -1
  31. package/skills/ultra-change/SKILL.md +10 -2
  32. package/skills/ultra-deliver/SKILL.md +6 -3
  33. package/skills/ultra-dev/SKILL.md +21 -6
  34. package/skills/ultra-doctor/SKILL.md +10 -1
  35. package/skills/ultra-init/SKILL.md +18 -9
  36. package/skills/ultra-plan/SKILL.md +11 -4
  37. package/skills/ultra-research/SKILL.md +12 -13
  38. package/skills/ultra-review/SKILL.md +5 -3
  39. package/skills/ultra-status/SKILL.md +11 -7
  40. package/skills/ultra-test/SKILL.md +3 -2
  41. package/spec/cli-protocol.md +3 -0
  42. package/spec/mcp-tools.yaml +127 -0
  43. package/spec/schemas/context-file.v4.5.schema.json +1 -1
  44. package/spec/schemas/state-db.sql +1 -1
  45. package/spec/schemas/task-ledger.v1.schema.json +217 -0
  46. package/ultra-tools/commands/migrate.cjs +5 -2
  47. package/.ultra-template/tasks/contexts/TEMPLATE.md +0 -19
@@ -1,6 +1,13 @@
1
1
  {
2
- "schema_version": "4.5",
3
- "generated_at": "1970-01-01T00:00:00.000Z",
4
- "source": ".ultra/.runtime/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,46 @@ 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
+
10
50
  ## [0.21.1] — 2026-07-29
11
51
 
12
52
  ### Fixed
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/.runtime/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/.runtime/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**.
@@ -253,8 +304,11 @@ that rationale is useful. MCP validates state, evidence, and transitions; it
253
304
  does not store or prove the preceding UI interaction.
254
305
 
255
306
  Older projection-only Ultra projects are preserved and routed through a
256
- backup-first migration or rebaseline. Use `ultra-doctor` when initialization
257
- 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.
258
312
 
259
313
  ### 3. Make daily changes
260
314
 
@@ -311,6 +365,61 @@ These eleven capabilities are the complete public Ultra command graph. Each capa
311
365
  returns current `allowed_transitions`; the host may recommend one, but another public
312
366
  capability starts only after an explicit user command or skill invocation.
313
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.
422
+
314
423
  ## What lives in `.ultra/`
315
424
 
316
425
  ```text
@@ -318,6 +427,7 @@ capability starts only after an explicit user command or skill invocation.
318
427
  .runtime/ # local mutable state; ignored by Git
319
428
  state.db # lifecycle, index, transition, and freshness authority
320
429
  checkpoint.json # advisory recovery projection
430
+ projections/ # generated local task and task-context views
321
431
  backups/ # verified migration and recovery snapshots
322
432
  collab/ # local collaboration scratch
323
433
  sessions/ # local leases and session runtime
@@ -326,9 +436,14 @@ capability starts only after an explicit user command or skill invocation.
326
436
  specs/ # digest-bound product and architecture baseline
327
437
  changes/
328
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
329
442
  research/ # Change-only findings and research reports
330
443
  delta/ # typed baseline overlay and semantic payloads
331
444
  documentation/ # documentation overlay and reconciliation evidence
445
+ plan.json # machine-readable task topology
446
+ plan.md # deterministic human plan projection
332
447
  contexts/ # immutable role/task context snapshots
333
448
  test/ # Change-scoped test reports
334
449
  review/ # Change-scoped review workers and summary
@@ -337,17 +452,20 @@ capability starts only after an explicit user command or skill invocation.
337
452
  docs/research/ # baseline-only research evidence
338
453
  reports/templates/ # blank report schemas; never delivery evidence
339
454
  tasks/
340
- tasks.json # generated projection, never the authority
341
- 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
342
458
  ```
343
459
 
344
460
  Together, `.ultra/` is Ultra's project-local cross-session workflow memory. The
345
461
  host model writes semantic specifications and evidence through the active
346
462
  workflow. MCP records lifecycle state, references, digests, provenance, and
347
463
  accepted intent, then rejects stale or illegal transitions. The DB is the
348
- lifecycle and index authority; registered digest-bound files carry the semantic
349
- or evidence bodies that the DB references. Generated projections and working
350
- scratch are not authority.
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.
351
469
 
352
470
  Ultra does not store chain-of-thought, raw prompts, transcripts, general
353
471
  conversational or episodic memory, or code-graph payloads. External memory and
@@ -356,6 +474,29 @@ references to them as workflow context. Only `.ultra/.runtime/` is ignored by
356
474
  Git: semantic and evidence artifacts can travel with the repository, while
357
475
  SQLite, leases, telemetry, and recovery scratch remain checkout-local.
358
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
+
359
500
  See [Artifact authority](./docs/ARTIFACT-AUTHORITY.md) for the promotion and
360
501
  evidence rules.
361
502
 
@@ -409,8 +550,11 @@ host's existing model session.
409
550
  reinstall only the degraded host.
410
551
  - **Project state is unhealthy:** invoke `ultra-doctor` or run
411
552
  `ultra-tools system doctor`. Repairs and schema migrations are backup-first.
412
- - **A projection disagrees with MCP:** trust `.ultra/.runtime/state.db`; do not repair
413
- `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.
414
558
  - **A workflow appears blocked:** use `ultra-status` to read the exact current
415
559
  workflow, blocker, owner decision, and mechanically valid transitions.
416
560
  - **Kimi reports a native-module ABI error:** ensure an external Node.js 22+
@@ -337,7 +337,8 @@ import path from "node:path";
337
337
  import { execFileSync } from "node:child_process";
338
338
  import { fileURLToPath } from "node:url";
339
339
 
340
- const TASKS_PROJECTION = ".ultra/tasks/tasks.json";
340
+ const TEAM_TASK_LEDGER = ".ultra/tasks/tasks.json";
341
+ const LIVE_TASK_PROJECTION = ".ultra/.runtime/projections/tasks.json";
341
342
  const NODE_BINARY = ${JSON.stringify(process.execPath)};
342
343
  const PLUGIN_DIR = path.dirname(fileURLToPath(import.meta.url));
343
344
  const BREADCRUMB_CLI = path.resolve(
@@ -382,20 +383,28 @@ function targetPaths(tool, args) {
382
383
  return [...new Set(paths)];
383
384
  }
384
385
 
385
- function projectionRootForTarget(baseRoot, candidate) {
386
+ function managedTaskRootForTarget(baseRoot, candidate) {
386
387
  const target = path.isAbsolute(candidate)
387
388
  ? path.resolve(candidate)
388
389
  : path.resolve(baseRoot, candidate);
389
- if (path.basename(target) !== "tasks.json"
390
- || path.basename(path.dirname(target)) !== "tasks"
391
- || path.basename(path.dirname(path.dirname(target))) !== ".ultra") {
392
- return null;
390
+ if (target === path.resolve(baseRoot, TEAM_TASK_LEDGER)
391
+ || target === path.resolve(baseRoot, LIVE_TASK_PROJECTION)) return baseRoot;
392
+ if (path.basename(target) !== "tasks.json") return null;
393
+ const parent = path.dirname(target);
394
+ if (path.basename(parent) === "tasks"
395
+ && path.basename(path.dirname(parent)) === ".ultra") {
396
+ return path.dirname(path.dirname(parent));
397
+ }
398
+ if (path.basename(parent) === "projections"
399
+ && path.basename(path.dirname(parent)) === ".runtime"
400
+ && path.basename(path.dirname(path.dirname(parent))) === ".ultra") {
401
+ return path.dirname(path.dirname(path.dirname(parent)));
393
402
  }
394
- return path.dirname(path.dirname(path.dirname(target)));
403
+ return null;
395
404
  }
396
405
 
397
- function protectsTasksProjection(baseRoot, candidate) {
398
- const targetRoot = projectionRootForTarget(baseRoot, candidate);
406
+ function protectsManagedTaskFile(baseRoot, candidate) {
407
+ const targetRoot = managedTaskRootForTarget(baseRoot, candidate);
399
408
  if (!targetRoot) return false;
400
409
  return Boolean(readUltraContext(targetRoot));
401
410
  }
@@ -421,11 +430,13 @@ export const UltraBuilderProPlugin = async ({ directory, worktree }) => {
421
430
  const tool = String(input?.tool ?? "").toLowerCase();
422
431
  if (!["write", "edit", "apply_patch"].includes(tool)) return;
423
432
  if (targetPaths(tool, output?.args).some(
424
- (candidate) => protectsTasksProjection(root, candidate),
433
+ (candidate) => protectsManagedTaskFile(root, candidate),
425
434
  )) {
426
435
  throw new Error(
427
- "Ultra Builder Pro refused a direct write to .ultra/tasks/tasks.json. " +
428
- ".ultra/.runtime/state.db is authoritative; use MCP task tools and run ultra-doctor when state or projection health is degraded."
436
+ "Ultra Builder Pro refused a direct write to an MCP-managed task file. " +
437
+ ".ultra/tasks/tasks.json is the MCP-published team checkpoint and " +
438
+ ".ultra/.runtime/projections/tasks.json is the checkout-local DB view. " +
439
+ "Use the Ultra MCP task or task.ledger tools."
429
440
  );
430
441
  }
431
442
  },
@@ -26,8 +26,10 @@ not put it in a plugin until that allowlist classifies it.
26
26
 
27
27
  ```text
28
28
  native command or skill -> MCP workflow-state operation -> .ultra/.runtime/state.db
29
+ | \
30
+ | -> .ultra/tasks/tasks.json (Git checkpoint)
31
+ | -> .ultra/.runtime/projections/ (local views)
29
32
  ^
30
- |
31
33
  selected CLI init / doctor / diagnostics / orchestration
32
34
  ```
33
35
 
@@ -39,23 +41,25 @@ native command or skill -> MCP workflow-state operation -> .ultra/.runtime/state
39
41
 
40
42
  `.ultra/` is project-local cross-session workflow memory for normalized intent,
41
43
  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
44
+ `.ultra/.runtime/state.db` is checkout-local lifecycle, index, transition, freshness,
45
+ and coordination authority for baselines, changes, decisions, tasks, workflow
46
+ runs/steps, sessions, events, incidents, projection jobs/cursors, telemetry, review
47
+ evidence, and circuit-breaker state. Registered digest-bound specifications and
48
+ reports carry semantic or evidence bodies. `.ultra/tasks/tasks.json` is the
49
+ MCP-published portable baseline/Change/task checkpoint; it is not live lease or session
50
+ authority. Generated task views, runtime checkpoints, and collaboration scratch are
51
+ not independent authority. See
48
52
  [`ARTIFACT-AUTHORITY.md`](./ARTIFACT-AUTHORITY.md).
49
53
 
50
54
  ## 3. Live MCP and declared contracts
51
55
 
52
- `spec/mcp-tools.yaml` declares and the bundled server registers 57 tools across
56
+ `spec/mcp-tools.yaml` declares and the bundled server registers 60 tools across
53
57
  nine families:
54
58
 
55
59
  | Family | Live tools |
56
60
  |---|---|
57
61
  | `baseline.*` | start, record, get, converge |
58
- | `task.*` | create, update, list, get, switch_tag, delete, init_project, expand, parse_prd, dependency_topo, append_event, subscribe_events |
62
+ | `task.*` | create, update, list, get, switch_tag, delete, init_project, expand, parse_prd, dependency_topo, append_event, subscribe_events, ledger_get, ledger_publish, ledger_import |
59
63
  | `session.*` | spawn, close, get, list, admission_check, heartbeat, subscribe_events |
60
64
  | `change.*` | create, update, delta, documentation_reconcile, get, list, context, breadcrumb, learning_propose, learning_resolve, converge, archive |
61
65
  | `decision.*` | thread_start, get, list, open, resolve, delegate, defer, supersede, complete, checkpoint |
@@ -176,10 +180,11 @@ OpenCode plugin invoke the same bundled JavaScript `change.breadcrumb` reader
176
180
  through the thin `context_spine.py` bridge. No hook reimplements the state query.
177
181
  `health_check.py` and
178
182
  `workflow_context.py` may inspect any initialized project;
179
- `active_task_context.py` always protects the task projection but limits ordinary
183
+ `active_task_context.py` protects both the MCP-owned Git checkpoint and local task
184
+ projection but limits ordinary
180
185
  edit guidance to an active workflow. Compact/stop/subagent hooks remain
181
186
  active-workflow scoped. OpenCode natively injects baseline/change context and
182
- protects the projection; full health inspection is available through
187
+ protects both managed task paths; full health inspection is available through
183
188
  `system.doctor` rather than a session-start health hook.
184
189
  Advisory baseline or context-budget warnings are presentation only and never
185
190
  reject an edit, stop, or tool call.
@@ -213,14 +218,18 @@ sessions never call it, and it cannot collect, recall, or reflect memory.
213
218
  .ultra/
214
219
  ├── .runtime/
215
220
  │ ├── state.db # authoritative SQLite lifecycle/index store
216
- │ └── checkpoint.json # advisory breadcrumb recovery projection
221
+ │ ├── checkpoint.json # advisory breadcrumb recovery projection
222
+ │ └── projections/ # generated checkout-local task views
217
223
  ├── changes/
218
224
  │ ├── active/<id>/ # all Change semantics and evidence
219
225
  │ │ ├── intent.md, findings.md, progress.md
220
226
  │ │ ├── research/, delta/, documentation/, plan.json, plan.md
221
227
  │ │ └── contexts/, test/, review/, delivery/
222
228
  │ └── archive/ # converged packets after baseline reconciliation
223
- ├── tasks/ # projections and task contexts
229
+ ├── tasks/
230
+ │ └── tasks.json # MCP-published Git team checkpoint
231
+ ├── templates/
232
+ │ └── task-context.md # authored task-context template
224
233
  ├── specs/ # research/product/architecture artifacts
225
234
  └── reports/templates/ # blank report schemas; never evidence
226
235
  ```