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
@@ -3,55 +3,36 @@ name: ultra-think
3
3
  description: Resolve a consequential product, architecture, or recovery question through evidence-first reasoning and adaptive user alignment. Use when a material decision cannot be derived safely from accepted intent and current evidence.
4
4
  ---
5
5
 
6
- # Align without suppressing model judgment
6
+ # Align without suppressing judgment
7
7
 
8
- Thinking is an optional reasoning capability, not a mandatory stage. Answer
9
- self-contained questions directly. Use durable decision state only when a
10
- project-bound choice must survive interruption or gate later work.
8
+ Thinking is optional. Answer self-contained questions directly. Persist only a
9
+ project-bound decision that must survive interruption or control later work.
11
10
 
12
- ## Reason first
11
+ ## Reason and interact
13
12
 
14
- 1. Define the actual decision or disputed claim and the constraints that can change
15
- its answer.
16
- 2. Inspect current authority, source, runtime, tests, and primary documentation before
17
- asking the user for facts.
18
- 3. Separate verified fact, evidence-backed inference, accepted intent, delegated
13
+ 1. Call `ultra.context` for the relevant project or Change scope.
14
+ 2. Define the real decision and the constraints that can change its answer.
15
+ 3. Inspect source, runtime, tests, accepted artifacts, and primary documentation
16
+ before asking the owner for facts.
17
+ 4. Separate verified fact, evidence-backed inference, accepted intent, delegated
19
18
  implementation judgment, and unresolved owner choice.
20
- 4. Form credible alternatives only when alternatives materially help the decision.
21
- Evaluate them against the real constraints; do not impose a fixed option count,
22
- scoring system, or confidence percentage.
23
- 5. Stress-test the leading answer with its strongest counterexample, likely failure
24
- path, recovery, and load-bearing assumption.
25
-
26
- ## Interact adaptively
27
-
28
- Read `references/decision-dialogue.md`. If the user already gave a clear decision,
29
- normalize and use it without asking for confirmation. If the decision is reversible
30
- and delegated by the accepted contract, decide it and explain the reasoning.
31
-
32
- When owner authority is required, use the host's native question UI when available.
33
- Ask the earliest dependent decision with a recommendation, decisive evidence, and the
34
- effect of the answer. Keep cognitive load small; group only independent, simple facts.
35
- Do not expose the hidden decision queue.
36
-
37
- For durable project decisions, use `decision.thread_start`, `decision.open`, and the
38
- appropriate resolve, delegate, defer, or supersede transition. Store normalized
39
- decisions and artifact references, never transcripts or internal reasoning.
40
- Apply any resulting change through its owning baseline, change, workflow, task, or
41
- semantic artifact operation, read it back, and pass typed `applied_refs` to
42
- `decision.complete`. If the decision record itself is the complete durable authority,
43
- the list may be empty. Completion is not another owner approval.
44
-
45
- Prepare and confirm a checkpoint only when the decision changes a durable contract or
46
- artifact and a checkpoint is needed for recovery. Do not add a ceremonial approval
47
- gate to an already explicit user instruction or a reversible implementation detail.
48
-
49
- ## Return control
50
-
51
- Return the conclusion, decisive evidence, material uncertainty, and affected
52
- contracts. Re-read the invoking workflow or breadcrumb and recommend one of its
53
- `allowed_transitions`; follow `required_transition` only when a hard invariant leaves
54
- no alternative. Thinking does not implement code, mutate unrelated state, or invent a
55
- canonical next action.
56
-
57
- Never invoke the recommended capability here; wait for an explicit user invocation.
19
+ 5. Stress-test the leading answer with its strongest failure path and recovery.
20
+
21
+ Read `references/decision-dialogue.md`. Reuse a clear decision already present in the
22
+ request. Decide reversible delegated implementation details yourself. When owner
23
+ authority is necessary, ask one dependent decision through the host-native question
24
+ surface with a recommendation, decisive evidence, and the effect of the answer.
25
+
26
+ ## Persist only the normalized result
27
+
28
+ Use one `ultra.record` batch for `decision.thread_start`, `decision.open`, the
29
+ appropriate resolve/delegate/defer/supersede operation, the owning artifact mutation,
30
+ and `decision.complete` when they are all known. Store normalized decisions and
31
+ artifact references, never transcripts or internal reasoning.
32
+
33
+ A semantic rejection remains a mutable diagnostic. Correct the record or intentionally
34
+ abandon the draft; do not invent a new decision merely to satisfy a state machine.
35
+
36
+ Return the conclusion, decisive evidence, uncertainty, affected authority, and the
37
+ model's recommended next explicit capability. Thinking never performs unrelated
38
+ implementation or an external effect. Do not invoke the next capability automatically.
@@ -147,7 +147,9 @@ exists; that exception does not create interaction proof.
147
147
 
