ultra-builder-pro-cli 0.16.0 → 0.17.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 (64) hide show
  1. package/.ultra-template/specs/research-distillate.md +4 -3
  2. package/CHANGELOG.md +86 -0
  3. package/README.md +54 -24
  4. package/adapters/_shared/codex-assets.cjs +10 -5
  5. package/adapters/_shared/handbook.cjs +1 -1
  6. package/adapters/_shared/interaction-contract.cjs +61 -0
  7. package/adapters/claude.js +1 -1
  8. package/adapters/opencode.js +1 -1
  9. package/bin/orchestrator.js +175 -19
  10. package/commands/ultra-change.md +1 -1
  11. package/commands/ultra-deliver.md +3 -3
  12. package/commands/ultra-init.md +1 -1
  13. package/commands/ultra-plan.md +1 -1
  14. package/commands/ultra-research.md +2 -2
  15. package/commands/ultra-review.md +10 -0
  16. package/commands/ultra-status.md +1 -1
  17. package/commands/ultra-test.md +1 -1
  18. package/docs/AGENT-CONTEXT.md +11 -8
  19. package/docs/ARCHITECTURE.md +67 -9
  20. package/docs/LEGACY-CLI-CROSSWALK.md +163 -0
  21. package/docs/PLAN.zh-CN.md +19 -13
  22. package/docs/RUNTIME-COMPAT-MATRIX.md +2 -2
  23. package/docs/WORKFLOW-LIFECYCLE.md +123 -59
  24. package/hooks/pre_stop_check.py +3 -2
  25. package/mcp-server/lib/baseline-workflow.cjs +84 -16
  26. package/mcp-server/lib/change-workflow.cjs +55 -35
  27. package/mcp-server/lib/context-spine.cjs +171 -105
  28. package/mcp-server/lib/git-bootstrap.cjs +240 -0
  29. package/mcp-server/lib/init-project.cjs +178 -41
  30. package/mcp-server/lib/project-breadcrumb.cjs +14 -14
  31. package/mcp-server/lib/state-db.cjs +257 -10
  32. package/mcp-server/lib/state-ops.cjs +64 -1
  33. package/mcp-server/lib/workflow-state.cjs +300 -205
  34. package/mcp-server/server.cjs +58 -34
  35. package/orchestrator/auto-merge.cjs +19 -0
  36. package/orchestrator/daemon.cjs +104 -0
  37. package/orchestrator/parallel-orchestrator.cjs +371 -49
  38. package/orchestrator/session-runner.cjs +354 -25
  39. package/package.json +2 -1
  40. package/skills/ultra-change/SKILL.md +69 -94
  41. package/skills/ultra-deliver/SKILL.md +37 -65
  42. package/skills/ultra-dev/SKILL.md +50 -52
  43. package/skills/ultra-doctor/SKILL.md +34 -49
  44. package/skills/ultra-init/SKILL.md +78 -105
  45. package/skills/ultra-plan/SKILL.md +78 -99
  46. package/skills/ultra-research/SKILL.md +99 -113
  47. package/skills/ultra-review/SKILL.md +38 -53
  48. package/skills/ultra-review/references/review-modes.md +5 -3
  49. package/skills/ultra-review/references/unified-schema.md +26 -6
  50. package/skills/ultra-review/scripts/review_wait.py +12 -0
  51. package/skills/ultra-status/SKILL.md +34 -44
  52. package/skills/ultra-test/SKILL.md +61 -54
  53. package/skills/ultra-think/SKILL.md +37 -51
  54. package/skills/ultra-think/references/decision-dialogue.md +87 -111
  55. package/spec/cli-protocol.md +35 -0
  56. package/spec/mcp-tools.yaml +145 -28
  57. package/spec/schemas/delivery-report.v1.schema.json +1 -46
  58. package/spec/schemas/state-db.sql +8 -2
  59. package/spec/schemas/test-report.v1.schema.json +45 -14
  60. package/ultra-tools/cli.cjs +1 -1
  61. package/ultra-tools/commands/session.cjs +10 -3
  62. package/ultra-tools/commands/status.cjs +19 -14
  63. package/ultra-tools/commands/system.cjs +2 -2
  64. package/ultra-tools/commands/task.cjs +3 -0
@@ -168,9 +168,10 @@ tools:
168
168
  - { code: CHANGE_NOT_MUTABLE, description: 'assigned change no longer accepts task updates' }
169
169
  - { code: TASK_CHANGE_OWNERSHIP_MISMATCH, description: 'task ownership conflicts with its parent or children' }
170
170
  - { code: TASK_EXECUTION_CONTRACT_INCOMPLETE, description: 'task is not executable until its outcome, seam, checks, evidence context, docs impact, ownership, and traceability are complete' }
171
+ - { code: TASK_STALE_RECONCILIATION_REQUIRED, description: 'stale can clear only while rebinding and validating the complete task execution contract' }
171
172
  - { code: LEGACY_STATE_MIGRATION_REQUIRED, description: 'non-empty v4.4 projection must be migrated before state-backed tools can run' }
172
173
  cli_subcommand: task update
173
- emits_events: [task_started, task_completed, task_blocked, task_stale_marked]
174
+ emits_events: [task_started, task_completed, task_blocked, task_stale_marked, task_contract_updated, task_contract_reconciled]
174
175
  trace_to: '§7.3, §7.2'
175
176
 
176
177
  - name: task.list
@@ -281,9 +282,9 @@ tools:
281
282
  - name: task.init_project
282
283
  family: task
283
284
  description: |
284
- Bootstrap `.ultra/` and start an authoritative greenfield or brownfield
285
- baseline. Auto mode detects meaningful existing project content before
286
- copying specification templates and creating state.db.
285
+ Bootstrap `.ultra/`, classify the repository, initialize or preserve local
286
+ Git authority, and complete the initialization workflow. It creates no
287
+ research run; research begins only through an explicit workflow.start.
287
288
  phase: '3'
288
289
  writer_role: mcp
289
290
  input_schema:
@@ -309,6 +310,11 @@ tools:
309
310
  enum: [auto, greenfield, brownfield]
