ultra-builder-pro-cli 0.15.0 → 0.16.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 (42) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/README.md +18 -11
  3. package/adapters/_shared/handbook.cjs +2 -1
  4. package/commands/ultra-change.md +1 -1
  5. package/commands/ultra-plan.md +1 -1
  6. package/commands/ultra-research.md +1 -1
  7. package/commands/ultra-think.md +2 -2
  8. package/docs/AGENT-CONTEXT.md +30 -13
  9. package/docs/ARCHITECTURE.md +24 -4
  10. package/docs/PLAN.zh-CN.md +3 -2
  11. package/docs/ROADMAP.md +5 -3
  12. package/docs/RUNTIME-COMPAT-MATRIX.md +4 -4
  13. package/docs/STATE-DB-ACCESS-POLICY.md +8 -6
  14. package/docs/USER-HANDBOOK-CONTRACT.md +8 -2
  15. package/docs/WORKFLOW-LIFECYCLE.md +89 -13
  16. package/mcp-server/lib/change-workflow.cjs +52 -4
  17. package/mcp-server/lib/context-spine.cjs +65 -3
  18. package/mcp-server/lib/decision-dialogue.cjs +713 -0
  19. package/mcp-server/lib/doctor.cjs +9 -0
  20. package/mcp-server/lib/project-breadcrumb.cjs +9 -0
  21. package/mcp-server/lib/state-db.cjs +29 -6
  22. package/mcp-server/lib/workflow-state.cjs +13 -0
  23. package/mcp-server/server.cjs +54 -0
  24. package/package.json +1 -1
  25. package/skills/ultra-change/SKILL.md +41 -12
  26. package/skills/ultra-deliver/SKILL.md +10 -3
  27. package/skills/ultra-dev/SKILL.md +11 -3
  28. package/skills/ultra-doctor/SKILL.md +10 -0
  29. package/skills/ultra-init/SKILL.md +6 -1
  30. package/skills/ultra-plan/SKILL.md +25 -5
  31. package/skills/ultra-research/SKILL.md +38 -23
  32. package/skills/ultra-review/SKILL.md +9 -3
  33. package/skills/ultra-status/SKILL.md +8 -4
  34. package/skills/ultra-test/SKILL.md +9 -3
  35. package/skills/ultra-think/SKILL.md +26 -12
  36. package/skills/ultra-think/references/decision-dialogue.md +130 -0
  37. package/spec/cli-protocol.md +11 -2
  38. package/spec/mcp-tools.yaml +299 -1
  39. package/spec/schemas/mcp-tools.schema.json +1 -1
  40. package/spec/schemas/state-db.sql +58 -0
  41. package/ultra-tools/cli.cjs +1 -1
  42. package/ultra-tools/commands/status.cjs +15 -0
@@ -18,8 +18,9 @@ One axis cannot compensate for the other.
18
18
  1. Read `references/review-modes.md`. Select exactly one review mode: `task` for one
19
19
  implementation slice, `change` for aggregate delivery readiness, or `plan` for an
20
20
  approved plan before implementation. Bind only the evidence defined by that mode.
21
- 2. Resolve one explicit diff range, current full HEAD, change, task set, and accepted
22
- evidence. Stop on an empty or ambiguous scope.
21
+ 2. Resolve one explicit diff range, current full HEAD, change, task set, accepted
22
+ evidence, and decision checkpoint state. Stop on an empty or ambiguous scope or an
23
+ unconfirmed alignment checkpoint.
23
24
  3. Resume or start a `review` workflow. Record `bind-diff` with revision, paths, mode,
24
25
  and task set.
25
26
  4. Compile `change.context` for `review` using only accepted intent, delta, task
@@ -50,6 +51,8 @@ Record:
50
51
  The coordinator preserves every specialist finding unchanged in `SUMMARY.json`.
51
52
  Duplicate root causes may be grouped only in the human-readable summary. Review is
52
53
  read-only except for review artifacts; implementation fixes are a separate dev action.
54
+ If a finding exposes a new owner choice, preserve it as a finding and route the primary
55
+ agent to `ultra-think`; a review worker must not open, answer, or hide that decision.
53
56
 
54
57
  ## Verify and complete
55
58
 
@@ -62,4 +65,7 @@ coordinator summary cannot replace either axis. Any code, test, spec, or contrac
62
65
  invalidates affected review evidence and requires a new or resumed run.
63
66
 
64
67
  Return both axis verdicts first, blocking findings, reviewed revision and paths,
65
- artifact digests, workflow id, skipped-role rationale, and one exact next route.
68
+ artifact digests, workflow id, skipped-role rationale, and one exact next route. A
69
+ blocking implementation finding returns to `ultra-dev`; stale verification returns to
70
+ `ultra-test`; a new owner choice returns to `ultra-think`; an approved current change
71
+ review routes to `ultra-deliver`.
@@ -13,10 +13,12 @@ projections.
13
13
  1. Call `system.doctor` with repair disabled.
14
14
  2. Call `baseline.get` for classification, readiness, revision, worktree, spec digests,