148
148
  ## Return to the capability graph
149
149
 
150
- After alignment, re-read the invoking workflow and breadcrumb. A
151
- `required_transition` is authoritative only for a hard invariant. Otherwise the host
152
- model recommends among `allowed_transitions` based on the user's goal and current
153
- evidence. Do not persist that semantic recommendation as MCP authority.
150
+ After alignment, re-read `ultra.context` for the invoking scope. The host model
151
+ recommends the next explicit capability from the user's goal, accepted intent,
152
+ evidence, recovery cost, and current warnings or blockers. MCP diagnostics describe
153
+ mechanical facts; they do not encode a semantic route or persist the recommendation
154
+ as authority. Only corruption, unsafe paths, true concurrency conflicts, permissions,
155
+ or irreversible external effects are hard blockers.
@@ -81,6 +81,13 @@ as a fallback unless `ultra-tools <family> --help` lists it.
81
81
 
82
82
  | MCP tool | CLI subcommand | Phase | Writer |
83
83
  |---------------------------|-----------------------------|------:|---------|
84
+ | `ultra.context` | `ultra context` | 23 | mcp |
85
+ | `ultra.record` | `ultra record` | 23 | mcp |
86
+ | `ultra.checkpoint` | `ultra checkpoint` | 23 | mcp |
87
+ | `ultra.sync` | `ultra sync` | 23 | mcp |
88
+ | `ultra.session` | `ultra session` | 23 | mcp |
89
+ | `ultra.archive` | `ultra archive` | 23 | mcp |
90
+ | `ultra.doctor` | `ultra doctor` | 23 | mcp |
84
91
  | `task.create` | `task create` | 2 | mcp |
85
92
  | `task.update` | `task update` | 2 | mcp |
86
93
  | `task.list` | `task list` | 2 | any |
@@ -91,6 +98,9 @@ as a fallback unless `ultra-tools <family> --help` lists it.
91
98
  | `task.expand` | `task expand` | 8a | mcp |
92
99
  | `task.parse_prd` | `task parse-prd` | 8a | mcp |
93
100
  | `task.dependency_topo` | `task topo` | 8a | mcp |
101
+ | `task.ledger_get` | `task ledger-get` | 21 | any |
102
+ | `task.ledger_publish` | `task ledger-publish` | 21 | mcp |
103
+ | `task.ledger_import` | `task ledger-import` | 21 | mcp |
94
104
  | `task.append_event` | `task append-event` | 2 | any (allowlisted observations only) |
95
105
  | `task.subscribe_events` | `task subscribe` | 2 | any |
96
106
  | `session.spawn` | `session spawn` | 4.5 | mcp |
@@ -139,6 +149,11 @@ as a fallback unless `ultra-tools <family> --help` lists it.
139
149
  | `plan.export` | `plan export` | 8a | mcp |
140
150
  | `plan.get` | `plan get` | 8a | any |
141
151
 