310
311
  default: auto
311
312
  description: auto detects whether meaningful project content already exists
313
+ git_mode:
314
+ type: string
315
+ enum: [auto, initialize, skip]
316
+ default: auto
317
+ description: preserve an existing repository, initialize a missing local repository by default, or explicitly keep a non-Git workspace
312
318
  resume:
313
319
  type: boolean
314
320
  default: false
@@ -329,7 +335,7 @@ tools:
329
335
  description: override path to the template root (defaults to bundled templates/.ultra/)
330
336
  output_schema:
331
337
  type: object
332
- required: [created_path, state_db_path, status, mode, baseline, copied_files, repository_profile, workflow]
338
+ required: [created_path, state_db_path, status, mode, baseline, copied_files, repository_profile, git, workflow]
333
339
  additionalProperties: false
334
340
  properties:
335
341
  created_path:
@@ -355,9 +361,22 @@ tools:
355
361
  repository_profile:
356
362
  type: object
357
363
  description: bounded classification evidence used to route greenfield or brownfield adoption
364
+ git:
365
+ type: object
366
+ required: [requested_mode, status, repository_root, branch, head, gitignore_path, gitignore_changed, initial_commit_required]
367
+ additionalProperties: false
368
+ properties:
369
+ requested_mode: { type: string, enum: [auto, initialize, skip] }
370
+ status: { type: string, enum: [initialized, existing, skipped] }
371
+ repository_root: { type: ['string', 'null'] }
372
+ branch: { type: ['string', 'null'] }
373
+ head: { type: ['string', 'null'] }
374
+ gitignore_path: { type: ['string', 'null'] }
375
+ gitignore_changed: { type: boolean }
376
+ initial_commit_required: { type: boolean }
358
377
  workflow:
359
378
  type: object
360
- description: durable initialization and research run ids, states, mode, and exact next route
379
+ description: completed initialization provenance, research status, and the allowed or required transitions
361
380
  backup_path:
362
381
  type: string
363
382
  description: set only when status=overwritten
@@ -372,6 +391,9 @@ tools:
372
391
  - { code: LEGACY_STATE_MIGRATION_REQUIRED, description: 'projection-only tasks must be imported before resume' }
373
392
  - { code: STATE_AUTHORITY_CONFLICT, description: 'projection tasks and authoritative state cannot be reconciled automatically' }
374
393
  - { code: STATE_PROJECTION_INVALID, description: 'the existing task projection is malformed' }
394
+ - { code: GIT_INIT_FAILED, description: 'the local Git repository or Ultra ignore rule could not be initialized' }
395
+ - { code: GITIGNORE_UNSAFE, description: 'root .gitignore is a symlink or non-file and cannot be updated safely' }
396
+ - { code: GITIGNORE_INEFFECTIVE, description: 'the effective Git rules still expose the `.ultra` authority' }
375
397
  - { code: IO_ERROR, description: 'filesystem write failed', retriable: true }
376
398
  cli_subcommand: task init-project
377
399
  emits_events: [project_initialized, project_resumed]
@@ -423,7 +445,7 @@ tools:
423
445
 
424
446
  - name: task.parse_prd
425
447
  family: task
426
- description: Validate a host-derived PRD task graph and optionally persist it after the Ultra planning approval gate.
448
+ description: Validate a host-derived PRD task graph and optionally persist it inside the current plan workflow.
427
449
  phase: '8a'
428
450
  writer_role: mcp
429
451
  input_schema:
@@ -448,7 +470,7 @@ tools:
448
470
  files_modified: { type: array, items: { type: string } }
449
471
  tag: { type: string }
450
472
  change_id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$', description: 'continuous change unit that will own every persisted parsed task' }
451
- dry_run: { type: boolean, default: false, description: 'when true, do not persist to state.db — used by ultra-plan gate to preview before approve' }
473
+ dry_run: { type: boolean, default: false, description: 'when true, validate and preview without persisting to state.db' }
452
474
  output_schema:
453
475
  type: object
454
476
  required: [tasks, topo]
@@ -564,7 +586,7 @@ tools:
564
586
  # ────────────────────────── session family ──────────────────────────────
565
587
  - name: session.spawn
566
588
  family: session
567
- description: Register execution-session intent, lease, and proposed worktree/artifact paths. The orchestrator creates the process and worktree after this admission step.
589
+ description: Admit a plan-authorized execution session, create its isolated Git worktree and artifact directory, and register the lease. Change-owned tasks must retain their complete accepted contract, current completed plan, dependency readiness, and non-stale executable status. The current host launches its bounded worker inside the returned worktree.
568
590
  phase: '4.5'
569
591
  writer_role: mcp
570
592
  input_schema:
@@ -575,26 +597,43 @@ tools:
575
597
  task_id: { type: string }
576
598
  runtime: { type: string, enum: [claude, opencode, codex, kimi] }
577
599
  takeover: { type: boolean, default: false, description: 'override active lease (D33 takeover strategy)' }
578
- worktree_base: { type: string }
600
+ worktree_base:
601
+ type: string
602
+ description: optional path resolving inside the repository `.ultra/worktrees` boundary; outside paths are rejected
579
603
  output_schema:
580
604
  type: object
581
- required: [sid, worktree_path, artifact_dir, lease_expires_at]
605
+ required: [sid, worktree_path, artifact_dir, lease_expires_at, worktree_created]
582
606
  additionalProperties: false
583
607
  properties:
584
608
  sid: { type: string }
585
609
  worktree_path: { type: string }
586
610
  artifact_dir: { type: string }
587
611
  lease_expires_at: { type: string, format: date-time }
612
+ worktree_created: { type: boolean }
588
613
  errors:
589
614
  - { code: TASK_NOT_FOUND, description: 'task id missing' }
590
615
  - { code: ADMISSION_DENIED, description: 'active lease exists; choose takeover/resume/abandon' }
