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
@@ -17,6 +17,8 @@ Run tests and analyze their evidence. This assignment is read-only.
17
17
  1. Resolve the requested scope, checkout, repository guidance, and canonical command
18
18
  from package scripts, CI configuration, or framework files. Ask the parent to
19
19
  resolve ambiguity when different commands prove different contracts.
20
+ For an Ultra delegation, validate the immutable Worker Packet and echo its exact
21
+ `packet_digest` in the assigned output.
20
22
  2. Run the exact command without weakening flags, skipping failures, or changing test
21
23
  configuration. Capture exit code, duration, pass/fail/skip counts, and coverage only
22
24
  when the runner reports it.
@@ -31,5 +33,6 @@ Run tests and analyze their evidence. This assignment is read-only.
31
33
  failures, environment limitations, and residual coverage gaps. Do not paste the full
32
34
  runner transcript unless the parent requests it.
33
35
 
34
- Do not edit tests, production code, task state, or projections. Do not claim a green
35
- suite when the command did not complete successfully.
36
+ Do not edit tests or production code, call Ultra MCP write tools, change task state, or
37
+ edit projections. Do not claim a green suite when the command did not complete
38
+ successfully.
package/bin/install.js CHANGED
@@ -4,14 +4,14 @@
4
4
  * ultra-builder-pro-cli — multi-runtime installer.
5
5
  *
6
6
  * Distributes Ultra Builder Pro assets — commands, agents, skills, hooks,
7
- * MCP server — to Claude Code, OpenCode, Codex CLI, and Kimi Code via
7
+ * MCP server — to Claude Code, OpenCode, Codex CLI, Kimi Code, and Grok Build via
8
8
  * runtime-specific adapters under adapters/. Install is idempotent and
9
9
  * uses atomic writes; uninstall reverses via sentinel/manifest blocks.
10
10
  *
11
11
  * Usage:
12
12
  * npx ultra-builder-pro-cli [options]
13
13
  *
14
- * --claude / --opencode / --codex / --kimi select runtime(s)
14
+ * --claude / --opencode / --codex / --kimi / --grok select runtime(s)
15
15
  * --all install to all supported runtimes
16
16
  * -g, --global install to runtime's global config dir
17
17
  * -l, --local install into current working directory
@@ -58,7 +58,7 @@ function printBanner() {
58
58
  paint('cyan', ' ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝╚══════╝╚═╝'),
59
59
  '',
60
60
  ` ${paint('bold', 'Ultra Builder Pro CLI')} ${paint('dim', 'v' + pkg.version)}`,
61
- ` ${paint('dim', 'Multi-runtime installer for Claude Code, OpenCode, Codex, and Kimi Code')}`,
61
+ ` ${paint('dim', 'Multi-runtime installer for Claude Code, OpenCode, Codex, Kimi Code, and Grok Build')}`,
62
62
  '',
63
63
  ];
64
64
  console.log(banner.join('\n'));
