Skip to content

Commit 4422003

Browse files
committed
feat(mcp): reduce Ultra to a seven-tool kernel
Cause: the 0.22 MCP exposed 60 fine-grained operations and encoded semantic workflow sequencing as hard state-machine gates, creating high prompt cost, repeated model round trips, and unrecoverable draft self-locks. Scope: add the seven-tool public facade, keep legacy operations hidden for one compatibility release, make drafts reversible, collapse semantic checkpoint bookkeeping, make context compilation idempotent, update four host adapters and all public Skills, and release package metadata as 0.23.0. Verification: npm run verify:release; 18 Skill Creator validations; Codex plugin validator; npm pack --dry-run --json; git diff --check. Residual risk: hidden 0.22 compatibility operations remain callable for one release and should be removed only after downstream migration evidence. Rollback: reinstall 0.22.0 and revert this commit; accepted SQLite revisions remain backward-readable by the retained compatibility layer.
1 parent 2813619 commit 4422003

49 files changed

Lines changed: 2380 additions & 1170 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ not create or rewrite that file.
77
## Product boundary
88

99
Ultra Builder Pro is a host-adapted workflow plugin for Claude Code, Codex, OpenCode,
10-
and Kimi Code. It owns workflow authority, evidence, recovery, host adapters, and the
11-
minimal prompts required to operate them.
10+
and Kimi Code. It owns durable project checkpoints, evidence, recovery, host adapters,
11+
and the minimal prompts required to operate them. The host model owns semantic
12+
reasoning and route selection; MCP is a persistence and safety kernel, not a
13+
fine-grained workflow supervisor.
1214

1315
It owns project-local cross-session workflow memory under `.ultra/`: normalized intent,
1416
progress, tasks, bounded context, specifications, evidence, provenance, and recovery.
@@ -20,8 +22,11 @@ Keep those capabilities in separately installed owner packages.
2022

2123
- `adapters/_shared/runtime-assets.cjs`: packaged Skill, hook, and collaboration allowlists.
2224
- `docs/PLUGIN-ISOLATION-CONTRACT.md`: installation, activation, idle, and ownership boundaries.
23-
- `mcp-server/lib/workflow-state.cjs`: workflow state transitions and durable gates.
24-
- `spec/mcp-tools.yaml`: public MCP contract.
25+
- `mcp-server/lib/ultra-facade.cjs`: seven-tool model-facing MCP kernel.
26+
- `mcp-server/lib/workflow-state.cjs`: hidden compatibility bookkeeping and durable
27+
checkpoint validation.
28+
- `spec/mcp-tools.yaml`: seven public contracts plus one-release hidden compatibility
29+
contracts.
2530
- `skills/*/SKILL.md`: reusable workflow prompts.
2631
- Codex plugin Skills: native `$ultra-builder-pro:<skill>` entry points.
2732
- `.ultra/.runtime/state.db`: lifecycle, index, transition, freshness, and coordination authority
@@ -52,8 +57,10 @@ one workflow may recommend but must not launch another.
5257
4. Run the narrow test first, then the relevant package suite.
5358
5. Inspect the final diff and packaged artifact.
5459

55-
Do not weaken gates merely to make tests pass. Context-size guidance is advisory;
56-
authority, security, irreversible effects, and evidence integrity may block.
60+
Do not turn semantic advice, incomplete exploration, or an editable draft into a hard
61+
MCP failure. Failed checkpoints report mutable diagnostics. Corruption, unsafe paths,
62+
true concurrency conflicts, permissions, irreversible effects, and accepted evidence
63+
integrity remain fail-closed. Context-size guidance is advisory.
5764