15
15
  research provenance, gaps, and blockers.
16
- 3. Call `workflow.list`, then `workflow.get` for every active, blocked, or ready run.
17
- 4. Call `change.breadcrumb`, `change.list`, `task.list`, and `session.list`.
18
- 5. Inspect current Git branch, full HEAD, and worktree without mutation.
19
- 6. Read test, review, and delivery artifacts only when referenced by DB workflow state;
16
+ 3. Call `decision.list`, then `decision.get` for the current active or checkpoint-ready
17
+ thread. Expose only its current question or checkpoint, not the hidden history.
18
+ 4. Call `workflow.list`, then `workflow.get` for every active, blocked, or ready run.
19
+ 5. Call `change.breadcrumb`, `change.list`, `task.list`, and `session.list`.
20
+ 6. Inspect current Git branch, full HEAD, and worktree without mutation.
21
+ 7. Read test, review, and delivery artifacts only when referenced by DB workflow state;
20
22
  compare their recorded digest and revision with current authority.
21
23
 
22
24
  If state is unreadable, report that panel unavailable and route to `ultra-doctor`.
@@ -27,6 +29,7 @@ Never fall back to generated task JSON, raw SQLite queries, or context frontmatt
27
29
  Prefer the breadcrumb and durable workflow position:
28
30
 
29
31
  - state integrity, schema, projection, or installed-asset failure: `ultra-doctor`;
32
+ - open decision or checkpoint: `ultra-think` with its exact decision id;
30
33
  - missing project or migrated compatibility authority: `ultra-init`;
31
34
  - active/blocked research: `ultra-research` at its exact `current_step`;
32
35
  - ready research with unconverged baseline: finalize research, record, approve, and
@@ -49,6 +52,7 @@ Report:
49
52
  Ultra: <healthy|degraded> · <branch>@<head> · worktree <clean|dirty>
50
53
  Baseline: <mode>/<status> · research=<run/status> · gaps=<open>/<blocking>
51
54
  Workflow: <kind/id/status> · step=<current|finalize> · outputs=<fresh|stale>
55
+ Decision: <id/phase|checkpoint|none> · thread=<id/status>
52
56
  Change: <id/status|none> · Task: <id/status|none> · Sessions: <active>
53
57
  Evidence: test=<state> · review=<two axes> · delivery=<state>
54
58
  Blockers: <specific codes or none>
@@ -10,8 +10,10 @@ or use generated task JSON as authority.
10
10
 
11
11
  ## Bind and execute
12
12
 
13
- 1. Read `system.doctor`, `change.breadcrumb`, authoritative tasks, completed dev runs,
14
- current HEAD/diff, and prior test report freshness.
13
+ 1. Read `system.doctor`, `change.breadcrumb`, active decision state, authoritative
14
+ tasks, completed dev runs, current HEAD/diff, and prior test report freshness. An
15
+ open decision or unconfirmed checkpoint blocks testing claims and routes to
16
+ `ultra-think`.
15
17
  2. Resume or start a `test` workflow linked to the change and optional task. Record
16
18
  `bind-scope` with the exact revision, task set, and acceptance ids.
17
19
  3. Compile `change.context` for `check`; record `compile-context` only when required
@@ -26,6 +28,8 @@ or use generated task JSON as authority.
26
28
  Use real boundaries where practical. A test double is acceptable at a costly or
27
29
  nondeterministic external boundary only when the report explains why it preserves the
28
30
  contract. Reject tautologies, hidden skips, weakened assertions, and unconsumed code.
31
+ When evidence reveals an unresolved product decision, report the exact consequence and
32
+ route it to the decision dialogue; testing must not silently select the desired result.
29
33
 
30
34
  ## Report and converge
31
35
 
@@ -49,4 +53,6 @@ completion.
49
53
 
50
54
  Return the workflow id, revision, pass/fail result, exact checks, verified seams,
51
55
  blocking failures, report path/digest, and one route to fix, `ultra-review`, or
52
- `ultra-deliver`.
56
+ `ultra-deliver`. A failed implementation contract returns to `ultra-dev`; a new owner
57
+ choice returns to `ultra-think`; a passing current change without current aggregate
58
+ review routes to `ultra-review`.
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  name: ultra-think
3
- description: Produce an evidence-bounded recommendation or diagnosis for a consequential technical or product question. Use when the decision has material tradeoffs, uncertainty, or failure risk that benefits from explicit stress testing.
3
+ description: Resolve a consequential product or technical question through evidence-first analysis or a resumable one-decision-at-a-time owner dialogue. Use when tradeoffs, ambiguity, diagnosis, or failure risk require shared understanding before research, planning, or implementation proceeds.
4
4
  ---
5
5
 
6
- # Analyze a consequential question
6
+ # Align on a consequential question
7
7
 
8
- Use the smallest reasoning structure that resolves the user's actual decision. Answer
9
- simple questions directly; do not turn every request into a framework exercise.
8
+ Use the smallest reasoning structure that resolves the user's actual decision. Answer a
9
+ simple self-contained question directly. For a project-bound or multi-turn decision,
10
+ read `references/decision-dialogue.md` and use its durable protocol.
10
11
 
