ultra-builder-pro-cli 0.23.0 → 0.24.1

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 (95) hide show
  1. package/.ultra-template/docs/research/README.md +4 -4
  2. package/.ultra-template/tasks/tasks.json +4 -2
  3. package/CHANGELOG.md +72 -0
  4. package/README.md +55 -39
  5. package/adapters/_shared/codex-assets.cjs +121 -65
  6. package/adapters/_shared/interaction-contract.cjs +7 -1
  7. package/adapters/_shared/provenance.cjs +7 -2
  8. package/adapters/_shared/runtime-assets.cjs +3 -2
  9. package/adapters/_shared/runtime-native.cjs +132 -0
  10. package/adapters/claude.js +60 -30
  11. package/adapters/codex.js +178 -81
  12. package/adapters/grok.js +372 -0
  13. package/adapters/kimi.js +7 -3
  14. package/adapters/opencode.js +210 -32
  15. package/agents/code-reviewer.md +4 -2
  16. package/agents/debugger.md +4 -1
  17. package/agents/review-code.md +7 -3
  18. package/agents/review-comments.md +7 -4
  19. package/agents/review-coordinator.md +11 -7
  20. package/agents/review-design.md +8 -4
  21. package/agents/review-errors.md +8 -4
  22. package/agents/review-spec.md +8 -5
  23. package/agents/review-tests.md +7 -4
  24. package/agents/tdd-runner.md +5 -2
  25. package/bin/install.js +9 -4
  26. package/bin/orchestrator.js +4 -13
  27. package/docs/AGENT-CONTEXT.md +143 -229
  28. package/docs/ARCHITECTURE.md +205 -494
  29. package/docs/ARTIFACT-AUTHORITY.md +35 -28
  30. package/docs/LEGACY-CLI-CROSSWALK.md +1 -1
  31. package/docs/PLUGIN-ISOLATION-CONTRACT.md +12 -9
  32. package/docs/ROADMAP.md +85 -110
  33. package/docs/RUNTIME-COMPAT-MATRIX.md +139 -175
  34. package/docs/SKILL-AUTHORING.md +3 -3
  35. package/docs/STATE-DB-ACCESS-POLICY.md +13 -8
  36. package/docs/WORKFLOW-LIFECYCLE.md +189 -448
  37. package/hooks/README.md +11 -8
  38. package/hooks/active_task_context.py +16 -16
  39. package/hooks/adapters/grok.py +134 -0
  40. package/hooks/{context_spine.py → context_envelope.py} +26 -22
  41. package/hooks/health_check.py +29 -34
  42. package/hooks/pre_stop_check.py +22 -12
  43. package/hooks/subagent_tracker.py +1 -1
  44. package/hooks/workflow_checkpoint.py +14 -13
  45. package/hooks/workflow_context.py +11 -12
  46. package/hooks/workflow_resume.py +14 -13
  47. package/mcp-server/{breadcrumb.cjs → hook-context.cjs} +7 -9
  48. package/mcp-server/lib/baseline-workflow.cjs +108 -82
  49. package/mcp-server/lib/canonical-json.cjs +19 -0
  50. package/mcp-server/lib/change-authority.cjs +26 -0
  51. package/mcp-server/lib/change-workflow.cjs +630 -45
  52. package/mcp-server/lib/context-envelope.cjs +508 -0
  53. package/mcp-server/lib/decision-records.cjs +337 -0
  54. package/mcp-server/lib/doctor.cjs +91 -33
  55. package/mcp-server/lib/init-project.cjs +78 -39
  56. package/mcp-server/lib/managed-file-write.cjs +116 -0
  57. package/mcp-server/lib/plan-checkpoint.cjs +177 -0
  58. package/mcp-server/lib/project-context.cjs +178 -0
  59. package/mcp-server/lib/stage-checkpoints.cjs +309 -0
  60. package/mcp-server/lib/state-db.cjs +155 -24
  61. package/mcp-server/lib/state-ops.cjs +21 -3
  62. package/mcp-server/lib/task-ledger.cjs +522 -13
  63. package/mcp-server/lib/ultra-facade.cjs +757 -442
  64. package/mcp-server/lib/worker-packet.cjs +358 -0
  65. package/mcp-server/server.cjs +200 -1103
  66. package/orchestrator/daemon.cjs +27 -9
  67. package/orchestrator/parallel-orchestrator.cjs +111 -76
  68. package/orchestrator/session-runner.cjs +135 -34
  69. package/package.json +10 -3
  70. package/skills/ultra-change/SKILL.md +10 -8
  71. package/skills/ultra-deliver/SKILL.md +17 -19
  72. package/skills/ultra-dev/SKILL.md +20 -11
  73. package/skills/ultra-doctor/SKILL.md +4 -4
  74. package/skills/ultra-init/SKILL.md +6 -5
  75. package/skills/ultra-init/references/brownfield-adoption.md +20 -14
  76. package/skills/ultra-plan/SKILL.md +13 -9
  77. package/skills/ultra-research/SKILL.md +18 -9
  78. package/skills/ultra-review/SKILL.md +14 -9
  79. package/skills/ultra-review/references/unified-schema.md +2 -0
  80. package/skills/ultra-review/scripts/review_wait.py +8 -0
  81. package/skills/ultra-status/SKILL.md +2 -2
  82. package/skills/ultra-test/SKILL.md +10 -6
  83. package/skills/ultra-think/SKILL.md +8 -7
  84. package/skills/ultra-think/references/interaction-boundary.md +56 -0
  85. package/spec/cli-protocol.md +80 -199
  86. package/spec/mcp-tools.yaml +43 -2806
  87. package/spec/schemas/state-db.sql +107 -4
  88. package/spec/schemas/{task-ledger.v1.schema.json → task-ledger.v2.schema.json} +70 -6
  89. package/ultra-tools/commands/status.cjs +369 -243
  90. package/mcp-server/lib/context-spine.cjs +0 -1208
  91. package/mcp-server/lib/decision-dialogue.cjs +0 -1128
  92. package/mcp-server/lib/project-breadcrumb.cjs +0 -173
  93. package/mcp-server/lib/spec-learning.cjs +0 -284
  94. package/mcp-server/lib/workflow-state.cjs +0 -3129
  95. package/skills/ultra-think/references/decision-dialogue.md +0 -155
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,251 +1,165 @@
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 -> 7-tool MCP safety kernel -> .ultra/.runtime/state.db
29
- | \
30
- | -> .ultra/tasks/tasks.json (Git checkpoint)
31
- | -> .ultra/.runtime/projections/ (local views)
32
- ^
33
- CLI 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` | Persistence, semantic checkpoints, team sync, leases, archive transactions, and mechanical recovery |
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. Public MCP kernel and compatibility layer
55
-
56
- Every host discovers the same seven model-facing tools:
57
-
58
- | Public tool | Contract |
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 |
59
41
  |---|---|
60
- | `ultra.context` | side-effect-free current authority and evidence spine |
61
- | `ultra.record` | idempotent batch recording of typed draft facts and events |
62
- | `ultra.checkpoint` | one semantic stage commit; rejection keeps the draft mutable |
63
- | `ultra.sync` | Git team-checkpoint inspect/import/publish |
64
- | `ultra.session` | transactional execution lease |
65
- | `ultra.archive` | recoverable convergence and archive boundary |
66
- | `ultra.doctor` | mechanical diagnosis and backup-first repair |
67
-
68
- The public schemas stay below a 12KB discovery budget. The sixty 0.22 fine-grained
69
- task/session/baseline/change/decision/workflow/artifact/system/plan tools remain
70
- callable but undiscoverable for one compatibility release. They are implementation
71
- operations, not a second public API, and Skills must not call them directly.
72
-
73
- Semantic rejections return `accepted: false`, `mutable: true`, and diagnostics. Hard
74
- MCP errors are reserved for corruption, unsafe paths, real concurrency conflicts,
75
- permissions, or irreversible effects. Review, repository discovery, model reasoning,
76
- and owner interaction remain host-native.
77
-
78
- The complete write, transition, invalidation, and recovery contract lives in
79
- [`WORKFLOW-LIFECYCLE.md`](./WORKFLOW-LIFECYCLE.md).
80
-
81
- Any new MCP contract starts in `spec/mcp-tools.yaml` with valid and invalid
82
- fixtures. Do not add an ad-hoc server handler first.
83
-
84
- ## 4. Human-agent alignment contract
85
-
86
- `skills/ultra-think/references/decision-dialogue.md` is the single reusable prompt
87
- contract for load-bearing owner choices. Research, change, and plan read it at their
88
- decision boundaries. They inspect evidence first, expose only the earliest unresolved
89
- choice, include a recommendation and durable effects, and stop the turn. Dev, test,
90
- review, and deliver route back to the same thread instead of deciding for the owner.
91
-
92
- One partial unique index permits only one open item per thread. `decision.resolve`,
93
- `decision.delegate`, and `decision.defer` preserve the source of authority;
94
- `decision.supersede` preserves history when evidence or intent changes.
95
- After normalization, the host records accepted intent in one `ultra.record` batch,
96
- reads it back through `ultra.context`, and attempts an owning `ultra.checkpoint` only
97
- when durable authority is ready. Active proposals are never recalled as accepted
98
- intent. Status returns the current unresolved question, accepted intent, evidence,
99
- warnings, and hard blockers so recovery does not require replaying conversation
100
- history. The host model, not SQLite, recommends the next capability.
101
-
102
- ## 5. Context Spine contract
103
-
104
- Context Manifest v3 is an immutable DB-backed role handoff, not a static codebase summary.
105
- `ultra.checkpoint` compiles or reuses a content-addressed Context Manifest containing
106
- required references, digests, readiness, context budget, public seam, exact verification
107
- command, and Change/task authority digests for `plan`, `implement`, `check`, or
108
- `review`. Compilation never updates
109
- Change or provider authority; provider metadata changes through `change.update`.
110
- Snapshots are selected exactly by `change_id`, nullable `task_id`, `role`, and `gate`,
111
- so a review packet cannot satisfy implementation or planning evidence.
112
-
113
- Implementation packets inline only the selected task, direct dependency/integration
114
- neighborhood, and the restored task-context contract. Referenced file bodies remain
115
- lazy. The token estimate includes inline Change/task authority plus referenced-file
116
- estimates. Context refs preserve `expected_digest`, `anchor`, `scope`, and one of
117
- `digest`, `existence`, or `advisory` freshness. Current consumers revalidate these
118
- policies instead of trusting an old manifest.
119
-
120
- The default 12-file, about 12k-token, and 40%
121
- fresh-context values are attention guidance. Overflow produces warnings; it does
122
- not block work or require raising a threshold. Prefer direct reads, bounded
123
- excerpts, or a smaller slice when they preserve correctness, and retain all
124
- necessary context when they do not.
125
-
126
- The compact breadcrumb is a hook-only compatibility reader. Hooks may inject its
127
- change/task, role, gate, readiness, blockers, and bounded normalized accepted intent.
128
- They must not inject raw prompts,
129
- interaction transcripts, external-memory payloads, or graph payloads. Missing references,
130
- required digest drift, HEAD drift, or a missing execution seam blocks readiness. Context
131
- size and baseline drift are advisory for a change that is already active. New ordinary
132
- work requires a healthy baseline. Only an explicitly approved incident break-glass may
133
- start without it; incident archive records a blocking reconciliation gap. Revision and
134
- tracked-spec integrity are reconciled and rechecked atomically for ordinary archive.
135
-
136
- The plan workflow records a `plan/planning` manifest before design and exports only
137
- `<artifact_root>/plan.json` plus deterministic `plan.md`. Both bind the planning
138
- snapshot digest. The global `.ultra/execution-plan.json` is legacy read-only
139
- compatibility and must not receive new plan writes.
140
-
141
- Stable discoveries use `change.learning_propose`; they reach the baseline only
142
- through approve/reject/apply transitions in `change.learning_resolve`. Unresolved
143
- learning blocks convergence. Review contributes two independent axes,
144
- `spec_fidelity` and `engineering_standards`; neither can replace the other.
145
-
146
- ## 6. Native host presentation
147
-
148
- | Host | Plugin form | Workflow entry | Hook form | Collaboration companions |
149
- |---|---|---|---|---|
150
- | Claude Code | `.claude-plugin/plugin.json`, native commands/skills/agents, `.mcp.json` | `/ultra-builder-pro:ultra-*` | native `hooks/hooks.json` | `codex-collab`, `ultra-verify` |
151
- | 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` |
152
- | OpenCode | config bundle plus native JavaScript plugin | `/ultra-*` | `event`, system transform, compaction, and tool lifecycle handlers | `cc-collab`, `codex-collab`, `ultra-verify` |
153
- | 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` |
154
-
155
- `spec/interaction-contract.json` carries the same exact public-capability graph for
156
- every host. Adapters translate the question and invocation surfaces; they never own
157
- semantic selection or durable state.
158
-
159
- The current host remains primary. Collaboration skills call another runtime
160
- only when explicitly requested, use it as a read-only advisor, and return the
161
- evidence to the primary host for final verification.
162
-
163
- ## 7. Hook boundary
164
-
165
- The canonical Python hook bundle contains seven executable workflow hooks plus
166
- the shared read-only `context_spine.py` breadcrumb helper:
167
-
168
- - `health_check.py` and `workflow_context.py` on session start;
169
- - `active_task_context.py` before an edit;
170
- - `workflow_checkpoint.py` before compaction;
171
- - `workflow_resume.py` after compaction/resume;
172
- - `pre_stop_check.py` reports unfinished workflow position at stop without denial;
173
- - `subagent_tracker.py` for minimal DB event evidence containing only lifecycle ids
174
- and types, never transcript paths or messages.
175
-
176
- `workflow_context.py`, `active_task_context.py`, `workflow_resume.py`, and the
177
- OpenCode plugin invoke the same bundled JavaScript hook-only breadcrumb reader
178
- through the thin `context_spine.py` bridge. No hook reimplements the state query.
179
- `health_check.py` and
180
- `workflow_context.py` may inspect any initialized project;
181
- `active_task_context.py` protects both the MCP-owned Git checkpoint and local task
182
- projection but limits ordinary
183
- edit guidance to an active workflow. Compact/stop/subagent hooks remain
184
- active-workflow scoped. OpenCode natively injects baseline/change context and
185
- protects both managed task paths; full health inspection is available through
186
- `ultra.doctor` rather than a session-start health hook.
187
- Advisory baseline or context-budget warnings are presentation only and never
188
- reject an edit, stop, or tool call.
189
- Generic command blocking, post-edit governance, and unrelated user hooks are not
190
- copied into Ultra Builder Pro.
191
-
192
- ## 8. Workflow-memory boundary
193
-
194
- Ultra Builder Pro has no general memory MCP family, general recall skill, prompt
195
- capture, transcript capture, observation journal, or session-summary hook. It does
196
- retain its own project-local cross-session workflow memory under `.ultra/`.
197
- General conversational or episodic memory belongs to a separately installed provider
198
- such as cloud-mem/claude-mem. Code-graph content is equally external. A change context
199
- may contain only provider metadata references, never provider payload content.
200
-
201
- Old Ultra data is never deleted during install. The explicit migration path is:
202
-
203
- ```bash
204
- ultra-tools legacy-memory inspect
205
- ultra-tools legacy-memory archive
206
- 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
207
79
  ```
208
80
 
209
- Archive before prune; the confirmation token is intentionally required.
210
- This CLI is an operator-invoked migration cleanup surface only. Hooks, MCP, and
211
- 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:
212
87
 
213
- ## 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 and decide semantic sufficiency;
99
+ SQLite does not authorize a fixed step sequence or reinterpret the supplied verdict.
100
+ A stage has a mutable draft and immutable accepted revisions:
214
101
 
215
102
  ```text
