ultra-builder-pro-cli 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +55 -25
  3. package/adapters/_shared/codex-assets.cjs +8 -3
  4. package/adapters/_shared/interaction-contract.cjs +13 -6
  5. package/adapters/_shared/runtime-assets.cjs +1 -1
  6. package/adapters/claude.js +1 -1
  7. package/adapters/kimi.js +1 -1
  8. package/adapters/opencode.js +1 -1
  9. package/docs/AGENT-CONTEXT.md +38 -40
  10. package/docs/ARCHITECTURE.md +29 -33
  11. package/docs/ARTIFACT-AUTHORITY.md +15 -16
  12. package/docs/ROADMAP.md +2 -2
  13. package/docs/RUNTIME-COMPAT-MATRIX.md +7 -6
  14. package/docs/STATE-DB-ACCESS-POLICY.md +14 -14
  15. package/docs/WORKFLOW-LIFECYCLE.md +39 -33
  16. package/mcp-server/lib/artifact-registry.cjs +25 -1
  17. package/mcp-server/lib/change-workflow.cjs +42 -6
  18. package/mcp-server/lib/ultra-facade.cjs +646 -0
  19. package/mcp-server/lib/workflow-state.cjs +166 -2
  20. package/mcp-server/server.cjs +73 -21
  21. package/package.json +1 -1
  22. package/skills/ultra-change/SKILL.md +38 -98
  23. package/skills/ultra-deliver/SKILL.md +42 -65
  24. package/skills/ultra-dev/SKILL.md +34 -88
  25. package/skills/ultra-doctor/SKILL.md +35 -57
  26. package/skills/ultra-init/SKILL.md +37 -78
  27. package/skills/ultra-plan/SKILL.md +52 -132
  28. package/skills/ultra-research/SKILL.md +41 -100
  29. package/skills/ultra-review/SKILL.md +25 -46
  30. package/skills/ultra-status/SKILL.md +21 -44
  31. package/skills/ultra-test/SKILL.md +25 -61
  32. package/skills/ultra-think/SKILL.md +29 -48
  33. package/skills/ultra-think/references/decision-dialogue.md +6 -4
  34. package/spec/cli-protocol.md +12 -0
  35. package/spec/mcp-tools.yaml +159 -0
  36. package/spec/schemas/mcp-tools.schema.json +1 -1
@@ -5,102 +5,48 @@ description: Implement one authoritative Ultra task through a fresh-context, tes
5
5
 
6
6
  # Implement one task
7
7
 
8
- The host model owns code reasoning and edits. Ultra owns the task and workflow state,
9
- fresh context contract, session lease, evidence references, and recovery.
8
+ The model owns code reasoning and edits. Ultra owns the durable task contract, current
9
+ Context Manifest, execution lease, evidence references, and checkpoint.
10
10
 
11
- ## Bind and resume
11
+ ## Bind execution
12
12
 
13
- 1. Read doctor, `task.ledger_get`, breadcrumb `accepted_intent`, active decisions, task
14
- contract, dependencies, dev runs, sessions, HEAD, and worktree. Import a newer
15
- descendant team checkpoint before taking a lease. Stop on a typed baseline, Change,
16
- task, ancestry, or active-session conflict; do not merge authority by editing JSON.
17
- 2. Resume the matching dev run or start one with `change_id` and `task_id`.
18
- 3. Record `bind-task` with current authority and dependency evidence.
19
- 4. Compile `change.context` with `role: implement` and `gate: implementation`. The
20
- public seam, verification command, and context refs come from the DB-backed task
21
- contract; update that contract before compilation instead of overriding it in the
22
- call. Persist any changed external-provider metadata with `change.update` first.
23
- Context compilation itself is read-only with respect to Change and provider
24
- authority.
25
- 5. Confirm the manifest contains the selected task, its direct dependencies, direct
26
- dependents needed for integration, and relevant integration checkpoints—not the
27
- entire task graph. Referenced file bodies stay lazy. The token estimate includes
28
- inline Change/task authority as well as file estimates; budget overflow is
29
- advisory, while a missing or stale required reference is blocking. Record the
30
- immutable manifest as `compile-context`.
31
- 6. Reuse an existing valid session. Otherwise pass admission and call `session.spawn`.
32
- Work only in the returned worktree and preserve unrelated changes.
13
+ 1. Call `ultra.context { stage: dev, scope: { change_id, task_id }, detail: full }`.
14
+ 2. Import a newer team checkpoint with `ultra.sync`; stop on a real same-record or
15
+ active-session conflict.
16
+ 3. Reuse a valid lease or call `ultra.session { action: admission }`, then
17
+ `ultra.session { action: acquire }`. Work only in the returned worktree.
18
+ 4. Confirm purpose, acceptance, dependencies, public seam, verification command,
19
+ non-goals, recovery, and required context refs. Update the task contract before
20
+ implementation when accepted intent changed.
33
21
 