11
- ## Workflow
12
+ ## Establish evidence
12
13
 
13
14
  1. State the decision, observed symptom, or disputed claim and the constraints that
14
- could change the answer. Ask only for missing information that materially affects
15
- the result.
15
+ could change the answer.
16
16
  2. Gather evidence from the most authoritative available source:
17
17
  - current checkout and runtime for repository claims;
18
18
  - official primary documentation for product or API behavior;
@@ -31,8 +31,19 @@ simple questions directly; do not turn every request into a framework exercise.
31
31
  - likely failure scenario and recovery;
32
32
  - load-bearing assumption;
33
33
  - meaningful second-order effect.
34
- 7. Return the recommendation or diagnosis, evidence, uncertainty, what would change
35
- the conclusion, and the smallest verification step.
34
+ 7. Decide whether the question is now answerable or still requires owner authority.
35
+
36
+ ## Route the result
37
+
38
+ - For an answerable read-only question, return the recommendation or diagnosis,
39
+ decisive evidence, uncertainty, what would change the conclusion, and one smallest
40
+ verification step.
41
+ - For a load-bearing owner decision, bind or resume a decision thread, open the one
42
+ earliest decision, present it using the shared protocol, and STOP.
43
+ - After an answer, normalize it through `decision.resolve`, `decision.delegate`, or
44
+ `decision.defer`; never store the conversation transcript.
45
+ - At a phase boundary, prepare the checkpoint, obtain approval, bind current artifact
46
+ digests when project-bound, and only then return control to the invoking workflow.
36
47
 
37
48
  ## Output
38
49
 
@@ -46,6 +57,9 @@ Adapt the response to the question. Include:
46
57
  Use a comparison table only when several alternatives share the same decision
47
58
  criteria. Comparisons are an analysis tool, not a required output section.
48
59
 
