ultra-builder-pro-cli 0.22.0 → 0.24.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 (93) hide show
  1. package/.ultra-template/docs/research/README.md +4 -4
  2. package/CHANGELOG.md +83 -0
  3. package/README.md +68 -35
  4. package/adapters/_shared/codex-assets.cjs +121 -60
  5. package/adapters/_shared/interaction-contract.cjs +20 -7
  6. package/adapters/_shared/provenance.cjs +7 -2
  7. package/adapters/_shared/runtime-assets.cjs +4 -3
  8. package/adapters/_shared/runtime-native.cjs +132 -0
  9. package/adapters/claude.js +61 -31
  10. package/adapters/codex.js +178 -81
  11. package/adapters/grok.js +372 -0
  12. package/adapters/kimi.js +8 -4
  13. package/adapters/opencode.js +211 -33
  14. package/agents/code-reviewer.md +4 -2
  15. package/agents/debugger.md +4 -1
  16. package/agents/review-code.md +7 -3
  17. package/agents/review-comments.md +7 -4
  18. package/agents/review-coordinator.md +11 -7
  19. package/agents/review-design.md +8 -4
  20. package/agents/review-errors.md +8 -4
  21. package/agents/review-spec.md +8 -5
  22. package/agents/review-tests.md +7 -4
  23. package/agents/tdd-runner.md +5 -2
  24. package/bin/install.js +9 -4
  25. package/bin/orchestrator.js +4 -13
  26. package/docs/AGENT-CONTEXT.md +141 -231
  27. package/docs/ARCHITECTURE.md +203 -498
  28. package/docs/ARTIFACT-AUTHORITY.md +38 -35
  29. package/docs/PLUGIN-ISOLATION-CONTRACT.md +12 -9
  30. package/docs/ROADMAP.md +85 -110
  31. package/docs/RUNTIME-COMPAT-MATRIX.md +139 -174
  32. package/docs/SKILL-AUTHORING.md +3 -3
  33. package/docs/STATE-DB-ACCESS-POLICY.md +25 -20
  34. package/docs/WORKFLOW-LIFECYCLE.md +174 -442
  35. package/hooks/README.md +11 -8
  36. package/hooks/active_task_context.py +16 -16
  37. package/hooks/adapters/grok.py +134 -0
  38. package/hooks/{context_spine.py → context_envelope.py} +26 -22
  39. package/hooks/health_check.py +19 -29
  40. package/hooks/pre_stop_check.py +22 -12
  41. package/hooks/subagent_tracker.py +1 -1
  42. package/hooks/workflow_checkpoint.py +14 -13
  43. package/hooks/workflow_context.py +11 -12
  44. package/hooks/workflow_resume.py +14 -13
  45. package/mcp-server/{breadcrumb.cjs → hook-context.cjs} +7 -9
  46. package/mcp-server/lib/artifact-registry.cjs +25 -1
  47. package/mcp-server/lib/baseline-workflow.cjs +36 -38
  48. package/mcp-server/lib/canonical-json.cjs +19 -0
  49. package/mcp-server/lib/change-workflow.cjs +637 -49
  50. package/mcp-server/lib/context-envelope.cjs +508 -0
  51. package/mcp-server/lib/decision-records.cjs +337 -0
  52. package/mcp-server/lib/doctor.cjs +91 -33
  53. package/mcp-server/lib/init-project.cjs +78 -39
  54. package/mcp-server/lib/managed-file-write.cjs +116 -0
  55. package/mcp-server/lib/plan-checkpoint.cjs +177 -0
  56. package/mcp-server/lib/project-context.cjs +178 -0
  57. package/mcp-server/lib/stage-checkpoints.cjs +309 -0
  58. package/mcp-server/lib/state-db.cjs +155 -24
  59. package/mcp-server/lib/task-ledger.cjs +522 -13
  60. package/mcp-server/lib/ultra-facade.cjs +834 -0
  61. package/mcp-server/lib/worker-packet.cjs +358 -0
  62. package/mcp-server/server.cjs +208 -1059
  63. package/orchestrator/daemon.cjs +27 -9
  64. package/orchestrator/parallel-orchestrator.cjs +111 -76
  65. package/orchestrator/session-runner.cjs +135 -34
  66. package/package.json +10 -3
  67. package/skills/ultra-change/SKILL.md +39 -98
  68. package/skills/ultra-deliver/SKILL.md +42 -65
  69. package/skills/ultra-dev/SKILL.md +52 -99
  70. package/skills/ultra-doctor/SKILL.md +35 -57
  71. package/skills/ultra-init/SKILL.md +48 -88
  72. package/skills/ultra-init/references/brownfield-adoption.md +11 -8
  73. package/skills/ultra-plan/SKILL.md +54 -132
  74. package/skills/ultra-research/SKILL.md +58 -112
  75. package/skills/ultra-review/SKILL.md +28 -46
  76. package/skills/ultra-review/references/unified-schema.md +2 -0
  77. package/skills/ultra-review/scripts/review_wait.py +8 -0
  78. package/skills/ultra-status/SKILL.md +22 -45
  79. package/skills/ultra-test/SKILL.md +27 -61
  80. package/skills/ultra-think/SKILL.md +29 -48
  81. package/skills/ultra-think/references/interaction-boundary.md +56 -0
  82. package/spec/cli-protocol.md +80 -187
  83. package/spec/mcp-tools.yaml +130 -2738
  84. package/spec/schemas/mcp-tools.schema.json +1 -1
  85. package/spec/schemas/state-db.sql +107 -4
  86. package/spec/schemas/{task-ledger.v1.schema.json → task-ledger.v2.schema.json} +70 -6
  87. package/ultra-tools/commands/status.cjs +369 -243
  88. package/mcp-server/lib/context-spine.cjs +0 -1208
  89. package/mcp-server/lib/decision-dialogue.cjs +0 -1128
  90. package/mcp-server/lib/project-breadcrumb.cjs +0 -173
  91. package/mcp-server/lib/spec-learning.cjs +0 -284
  92. package/mcp-server/lib/workflow-state.cjs +0 -2965
  93. package/skills/ultra-think/references/decision-dialogue.md +0 -153