34
- Do not spawn recursively from a parent-owned worker session. Process exit is transport
35
- evidence, never task completion.
22
+ ## Implement adaptively
36
23
 
37
- ## Focused inner loop
24
+ Reproduce the failure, write a failing test, or establish a characterization signal
25
+ before changing logic. Implement the smallest complete vertical slice. Ask the owner
26
+ only when new evidence changes product intent, compatibility, security, material cost,
27
+ external effects, or recovery.
38
28
 
39
- 1. Reproduce the bug, write a failing test, or establish a characterization signal
40
- before a logic change. Record `establish-feedback-loop`.
41
- 2. Mark the task `in_progress` and implement the smallest complete slice through the
42
- declared public seam.
43
- 3. Keep the loop adaptive. The model may choose implementation details inside the
44
- accepted contract. If new evidence changes product intent, compatibility, security,
45
- material cost, external effects, or recovery, use the host's native question UI and
46
- the decision protocol; do not ask about ordinary reversible details.
47
- 4. Record `implement-slice`, then run focused tests plus the adjacent checks justified
48
- by the task risk. Record exact results under `verify-slice`.
49
- 5. Run a task-scoped independent review on specification fidelity and relevant
50
- engineering risks. Record `review-slice`. Fix blocking findings and refresh affected
51
- evidence.
52
- 6. In direct mode, update the task to `completed` only after verification and review
53
- are current. This publishes the durable team ledger checkpoint. Create one
54
- authorized local task commit containing code, semantic artifacts, and that
55
- checkpoint. Read the resulting `HEAD`, then record it as `completion_commit`;
56
- that hash remains checkout-local and must not create another Git commit. Do not
57
- push, publish, tag, or deploy unless the user separately authorized that external
58
- effect.
29
+ Use `ultra.record` batches for task status, bounded events, artifacts, decisions, and
30
+ documentation candidates. Live ownership, `in_progress`, session ids, leases,
31
+ worktrees, telemetry, and completion hashes remain local runtime state; durable task
32
+ outcome and evidence may enter the team checkpoint.
59
33
 
60
- The tracked team checkpoint contains durable task status and contract evidence, not
61
- live ownership. `in_progress`, `session_id`, leases, worktrees, telemetry, and
62
- `completion_commit` remain checkout-local. The local generated task view lives under
63
- `.ultra/.runtime/projections/` and is never committed.
34
+ Run focused and adjacent risk-justified checks, then a task-scoped independent review.
35
+ Fix blocking findings and refresh affected evidence.
64
36
 
65
- Treat the compiled task-context contract as the handoff boundary: purpose, why,
66
- constraints, non-goals, target seams/files, pattern refs, acceptance, documentation
67
- impact, recovery, and definition of drift. If accepted intent, the task contract, or a
68
- digest-bound reference changes, update the owning authority and recompile rather than
69
- continuing from a stale packet.
37
+ ## Commit one semantic checkpoint
70
38
 
71
- Keep implementation findings and documentation candidates inside the owning Change
72
- root. When code changes invalidate or extend maintained documentation, update the
73
- Change documentation overlay and its evidence rather than editing accepted baseline
74
- specifications. Hooks may remind the host to reconcile documentation; they must not
75
- block ordinary development or choose the semantic update.
39
+ Call `ultra.checkpoint` once with `stage: dev`, the exact Change/Task scope, evidence,
40
+ and stable idempotency key. It compiles or reuses the implementation Context Manifest
41
+ and validates the durable outcome. A rejection leaves the draft mutable.
76
42
 
77
- Task-level tests and review belong to this inner loop. They do not replace aggregate
78
- change testing or review when multiple slices, integrations, or broader risks require
79
- those capabilities.
43
+ After acceptance, mark the task durably completed, publish with `ultra.sync`, and
44
+ create at most one authorized local task commit containing code and semantic
45
+ artifacts. Record its SHA only in local state; never create a bookkeeping commit.
80
46
 
81
- ## Complete or recover
47
+ Release the lease through `ultra.session`. Preserve a dirty or unintegrated worktree
48
+ on interruption. Commit, push, tag, publish, deploy, or destructive cleanup require
49
+ separate owner authority.
82
50
 