5865
## Verification
5966

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.23.0] — 2026-07-30
11+
12+
### Added
13+
14+
- Added a seven-tool public MCP kernel: `ultra.context`, `ultra.record`,
15+
`ultra.checkpoint`, `ultra.sync`, `ultra.session`, `ultra.archive`, and
16+
`ultra.doctor`.
17+
- Added idempotent batched recording, content-addressed Context snapshots, and
18+
semantic checkpoints that commit accepted workflow authority in one model
19+
round trip.
20+
- Added mutable diagnostic envelopes for rejected draft checkpoints and
21+
archive preflights so the host model can correct or abandon the same draft.
22+
23+
### Changed
24+
25+
- Moved workflow sequencing and semantic judgment back into the eleven public
26+
Skills. MCP now owns persistence, schema, transaction, concurrency, path,
27+
recovery, and irreversible-effect boundaries instead of directing the model.
28+
- Reduced the unconditional `tools/list` surface from 60 fine-grained tools to
29+
seven high-level tools. The 0.22 fine-grained contracts remain callable but
30+
hidden for one compatibility release.
31+
- Made draft Changes and nonterminal workflows reversible while keeping
32+
accepted revisions immutable and replaceable through a new draft.
33+
- Updated Claude Code, Codex, OpenCode, and Kimi assets to use the same narrow
34+
capability graph while preserving each host's native question and bounded
35+
worker surfaces.
36+
37+
### Fixed
38+
39+
- Fixed Plan drafts becoming permanently self-locked when a task or exported
40+
artifact changed after validation.
41+
- Fixed semantic validation failures surfacing as MCP transport errors and
42+
forcing models into repeated repair calls.
43+
- Fixed duplicate Context compilation creating competing snapshots for the
44+
same semantic inputs.
45+
- Fixed `ultra.context` creating `.ultra` state merely by inspecting an
46+
uninitialized project.
47+
1048
## [0.22.0] — 2026-07-30
1149

1250
### Added

README.md

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ flowchart TB
7171
end
7272
7373
SKILLS["Eleven explicit Ultra Skills<br/>init / research / think / change / plan / dev<br/>test / review / deliver / status / doctor"]
74-
MCP["Ultra MCP<br/>60 typed tools across nine families"]
74+
MCP["Ultra MCP safety kernel<br/>7 public tools; 60 hidden compatibility operations"]
7575
DB[(".ultra/.runtime/state.db<br/>SQLite lifecycle and index authority")]
7676
LEDGER[".ultra/tasks/tasks.json<br/>Git team checkpoint for portable baseline, Change, and task state"]
7777
VIEWS[".ultra/.runtime/projections<br/>checkout-local generated views"]
@@ -103,13 +103,42 @@ The responsibility split is deliberate:
103103
|---|---|
104104
| **User** | Product intent, semantic route selection, material scope and trade-offs, risk acceptance, destructive actions, publishing and deployment authorization |
105105
| **Host model** | Fact-finding, synthesis, research-coverage and route recommendations, reversible implementation decisions |
106-
| **Ultra MCP** | Checkout-local state, evidence references, digests, freshness, locks, valid transitions, hard recovery, and Git checkpoint publish/import |
106+
| **Ultra MCP** | Durable checkpoints, evidence references, digests, team sync, leases, archive transactions, and mechanical recovery |
107107
| **Host adapter** | Native Skill discovery, user questions, tool invocation, installation, and runtime wiring |
108108
| **Hooks** | Fast lifecycle observation, current breadcrumb injection, and protection of MCP-owned checkpoint and generated projection paths |
109109

110-
The MCP does not replace the model's judgment. A hook does not decide product
111-
strategy. A prompt does not become durable authority merely because it appeared
112-
in a conversation.
110+
The MCP does not replace the model's judgment or pre-authorize a semantic route. It
111+
reports draft diagnostics and commits accepted checkpoints. A hook does not decide
112+
product strategy. A prompt does not become durable authority merely because it
113+
appeared in a conversation.
114+
115+
### The seven-tool MCP kernel
116+
117+
The public model-facing surface is intentionally small:
118+
119+
| Tool | Responsibility |
120+
|---|---|
121+
| `ultra.context` | Read the complete current spine without side effects |
122+
| `ultra.record` | Batch typed draft facts and events with idempotency |
123+
| `ultra.checkpoint` | Attempt one semantic stage checkpoint; rejection leaves the draft editable |
124+
| `ultra.sync` | Inspect, import, or publish the Git team checkpoint |
125+
| `ultra.session` | Own the transactional execution lease |
126+
| `ultra.archive` | Converge and archive through the recoverable filesystem/DB boundary |
127+
| `ultra.doctor` | Inspect or repair mechanical health, backup first |
128+
129+
The 0.22 fine-grained tools remain callable but undiscoverable for one compatibility
130+
release. Skills and new sessions use only the seven tools above. Workflow prose stays
131+
in Skills, model judgment stays with the host, and SQLite records what happened rather
132+
than deciding what the model is allowed to think next.
133+
134+
The enforcement gradient is:
135+
136+
```text
137+
exploration and iteration: advisory
138+
durable semantic checkpoint: validated and recoverable
139+
corruption / unsafe path / real concurrency / permission: fail closed
140+
irreversible external effect: explicit owner authority plus fail closed
141+
```
113142