152
+ The seven `ultra.*` rows are the public model-facing MCP surface. The remaining
153
+ rows are one-release compatibility operations and CLI naming reservations; they
154
+ are callable by an already-running 0.22 session but are not returned by
155
+ `tools/list`.
156
+
142
157
  Current executable maintenance surfaces are `task init-project`,
143
158
  `session close|get|list|admission|heartbeat|subscribe|reap`, `status`, `db`,
144
159
  `migrate`, `system doctor|restore|rebaseline`, and `legacy-memory`. In particular, `task create|update|list|get`
@@ -20,6 +20,7 @@ info:
20
20
  fixture to spec/fixtures/{valid,invalid}/, (c) `npm run test:spec` green.
21
21
 
22
22
  families:
23
+ - { name: ultra, description: 'narrow model-facing persistence and safety kernel', phase: '23' }
23
24
  - { name: task, description: 'authoritative task lifecycle on state.db', phase: '2' }
24
25
  - { name: session, description: 'execution-unit lifecycle with single-active-lease admission (D33)', phase: '4.5' }
25
26
  - { name: plan, description: 'execution-plan artifact export and query (D34)', phase: '8a' }
@@ -32,6 +33,164 @@ families:
32
33
 
33
34
  tools:
34
35
 
36
+ # ───────────────────── public model-facing kernel ─────────────────────
37
+ - name: ultra.context
38
+ family: ultra
39
+ description: Read the complete current Ultra spine and optionally compile one stage-scoped Context Manifest. This tool reports warnings and blockers without choosing the next semantic action.
40
+ phase: '23'
41
+ readonly: true
42
+ writer_role: mcp
43
+ input_schema:
44
+ type: object
45
+ additionalProperties: false
46
+ properties:
47
+ stage: { type: string, enum: [project, research, plan, dev, test, review, deliver] }
48
+ scope:
49
+ type: object
50
+ additionalProperties: false
51
+ properties:
52
+ change_id: { type: string, minLength: 1 }
53
+ task_id: { type: string, minLength: 1 }
54
+ detail: { type: string, enum: [summary, full] }
55
+ output_schema: { type: object }
56
+ errors:
57
+ - { code: VALIDATION_ERROR, description: 'input failed structural validation' }
58
+ - { code: STATE_CORRUPT, description: 'local authority cannot be read safely' }
59
+ cli_subcommand: 'ultra context'
60
+
61
+ - name: ultra.record
62
+ family: ultra
63
+ description: Record one or more typed draft facts or actions with per-entry idempotency. Semantic rejections are returned as mutable diagnostics rather than transport errors.
64
+ phase: '23'
65
+ writer_role: mcp
66
+ input_schema:
67
+ type: object
68
+ required: [entries]
69
+ additionalProperties: false
70
+ properties:
71
+ entries:
72
+ type: array
73
+ minItems: 1
74
+ items:
75
+ type: object
76
+ required: [operation, data, idempotency_key]
77
+ additionalProperties: false
78
+ properties:
79
+ operation: { type: string, minLength: 3 }
80
+ data: { type: object }
81
+ idempotency_key: { type: string, minLength: 3 }
82
+ output_schema: { type: object }
83
+ errors:
84
+ - { code: VALIDATION_ERROR, description: 'input failed structural validation' }
85
+ - { code: STATE_CORRUPT, description: 'local authority cannot be updated safely' }
86
+ - { code: PATH_AUTHORITY_VIOLATION, description: 'a requested write escapes managed authority' }
87
+ cli_subcommand: 'ultra record'
88
+ emits_events: [ultra_facade_call]
89
+
90
+ - name: ultra.checkpoint
91
+ family: ultra
92
+ description: Attempt one semantic stage checkpoint. Failed semantic checks return blockers and leave the draft mutable; accepted checkpoints commit durable authority once.
93
+ phase: '23'
94
+ writer_role: mcp
95
+ input_schema:
96
+ type: object
97
+ required: [stage, scope, payload, idempotency_key]
98
+ additionalProperties: false
99
+ properties:
100
+ stage: { type: string, enum: [research, plan, dev, test, review, deliver] }
101
+ scope:
102
+ type: object
103
+ additionalProperties: false
104
+ properties:
105
+ change_id: { type: string, minLength: 1 }
106
+ task_id: { type: string, minLength: 1 }
107
+ payload: { type: object }
108
+ idempotency_key: { type: string, minLength: 3 }
109
+ output_schema: { type: object }
110
+ errors:
111
+ - { code: VALIDATION_ERROR, description: 'input failed structural validation' }
112
+ - { code: STATE_CORRUPT, description: 'local authority cannot be checkpointed safely' }
113
+ - { code: PATH_AUTHORITY_VIOLATION, description: 'checkpoint evidence escapes managed authority' }
114
+ cli_subcommand: 'ultra checkpoint'
115
+ emits_events: [ultra_checkpoint_accepted, ultra_checkpoint_rejected]
116
+
117
+ - name: ultra.sync
118
+ family: ultra
119
+ description: Inspect, import, or publish the Git team checkpoint while preserving local sessions and rejecting real concurrent team-state conflicts.
120
+ phase: '23'
121
+ writer_role: mcp
122
+ input_schema:
123
+ type: object
124
+ required: [action]
125
+ additionalProperties: false
126
+ properties:
127
+ action: { type: string, enum: [inspect, import, publish] }
128
+ reason: { type: string }
129
+ idempotency_key: { type: string }
130
+ output_schema: { type: object }
131
+ errors:
132
+ - { code: VALIDATION_ERROR, description: 'input failed structural validation' }
133
+ - { code: TASK_LEDGER_HISTORY_CONFLICT, description: 'team checkpoint histories conflict' }
134
+ - { code: TASK_LEDGER_TASK_CONFLICT, description: 'the same durable task changed concurrently' }
135
+ cli_subcommand: 'ultra sync'
136
+
137
+ - name: ultra.session
138
+ family: ultra
139
+ description: Acquire, inspect, heartbeat, or release the small execution lease that requires transactional concurrency control.
140
+ phase: '23'
141
+ writer_role: mcp
142
+ input_schema:
143
+ type: object
144
+ required: [action]
145
+ additionalProperties: false
146
+ properties:
147
+ action: { type: string, enum: [admission, acquire, get, list, heartbeat, release] }
148
+ scope: { type: object }
149
+ payload: { type: object }
150
+ idempotency_key: { type: string }
151
+ output_schema: { type: object }
152
+ errors:
153
+ - { code: VALIDATION_ERROR, description: 'input failed structural validation' }
154
+ - { code: SESSION_STATUS_CONFLICT, description: 'a concurrent session transition won' }
155
+ - { code: LEASE_EXPIRED, description: 'the execution lease already expired' }
156
+ cli_subcommand: 'ultra session'
157
+
158
+ - name: ultra.archive
159
+ family: ultra
160
+ description: Converge and archive one accepted Change through the recoverable filesystem and database transaction boundary.
161
+ phase: '23'
162
+ writer_role: mcp
163
+ input_schema:
164
+ type: object
165
+ required: [change_id, payload, idempotency_key]
166
+ additionalProperties: false
167
+ properties:
168
+ change_id: { type: string, minLength: 1 }
169
+ payload: { type: object }
170
+ idempotency_key: { type: string, minLength: 3 }
171
+ output_schema: { type: object }
172
+ errors:
173
+ - { code: VALIDATION_ERROR, description: 'input failed structural validation' }
174
+ - { code: STATE_CORRUPT, description: 'archive authority cannot be trusted' }
175
+ - { code: ARCHIVE_RUNTIME_UNAVAILABLE, description: 'safe archive primitives are unavailable' }
176
+ cli_subcommand: 'ultra archive'
177
+
178
+ - name: ultra.doctor
179
+ family: ultra
180
+ description: Inspect mechanical health and optionally apply only backup-first deterministic repairs. Semantic choices remain with the model and owner.
181
+ phase: '23'
182
+ writer_role: mcp
183
+ input_schema:
184
+ type: object
185
+ additionalProperties: false
186
+ properties:
187
+ repair: { type: boolean }
188
+ output_schema: { type: object }
189
+ errors:
190
+ - { code: STATE_CORRUPT, description: 'the state database cannot be inspected safely' }
191
+ - { code: BACKUP_FAILED, description: 'a required recovery backup could not be created' }
192
+ cli_subcommand: 'ultra doctor'
193
+
35
194
  # ─────────────────────────── task family ────────────────────────────────