@@ -72,6 +72,7 @@ function printHelp() {
72
72
  ${paint('cyan', '--opencode')} OpenCode
73
73
  ${paint('cyan', '--codex')} Codex CLI (OpenAI)
74
74
  ${paint('cyan', '--kimi')} Kimi Code (Moonshot AI)
75
+ ${paint('cyan', '--grok')} Grok Build (xAI)
75
76
  ${paint('cyan', '--all')} all supported runtimes
76
77
 
77
78
  ${paint('yellow', 'Scope:')}
@@ -99,6 +100,9 @@ function printHelp() {
99
100
  ${paint('dim', '# Install to Kimi Code globally')}
100
101
  npx ultra-builder-pro-cli --kimi --global
101
102
 
103
+ ${paint('dim', '# Install to Grok Build globally')}
104
+ npx ultra-builder-pro-cli --grok --global
105
+
102
106
  ${paint('dim', '# Verify all host installations without changing them')}
103
107
  npx ultra-builder-pro-cli --all --global --doctor
104
108
  `);
@@ -125,6 +129,7 @@ function parseArgs(argv) {
125
129
  case '--opencode': runtimes.add('opencode'); break;
126
130
  case '--codex': runtimes.add('codex'); break;
127
131
  case '--kimi': runtimes.add('kimi'); break;
132
+ case '--grok': runtimes.add('grok'); break;
128
133
  case '--all':
129
134
  SUPPORTED_RUNTIMES.forEach(r => runtimes.add(r));
130
135
  break;
@@ -204,7 +209,7 @@ async function main() {
204
209
  if (flags.json && !flags.doctor) bail('--json is available only with --doctor');
205
210
 
206
211
  if (runtimes.length === 0) {
207
- bail('no runtime selected; use --claude / --opencode / --codex / --kimi / --all');
212
+ bail('no runtime selected; use --claude / --opencode / --codex / --kimi / --grok / --all');
208
213
  }
209
214
 
210
215
  const scope = resolveScope(flags);
@@ -49,7 +49,7 @@ function optInAllowed(settings) {
49
49
  }
50
50
 
51
51
  function parseRuntimes() {
52
- const raw = process.env.UBP_ORCH_RUNTIMES || 'claude,opencode,codex,kimi';
52
+ const raw = process.env.UBP_ORCH_RUNTIMES || 'claude,opencode,codex,kimi,grok';
53
53
  const runtimes = [...new Set(raw.split(',').map((s) => s.trim()).filter(Boolean))];
54
54
  const invalid = runtimes.filter((runtime) => !isSupportedRuntime(runtime));
55
55
  if (invalid.length > 0) {
@@ -112,7 +112,6 @@ function resolveDispatchCommand(settings, env = process.env) {
112
112
 
113
113
  function parseExecutePlanArgs(argv = []) {
114
114
  const options = {
115
- planPath: null,
116
115
  changeId: null,
117
116
  autoMerge: false,
118
117
  mergeBaseBranch: 'main',
@@ -123,7 +122,7 @@ function parseExecutePlanArgs(argv = []) {
123
122
  options.autoMerge = true;
124
123
  continue;
125
124
  }
126
- if (arg === '--plan' || arg === '--change' || arg === '--base-branch') {
125
+ if (arg === '--change' || arg === '--base-branch') {
127
126
  const value = argv[index + 1];
128
127
  if (!value || value.startsWith('--')) {
129
128
  throw commandConfigError(
@@ -131,8 +130,7 @@ function parseExecutePlanArgs(argv = []) {
131
130
  `${arg} requires a value`,
132
131
  );
133
132
  }
134
- if (arg === '--plan') options.planPath = value;
135
- else if (arg === '--change') options.changeId = value;
133
+ if (arg === '--change') options.changeId = value;
136
134
  else options.mergeBaseBranch = value;
137
135
  index += 1;
138
136
  continue;
@@ -142,12 +140,6 @@ function parseExecutePlanArgs(argv = []) {
142
140
  `unknown execute-plan option: ${arg}`,
143
141
  );
144
142
  }
145
- if (options.planPath && options.changeId) {
146
- throw commandConfigError(
147
- 'ORCHESTRATOR_ARGUMENT_INVALID',
148
- '--plan is explicit legacy compatibility and cannot be combined with --change',
149
- );
150
- }
151
143
  return options;
152
144
  }
153
145
 
@@ -177,7 +169,6 @@ async function cmdExecutePlan(argv = []) {
177
169
  const result = await parallelOrchestrator.runPlan({
178
170
  db,
179
171
  repoRoot: REPO_ROOT,
180
- planPath: options.planPath ? path.resolve(REPO_ROOT, options.planPath) : undefined,
181
172
  changeId: options.changeId,
182
173
  runtimes: parseRuntimes(),
183
174
  command: dispatch.command,
@@ -336,7 +327,7 @@ function usage() {
336
327
  process.stderr.write(
337
328
  'usage: ubp-orchestrator <execute-plan|run|start|stop|status>\n' +
338
329
  '\n' +
339
- ' execute-plan resume the first unfinished dependency wave [--change <id>] [--plan <legacy-path>] [--auto-merge] [--base-branch <name>]\n' +
330
+ ' execute-plan resume an accepted Change Plan [--change <id>] [--auto-merge] [--base-branch <name>]\n' +
340
331
  ' run foreground daemon (requires opt-in)\n' +
341
332
  ' start detached background daemon (requires opt-in)\n' +
342
333
  ' stop terminate running daemon\n' +
@@ -1,253 +1,163 @@
1
- # Ultra Builder Pro — Agent Context
1
+ # Ultra Builder Pro agent context contract
2
2
 
3
- Current shared runtime contract for the native Claude Code, OpenCode, Codex,
4
- and Kimi Code plugins.
3
+ This is the shared runtime contract for Claude Code, Codex, OpenCode, Kimi Code,
4
+ and Grok Build.
5
5
 
6
- ## 1. Ownership boundary
6
+ ## Ownership
7
7
 
8
- Ultra Builder Pro owns only:
8
+ Ultra owns:
9
9
 
10
- - eleven public capabilities: `ultra-init`, `ultra-research`, `ultra-plan`,
11
- `ultra-dev`, `ultra-test`, `ultra-review`, `ultra-deliver`, `ultra-status`,
12
- `ultra-think`, `ultra-change`, and `ultra-doctor`;
13
- - four internal agent-only rule skills: `code-review-expert`, `security-rules`,
14
- `integration-rules`, and `testing-rules`;
15
- - the host-specific collaboration companions, `ultra-verify`, and host-native
16
- explicit command or skill entry points;
17
- - bounded review/debug agents, workflow-only hooks, MCP task state, and the
18
- portable CLI/orchestrator.
10
+ - eleven explicit workflow Skills: `ultra-init`, `ultra-research`, `ultra-think`,
11
+ `ultra-change`, `ultra-plan`, `ultra-dev`, `ultra-test`, `ultra-review`,
12
+ `ultra-deliver`, `ultra-status`, and `ultra-doctor`;
13
+ - four internal worker-rule Skills;
14
+ - bounded review/debug workers;
15
+ - deterministic workflow Hooks;
16
+ - exactly seven public MCP tools;
17
+ - `.ultra` project authority, team sync, recovery, and the portable installer.
19
18
 
20
- Browser automation, deployment helpers, skill discovery, Vercel guidance, and
21
- other framework skills are external packages. Adapters build exclusively from
22
- `adapters/_shared/runtime-assets.cjs`; adding a directory under `skills/` does
23
- not put it in a plugin until that allowlist classifies it.
19
+ Ultra does not own general memory, code graphs, browser or deployment providers,
20
+ framework guidance, global user instructions, or unrelated Skills.
24
21
 
25
- ## 2. Three-layer architecture
22
+ ## Runtime model
26
23
 
27
24
  ```text
28
- native command or skill -> MCP workflow-state operation -> .ultra/.runtime/state.db
29
- | \
30
- | -> .ultra/tasks/tasks.json (Git checkpoint)
31
- | -> .ultra/.runtime/projections/ (local views)
32
- ^
33
- selected CLI init / doctor / diagnostics / orchestration
25
+ explicit Skill
26
+ -> canonical Context Envelope
27
+ -> host model reasoning and owner interaction
28
+ -> typed ultra.record
29
+ -> mutable Stage Checkpoint draft
30
+ -> accepted immutable revision
31
+ -> evidence / team sync / archive
34
32
  ```
35
33
 
36
- | Layer | Artifact | Contract |
37
- |---|---|---|
38
- | Skill/command | `skills/*/SKILL.md`, `commands/*.md` | Model-facing workflow and host-native entry point |
39
- | MCP | `mcp-server/server.cjs` | Authoritative typed operations over `.ultra/.runtime/state.db` |
40
- | CLI | `ultra-tools`, `ubp-orchestrator` | Selected initialization, backup-first recovery, automation, and diagnostics; not a change-state mirror |
41
-
42
- `.ultra/` is project-local cross-session workflow memory for normalized intent,
43
- progress, tasks, bounded context, specifications, evidence, provenance, and recovery.
44
- `.ultra/.runtime/state.db` is checkout-local lifecycle, index, transition, freshness,
45
- and coordination authority for baselines, changes, decisions, tasks, workflow
46
- runs/steps, sessions, events, incidents, projection jobs/cursors, telemetry, review
47
- evidence, and circuit-breaker state. Registered digest-bound specifications and
48
- reports carry semantic or evidence bodies. `.ultra/tasks/tasks.json` is the
49
- MCP-published portable baseline/Change/task checkpoint; it is not live lease or session
50
- authority. Generated task views, runtime checkpoints, and collaboration scratch are
51
- not independent authority. See
52
- [`ARTIFACT-AUTHORITY.md`](./ARTIFACT-AUTHORITY.md).
53
-
54
- ## 3. Live MCP and declared contracts
55
-
56
- `spec/mcp-tools.yaml` declares and the bundled server registers 60 tools across
57
- nine families:
58
-
59
- | Family | Live tools |
34
+ The host model recommends semantic routes. The user selects material intent and
35
+ external effects. MCP persists facts and enforces mechanical safety. A Hook may
36
+ observe or inject context, but cannot create a decision or accept a checkpoint.
37
+
38
+ ## Seven public tools
39
+
40
+ | Tool | Use |
60
41
  |---|---|
61
- | `baseline.*` | start, record, get, converge |
62
- | `task.*` | create, update, list, get, switch_tag, delete, init_project, expand, parse_prd, dependency_topo, append_event, subscribe_events, ledger_get, ledger_publish, ledger_import |
63
- | `session.*` | spawn, close, get, list, admission_check, heartbeat, subscribe_events |
64
- | `change.*` | create, update, delta, documentation_reconcile, get, list, context, breadcrumb, learning_propose, learning_resolve, converge, archive |
65
- | `decision.*` | thread_start, get, list, open, resolve, delegate, defer, supersede, complete, checkpoint |
66
- | `workflow.*` | start, get, list, step, revise, supersede, complete |
67
- | `artifact.*` | record, get |
68
- | `system.*` | doctor |
69
- | `plan.*` | export, get |
70
-
71
- Review, repository impact discovery, skill loading, and decision presentation remain
72
- host-native capabilities rather than fake MCP contracts. MCP stores only normalized
73
- decision authority, pending-question recovery state, lifecycle completion, and optional
74
- checkpoints; it never generates questions or retains prompts and transcripts. The
75
- generated Codex capability map documents host replacements.
76
-
77
- The complete write, transition, invalidation, and recovery contract lives in
78
- [`WORKFLOW-LIFECYCLE.md`](./WORKFLOW-LIFECYCLE.md).
79
-
80
- Any new MCP contract starts in `spec/mcp-tools.yaml` with valid and invalid
81
- fixtures. Do not add an ad-hoc server handler first.
82
-
83
- ## 4. Human-agent alignment contract
84
-
85
- `skills/ultra-think/references/decision-dialogue.md` is the single reusable prompt
86
- contract for load-bearing owner choices. Research, change, and plan read it at their
87
- decision boundaries. They inspect evidence first, expose only the earliest unresolved
88
- choice, include a recommendation and durable effects, and stop the turn. Dev, test,
89
- review, and deliver route back to the same thread instead of deciding for the owner.
90
-
91
- One partial unique index permits only one open item per thread. `decision.resolve`,
92
- `decision.delegate`, and `decision.defer` preserve the source of authority;
93
- `decision.supersede` preserves history when evidence or intent changes.
94
- After normalization, the host applies accepted intent through the owning MCP operation
95
- or digest-bound artifact, reads it back, and records typed `applied_refs` when another
96
- authority changed. Row-backed references require the exact field and canonical value;
97
- specification and artifact references require the exact file digest. Active proposals
98
- are never recalled as accepted intent. `decision.complete` then closes settled state without manufacturing
99
- an approval receipt. Prepare and confirm checkpointing remain optional and bind only a
100
- material accepted cluster to current artifact digests when interruption recovery needs
101
- that boundary. Status and breadcrumb return the current unresolved question, accepted
102
- intent relevant to the active authority, and allowed or mechanically required
103
- transitions, so recovery does not require replaying conversation history.
104
-
105
- ## 5. Context Spine contract
106
-
107
- Context Manifest v3 is an immutable DB-backed role handoff, not a static codebase summary.
108
- `change.context` compiles required references, digests, readiness, context budget,
109
- public seam, exact verification command, Change/task authority digests, and valid
110
- transitions for `plan`, `implement`, `check`, or `review`. Compilation never updates
111
- Change or provider authority; provider metadata changes through `change.update`.
112
- Snapshots are selected exactly by `change_id`, nullable `task_id`, `role`, and `gate`,
113
- so a review packet cannot satisfy implementation or planning evidence.
114
-
115
- Implementation packets inline only the selected task, direct dependency/integration
116
- neighborhood, and the restored task-context contract. Referenced file bodies remain
117
- lazy. The token estimate includes inline Change/task authority plus referenced-file
118
- estimates. Context refs preserve `expected_digest`, `anchor`, `scope`, and one of
119
- `digest`, `existence`, or `advisory` freshness. Current consumers revalidate these
120
- policies instead of trusting an old manifest.
121
-
122
- The default 12-file, about 12k-token, and 40%
123
- fresh-context values are attention guidance. Overflow produces warnings; it does
124
- not block work or require raising a threshold. Prefer direct reads, bounded
125
- excerpts, or a smaller slice when they preserve correctness, and retain all
126
- necessary context when they do not.
127
-
128
- `change.breadcrumb` is the only compact router. Hooks may inject its change/task,
129
- role, gate, readiness, blockers, bounded normalized accepted intent,
130
- `allowed_transitions`, and `required_transition`. They must not inject raw prompts,
131
- interaction transcripts, external-memory payloads, or graph payloads. Missing references,
132
- required digest drift, HEAD drift, or a missing execution seam blocks readiness. Context
133
- size and baseline drift are advisory for a change that is already active. New ordinary
134
- work requires a healthy baseline. Only an explicitly approved incident break-glass may
135
- start without it; incident archive records a blocking reconciliation gap. Revision and
136
- tracked-spec integrity are reconciled and rechecked atomically for ordinary archive.
137
-
138
- The plan workflow records a `plan/planning` manifest before design and exports only
139
- `<artifact_root>/plan.json` plus deterministic `plan.md`. Both bind the planning
140
- snapshot digest. The global `.ultra/execution-plan.json` is legacy read-only
141
- compatibility and must not receive new plan writes.
142
-
143
- Stable discoveries use `change.learning_propose`; they reach the baseline only
144
- through approve/reject/apply transitions in `change.learning_resolve`. Unresolved
145
- learning blocks convergence. Review contributes two independent axes,
146
- `spec_fidelity` and `engineering_standards`; neither can replace the other.
147
-
148
- ## 6. Native host presentation
149
-
150
- | Host | Plugin form | Workflow entry | Hook form | Collaboration companions |
151
- |---|---|---|---|---|
152
- | Claude Code | `.claude-plugin/plugin.json`, native commands/skills/agents, `.mcp.json` | `/ultra-builder-pro:ultra-*` | native `hooks/hooks.json` | `codex-collab`, `ultra-verify` |
153
- | Codex | personal plugin with `.codex-plugin/plugin.json`, namespaced skills, TOML agents, `.mcp.json` | `$ultra-builder-pro:ultra-*` | native `hooks/hooks.json` through the Codex wire adapter | `cc-collab`, `ultra-verify` |
154
- | OpenCode | config bundle plus native JavaScript plugin | `/ultra-*` | `event`, system transform, compaction, and tool lifecycle handlers | `cc-collab`, `codex-collab`, `ultra-verify` |
155
- | Kimi Code 0.26+ | managed `kimi.plugin.json` plugin with commands, skills, hooks, and MCP | `/ultra-builder-pro:ultra-*` | native hooks through the Kimi wire adapter | `cc-collab`, `codex-collab`, `ultra-verify` |
156
-
157
- `spec/interaction-contract.json` carries the same exact public-capability graph for
158
- every host. Adapters translate the question and invocation surfaces; they never own
159
- semantic selection or durable state.
160
-
161
- The current host remains primary. Collaboration skills call another runtime
162
- only when explicitly requested, use it as a read-only advisor, and return the
163
- evidence to the primary host for final verification.
164
-
165
- ## 7. Hook boundary
166
-
167
- The canonical Python hook bundle contains seven executable workflow hooks plus
168
- the shared read-only `context_spine.py` breadcrumb helper:
169
-
170
- - `health_check.py` and `workflow_context.py` on session start;
171
- - `active_task_context.py` before an edit;
172
- - `workflow_checkpoint.py` before compaction;
173
- - `workflow_resume.py` after compaction/resume;
174
- - `pre_stop_check.py` reports unfinished workflow position at stop without denial;
175
- - `subagent_tracker.py` for minimal DB event evidence containing only lifecycle ids
176
- and types, never transcript paths or messages.
177
-
178
- `workflow_context.py`, `active_task_context.py`, `workflow_resume.py`, and the
179
- OpenCode plugin invoke the same bundled JavaScript `change.breadcrumb` reader
180
- through the thin `context_spine.py` bridge. No hook reimplements the state query.
181
- `health_check.py` and
182
- `workflow_context.py` may inspect any initialized project;
183
- `active_task_context.py` protects both the MCP-owned Git checkpoint and local task
184
- projection but limits ordinary
185
- edit guidance to an active workflow. Compact/stop/subagent hooks remain
186
- active-workflow scoped. OpenCode natively injects baseline/change context and
187
- protects both managed task paths; full health inspection is available through
188
- `system.doctor` rather than a session-start health hook.
189
- Advisory baseline or context-budget warnings are presentation only and never
190
- reject an edit, stop, or tool call.
191
- Generic command blocking, post-edit governance, and unrelated user hooks are not
192
- copied into Ultra Builder Pro.
193
-
194
- ## 8. Workflow-memory boundary
195
-
196
- Ultra Builder Pro has no general memory MCP family, general recall skill, prompt
197
- capture, transcript capture, observation journal, or session-summary hook. It does
198
- retain its own project-local cross-session workflow memory under `.ultra/`.
199
- General conversational or episodic memory belongs to a separately installed provider
200
- such as cloud-mem/claude-mem. Code-graph content is equally external. A change context
201
- may contain only provider metadata references, never provider payload content.
202
-
203
- Old Ultra data is never deleted during install. The explicit migration path is:
204
-
205
- ```bash
206
- ultra-tools legacy-memory inspect
207
- ultra-tools legacy-memory archive
208
- ultra-tools legacy-memory prune --confirm DELETE_ULTRA_LEGACY_MEMORY
42
+ | `ultra.context` | Read bounded current authority without mutation |
43
+ | `ultra.record` | Persist typed facts, decisions, tasks, artifacts, outcomes, and observations |
44
+ | `ultra.checkpoint` | Save or accept a stage-level revision |
45
+ | `ultra.sync` | Inspect, migrate, import, or publish the Git checkpoint |
46
+ | `ultra.session` | Acquire/release execution authority and create a Worker Packet |
47
+ | `ultra.archive` | Perform recoverable local delivery convergence |
48
+ | `ultra.doctor` | Diagnose or backup-first repair mechanical health |
49
+
50
+ Retired operation names are not callable. Semantic incompleteness is returned as
51
+ diagnostics and leaves the draft editable. Hard errors are limited to corruption,
52
+ unsafe paths, digest/CAS/lease conflicts, missing runtime prerequisites, permissions,
53
+ and irreversible external effects.
54
+
55
+ ## Context Envelope
56
+
57
+ Every Skill begins by reading `ultra.context` for the relevant stage and scope. The
58
+ same content-addressed generator supplies Hook breadcrumbs, compact recovery, Session
59
+ handoff, and Worker Packets. It includes:
60
+
61
+ - project/host identity and health;
62
+ - Git head, scope digest, and drift classification;
63
+ - accepted baseline and evidence references;
64
+ - current Change and Task contracts;
65
+ - accepted normalized Decision Records;
66
+ - typed evidence references and freshness;
67
+ - current execution lease/worktree/packet;
68
+ - warnings, `needs_attention`, and hard conflicts.
69
+
70
+ Summary output stays within 16 KiB. Selected full output stays within 64 KiB. Large
71
+ file bodies remain lazy references. Identical authority must reuse one digest and
72
+ snapshot.
73
+
74
+ ## Interaction
75
+
76
+ ```text
77
+ inspect -> suggest -> host-native ask when needed -> normalize
78
+ -> persist -> apply -> read back
209
79
  ```
210
80
 
211
- Archive before prune; the confirmation token is intentionally required.
212
- This CLI is an operator-invoked migration cleanup surface only. Hooks, MCP, and
213
- sessions never call it, and it cannot collect, recall, or reflect memory.
81
+ Do not ask again when the current user message already resolves the decision. Persist
82
+ only the normalized question, recommendation, selection, effects, non-goals,
83
+ provenance, applied references, status, digest, and supersession. Never persist raw
84
+ conversation, chain-of-thought, full prompts, or UI receipts.
85
+
86
+ Host question surfaces:
214
87
 
215
- ## 9. Project state layout
88
+ - Claude Code and Kimi Code: `AskUserQuestion`;
89
+ - Codex: `request_user_input` when available;
90
+ - OpenCode: `question`;
91
+ - Grok Build: its native structured question surface when available, otherwise one
92
+ concise conversational question.
93
+
94
+ If the host mode forbids interaction, leave the decision unresolved.
95
+
96
+ ## Stage Checkpoints
97
+
98
+ Skills describe adaptive evidence expectations; SQLite does not authorize a fixed
99
+ step sequence. A stage has a mutable draft and immutable accepted revisions:
216
100
 
217
101
  ```text
218
- .ultra/
219
- ├── .runtime/
220
- │ ├── state.db # authoritative SQLite lifecycle/index store
221
- │ ├── checkpoint.json # advisory breadcrumb recovery projection
222
- │ └── projections/ # generated checkout-local task views
223
- ├── changes/
224
- │ ├── active/<id>/ # all Change semantics and evidence
225
- │ │ ├── intent.md, findings.md, progress.md
226
- │ │ ├── research/, delta/, documentation/, plan.json, plan.md
227
- │ │ └── contexts/, test/, review/, delivery/
228
- │ └── archive/ # converged packets after baseline reconciliation
229
- ├── tasks/
230
- │ └── tasks.json # MCP-published Git team checkpoint
231
- ├── templates/
232
- │ └── task-context.md # authored task-context template
233
- ├── specs/ # research/product/architecture artifacts
234
- └── reports/templates/ # blank report schemas; never evidence
102
+ draft N -> accepted N -> superseded by accepted N+1
235
103
  ```
236
104
 
237
- ## 10. Plugin and user-instruction isolation
105
+ Warnings and semantic gaps do not lock a draft. An accepted revision can be replaced
106
+ by a later accepted revision without rewriting history.
107
+
108
+ ## Worker handoff
109
+
110
+ Every worker must receive one immutable Worker Packet generated from current authority.
111
+ The packet binds:
112
+
113
+ - role, runtime, Change/Task scope, and output schema;
114
+ - Context Envelope path/digest;
115
+ - accepted Decision Records and digest;
116
+ - Git head/diff/changed files;
117
+ - Task contract, acceptance, and digest;
118
+ - evidence references;
119
+ - exact output path;
120
+ - `packet_digest`.
121
+
122
+ Workers may inspect and write only the declared output. They do not write SQLite,
123
+ accept checkpoints, modify another worker's result, or decide final delivery. Output
124
+ must echo `packet_digest`; the primary host verifies and records it.
125
+
126
+ ## Hook boundary
127
+
128
+ The canonical Hook bundle uses `context_envelope.py`, not a parallel context reader.
129
+ Hooks may:
130
+
131
+ - report health and inject a compact envelope;
132
+ - protect MCP-owned team checkpoints and generated projections;
133
+ - save/restore minimal compact recovery state;
134
+ - append minimal lifecycle identifiers;
135
+ - report an advisory Stop summary.
136
+
137
+ Hooks may not select a route, manufacture a semantic record, capture prompts or
138
+ transcripts, block ordinary work for semantic incompleteness, or claim an ignored
139
+ stdout channel was injected. Every Skill still reads authoritative Context at entry.
140
+
141
+ ## Five host presentations
142
+
143
+ | Host | Entry | Worker surface | Context behavior |
144
+ |---|---|---|---|
145
+ | Claude Code | `/ultra-builder-pro:ultra-*` | native agents | SessionStart compact + Skill full |
146
+ | Codex | `$ultra-builder-pro:ultra-*` | managed TOML agents | session/prompt compact + Skill full |
147
+ | OpenCode | `/ultra-*` | native agents | system transform + Skill full |
148
+ | Kimi Code | `/ultra-builder-pro:ultra-*` | Agent/AgentSwarm templates | native compact where supported + Skill full |
149
+ | Grok Build | native Ultra commands/Skills | plugin agent templates | Skill full is authoritative; Hook stdout limitations are explicit |
238
150
 
239
- General engineering doctrine and long-term personal preferences live in each
240
- host's durable `CLAUDE.md` or `AGENTS.md`. Ultra never writes those files. Its
241
- workflow doctrine remains in plugin-owned skills and is loaded only through an
242
- explicit public invocation.
151
+ Adapters own only translation and wiring. The active host remains primary; optional
152
+ cross-host collaboration is explicit and read-only.
243
153
 
244
- Installation and uninstall own only adapter-declared commands, skills, workers,
245
- hooks, runtime assets, provenance, and host registration. Project authority is
246
- created only by an explicit `ultra-init`, and uninstall never deletes `.ultra/`.
247
- See [`PLUGIN-ISOLATION-CONTRACT.md`](./PLUGIN-ISOLATION-CONTRACT.md).
154
+ ## Storage
248
155
 
249
- ## 11. Verification
156
+ Tracked `.ultra` files carry inspectable intent, specifications, plans, Decision
157
+ Records, test/review/delivery evidence, and archives. `.ultra/tasks/tasks.json` is a
158
+ digest-chained team checkpoint. `.ultra/.runtime/` is ignored and contains SQLite,
159
+ generated projections, Sessions, worktrees, recovery, backups, telemetry, and debug
160
+ state.
250
161
 
251
- Run `npm run test:all`, `python3 -m pytest hooks/tests -q`, and `npm audit`.
252
- Adapter tests assert the allowlisted assets, native manifests, hook boundary,
253
- MCP visibility, and host-specific skill rendering.
162
+ Every semantic file must have one writer, owner, consumer, digest, promotion gate, and
163
+ archive rule as defined in `ARTIFACT-AUTHORITY.md`.