114143
### How owner intent becomes durable authority
115144

@@ -121,9 +150,9 @@ flowchart TD
121150
CLEAR -->|"Yes"| NORMALIZE["Normalize the accepted intent"]
122151
CLEAR -->|"No: a material choice remains"| ASK["Ask one dependent question through the host-native question tool"]
123152
ASK --> NORMALIZE
124-
NORMALIZE --> DECISION["Persist the normalized result through decision.*"]
125-
DECISION --> APPLY["Apply it through the owning MCP operation or digest-bound artifact"]
126-
APPLY --> AUTHORITY["Bind state, artifact digest, provenance, and downstream effects"]
153+
NORMALIZE --> RECORD["Batch the normalized result through ultra.record"]
154+
RECORD --> CHECKPOINT["Attempt the owning ultra.checkpoint when authority is ready"]
155+
CHECKPOINT --> AUTHORITY["Bind state, artifact digest, provenance, and downstream effects"]
127156
AUTHORITY --> READBACK["Read back the authoritative result"]
128157
READBACK --> RESUME["Resume the exact workflow step and recommend the next explicit capability"]
129158
```
@@ -299,9 +328,9 @@ already resolves the route. The normalized accepted coverage is then stored in
299328
- `deferred` — record the consequence and accepted owner.
300329

301330
The catalog is not a mandatory document set or questionnaire. Omitted areas
302-
create no workflow rows; an explicit exclusion is recorded only when retaining
303-
that rationale is useful. MCP validates state, evidence, and transitions; it
304-
does not store or prove the preceding UI interaction.
331+
create no workflow rows; an explicit exclusion is recorded only when retaining
332+
that rationale is useful. MCP validates accepted checkpoints and mechanical
333+
integrity; it does not store or prove the preceding UI interaction.
305334

306335
Older projection-only Ultra projects are preserved and routed through a
307336
backup-first migration or rebaseline. The first supported checkpoint publication
@@ -358,19 +387,19 @@ The next piece of daily work starts with a new `ultra-change`.
358387
| `ultra-test` | Run the risk-selected verification profile and persist the gate result |
359388
| `ultra-review` | Coordinate independent specification-fidelity and engineering review |
360389
| `ultra-deliver` | Reconcile specifications, close local authority, and archive the change |
361-
| `ultra-status` | Read the current breadcrumb, blockers, evidence, and allowed transitions |
390+
| `ultra-status` | Read the current context, warnings, blockers, and evidence |
362391
| `ultra-doctor` | Diagnose installation or project-state faults and expose safe recovery |
363392

364-
These eleven capabilities are the complete public Ultra command graph. Each capability
365-
returns current `allowed_transitions`; the host may recommend one, but another public
366-
capability starts only after an explicit user command or skill invocation.
393+
These eleven capabilities are the complete public Ultra command graph. The host model
394+
recommends the next capability from current context and owner intent; SQLite does not
395+
encode the semantic route. Another public capability starts only after an explicit
396+
user command or skill invocation.
367397

368398
### Command interaction graph
369399

370-
Every solid handoff below means: the current capability returns
371-
`allowed_transitions`, the model recommends a route, and the owner explicitly
372-
invokes the next public capability. It does not mean that one public command
373-
silently launches another.
400+
Every solid handoff below means: the current capability returns context and checkpoint
401+
diagnostics, the model recommends a route, and the owner explicitly invokes the next
402+
public capability. It does not mean that one public command silently launches another.
374403

375404
```mermaid
376405
flowchart TD
@@ -459,8 +488,8 @@ health without selecting product intent.
459488