@@ -1,94 +1,54 @@
1
1
  ---
2
2
  name: ultra-init
3
- description: Create or recover Ultra project authority for a new repository, an existing codebase, or an older Ultra installation. Use when `.ultra` is absent, initialization is incomplete, or doctor reports a migration or initialization fault.
3
+ description: Create or recover Ultra project authority for a new repository, an existing codebase, or an older Ultra installation. Use when `.ultra` is absent, initialization is incomplete, or doctor reports a migration fault.
4
4
  ---
5
5
 
6
6
  # Initialize project authority
7
7
 
8
- Initialization is a bounded setup capability. It creates or repairs the repository and
9
- Ultra authority; it does not perform product research, approve a baseline, or choose
10
- the next semantic workflow.
11
-
12
- ## Inspect before mutation
13
-
14
- 1. Identify the repository root, existing `.ultra` state, Git state, meaningful source,
15
- monorepo boundaries, and current owner request.
16
- 2. If `.ultra/.runtime/state.db` exists, run `system.doctor` read-only and resume with
17
- `task.init_project` only when its report permits it.
18
- 3. Read the Git-facing team checkpoint when present. Never parse a legacy
19
- `.ultra/tasks/tasks.json` as current authority or edit it directly.
20
- 4. Otherwise call `task.init_project` with `mode: "auto"`, the project name, and an
21
- explicit scope only when the repository contains multiple plausible roots.
22
- 5. Leave `git_mode` as `auto` unless the user explicitly requires a non-Git workspace.
23
-
24
- Use repository evidence to classify:
25
-
26
- - `greenfield`: no meaningful delivered application behavior is present;
27
- - `brownfield`: source, runtime, API, data, deployment, or tests describe an existing
28
- maintained system;
29
- - `migrated`: older Ultra authority was preserved but is not a trusted baseline.
30
-
31
- The model may override an automatic classification only with evidence or an explicit
32
- user decision. Classification must not infer product scope, an MVP, or a release plan.
33
-
34
- ## Interaction boundary
35
-
36
- Read `../ultra-think/references/decision-dialogue.md` before asking a material question.
37
- Inspect observable facts yourself. Use the host's native question UI when available and
38
- plain direct interaction otherwise. Ask only when repository scope, replacement of
39
- healthy authority, destructive recovery, or another material owner decision is truly
40
- unresolved. Normalize clear intent already present in the request without asking again.
41
-
42
- ## Deterministic initialization contract
43
-
44
- `task.init_project` owns these steps:
45
-
46
- 1. `inspect-authority`
47
- 2. `classify-repository`
48
- 3. `scaffold-authority`
49
- 4. `verify-initialization`
50
-
51
- The operation must:
52
-
53
- - create or migrate `.ultra/.runtime/state.db` with a backup before schema migration;
54
- - install only missing scaffold assets on resume;
55
- - create an empty `.ultra/tasks/tasks.json` team checkpoint for a new project;
56
- - import a validated team checkpoint on clone or resume, while requiring
57
- checkout-local revalidation before an imported ready baseline can authorize work;
58
- - preserve existing artifacts and unrelated work;
59
- - preserve an existing Git repository and HEAD;
60
- - initialize Git and a safe `.gitignore` entry when Git is absent;
61
- - report an unborn repository as `initial_commit_required` without manufacturing a
62
- commit, remote, tag, or push;
63
- - read back the created DB, classification, local runtime projection, team checkpoint,
64
- and Git result before completing the init workflow.
65
-
66
- Projection-only projects must use the exact backup-first migration command returned by
67
- the runtime. On the first supported team-checkpoint publication, a matching legacy
68
- task projection is copied byte-for-byte into `.ultra/.runtime/backups/task-ledger/`
69
- before replacement; any task-id or durable-field mismatch stops with a typed conflict.
70
- A migrated compatibility baseline requires a new brownfield adoption with
71
- `replace_migrated: true`. Replacing a healthy baseline requires explicit replacement
72
- authority. Corrupt DB, WAL, SHM, and backups must be preserved until the user chooses
73
- a documented recovery operation.
74
-
75
- ## Completion and handoff
76
-
77
- Initialization is complete when the init workflow is `completed`, the current schema is
78
- healthy, the scaffold is readable, and repository classification and Git state are
79
- durable. Research status may still be `not_started`; that is not incomplete init.
80
-
81
- Read the returned `allowed_transitions` and `required_transition`:
82
-
83
- - a required transition represents a hard recovery invariant and must be followed;
84
- - otherwise the host model recommends among the allowed capabilities using the user's
85
- goal and current evidence;
86
- - never invoke another public Ultra workflow automatically; recommend the best allowed
87
- capability and wait for an explicit user invocation.
88
-
89
- Report classification, scope, schema and backup result, Git state, init workflow id,
90
- team-checkpoint import or revalidation state, baseline state, and allowed transitions.
91
- Do not claim that a baseline is ready until a separate research/adoption workflow has
92
- recorded and converged it in the current checkout.
93
-
94
- Never invoke the recommended capability here; wait for an explicit user invocation.
8
+ Initialization creates the repository-local Ultra authority. It does not perform
9
+ research, accept a product baseline, choose a Change, or start another public
10
+ capability.
11
+
12
+ ## Inspect and align
13
+
14
+ 1. Inspect the repository root, Git state, meaningful source, existing `.ultra`,
15
+ monorepo boundaries, and the current request.
16
+ 2. When authority already exists, call `ultra.doctor { repair: false }` and preserve
17
+ healthy state. Never replace or delete it merely to obtain a clean init.
18
+ 3. Classify the repository from evidence:
19
+ - `greenfield`: no meaningful delivered behavior exists;
20
+ - `brownfield`: source, runtime, API, data, deployment, or tests describe an
21
+ existing maintained system;
22
+ - `migrated`: older Ultra authority was preserved but is not yet a trusted baseline.
23
+ 4. Ask the owner only when scope, healthy-authority replacement, destructive recovery,
24
+ or another material choice cannot be derived. Reuse explicit intent.
25
+
26
+ Read `../ultra-think/references/interaction-boundary.md` before asking a material
27
+ question.
28
+
29
+ ## Initialize once
30
+
31
+ Call `ultra.record` with one typed entry:
32
+
33
+ ```text
34
+ kind: baseline
35
+ action: initialize
36
+ data: { target_dir, project_name, mode=auto, git_mode=auto, optional scope }
37
+ idempotency_key: <stable init attempt id>
38
+ ```
39
+
40
+ This stateless bootstrap is the only `ultra.record` operation allowed before
41
+ `state.db` exists. It must create or migrate `.ultra/.runtime/state.db`, preserve
42
+ existing artifacts and Git history, install only missing scaffold assets on resume,
43
+ validate or safely upgrade a legacy task ledger, and read back the result.
44
+
45
+ An unborn Git repository may require a local initial commit, but init never creates a
46
+ remote, tag, push, publish, or deployment. Corrupt DB/WAL/SHM and backups remain
47
+ preserved until an explicit recovery choice is made.
48
+
49
+ ## Return control
50
+
51
+ Report classification, scope, schema and backup result, Git state, imported team
52
+ checkpoint state, and any mechanical blocker. Recommend the next useful capability
53
+ from current evidence, usually `ultra-research`, `ultra-change`, `ultra-status`, or
54
+ `ultra-doctor`; do not invoke it automatically.
@@ -66,7 +66,8 @@ ledger into hundreds of application tasks.
66
66
 
