ultra-builder-pro-cli 0.20.0 → 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.
Files changed (109) hide show
  1. package/.ultra-template/docs/research/README.md +26 -5
  2. package/.ultra-template/specs/discovery.md +1 -1
  3. package/.ultra-template/tasks/tasks.json +10 -3
  4. package/.ultra-template/templates/task-context.md +19 -0
  5. package/CHANGELOG.md +106 -0
  6. package/README.md +215 -41
  7. package/adapters/_shared/codex-assets.cjs +69 -11
  8. package/adapters/_shared/interaction-contract.cjs +36 -3
  9. package/adapters/_shared/runtime-assets.cjs +41 -1
  10. package/adapters/claude.js +7 -5
  11. package/adapters/codex.js +1 -1
  12. package/adapters/kimi.js +2 -8
  13. package/adapters/opencode.js +43 -30
  14. package/bin/orchestrator.js +64 -24
  15. package/docs/AGENT-CONTEXT.md +89 -49
  16. package/docs/ARCHITECTURE.md +112 -45
  17. package/docs/ARTIFACT-AUTHORITY.md +274 -0
  18. package/docs/COMMIT-HASH-BACKFILL.md +33 -90
  19. package/docs/DECISIONS.md +14 -6
  20. package/docs/LEGACY-CLI-CROSSWALK.md +16 -6
  21. package/docs/PLUGIN-ISOLATION-CONTRACT.md +6 -4
  22. package/docs/ROADMAP.md +20 -6
  23. package/docs/RUNTIME-COMPAT-MATRIX.md +29 -16
  24. package/docs/STATE-DB-ACCESS-POLICY.md +43 -13
  25. package/docs/WORKFLOW-LIFECYCLE.md +105 -50
  26. package/hooks/README.md +10 -8
  27. package/hooks/active_task_context.py +105 -18
  28. package/hooks/context_spine.py +16 -4
  29. package/hooks/health_check.py +5 -4
  30. package/hooks/pre_stop_check.py +5 -2
  31. package/hooks/runtime_paths.py +396 -0
  32. package/hooks/subagent_tracker.py +5 -2
  33. package/hooks/workflow_checkpoint.py +16 -3
  34. package/hooks/workflow_context.py +11 -3
  35. package/hooks/workflow_resume.py +7 -4
  36. package/mcp-server/breadcrumb.cjs +20 -2
  37. package/mcp-server/lib/archive-journal.cjs +1026 -111
  38. package/mcp-server/lib/archive-mutation-worker.py +365 -0
  39. package/mcp-server/lib/artifact-registry.cjs +1127 -0
  40. package/mcp-server/lib/baseline-workflow.cjs +69 -28
  41. package/mcp-server/lib/change-packet.cjs +818 -0
  42. package/mcp-server/lib/change-workflow.cjs +932 -176
  43. package/mcp-server/lib/context-paths.cjs +142 -0
  44. package/mcp-server/lib/context-spine.cjs +511 -45
  45. package/mcp-server/lib/decision-dialogue.cjs +345 -3
  46. package/mcp-server/lib/delivery-transaction.cjs +471 -0
  47. package/mcp-server/lib/doctor-backup-worker.cjs +328 -0
  48. package/mcp-server/lib/doctor.cjs +401 -11
  49. package/mcp-server/lib/git-bootstrap.cjs +458 -47
  50. package/mcp-server/lib/init-project.cjs +240 -95
  51. package/mcp-server/lib/plan-publication-worker.cjs +830 -0
  52. package/mcp-server/lib/plan-store.cjs +700 -5
  53. package/mcp-server/lib/project-breadcrumb.cjs +23 -4
  54. package/mcp-server/lib/projector.cjs +211 -42
  55. package/mcp-server/lib/runtime-paths.cjs +1687 -0
  56. package/mcp-server/lib/safe-project-file.cjs +385 -0
  57. package/mcp-server/lib/spec-learning.cjs +28 -12
  58. package/mcp-server/lib/state-authority.cjs +19 -3
  59. package/mcp-server/lib/state-db.cjs +263 -9
  60. package/mcp-server/lib/state-ops.cjs +254 -50
  61. package/mcp-server/lib/task-ledger.cjs +1342 -0
  62. package/mcp-server/lib/telemetry.cjs +12 -3
  63. package/mcp-server/lib/workflow-state.cjs +610 -58
  64. package/mcp-server/server.cjs +423 -42
  65. package/orchestrator/daemon.cjs +2 -10
  66. package/orchestrator/parallel-orchestrator.cjs +314 -50
  67. package/orchestrator/planner/plan-builder.cjs +1 -1
  68. package/orchestrator/recovery.cjs +125 -7
  69. package/orchestrator/session-close-journal-worker.cjs +5 -0
  70. package/orchestrator/session-close-journal.cjs +1014 -0
  71. package/orchestrator/session-runner.cjs +679 -69
  72. package/orchestrator/worktree-manager.cjs +186 -35
  73. package/package.json +2 -3
  74. package/skills/cc-collab/SKILL.md +4 -1
  75. package/skills/codex-collab/SKILL.md +5 -2
  76. package/skills/ultra-change/SKILL.md +34 -8
  77. package/skills/ultra-deliver/SKILL.md +26 -11
  78. package/skills/ultra-dev/SKILL.md +52 -10
  79. package/skills/ultra-doctor/SKILL.md +16 -3
  80. package/skills/ultra-init/SKILL.md +22 -11
  81. package/skills/ultra-plan/SKILL.md +58 -18
  82. package/skills/ultra-research/SKILL.md +37 -35
  83. package/skills/ultra-review/SKILL.md +14 -8
  84. package/skills/ultra-status/SKILL.md +18 -9
  85. package/skills/ultra-test/SKILL.md +11 -5
  86. package/skills/ultra-think/SKILL.md +6 -2
  87. package/skills/ultra-think/references/decision-dialogue.md +17 -6
  88. package/skills/ultra-verify/SKILL.md +4 -1
  89. package/spec/cli-protocol.md +21 -7
  90. package/spec/mcp-tools.yaml +629 -44
  91. package/spec/schemas/change-delta.v1.schema.json +153 -0
  92. package/spec/schemas/context-file.v4.5.schema.json +1 -1
  93. package/spec/schemas/documentation-reconciliation.v1.schema.json +106 -0
  94. package/spec/schemas/mcp-tools.schema.json +1 -1
  95. package/spec/schemas/state-db.sql +51 -14
  96. package/spec/schemas/task-ledger.v1.schema.json +217 -0
  97. package/spec/schemas/tasks.v4.5.schema.json +1 -1
  98. package/ultra-tools/cli.cjs +3 -2
  99. package/ultra-tools/commands/db.cjs +76 -25
  100. package/ultra-tools/commands/migrate.cjs +1000 -82
  101. package/ultra-tools/commands/session.cjs +34 -8
  102. package/ultra-tools/commands/status.cjs +32 -6
  103. package/ultra-tools/commands/system.cjs +129 -22
  104. package/.ultra-template/tasks/contexts/TEMPLATE.md +0 -19
  105. package/commands/learn.md +0 -10
  106. package/orchestrator/skill-miner.cjs +0 -133
  107. package/output-styles/coding-vibes.md +0 -67
  108. package/output-styles/structural-thinking.md +0 -61
  109. package/skills/learn/SKILL.md +0 -58