460489
Together, `.ultra/` is Ultra's project-local cross-session workflow memory. The
461490
host model writes semantic specifications and evidence through the active
462-
workflow. MCP records lifecycle state, references, digests, provenance, and
463-
accepted intent, then rejects stale or illegal transitions. The DB is the
491+
capability. MCP records lifecycle state, references, digests, provenance, and
492+
accepted intent, then validates durable checkpoints and mechanical integrity. The DB is the
464493
lifecycle and index authority for one checkout; registered digest-bound files carry
465494
the semantic or evidence bodies that the DB references. The Git checkpoint is a
466495
portable, digest-chained handoff of baseline, Change, and durable task records. It is
@@ -551,12 +580,13 @@ host's existing model session.
551580
- **Project state is unhealthy:** invoke `ultra-doctor` or run
552581
`ultra-tools system doctor`. Repairs and schema migrations are backup-first.
553582
- **The team checkpoint disagrees with local state:** run `ultra-status`, inspect the
554-
typed ledger condition, then use the recommended `task.ledger_import` or
555-
`task.ledger_publish` path. Never edit `.ultra/tasks/tasks.json` by hand.
583+
typed ledger condition, then use `ultra.sync` to import or publish after reviewing
584+
any real conflict. Never edit `.ultra/tasks/tasks.json` by hand.
556585
- **A generated view disagrees with MCP:** trust `.ultra/.runtime/state.db`; never edit
557586
`.ultra/.runtime/projections/` by hand.
558-
- **A workflow appears blocked:** use `ultra-status` to read the exact current
559-
workflow, blocker, owner decision, and mechanically valid transitions.
587+
- **A draft checkpoint is rejected:** use `ultra-status` to read the exact warnings
588+
and blockers, fix the same mutable draft, and retry. Use `workflow.abandon` through
589+
`ultra.record` only when intentionally cancelling the attempt.
560590
- **Kimi reports a native-module ABI error:** ensure an external Node.js 22+
561591
executable is available on `PATH`; the generated Kimi MCP launcher uses
562592
`env node`.