49
- This skill is read-only unless the user separately authorizes writing an analysis
50
- artifact. It does not update Ultra state, implement the recommendation, or replace an
51
- independent review.
60
+ Unbound analysis is read-only. A project-bound dialogue may write only decision state
61
+ and explicitly approved checkpoint artifacts. It does not implement the decision or
62
+ replace research, planning, testing, or independent review. After a confirmed
63
+ checkpoint, return to the exact invoking `ultra-init`, `ultra-research`, `ultra-change`,
64
+ `ultra-plan`, `ultra-dev`, `ultra-test`, `ultra-review`, or `ultra-deliver` run and
65
+ current step; never choose a new route from conversation history.
@@ -0,0 +1,130 @@
1
+ # Decision dialogue protocol
2
+
3
+ Use this protocol when an Ultra workflow reaches a load-bearing owner decision. Keep
4
+ fact acquisition autonomous and decision authority explicit. Do not use it for facts
5
+ that repository, runtime, tests, or primary sources can answer.
6
+
7
+ ## Select the interaction depth
8
+
9
+ - `guided`: ask every unresolved decision that changes accepted product intent, scope,
10
+ public behavior, security, material cost, compatibility, delivery semantics, or
11
+ recovery. Use for initial research and major changes.
12
+ - `fast`: ask only unresolved one-way-door or materially expensive decisions. Decide
13
+ reversible implementation detail inside accepted constraints. Use for bounded daily
14
+ work.
15
+ - `autonomous`: use only after the owner explicitly delegates reversible decisions.
16
+ Preserve the delegation, selected result, rationale, and guardrails.
17
+ - `diagnostic`: acquire evidence and distinguish falsifiable hypotheses before asking
18
+ for a recovery or product decision.
19
+
20
+ Do not ask a meta-question about mode when the user's request or current change profile
21
+ already determines the appropriate depth.
22
+
23
+ ## Separate evidence from decisions
24
+
25
+ Before asking:
26
+
27
+ 1. Inspect current authority, repository, runtime, tests, and relevant primary sources.
28
+ 2. Resolve factual unknowns yourself when evidence is obtainable.
29
+ 3. Separate `Observed`, `Verified`, `Decided`, and `Unknown`.
30
+ 4. Identify the earliest unresolved decision on which later decisions depend.
31
+ 5. Form a private candidate queue, but expose only its current item. Do not dump the
32
+ backlog, a questionnaire, or every research step.
33
+
34
+ If more evidence can resolve the current uncertainty, perform that research first. If
35
+ the user says they do not know, convert the gap into a bounded validation action rather
36
+ than pressuring them to guess.
37
+
38
+ ## Bind durable authority
39
+
40
+ For a project-bound dialogue:
41
+
42
+ 1. Call `decision.list` and resume the matching `active` or `checkpoint_ready` thread.
43
+ 2. Otherwise call `decision.thread_start` with one baseline, change, or workflow
44
+ binding, a concise purpose, and the selected mode. Never store raw prompts or
45
+ transcripts.
46
+ 3. Call `decision.open` for exactly one decision. Include:
47
+ - why it must be decided now;
48
+ - the evidence-backed recommendation;
49
+ - zero to three credible alternatives with their net tradeoff;
50
+ - evidence references;
51
+ - the contract, artifact, gate, or task effects;
52
+ - whether deferral blocks progress.
53
+
54
+ Do not encode future questions as open decisions. Re-evaluate the next candidate after
55
+ each answer so the dialogue adapts instead of following a static questionnaire.
56
+
57
+ ## Present one decision and stop
58
+
59
+ Use a compact shape adapted to the user's language:
60
+
61
+ ```text
62
+ Decision <position when known>: <question>
63
+ Why now: <one sentence>
64
+ Recommendation: <choice or next validation> — <reason>
65
+ Options: <only credible alternatives and their net tradeoff>
66
+ Effect: <what this answer changes>
67
+ ```
68
+
69
+ Ask one question only. Do not combine dependent questions, append a second request, or
70
+ continue into analysis, planning, edits, or another workflow step. End the turn and
71
+ wait. This STOP is mandatory even when the likely answer seems obvious.
72
+
73
+ ## Normalize the answer
74
+
75
+ On the next turn:
76
+
77
+ - When the answer is unambiguous, briefly reflect the normalized decision and its
78
+ durable effect, then call `decision.resolve` with the decision, rationale, and owner.
79
+ - When the user says "you decide", select the reversible result within stated bounds
80
+ and call `decision.delegate` with the explicit delegation, result, rationale, and
81
+ guardrails. Never represent delegation as a direct owner decision.
82
+ - When the user defers, call `decision.defer` with the reason, consequence, and revisit
83
+ condition. A blocking deferral remains a gate.
84
+ - When the answer is ambiguous, ask one clarification for the same decision; do not
85
+ infer a product choice from tone or partial wording.
86
+ - When evidence or owner intent changes a resolved decision, call
87
+ `decision.supersede`. Preserve the prior record and open one replacement question.
88
+
89
+ Do not require a redundant confirmation after a clear answer. The owner can correct
90
+ the compact reflection; phase checkpoint approval is the durable confirmation.
91
+
92
+ ## Checkpoint before projection
93
+
94
+ After a coherent cluster of decisions or a phase boundary:
95
+
96
+ 1. Call `decision.checkpoint` with `action: "prepare"` and a compact shared
97
+ understanding. Open or blocking-deferred decisions must prevent preparation.
98
+ 2. Present only accepted decisions, unresolved consequences, and the artifacts that
99
+ will change. Ask for one checkpoint approval and STOP.
100
+ 3. After approval, update the target specification, Change Contract, delta, or plan
101
+ from normalized decisions. Do not write conversation transcripts.
102
+ 4. Call `decision.checkpoint` with `action: "confirm"`, owner approval, and the current
103
+ artifact paths. MCP binds their digests. A change- or workflow-bound thread must
104
+ bind at least one artifact. When a shared specification will continue evolving,
105
+ bind a stable decision projection under `.ultra/docs/decisions/<thread-id>.md`
106
+ instead of a mutable draft that would immediately become stale. Only a standalone
107
+ baseline thinking thread may use an explicit no-artifact reason.
108
+ 5. Re-read the confirmed thread. Only then may the linked workflow complete the gated
109
+ step or move to another phase.
110
+
111
+ If a bound artifact changes while the normalized decisions remain valid, prepare the
112
+ same thread again, show the changed effect, obtain one new checkpoint approval, and
113
+ confirm the current digest. Do not invent a replacement decision merely to refresh an
114
+ artifact. If the decision itself changed, use supersession instead.
115
+
116
+ Start a new thread for a new decision cluster. Supersede an old item only when the old
117
+ decision itself changed.
118
+
119
+ ## Keep the user surface small
120
+
121
+ At each turn show only:
122
+
123
+ - the current decision or checkpoint;
124
+ - the decisive evidence and recommendation;
125
+ - the effect of the answer;
126
+ - optionally the number of already resolved decisions.
127
+
128
+ Provide the hidden evidence inventory, all semantic steps, or full report paths only
129
+ when requested. Context and token budgets are advisory; they never justify omitting
130
+ load-bearing evidence or refusing legitimate work.
@@ -114,6 +114,15 @@ as a fallback unless `ultra-tools <family> --help` lists it.
114
114
  | `change.learning_resolve` | `change learning-resolve` | 10 | mcp |
115
115
  | `change.converge` | `change converge` | 9 | mcp |
116
116
  | `change.archive` | `change archive` | 9 | mcp |
117
+ | `decision.thread_start` | `decision thread-start` | 16 | mcp |
118
+ | `decision.get` | `decision get` | 16 | any |
119
+ | `decision.list` | `decision list` | 16 | any |
120
+ | `decision.open` | `decision open` | 16 | mcp |
121
+ | `decision.resolve` | `decision resolve` | 16 | mcp |
122
+ | `decision.delegate` | `decision delegate` | 16 | mcp |
123
+ | `decision.defer` | `decision defer` | 16 | mcp |
124
+ | `decision.supersede` | `decision supersede` | 16 | mcp |
125
+ | `decision.checkpoint` | `decision checkpoint` | 16 | mcp |
117
126
  | `workflow.start` | `workflow start` | 13 | mcp |