616
+ - { code: NESTED_SESSION_FORBIDDEN, description: 'an active worker must resume its assigned session instead of recursively spawning another one' }
617
+ - { code: TAKEOVER_FAILED, description: 'prior owned worker could not be terminated safely' }
618
+ - { code: TASK_EXECUTION_CONTRACT_INCOMPLETE, description: 'change-owned task contract is incomplete' }
619
+ - { code: WORKFLOW_TASK_NOT_EXECUTABLE, description: 'task status or staleness blocks execution' }
620
+ - { code: TASK_DEPENDENCIES_INCOMPLETE, description: 'one or more task dependencies have not converged' }
621
+ - { code: WORKFLOW_PLAN_NOT_COMPLETED, description: 'owning change has no healthy completed plan workflow' }
622
+ - { code: WORKFLOW_PLAN_TASK_SET_STALE, description: 'change task set differs from the current converged plan' }
623
+ - { code: WORKFLOW_PLAN_TASK_CONTRACT_STALE, description: 'task contract differs from the current converged plan' }
624
+ - { code: WORKTREE_SCOPE_INVALID, description: 'requested worktree base escapes the managed project boundary' }
625
+ - { code: WORKTREE_FAILED, description: 'Git worktree creation failed or the repository has no usable HEAD' }
626
+ - { code: WORKTREE_AUTHORITY_MISSING, description: 'central `.ultra/state.db` disappeared before worktree binding' }
627
+ - { code: WORKTREE_AUTHORITY_NOT_IGNORED, description: 'a safe local ignore rule for the `.ultra` authority link could not be established' }
628
+ - { code: WORKTREE_AUTHORITY_CONFLICT, description: 'the isolated checkout already contains a conflicting `.ultra` entry' }
629
+ - { code: WORKTREE_AUTHORITY_LINK_FAILED, description: 'the isolated checkout could not be linked to central Ultra authority' }
591
630
  cli_subcommand: session spawn
592
631
  emits_events: [session_spawned]
593
632
  trace_to: '§7.3, D20, D33'
594
633
 
595
634
  - name: session.close
596
635
  family: session
597
- description: Close a session and release its lease.
636
+ description: Close a session and release its lease. Preserve the worktree by default; explicit cleanup succeeds only after Git proves it is clean and integrated.
598
637
  phase: '4.5'
599
638
  writer_role: mcp
600
639
  input_schema:
@@ -604,14 +643,19 @@ tools:
604
643
  properties:
605
644
  sid: { type: string }
606
645
  status: { type: string, enum: [completed, crashed, orphan] }
646
+ remove_worktree: { type: boolean, default: false }
607
647
  output_schema:
608
648
  type: object
609
- required: [ok]
649
+ required: [ok, worktree_preserved]
610
650
  additionalProperties: false
611
651
  properties:
612
652
  ok: { type: boolean }
653
+ worktree_preserved: { type: boolean }
613
654
  errors:
614
655
  - { code: SESSION_NOT_FOUND, description: 'sid unknown' }
656
+ - { code: WORKER_SESSION_PARENT_OWNED, description: 'an active worker must exit and let its supervising parent settle the lease' }
657
+ - { code: SESSION_SCOPE_VIOLATION, description: 'an active worker attempted to close a session it does not own' }
658
+ - { code: WORKTREE_NOT_INTEGRATED, description: 'Explicit cleanup refused because work is uncommitted, unverified, or not integrated into the current checkout' }
615
659
  cli_subcommand: session close
616
660
  emits_events: [session_closed, session_crashed, session_orphaned]
617
661
  trace_to: '§7.3, D32'
@@ -666,7 +710,7 @@ tools:
666
710
 
667
711
  - name: session.admission_check
668
712
  family: session
669
- description: Check whether spawning a new session for task_id is allowed (D33). Returns recommended action.
713
+ description: Check the same task, dependency, current-plan, staleness, breaker, and lease gates enforced by session.spawn. Returns a recommended lease action only after workflow authority is executable.
670
714
  phase: '4.5'
671
715
  readonly: true
672
716
  input_schema:
@@ -693,6 +737,12 @@ tools:
693
737
  enum: [spawn, takeover, resume, abandon, blocked_by_breaker]
694
738
  errors:
695
739
  - { code: TASK_NOT_FOUND, description: 'task id missing' }
740
+ - { code: TASK_EXECUTION_CONTRACT_INCOMPLETE, description: 'change-owned task contract is incomplete' }
741
+ - { code: WORKFLOW_TASK_NOT_EXECUTABLE, description: 'task status or staleness blocks execution' }
742
+ - { code: TASK_DEPENDENCIES_INCOMPLETE, description: 'one or more task dependencies have not converged' }
743
+ - { code: WORKFLOW_PLAN_NOT_COMPLETED, description: 'owning change has no healthy completed plan workflow' }
744
+ - { code: WORKFLOW_PLAN_TASK_SET_STALE, description: 'change task set differs from the current converged plan' }
745
+ - { code: WORKFLOW_PLAN_TASK_CONTRACT_STALE, description: 'task contract differs from the current converged plan' }
696
746
  cli_subcommand: session admission
697
747
  emits_events: []
698
748
  trace_to: '§7.3, D33'
@@ -932,6 +982,7 @@ tools:
932
982
  errors:
933
983
  - { code: BASELINE_NOT_FOUND, description: 'baseline id does not exist' }
934
984
  - { code: BASELINE_NOT_MUTABLE, description: 'ready and superseded baselines are immutable' }
985
+ - { code: BASELINE_GIT_HEAD_REQUIRED, description: 'Git is initialized but the owner-authorized initial checkpoint commit does not exist' }
935
986
  - { code: BASELINE_SPEC_MISSING, description: 'a declared specification file does not exist' }
936
987
  - { code: BASELINE_SCOPE_MISSING, description: 'a selected baseline scope does not exist' }
937
988
  - { code: PROVIDER_CONTENT_FORBIDDEN, description: 'provider payload content must remain external' }
@@ -995,7 +1046,7 @@ tools:
995
1046
  # ────────────────────────── change family ──────────────────────────────
996
1047
  - name: change.create
997
1048
  family: change
998
- description: Create a continuous feature, fix, redesign, or incident change unit and its initial context manifest; incidents also register a five-section diagnosis artifact.
1049
+ description: Capture a continuous feature, fix, redesign, or incident change contract; incidents also register a five-section diagnosis artifact. Planning context is compiled separately.
999
1050
  phase: '9'