36
195
  - name: task.create
37
196
  family: task
@@ -233,6 +392,106 @@ tools:
233
392
  emits_events: []
234
393
  trace_to: '§7.3'
235
394
 
395
+ - name: task.ledger_get
396
+ family: task
397
+ description: Read the Git-facing durable baseline, Change, and task checkpoint ledger and compare it with local SQLite authority.
398
+ phase: '21'
399
+ readonly: true
400
+ writer_role: any
401
+ input_schema:
402
+ type: object
403
+ additionalProperties: false
404
+ output_schema:
405
+ type: object
406
+ required: [ledger, health]
407
+ additionalProperties: false
408
+ properties:
409
+ ledger: { type: ['object', 'null'] }
410
+ health: { type: object }
411
+ errors:
412
+ - { code: TASK_LEDGER_INVALID, description: 'the Git ledger is malformed' }
413
+ - { code: TASK_LEDGER_DIGEST_MISMATCH, description: 'ledger content does not match its digest' }
414
+ - { code: TASK_LEDGER_UNSAFE, description: 'ledger path is a symlink or non-regular file' }
415
+ cli_subcommand: task ledger-get
416
+ emits_events: []
417
+ trace_to: 'docs/ARTIFACT-AUTHORITY.md#team-task-ledger'
418
+
419
+ - name: task.ledger_publish
420
+ family: task
421
+ description: Publish a low-frequency Git-facing baseline, Change, and task checkpoint from local SQLite authority.
422
+ phase: '21'
423
+ writer_role: mcp
424
+ input_schema:
425
+ type: object
426
+ additionalProperties: false
427
+ properties:
428
+ reason:
429
+ type: string
430
+ minLength: 1
431
+ default: manual_checkpoint
432
+ output_schema:
433
+ type: object
434
+ required: [changed, path, generation, state_digest]
435
+ additionalProperties: false
436
+ properties:
437
+ changed: { type: boolean }
438
+ path: { type: string }
439
+ generation: { type: integer, minimum: 0 }
440
+ state_digest: { type: string, pattern: '^[0-9a-f]{64}$' }
441
+ migrated_legacy_projection: { type: boolean }
442
+ legacy_backup_path: { type: string }
443
+ errors:
444
+ - { code: TASK_LEDGER_INVALID, description: 'the prior Git ledger is malformed' }
445
+ - { code: TASK_LEDGER_DIGEST_MISMATCH, description: 'prior ledger content does not match its digest' }
446
+ - { code: TASK_LEDGER_UNSAFE, description: 'ledger path is a symlink or non-regular file' }
447
+ - { code: TASK_LEDGER_CHANGE_MISSING, description: 'a task has no portable owning Change' }
448
+ - { code: TASK_LEDGER_LEGACY_CONFLICT, description: 'the legacy task projection differs from SQLite authority and cannot be replaced automatically' }
449
+ - { code: TASK_LEDGER_REVALIDATION_REQUIRED, description: 'an imported ready baseline must converge in this checkout before publication' }
450
+ cli_subcommand: task ledger-publish
451
+ emits_events: [task_ledger_published]
452
+ trace_to: 'docs/ARTIFACT-AUTHORITY.md#team-task-ledger'
453
+
454
+ - name: task.ledger_import
455
+ family: task
456
+ description: Import a validated Git checkpoint into local SQLite authority with per-baseline, per-Change, and per-task conflict checks.
457
+ phase: '21'
458
+ writer_role: mcp
459
+ input_schema:
460
+ type: object
461
+ additionalProperties: false
462
+ output_schema:
463
+ type: object
464
+ required: [imported, preserved, deleted, imported_changes, preserved_changes, imported_baseline, preserved_baseline, generation, state_digest, requires_plan_revalidation, requires_baseline_revalidation, already_current]
465
+ additionalProperties: false
466
+ properties:
467
+ imported: { type: integer, minimum: 0 }
468
+ preserved: { type: integer, minimum: 0 }
469
+ deleted: { type: integer, minimum: 0 }
470
+ imported_changes: { type: integer, minimum: 0 }
471
+ preserved_changes: { type: integer, minimum: 0 }
472
+ imported_baseline: { type: boolean }
473
+ preserved_baseline: { type: boolean }
474
+ generation: { type: integer, minimum: 0 }
475
+ state_digest: { type: string, pattern: '^[0-9a-f]{64}$' }
476
+ requires_plan_revalidation: { type: boolean }
477
+ requires_baseline_revalidation: { type: boolean }
478
+ already_current: { type: boolean }
479
+ errors:
480
+ - { code: TASK_LEDGER_INVALID, description: 'the Git ledger is malformed' }
481
+ - { code: TASK_LEDGER_DIGEST_MISMATCH, description: 'ledger content does not match its digest' }
482
+ - { code: TASK_LEDGER_UNSAFE, description: 'ledger path is a symlink or non-regular file' }
483
+ - { code: TASK_LEDGER_CONFLICT, description: 'the same task changed locally and in Git' }
484
+ - { code: TASK_LEDGER_ACTIVE_TASK_CONFLICT, description: 'Git changed a task with an active local session' }
485
+ - { code: TASK_LEDGER_STALE, description: 'the Git ledger is older than the last local checkpoint' }
486
+ - { code: TASK_LEDGER_HISTORY_CONFLICT, description: 'the Git ledger does not descend from the last local checkpoint' }
487
+ - { code: TASK_LEDGER_CHANGE_MISSING, description: 'a task references an unavailable Change' }
488
+ - { code: TASK_LEDGER_PARENT_MISSING, description: 'a task references an unavailable parent task' }
489
+ - { code: TASK_LEDGER_CHANGE_CONFLICT, description: 'the same Change changed locally and in Git' }
490
+ - { code: TASK_LEDGER_BASELINE_CONFLICT, description: 'the same baseline changed locally and in Git' }
491
+ cli_subcommand: task ledger-import
492
+ emits_events: [task_ledger_imported]
493
+ trace_to: 'docs/ARTIFACT-AUTHORITY.md#team-task-ledger'
494
+
236
495
  - name: task.switch_tag