67
67
  ## Record authority
68
68
 
69
- Call `baseline.record` with full replacement arrays for:
69
+ Use `ultra.record` with `kind: baseline`, `action: observe`, and full replacement
70
+ arrays for:
70
71
 
71
72
  - scope and repository revision;
72
73
  - repository classification;
@@ -82,12 +83,14 @@ Use the server-returned revision, branch, worktree digest, and specification dig
82
83
  ## Obtain approval and converge
83
84
 
84
85
  Present scope, observed behavior, drift, known-red verification, unknowns, gaps, dirty
85
- worktree state, and material decisions to the owner. Call `baseline.converge` only after
86
- explicit approval. Set `accept_known_red` and `accept_dirty_worktree` only for the exact
87
- items the owner accepted.
86
+ worktree state, and material decisions to the owner. Use `ultra.record` with
87
+ `kind: baseline`, `action: accept` only after explicit approval. Set
88
+ `accept_known_red` and `accept_dirty_worktree` only for the exact items the owner
89
+ accepted.
88
90
 
89
91
  Resolve returned blockers through evidence or an owner decision, record the replacement
90
- snapshot, and retry. Adoption is complete only when `baseline.get` is `ready` and
91
- current, the gap ledger has no open blocker, and project doctor has no authority
92
- failure. Route all selected work through `ultra-change`, including work described by a
93
- legacy plan. Import its accepted intent into a current Change Contract before planning.
92
+ snapshot, and retry. Adoption is complete only when `ultra.context` reports a current
93
+ accepted baseline, the gap ledger has no open blocker, and project doctor has no
94
+ authority failure. Route all selected work through `ultra-change`, including work
95
+ described by a legacy plan. Import its accepted intent into a current Change Contract
96
+ before planning.
@@ -5,135 +5,57 @@ description: Turn an accepted Ultra Change Contract into dependency-valid, DB-ba
5
5
 