1000
1051
  writer_role: mcp
1001
1052
  input_schema:
@@ -1115,7 +1166,7 @@ tools:
1115
1166
  properties:
1116
1167
  change: { type: object }
1117
1168
  intent_path: { type: string }
1118
- context_manifest_path: { type: string }
1169
+ context_manifest_path: { type: ['string', 'null'] }
1119
1170
  workflow: { type: object }
1120
1171
  errors:
1121
1172
  - { code: DUPLICATE_CHANGE_ID, description: 'change id already exists' }
@@ -1129,11 +1180,11 @@ tools:
1129
1180
  - { code: CHANGE_PROFILE_ESCALATION_REQUIRED, description: 'quick profile conflicts with material risk or research' }
1130
1181
  - { code: CHANGE_ALIGNMENT_REQUIRED, description: 'declared alignment thread is missing, unconfirmed, stale, not artifact-bound, bound to another authority, or not scoped to the current baseline' }
1131
1182
  cli_subcommand: change create
1132
- emits_events: [change_created, context_updated, workflow_started, workflow_step_updated]
1183
+ emits_events: [change_created, workflow_started, workflow_step_updated, workflow_completed]
1133
1184
 
1134
1185
  - name: change.update
1135
1186
  family: change
1136
- description: Update change intent, documentation impact, external provider metadata, or active status.
1187
+ description: Update mutable change authority. Semantic changes invalidate every derived task and compiled context so they must be reconciled before execution.
1137
1188
  phase: '9'
1138
1189
  writer_role: mcp
1139
1190
  input_schema:
@@ -1198,7 +1249,7 @@ tools:
1198
1249
  - { code: ILLEGAL_CHANGE_TRANSITION, description: 'change transition is not permitted' }
1199
1250
  - { code: PROVIDER_CONTENT_FORBIDDEN, description: 'provider payload content must remain external' }
1200
1251
  cli_subcommand: change update
1201
- emits_events: [change_updated]
1252
+ emits_events: [task_stale_marked, change_updated]
1202
1253
 
1203
1254
  - name: change.get
1204
1255
  family: change
@@ -1248,7 +1299,7 @@ tools:
1248
1299
 
1249
1300
  - name: change.context
1250
1301
  family: change
1251
- description: Compile an immutable role-scoped Context Spine snapshot whose execution seam and next action are derived from authoritative task and workflow state.
1302
+ description: Compile an immutable role-scoped Context Spine snapshot with authoritative readiness and allowed or required transitions. A host may attach a clearly non-authoritative recommendation.
1252
1303
  phase: '10'
1253
1304
  writer_role: mcp
1254
1305
  input_schema:
@@ -1300,6 +1351,13 @@ tools:
1300
1351
  revision: { type: string }
1301
1352
  indexed_head: { type: string }
1302
1353
  status: { type: string, enum: [available, unavailable, fresh, stale, unknown] }
1354
+ recommendation:
1355
+ type: object
1356
+ required: [workflow, rationale]
1357
+ additionalProperties: false
1358
+ properties:
1359
+ workflow: { type: string, minLength: 1 }
1360
+ rationale: { type: string, minLength: 3 }
1303
1361
  code_graph:
1304
1362
  type: object
1305
1363
  required: [provider]
@@ -1326,14 +1384,14 @@ tools:
1326
1384
  - { code: TASK_NOT_FOUND, description: 'task id is not linked to the change' }
1327
1385
  - { code: EXECUTION_CONTRACT_CONFLICT, description: 'Prompt input attempted to override the DB-backed task seam or verification command' }
1328
1386
  - { code: EXECUTION_CONTEXT_REFS_CONFLICT, description: 'Prompt input attempted to override DB-backed task context references' }
1329
- - { code: CONTEXT_NEXT_ACTION_AUTHORITY_VIOLATION, description: 'next action is derived from workflow and task state and cannot be supplied by Prompt input' }
1387
+ - { code: CONTEXT_LEGACY_NEXT_ACTION_UNSUPPORTED, description: 'a canonical next action is not an MCP authority field; use a non-authoritative host recommendation' }
1330
1388
  - { code: PROVIDER_CONTENT_FORBIDDEN, description: 'provider payload content must remain external' }
1331
1389
  cli_subcommand: change context
1332
1390
  emits_events: [context_updated]
1333
1391
 
1334
1392
  - name: change.breadcrumb
1335
1393
  family: change
1336
- description: Read the compact DB-derived Context Spine position, readiness, and single recommended next action.
1394
+ description: Read the compact DB-derived Context Spine position, readiness, allowed transitions, and any mechanically required recovery transition.
1337
1395
  phase: '10'
1338
1396
  readonly: true
1339
1397
  writer_role: any
@@ -1775,7 +1833,7 @@ tools:
1775
1833
  # ────────────────────────── workflow family ────────────────────────────
1776
1834
  - name: workflow.start
1777
1835
  family: workflow
1778
- description: Start one durable Ultra workflow run from its canonical step definition. Research defaults to the complete seventeen-step flow and never infers a reduced product posture.
1836
+ description: Start one durable Ultra workflow run. For full or adoption research, the host model must disposition every semantic coverage area without being forced to execute every area.
1779
1837
  phase: '13'
1780
1838
  writer_role: mcp
1781
1839
  input_schema:
@@ -1788,6 +1846,20 @@ tools:
1788
1846
  subject: { type: string, minLength: 3 }
1789
1847
  mode: { type: string, enum: [full, adoption, product, feature, architecture, custom] }
1790
1848
  selected_steps: { type: array, uniqueItems: true, items: { type: string } }
1849
+ coverage:
1850
+ type: array
1851
+ minItems: 1
1852
+ items:
1853
+ type: object
1854
+ required: [step_id, disposition, rationale]
1855
+ additionalProperties: false
1856
+ properties:
1857
+ step_id: { type: string, minLength: 1 }
1858
+ disposition: { type: string, enum: [execute, verify_existing, reuse, not_applicable, deferred] }
1859
+ rationale: { type: string, minLength: 3 }
1860
+ evidence_refs: { type: array, uniqueItems: true, items: { type: string, minLength: 1 } }
1861
+ accepted_by: { type: string, minLength: 1 }
1862
+ consequence: { type: string, minLength: 3 }
1791
1863
  baseline_id: { type: string }