237
496
  family: task
238
497
  description: Change a task's tag (branch-scoped context partition, Phase 7.2). Emits task_tag_changed.
@@ -389,6 +648,32 @@ tools:
389
648
  migration_backup_path:
390
649
  type: string
391
650
  description: pre-migration database backup created while resuming an older schema
651
+ runtime_migration_backup_path:
652
+ type: string
653
+ description: verified backup of a legacy runtime layout moved into `.ultra/.runtime/`
654
+ team_checkpoint:
655
+ type: object
656
+ additionalProperties: false
657
+ required: [generation, state_digest, imported_tasks, deleted_tasks, imported_changes, imported_baseline, requires_plan_revalidation, requires_baseline_revalidation, already_current]
658
+ properties:
659
+ generation: { type: integer, minimum: 0 }
660
+ state_digest: { type: string, pattern: '^[0-9a-f]{64}$' }
661
+ imported_tasks: { type: integer, minimum: 0 }
662
+ deleted_tasks: { type: integer, minimum: 0 }
663
+ imported_changes: { type: integer, minimum: 0 }
664
+ imported_baseline: { type: boolean }
665
+ requires_plan_revalidation: { type: boolean }
666
+ requires_baseline_revalidation: { type: boolean }
667
+ already_current: { type: boolean }
668
+ published:
669
+ type: boolean
670
+ description: true when resume replaced a matching legacy task projection with a new team checkpoint
671
+ migrated_legacy_projection:
672
+ type: boolean
673
+ description: true when the prior tracked file used the supported legacy projection format
674
+ legacy_backup_path:
675
+ type: string
676
+ description: exact-byte backup of the replaced legacy task projection
392
677
  errors:
393
678
  - { code: ULTRA_DIR_EXISTS, description: '.ultra/ already exists and overwrite=false' }
394
679
  - { code: TEMPLATE_MISSING, description: 'source_template path does not exist' }
@@ -397,6 +682,7 @@ tools:
397
682
  - { code: LEGACY_STATE_MIGRATION_REQUIRED, description: 'projection-only tasks must be imported before resume' }
398
683
  - { code: STATE_AUTHORITY_CONFLICT, description: 'projection tasks and authoritative state cannot be reconciled automatically' }
399
684
  - { code: STATE_PROJECTION_INVALID, description: 'the existing task projection is malformed' }
685
+ - { code: TASK_LEDGER_LEGACY_CONFLICT, description: 'the legacy task projection differs from SQLite authority and cannot be upgraded automatically' }
400
686
  - { code: GIT_INIT_FAILED, description: 'the local Git repository or Ultra ignore rule could not be initialized' }
401
687
  - { code: GITIGNORE_UNSAFE, description: 'root .gitignore is a symlink or non-file and cannot be updated safely' }
402
688
  - { code: GITIGNORE_INEFFECTIVE, description: 'the effective Git rules still expose the `.ultra` authority' }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://ultra-builder-pro.dev/spec/context-file.v4.5.schema.json",