216
- .ultra/
217
- ├── .runtime/
218
- │ ├── state.db # authoritative SQLite lifecycle/index store
219
- │ ├── checkpoint.json # advisory breadcrumb recovery projection
220
- │ └── projections/ # generated checkout-local task views
221
- ├── changes/
222
- │ ├── active/<id>/ # all Change semantics and evidence
223
- │ │ ├── intent.md, findings.md, progress.md
224
- │ │ ├── research/, delta/, documentation/, plan.json, plan.md
225
- │ │ └── contexts/, test/, review/, delivery/
226
- │ └── archive/ # converged packets after baseline reconciliation
227
- ├── tasks/
228
- │ └── tasks.json # MCP-published Git team checkpoint
229
- ├── templates/
230
- │ └── task-context.md # authored task-context template
231
- ├── specs/ # research/product/architecture artifacts
232
- └── reports/templates/ # blank report schemas; never evidence
103
+ draft N -> accepted N -> superseded by accepted N+1
233
104
  ```
234
105
 
235
- ## 10. Plugin and user-instruction isolation
106
+ Warnings and semantic gaps do not reject explicit acceptance. Structural, digest,
107
+ path, publication, and concurrency conflicts leave the draft mutable. An accepted
108
+ revision can be replaced by a later accepted revision without rewriting history.
109
+
110
+ ## Worker handoff
111
+
112
+ Every worker must receive one immutable Worker Packet generated from current authority.
113
+ The packet binds:
114
+
115
+ - role, runtime, Change/Task scope, and output schema;
116
+ - Context Envelope path/digest;
117
+ - accepted Decision Records and digest;
118
+ - Git head/diff/changed files;
119
+ - Task contract, acceptance, and digest;
120
+ - evidence references;
121
+ - exact output path;
122
+ - `packet_digest`.
123
+
124
+ Workers may inspect and write only the declared output. They do not write SQLite,
125
+ accept checkpoints, modify another worker's result, or decide final delivery. Output
126
+ must echo `packet_digest`; the primary host verifies and records it.
127
+
128
+ ## Hook boundary
129
+
130
+ The canonical Hook bundle uses `context_envelope.py`, not a parallel context reader.
131
+ Hooks may:
132
+
133
+ - report health and inject a compact envelope;
134
+ - protect MCP-owned team checkpoints and generated projections;
135
+ - save/restore minimal compact recovery state;
136
+ - append minimal lifecycle identifiers;
137
+ - report an advisory Stop summary.
138
+
139
+ Hooks may not select a route, manufacture a semantic record, capture prompts or
140
+ transcripts, block ordinary work for semantic incompleteness, or claim an ignored
141
+ stdout channel was injected. Every Skill still reads authoritative Context at entry.
142
+
143
+ ## Five host presentations
144
+
145
+ | Host | Entry | Worker surface | Context behavior |
146
+ |---|---|---|---|
147
+ | Claude Code | `/ultra-builder-pro:ultra-*` | native agents | SessionStart compact + Skill full |
148
+ | Codex | `$ultra-builder-pro:ultra-*` | managed TOML agents | session/prompt compact + Skill full |
149
+ | OpenCode | `/ultra-*` | native agents | system transform + Skill full |
150
+ | Kimi Code | `/ultra-builder-pro:ultra-*` | Agent/AgentSwarm templates | native compact where supported + Skill full |
151
+ | Grok Build | native Ultra commands/Skills | plugin agent templates | Skill full is authoritative; Hook stdout limitations are explicit |
236
152
 
237
- General engineering doctrine and long-term personal preferences live in each
238
- host's durable `CLAUDE.md` or `AGENTS.md`. Ultra never writes those files. Its
239
- workflow doctrine remains in plugin-owned skills and is loaded only through an
240
- explicit public invocation.
153
+ Adapters own only translation and wiring. The active host remains primary; optional
154
+ cross-host collaboration is explicit and read-only.
241
155
 
242
- Installation and uninstall own only adapter-declared commands, skills, workers,
243
- hooks, runtime assets, provenance, and host registration. Project authority is
244
- created only by an explicit `ultra-init`, and uninstall never deletes `.ultra/`.
245
- See [`PLUGIN-ISOLATION-CONTRACT.md`](./PLUGIN-ISOLATION-CONTRACT.md).
156
+ ## Storage
246
157
 
247
- ## 11. Verification
158
+ Tracked `.ultra` files carry inspectable intent, specifications, plans, Decision
159
+ Records, test/review/delivery evidence, and archives. `.ultra/tasks/tasks.json` is a
160
+ digest-chained team checkpoint. `.ultra/.runtime/` is ignored and contains SQLite,
161
+ generated projections, Sessions, worktrees, recovery, backups, telemetry, and debug
162
+ state.
248
163
 
249
- Run `npm run test:all`, `python3 -m pytest hooks/tests -q`, and `npm audit`.
250
- Adapter tests assert the allowlisted assets, native manifests, hook boundary,
251
- MCP visibility, and host-specific skill rendering.
164
+ Every semantic file must have one writer, owner, consumer, digest, promotion gate, and
165
+ archive rule as defined in `ARTIFACT-AUTHORITY.md`.