1792
1864
  change_id: { type: string }
1793
1865
  task_id: { type: string }
@@ -1805,10 +1877,24 @@ tools:
1805
1877
  - { code: WORKFLOW_CHANGE_NOT_FOUND, description: 'the requested change authority does not exist' }
1806
1878
  - { code: WORKFLOW_CHANGE_RUN_REQUIRED, description: 'change-bound stages require the owning durable change workflow; legacy gaps route through doctor repair' }
1807
1879
  - { code: WORKFLOW_BASELINE_MISMATCH, description: 'a supplied stage baseline differs from the baseline bound by the owning change workflow' }
1880
+ - { code: WORKFLOW_BASELINE_NOT_READY, description: 'the baseline bound to the change is no longer ready' }
1808
1881
  - { code: WORKFLOW_BASELINE_REQUIRED, description: 'a baseline-free plan is valid only for an approved incident break-glass change' }
1809
1882
  - { code: WORKFLOW_CHANGE_NOT_MUTABLE, description: 'the owning change does not accept a new workflow of this stage' }
1883
+ - { code: WORKFLOW_AUTHORITY_REQUIRED, description: 'the workflow is missing its required baseline, change, or task authority' }
1884
+ - { code: WORKFLOW_CHANGE_DECISION_BLOCKING, description: 'the change contains unresolved material owner decisions' }
1885
+ - { code: WORKFLOW_CHANGE_RESEARCH_INCOMPLETE, description: 'the change-bound research disposition is not current and complete' }
1886
+ - { code: WORKFLOW_RESEARCH_COVERAGE_REQUIRED, description: 'full and adoption research require a disposition for every semantic area' }
1887
+ - { code: WORKFLOW_RESEARCH_COVERAGE_EVIDENCE_REQUIRED, description: 'reuse, verification, and not-applicable dispositions require evidence references' }
1888
+ - { code: WORKFLOW_RESEARCH_SYNTHESIS_REQUIRED, description: 'research synthesis must execute, verify, or reuse durable evidence' }
1889
+ - { code: WORKFLOW_RESEARCH_MODE_MISMATCH, description: 'the selected research mode does not match its authority or baseline mode' }
1890
+ - { code: WORKFLOW_SELECTION_REASON_REQUIRED, description: 'bounded research requires an explicit owner-selected scope reason' }
1810
1891
  - { code: TASK_EXECUTION_CONTRACT_INCOMPLETE, description: 'dev cannot start until the linked task contract is executable' }
1811
1892
  - { code: TASK_CHANGE_OWNERSHIP_MISMATCH, description: 'linked task and change authority disagree' }
1893
+ - { code: TASK_DEPENDENCIES_INCOMPLETE, description: 'dev cannot start while a task dependency remains incomplete' }
1894
+ - { code: WORKFLOW_TASK_NOT_EXECUTABLE, description: 'the linked task status or stale marker forbids execution' }
1895
+ - { code: WORKFLOW_PLAN_NOT_COMPLETED, description: 'dev requires a completed current change plan' }
1896
+ - { code: WORKFLOW_PLAN_TASK_SET_STALE, description: 'the authoritative task set changed after plan convergence' }
1897
+ - { code: WORKFLOW_PLAN_TASK_CONTRACT_STALE, description: 'a task contract was invalidated or changed after plan convergence' }
1812
1898
  cli_subcommand: workflow start
1813
1899
  emits_events: [workflow_started]
1814
1900
 
@@ -1926,8 +2012,11 @@ tools:
1926
2012
  workflow: { type: object }
1927
2013
  errors:
1928
2014
  - { code: WORKFLOW_NOT_FOUND, description: 'workflow id does not exist' }
2015
+ - { code: WORKFLOW_NOT_MUTABLE, description: 'completed and cancelled workflows cannot accept step updates' }
1929
2016
  - { code: WORKFLOW_STEP_NOT_FOUND, description: 'step is not part of the canonical workflow' }
2017
+ - { code: ILLEGAL_WORKFLOW_STEP_TRANSITION, description: 'the requested step-state transition is not permitted' }
1930
2018
  - { code: WORKFLOW_STEP_OUT_OF_ORDER, description: 'an earlier selected step remains incomplete' }
2019
+ - { code: VALIDATION_ERROR, description: 'step evidence, output, decision, semantic, or blocker input is malformed' }
1931
2020
  - { code: WORKFLOW_EVIDENCE_REQUIRED, description: 'the step cannot complete without evidence' }
1932
2021
  - { code: WORKFLOW_OUTPUT_REQUIRED, description: 'the step cannot complete without a durable output' }
1933
2022
  - { code: WORKFLOW_OUTPUT_MISSING, description: 'a declared output file is missing' }
@@ -1936,20 +2025,27 @@ tools:
1936
2025
  - { code: WORKFLOW_RESEARCH_SYNTHESIS_INCOMPLETE, description: 'full or adoption synthesis did not bind all baseline specifications and the distillate' }
1937
2026
  - { code: WORKFLOW_SEMANTIC_RECORDS_REQUIRED, description: 'a research step did not persist typed semantic results' }
1938
2027
  - { code: WORKFLOW_SEMANTIC_RECORD_INVALID, description: 'a semantic record does not satisfy its step contract' }
2028
+ - { code: WORKFLOW_SEMANTIC_SOURCE_INVALID, description: 'a semantic record source is missing, outside the project, or lacks an anchor' }
1939
2029
  - { code: WORKFLOW_SYNTHESIS_TRACE_INVALID, description: 'synthesis references missing research semantic records' }
1940
2030
  - { code: WORKFLOW_BLOCKER_REQUIRED, description: 'blocked state requires a specific blocker code' }