4
4
  "title": "context-file projection (v4.5)",
5
- "description": "Schema for the parsed representation of .ultra/tasks/contexts/task-*.md. The header is regenerated by the projector from state.db. Body sections are author-owned; status MUST NOT appear in body. Authority boundary: docs/DECISIONS.md.",
5
+ "description": "Schema for the parsed representation of .ultra/.runtime/projections/contexts/task-*.md. The file is regenerated by the projector from state.db and remains checkout-local. Authority boundary: docs/ARTIFACT-AUTHORITY.md.",
6
6
  "type": "object",
7
7
  "required": ["header", "body"],
8
8
  "additionalProperties": false,
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "family": {
62
62
  "type": "string",
63
- "enum": ["task", "memory", "review", "impact", "skill", "session", "ask", "plan", "baseline", "change", "decision", "workflow", "artifact", "system"]
63
+ "enum": ["ultra", "task", "memory", "review", "impact", "skill", "session", "ask", "plan", "baseline", "change", "decision", "workflow", "artifact", "system"]
64
64
  },
65
65
  "description": { "type": "string", "minLength": 10 },
66
66
  "phase": {
@@ -105,7 +105,7 @@ CREATE TABLE IF NOT EXISTS tasks (
105
105
  docs_impact_json TEXT NOT NULL DEFAULT '{"status":"unknown","files":[],"rationale":null}',
106
106
  ownership_json TEXT NOT NULL DEFAULT '{}',
107
107
  context_file TEXT, -- projection target path
108
- completion_commit TEXT, -- backfilled hash (Phase 2.8)
108
+ completion_commit TEXT, -- checkout-local integrated commit evidence
109
109
  change_id TEXT REFERENCES changes(id) ON DELETE SET NULL,
110
110
  parent_id TEXT REFERENCES tasks(id) ON DELETE SET NULL, -- Phase 8A.1: task.expand subtask→parent
111
111
  created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),