6
6
  # Build an executable plan
7
7
 
8
- The model owns decomposition and technical design. MCP owns plan state, task contracts,
9
- dependency integrity, output digests, and recovery. Planning must stay inside the
10
- accepted Change Contract without adding ceremonial approval.
11
-
12
- ## Bind current authority
13
-
14
- 1. Read doctor, `task.ledger_get`, baseline, change, breadcrumb `accepted_intent`,
15
- decisions, existing plan runs, tasks, and current checkout. If a new Git checkpoint
16
- arrived after this MCP process started, call `task.ledger_import` before planning.
17
- Stop on a typed baseline, Change, task, ancestry, or active-session conflict; never
18
- choose one side by editing the ledger.
19
- 2. Require one mutable change with a healthy baseline or recorded incident bypass.
20
- For the first delivery of a greenfield project, an accepted ready baseline may
21
- already contain the complete delivery outcome. When no matching Change exists,
22
- materialize one `change.create` contract from that accepted intent and read it back
23
- without asking the owner to repeat the same choice. Do not invent scope, expand an
24
- incomplete baseline, or use this shortcut for a later change.
25
- 3. Complete the exact change-bound research disposition before planning.
26
- 4. For a standard or major Change, read the current registered `change.delta` and
27
- verify its baseline anchors and digest. A Direct Build route supplies the delta
28
- directly from accepted intent; it skips Research, not this authority boundary.
29
- 5. Resume the matching plan run. Do not start a new run until planning posture is
30
- accepted.
31
-
32
- Read `references/semantic-preflight.md` and inspect requirements, real consumers,
33
- state, tests, deployment, and recovery paths.
34
-
35
- ## Align planning posture
36
-
37
- Use the interaction protocol in `../ultra-think/references/decision-dialogue.md`.
38
- Normalize a posture already explicit in current intent. Otherwise recommend one based
39
- on the Change Contract, explain its scope effect, and use the host's native question
40
- surface:
41
-
42
- - `EXPAND`: surface evidence-backed opportunities beyond accepted scope;
43
- - `SELECTIVE`: hold accepted scope and offer optional expansions individually;
44
- - `HOLD`: preserve scope and strengthen completeness, failure handling, and recovery;
45
- - `REDUCE`: propose the smallest outcome that still satisfies revised acceptance.
46
-
47
- The user may select, modify, delegate, or defer the posture. Stop on an unanswered
48
- choice. Start `workflow.start` only after alignment and store `planning_posture` plus
49
- its rationale in workflow metadata. This is a scope boundary, not approval of the
50
- eventual technical design.
51
-
52
- ## Design with model autonomy
53
-
54
- Build a candidate plan from the Change Contract, current typed delta, and any selected
55
- research. Ask the user only if the plan would change accepted
56
- scope, public behavior, compatibility, security, material cost, external effects, or
57
- recovery. Use the same host-native interaction protocol.
58
-
59
- When the candidate remains inside the accepted Change Contract, proceed without a
60
- second approval. A user may still request a plan review before persistence; that is an
61
- interaction preference, not a runtime invariant.
62
-
63
- Record:
64
-
65
- 1. `validate-baseline`
66
- 2. `compile-context`
67
- 3. `analyze-requirements`
68
- 4. `analyze-codebase`
69
- 5. `design-slices`
70
- 6. `validate-dependencies`
71
- 7. `persist-task-contracts`
72
- 8. `verify-plan`
73
-
74
- Design a walking skeleton and subsequent vertical slices. Every slice reaches a real
75
- consumer and owns its validation, side effects, errors, documentation, migration,
76
- observability, and recovery obligations. Avoid unconsumed horizontal scaffolding.
77
-
78
- After starting or resuming the workflow, compile `change.context` with `role: plan`
79
- and `gate: planning`. Record its immutable manifest as the `compile-context` output.
80
- The packet is the accepted planning input, not a mutable plan draft. `change.context`
81
- must not update Change provider references; persist new provider metadata with
82
- `change.update` before recompiling.
83
-
84
- ## Persist task contracts
85
-
86
- Create each task with:
87
-
88
- - observable outcome (`purpose`) and stable trace (`why`);
89
- - `slice_kind`, public seam, and exact verification command;
90
- - structured acceptance mapped to Change acceptance ids;
91
- - target seams and affected files when known;
92
- - bounded pattern/context refs with a reason, optional anchor and scope, and an
93
- explicit freshness policy;
94
- - documentation impact, ownership, and dependencies.
95
-
96
- Use `digest` freshness with `expected_digest` for accepted inputs that must remain
97
- byte-current. Use `existence` for source targets expected to change during
98
- implementation. Use `advisory` only when drift should be visible but non-blocking.
99
- The compiled task context restores constraints and non-goals from the Change Contract,
100
- plus acceptance, recovery, documentation impact, and the definition of drift. Keep
101
- large referenced files lazy; do not paste their bodies into the plan packet.
102
-
103
- Use estimates only when evidence supports them. A quick change has exactly one task.
104
- Read every task back from DB. Never read or write `.ultra/tasks/tasks.json` directly.
105
- It is the MCP-published Git team checkpoint, while
106
- `.ultra/.runtime/projections/tasks.json` is the generated checkout-local view.
107
-
108
- If a semantic `change.update` invalidated existing tasks, reconcile every affected
109
- task contract against the current intent, acceptance, decisions, and research
110
- evidence. Rebind the complete execution contract while clearing `stale` through
111
- `task.update`; MCP rejects a marker-only clear, validates the read-back, and records
112
- the current Change authority digest. Never clear staleness merely to pass a gate.
113
-
114
- Validate the change-scoped graph with `task.dependency_topo`. Export
115
- the deterministic `<artifact_root>/plan.json` and `<artifact_root>/plan.md` pair with
116
- `plan.export { change_id }`. The JSON binds the exact planning context snapshot and
117
- manifest digest; the Markdown is a deterministic human view of the same task graph.
118
- An accepted export also publishes the portable baseline, Change, task contracts,
119
- dependencies, and durable statuses to the team checkpoint. Local sessions, leases,
120
- `in_progress` ownership, telemetry, and completion hashes remain in `.ultra/.runtime`.
121
- Read the JSON through `plan.get` and record it as the `verify-plan` output. Do not
122
- choose an arbitrary output path or overwrite another Change's plan. A legacy global
123
- `.ultra/execution-plan.json` may be read for migration diagnosis only and is never a
124
- current write target.
125
-
126
- Call `workflow.complete`. `approval` is optional: include it only when a material plan
127
- decision actually required and received user approval. MCP derives task coverage and
128
- topology from DB and must reject incomplete contracts, uncovered acceptance, cycles,
129
- cross-change tasks, stale research, or a mismatched export.
130
-
131
- Do not advance or complete the Change workflow; change capture is already complete.
132
- Compile a separate task context later for each consumer that needs it. Planning,
133
- implementation, testing, review, and convergence snapshots are not interchangeable.
134
-
135
- Return topology, first executable slices, public seams, verification commands, plan
136
- workflow id, and allowed transitions. The host may recommend parallel or sequential
137
- execution based on dependency and conflict evidence.
138
-
139
- Never invoke the recommended capability here; wait for an explicit user invocation.
8
+ The model owns decomposition and technical design. MCP commits the accepted task graph,
9
+ digests, context, and team checkpoint in one semantic operation.
10
+
11
+ ## Bind and design
12
+
13
+ 1. Call `ultra.context { stage: plan, scope: { change_id }, detail: full }`.
14
+ 2. Inspect or import the team checkpoint with `ultra.sync`. Resolve real concurrent
15
+ record conflicts; do not merge authority by editing JSON.
16
+ 3. Require an accepted Change contract and its current typed delta. Direct Build skips
17
+ extra research, never Plan or task contracts.
18
+ 4. Read `references/semantic-preflight.md`; inspect real consumers, source, tests,
19
+ deployment, and recovery.
20
+ 5. Recommend `EXPAND`, `SELECTIVE`, `HOLD`, or `REDUCE` only when posture changes
21
+ accepted scope. Reuse an explicit posture and ask through the host-native UI only
22
+ for a material unresolved choice.
23
+ 6. Design a walking skeleton and vertical slices. Each task owns an observable outcome,
24
+ public seam, verification command, acceptance mapping, target seams, bounded
25
+ context refs, documentation impact, recovery, owner, and dependencies.
26
+
27
+ Large sources stay lazy. Use digest freshness for accepted inputs that must remain
28
+ byte-current, existence for expected implementation targets, and advisory only when
29
+ drift must be visible without blocking.
30
+
31
+ Read `../ultra-think/references/interaction-boundary.md` before asking a material
32
+ question.
33
+
34
+ ## Record and checkpoint
35
+
36
+ Use one `ultra.record` batch with `task_contract / define` for new tasks and
37
+ `task_contract / revise` for corrected contracts. Read back the draft with
38
+ `ultra.context`.
39
+ Never read or write `.ultra/tasks/tasks.json`; use `ultra.sync` for the Git team
40
+ checkpoint, and never edit the local runtime projection directly.
41
+
42
+ Call exactly one `ultra.checkpoint`:
43
+
44
+ ```text
45
+ stage: plan
46
+ scope: { change_id }
47
+ payload: planning posture, optional approval already obtained, context budget/refs
48
+ idempotency_key: stable semantic Plan checkpoint id
49
+ ```
50
+
51
+ The checkpoint compiles or reuses the content-addressed Context Envelope, derives
52
+ coverage diagnostics, exports `plan.json` and `plan.md` inside the same recoverable
53
+ publication, accepts one Plan revision, and publishes the team checkpoint. Do not
54
+ export separately.
55
+
56
+ If rejected, the same Plan draft stays mutable. Fix task contracts or evidence and
57
+ retry. To replace an accepted Plan, submit a new checkpoint revision; never edit
58
+ SQLite or open a parallel run to escape a diagnostic.
59
+
60
+ Return topology, executable slices, public seams, exact checks, checkpoint result, and
61
+ the model's recommended execution order. Do not invoke `ultra-dev` automatically.
@@ -1,118 +1,64 @@
1
1
  ---