1941
- - { code: WORKFLOW_CONTEXT_OUTPUT_REQUIRED, description: 'the stage requires its immutable Context Manifest v2 output' }
2031
+ - { code: WORKFLOW_CONTEXT_OUTPUT_REQUIRED, description: 'the stage requires its immutable Context Manifest v3 output' }
1942
2032
  - { code: WORKFLOW_CONTEXT_MISMATCH, description: 'the context role, gate, change, task, or readiness does not match the stage' }
1943
2033
  - { code: WORKFLOW_CONTEXT_AUTHORITY_MISMATCH, description: 'the context artifact does not match its DB snapshot row' }
1944
2034
  - { code: WORKFLOW_CONTEXT_STALE, description: 'the context artifact no longer matches the current checkout' }
1945
- - { code: WORKFLOW_RELEASE_AUTHORIZATION_INVALID, description: 'release-if-authorized requires one complete durable owner decision' }
2035
+ - { code: WORKFLOW_TASKS_REQUIRED, description: 'the stage requires at least one task bound to the change' }
2036
+ - { code: WORKFLOW_TASK_NOT_COMPLETED, description: 'the required task development state has not converged' }
2037
+ - { code: WORKFLOW_GATE_MISSING, description: 'a required completed dev, test, or review gate is missing' }
2038
+ - { code: WORKFLOW_GATE_STALE, description: 'a required task or gate no longer matches current authority or checkout state' }
2039
+ - { code: WORKFLOW_REVIEW_NOT_APPROVED, description: 'the required independent review axes have not passed' }
2040
+ - { code: WORKFLOW_TEST_NOT_PASSED, description: 'the required current test gate has not passed' }
2041
+ - { code: WORKFLOW_SESSION_ACTIVE, description: 'delivery is blocked while a bound execution session remains active' }
1946
2042
  - { code: DECISION_ALIGNMENT_BLOCKING, description: 'matching owner decisions or artifact checkpoints are not current' }
1947
2043
  cli_subcommand: workflow step
1948
2044
  emits_events: [workflow_step_updated, workflow_blocked]
1949
2045
 
1950
2046
  - name: workflow.complete
1951
2047
  family: workflow
1952
- description: Complete a ready workflow only when every selected step is complete and every recorded output digest remains current.
2048
+ description: Complete a ready workflow only when every selected step is complete and every recorded output digest remains current. Plan approval is optional unless the host identified a material owner decision.
1953
2049
  phase: '13'
1954
2050
  writer_role: mcp
1955
2051
  input_schema:
@@ -1976,12 +2072,21 @@ tools:
1976
2072
  - { code: WORKFLOW_NOT_FOUND, description: 'workflow id does not exist' }
1977
2073
  - { code: WORKFLOW_NOT_READY, description: 'selected steps or blockers remain incomplete' }
1978
2074
  - { code: WORKFLOW_OUTPUT_STALE, description: 'a recorded output changed or disappeared' }
2075
+ - { code: VALIDATION_ERROR, description: 'approval or completion input is malformed' }
1979
2076
  - { code: WORKFLOW_TASKS_REQUIRED, description: 'plan completion requires a non-empty authoritative task set' }
2077
+ - { code: TASK_NOT_FOUND, description: 'a task referenced by the authoritative plan no longer exists' }
1980
2078
  - { code: TASK_EXECUTION_CONTRACT_INCOMPLETE, description: 'one or more planned tasks lack an executable contract' }
2079
+ - { code: TASK_CHANGE_OWNERSHIP_MISMATCH, description: 'a planned task is not owned by the workflow change' }
1981
2080
  - { code: TASK_DEPENDENCY_MISSING, description: 'a planned dependency does not exist' }
1982
2081
  - { code: TASK_DEPENDENCY_CYCLE, description: 'the planned task graph contains a cycle' }
2082
+ - { code: WORKFLOW_PLAN_ARTIFACT_INVALID, description: 'the plan workflow did not produce exactly one valid JSON execution plan' }
2083
+ - { code: WORKFLOW_PLAN_ARTIFACT_STALE, description: 'the execution-plan artifact differs from current DB task authority' }
2084
+ - { code: WORKFLOW_PLAN_COVERAGE_INCOMPLETE, description: 'one or more accepted change outcomes have no executable task coverage' }
2085
+ - { code: WORKFLOW_PLAN_ORPHAN_TASK, description: 'a task trace does not resolve to accepted change or research authority' }
2086
+ - { code: WORKFLOW_PLAN_TASK_CONTRACT_STALE, description: 'a task was invalidated or changed before plan convergence' }
2087
+ - { code: WORKFLOW_QUICK_PLAN_TOO_LARGE, description: 'a quick change contains more than one executable task' }
1983
2088
  - { code: WORKFLOW_TASK_NOT_COMPLETED, description: 'dev convergence requires its task to be completed' }
1984
- - { code: WORKFLOW_APPROVAL_REQUIRED, description: 'plan convergence requires explicit approved_by and approval_note fields' }
2089
+ - { code: WORKFLOW_APPROVAL_REQUIRED, description: 'when optional plan approval is supplied it requires approved_by and approval_note fields' }
1985
2090
  - { code: WORKFLOW_SUMMARY_AUTHORITY_VIOLATION, description: 'Prompt summary fields are not allowed to replace DB-derived gate evidence or the complete change task set' }
1986
2091
  - { code: WORKFLOW_APPROVAL_AUTHORITY_VIOLATION, description: 'only the plan workflow accepts completion approval' }
1987
2092
  - { code: WORKFLOW_GATE_MISSING, description: 'a required completed dev, test, or review gate is missing' }
@@ -1990,10 +2095,22 @@ tools:
1990
2095
  - { code: WORKFLOW_REPORT_CONTEXT_MISMATCH, description: 'a report is not bound to the recorded stage context digest' }
1991
2096
  - { code: WORKFLOW_REPORT_REVISION_STALE, description: 'a report does not match the current full Git HEAD' }
1992
2097
  - { code: WORKFLOW_REPORT_WORKTREE_STALE, description: 'a report does not match the current worktree digest' }