83
- In direct mode, integrate the task commit through the repository's accepted path,
84
- verify ancestry and the public seam, close the session, record `record-completion`,
85
- and complete the dev workflow. If commit creation fails after the pre-commit
86
- completion checkpoint, move the still-session-owned task to `blocked`, preserve the
87
- worktree, and record the failure. A completion with a recorded commit remains
88
- terminal.
89
-
90
- Change convergence revalidates the exact latest
91
- `change_id + task_id + implement + implementation` snapshot for every executable
92
- task. A newer review, test, or plan packet cannot substitute for it.
93
-
94
- In a parent-supervised worker, record completion evidence and exit without closing the
95
- parent-owned lease. The primary host verifies the exact session commit, performs any
96
- integration, refreshes review if the reviewed checkout changed, settles the lease, and
97
- completes the workflow.
98
-
99
- Preserve worktrees by default. Remove one only when Git proves it is clean and
100
- integrated. On interruption, record the current step and task as blocked, preserve
101
- worktree and evidence, and resume the same run later.
102
-
103
- Return outcome, changed paths, public seam, exact checks, review axes, commit and
104
- session state, residual risk, and allowed transitions.
105
-
106
- Never invoke the recommended capability here; wait for an explicit user invocation.
51
+ Return changed paths, public seam, exact checks, review result, checkpoint, commit,
52
+ session state, and residual risk. Do not invoke the next capability automatically.
@@ -1,63 +1,41 @@
1
1
  ---
2
2
  name: ultra-doctor
3
- description: Diagnose and mechanically recover Ultra schema, workflow, projection, session, archive, hook, and installed-asset faults. Use when authority is degraded, stale, contradictory, or unavailable.
3
+ description: Diagnose and mechanically recover Ultra schema, projection, session, archive, hook, and installed-asset faults. Use when authority is degraded, contradictory, or unavailable.
4
4
  ---
5
5
 
6
6
  # Diagnose before repair
7
7
 
8
- Doctor owns deterministic health and supported recovery. It cannot decide product
9
- scope, invent evidence, approve a baseline, answer a user decision, or mark semantic
10
- work complete.
11
-
12
- ## Read-only diagnosis
13
-
14
- Run `system.doctor` without repair and inspect:
15
-
16
- - SQLite integrity, schema 20 migration, required tables, and backups;
17
- - artifact registration, ownership, digest freshness, dependency edges, consumers,
18
- and orphan or duplicate authority;
19
- - baseline and research provenance, gaps, digests, and Git/worktree drift;
20
- - workflow status, obsolete-step migration, blockers, and output freshness;
21
- - decisions and checkpoint artifact freshness;
22
- - Git team-checkpoint schema, ancestry, per-baseline, per-Change, and per-task drift,
23
- plus checkout-local baseline revalidation requirements;
24
- - projection jobs and event cursors;
25
- - sessions, preserved worktrees, incidents, circuit state, and archive journals;
26
- - external provider boundaries.
27
-
28
- An expected workflow pause or awaiting user decision is a warning, not corruption.
29
- Missing or changed required evidence is an authority failure but cannot be reconstructed
30
- by doctor.
31
-
32
- ## Recovery boundary
33
-
34
- With explicit repair authorization, `system.doctor` may:
35
-
36
- - apply backup-first supported schema migrations;
37
- - migrate incompatible rigid workflows into recoverable adaptive state;
38
- - requeue or regenerate projections from healthy DB authority;
39
- - reconcile orphan sessions without deleting unrelated or dirty worktrees;
40
- - resume supported archive journals;
41
- - recover missing workflow provenance as a blocked run requiring real evidence.
42
-
43
- It may not create a Git checkpoint, replace a healthy baseline, accept known failures,
44
- resolve decisions, regenerate semantic content, import or publish the team checkpoint,
45
- or edit application code. A missing or drifted valid checkpoint is a warning; invalid
46
- content or conflicting ancestry is degraded authority. Resolve semantic checkpoint
47
- state explicitly with `task.ledger_import` or `task.ledger_publish` after reviewing
48
- the typed conflict.
49
-
50
- Corrupt SQLite requires preservation of DB, WAL, and SHM followed by an explicit
51
- restore-or-rebaseline choice. Missing hook adapters or stale cache paths require
52
- `ubp --doctor` and adapter reinstall; never patch plugin cache contents by hand.
53
- A legacy task projection is never rewritten by doctor. The supported publication path
54
- first proves its durable task fields match SQLite and preserves its original bytes in
55
- the local runtime backup directory.
56
-
57
- After repair, rerun doctor read-only and verify backup paths, schema, installed hashes,
58
- entry points, MCP startup, and hook smoke tests as applicable.
59
-
60
- Return health first, failed checks, mechanical repairs performed, preserved recovery
61
- paths, unresolved owners, and allowed transitions plus any unique required transition.
62
-
63
- Never invoke the recommended capability here; wait for an explicit user invocation.
8
+ Doctor owns deterministic health and supported recovery. It cannot choose product
9
+ scope, invent evidence, accept a baseline, resolve a user decision, or declare
10
+ semantic work complete.
11
+
12
+ ## Diagnose
13
+
14
+ Call `ultra.doctor { repair: false }` and inspect:
15
+
16
+ - SQLite integrity, schema, backups, WAL/SHM, and migration state;
17
+ - artifact ownership, digest freshness, edges, orphans, and duplicate authority;
18
+ - team-checkpoint ancestry and real concurrent record conflicts;
19
+ - projection jobs, sessions, leases, worktrees, and recovery journals;
20
+ - installed plugin assets, MCP startup, and hook paths.
21
+
22
+ An expected workflow pause, editable draft, failed semantic checkpoint, or awaiting
23
+ owner decision is a warning, not corruption.
24
+
25
+ ## Repair
26
+
27
+ With explicit repair authority, call `ultra.doctor { repair: true }`. It may apply
28
+ backup-first schema migration, regenerate local projections, recover supported
29
+ journals, reconcile orphan sessions, and repair installed mechanical assets.
30
+
31
+ It may not manufacture semantic evidence, import or publish a team checkpoint, replace
32
+ a healthy baseline, resolve decisions, edit application code, or force a draft to
33
+ accepted. Use `ultra.sync` for reviewed checkpoint import/publish and
34
+ `workflow.abandon` through `ultra.record` for intentional draft cancellation.
35
+
36
+ Preserve corrupt DB/WAL/SHM and dirty worktrees. Never patch plugin cache files by
37
+ hand; reinstall through `ubp` and verify the installed manifest and hook targets.
38
+
39
+ Rerun doctor read-only after repair. Report health, exact failed checks, backups,
40
+ repairs, preserved recovery paths, and remaining owner or semantic work. Do not invoke
41
+ another capability automatically.
@@ -1,94 +1,53 @@
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.
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
11
 