2
2
  name: ultra-research
3
- description: Build or refresh an evidence-backed product and architecture baseline through recommended, user-selected semantic coverage and low-load alignment. Use when initialization, brownfield adoption, or an active change has a real evidence gap.
3
+ description: Build or refresh an evidence-backed product and architecture baseline through recommended, user-selected semantic coverage. Use when initialization, brownfield adoption, or an active Change has a real evidence gap.
4
4
  ---
5
5
 
6
6
  # Research with adaptive coverage
7
7
 
8
- The model owns investigation, synthesis, and coverage recommendations; the user owns the accepted semantic route and material deferrals.
9
- MCP owns run state, evidence, semantic records, digests, freshness, and convergence, not a questionnaire.
10
-
11
- Read `../ultra-think/references/decision-dialogue.md` before asking a material question.
12
-
13
- ## Bind authority
14
-
15
- 1. Read `system.doctor`, `task.ledger_get`, `baseline.get`, breadcrumb
16
- `accepted_intent`, active decisions, and existing research runs. Import a newer
17
- descendant team checkpoint before binding coverage; stop on a typed merge conflict.
18
- 2. Resume the matching active, blocked, or ready run. Do not create parallel authority.
19
- 3. If none exists, use `full` for greenfield, `adoption` for brownfield, or a bounded
20
- mode only for a recorded active-Change disposition. Focused baseline coverage
21
- remains `full` or `adoption`; `custom` is Change-bound only.
22
- 4. Before `workflow.start`, inspect current code, docs, tests, runtime, and prior
23
- artifacts. Recommend the smallest sufficient set of applicable catalog areas.
24
- Explain the net effect without dumping all 17 areas. Offer at most three credible
25
- routes: the recommended adaptive set, the full catalog, and a focused or custom set.
26
- 5. If current user intent does not already select a route, use the host's native
27
- structured question surface. The user selects, modifies, delegates, or defers.
28
- Treat a dismissal as unanswered, stop, and perform no route-dependent write.
29
- 6. Normalize the answer and persist the accepted coverage through `workflow.start`.
30
- Use `execute` for fresh evidence, `verify_existing` for source validation, `reuse`
31
- for current evidence, `not_applicable` with evidence and rationale, or `deferred`
32
- with consequence and owner acceptance when scope or material risk changes.
33
- 7. Pass the evidence-based coverage rationale as `metadata.selection_reason`. Omitted
34
- catalog areas create no DB step and need no ceremonial disposition.
35
- 8. Read back the created workflow and accepted coverage. When a durable decision thread
36
- recorded the route, complete it with the workflow reference in `applied_refs`.
37
-
38
- `99-synthesis` must execute, verify, or reuse. A missing disposition is a coverage error only for an included area; a recorded exclusion with evidence is not incomplete.
39
-
40
- ## Coverage catalog
41
-
42
- Load only the reference for a step that must execute, verify, or reuse:
43
-
44
- | Area | Reference | Area | Reference |
45
- |---|---|---|---|
46
- | `00-problem-validation` | `references/00-problem-validation.md` | `01-opportunity-discovery` | `references/01-opportunity-discovery.md` |
47
- | `02-market-assessment` | `references/02-market-assessment.md` | `03-competitive-landscape` | `references/03-competitive-landscape.md` |
48
- | `04-product-strategy` | `references/04-product-strategy.md` | `05-assumptions-validation` | `references/05-assumptions-validation.md` |
49
- | `10-user-personas` | `references/10-user-personas.md` | `11-user-scenarios` | `references/11-user-scenarios.md` |
50
- | `20-user-stories` | `references/20-user-stories.md` | `21-features-scope` | `references/21-features-scope.md` |
51
- | `22-success-metrics` | `references/22-success-metrics.md` | `30-architecture-context` | `references/30-architecture-context.md` |
52
- | `31-solution-strategy` | `references/31-solution-strategy.md` | `32-building-blocks` | `references/32-building-blocks.md` |
53
- | `40-deployment` | `references/40-deployment.md` | `41-quality-risks` | `references/41-quality-risks.md` |
54
- | `99-synthesis` | `references/99-synthesis.md` | | |
55
-
56
- ## Investigate and interact
57
-
58
- For each active area:
59
-
60
- 1. Resolve observable facts from the checkout, runtime, tests, existing specifications,
61
- and primary sources. Separate `Observed`, `Verified`, `Decided`, and `Unknown`.
62
- 2. Ask the user only for a material intent, scope, compatibility, risk, or recovery
63
- decision that evidence cannot answer. Use the host's native question UI when
64
- available. Present the recommendation and effect; avoid a questionnaire or a dump
65
- of the hidden research queue.
66
- 3. Process dependent decisions one at a time. A small group of independent,
67
- low-cognitive-load facts may be asked together when the host UI supports it.
68
- 4. Normalize explicit user intent without redundant confirmation. Create durable
69
- decision state only when a project-bound decision must survive interruption.
70
- 5. Update the smallest relevant baseline specification or active-change research
71
- artifact. Do not copy prompts, transcripts, provider payloads, or internal chain of
72
- thought.
73
-
74
- Every required step writes `Evidence`, `Specification updates`, and `Decisions and
75
- unknowns` to `.ultra/docs/research/<workflow-id>/<step-id>.md` for a baseline, or
76
- `<change-root>/research/<workflow-id>/<step-id>.md` for an active Change.
77
-
78
- Call `workflow.step` with bounded evidence, the report output, and typed semantic
79
- records. Reused or verified evidence must still produce a current report and digest.
80
- Block the same step when required evidence or owner authority is missing. For Change
81
- research, keep `findings.md` and every semantic output inside the same Change root and
82
- register them through workflow outputs; do not write baseline specifications.
83
-
84
- At synthesis, bind the current `discovery.md`, `product.md`, `architecture.md`, and
85
- `research-distillate.md` only for initial/adoption research. Change-bound synthesis
86
- updates the Change findings and specification overlay, then records or refreshes
87
- `change.delta`. It never mutates the accepted baseline.
88
-
89
- ## Baseline convergence
90
-
91
- After `workflow.complete`, initial or adoption research calls `baseline.record` with
92
- the current repository scope and revision, specification refs, evidence, real
93
- verification results, unknowns, gap ledger, classification, and external provider
94
- metadata references.
95
-
96
- If Git is initialized but unborn, present the exact local checkpoint paths and purpose
97
- for user authorization, then create only that local commit. Never create a remote,
98
- tag, or push through research. If authorization or identity is missing, preserve the
99
- run as blocked with `BASELINE_GIT_HEAD_REQUIRED`.
100
-
101
- Call `baseline.converge` only when the user has accepted the exact baseline snapshot,
102
- known failures, blocking gaps, and scope. Reuse an unambiguous current approval; do not
103
- ask twice. MCP must reject stale research, drift, missing evidence, and unaccepted
104
- failures. Successful convergence publishes the portable baseline, Changes, and tasks
105
- to the Git team checkpoint; the receiving checkout must still revalidate a ready
106
- baseline against its own HEAD and files.
107
-
108
- Reuse the final research acceptance or current artifact checkpoint during baseline
109
- convergence; do not ask for an equivalent approval again. After initial or adoption
110
- convergence, `ultra-change` becomes an available transition. Bounded change research
111
- returns to its owning Change authority; the next route is still `ultra-plan`, never
112
- direct implementation.
113
-
114
- Return a compact coverage summary by disposition, current evidence or decision blocker, baseline state, gaps, and allowed transitions.
115
- Recommend a semantic next action from those transitions. If current intent does not already select it, present the recommendation
116
- and credible alternatives through the interaction protocol, then wait. MCP supplies only valid and required transitions.
117
-
118
- Never invoke the recommended capability here; wait for an explicit user invocation.
8
+ The model owns investigation and synthesis. The owner controls material scope and
9
+ deferrals. MCP records the accepted draft and commits one durable checkpoint; it is
10
+ not a questionnaire or a step-by-step supervisor.
11
+
12
+ ## Bind current context
13
+
14
+ 1. Call `ultra.context { stage: research, detail: full }`.
15
+ 2. If the team checkpoint is newer, call `ultra.sync { action: import }`. Stop only
16
+ on a real ancestry or same-record conflict.
17
+ 3. Inspect code, docs, tests, runtime, accepted intent, decisions, and existing
18
+ research. Reuse current evidence and the matching mutable draft.
19
+ 4. Recommend the smallest sufficient coverage. Offer the adaptive set, the full
20
+ catalog, and a focused Change-bound set only when all are credible.
21
+ 5. Use the host-native question surface only for a material unresolved route. Reuse an
22
+ explicit owner choice without asking again.
23
+
24
+ Read `../ultra-think/references/interaction-boundary.md` before asking. Load only the
25
+ reference files for research areas that actually apply.
26
+
27
+ ## Investigate
28
+
29
+ For each selected area:
30
+
31
+ - separate `Observed`, `Verified`, `Decided`, and `Unknown`;
32
+ - resolve observable facts yourself and use primary sources where needed;
33
+ - update the smallest baseline or Change-owned research artifact;
34
+ - never store transcripts, hidden reasoning, raw provider payloads, or copied prompts;
35
+ - record evidence, specification updates, decisions, deferrals, and consequences.
36
+
37
+ Use one `ultra.record` batch for typed durable facts:
38
+
39
+ - `artifact / bind` for a managed research or specification artifact;
40
+ - `decision / accept` for normalized owner intent;
41
+ - `baseline / observe` or `baseline / accept` for baseline authority;
42
+ - `change_contract / revise` for Change-bound findings.
43
+
44
+ Every entry needs a stable idempotency key. A semantic rejection is a mutable
45
+ diagnostic: correct the same draft and retry.
46
+
47
+ ## Commit one research checkpoint
48
+
49
+ Call exactly one `ultra.checkpoint` with `stage: research`. Put the selected research areas
50
+ and their report outputs in `payload.steps`; include only work actually performed,
51
+ verified, reused, deferred with owner authority, or proved not applicable. Synthesis
52
+ must always be present.
53
+
54
+ For baseline research, update and accept the baseline through typed `ultra.record`
55
+ entries, then publish the team checkpoint with `ultra.sync { action: publish }`.
56
+ For Change-bound research, keep all findings and delta artifacts below the Change
57
+ root and never edit accepted baseline specs directly.
58
+
59
+ If the checkpoint returns `accepted: false`, keep the same draft mutable, repair the
60
+ reported evidence, and retry. Do not manufacture evidence or open a replacement run.
61
+
62
+ Return coverage, decisive evidence, remaining gaps, durable artifact paths, and a
63
+ model recommendation for the next explicit capability, such as `ultra-change` after a
64
+ ready baseline. Never invoke it automatically.