2098
+ - { code: WORKFLOW_REPORT_TASK_SET_STALE, description: 'a report task set no longer matches the authoritative execution scope' }
2099
+ - { code: WORKFLOW_REPORT_BASELINE_MISMATCH, description: 'a report no longer matches current baseline authority' }
2100
+ - { code: WORKFLOW_REPORT_CHANGE_MISMATCH, description: 'a report is bound to a different change' }
2101
+ - { code: WORKFLOW_REPORT_VERDICT_CONFLICT, description: 'the declared verdict conflicts with failures or blocking evidence' }
2102
+ - { code: WORKFLOW_VERIFICATION_PROFILE_INVALID, description: 'the selected verification dimensions or exclusion rationale are invalid' }
2103
+ - { code: WORKFLOW_REGRESSION_SIGNAL_MISSING, description: 'a reported regression fix lacks a failing-before signal' }
2104
+ - { code: WORKFLOW_REVIEW_MODE_MISMATCH, description: 'the review summary scope differs from the workflow scope' }
2105
+ - { code: WORKFLOW_REVIEW_EVIDENCE_MISMATCH, description: 'the review worker roster differs from persisted specialist artifacts' }
2106
+ - { code: WORKFLOW_REVIEW_FINDINGS_MISMATCH, description: 'the unified review findings differ from specialist evidence' }
1993
2107
  - { code: WORKFLOW_REVIEW_NOT_APPROVED, description: 'both independent review axes must pass' }
1994
2108
  - { code: WORKFLOW_TEST_NOT_PASSED, description: 'the current change-level test gate did not pass' }
2109
+ - { code: WORKFLOW_SESSION_ACTIVE, description: 'delivery cannot converge while an execution session remains active' }
2110
+ - { code: WORKFLOW_CONTEXT_NOT_READY, description: 'delivery evidence lacks a current ready context manifest' }
2111
+ - { code: WORKFLOW_DELIVERY_CHECK_FAILED, description: 'one or more local delivery checks did not pass' }
1995
2112
  - { code: WORKFLOW_CHANGE_NOT_ARCHIVED, description: 'delivery completion requires an archived change' }
1996
- - { code: WORKFLOW_RELEASE_AUTHORITY_MISMATCH, description: 'delivery release claims differ from the durable owner authorization decision' }
2113
+ - { code: WORKFLOW_RELEASE_AUTHORITY_MISMATCH, description: 'a local delivery report attempted to claim external release authority' }
1997
2114
  - { code: DECISION_ALIGNMENT_BLOCKING, description: 'matching owner decisions or artifact checkpoints are not current' }
1998
2115
  cli_subcommand: workflow complete
1999
2116
  emits_events: [workflow_completed, plan_approved]
@@ -5,7 +5,7 @@
5
5
  "type": "object",
6
6
  "required": [
7
7
  "$schema", "change_id", "archive_status", "baseline_id", "baseline_status",
8
- "git_commit", "worktree_digest", "context_digest", "checks", "release", "rollback", "timestamp"
8
+ "git_commit", "worktree_digest", "context_digest", "checks", "rollback", "timestamp"
9
9
  ],
10
10
  "additionalProperties": false,
11
11
  "properties": {
@@ -41,51 +41,6 @@
41
41
  ]
42
42
  }
43
43
  },
44
- "release": {
45
- "type": "object",
46
- "required": ["authorized", "performed", "evidence"],
47
- "additionalProperties": false,
48
- "properties": {
49
- "authorized": { "type": "boolean" },
50
- "performed": { "type": "boolean" },
51
- "evidence": {
52
- "type": "array",
53
- "items": {
54
- "type": "object",
55
- "required": ["kind", "reference", "status", "evidence"],
56
- "additionalProperties": false,
57
- "properties": {
58
- "kind": { "enum": ["commit", "push", "tag", "registry", "deploy", "release", "other"] },
59
- "reference": { "type": "string", "minLength": 1 },
60
- "status": { "const": "pass" },
61
- "evidence": { "type": "string", "minLength": 1 }
62
- }
63
- }
64
- },
65
- "version": { "type": "string" },
66
- "tag": { "type": "string" },
67
- "commit": { "type": "string" },
68
- "registry": { "type": "string" },
69
- "remote": { "type": "string" }
70
- },
71
- "allOf": [
72
- {
73
- "if": { "properties": { "authorized": { "const": true } } },
74
- "then": {
75
- "properties": {
76
- "performed": { "const": true },
77
- "evidence": { "minItems": 1 }
78
- }
79
- },
80
- "else": {
81
- "properties": {
82
- "performed": { "const": false },
83
- "evidence": { "maxItems": 0 }
84
- }
85
- }
86
- }
87
- ]
88
- },
89
44
  "rollback": { "type": ["string", "null"] },
90
45
  "timestamp": { "type": ["string", "null"], "format": "date-time" }
91
46
  },
