ultra-builder-pro-cli 0.21.1 → 0.22.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.
- package/.ultra-template/tasks/tasks.json +10 -3
- package/.ultra-template/templates/task-context.md +19 -0
- package/CHANGELOG.md +40 -0
- package/README.md +166 -22
- package/adapters/opencode.js +23 -12
- package/docs/AGENT-CONTEXT.md +22 -13
- package/docs/ARCHITECTURE.md +59 -24
- package/docs/ARTIFACT-AUTHORITY.md +70 -30
- package/docs/COMMIT-HASH-BACKFILL.md +33 -90
- package/docs/DECISIONS.md +9 -7
- package/docs/LEGACY-CLI-CROSSWALK.md +10 -2
- package/docs/PLUGIN-ISOLATION-CONTRACT.md +3 -2
- package/docs/ROADMAP.md +3 -3
- package/docs/RUNTIME-COMPAT-MATRIX.md +8 -6
- package/docs/STATE-DB-ACCESS-POLICY.md +35 -7
- package/docs/WORKFLOW-LIFECYCLE.md +40 -16
- package/hooks/README.md +5 -4
- package/hooks/active_task_context.py +41 -39
- package/mcp-server/lib/artifact-registry.cjs +7 -6
- package/mcp-server/lib/baseline-workflow.cjs +60 -24
- package/mcp-server/lib/context-paths.cjs +34 -3
- package/mcp-server/lib/doctor.cjs +28 -0
- package/mcp-server/lib/git-bootstrap.cjs +0 -1
- package/mcp-server/lib/init-project.cjs +52 -2
- package/mcp-server/lib/projector.cjs +43 -8
- package/mcp-server/lib/state-authority.cjs +19 -3
- package/mcp-server/lib/state-ops.cjs +6 -1
- package/mcp-server/lib/task-ledger.cjs +1342 -0
- package/mcp-server/server.cjs +145 -9
- package/package.json +1 -1
- package/skills/ultra-change/SKILL.md +10 -2
- package/skills/ultra-deliver/SKILL.md +6 -3
- package/skills/ultra-dev/SKILL.md +21 -6
- package/skills/ultra-doctor/SKILL.md +10 -1
- package/skills/ultra-init/SKILL.md +18 -9
- package/skills/ultra-plan/SKILL.md +11 -4
- package/skills/ultra-research/SKILL.md +12 -13
- package/skills/ultra-review/SKILL.md +5 -3
- package/skills/ultra-status/SKILL.md +11 -7
- package/skills/ultra-test/SKILL.md +3 -2
- package/spec/cli-protocol.md +3 -0
- package/spec/mcp-tools.yaml +127 -0
- package/spec/schemas/context-file.v4.5.schema.json +1 -1
- package/spec/schemas/state-db.sql +1 -1
- package/spec/schemas/task-ledger.v1.schema.json +217 -0
- package/ultra-tools/commands/migrate.cjs +5 -2
- package/.ultra-template/tasks/contexts/TEMPLATE.md +0 -19
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
`ultra-builder-pro-cli` is a multi-runtime plugin suite that **distributes** the
|
|
10
10
|
Ultra Builder Pro engineering loop (skills + commands + workflow hooks) as
|
|
11
11
|
native Claude Code, OpenCode, Codex, and Kimi Code plugins, and
|
|
12
|
-
**runs** that loop with isolated sessions sharing
|
|
13
|
-
|
|
12
|
+
**runs** that loop with isolated sessions sharing checkout-local operational
|
|
13
|
+
authority (`.ultra/.runtime/state.db`) plus one MCP-published Git team checkpoint
|
|
14
|
+
(`.ultra/tasks/tasks.json`).
|
|
14
15
|
|
|
15
16
|
It is not an agent or a general conversational-memory provider. It is the workflow
|
|
16
17
|
substrate the supported hosts share, including project-local cross-session workflow
|
|
@@ -42,17 +43,19 @@ memory under `.ultra/`.
|
|
|
42
43
|
│ .ultra/.runtime/state.db │
|
|
43
44
|
│ (SQLite + WAL) │ ← lifecycle + index authority
|
|
44
45
|
└──────────┬──────────┘
|
|
45
|
-
│
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
│
|
|
47
|
+
┌─────────┴──────────┐
|
|
48
|
+
│ │
|
|
49
|
+
▼ ▼
|
|
50
|
+
.ultra/.runtime/projections/ .ultra/tasks/tasks.json
|
|
51
|
+
(local generated views) (Git team checkpoint:
|
|
52
|
+
baseline + Changes + tasks)
|
|
50
53
|
```
|
|
51
54
|
|
|
52
55
|
| Layer | Role | Form |
|
|
53
56
|
|--------------|----------------------------------------------|-------------------------------------------------------|
|
|
54
57
|
| **skill** | knowledge carrier; tells the runtime *what to do* | `skills/<name>/SKILL.md` discovered natively by all supported runtimes |
|
|
55
|
-
| **MCP** | authoritative workflow-state, decision, artifact, and Context Spine API | stdio MCP server exposing
|
|
58
|
+
| **MCP** | authoritative workflow-state, decision, artifact, and Context Spine API | stdio MCP server exposing 60 live tools across task/session/baseline/change/decision/workflow/artifact/system/plan families in [`spec/mcp-tools.yaml`](../spec/mcp-tools.yaml) |
|
|
56
59
|
| **CLI** | explicit initialization, recovery, diagnostics, and orchestration | `ultra-tools` / `ubp-orchestrator`; only commands listed by `--help` are executable (see [`spec/cli-protocol.md`](../spec/cli-protocol.md)) |
|
|
57
60
|
|
|
58
61
|
Why three: skills give us behavior portability across runtimes; MCP gives
|
|
@@ -69,11 +72,14 @@ RPC, and host-native loaders own resolution and invocation.
|
|
|
69
72
|
|
|
70
73
|
Together, `.ultra/` retains project-local cross-session workflow memory:
|
|
71
74
|
normalized intent, progress, tasks, bounded context, specifications, evidence,
|
|
72
|
-
provenance, and recovery. `.ultra/.runtime/state.db` is
|
|
73
|
-
indexing, transitions, freshness, and coordination
|
|
74
|
-
carry semantic and evidence bodies.
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
provenance, and recovery. `.ultra/.runtime/state.db` is operational authority for
|
|
76
|
+
lifecycle, indexing, transitions, freshness, and coordination in one checkout.
|
|
77
|
+
Registered digest-bound files carry semantic and evidence bodies.
|
|
78
|
+
`.ultra/tasks/tasks.json` is a portable, digest-chained Git handoff for baseline,
|
|
79
|
+
Change, and durable task records; it never owns sessions, leases, or live
|
|
80
|
+
`in_progress` state. Generated projections and working scratch do not become
|
|
81
|
+
authority merely because they live under `.ultra/`. The complete classification and
|
|
82
|
+
promotion contract is
|
|
77
83
|
[`ARTIFACT-AUTHORITY.md`](./ARTIFACT-AUTHORITY.md).
|
|
78
84
|
|
|
79
85
|
All durable Ultra lifecycle and index state lives in one SQLite file with WAL enabled.
|
|
@@ -109,9 +115,11 @@ Two rules make this work:
|
|
|
109
115
|
|
|
110
116
|
1. **No double source (D32).** lease/heartbeat live only in `sessions`,
|
|
111
117
|
not in a `lease.json` file. Activity log lives only in `events`, not
|
|
112
|
-
in JSON files.
|
|
113
|
-
`contexts/task-*.md` files are
|
|
114
|
-
manual edits are overwritten on the next state.db change.
|
|
118
|
+
in JSON files. `.ultra/.runtime/projections/tasks.json` and its complete
|
|
119
|
+
`contexts/task-*.md` files are local projections generated by the projector;
|
|
120
|
+
manual edits are overwritten on the next state.db change. The tracked
|
|
121
|
+
`.ultra/tasks/tasks.json` is a different surface: only MCP publishes or imports
|
|
122
|
+
this versioned team checkpoint, and digest validation rejects manual edits.
|
|
115
123
|
|
|
116
124
|
2. **Single writer for mutable tables, multi-writer for `events`.**
|
|
117
125
|
`.ultra/.runtime/state.db` opens in WAL with `busy_timeout=5000`. The MCP
|
|
@@ -324,14 +332,40 @@ evidence, and final convergence decision.
|
|
|
324
332
|
|
|
325
333
|
Mutating MCP calls enqueue durable `projection_jobs`. Success is exposed in MCP
|
|
326
334
|
response metadata; failure becomes a retryable structured incident instead of a
|
|
327
|
-
swallowed warning.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
335
|
+
swallowed warning. These jobs regenerate only checkout-local views below
|
|
336
|
+
`.ultra/.runtime/projections/`; they never rewrite the Git team checkpoint. Durable
|
|
337
|
+
semantic operations publish the checkpoint directly at baseline, Change, plan, and
|
|
338
|
+
task handoff boundaries. `system.doctor` is read-only by default. Explicit repair
|
|
339
|
+
performs backup-first schema upgrade, archive-journal recovery, session and local
|
|
340
|
+
projection recovery, and regenerated local views. It cannot import or publish semantic
|
|
341
|
+
team state, approve a baseline, or replace a corrupt SQLite file silently. `system
|
|
342
|
+
restore` accepts only a verified SQLite backup inside `.ultra/.runtime/backups`,
|
|
343
|
+
quarantines the corrupt authority, and rolls back on failure.
|
|
332
344
|
When no valid backup exists, confirmed `system rebaseline` preserves both corrupt
|
|
333
345
|
authority and the legacy task projection before creating a new brownfield adoption.
|
|
334
346
|
|
|
347
|
+
### Git team checkpoint and checkout merge
|
|
348
|
+
|
|
349
|
+
`task.ledger_publish` serializes the current portable baseline, all Change summaries,
|
|
350
|
+
and durable task contracts to `.ultra/tasks/tasks.json`. Per-record digests and
|
|
351
|
+
revisions make independent fast-forward possible; the document state digest, parent
|
|
352
|
+
digest, and bounded ancestor list reject stale or unrelated histories. Local process
|
|
353
|
+
ownership fields are deliberately absent.
|
|
354
|
+
|
|
355
|
+
The MCP server imports the checkpoint once when it opens project authority. A
|
|
356
|
+
long-running host explicitly calls `task.ledger_import` after receiving a newer Git
|
|
357
|
+
version. Import is transactional: it validates every record first, preserves local-only
|
|
358
|
+
fields, fast-forwards clean records, and rejects same-record concurrency or an active
|
|
359
|
+
task collision. Re-reading an already imported checkpoint performs no write. A ready
|
|
360
|
+
baseline is never trusted from Git alone; import creates a local revalidation gap and
|
|
361
|
+
clears checkout-specific approval until current scope bytes, HEAD, and verification
|
|
362
|
+
converge.
|
|
363
|
+
|
|
364
|
+
Baseline freshness hashes scoped application content independently of Git staging and
|
|
365
|
+
excludes `.ultra/`, then checks commit ancestry. This removes the metadata treadmill:
|
|
366
|
+
committing a checkpoint or another Ultra artifact advances HEAD without staling the
|
|
367
|
+
baseline, while changing scoped application bytes still does.
|
|
368
|
+
|
|
335
369
|
## 5. Sessions — the execution unit
|
|
336
370
|
|
|
337
371
|
A **session** is the standard unit of execution across all four runtimes
|
|
@@ -456,7 +490,8 @@ shippable; downstream slip never blocks an earlier release.
|
|
|
456
490
|
| What does each MCP tool accept and return? | [`spec/mcp-tools.yaml`](../spec/mcp-tools.yaml) |
|
|
457
491
|
| How do CLI subcommands map to MCP tools? | [`spec/cli-protocol.md`](../spec/cli-protocol.md) |
|
|
458
492
|
| Exact SQLite schema? | [`spec/schemas/state-db.sql`](../spec/schemas/state-db.sql) |
|
|
459
|
-
| What does
|
|
493
|
+
| What does the Git team checkpoint look like? | [`spec/schemas/task-ledger.v1.schema.json`](../spec/schemas/task-ledger.v1.schema.json) |
|
|
494
|
+
| What does the local task projection look like? | [`spec/fixtures/valid/tasks.v4.5.json`](../spec/fixtures/valid/tasks.v4.5.json) |
|
|
460
495
|
| Current authority and package decisions | [`docs/DECISIONS.md`](./DECISIONS.md) |
|
|
461
496
|
| When does each workflow write, invalidate, and converge state? | [`docs/WORKFLOW-LIFECYCLE.md`](./WORKFLOW-LIFECYCLE.md) |
|
|
462
497
|
|
|
@@ -469,8 +504,8 @@ Every contract on this page is enforced by `npm run test:spec`:
|
|
|
469
504
|
- `validate-state-db.cjs` — schema applies cleanly to a fresh in-memory
|
|
470
505
|
SQLite, valid fixtures insert, invalid fixtures are rejected by
|
|
471
506
|
CHECK / NOT NULL / FK constraints.
|
|
472
|
-
- `validate-json-schemas.cjs` —
|
|
473
|
-
`contexts/task-*.md`.
|
|
507
|
+
- `validate-json-schemas.cjs` — the team-checkpoint schema plus local projection
|
|
508
|
+
schemas for `tasks.json` and `contexts/task-*.md`.
|
|
474
509
|
- `validate-skills.cjs` — every existing skill passes the manifest
|
|
475
510
|
contract; failures are recorded in `spec/migration-notes.md`.
|
|
476
511
|
- `check-cli-mapping.cjs` — every MCP tool has exactly one CLI
|
|
@@ -15,23 +15,28 @@ payloads.
|
|
|
15
15
|
Semantic and evidence artifacts under `.ultra/` are trackable so reviewed intent and
|
|
16
16
|
verification can travel with the repository. `.ultra/.runtime/` is always ignored:
|
|
17
17
|
the SQLite authority, leases, worktrees, local telemetry, and recovery snapshots remain
|
|
18
|
-
checkout-local
|
|
18
|
+
checkout-local. `.ultra/tasks/tasks.json` is the narrow MCP-owned Git handoff for
|
|
19
|
+
portable baseline, Change, and durable task records; it is not a copy of live runtime
|
|
20
|
+
state.
|
|
19
21
|
|
|
20
22
|
## Artifact classes
|
|
21
23
|
|
|
22
24
|
| Class | Examples | Authority |
|
|
23
25
|
|---|---|---|
|
|
24
|
-
|
|
|
26
|
+
| Checkout-local lifecycle and index | `.ultra/.runtime/state.db` | Operational authority for identifiers, normalized accepted intent, status, legal transitions, references, digests, freshness, provenance, locks, leases, transactions, recovery, and coordination in one checkout |
|
|
27
|
+
| Git team checkpoint | `.ultra/tasks/tasks.json` | MCP-published, digest-chained handoff of portable baseline, Change, task-contract, dependency, and durable status records; never live session or lease authority |
|
|
25
28
|
| Digest-bound semantic artifacts | specifications, research reports, Change intent/delta/plan, context manifests | Authoritative semantic bodies only while registered by the owning DB row or workflow step and matching its recorded digest |
|
|
26
29
|
| Digest-bound evidence artifacts | test, review, delivery, and verification reports | Authoritative evidence bodies only while registered, immutable where required, and matching the recorded digest and scope |
|
|
27
|
-
| Generated projections |
|
|
30
|
+
| Generated projections | `.ultra/.runtime/projections/tasks.json`, generated task contexts, activity exports | Checkout-local read-only views derived from DB authority; manual edits are overwritten and never become authority |
|
|
28
31
|
| Advisory recovery | `.ultra/.runtime/checkpoint.json` | Compact recovery hint derived from DB authority; stale or missing content never overrides the DB |
|
|
29
32
|
| Working scratch | `.ultra/.runtime/collab/`, temporary session output, incomplete drafts | Non-authoritative working material until verified and promoted through a supported workflow write |
|
|
30
33
|
| External provider references | memory or code-graph provider name, scope, version, stable reference, freshness metadata | Metadata-only context stored by Ultra; the provider remains authority for its payload |
|
|
31
34
|
|
|
32
|
-
The DB is not expected to contain every semantic paragraph. It owns
|
|
33
|
-
the binding between a fact and its current content. A digest-bound file
|
|
34
|
-
registered semantic or evidence body.
|
|
35
|
+
The DB is not expected to contain every semantic paragraph. It owns checkout-local
|
|
36
|
+
lifecycle and the binding between a fact and its current content. A digest-bound file
|
|
37
|
+
owns the registered semantic or evidence body. The team checkpoint moves a reviewed
|
|
38
|
+
portable subset through Git and is merged into the receiving DB through MCP. None of
|
|
39
|
+
these surfaces independently owns all three roles.
|
|
35
40
|
|
|
36
41
|
## Human, model, and mechanical responsibilities
|
|
37
42
|
|
|
@@ -39,9 +44,9 @@ registered semantic or evidence body. Neither surface is a parallel lifecycle so
|
|
|
39
44
|
|---|---|---|
|
|
40
45
|
| Owner | Goals, acceptance, non-goals, material choices, risk acceptance, and authorization for irreversible or external effects | Supply facts the checkout or runtime can establish directly |
|
|
41
46
|
| Host model | Inspect evidence, recommend a route, ask only for unresolved owner choices, normalize the answer, call the owning write, update semantic artifacts, read back the result, and present the next recommendation | Fabricate evidence, infer owner authorization, or bypass legal transitions |
|
|
42
|
-
| Ultra MCP | Persist normalized inputs, validate structure and current digests, record lifecycle and provenance, enforce legal transitions, project views, and expose recovery | Choose product direction, prove a UI click, force a semantic route, or replace model judgment |
|
|
47
|
+
| Ultra MCP | Persist normalized inputs, validate structure and current digests, record lifecycle and provenance, enforce legal transitions, project local views, publish/import the Git checkpoint, and expose recovery | Choose product direction, prove a UI click, force a semantic route, or replace model judgment |
|
|
43
48
|
| Host adapter | Render the shared interaction contract through the host-native question and tool surfaces | Become a second workflow authority |
|
|
44
|
-
| Hook | Observe lifecycle, inject compact DB-derived recovery context, and protect generated
|
|
49
|
+
| Hook | Observe lifecycle, inject compact DB-derived recovery context, and protect MCP-owned checkpoint and generated projection paths | Select a semantic route or block ordinary development |
|
|
45
50
|
|
|
46
51
|
## Intent persistence
|
|
47
52
|
|
|
@@ -169,8 +174,8 @@ rejected without changing prior authority. A caller can provide
|
|
|
169
174
|
`artifact.get` reads by unique ID or unambiguous path. It fails closed when a path
|
|
170
175
|
has multiple active authorities and reports whether the row satisfies the managed
|
|
171
176
|
registry contract. A canonical path can have only one non-archived authority across
|
|
172
|
-
all owners and kinds. Runtime, scratch,
|
|
173
|
-
cannot be promoted through this API.
|
|
177
|
+
all owners and kinds. Runtime, scratch, the MCP-owned team checkpoint, and generated
|
|
178
|
+
task contexts cannot be promoted through this API.
|
|
174
179
|
|
|
175
180
|
Owning internal writers use the same transaction contract. Change intent, delta and
|
|
176
181
|
documentation packets, contexts, adaptive research, findings, incident diagnosis,
|
|
@@ -196,11 +201,13 @@ tables. It reports:
|
|
|
196
201
|
- graph cycles that cannot become consumer evidence;
|
|
197
202
|
- more than one active authority for the same canonical path;
|
|
198
203
|
- legacy compatibility rows that remain unmanaged;
|
|
199
|
-
- generated task contexts
|
|
204
|
+
- legacy generated task contexts left outside the runtime projection root.
|
|
200
205
|
|
|
201
206
|
`.ultra/.runtime/**`, `.ultra/scratch/**`, and fixed scaffold support files are outside
|
|
202
|
-
orphan diagnosis. Current generated projections are
|
|
203
|
-
|
|
207
|
+
orphan diagnosis. Current generated projections are local runtime files and are not
|
|
208
|
+
semantic artifacts. A retired `.ultra/tasks/contexts/**` entry is diagnosed and any
|
|
209
|
+
generated marker is reported as a ghost projection. Before a baseline is ready, only
|
|
210
|
+
the reserved
|
|
204
211
|
`discovery.md`, `product.md`, `architecture.md`, and `research-distillate.md` scaffold
|
|
205
212
|
paths under `.ultra/specs/` are provisional; every additional specification is subject
|
|
206
213
|
to orphan diagnosis immediately. Completion cannot be manufactured by registering
|
|
@@ -208,25 +215,58 @@ empty templates. Doctor and status expose registered, managed, and unmanaged cou
|
|
|
208
215
|
and compatibility remains unhealthy until every retained row is deliberately promoted
|
|
209
216
|
or retired.
|
|
210
217
|
|
|
218
|
+
## Team checkpoint
|
|
219
|
+
|
|
220
|
+
`.ultra/tasks/tasks.json` has kind `ultra-team-task-ledger` and a versioned schema. It
|
|
221
|
+
contains:
|
|
222
|
+
|
|
223
|
+
- one portable baseline record, when present;
|
|
224
|
+
- every Change summary, including a Change that has not yet produced tasks;
|
|
225
|
+
- durable task contracts, dependencies, acceptance mappings, and statuses;
|
|
226
|
+
- per-record revisions, parent digests, the checkpoint state digest, and bounded
|
|
227
|
+
checkpoint ancestry.
|
|
228
|
+
|
|
229
|
+
It excludes `in_progress` ownership, session ids, leases, worktrees, telemetry,
|
|
230
|
+
projection jobs, recovery scratch, and `completion_commit`. Those fields are meaningful
|
|
231
|
+
only in the checkout that owns the active process or Git object.
|
|
232
|
+
|
|
233
|
+
MCP publishes a new generation at semantic handoff points: baseline convergence,
|
|
234
|
+
Change creation or update, plan acceptance, durable task-contract or status change,
|
|
235
|
+
task expansion or deletion, and Change convergence or archive. A direct edit is
|
|
236
|
+
rejected by host hooks and fails digest validation even without hooks.
|
|
237
|
+
|
|
238
|
+
`task.ledger_import` validates schema, full and per-record digests, bounded ancestry,
|
|
239
|
+
Change ownership, task parents, and local active sessions. A clean record fast-forwards.
|
|
240
|
+
A record changed on both sides, a non-descendant checkpoint, or a remote update to a
|
|
241
|
+
locally active task stops with a typed conflict. Re-importing the same checkpoint
|
|
242
|
+
performs no DB write. A ready imported baseline becomes `draft` or `adopting` with a
|
|
243
|
+
blocking checkout-local revalidation gap; Git cannot prove the receiving checkout's
|
|
244
|
+
HEAD, scope bytes, verification, or accepted dirty state. Publication remains blocked
|
|
245
|
+
until that local baseline converges, preventing one unvalidated checkout from
|
|
246
|
+
downgrading team authority.
|
|
247
|
+
|
|
248
|
+
Legacy v4.4/v4.5 projections are replaced only through `task.ledger_publish`. The
|
|
249
|
+
publisher first compares every available durable field with SQLite, writes the exact
|
|
250
|
+
legacy bytes to `.ultra/.runtime/backups/task-ledger/`, and refuses any mismatch.
|
|
251
|
+
Doctor diagnoses this state but never performs the semantic replacement.
|
|
252
|
+
|
|
211
253
|
## Task-context projection
|
|
212
254
|
|
|
213
|
-
`.ultra/
|
|
214
|
-
The projector replaces the whole file, including its execution contract and
|
|
215
|
-
banner, and marks it with `generated_by: ultra-projector`. It never preserves
|
|
216
|
-
prose inserted into an earlier projection.
|
|
217
|
-
|
|
218
|
-
Before
|
|
219
|
-
body bytes once into a digest-bound
|
|
220
|
-
consumed by the task. Legacy frontmatter,
|
|
221
|
-
regions are removed first; any remaining
|
|
222
|
-
an older projector had preserved it after
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
pruned, and the removal emits `projection_pruned`; unknown authored files are retained
|
|
229
|
-
for diagnosis.
|
|
255
|
+
`.ultra/.runtime/projections/contexts/<task-id>.md` is fully generated from current DB
|
|
256
|
+
authority. The projector replaces the whole file, including its execution contract and
|
|
257
|
+
stale banner, and marks it with `generated_by: ultra-projector`. It never preserves
|
|
258
|
+
arbitrary prose inserted into an earlier projection.
|
|
259
|
+
|
|
260
|
+
Before retiring an existing `.ultra/tasks/contexts/<task-id>.md`, the projector
|
|
261
|
+
promotes its exact authored body bytes once into a digest-bound
|
|
262
|
+
`legacy_context_findings` artifact owned and consumed by the task. Legacy frontmatter,
|
|
263
|
+
stale banners, and generated contract marker regions are removed first; any remaining
|
|
264
|
+
authored body is retained exactly, even when an older projector had preserved it after
|
|
265
|
+
a generated contract. Migration fails without deleting the authored body if promotion
|
|
266
|
+
cannot be registered. Both legacy reads and runtime projection writes reject traversal,
|
|
267
|
+
symlink ancestors, and path escape. When a task disappears, only a runtime projection
|
|
268
|
+
carrying the generated marker may be pruned, and the removal emits
|
|
269
|
+
`projection_pruned`.
|
|
230
270
|
|
|
231
271
|
Model findings, decisions, or evidence discovered during development must be written
|
|
232
272
|
below the owning Change root and registered through the workflow or `artifact.record`.
|
|
@@ -1,101 +1,44 @@
|
|
|
1
|
-
# Commit-hash backfill
|
|
1
|
+
# Commit-hash backfill
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
`tasks.completion_commit` is checkout-local integration evidence. It lives in
|
|
4
|
+
`.ultra/.runtime/state.db` and may appear in checkout-local projections, but it is
|
|
5
|
+
deliberately absent from the Git-facing team ledger.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This removes the old self-referential two-commit loop. Recording a commit hash no
|
|
8
|
+
longer changes any tracked file.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
in its frontmatter. The legacy flow was:
|
|
10
|
+
## Direct task completion
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
2. read the freshly-created commit hash
|
|
14
|
-
3. edit `contexts/task-N.md` to write the hash into the header
|
|
15
|
-
4. `git commit --amend --no-edit` to fold the edit into the same commit
|
|
12
|
+
After implementation, verification, and review are current:
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
1. Update the task to `completed`. The MCP publishes its durable status and contract to
|
|
15
|
+
`.ultra/tasks/tasks.json`.
|
|
16
|
+
2. Create one local task commit containing the implementation, semantic Ultra
|
|
17
|
+
artifacts, and the team ledger checkpoint.
|
|
18
|
+
3. Read the resulting `HEAD` and update only `completion_commit` through `task.update`.
|
|
19
|
+
4. Verify the task worktree `HEAD`, integration ancestry, review evidence, and public
|
|
20
|
+
seam; then close the session and complete the dev workflow.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
The third step changes only ignored runtime state. Repeating it with the same hash is
|
|
23
|
+
byte-idempotent and leaves Git clean.
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
│ -m "feat: task-N — title" │ emitted it from a NULL row)
|
|
29
|
-
└──────────────────┬───────────────┘
|
|
30
|
-
▼
|
|
31
|
-
┌──────────────────────────────────┐
|
|
32
|
-
│ 2. read the new SHA │ hash = `git rev-parse HEAD`
|
|
33
|
-
└──────────────────┬───────────────┘
|
|
34
|
-
▼
|
|
35
|
-
┌──────────────────────────────────┐
|
|
36
|
-
│ 3. update state.db │ ops.patchTask(db, id,
|
|
37
|
-
│ │ { completion_commit: hash })
|
|
38
|
-
└──────────────────┬───────────────┘
|
|
39
|
-
▼
|
|
40
|
-
┌──────────────────────────────────┐
|
|
41
|
-
│ 4. projector regenerates the │ projector.projectContext(db, id)
|
|
42
|
-
│ context md header with the │ writes a new contexts/task-N.md
|
|
43
|
-
│ completion_commit value │ whose YAML now contains the hash
|
|
44
|
-
└──────────────────┬───────────────┘
|
|
45
|
-
▼
|
|
46
|
-
┌──────────────────────────────────┐
|
|
47
|
-
│ 5. chore commit │ git add contexts/task-N.md
|
|
48
|
-
│ │ git commit -m
|
|
49
|
-
│ │ "chore: record task-N hash"
|
|
50
|
-
└──────────────────────────────────┘
|
|
51
|
-
```
|
|
25
|
+
If the commit fails after step 1, transition the still-session-owned task from
|
|
26
|
+
`completed` to `blocked`, preserve the worktree, and record the failure. This recovery
|
|
27
|
+
transition is accepted only while `completion_commit` is absent. A task with a recorded
|
|
28
|
+
completion commit remains terminal.
|
|
52
29
|
|
|
53
|
-
|
|
30
|
+
## Parent-supervised workers
|
|
54
31
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```
|
|
32
|
+
A worker records evidence and exits without finalizing the parent-owned task. The
|
|
33
|
+
primary host verifies and integrates the worker commit, publishes the task completion
|
|
34
|
+
checkpoint, records the integrated commit hash locally, and settles the lease.
|
|
59
35
|
|
|
60
|
-
|
|
61
|
-
projection file changed) and is trivial to revert if the wrong task is
|
|
62
|
-
recorded.
|
|
36
|
+
## Why the hash is local
|
|
63
37
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
- **Audit trail.** Reviewers can see the implementation diff (commit 1)
|
|
72
|
-
separately from the bookkeeping diff (commit 2).
|
|
73
|
-
|
|
74
|
-
## Hook integration (Phase 3)
|
|
75
|
-
|
|
76
|
-
The post-commit hook installed by `skills/ultra-dev/` will invoke this
|
|
77
|
-
flow as soon as a feat commit lands on a task branch:
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
post-commit workflow → if commit message starts with "feat:" and the
|
|
81
|
-
working tree contains contexts/task-N.md →
|
|
82
|
-
MCP task.update {id: task-N,
|
|
83
|
-
patch: {completion_commit: $(git rev-parse HEAD)}} &&
|
|
84
|
-
git add contexts/task-N.md &&
|
|
85
|
-
git commit -m "chore: record task-N completion hash"
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Until that hook lands, contributors run the two commits manually. The
|
|
89
|
-
contract above is what the hook will codify.
|
|
90
|
-
|
|
91
|
-
## Verification
|
|
92
|
-
|
|
93
|
-
`mcp-server/tests/commit-hash-flow.test.cjs` builds a throwaway git
|
|
94
|
-
repo, walks the five steps in-process, and asserts:
|
|
95
|
-
|
|
96
|
-
- `git log --oneline -2` shows `chore: record task-N completion hash`
|
|
97
|
-
on top of `feat: task-N — …`.
|
|
98
|
-
- The post-projection `contexts/task-N.md` frontmatter contains the
|
|
99
|
-
exact SHA produced by the feat commit.
|
|
100
|
-
- Re-running step 4 + step 5 against the same SHA is a no-op (the
|
|
101
|
-
chore commit is empty and skipped).
|
|
38
|
+
- A Git file cannot contain the hash of the commit that contains that same file.
|
|
39
|
+
- Runtime integration evidence is checkout-specific and does not belong in a shared
|
|
40
|
+
semantic merge surface.
|
|
41
|
+
- The team ledger needs the durable task outcome and status, not a self-referential
|
|
42
|
+
commit identifier.
|
|
43
|
+
- Baseline freshness uses scoped content plus Git ancestry, so a metadata-only Ultra
|
|
44
|
+
checkpoint commit does not invalidate an otherwise unchanged baseline.
|
package/docs/DECISIONS.md
CHANGED
|
@@ -11,16 +11,18 @@ release-version authority.
|
|
|
11
11
|
|---|---|---|
|
|
12
12
|
| User intent | Goals, acceptance, non-goals, semantic route selection, material product trade-offs, risk acceptance, and authorization for irreversible or external effects | Facts that the current checkout or runtime can establish directly |
|
|
13
13
|
| Host model | Classification and route recommendations, investigation, solution design, task decomposition, context, test and review strategy, documentation impact, intent normalization, and next-action recommendations | Fabricated evidence, bypassed authorization, or durable lifecycle state |
|
|
14
|
-
| Ultra MCP | IDs, state, digests, provenance, freshness, locks, leases, transactions, recovery,
|
|
14
|
+
| Ultra MCP | IDs, checkout-local state, digests, provenance, freshness, locks, leases, transactions, recovery, legal state transitions, and Git checkpoint publish/import | Product direction, a fixed research route, technology selection, or business decisions |
|
|
15
15
|
| Host adapter | Native Skill discovery, user-question surfaces, tool invocation, installation, and runtime wiring | A second project-state authority |
|
|
16
|
-
| Hook | Lifecycle observation, compact DB-derived context, recovery hints, and
|
|
16
|
+
| Hook | Lifecycle observation, compact DB-derived context, recovery hints, and protection of MCP-owned checkpoint/projection paths | Ordinary development blocking or semantic route selection |
|
|
17
17
|
|
|
18
18
|
`.ultra/` is project-local cross-session workflow memory. `.ultra/.runtime/state.db` is
|
|
19
|
-
|
|
20
|
-
Registered digest-bound files carry semantic or evidence bodies
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
authority.
|
|
19
|
+
checkout-local lifecycle, index, transition, freshness, and coordination authority.
|
|
20
|
+
Registered digest-bound files carry semantic or evidence bodies.
|
|
21
|
+
`.ultra/tasks/tasks.json` is the MCP-published Git handoff for portable baseline,
|
|
22
|
+
Change, and durable task records, never live session state. Generated projections and
|
|
23
|
+
working scratch are not authority. Prompt text, chat history, general external-memory
|
|
24
|
+
payloads, and code-graph payloads are not Ultra authority. See
|
|
25
|
+
[`ARTIFACT-AUTHORITY.md`](./ARTIFACT-AUTHORITY.md).
|
|
24
26
|
|
|
25
27
|
## Research coverage
|
|
26
28
|
|
|
@@ -53,6 +53,9 @@ The following are deliberate extensions built on the original spine:
|
|
|
53
53
|
9. Native adapters for Claude Code, OpenCode, Codex, and Kimi Code.
|
|
54
54
|
10. Explicit worktree admission, leases, heartbeats, crash evidence, circuit breaking,
|
|
55
55
|
dependency waves, and optional verified cleanup.
|
|
56
|
+
11. A digest-chained Git team checkpoint that keeps the original shareable task-ledger
|
|
57
|
+
benefit without committing SQLite, leases, sessions, or live `in_progress`
|
|
58
|
+
ownership.
|
|
56
59
|
|
|
57
60
|
## Intentionally retired original baggage
|
|
58
61
|
|
|
@@ -85,6 +88,7 @@ route only for a unique mechanical recovery invariant.
|
|
|
85
88
|
task.init_project
|
|
86
89
|
-> greenfield classification
|
|
87
90
|
-> Git bootstrap when absent
|
|
91
|
+
-> empty or imported team checkpoint
|
|
88
92
|
-> init read-back and completion
|
|
89
93
|
-> explicit full research with a model-recommended, owner-selected route
|
|
90
94
|
-> selected execute/verify/reuse work and synthesis
|
|
@@ -101,6 +105,7 @@ task.init_project
|
|
|
101
105
|
task.init_project
|
|
102
106
|
-> brownfield classification and selected scope
|
|
103
107
|
-> preserve current Git HEAD and dirty-state evidence
|
|
108
|
+
-> import portable team state and require local baseline revalidation when cloned
|
|
104
109
|
-> init read-back and completion
|
|
105
110
|
-> explicit adoption research with a model-recommended, owner-selected route
|
|
106
111
|
-> characterization verification + known-red/gap ledger
|
|
@@ -123,13 +128,13 @@ doctor/migrate with backup
|
|
|
123
128
|
|
|
124
129
|
```text
|
|
125
130
|
status
|
|
126
|
-
-> change intent capture
|
|
131
|
+
-> checkpoint condition + change intent capture
|
|
127
132
|
-> material alignment only when unresolved
|
|
128
133
|
-> model-recommended, owner-selected or delegated bounded research, plan,
|
|
129
134
|
current dev work, think, or status
|
|
130
135
|
-> session.spawn creates the real task worktree
|
|
131
136
|
-> red/green/verify/review
|
|
132
|
-
-> local task commit
|
|
137
|
+
-> durable task checkpoint + one local task commit + local hash backfill
|
|
133
138
|
-> safe session close
|
|
134
139
|
-> aggregate test -> review -> deliver
|
|
135
140
|
-> atomic baseline reconciliation
|
|
@@ -156,6 +161,9 @@ status
|
|
|
156
161
|
| Failure returned a task to pending without recovery evidence | Exit and spawn failures become `blocked` and record session-linked circuit-breaker evidence. |
|
|
157
162
|
| A late resume failure could leave refreshed DB metadata behind | Resume snapshots DB authority and generated projections, then restores both together with Git rollback. |
|
|
158
163
|
| A legacy schema migrated before a later resume failure | Resume restores the pre-migration backup, not the partially completed upgraded intermediate state. |
|
|
164
|
+
| Tracked `tasks.json` made every Ultra write dirty and every metadata commit stale the baseline | Live projections moved below ignored `.ultra/.runtime/projections/`; the tracked file became a low-frequency MCP checkpoint, and baseline freshness excludes `.ultra` while still checking scoped source bytes plus Git ancestry. |
|
|
165
|
+
| A local SQLite DB could not hand baseline, Change, and task authority to another checkout | The Git checkpoint carries portable records with per-record digests and ancestry; import fast-forwards clean records, rejects concurrency, and revalidates every ready baseline locally. |
|
|
166
|
+
| A completed task needed a second commit to record its own commit hash | Durable task outcome enters the same task commit; the resulting hash is backfilled only into local SQLite/projections, so no self-referential metadata commit is created. |
|
|
159
167
|
|
|
160
168
|
## Advancement rule
|
|
161
169
|
|
|
@@ -13,7 +13,7 @@ An adapter may write only:
|
|
|
13
13
|
|
|
14
14
|
The first command allowed to create project authority is `ultra-init`. Once invoked,
|
|
15
15
|
Ultra owns only the repository-local `.ultra/` workflow-memory envelope and its
|
|
16
|
-
generated projections.
|
|
16
|
+
MCP-published checkpoint plus generated local projections.
|
|
17
17
|
|
|
18
18
|
## Surfaces Ultra does not own
|
|
19
19
|
|
|
@@ -48,7 +48,8 @@ Internal review-rule skills remain available only to their bounded workers.
|
|
|
48
48
|
Outside a repository containing `.ultra/.runtime/state.db`, all Ultra hooks are silent. Inside
|
|
49
49
|
an initialized repository they remain silent unless a DB-authoritative workflow is
|
|
50
50
|
active, blocked, or ready. The sole idle-time enforcement is protection against direct
|
|
51
|
-
writes to generated Ultra projections; the DB remains
|
|
51
|
+
writes to the MCP-owned team checkpoint or generated Ultra projections; the DB remains
|
|
52
|
+
checkout-local operational authority.
|
|
52
53
|
|
|
53
54
|
Installation tests preserve byte-for-byte snapshots of all supported user handbook
|
|
54
55
|
paths. Runtime tests cover explicit activation, idle silence, active recovery, and
|
package/docs/ROADMAP.md
CHANGED
|
@@ -57,14 +57,14 @@ sharing one authoritative workflow store.
|
|
|
57
57
|
|
|
58
58
|
```
|
|
59
59
|
spec/ ← Phase 1 single source of truth
|
|
60
|
-
├── mcp-tools.yaml (
|
|
60
|
+
├── mcp-tools.yaml (60 live tools across 9 families)
|
|
61
61
|
├── cli-protocol.md (CLI ↔ MCP mapping table)
|
|
62
62
|
├── schemas/ (state-db.sql + 4 JSON schemas)
|
|
63
63
|
├── fixtures/{valid,invalid}/ (+ v4.4-project for migration)
|
|
64
64
|
└── scripts/test-all.cjs (npm run test:spec — 7 validation stages)
|
|
65
65
|
|
|
66
66
|
mcp-server/ ← Phase 2 authoritative state layer
|
|
67
|
-
├── server.cjs (stdio MCP server,
|
|
67
|
+
├── server.cjs (stdio MCP server, 60 task/session/baseline/change/decision/workflow/artifact/system/plan tools)
|
|
68
68
|
├── lib/
|
|
69
69
|
│ ├── state-db.cjs (SQLite + WAL + pragmas)
|
|
70
70
|
│ ├── state-ops.cjs (full write API, status state machine)
|
|
@@ -106,7 +106,7 @@ docs/
|
|
|
106
106
|
├── PLUGIN-ISOLATION-CONTRACT.md install, activation, idle, and ownership contract
|
|
107
107
|
├── RUNTIME-COMPAT-MATRIX.md Phase 4 runtime capability matrix
|
|
108
108
|
├── STATE-DB-ACCESS-POLICY.md Phase 2 multi-process write contract
|
|
109
|
-
├── COMMIT-HASH-BACKFILL.md
|
|
109
|
+
├── COMMIT-HASH-BACKFILL.md Checkout-local completion commit evidence
|
|
110
110
|
└── ROADMAP.md this file
|
|
111
111
|
```
|
|
112
112
|
|
|
@@ -47,16 +47,17 @@ not presented as nonexistent custom agents.
|
|
|
47
47
|
| Lifecycle | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
|
|
48
48
|
|---|---|---|---|---|
|
|
49
49
|
| Session context/health | FULL, active-workflow breadcrumb on native `SessionStart` | FULL, native JS plugin injects only an active-workflow breadcrumb; health via `system.doctor` | FULL, active-workflow breadcrumb on native `SessionStart` | FULL, active-workflow breadcrumb via native hooks |
|
|
50
|
-
| Active edit boundary | FULL, `PreToolUse Edit|Write` | FULL, `tool.execute.before` rejects projection writes | FULL, `PreToolUse Edit|Write|apply_patch` | FULL, native `PreToolUse Edit|Write` deny contract |
|
|
50
|
+
| Active edit boundary | FULL, `PreToolUse Edit|Write` | FULL, `tool.execute.before` rejects managed checkpoint/projection writes | FULL, `PreToolUse Edit|Write|apply_patch` | FULL, native `PreToolUse Edit|Write` deny contract |
|
|
51
51
|
| Pre-compact checkpoint | FULL | FULL | FULL | FULL, native `PreCompact` |
|
|
52
52
|
| Post-compact context injection | FULL | FULL, native compacting context | FULL, native `PostCompact` restore | DEGRADED; checkpoint restoration runs, but Kimi 0.26/0.27 does not reinject fire-and-forget hook text |
|
|
53
53
|
| Stop lifecycle advisory | FULL, native non-blocking `Stop` | N/A, no equivalent stop event needed | FULL, native non-blocking `Stop` | FULL, native non-blocking `Stop` |
|
|
54
54
|
| Subagent lifecycle evidence | FULL | DEGRADED, no equivalent packaged event | FULL | FULL, native `SubagentStart` / `SubagentStop` |
|
|
55
55
|
|
|
56
56
|
Health/context, compact, stop, and subagent hooks remain silent unless
|
|
57
|
-
`.ultra/.runtime/state.db` proves an active, blocked, or ready workflow.
|
|
58
|
-
protection applies to every initialized project because
|
|
59
|
-
|
|
57
|
+
`.ultra/.runtime/state.db` proves an active, blocked, or ready workflow. Managed-file
|
|
58
|
+
protection applies to every initialized project because neither a hand-edited team
|
|
59
|
+
checkpoint nor generated local projection may become a second authority. No host
|
|
60
|
+
receives prompt capture, transcript capture,
|
|
60
61
|
observation journaling, session-summary memory, generic command blocking, or
|
|
61
62
|
generic post-edit policy.
|
|
62
63
|
Baseline-adoption and context-budget warnings are injected as advisory context;
|
|
@@ -67,7 +68,7 @@ they do not deny edits or stop active incident work.
|
|
|
67
68
|
| Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
|
|
68
69
|
|---|---|---|---|---|
|
|
69
70
|
| stdio MCP registration | plugin `.mcp.json` | `opencode.json` local MCP entry | plugin `.mcp.json` | plugin `mcpServers` entry |
|
|
70
|
-
| Live/declared contracts |
|
|
71
|
+
| Live/declared contracts | 60 | 60 | 60 | 60 |
|
|
71
72
|
| Structured user alignment | `AskUserQuestion` in interactive sessions | `question` when permission is not denied | `request_user_input` when the current mode exposes it | `AskUserQuestion` outside auto mode |
|
|
72
73
|
| Greenfield/brownfield baseline adoption | FULL | FULL | FULL | FULL |
|
|
73
74
|
| Context Manifest v3 / breadcrumb | FULL | FULL, same bundled read-only DB reader as every hook | FULL | FULL |
|
|
@@ -75,9 +76,10 @@ they do not deny edits or stop active incident work.
|
|
|
75
76
|
| Host-native review/discovery/ask | native | native | documented in `codex-capability-map.json` | native Kimi tools and workers |
|
|
76
77
|
| Workflow-memory envelope | project `.ultra/` | project `.ultra/` | project `.ultra/` | project `.ultra/` |
|
|
77
78
|
| Lifecycle/index authority | project `.ultra/.runtime/state.db` | project `.ultra/.runtime/state.db` | project `.ultra/.runtime/state.db` | project `.ultra/.runtime/state.db` |
|
|
79
|
+
| Git team checkpoint | `.ultra/tasks/tasks.json` | `.ultra/tasks/tasks.json` | `.ultra/tasks/tasks.json` | `.ultra/tasks/tasks.json` |
|
|
78
80
|
| General memory-provider API | N/A | N/A | N/A | N/A |
|
|
79
81
|
|
|
80
|
-
All
|
|
82
|
+
All 60 `task.*`, `session.*`, `baseline.*`, `change.*`, `decision.*`,
|
|
81
83
|
`workflow.*`, `artifact.*`, `system.*`, and `plan.*` operations
|
|
82
84
|
registered by `mcp-server/server.cjs` are live. Review, impact discovery, skill
|
|
83
85
|
loading, and user interaction remain host-native surfaces.
|