118
127
  | `workflow.get` | `workflow get` | 13 | any |
119
128
  | `workflow.list` | `workflow list` | 13 | any |
@@ -126,12 +135,12 @@ as a fallback unless `ultra-tools <family> --help` lists it.
126
135
  Current executable maintenance surfaces are `task init-project`,
127
136
  `session close|get|list|admission|heartbeat|subscribe|reap`, `status`, `db`,
128
137
  `migrate`, `system doctor|restore|rebaseline`, and `legacy-memory`. In particular, `task create|update|list|get`
129
- and all `change` lifecycle verbs are not CLI fallbacks. Change state must use
138
+ and all `change` and `decision` lifecycle verbs are not CLI fallbacks. Change and decision state must use
130
139
  the live MCP server; `system doctor` may additionally be exposed by the
131
140
  maintenance CLI because it is the recovery path when MCP startup is degraded.
132
141
  `task init-project --resume` preserves existing `.ultra` files and installs only
133
142
  missing current scaffold assets. Projection-only state uses the supported
134
- `migrate --from=4.4 --to=4.5` or `--from=4.5 --to=15.0` transition before resume.
143
+ `migrate --from=4.4 --to=4.5` or the current supported state-schema transition before resume.
135
144
  `system doctor --repair` applies supported schema upgrades with a pre-migration
136
145
  backup before mechanical recovery.
137
146
  `system restore` requires the exact `REPLACE_CORRUPT_ULTRA_STATE` confirmation and a
@@ -3,7 +3,7 @@
3
3
  # Validated by spec/schemas/mcp-tools.schema.json (run `npm run test:spec`).
4
4
  # Trace: PLAN §7.3, decisions D12 / D29 / D31-D34.
5
5
 
6
- version: '1.2'
6
+ version: '1.3'
7
7
 
8
8
  info:
9
9
  title: Ultra Builder Pro MCP tool contracts
@@ -25,6 +25,7 @@ families:
25
25
  - { name: plan, description: 'execution-plan artifact export and query (D34)', phase: '8a' }
26
26
  - { name: baseline, description: 'project adoption, baseline evidence, convergence, and drift authority', phase: '11' }
27
27
  - { name: change, description: 'continuous post-delivery change lifecycle and convergence', phase: '9' }
28
+ - { name: decision, description: 'durable owner-agent alignment, one-question presentation, and approved checkpoints', phase: '16' }
28
29
  - { name: workflow, description: 'durable cross-stage run position, evidence, outputs, blockers, and recovery', phase: '13' }
29
30
  - { name: system, description: 'read-only diagnostics and explicit backup-first repair', phase: '9' }
30
31
 
@@ -1064,6 +1065,7 @@ tools:
1064
1065
  mode: { type: ['string', 'null'], enum: [product, feature, architecture, custom, null] }
1065
1066
  selected_steps: { type: array, uniqueItems: true, items: { type: string, minLength: 1 } }
1066
1067
  rationale: { type: string, minLength: 1 }
1068
+ alignment_thread_id: { type: string, description: 'confirmed decision checkpoint that produced this change contract' }
1067
1069
  base_commit: { type: string, pattern: '^[0-9a-f]{7,40}$' }
1068
1070
  baseline_bypass:
1069
1071
  type: object
@@ -1125,6 +1127,7 @@ tools:
1125
1127
  - { code: CHANGE_CLASSIFICATION_REQUIRED, description: 'classification rationale or risk flags are incomplete' }
1126
1128
  - { code: CHANGE_RESEARCH_DISPOSITION_REQUIRED, description: 'research routing is incomplete or inconsistent' }
1127
1129
  - { code: CHANGE_PROFILE_ESCALATION_REQUIRED, description: 'quick profile conflicts with material risk or research' }