@@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS baselines (
29
29
  repository_revision TEXT,
30
30
  repository_branch TEXT,
31
31
  worktree_state TEXT NOT NULL DEFAULT 'unavailable'
32
- CHECK (worktree_state IN ('clean', 'dirty', 'unavailable')),
32
+ CHECK (worktree_state IN ('clean', 'dirty', 'unborn', 'unavailable')),
33
33
  worktree_digest TEXT,
34
34
  worktree_files_json TEXT NOT NULL DEFAULT '[]',
35
35
  worktree_accepted INTEGER NOT NULL DEFAULT 0 CHECK (worktree_accepted IN (0, 1)),
@@ -252,7 +252,9 @@ CREATE TABLE IF NOT EXISTS context_snapshots (
252
252
  CHECK (role IN ('plan', 'implement', 'check', 'review')),
253
253
  gate TEXT NOT NULL DEFAULT 'alignment'
254
254
  CHECK (gate IN ('alignment', 'planning', 'implementation', 'verification', 'review', 'convergence', 'recovery')),
255
- next_action TEXT NOT NULL DEFAULT 'Resolve the next Ultra workflow action.',
255
+ next_action TEXT NOT NULL DEFAULT '',
256
+ allowed_transitions_json TEXT NOT NULL DEFAULT '[]',
257
+ required_transition TEXT,
256
258
  readiness TEXT NOT NULL DEFAULT 'ready'
257
259
  CHECK (readiness IN ('ready', 'blocked')),
258
260
  blockers_json TEXT NOT NULL DEFAULT '[]',
@@ -486,3 +488,7 @@ INSERT OR IGNORE INTO schema_version (version, description)
486
488
  VALUES ('15.0', 'Typed research semantics, complete change contracts, verified learning application, and reconciliation provenance');
487
489
  INSERT OR IGNORE INTO schema_version (version, description)
488
490
  VALUES ('16.0', 'Durable one-question decision dialogue, owner checkpoints, and workflow alignment gates');
491
+ INSERT OR IGNORE INTO schema_version (version, description)
492
+ VALUES ('17.0', 'Explicit unborn Git authority and owner-authorized baseline checkpoints');
493
+ INSERT OR IGNORE INTO schema_version (version, description)
494
+ VALUES ('18.0', 'Adaptive capability transitions, independent initialization, and recoverable workflow migration');
@@ -6,7 +6,7 @@
6
6
  "required": [
7
7
  "$schema", "change_id", "task_ids", "git_commit", "worktree_digest",
8
8
  "context_digest", "acceptance", "commands", "public_seams", "failures",
9
- "recovery", "verification_dimensions", "regression_signal", "passed", "run_count",
9
+ "recovery", "verification_profile", "verification_dimensions", "regression_signal", "passed", "run_count",
10
10
  "timestamp", "blocking_issues"
11
11
  ],
12
12
  "additionalProperties": false,
@@ -93,12 +93,36 @@
93
93
  }
94
94
  }
95
95
  },
96
+ "verification_profile": {
97
+ "type": "object",
98
+ "required": ["rationale", "selected_dimensions", "excluded_dimensions"],
99
+ "additionalProperties": false,
100
+ "properties": {
101
+ "rationale": { "type": "string", "minLength": 3 },
102
+ "selected_dimensions": {
103
+ "type": "array",
104
+ "minItems": 1,
105
+ "uniqueItems": true,
106
+ "contains": { "const": "acceptance" },
107
+ "items": { "$ref": "#/$defs/verificationDimensionName" }
108
+ },
109
+ "excluded_dimensions": {
110
+ "type": "array",
111
+ "items": {
112
+ "type": "object",
113
+ "required": ["dimension", "rationale"],
114
+ "additionalProperties": false,
115
+ "properties": {
116
+ "dimension": { "$ref": "#/$defs/verificationDimensionName" },
117
+ "rationale": { "type": "string", "minLength": 3 }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ },
96
123
  "verification_dimensions": {
97
124
  "type": "object",
98
- "required": [
99
- "acceptance", "regression", "integration", "static_analysis",
100
- "build", "performance", "security", "recovery"
101
- ],
125
+ "required": ["acceptance"],
102
126
  "additionalProperties": false,
103
127
  "properties": {
104
128
  "acceptance": { "$ref": "#/$defs/verificationDimension" },
@@ -131,12 +155,19 @@
131
155
  "blocking_issues": { "type": "array", "items": { "type": "string" } }
132
156
  },
133
157
  "$defs": {
158
+ "verificationDimensionName": {
159
+ "type": "string",
160
+ "enum": [
161
+ "acceptance", "regression", "integration", "static_analysis",
162
+ "build", "performance", "security", "recovery"
163
+ ]
164
+ },
134
165
  "verificationDimension": {
135
166
  "type": "object",
136
167
  "required": ["status", "evidence", "rationale"],
137
168
  "additionalProperties": false,
138
169
  "properties": {
139
- "status": { "enum": ["pass", "fail", "not_run", "not_applicable"] },
170
+ "status": { "enum": ["pass", "fail", "not_run"] },
140
171
  "evidence": {
141
172
  "type": "array",
142
173
  "items": { "type": "string", "minLength": 1 }
@@ -174,14 +205,14 @@
174
205
  "recovery": { "items": { "properties": { "status": { "const": "pass" } } } },
175
206
  "verification_dimensions": {
176
207
  "properties": {
177
- "acceptance": { "properties": { "status": { "enum": ["pass", "not_applicable"] } } },
178
- "regression": { "properties": { "status": { "enum": ["pass", "not_applicable"] } } },
179
- "integration": { "properties": { "status": { "enum": ["pass", "not_applicable"] } } },
180
- "static_analysis": { "properties": { "status": { "enum": ["pass", "not_applicable"] } } },
181
- "build": { "properties": { "status": { "enum": ["pass", "not_applicable"] } } },
182
- "performance": { "properties": { "status": { "enum": ["pass", "not_applicable"] } } },
183
- "security": { "properties": { "status": { "enum": ["pass", "not_applicable"] } } },
184
- "recovery": { "properties": { "status": { "enum": ["pass", "not_applicable"] } } }
208
+ "acceptance": { "properties": { "status": { "const": "pass" } } },
209
+ "regression": { "properties": { "status": { "const": "pass" } } },
210
+ "integration": { "properties": { "status": { "const": "pass" } } },
211
+ "static_analysis": { "properties": { "status": { "const": "pass" } } },
212
+ "build": { "properties": { "status": { "const": "pass" } } },
213
+ "performance": { "properties": { "status": { "const": "pass" } } },
214
+ "security": { "properties": { "status": { "const": "pass" } } },
215
+ "recovery": { "properties": { "status": { "const": "pass" } } }
185
216
  }
186
217
  },
187
218
  "run_count": { "minimum": 1 },
@@ -38,7 +38,7 @@ SUBCOMMANDS:
38
38
  system doctor [--repair] | restore | rebaseline
39
39
  status [--cost] [--since <duration>] [--json]
40
40
  db init | checkpoint | vacuum | integrity | backup (Phase 2)
41
- migrate --from=<4.4|4.5> --to=<4.5|16.0> [--dry|--rollback]
41
+ migrate --from=<4.4|4.5> --to=<4.5|18.0> [--dry|--rollback]
42
42
  legacy-memory inspect | archive | prune --confirm DELETE_ULTRA_LEGACY_MEMORY
43
43
 
44
44
  --help / -h show this message