adapters/_shared/codex-assets.cjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function adaptCodexPrimaryText(input, skillName) {
9696
let text = String(input);
9797
if (skillName === 'ultra-review') {
9898
text = text.replace(
99-
/the current host's native bounded-worker\s+mechanism/g,
99+
/(?:the current host's native|the host-native) bounded-worker\s+mechanism/g,
100100
'native Codex custom agents installed for the selected review workers',
101101
);
102102
}
@@ -470,7 +470,11 @@ main().catch((error) => {
470470

471471
const sourceToolsFile = path.join(repoRoot, 'spec', 'mcp-tools.yaml');
472472
const upstreamManifest = yaml.load(fs.readFileSync(sourceToolsFile, 'utf8'));
473-
const { REGISTERED_TOOLS } = require(path.join(repoRoot, 'mcp-server', 'server.cjs'));
473+
const {
474+
LEGACY_TOOLS,
475+
PUBLIC_TOOLS,
476+
REGISTERED_TOOLS,
477+
} = require(path.join(repoRoot, 'mcp-server', 'server.cjs'));
474478
const registered = new Set(REGISTERED_TOOLS);
475479
const liveFamilies = new Set(
476480
upstreamManifest.tools.filter((tool) => registered.has(tool.name)).map((tool) => tool.family),
@@ -495,7 +499,8 @@ main().catch((error) => {
495499
fs.copyFileSync(sourceToolsFile, path.join(specRoot, 'upstream-mcp-tools.yaml'));
496500
writeAtomic(path.join(specRoot, 'codex-capability-map.json'), JSON.stringify({
497501
runtime: 'codex',
498-
live_mcp_tools: REGISTERED_TOOLS,
502+
live_mcp_tools: PUBLIC_TOOLS,
503+
compatibility_mcp_tools: LEGACY_TOOLS,
499504
codex_native_replacements: CODEX_NATIVE_MCP_REPLACEMENTS,
500505
}, null, 2) + '\n');
501506
}

adapters/_shared/interaction-contract.cjs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function interactionContract(runtime) {
3232
const question = SURFACES[runtime];
3333
if (!question) throw new Error(`unsupported interaction runtime: ${runtime}`);
3434
return {
35-
schema_version: '1.2',
35+
schema_version: '1.3',
3636
runtime,
3737
public_capability_graph: PUBLIC_CAPABILITY_GRAPH,
3838
authority: {
@@ -50,9 +50,9 @@ function interactionContract(runtime) {
5050
'accepted_intent_normalization',
5151
],
5252
ultra_mcp: [
53-
'durable_state_and_evidence_refs',
54-
'digests_freshness_locks_and_recovery',
55-
'allowed_and_required_transitions',
53+
'durable_checkpoints_and_evidence_refs',
54+
'digests_freshness_leases_archives_and_recovery',
55+
'mutable_semantic_diagnostics',
5656
],
5757
},
5858
interaction: {
@@ -85,8 +85,15 @@ function interactionContract(runtime) {
8585
routing: {
8686
semantic_recommendation_owner: 'host_model',
8787
durable_recommendation_authority: false,
88-
hard_invariant_field: 'required_transition',
89-
valid_capabilities_field: 'allowed_transitions',
88+
current_context_tool: 'ultra.context',
89+
checkpoint_diagnostic_fields: ['warnings', 'blockers'],
90+
hard_blocker_boundary: [
91+
'corruption',
92+
'unsafe_path',
93+
'concurrency_conflict',
94+
'permission',
95+
'irreversible_external_effect',
96+
],
9097
},
9198
};
9299
}

adapters/_shared/runtime-assets.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const PUBLIC_CAPABILITY_GRAPH = Object.freeze(Object.fromEntries(
4141
Object.freeze({
4242
mode: PUBLIC_CAPABILITY_MODES[name],
4343
activation: 'explicit_only',
44-
next_capability_source: 'mcp_allowed_transitions',
44+
next_capability_source: 'host_model_from_ultra_context',
4545
recommendation_owner: 'host_model',
4646
selection_owner: 'user',
4747
automatic_invocation: false,

adapters/_shared/tests/interaction-contract.test.cjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test('every supported host receives the same authority split with a native quest
2222
};
2323
for (const runtime of ['claude', 'codex', 'opencode', 'kimi']) {
2424
const contract = interactionContract(runtime);
25-
assert.equal(contract.schema_version, '1.2');
25+
assert.equal(contract.schema_version, '1.3');
2626
assert.equal(contract.runtime, runtime);
2727
assert.equal(contract.interaction.question_surface.primary, expectedSurfaces[runtime]);
2828
assert.equal(contract.interaction.question_surface.primary, SURFACES[runtime].primary);
@@ -51,7 +51,9 @@ test('every supported host receives the same authority split with a native quest
5151
assert.ok(!contract.authority.host_model.includes('semantic_route_selection'));
5252
assert.equal(contract.routing.semantic_recommendation_owner, 'host_model');
5353
assert.equal(contract.routing.durable_recommendation_authority, false);
54-
assert.equal(contract.routing.hard_invariant_field, 'required_transition');
54+
assert.equal(contract.routing.current_context_tool, 'ultra.context');
55+
assert.deepEqual(contract.routing.checkpoint_diagnostic_fields, ['warnings', 'blockers']);
56+
assert.ok(contract.routing.hard_blocker_boundary.includes('concurrency_conflict'));
5557
}
5658
});
5759

adapters/_shared/tests/runtime-assets.test.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ test('the public capability graph is exact and every handoff remains explicit',
103103
assert.deepEqual(PUBLIC_CAPABILITY_GRAPH[name], {
104104
mode: GRAPH_MODES[name],
105105
activation: 'explicit_only',
106-
next_capability_source: 'mcp_allowed_transitions',
106+
next_capability_source: 'host_model_from_ultra_context',
107107
recommendation_owner: 'host_model',
108108
selection_owner: 'user',
109109
automatic_invocation: false,

adapters/claude.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function copySkills(repoRoot, target, names) {
6666
let adaptedBody = adaptInteractionGuidance(body, 'claude');
6767
if (name === 'ultra-review') {
6868
adaptedBody = adaptedBody.replace(
69-
/the current host's native bounded-worker\s+mechanism/g,
69+
/(?:the current host's native|the host-native) bounded-worker\s+mechanism/g,
7070
'Claude Code Task workers using the installed review agent definitions',
7171
);
7272
}

adapters/kimi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function kimiTextTransform(input, assetName = '') {
9696
}
9797
if (assetName === 'ultra-review') {
9898
text = text.replace(
99-
/the current host's native bounded-worker\s+mechanism/g,
99+
/(?:the current host's native|the host-native) bounded-worker\s+mechanism/g,
100100
'Kimi `AgentSwarm` for parallel reviewers or one foreground Kimi `Agent` for a single reviewer, using the worker prompt files under `$KIMI_PLUGIN_ROOT/agents/`',
101101
);
102102
}

0 commit comments

Comments
 (0)