1130
+ - { 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' }
1128
1131
  cli_subcommand: change create
1129
1132
  emits_events: [change_created, context_updated, workflow_started, workflow_step_updated]
1130
1133
 
@@ -1476,6 +1479,299 @@ tools:
1476
1479
  cli_subcommand: change archive
1477
1480
  emits_events: [change_archived]
1478
1481
 
1482
+ # ────────────────────────── decision family ────────────────────────────
1483
+ - name: decision.thread_start
1484
+ family: decision
1485
+ description: Start one durable owner-agent alignment thread bound to baseline, change, or workflow authority.
1486
+ phase: '16'
1487
+ writer_role: mcp
1488
+ input_schema:
1489
+ type: object
1490
+ required: [id, purpose]
1491
+ additionalProperties: false
1492
+ properties:
1493
+ id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
1494
+ purpose: { type: string, minLength: 3 }
1495
+ mode: { type: string, enum: [guided, fast, autonomous, diagnostic], default: guided }
1496
+ baseline_id: { type: string }
1497
+ change_id: { type: string }
1498
+ workflow_run_id: { type: string }
1499
+ output_schema:
1500
+ type: object
1501
+ required: [thread]
1502
+ additionalProperties: false
1503
+ properties:
1504
+ thread: { type: object }
1505
+ errors:
1506
+ - { code: DECISION_AUTHORITY_REQUIRED, description: 'thread has no baseline, change, or workflow authority' }
1507
+ - { code: DECISION_AUTHORITY_MISMATCH, description: 'thread authority differs from its workflow binding' }
1508
+ - { code: DECISION_THREAD_IN_PROGRESS, description: 'the same authority and purpose already has an active thread' }
1509
+ - { code: DUPLICATE_DECISION_THREAD, description: 'decision thread id already exists' }
1510
+ - { code: VALIDATION_ERROR, description: 'thread input is incomplete or invalid' }
1511
+ cli_subcommand: decision thread-start
1512
+ emits_events: [decision_thread_started]
1513
+
1514
+ - name: decision.get
1515
+ family: decision
1516
+ description: Read one decision thread with its current question, normalized decisions, and checkpoint authority.
1517
+ phase: '16'
1518
+ readonly: true
1519
+ input_schema:
1520
+ type: object
1521
+ required: [id]
1522
+ additionalProperties: false
1523
+ properties:
1524
+ id: { type: string }
1525
+ output_schema:
1526
+ type: object
1527
+ required: [thread]
1528
+ additionalProperties: false
1529
+ properties:
1530
+ thread: { type: object }
1531
+ errors:
1532
+ - { code: DECISION_THREAD_NOT_FOUND, description: 'decision thread id does not exist' }
1533
+ cli_subcommand: decision get
1534
+ emits_events: []
1535
+
1536
+ - name: decision.list
1537
+ family: decision
1538
+ description: List durable decision threads by authority, mode, or lifecycle state for recovery and status reporting.
1539
+ phase: '16'
1540
+ readonly: true
1541
+ input_schema:
1542
+ type: object
1543
+ additionalProperties: false
1544
+ properties:
1545
+ status: { type: string, enum: [active, checkpoint_ready, confirmed, cancelled] }
1546
+ mode: { type: string, enum: [guided, fast, autonomous, diagnostic] }
1547
+ baseline_id: { type: string }
1548
+ change_id: { type: string }
1549
+ workflow_run_id: { type: string }
1550
+ limit: { type: integer, minimum: 1, maximum: 500, default: 100 }
1551
+ output_schema:
1552
+ type: object
1553
+ required: [threads, count]
1554
+ additionalProperties: false
1555
+ properties:
1556
+ threads: { type: array, items: { type: object } }
1557
+ count: { type: integer, minimum: 0 }
1558
+ errors:
1559
+ - { code: STATE_DB_ERROR, description: 'decision thread state could not be read' }
1560
+ cli_subcommand: decision list
1561
+ emits_events: []
1562
+
1563
+ - name: decision.open
1564
+ family: decision
1565
+ description: Open the sole user-facing decision in a thread with evidence, recommendation, credible alternatives, and durable effects.
1566
+ phase: '16'
1567
+ writer_role: mcp
1568
+ input_schema:
1569
+ type: object
1570
+ required: [id, thread_id, phase, question, why_now, recommendation, effects]
1571
+ additionalProperties: false
1572
+ properties:
1573
+ id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
1574
+ thread_id: { type: string }
1575
+ phase: { type: string, minLength: 1 }
1576
+ question: { type: string, minLength: 1 }
1577
+ why_now: { type: string, minLength: 1 }
1578
+ recommendation: { type: string, minLength: 1 }
1579
+ options:
1580
+ type: array
1581
+ maxItems: 3
1582
+ items: &decision_option
1583
+ type: object
1584
+ required: [id, label, tradeoff]
1585
+ additionalProperties: false
1586
+ properties:
1587
+ id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
1588
+ label: { type: string, minLength: 1 }
1589
+ tradeoff: { type: string, minLength: 1 }
1590
+ evidence_refs: { type: array, uniqueItems: true, items: { type: string, minLength: 1 } }
1591
+ dependency_ids: { type: array, uniqueItems: true, items: { type: string, minLength: 1 } }
1592
+ effects: { type: object, minProperties: 1 }
1593
+ blocking: { type: boolean, default: true }
1594
+ output_schema:
1595
+ type: object
1596
+ required: [thread]
1597
+ additionalProperties: false
1598
+ properties:
1599
+ thread: { type: object }
1600
+ errors:
1601
+ - { code: DECISION_THREAD_NOT_FOUND, description: 'decision thread id does not exist' }
1602
+ - { code: DECISION_ALREADY_OPEN, description: 'another decision is already awaiting an answer' }
1603
+ - { code: DECISION_CHECKPOINT_PENDING, description: 'the prepared checkpoint must be confirmed or revised first' }
1604
+ - { code: DECISION_DEPENDENCY_UNRESOLVED, description: 'a declared decision dependency is unresolved' }
1605
+ - { code: DUPLICATE_DECISION_ID, description: 'decision item id already exists' }
1606
+ - { code: VALIDATION_ERROR, description: 'question, recommendation, options, evidence, or effects are invalid' }
1607
+ cli_subcommand: decision open
1608
+ emits_events: [decision_opened]
1609
+
1610
+ - name: decision.resolve
1611
+ family: decision
1612
+ description: Resolve the current question as an explicit normalized owner decision without storing the conversation transcript.
1613
+ phase: '16'
1614
+ writer_role: mcp
1615
+ input_schema:
1616
+ type: object
1617
+ required: [id, decision, rationale, decided_by]
1618
+ additionalProperties: false
1619
+ properties:
1620
+ id: { type: string }
1621
+ decision: { type: string, minLength: 1 }
1622
+ rationale: { type: string, minLength: 1 }
1623
+ decided_by: { type: string, minLength: 1 }
1624
+ output_schema:
1625
+ type: object
1626
+ required: [thread]
1627
+ additionalProperties: false
1628
+ properties:
1629
+ thread: { type: object }
1630
+ errors:
1631
+ - { code: DECISION_NOT_FOUND, description: 'decision item id does not exist' }
1632
+ - { code: DECISION_NOT_OPEN, description: 'decision item is no longer awaiting an answer' }
1633
+ - { code: VALIDATION_ERROR, description: 'normalized owner decision is incomplete' }
1634
+ cli_subcommand: decision resolve
1635
+ emits_events: [decision_resolved]
1636
+
1637
+ - name: decision.delegate
1638
+ family: decision
1639
+ description: Record explicit owner delegation for a reversible decision, including the selected result and non-negotiable guardrails.
1640
+ phase: '16'
1641
+ writer_role: mcp
1642
+ input_schema:
1643
+ type: object
1644
+ required: [id, delegated_to, decision, rationale, guardrails]
1645
+ additionalProperties: false
1646
+ properties:
1647
+ id: { type: string }
1648
+ delegated_to: { type: string, minLength: 1 }
1649
+ decision: { type: string, minLength: 1 }
1650
+ rationale: { type: string, minLength: 1 }
1651
+ guardrails: { type: array, minItems: 1, uniqueItems: true, items: { type: string, minLength: 1 } }
1652
+ output_schema:
1653
+ type: object
1654
+ required: [thread]
1655
+ additionalProperties: false
1656
+ properties:
1657
+ thread: { type: object }
1658
+ errors:
1659
+ - { code: DECISION_NOT_FOUND, description: 'decision item id does not exist' }
1660
+ - { code: DECISION_NOT_OPEN, description: 'decision item is no longer awaiting an answer' }
1661
+ - { code: VALIDATION_ERROR, description: 'delegation result or guardrails are incomplete' }
1662
+ cli_subcommand: decision delegate
1663
+ emits_events: [decision_resolved]
1664
+
1665
+ - name: decision.defer
1666
+ family: decision
1667
+ description: Defer the current decision with explicit consequences and a deterministic condition for revisiting it.
1668
+ phase: '16'
1669
+ writer_role: mcp
1670
+ input_schema:
1671
+ type: object
1672
+ required: [id, reason, consequences, revisit_condition]
1673
+ additionalProperties: false
1674
+ properties:
1675
+ id: { type: string }
1676
+ reason: { type: string, minLength: 1 }
1677
+ consequences: { type: string, minLength: 1 }
1678
+ revisit_condition: { type: string, minLength: 1 }
1679
+ output_schema:
1680
+ type: object
1681
+ required: [thread]
1682
+ additionalProperties: false
1683
+ properties:
1684
+ thread: { type: object }
1685
+ errors:
1686
+ - { code: DECISION_NOT_FOUND, description: 'decision item id does not exist' }
1687
+ - { code: DECISION_NOT_OPEN, description: 'decision item is no longer awaiting an answer' }
1688
+ - { code: VALIDATION_ERROR, description: 'deferral consequence or revisit condition is incomplete' }
1689
+ cli_subcommand: decision defer
1690
+ emits_events: [decision_resolved]
1691
+
1692
+ - name: decision.supersede
1693
+ family: decision
1694
+ description: Preserve a prior resolved decision and reopen alignment with one replacement question when evidence or owner intent changes.
1695
+ phase: '16'
1696
+ writer_role: mcp
1697
+ input_schema:
1698
+ type: object
1699
+ required: [id, reason, replacement]
1700
+ additionalProperties: false
1701
+ properties:
1702
+ id: { type: string }
1703
+ reason: { type: string, minLength: 1 }
1704
+ replacement:
1705
+ type: object
1706
+ required: [id, phase, question, why_now, recommendation, effects]
1707
+ additionalProperties: false
1708
+ properties:
1709
+ id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
1710
+ phase: { type: string, minLength: 1 }
1711
+ question: { type: string, minLength: 1 }
1712
+ why_now: { type: string, minLength: 1 }
1713
+ recommendation: { type: string, minLength: 1 }
1714
+ options: { type: array, maxItems: 3, items: *decision_option }
1715
+ evidence_refs: { type: array, uniqueItems: true, items: { type: string, minLength: 1 } }
1716
+ dependency_ids: { type: array, uniqueItems: true, items: { type: string, minLength: 1 } }
1717
+ effects: { type: object, minProperties: 1 }
1718
+ blocking: { type: boolean, default: true }
1719
+ output_schema:
1720
+ type: object
1721
+ required: [thread]
1722
+ additionalProperties: false
1723
+ properties:
1724
+ thread: { type: object }
1725
+ errors:
1726
+ - { code: DECISION_NOT_FOUND, description: 'decision item id does not exist' }
1727
+ - { code: DECISION_NOT_SUPERSEDEABLE, description: 'decision item cannot be revised from its current state' }
1728
+ - { code: DECISION_ALREADY_OPEN, description: 'another decision is already awaiting an answer' }
1729
+ - { code: VALIDATION_ERROR, description: 'replacement question or revision reason is invalid' }
1730
+ cli_subcommand: decision supersede
1731
+ emits_events: [decision_opened]
1732
+
1733
+ - name: decision.checkpoint
1734
+ family: decision
1735
+ description: Prepare or confirm a decision checkpoint, including renewal of unchanged decisions against current artifacts; change- and workflow-bound threads require an artifact, while a standalone baseline thread may record an explicit no-artifact reason.
1736
+ phase: '16'
1737
+ writer_role: mcp
1738
+ input_schema:
1739
+ type: object
1740
+ required: [id, action]
1741
+ additionalProperties: false
1742
+ properties:
1743
+ id: { type: string }
1744
+ action: { type: string, enum: [prepare, confirm] }
1745
+ summary: { type: string, minLength: 1 }
1746
+ approved_by: { type: string, minLength: 1 }
1747
+ approval_note: { type: string, minLength: 3 }
1748
+ artifacts:
1749
+ type: array
1750
+ items:
1751
+ type: object
1752
+ required: [path, kind]
1753
+ additionalProperties: false
1754
+ properties:
1755
+ path: { type: string, minLength: 1 }
1756
+ kind: { type: string, minLength: 1 }
1757
+ no_artifact_reason: { type: string, minLength: 3 }
1758
+ output_schema:
1759
+ type: object
1760
+ required: [thread]
1761
+ additionalProperties: false
1762
+ properties:
1763
+ thread: { type: object }
1764
+ errors:
1765
+ - { code: DECISION_THREAD_NOT_FOUND, description: 'decision thread id does not exist' }
1766
+ - { code: DECISION_THREAD_NOT_MUTABLE, description: 'cancelled decision thread cannot be checkpointed' }
1767
+ - { code: DECISION_ALIGNMENT_BLOCKING, description: 'an open or deferred blocking decision prevents checkpointing' }
1768
+ - { code: DECISION_CHECKPOINT_STALE, description: 'prepared decision digest no longer matches current authority' }
1769
+ - { code: DECISION_ARTIFACT_REQUIRED, description: 'confirmation lacks required artifact bindings; no-artifact reasons are allowed only for standalone baseline thinking' }
1770
+ - { code: DECISION_ARTIFACT_MISSING, description: 'a declared checkpoint artifact does not exist' }
1771
+ - { code: VALIDATION_ERROR, description: 'checkpoint action, approval, or artifact input is invalid' }
1772
+ cli_subcommand: decision checkpoint
1773
+ emits_events: [decision_checkpoint_prepared, decision_checkpoint_confirmed]
1774
+
1479
1775
  # ────────────────────────── workflow family ────────────────────────────
1480
1776
  - name: workflow.start
1481
1777
  family: workflow
@@ -1647,6 +1943,7 @@ tools:
1647
1943
  - { code: WORKFLOW_CONTEXT_AUTHORITY_MISMATCH, description: 'the context artifact does not match its DB snapshot row' }
1648
1944
  - { code: WORKFLOW_CONTEXT_STALE, description: 'the context artifact no longer matches the current checkout' }
1649
1945
  - { code: WORKFLOW_RELEASE_AUTHORIZATION_INVALID, description: 'release-if-authorized requires one complete durable owner decision' }
1946
+ - { code: DECISION_ALIGNMENT_BLOCKING, description: 'matching owner decisions or artifact checkpoints are not current' }
1650
1947
  cli_subcommand: workflow step
1651
1948
  emits_events: [workflow_step_updated, workflow_blocked]
1652
1949
 
@@ -1697,6 +1994,7 @@ tools:
1697
1994
  - { code: WORKFLOW_TEST_NOT_PASSED, description: 'the current change-level test gate did not pass' }
1698
1995
  - { code: WORKFLOW_CHANGE_NOT_ARCHIVED, description: 'delivery completion requires an archived change' }
1699
1996
  - { code: WORKFLOW_RELEASE_AUTHORITY_MISMATCH, description: 'delivery release claims differ from the durable owner authorization decision' }
1997
+ - { code: DECISION_ALIGNMENT_BLOCKING, description: 'matching owner decisions or artifact checkpoints are not current' }
1700
1998
  cli_subcommand: workflow complete
1701
1999
  emits_events: [workflow_completed, plan_approved]
1702
2000