@@ -1,101 +1,44 @@
1
- # Commit-hash backfill — two-commit completion flow
1
+ # Commit-hash backfill
2
2
 
3
- > Phase 2.8 contract. Replaces the v4.4 `git commit --amend` step with an
4
- > append-only flow that survives the SQLite authority model.
5
- > Hook wiring lives in Phase 3 (`skills/ultra-dev/SKILL.md` Step 6).
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
- ## Why we changed
7
+ This removes the old self-referential two-commit loop. Recording a commit hash no
8
+ longer changes any tracked file.
8
9
 
9
- In v4.4 the per-task `context md` carried a `completion_commit` field
10
- in its frontmatter. The legacy flow was:
10
+ ## Direct task completion
11
11
 
12
- 1. `git commit -m "feat: …"` to land the implementation
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
- That last step makes the commit non-atomic (the second write produces
18
- a new SHA, invalidating the value we just stamped). It also fights the
19
- v4.5 authority rule (D32) — the projector is the only writer to
20
- `contexts/task-N.md`, so any handwritten edit gets stomped.
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
- ## The new flow
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
- │ 1. feat commit │ context md still has empty
27
- │ git add … && git commit │ completion_commit (projector
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
- The result in `git log --oneline`:
30
+ ## Parent-supervised workers
54
31
 
55
- ```
56
- 2222222 chore: record task-N completion hash
57
- 1111111 feat: task-N — <title>
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
- Both commits are immutable. The chore commit is small (only the
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
- ## Why two commits, not amend
65
-
66
- - **Atomic history.** Each SHA is final the moment it is written.
67
- - **Idempotent.** Re-running the chore commit on the same hash is a
68
- no-op (projector emits the same bytes).
69
- - **Survives the projector contract.** The projection is the only
70
- writer to `contexts/task-N.md`; this flow keeps that promise.
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,13 +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, and legal state transitions | Product direction, a fixed research route, technology selection, or business decisions |
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 generated-projection protection | Ordinary development blocking or semantic route selection |
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
- `.ultra/state.db` is the only durable Ultra lifecycle authority. Generated JSON
19
- and Markdown are projections or evidence artifacts. Prompt text, chat history,
20
- external memory, and code-graph payloads are not Ultra authority.
18
+ `.ultra/` is project-local cross-session workflow memory. `.ultra/.runtime/state.db` is
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).
21
26
 
22
27
  ## Research coverage
23
28
 
@@ -34,7 +39,10 @@ MCP validates generic invariants: selected identifiers must exist, dispositions
34
39
  must be legal, reused or excluded evidence must be referenced, synthesis must be
35
40
  active, and at least one non-synthesis area must be applicable. MCP does not
36
41
  choose the coverage set or prove how the owner answered. Once normalized intent
37
- is written, `.ultra/state.db` treats it as current cross-session authority.
42
+ is written, `.ultra/.runtime/state.db` treats it as current cross-session authority. If
43
+ that intent changes another Ultra authority, the host applies the change,
44
+ reads it back, and records typed applied references when completing the
45
+ decision thread.
38
46
 
39
47
  ## Lifecycle boundaries
40
48
 
@@ -37,8 +37,9 @@ contract and adds stronger authority, recovery, or portability.
37
37
 
38
38
  The following are deliberate extensions built on the original spine:
39
39
 
40
- 1. `.ultra/state.db` as the only lifecycle authority; Markdown and JSON are artifacts
41
- or projections.
40
+ 1. `.ultra/.runtime/state.db` as the only lifecycle and index authority; registered
41
+ digest-bound Markdown and JSON carry semantic or evidence bodies, while generated
42
+ views remain projections.
42
43
  2. Typed MCP transitions for baseline, change, decision, workflow, task, session,
43
44
  incident, projection, and evidence state.
44
45
  3. Greenfield, brownfield, monorepo-scope, migrated, restore, and rebaseline paths.
@@ -52,12 +53,16 @@ The following are deliberate extensions built on the original spine:
52
53
  9. Native adapters for Claude Code, OpenCode, Codex, and Kimi Code.
53
54
  10. Explicit worktree admission, leases, heartbeats, crash evidence, circuit breaking,
54
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.
55
59
 
56
60
  ## Intentionally retired original baggage
57
61
 
58
62
  These items are not compatibility losses:
59
63
 
60
- - embedded prompt, transcript, observation, summary, or cross-session memory;
64
+ - embedded prompt, transcript, observation journal, session summary, or general
65
+ conversational cross-session memory;
61
66
  - an internal code graph or memory store;
62
67
  - retired model runtimes and their prompts;
63
68
  - retired command-proxy integrations;
@@ -83,6 +88,7 @@ route only for a unique mechanical recovery invariant.
83
88
  task.init_project
84
89
  -> greenfield classification
85
90
  -> Git bootstrap when absent
91
+ -> empty or imported team checkpoint
86
92
  -> init read-back and completion
87
93
  -> explicit full research with a model-recommended, owner-selected route
88
94
  -> selected execute/verify/reuse work and synthesis
@@ -99,6 +105,7 @@ task.init_project
99
105
  task.init_project
100
106
  -> brownfield classification and selected scope
101
107
  -> preserve current Git HEAD and dirty-state evidence
108
+ -> import portable team state and require local baseline revalidation when cloned
102
109
  -> init read-back and completion
103
110
  -> explicit adoption research with a model-recommended, owner-selected route
104
111
  -> characterization verification + known-red/gap ledger
@@ -121,13 +128,13 @@ doctor/migrate with backup
121
128
 
122
129
  ```text
123
130
  status
124
- -> change intent capture
131
+ -> checkpoint condition + change intent capture
125
132
  -> material alignment only when unresolved
126
133
  -> model-recommended, owner-selected or delegated bounded research, plan,
127
134
  current dev work, think, or status
128
135
  -> session.spawn creates the real task worktree
129
136
  -> red/green/verify/review
130
- -> local task commit and verified integration
137
+ -> durable task checkpoint + one local task commit + local hash backfill
131
138
  -> safe session close
132
139
  -> aggregate test -> review -> deliver
133
140
  -> atomic baseline reconciliation
@@ -146,7 +153,7 @@ status
146
153
  | Dependency waves advanced after transport exit | The plan pauses at the first non-terminal wave and resumes only after its DB tasks converge. |
147
154
  | A crafted or merely exported plan could bypass current plan authority | Change-owned dispatch requires a healthy completed plan workflow and the exact current DB graph; malformed, cyclic, stale, duplicate-task, or cross-change plans fail before session creation. |
148
155
  | Direct session or daemon spawn bypassed the current plan | Every change-owned admission and spawn revalidates current task-contract digests, task set, dependencies, and staleness before takeover or worktree creation. |
149
- | A worker launched inside a worktree could create a second `.ultra/state.db` | Every session checkout links its ignored `.ultra` entry to central authority and receives non-overridable DB/root bindings; legacy repositories get a local `info/exclude` rule without tracked drift, while unsafe ignore or link state rolls back before worker launch. |
156
+ | A worker launched inside a worktree could create a second `.ultra/.runtime/state.db` | Every session checkout links its ignored `.ultra` entry to central authority and receives non-overridable DB/root bindings; legacy repositories get a local `info/exclude` rule without tracked drift, while unsafe ignore or link state rolls back before worker launch. |
150
157
  | Plan authority could drift between wave admission and actual spawn | The spawn-time gate converts this race into an authority pause without task-failure or circuit-breaker evidence. |
151
158
  | Explicit auto-merge could integrate before workflow gates | A change-owned auto-merge requires the exact completion commit, ready dev evidence, a current task review, and clean committed Git work; otherwise the worktree is preserved. |
152
159
  | Session close or auto-merge could delete uncommitted work | Close preserves by default; explicit cleanup verifies clean and integrated Git ancestry. |
@@ -154,6 +161,9 @@ status
154
161
  | Failure returned a task to pending without recovery evidence | Exit and spawn failures become `blocked` and record session-linked circuit-breaker evidence. |
155
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. |
156
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. |
157
167
 
158
168
  ## Advancement rule
159
169
 
@@ -12,7 +12,8 @@ An adapter may write only:
12
12
  - the plugin's own provenance and managed-file markers.
13
13
 
14
14
  The first command allowed to create project authority is `ultra-init`. Once invoked,
15
- Ultra owns only the repository-local `.ultra/` authority and its generated projections.
15
+ Ultra owns only the repository-local `.ultra/` workflow-memory envelope and its
16
+ MCP-published checkpoint plus generated local projections.
16
17
 
17
18
  ## Surfaces Ultra does not own
18
19
 
@@ -21,7 +22,7 @@ Install, update, doctor, and uninstall must not create, rewrite, trim, merge, or
21
22
  - user-level `CLAUDE.md`, `AGENTS.md`, or equivalent instruction files;
22
23
  - repository-level instruction files;
23
24
  - project source, Git history, remotes, or `.ultra/` data;
24
- - memory or code-graph provider data.
25
+ - general memory or code-graph provider data.
25
26
 
26
27
  Existing Ultra marker blocks in a user handbook are legacy user content after this
27
28
  contract takes effect. They are not silently removed because the plugin cannot prove
@@ -44,10 +45,11 @@ Internal review-rule skills remain available only to their bounded workers.
44
45
 
45
46
  ## Idle behavior
46
47
 
47
- Outside a repository containing `.ultra/state.db`, all Ultra hooks are silent. Inside
48
+ Outside a repository containing `.ultra/.runtime/state.db`, all Ultra hooks are silent. Inside
48
49
  an initialized repository they remain silent unless a DB-authoritative workflow is
49
50
  active, blocked, or ready. The sole idle-time enforcement is protection against direct
50
- writes to generated Ultra projections; the DB remains authoritative.
51
+ writes to the MCP-owned team checkpoint or generated Ultra projections; the DB remains
52
+ checkout-local operational authority.
51
53
 
52
54
  Installation tests preserve byte-for-byte snapshots of all supported user handbook
53
55
  paths. Runtime tests cover explicit activation, idle silence, active recovery, and
package/docs/ROADMAP.md CHANGED
@@ -40,7 +40,7 @@ sharing one authoritative workflow store.
40
40
  | 5 | Recovery + staleness + auto-routing | ✅ done (D43) → v0.2 |
41
41
  | 6 | Monitoring + telemetry | ✅ done (D44) → v0.2 |
42
42
  | 4.6b | Full conformance suite | ✅ done (D45) — 20 conformance + 21 resolveTarget tests |
43
- | 7 | tagged tasks + skill mining; retired Ultra memory delegated to external providers | ✅ superseded by the package-boundary cleanup |
43
+ | 7 | tagged tasks; non-core generation and retention surfaces removed from the plugin | ✅ superseded by the package-boundary cleanup |
44
44
  | 8A | Plan automation (parse / topo / expand + artifact + human gate) | ✅ done (D47, `a932cb8`) → v0.3 |
45
45
  | 8B | Execution automation (dispatch / parallel worktree / merge) | ✅ done (D48, `8224159`) — **v0.3 ready** |
46
46
  | 8C | Continuous change packets + context compiler + convergence + doctor | ✅ done (D52) |
@@ -50,20 +50,21 @@ sharing one authoritative workflow store.
50
50
  | 13 | Durable init-to-delivery workflows + task execution contracts + immutable stage evidence | ✅ done |
51
51
  | 16 | Resumable one-question owner-agent decisions + artifact checkpoints + workflow gates | ✅ done |
52
52
  | 19 | Non-ceremonial decision completion + four-host semantic-selection contract | ✅ done |
53
+ | 20 | Typed artifact registry + normalized dependency graph + orphan diagnostics | ✅ done |
53
54
  | 9 | Release pipeline | npm tag publishing live; Homebrew / pip not implemented |
54
55
 
55
56
  ## What is in the repo today
56
57
 
57
58
  ```
58
59
  spec/ ← Phase 1 single source of truth
59
- ├── mcp-tools.yaml (51 live tools across 8 families)
60
+ ├── mcp-tools.yaml (60 live tools across 9 families)
60
61
  ├── cli-protocol.md (CLI ↔ MCP mapping table)
61
62
  ├── schemas/ (state-db.sql + 4 JSON schemas)
62
63
  ├── fixtures/{valid,invalid}/ (+ v4.4-project for migration)
63
64
  └── scripts/test-all.cjs (npm run test:spec — 7 validation stages)
64
65
 
65
66
  mcp-server/ ← Phase 2 authoritative state layer
66
- ├── server.cjs (stdio MCP server, 51 task/session/baseline/change/decision/workflow/system/plan tools)
67
+ ├── server.cjs (stdio MCP server, 60 task/session/baseline/change/decision/workflow/artifact/system/plan tools)
67
68
  ├── lib/
68
69
  │ ├── state-db.cjs (SQLite + WAL + pragmas)
69
70
  │ ├── state-ops.cjs (full write API, status state machine)
@@ -81,9 +82,22 @@ ultra-tools/ ← CLI fallback, migration, and diagnostics
81
82
  └── legacy-memory.cjs (explicit inspect/archive/confirmed prune)
82
83
 
83
84
  bin/install.js ← multi-runtime installer
84
- adapters/ ← native Claude/OpenCode/Codex plugin builders
85
+ adapters/ ← native host plugin builders
86
+ ├── claude.js
87
+ ├── opencode.js
88
+ ├── codex.js
89
+ └── kimi.js
85
90
  skills/ ← allowlisted Ultra workflows, internal rules, and collab companions
86
- hooks/ ← 7 executable workflow hooks + shared Context Spine helper; OpenCode uses native JavaScript hooks
91
+ hooks/ ← allowlisted workflow hooks; OpenCode uses native JavaScript hooks
92
+ ├── active_task_context.py
93
+ ├── context_spine.py
94
+ ├── health_check.py
95
+ ├── pre_stop_check.py
96
+ ├── runtime_paths.py
97
+ ├── subagent_tracker.py
98
+ ├── workflow_checkpoint.py
99
+ ├── workflow_context.py
100
+ └── workflow_resume.py
87
101
  docs/
88
102
  ├── DECISIONS.md current authority and package boundaries
89
103
  ├── ARCHITECTURE.md Phase 1 single-page entry point
@@ -92,7 +106,7 @@ docs/
92
106
  ├── PLUGIN-ISOLATION-CONTRACT.md install, activation, idle, and ownership contract
93
107
  ├── RUNTIME-COMPAT-MATRIX.md Phase 4 runtime capability matrix
94
108
  ├── STATE-DB-ACCESS-POLICY.md Phase 2 multi-process write contract
95
- ├── COMMIT-HASH-BACKFILL.md Phase 2.8 two-commit completion flow
109
+ ├── COMMIT-HASH-BACKFILL.md Checkout-local completion commit evidence
96
110
  └── ROADMAP.md this file
97
111
  ```
98
112
 
@@ -14,29 +14,29 @@ not installed.
14
14
  | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
15
15
  |---|---|---|---|---|
16
16
  | Package form | `.claude-plugin` native plugin | native config bundle + JS plugin | personal `.codex-plugin` | managed `kimi.plugin.json` plugin |
17
- | Public entry | `/ultra-*`, `/learn` | `/ultra-*`, `/learn` | `$ultra-builder-pro:<skill>` | `/ultra-builder-pro:<command>` |
18
- | Public Ultra workflows | 12, model invocation disabled | 12 commands backed by private workflow assets | 12, implicit invocation disabled | 12, model invocation disabled |
17
+ | Public entry | `/ultra-builder-pro:ultra-*` | `/ultra-*` | `$ultra-builder-pro:ultra-*` | `/ultra-builder-pro:ultra-*` |
18
+ | Public Ultra capabilities | 11, model invocation disabled | 11 commands backed by private workflow assets | 11, implicit invocation disabled | 11, model invocation disabled |
19
19
  | Internal agent-rule skills | 4, non-user-facing | 4, non-user-facing | 4 with implicit invocation disabled | 4, consumed by review workers |
20
20
  | Collaboration companions | `codex-collab`, `ultra-verify` | `cc-collab`, `codex-collab`, `ultra-verify` | `cc-collab`, `ultra-verify` | `cc-collab`, `codex-collab`, `ultra-verify` |
21
21
  | Automatic workflow bootstrap | N/A | N/A | N/A | N/A |
22
22
  | External browser/deploy/framework skills | N/A | N/A | N/A | N/A |
23
23
 
24
- Codex converts workflows into namespaced skills and records eleven legacy
24
+ Codex converts workflows into namespaced skills and records ten compatibility
25
25
  command mappings in `command-map.json`; `ultra-review` remains directly
26
- invocable as a skill. Kimi registers all twelve commands through its native
26
+ invocable as a skill. Kimi registers all eleven commands through its native
27
27
  plugin command directory and exposes the allowlisted skills independently.
28
28
 
29
29
  ## 2. Agents and collaboration
30
30
 
31
31
  | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
32
32
  |---|---|---|---|---|
33
- | Bundled review/debug workers | FULL, native Markdown agents | FULL, native agent frontmatter | FULL, nine managed TOML agents | FUNCTIONAL, nine prompt templates consumed by `Agent` / `AgentSwarm` |
33
+ | Bundled review/debug workers | FULL, native Markdown agents | FULL, native agent frontmatter | FULL, 10 managed TOML agents | FUNCTIONAL, 10 prompt templates consumed by `Agent` / `AgentSwarm` |
34
34
  | Plugin custom-agent registration | FULL | FULL | FULL | N/A; the 0.26 manifest has no custom-agent field |
35
35
  | Native bounded delegation | native agent surface | native agent surface | native Codex subagents | native `Agent` / `AgentSwarm` |
36
36
  | Cross-host advisor | explicit and read-only | explicit and read-only | explicit and read-only | explicit and read-only |
37
37
  | Primary-agent ownership | FULL | FULL | FULL | FULL |
38
38
 
39
- No bundled worker owns private persistent memory. It receives current-checkout
39
+ No bundled worker owns private conversational memory. It receives current-checkout
40
40
  evidence and bounded context from the primary host, then returns a result for
41
41
  primary verification. On Kimi, the review workflow reads the bundled worker
42
42
  template before creating the corresponding `AgentSwarm` item; the templates are
@@ -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/state.db` proves an active, blocked, or ready workflow. Projection
58
- protection applies to every initialized project because generated projections
59
- must never become a second authority. No host receives prompt capture, transcript capture,
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,16 +68,19 @@ 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 | 51 | 51 | 51 | 51 |
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 |
74
75
  | Approval-gated spec learning | FULL | FULL | FULL | FULL |
75
76
  | Host-native review/discovery/ask | native | native | documented in `codex-capability-map.json` | native Kimi tools and workers |
76
- | Durable authority | project `.ultra/state.db` | project `.ultra/state.db` | project `.ultra/state.db` | project `.ultra/state.db` |
77
- | Ultra memory API | N/A | N/A | N/A | N/A |
77
+ | Workflow-memory envelope | project `.ultra/` | project `.ultra/` | project `.ultra/` | project `.ultra/` |
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` |
80
+ | General memory-provider API | N/A | N/A | N/A | N/A |
78
81
 
79
- All 51 `task.*`, `session.*`, `baseline.*`, `change.*`, `decision.*`, `workflow.*`, `system.*`, and `plan.*` operations
82
+ All 60 `task.*`, `session.*`, `baseline.*`, `change.*`, `decision.*`,
83
+ `workflow.*`, `artifact.*`, `system.*`, and `plan.*` operations
80
84
  registered by `mcp-server/server.cjs` are live. Review, impact discovery, skill
81
85
  loading, and user interaction remain host-native surfaces.
82
86
 
@@ -91,6 +95,15 @@ generated launcher recovers the project from the inherited `PWD`, sets
91
95
  cannot be established. On POSIX it intentionally uses `env node` because Kimi
92
96
  0.26/0.27's embedded Node ABI differs from the ABI used to install `better-sqlite3`.
93
97
 
98
+ Archive finalization and archive-journal recovery use an adjacent, explicitly
99
+ packaged Python 3 worker. The worker accepts only bounded, basename-only
100
+ operations and performs mutations relative to inherited, identity-checked
101
+ directory descriptors. This boundary requires a POSIX Python runtime with
102
+ `dir_fd`, no-follow `stat`, and `O_NOFOLLOW` support. If that prerequisite is
103
+ missing, archive operations fail closed with `ARCHIVE_RUNTIME_UNAVAILABLE`;
104
+ Ultra never falls back to ancestor-sensitive pathname mutation. Other MCP
105
+ operations remain available.
106
+
94
107
  ## 5. User instruction isolation
95
108
 
96
109
  | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
@@ -135,9 +148,9 @@ records. Uninstall refuses an unmanaged or conflicting root.
135
148
 
136
149
  | Capability | Contract |
137
150
  |---|---|
138
- | Current state schema | `19.0` |
151
+ | Current state schema | `20.0` |
139
152
  | Runtime values | `claude`, `opencode`, `codex`, `kimi` |
140
- | Upgrade from earlier schema | preserves runtime rows, adds Context Spine state through 10.0, authoritative baseline adoption in 11.0, repository evidence in 12.0, durable workflows in 13.0, continuous baseline revalidation in 14.0, typed research semantics and verified reconciliation in 15.0, resumable owner-agent decision threads and workflow alignment gates in 16.0, explicit unborn-Git authority in 17.0, adaptive transitions and legacy workflow normalization in 18.0, then non-ceremonial decision completion in 19.0 |
153
+ | Upgrade from earlier schema | preserves runtime rows, adds Context Spine state through 10.0, authoritative baseline adoption in 11.0, repository evidence in 12.0, durable workflows in 13.0, continuous baseline revalidation in 14.0, typed research semantics and verified reconciliation in 15.0, resumable owner-agent decision threads and workflow alignment gates in 16.0, explicit unborn-Git authority in 17.0, adaptive transitions and legacy workflow normalization in 18.0, non-ceremonial decision completion in 19.0, then typed artifact ownership and normalized dependency edges in 20.0 |
141
154
  | Preservation gate | rows, IDs, indexes, foreign keys, telemetry, incidents, and migration history remain intact |
142
155
  | Failure behavior | rollback; no partially upgraded authority database |
143
156
 
@@ -1,13 +1,16 @@
1
- # `.ultra/state.db` access policy
1
+ # `.ultra/.runtime/state.db` access policy
2
2
 
3
3
  > Multi-process access contract. Current authority is defined by
4
4
  > [`DECISIONS.md`](./DECISIONS.md) and the live database schema.
5
5
 
6
- `.ultra/state.db` is the only authoritative state store for baselines, changes,
7
- decision threads/items, tasks, workflow runs/steps, events, sessions, incidents,
8
- projections, telemetry, and spec references
9
- (D18, D52, D54). Every process
10
- that touches it must follow the rules below; deviations are bugs.
6
+ `.ultra/.runtime/state.db` is the checkout-local lifecycle, index, transition,
7
+ freshness, and coordination authority for baselines, changes, decision threads/items, tasks,
8
+ workflow runs/steps, events, sessions, incidents, projections, telemetry, and spec
9
+ references (D18, D52, D54). Registered digest-bound files carry semantic and evidence
10
+ bodies; the DB owns their references and current digests. The tracked
11
+ `.ultra/tasks/tasks.json` is an MCP-published handoff checkpoint, not a parallel live
12
+ writer. Every process that touches the DB must follow the rules below; deviations are
13
+ bugs.
11
14
 
12
15
  ## 1. Three-role write matrix
13
16
 
@@ -64,7 +67,7 @@ WAL is part of the authority contract, not an optional performance setting.
64
67
  `openStateDb` asks SQLite to enable WAL and checks the actual returned mode. If
65
68
  the storage layer returns anything else, startup fails with
66
69
  `STATE_DB_WAL_UNAVAILABLE`. Ultra does not silently downgrade to a different
67
- concurrency model. Move `.ultra/state.db` to storage that supports SQLite WAL or
70
+ concurrency model. Move `.ultra/.runtime/state.db` to storage that supports SQLite WAL or
68
71
  resolve the mount/runtime constraint before retrying.
69
72
 
70
73
  ## 4. Where each table is owned
@@ -74,9 +77,10 @@ resolve the mount/runtime constraint before retrying.
74
77
  | `baselines` | MCP server (`baseline.start` / `baseline.record` / `baseline.converge`); initialization and legacy-projection migration may create only the first draft or compatibility row |
75
78
  | `tasks` | MCP server (`task.create` / `task.update` / `task.delete`) |
76
79
  | `changes` | MCP server (`change.create` / `change.update` / `change.converge` / `change.archive`) |
77
- | `decision_threads`, `decision_items` | MCP server (`decision.thread_start` / `decision.open` / `decision.resolve` / `decision.delegate` / `decision.defer` / `decision.supersede` / `decision.complete` / `decision.checkpoint`); only pending questions needed for recovery, normalized choices, lifecycle completion, and optional artifact checkpoints are stored, never prompts or transcripts |
80
+ | `decision_threads`, `decision_items` | MCP server (`decision.thread_start` / `decision.open` / `decision.resolve` / `decision.delegate` / `decision.defer` / `decision.supersede` / `decision.complete` / `decision.checkpoint`); pending recovery state, normalized accepted intent, durable effects, typed applied references, lifecycle completion, and optional artifact checkpoints are stored, never UI receipts, prompts, or transcripts |
78
81
  | `workflow_runs`, `workflow_steps` | MCP server (`workflow.start` / `workflow.step` / `workflow.complete`); skills provide evidence inputs but never write rows directly |
79
- | `artifacts`, `context_snapshots`, `spec_learning_candidates`, `trace_links` | MCP server through change lifecycle tools |
82
+ | `artifacts`, `artifact_edges` | MCP server (`artifact.record`); workflow-owned registration may use the same internal registry transaction |
83
+ | `context_snapshots`, `spec_learning_candidates`, `trace_links` | MCP server through change lifecycle tools |
80
84
  | `incidents`, `projection_jobs`, `event_consumers`, `circuit_breaker` | MCP server; backup-first doctor recovery may perform only documented mechanical transitions |
81
85
  | `events` | MCP server for lifecycle events; approved processes and `task.append_event` for allowlisted append-only observations |
82
86
  | `sessions` | MCP server (`session.spawn` / `session.close` / `session.heartbeat`); orchestrator may write status transitions |
@@ -85,10 +89,33 @@ resolve the mount/runtime constraint before retrying.
85
89
  | `migration_history`| schema initializer and `ultra-tools migrate` or doctor repair |
86
90
  | `schema_version` | schema initializer, `ultra-tools db init`, migration, and doctor repair |
87
91
 
88
- ## 5. Forbidden patterns
92
+ ## 5. Git team checkpoint
89
93
 
90
- - **No file copies for state.** Don't `cp .ultra/state.db
94
+ Only `task.ledger_publish` may derive `.ultra/tasks/tasks.json` from SQLite, and only
95
+ `task.ledger_import` may merge it into SQLite. Server startup performs one import after
96
+ opening project authority; later pulls in a long-running process require an explicit
97
+ import. The same checkpoint is idempotent and must not append an event again.
98
+
99
+ The checkpoint carries portable baseline, Change, and durable task records with
100
+ per-record revisions and digests. It excludes local `in_progress` ownership, sessions,
101
+ leases, worktrees, telemetry, and completion commit hashes. Import validates document
102
+ ancestry plus record-level common bases. It fast-forwards clean records and fails
103
+ before commit on same-record concurrency, parent/owner gaps, non-descendant history, or
104
+ an active-task collision. A Git-ready baseline is downgraded to checkout-local
105
+ revalidation rather than trusted as execution authority.
106
+
107
+ Legacy v4.4/v4.5 task projections are backed up and replaced only when every available
108
+ durable field matches current SQLite. Doctor reports checkpoint condition but never
109
+ performs semantic import, publication, or conflict selection.
110
+
111
+ ## 6. Forbidden patterns
112
+
113
+ - **No file copies for state.** Don't `cp .ultra/.runtime/state.db
91
114
  somewhere/state.db` and edit; use `ultra-tools db backup`.
115
+ - **No direct checkpoint edits.** Don't merge or repair
116
+ `.ultra/tasks/tasks.json` by hand; use the typed import/publish conflict path.
117
+ - **No committed live projections.** `.ultra/.runtime/projections/**` remains ignored
118
+ checkout-local output.
92
119
  - **No long-held writer connections** outside the MCP server. Pop a
93
120
  short transaction, finish, close.
94
121
  - **No `PRAGMA journal_mode` toggling at runtime** by any process other
@@ -98,14 +125,14 @@ resolve the mount/runtime constraint before retrying.
98
125
  - **No `vacuum` / `wal_checkpoint(TRUNCATE)` from inside a transaction.**
99
126
  Maintenance subcommands open their own connection.
100
127
 
101
- ## 6. Maintenance windows
128
+ ## 7. Maintenance windows
102
129
 
103
130
  `ultra-tools db checkpoint` and `ultra-tools db vacuum` are safe to run
104
131
  while the MCP server is up (they take their own connection and obey the
105
132
  busy timeout). `db backup` uses better-sqlite3's online `.backup` API
106
133
  and produces a consistent snapshot without blocking writers.
107
134
 
108
- ## 7. Verification
135
+ ## 8. Verification
109
136
 
110
137
  The contract on this page is enforced by:
111
138
 
@@ -117,3 +144,6 @@ The contract on this page is enforced by:
117
144
  status transitions, task contracts, and event coupling.
118
145
  - `mcp-server/lib/workflow-state.test.cjs` — ordered workflow transitions,
119
146
  evidence/output requirements, blocking/resume, and cross-stage gates.
147
+ - `mcp-server/lib/task-ledger.test.cjs` — portable-field filtering, digest ancestry,
148
+ idempotent import, baseline/Change/task fast-forward and conflict behavior, legacy
149
+ backup, and active-session protection.