12
- ## Inspect before mutation
12
+ ## Inspect and align
13
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.
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.
23
25
 
24
- Use repository evidence to classify:
26
+ Read `../ultra-think/references/decision-dialogue.md` before asking a material
27
+ question.
25
28
 
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.
29
+ ## Initialize once
30
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.
31
+ Call `ultra.record` with one entry:
33
32
 
34
- ## Interaction boundary
33
+ ```text
34
+ operation: task.init_project
35
+ data: target_dir, project_name, mode=auto, git_mode=auto, optional scope
36
+ idempotency_key: stable init attempt id
37
+ ```
35
38
 
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.
39
+ This stateless bootstrap is the only `ultra.record` operation allowed before
40
+ `state.db` exists. It must create or migrate `.ultra/.runtime/state.db`, preserve
41
+ existing artifacts and Git history, install only missing scaffold assets on resume,
42
+ validate or safely upgrade a legacy task ledger, and read back the result.
41
43
 
42
- ## Deterministic initialization contract
44
+ An unborn Git repository may require a local initial commit, but init never creates a
45
+ remote, tag, push, publish, or deployment. Corrupt DB/WAL/SHM and backups remain
46
+ preserved until an explicit recovery choice is made.
43
47
 
44
- `task.init_project` owns these steps:
48
+ ## Return control
45
49
 
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.
50
+ Report classification, scope, schema and backup result, Git state, imported team
51
+ checkpoint state, and any mechanical blocker. Recommend the next useful capability
52
+ from current evidence, usually `ultra-research`, `ultra-change`, `ultra-status`, or
53
+ `ultra-doctor`; do not invoke it automatically.
@@ -5,135 +5,55 @@ 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/decision-dialogue.md` before asking a material
32
+ question.
33
+
34
+ ## Record and checkpoint
35
+
36
+ Use one `ultra.record` batch for all `task.create` and necessary `task.update`
37
+ operations. Read back the draft with `ultra.context`.
38
+ Never read or write `.ultra/tasks/tasks.json`; use `ultra.sync` for the Git team
39
+ checkpoint, and never edit the local runtime projection directly.
40
+
41
+ Call exactly one `ultra.checkpoint`:
42
+
43
+ ```text
44
+ stage: plan
45
+ scope: { change_id }
46
+ payload: planning posture, optional approval already obtained, context budget/refs
47
+ idempotency_key: stable semantic Plan checkpoint id
48
+ ```
49
+
50
+ The checkpoint compiles or reuses the content-addressed Context Manifest, validates
51
+ task coverage and dependencies, exports `plan.json` and `plan.md` once, completes the
52
+ durable Plan, and publishes the team checkpoint. Do not export again after validation.
53
+
54
+ If rejected, the same Plan draft stays mutable. Fix task contracts or evidence and
55
+ retry. To discard it, record `workflow.abandon`; never edit SQLite or open a parallel
56
+ run to escape a blocker.
57
+
58
+ Return topology, executable slices, public seams, exact checks, checkpoint result, and
59
+ the model's recommended execution order. Do not invoke `ultra-dev` automatically.