ultra-builder-pro-cli 0.5.3 → 0.7.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 (91) hide show
  1. package/.ultra-template/changes/active/.gitkeep +1 -0
  2. package/.ultra-template/changes/archive/.gitkeep +1 -0
  3. package/CHANGELOG.md +90 -14
  4. package/README.md +38 -32
  5. package/adapters/_shared/codex-assets.cjs +32 -151
  6. package/adapters/_shared/frontmatter.cjs +2 -2
  7. package/adapters/_shared/handbook.cjs +10 -10
  8. package/adapters/_shared/path-rewrite.cjs +0 -3
  9. package/adapters/_shared/runtime-assets.cjs +13 -4
  10. package/adapters/_shared/tests/handbook.test.cjs +4 -1
  11. package/adapters/_shared/tests/path-rewrite.test.cjs +1 -3
  12. package/adapters/_shared/tests/resolve-target.test.cjs +1 -11
  13. package/adapters/_shared/tests/runtime-assets.test.cjs +7 -6
  14. package/adapters/opencode.js +82 -26
  15. package/adapters/tests/claude.test.cjs +1 -4
  16. package/adapters/tests/codex.test.cjs +9 -8
  17. package/adapters/tests/opencode.test.cjs +17 -11
  18. package/bin/install.js +6 -28
  19. package/bin/orchestrator.js +12 -30
  20. package/commands/ultra-change.md +47 -0
  21. package/commands/ultra-deliver.md +14 -7
  22. package/commands/ultra-dev.md +6 -3
  23. package/commands/ultra-doctor.md +36 -0
  24. package/commands/ultra-init.md +4 -3
  25. package/commands/ultra-status.md +7 -5
  26. package/commands/ultra-test.md +2 -1
  27. package/docs/AGENT-CONTEXT.md +35 -28
  28. package/docs/ARCHITECTURE.md +49 -21
  29. package/docs/PLAN.zh-CN.md +67 -68
  30. package/docs/ROADMAP.md +17 -17
  31. package/docs/RUNTIME-COMPAT-MATRIX.md +63 -62
  32. package/hooks/README.md +8 -7
  33. package/hooks/active_task_context.py +22 -15
  34. package/hooks/health_check.py +136 -38
  35. package/hooks/workflow_context.py +120 -30
  36. package/mcp-server/lib/change-workflow.cjs +556 -0
  37. package/mcp-server/lib/change-workflow.test.cjs +259 -0
  38. package/mcp-server/lib/doctor.cjs +112 -0
  39. package/mcp-server/lib/doctor.test.cjs +86 -0
  40. package/mcp-server/lib/init-project.cjs +32 -6
  41. package/mcp-server/lib/pricing.cjs +0 -6
  42. package/mcp-server/lib/runtime-state.cjs +222 -0
  43. package/mcp-server/lib/runtime-state.test.cjs +92 -0
  44. package/mcp-server/lib/state-db.cjs +31 -8
  45. package/mcp-server/lib/state-ops.cjs +24 -3
  46. package/mcp-server/lib/telemetry.cjs +4 -0
  47. package/mcp-server/server.cjs +102 -10
  48. package/mcp-server/tests/db-ops.test.cjs +5 -1
  49. package/mcp-server/tests/init-project.test.cjs +45 -0
  50. package/mcp-server/tests/server-contract.test.cjs +140 -1
  51. package/mcp-server/tests/state-db.test.cjs +44 -7
  52. package/mcp-server/tests/state-ops.test.cjs +42 -0
  53. package/mcp-server/tests/telemetry.test.cjs +14 -0
  54. package/orchestrator/daemon.cjs +39 -0
  55. package/orchestrator/dispatch-rules.cjs +15 -4
  56. package/orchestrator/tests/daemon.test.cjs +63 -12
  57. package/orchestrator/tests/dispatch-rules.test.cjs +12 -10
  58. package/package.json +5 -7
  59. package/settings.json +1 -2
  60. package/skills/ultra-change/SKILL.md +140 -0
  61. package/skills/ultra-deliver/SKILL.md +81 -15
  62. package/skills/ultra-dev/SKILL.md +32 -12
  63. package/skills/ultra-doctor/SKILL.md +90 -0
  64. package/skills/ultra-init/SKILL.md +8 -6
  65. package/skills/ultra-review/SKILL.md +16 -0
  66. package/skills/ultra-status/SKILL.md +30 -7
  67. package/skills/ultra-test/SKILL.md +14 -2
  68. package/skills/ultra-verify/SKILL.md +22 -41
  69. package/skills/ultra-verify/evals/evals.json +22 -24
  70. package/skills/ultra-verify/references/confidence-system.md +15 -32
  71. package/skills/ultra-verify/references/cross-verify-modes.md +14 -59
  72. package/skills/ultra-verify/scripts/verify_wait.py +44 -81
  73. package/spec/cli-protocol.md +12 -1
  74. package/spec/mcp-tools.yaml +340 -4
  75. package/spec/schemas/mcp-tools.schema.json +1 -1
  76. package/spec/schemas/skill-manifest.schema.json +2 -2
  77. package/spec/schemas/state-db.sql +119 -2
  78. package/ultra-tools/cli.cjs +3 -0
  79. package/ultra-tools/commands/system.cjs +57 -0
  80. package/ultra-tools/system-command.test.cjs +53 -0
  81. package/adapters/_shared/md-to-toml.cjs +0 -54
  82. package/adapters/_shared/rtk-detect.cjs +0 -86
  83. package/adapters/_shared/tests/md-to-toml.test.cjs +0 -48
  84. package/adapters/_shared/tests/rtk-detect.test.cjs +0 -116
  85. package/adapters/gemini.js +0 -204
  86. package/adapters/tests/gemini.test.cjs +0 -112
  87. package/docs/LEGACY-HERMES.md +0 -1175
  88. package/orchestrator/code-graph-watcher.cjs +0 -121
  89. package/orchestrator/tests/code-graph-watcher.test.cjs +0 -183
  90. package/skills/gemini-collab/SKILL.md +0 -51
  91. package/skills/gemini-collab/evals/evals.json +0 -42
@@ -1,17 +1,36 @@
1
1
  ---
2
2
  name: ultra-deliver
3
- description: "Release preparation — verify /ultra-test passed, update docs, build, version-bump, tag, push. Writes .ultra/delivery-report.json."
3
+ description: "Converge and deliver a verified baseline or continuous change: reconcile specs, build/test, archive evidence, version, tag, and push."
4
4
  runtime: all
5
+ mcp_tools_required:
6
+ - change.list
7
+ - change.get
8
+ - change.context
9
+ - change.converge
10
+ - change.archive
5
11
  cli_fallback: "direct user interaction"
6
12
  ---
7
13
 
8
14
  # ultra-deliver — Phase 3.5
9
15
 
10
- Release the current working tree. Driven entirely by file-level artifacts
11
- (`.ultra/test-report.json` as the gate; `.ultra/delivery-report.json` as the
12
- output). No state.db writes.
16
+ Release the current working tree and close its continuous-change packet when
17
+ one exists. `.ultra/test-report.json` is the test gate; `change.converge` is the
18
+ deterministic closure gate; `.ultra/delivery-report.json` is the release report.
19
+ Change lifecycle writes go through MCP only.
13
20
 
14
- ## Prerequisites (Pre-Delivery Validations — both BLOCKING)
21
+ ## Prerequisites (all validations are blocking)
22
+
23
+ ### Validation 0 — Resolve continuous change
24
+
25
+ Call `change.list` for `active`, `blocked`, and `ready` work.
26
+
27
+ - Exactly one relevant change → bind delivery to that id.
28
+ - More than one → require an explicit id; never guess which change to archive.
29
+ - None → allow initial-baseline delivery, but record `change_id: null`.
30
+ - Active/blocked change → its linked tasks must all be completed and its
31
+ `test-report.json.change_id` must match.
32
+ - Ready change → do not rerun convergence blindly; verify its existing
33
+ verification artifact still matches current HEAD before archive.
15
34
 
16
35
  ### Validation 1 — `/ultra-test` passed
17
36
 
@@ -59,10 +78,19 @@ Commit failure (conflicts, hook rejection) → surface error and **EXIT**.
59
78
  2. If signatures changed, update README usage examples
60
79
  3. Verify examples match the new API
61
80
 
81
+ **1.4 Baseline specification reconciliation** (continuous change):
82
+
83
+ 1. Read `intent.md`, `delta/`, and `docs_impact` from the bound change.
84
+ 2. Merge accepted deltas into the declared baseline documents.
85
+ 3. Record every updated project-relative path as `baseline_updates`.
86
+ 4. If no baseline file changes, write a specific `no_baseline_change_reason`.
87
+ 5. Verify no `[NEEDS CLARIFICATION]` or unresolved delta remains for delivered behavior.
88
+
62
89
  **Checklist**:
63
90
  - [ ] CHANGELOG.md updated
64
91
  - [ ] technical-debt.md refreshed
65
92
  - [ ] README.md reflects current API (if applicable)
93
+ - [ ] active delta reconciled into baseline, or explicit no-change rationale exists
66
94
 
67
95
  Any unchecked → fix, then continue.
68
96
 
@@ -80,7 +108,7 @@ Non-zero exit → block with stderr captured, then ask the user:
80
108
  - A: "Fix error and retry"
81
109
  - B: "Abort delivery"
82
110
 
83
- ### Step 3 — Version + Release (MANDATORY — all 5 sub-steps)
111
+ ### Step 3 — Version + convergence + release
84
112
 
85
113
  **3.1 Determine version bump**:
86
114
  - `git log <last-tag>..HEAD --oneline` → analyze commit types
@@ -91,6 +119,13 @@ Non-zero exit → block with stderr captured, then ask the user:
91
119
  - `package.json`, `Cargo.toml`, `pyproject.toml`, etc.
92
120
  - Verify: read the file; confirm new version.
93
121
 
122
+ **3.2a Re-run release evidence after docs/version edits**:
123
+
124
+ - Run the exact relevant test, type-check, build, and package commands again.
125
+ - Capture command, exit code, and result. Any non-zero exit blocks delivery.
126
+ - Do not reuse a test report whose `change_id` or pre-change HEAD belongs to a
127
+ different change as final evidence.
128
+
94
129
  **3.3 Release commit**:
95
130
  ```bash
96
131
  git add -A
@@ -98,13 +133,33 @@ git commit -m "chore(release): v<X.Y.Z>"
98
133
  ```
99
134
  Verify with `git log -1 --oneline`.
100
135
 
101
- **3.4 Git tag**:
136
+ **3.4 Recompile context and converge the change** (skip only for initial baseline):
137
+
138
+ For `active` or `blocked`, call `change.context` after the release commit so its
139
+ git head and task set are current. Then call `change.converge` with the exact
140
+ evidence required by kind:
141
+
142
+ - `quick`: diff, tests, spec;
143
+ - `standard` / `major`: diff, tests, spec, docs, review;
144
+ - `incident`: diagnosis, diff, tests.
145
+
146
+ Evidence must name concrete commands, artifacts, or file paths. If blockers are
147
+ returned, stop before tag/push and route to the owning workflow. Do not weaken
148
+ the change kind or mark failed evidence `not_applicable` merely to pass.
149
+
150
+ **3.5 Archive after baseline reconciliation**:
151
+
152
+ Call `change.archive` with the summary and either `baseline_updates` or the
153
+ explicit no-change reason. This moves the packet from `changes/active` to the
154
+ dated archive and records closure in state.db. Archive failure blocks release.
155
+
156
+ **3.6 Git tag**:
102
157
  ```bash
103
158
  git tag v<X.Y.Z>
104
159
  ```
105
160
  Verify with `git tag -l v<X.Y.Z>`.
106
161
 
107
- **3.5 Push to remote**:
162
+ **3.7 Push to remote**:
108
163
  ```bash
109
164
  git push origin main # release commit
110
165
  git push origin v<X.Y.Z> # version tag
@@ -115,6 +170,7 @@ Verify with `git ls-remote --tags origin | grep v<X.Y.Z>`.
115
170
  - [ ] Version determined and displayed
116
171
  - [ ] Version file updated and verified
117
172
  - [ ] Release commit created and verified
173
+ - [ ] Change context current, convergence ready, baseline reconciled, archive complete
118
174
  - [ ] Git tag created and verified
119
175
  - [ ] Commit and tag pushed and verified on remote
120
176
 
@@ -128,6 +184,10 @@ Any failure → stop immediately; do NOT continue; surface last-step error.
128
184
  "version": "<X.Y.Z>",
129
185
  "git_tag": "v<X.Y.Z>",
130
186
  "git_commit": "<HEAD SHA>",
187
+ "change_id": "<archived-change-id-or-null>",
188
+ "change_archive_path": "<path-or-null>",
189
+ "convergence_ready": true,
190
+ "baseline_updates": ["<project-relative-path>"],
131
191
  "changelog_updated": true,
132
192
  "technical_debt_refreshed": true,
133
193
  "build_success": true,
@@ -137,8 +197,9 @@ Any failure → stop immediately; do NOT continue; surface last-step error.
137
197
 
138
198
  ### Step 5 — Report
139
199
 
140
- Print a tight release summary: tag, commit, files touched in CHANGELOG,
141
- outstanding technical-debt count, next suggested action (deploy / announce).
200
+ Print a tight release summary: change id/archive, baseline files reconciled,
201
+ tag, commit, exact verification commands, outstanding technical-debt count,
202
+ and next suggested action. After release, daily work starts with `/ultra-change`.
142
203
 
143
204
  ## Deliverables Checklist (final)
144
205
 
@@ -146,6 +207,7 @@ outstanding technical-debt count, next suggested action (deploy / announce).
146
207
  - [ ] Uncommitted changes handled
147
208
  - [ ] CHANGELOG + technical-debt refreshed (README if API changed)
148
209
  - [ ] Production build exit 0
210
+ - [ ] Continuous change converged and archived (when present)
149
211
  - [ ] Version bumped, tagged, pushed
150
212
  - [ ] delivery-report.json written
151
213
 
@@ -155,17 +217,21 @@ outstanding technical-debt count, next suggested action (deploy / announce).
155
217
  |---------|----------|--------------|
156
218
  | Resolve dirty-tree action | none | current Host's native user-interaction surface |
157
219
  | Override version bump | none | current Host's native user-interaction surface |
220
+ | Resolve/bind change | `change.list` / `change.get` | none; fail closed |
221
+ | Refresh context | `change.context` | none; fail closed |
222
+ | Deterministic closure | `change.converge` / `change.archive` | none; fail closed |
158
223
 
159
224
  ## What this skill DOES NOT do
160
225
 
161
- - Does NOT run tests (that is `/ultra-test`'s job)
226
+ - Does NOT replace `/ultra-test`; it re-runs the exact release evidence after
227
+ documentation and version changes so the shipped commit is verified
162
228
  - Does NOT publish to npm / crates.io / PyPI (Phase 9 handles distribution)
163
- - Does NOT mutate state.db
229
+ - Does NOT directly mutate state.db or external provider state
164
230
 
165
231
  ## Integration
166
232
 
167
233
  | | |
168
234
  |---|---|
169
- | **Input** | `.ultra/test-report.json` (gate), current repo |
170
- | **Output** | `.ultra/delivery-report.json`, git tag + remote push |
171
- | **Next** | Deploy target (Railway / Vercel / etc.) or release announcement |
235
+ | **Input** | bound change (if any), test/review artifacts, current repo |
236
+ | **Output** | archived change, reconciled baseline, delivery report, git tag + remote push |
237
+ | **Next** | deploy/announce; next daily change begins with `/ultra-change` |
@@ -6,6 +6,8 @@ mcp_tools_required:
6
6
  - task.update
7
7
  - task.get
8
8
  - task.list
9
+ - change.get
10
+ - change.context
9
11
  ---
10
12
 
11
13
  # ultra-dev — Phase 3.4
@@ -13,8 +15,9 @@ mcp_tools_required:
13
15
  Drive one task from `pending → completed` using a strict TDD loop, gated by
14
16
  `/ultra-review`. **state.db is the authority**: status transitions go through
15
17
  MCP `task.update`; the projector regenerates `tasks.json` and context-md
16
- frontmatter. The skill only writes context-md **bodies** (Change Log,
17
- Completion, Dual-Write notes).
18
+ frontmatter. For a task linked by `change_id`, requirement discoveries go to
19
+ the active change delta first; baseline reconciliation happens in
20
+ `/ultra-deliver`.
18
21
 
19
22
  ## Authority failure boundary
20
23
 
@@ -85,6 +88,11 @@ Pick the first result (dependency-resolved) or the one matching `$1`.
85
88
  Read `.ultra/tasks/contexts/task-{id}.md` body for the Implementation /
86
89
  Acceptance sections. Use the Acceptance list as the initial todo set.
87
90
 
91
+ If the task has `change_id`, call `change.get` and inspect its
92
+ `context-manifest.json`. The task id, git head, allowed paths, spec refs, and
93
+ external provider metadata must match the current slice. Call `change.context`
94
+ before editing whenever they are stale. Provider content remains external.
95
+
88
96
  ### Step 1.5 — Status → in_progress (single-write)
89
97
 
90
98
  ```jsonc
@@ -266,6 +274,10 @@ Any unchecked → fix; do NOT commit.
266
274
  git push origin main && git branch -d feat/task-<id>-<slug>
267
275
  ```
268
276
 
277
+ 8. For a task with `change_id`, call `change.context` after the final commit,
278
+ rebase, and verification so the manifest records the actual HEAD and task
279
+ set used for convergence.
280
+
269
281
  Checkpoint `step="6", status="committed", commit=<sha>`.
270
282
 
271
283
  ### Step 7 — Report
@@ -274,16 +286,16 @@ Checkpoint `step="6", status="committed", commit=<sha>`.
274
286
  - Project progress (`task.list` → `completed/total`)
275
287
  - Next task suggestion (first remaining `pending` in topological order)
276
288
 
277
- ## Dual-Write Mode
289
+ ## Delta-First Specification Mode
278
290
 
279
- Triggered when implementation reveals spec gaps or requirement changes.
291
+ Triggered when implementation reveals specification gaps or requirement changes.
280
292
 
281
293
  **Classification (mandatory before updating specs)**:
282
294
 
283
295
  | Kind | Meaning | Action |
284
296
  |------|---------|--------|
285
- | **EXPANSION** | new requirement surfaced | update spec + Change Log |
286
- | **CORRECTION** | spec error/ambiguity | update spec + Change Log |
297
+ | **EXPANSION** | new requirement surfaced | update active change delta + Change Log |
298
+ | **CORRECTION** | spec error/ambiguity | update active change delta + Change Log |
287
299
  | **REDUCTION** | removing/weakening scope | **STOP** → ask the user for approval |
288
300
 
289
301
  **REDUCTION gate** — options:
@@ -291,16 +303,23 @@ Triggered when implementation reveals spec gaps or requirement changes.
291
303
  - B: "Keep original scope, find alternative implementation"
292
304
  - C: "Split into separate task, defer to next cycle"
293
305
 
294
- Update `.ultra/specs/` immediately so parallel tasks see current truth.
295
- Log in context-md body Change Log:
306
+ For a task with `change_id`, update
307
+ `.ultra/changes/active/<change-id>/delta/` immediately, then recompile
308
+ `change.context`. Do not silently rewrite the baseline while parallel tasks are
309
+ still executing. `/ultra-deliver` must reconcile the approved delta into the
310
+ declared baseline files before archive.
311
+
312
+ For an initial-baseline task with no `change_id`, update `.ultra/specs/`
313
+ directly because no continuous-change packet exists yet. In both cases log the
314
+ decision in the context-md body Change Log:
296
315
 
297
316
  ```markdown
298
317
  | <date> | <KIND> | <change desc> | specs/<file>#<section> | <reason> |
299
318
  ```
300
319
 
301
- **Principle**: `specs/` is source of truth; `contexts/` tracks implementation
302
- history. Specs may grow (EXPANSION) or be corrected (CORRECTION). Specs must
303
- never silently shrink (REDUCTION without gate).
320
+ **Principle**: the baseline specs describe accepted product truth; the active
321
+ delta describes proposed change; task contexts record implementation history.
322
+ No layer may silently shrink scope without the REDUCTION gate.
304
323
 
305
324
  ## MCP failure matrix
306
325
 
@@ -311,6 +330,7 @@ never silently shrink (REDUCTION without gate).
311
330
  | Pre-review checkpoint | none | write `.ultra/workflow-state.json`; lifecycle hooks restore it |
312
331
  | Run review | none | `/ultra-review all` + Host-native review agents |
313
332
  | Status → completed | `task.update` (2) | stop; do not claim completion |
333
+ | Refresh linked context | `change.context` (9) | stop; do not claim the change packet is current |
314
334
  | Ask user | none | current Host's native user-interaction surface |
315
335
 
316
336
  ## What this skill DOES NOT do
@@ -325,5 +345,5 @@ never silently shrink (REDUCTION without gate).
325
345
  | | |
326
346
  |---|---|
327
347
  | **Input** | state.db via MCP, plus the `context_file` body returned for the selected task |
328
- | **Writes** | state.db (via `task.update`), context-md body (Completion + Change Log), workflow-state.json checkpoints |
348
+ | **Writes** | state.db (via `task.update`/`change.context`), active delta or baseline spec as classified, context-md body, workflow-state checkpoints |
329
349
  | **Next** | `/ultra-dev <next-id>` or `/ultra-test` when all Walking Skeleton + critical-path tasks complete |
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: ultra-doctor
3
+ description: "Inspect Ultra state, projection, session, incident, and active-change health; optionally run explicit backup-first mechanical recovery."
4
+ runtime: all
5
+ mcp_tools_required:
6
+ - system.doctor
7
+ cli_fallback: "system doctor"
8
+ ---
9
+
10
+ # ultra-doctor — Runtime Diagnostics and Recovery
11
+
12
+ Use this workflow when Ultra state appears empty, projections disagree with
13
+ `state.db`, a hook reports a missing adapter, sessions are orphaned, a change
14
+ artifact is missing, or MCP operations return degraded projection metadata.
15
+
16
+ ## Default is read-only
17
+
18
+ Call `system.doctor` with `{ "repair": false }` unless the user explicitly
19
+ requests repair. Read-only diagnosis reports:
20
+
21
+ - SQLite integrity and required tables;
22
+ - open structured incidents;
23
+ - projection queue failures and event/projection cursor lag;
24
+ - orphan sessions;
25
+ - missing active-change artifact roots;
26
+ - the external ownership boundary for Memory and code graph.
27
+
28
+ Do not infer health from `tasks.json`. Do not mutate provider state, delete
29
+ artifacts, rebuild a graph, or collect memory during diagnosis.
30
+
31
+ ## Interpret the report
32
+
33
+ | Check | Meaning | Next action |
34
+ |---|---|---|
35
+ | `state_db` fail | schema/integrity problem | stop ordinary workflow; preserve DB evidence |
36
+ | `incidents` fail | a structured runtime failure remains open | report code, source, retryability, and evidence |
37
+ | `projections` fail | state commit is ahead of generated views or a projector failed | explicit repair is appropriate when authorized |
38
+ | `sessions` fail | an orphan execution lease exists | repair may mark/reconcile it; never kill unrelated processes blindly |
39
+ | `change_artifacts` fail | DB points to a missing active packet | recover from version control/backup or recreate deliberately |
40
+ | `external_providers` pass | ownership is correctly external | provider availability must be checked with its own plugin/tool |
41
+
42
+ ## Explicit repair mode
43
+
44
+ Only after the user asks for repair, call `system.doctor` with
45
+ `{ "repair": true }`, or use the fallback:
46
+
47
+ ```bash
48
+ ultra-tools system doctor --repair
49
+ ```
50
+
51
+ The runtime must create `.ultra/backups/state-<timestamp>.db` before any
52
+ mechanical repair. Repair is bounded to:
53
+
54
+ - boot recovery for orphan sessions;
55
+ - durable consumption of spec-staleness events;
56
+ - requeueing projection jobs left `running` beyond the interruption cutoff;
57
+ - requeueing failed projection jobs;
58
+ - regenerating projections from authoritative state.
59
+
60
+ If backup fails, repair must stop with `BACKUP_FAILED`. A repair result is not
61
+ automatically healthy; inspect the returned post-repair report and keep any
62
+ remaining incident unresolved.
63
+
64
+ ## Hook/path failures
65
+
66
+ For an installed hook that points to a missing cached file:
67
+
68
+ 1. capture the exact hook config path and missing target;
69
+ 2. verify the currently installed plugin/cache version;
70
+ 3. reinstall or regenerate the host-native plugin through the adapter;
71
+ 4. rerun read-only doctor and a host hook smoke test.
72
+
73
+ Do not bypass a broken hook by changing application implementation, and do not
74
+ treat a hook failure as project-code evidence.
75
+
76
+ ## Output
77
+
78
+ Lead with `healthy` or `degraded`, list only failing checks, and include:
79
+
80
+ - incident ids/codes and sources;
81
+ - event vs projected cursor;
82
+ - whether repair ran;
83
+ - backup path when repair ran;
84
+ - unresolved actions and their owner (`Ultra`, host plugin, or external provider).
85
+
86
+ ## What this skill does not do
87
+
88
+ - It does not fix project code or semantic specification conflicts.
89
+ - It does not delete state, force-reset git, or close live healthy sessions.
90
+ - It does not install, query, refresh, or repair external Memory/graph providers.
@@ -10,7 +10,8 @@ cli_fallback: "task init-project"
10
10
  # ultra-init — Phase 3.1
11
11
 
12
12
  把当前工作目录(或 `--target-dir`)初始化为一个 Ultra Builder Pro 项目:拉起
13
- `.ultra/` 骨架、写入 `tasks.json` 元数据、按需配 git。
13
+ `.ultra/` 骨架、初始化权威 `state.db`、建立持续变更目录、写入 `tasks.json`
14
+ 初始元数据,并按需配置 git。
14
15
 
15
16
  真实的目录搭建 + 模板拷贝 + tasks.json 注入统一由 **MCP tool `task.init_project`** 完成;
16
17
  MCP 不可达时回退 `ultra-tools task init-project`。
@@ -18,7 +19,7 @@ MCP 不可达时回退 `ultra-tools task init-project`。
18
19
  ## 设计要点(对比 pre-Phase-3 行为)
19
20
 
20
21
  - **无 Claude 独占依赖**:`task.init_project` + `ultra-tools init-project` 两条路径
21
- 都不调 Claude 原生工具,4 个 runtime 都能走通。
22
+ 都不调 Claude 原生工具,Claude Code、OpenCode、Codex 三个 runtime 都能走通。
22
23
  - **模板内置**:`.ultra/` 骨架来自仓内 `templates/.ultra/`;不再依赖 `~/.claude/.ultra-template/`。
23
24
  - **幂等**:二次 init 默认拒绝,`--overwrite` 才会备份旧 `.ultra/` 为
24
25
  `.ultra.backup.<ts>` 后重建。
@@ -83,9 +84,11 @@ MCP 不可达时回退 `ultra-tools task init-project`。
83
84
  "copied_files": [
84
85
  "specs/discovery.md", "specs/product.md", "specs/architecture.md",
85
86
  "tasks/tasks.json", "tasks/contexts/TEMPLATE.md",
87
+ "changes/active/.gitkeep", "changes/archive/.gitkeep",
86
88
  "docs/research/README.md",
87
89
  "test-report.json", "delivery-report.json"
88
- ]
90
+ ],
91
+ "state_db_path": "/abs/path/to/project/.ultra/state.db"
89
92
  }
90
93
  ```
91
94
 
@@ -121,7 +124,8 @@ CLI 最后一行是 `{ "ok": true, "data": { ... } }`(见 spec/cli-protocol.md
121
124
  ### Step 4: 成功总结 + 下一步
122
125
 
123
126
  用中文输出:
124
- - ✅ `.ultra/` 骨架(specs / tasks / docs / reports)
127
+ - ✅ `.ultra/` 骨架(specs / tasks / changes / docs / reports)
128
+ - ✅ `.ultra/state.db` 已初始化为当前 schema,后续不再依赖第一次写操作懒创建
125
129
  - ✅ tasks.json 注入元数据(name / type / stack / created / updated)
126
130
  - ✅ git 状态(按选择)
127
131
  - ⚠️ **下一步**:跑 `/ultra-research` 做 17 步 discovery 填 spec;不要跳过直接 `/ultra-plan`
@@ -133,7 +137,6 @@ CLI 最后一行是 `{ "ok": true, "data": { ... } }`(见 spec/cli-protocol.md
133
137
  | Claude | `/ultra-init [name] [type] [stack] [git]` — 命令薄壳拉起此 skill |
134
138
  | OpenCode | `/ultra-init …` 同上(agent frontmatter 小写化) |
135
139
  | Codex | `codex exec "run /ultra-init …"`(Phase 4.4 adapter 接) |
136
- | Gemini | `gemini --prompt "run /ultra-init …"`(Phase 4.5 extension 接) |
137
140
 
138
141
  ## 输出锚点
139
142
 
@@ -144,5 +147,4 @@ CLI 最后一行是 `{ "ok": true, "data": { ... } }`(见 spec/cli-protocol.md
144
147
  ## 不做的事
145
148
 
146
149
  - **不**创建业务 task(业务 task 由 `/ultra-plan` 在 spec 填完后批量创建)
147
- - **不**写入 state.db(state.db 由第一次 MCP 写操作或显式 `ultra-tools db init` 触发)
148
150
  - **不**调 web:离线可执行
@@ -2,6 +2,10 @@
2
2
  name: ultra-review
3
3
  description: "Parallel code review orchestration with 6 specialized agents + coordinator. Zero context pollution - all output via JSON files."
4
4
  user-invocable: true
5
+ runtime: all
6
+ mcp_tools_required:
7
+ - change.list
8
+ - task.list
5
9
  ---
6
10
 
7
11
  # /ultra-review - Ultra Review System
@@ -54,6 +58,7 @@ Orchestrates parallel code review using specialized agents. All findings written
54
58
  # 1. Determine session context
55
59
  BRANCH = git branch --show-current # e.g., "feat/task-3-auth"
56
60
  ITER = count existing sessions matching this branch + 1 # iteration number
61
+ CHANGE_ID = active change whose linked tasks/diff match this scope, else null
57
62
 
58
63
  # 2. Create session directory with full context
59
64
  SESSION_ID = "<YYYYMMDD-HHmmss>-<branch>-iter<N>"
@@ -94,6 +99,15 @@ git diff RANGE --name-only
94
99
  DIFF_RANGE="RANGE"
95
100
  ```
96
101
 
102
+ **Continuous-change linkage**:
103
+
104
+ Call `change.list` and `task.list`, then bind the review to the single active or
105
+ blocked change whose linked task files intersect `DIFF_FILES`. If multiple
106
+ changes match, require an explicit scope instead of guessing. Write
107
+ `change_id` and reviewed HEAD into `SUMMARY.json` and the session index so
108
+ `/ultra-deliver` can use this artifact as review evidence. Initial-baseline
109
+ reviews may use `change_id: null`.
110
+
97
111
  ### Phase 2: Agent Selection
98
112
 
99
113
  Based on the mode argument and file classification:
@@ -277,6 +291,7 @@ A lightweight index file tracks all sessions for cross-referencing:
277
291
  {
278
292
  "id": "20260214-103000-feat-task-3-auth-iter1",
279
293
  "branch": "feat/task-3-auth",
294
+ "change_id": "auth-change",
280
295
  "iteration": 1,
281
296
  "mode": "full",
282
297
  "timestamp": "2026-02-14T10:30:00Z",
@@ -308,6 +323,7 @@ A lightweight index file tracks all sessions for cross-referencing:
308
323
  |-------|-------------|
309
324
  | `id` | Session directory name |
310
325
  | `branch` | Git branch at review time |
326
+ | `change_id` | Continuous change reviewed, or null for initial baseline |
311
327
  | `iteration` | Nth review for this branch (auto-incremented) |
312
328
  | `mode` | Review mode used (full/quick/security/recheck/delta) |
313
329
  | `timestamp` | ISO 8601 |
@@ -7,6 +7,8 @@ mcp_tools_required:
7
7
  - task.get
8
8
  - session.list
9
9
  - session.subscribe_events
10
+ - change.list
11
+ - system.doctor
10
12
  cli_fallback: "status --cost --json"
11
13
  ---
12
14
 
@@ -15,6 +17,8 @@ cli_fallback: "status --cost --json"
15
17
  Single-call dashboard. Pulls task state from state.db (authoritative), layers
16
18
  in `.ultra/test-report.json` + `.ultra/delivery-report.json` (file artifacts),
17
19
  reports progress + risks + workflow routing.
20
+ It never treats a completed initial delivery as a terminal state: a healthy
21
+ baseline routes the next daily request through `/ultra-change`.
18
22
 
19
23
  ## Authority failure boundary
20
24
 
@@ -47,6 +51,12 @@ user to run `ultra-tools migrate --from=4.4 --to=4.5 --source-dir <project-root>
47
51
  // MCP: session.subscribe_events (recent events for the "last event" panel)
48
52
  { "since_id": 0, "limit": 20 }
49
53
  // → { events: [...], next_since_id: M }
54
+
55
+ // MCP: change.list (continuous-change lane)
56
+ { "limit": 20 }
57
+
58
+ // MCP: system.doctor (read-only runtime health)
59
+ { "repair": false }
50
60
  ```
51
61
 
52
62
  Also read:
@@ -60,6 +70,8 @@ Extract:
60
70
  - Most recent 20 events (by `events.id` DESC) — "last event" panel
61
71
  - Test passed / failed / stale (compare `git_commit` to HEAD)
62
72
  - Delivery readiness (tag + pushed)
73
+ - Active/blocked/ready change, linked task counts, docs impact, and context freshness
74
+ - Runtime health: open incidents, projection lag/failure, orphan sessions, missing change artifacts
63
75
 
64
76
  ### Phase 2 — Progress report
65
77
 
@@ -68,6 +80,8 @@ Compact multi-section output:
68
80
  - **Tasks**: counts per status + per priority
69
81
  - **Test**: pass/fail, `run_count`, `blocking_issues` if any
70
82
  - **Delivery**: `version` + `pushed` + last tag
83
+ - **Change**: active id/kind/status, docs impact, task completion, context/provider freshness
84
+ - **Runtime**: healthy/degraded with failing doctor checks only
71
85
  - **Risks**: auto-detected list (see Phase 3)
72
86
  - **Next**: recommended next task (see Phase 4)
73
87
 
@@ -81,6 +95,10 @@ Auto-detect:
81
95
  - **Test stale**: `test-report.json.git_commit ≠ HEAD`
82
96
  - **Orphan sessions**: any session with `lease_expires_at < now()` still status=running
83
97
  (uninitialized by orphan-reaper; escalate)
98
+ - **Projection/incident failure**: read-only doctor is degraded → route to
99
+ `/ultra-doctor`; never infer recovery from a generated JSON file
100
+ - **Context stale**: active change manifest head or task set differs from current state
101
+ - **Docs drift**: change has `docs_impact.status=unknown` or declared required file is missing
84
102
 
85
103
  | Icon | Meaning | Action |
86
104
  |------|---------|--------|
@@ -105,12 +123,15 @@ Detect position from artifacts:
105
123
  |-----------|-------|
106
124
  | No `.ultra/` | `/ultra-init` |
107
125
  | Specs have `[NEEDS CLARIFICATION]` or missing | `/ultra-research` |
108
- | No tasks | `/ultra-plan` |
109
- | Any `pending` | `/ultra-dev` (show which) |
110
- | All `completed` | `/ultra-test` |
111
- | `test-report.json.passed === true` | `/ultra-deliver` |
126
+ | No tasks and no delivered baseline | `/ultra-plan` |
127
+ | Doctor degraded because of Ultra runtime state | `/ultra-doctor` |
128
+ | No active/blocked/ready change and fresh delivery exists | `/ultra-change` for the next daily change |
129
+ | Active change has any `pending` linked task | `/ultra-dev` (show which) |
130
+ | Active change linked tasks all `completed` | `/ultra-test` |
131
+ | Matching fresh `test-report.json.passed === true` | `/ultra-deliver` |
112
132
  | `test-report.json.passed === false` | `/ultra-dev` (show blocking issues) |
113
- | `delivery-report.json` exists + fresh | Done; suggest next milestone |
133
+ | Change is `ready` | `/ultra-deliver` to reconcile/archive before release completion |
134
+ | Latest change archived and delivery fresh | Baseline healthy; next work starts with `/ultra-change` |
114
135
 
115
136
  **Safety checks before routing**:
116
137
  - Routing to deliver but `test-report.git_commit ≠ HEAD` → warn "Tests stale"
@@ -143,6 +164,8 @@ session_id (if active), `context_file`, `trace_to`, stale flag, update history.
143
164
  |---------|----------|--------------|
144
165
  | List tasks | `task.list` | none; fail closed |
145
166
  | Single task detail | `task.get` | none; fail closed |
167
+ | Change lane | `change.list` | none; fail closed |
168
+ | Runtime health | `system.doctor { repair:false }` | `ultra-tools system doctor` |
146
169
  | Cost panel (Phase 6.3) | — | `ultra-tools status --cost --json --since 7d` |
147
170
 
148
171
  ## Cost panel (Phase 6.3)
@@ -154,7 +177,7 @@ is the conventional weekly window; override with ISO-8601 for custom ranges.
154
177
 
155
178
  ## What this skill DOES NOT do
156
179
 
157
- - Does NOT modify state
180
+ - Does NOT modify or repair state
158
181
  - Does NOT run tests / build / deploy
159
182
  - Does NOT require all artifacts (partial reports are tolerated)
160
183
 
@@ -162,6 +185,6 @@ is the conventional weekly window; override with ISO-8601 for custom ranges.
162
185
 
163
186
  | | |
164
187
  |---|---|
165
- | **Input** | state.db (via `task.list`/`task.get`), `test-report.json`, `delivery-report.json`, git HEAD |
188
+ | **Input** | state.db via task/change/session/system reads, test/delivery reports, git HEAD |
166
189
  | **Output** | console report (Chinese per project rule) |
167
190
  | **When** | anytime — idempotent read-only |
@@ -4,6 +4,7 @@ description: "Pre-delivery quality audit — Anti-Pattern + Coverage Gap + Wirin
4
4
  runtime: all
5
5
  mcp_tools_required:
6
6
  - task.list
7
+ - change.list
7
8
  ---
8
9
 
9
10
  # ultra-test — Phase 3.5
@@ -31,7 +32,9 @@ returns an authority error, stop the audit. Never fall back to
31
32
 
32
33
  1. Detect project type from config (`package.json` / `Cargo.toml` / `go.mod` / `pyproject.toml` / …)
33
34
  2. `task.list { status: "completed" }` → confirm ≥1 task delivered
34
- 3. Find test files (suffix `.test.*`, `.spec.*`, `test_*.py`, `*_test.go`)
35
+ 3. `change.list` → identify the active/blocked change, if any; filter linked
36
+ tasks locally by `change_id`
37
+ 4. Find test files (suffix `.test.*`, `.spec.*`, `test_*.py`, `*_test.go`)
35
38
 
36
39
  Block with instructive error if any precheck fails.
37
40
 
@@ -144,8 +147,12 @@ If max reached → surface remaining issues; `passed=false`.
144
147
  {
145
148
  "timestamp": "<ISO8601>",
146
149
  "git_commit": "<HEAD>",
150
+ "change_id": "<active-change-id-or-null>",
147
151
  "passed": true,
148
152
  "run_count": 1,
153
+ "commands": [
154
+ { "command": "<exact command>", "exit_code": 0, "scope": "unit/integration/e2e/build" }
155
+ ],
149
156
  "gates": {
150
157
  "anti_pattern": { "passed": true, "critical": 0, "warning": 1 },
151
158
  "coverage_gaps": { "passed": true, "high": 0, "medium": 3, "low": 5 },
@@ -162,6 +169,10 @@ Rules:
162
169
  - File exists → increment `run_count`
163
170
  - `passed = true` iff all gates `.passed === true`
164
171
  - `blocking_issues` lists human-readable strings for any fail
172
+ - `commands` records exact executable evidence; prose such as “tests look good”
173
+ is not convergence evidence
174
+ - when a continuous change is active, `change_id` must match it; never reuse a
175
+ report from another change
165
176
 
166
177
  ### Step 8 — Report
167
178
 
@@ -184,6 +195,7 @@ when `passed=true`.
184
195
  | Purpose | MCP tool | CLI fallback |
185
196
  |---------|----------|--------------|
186
197
  | Confirm ≥1 completed task | `task.list { status: "completed" }` | none; fail closed |
198
+ | Identify active change | `change.list` | none; omit only for initial baseline delivery |
187
199
  | Confirm risky auto-fix | none | current Host's native user-interaction surface |
188
200
 
189
201
  ## What this skill DOES NOT do
@@ -197,5 +209,5 @@ when `passed=true`.
197
209
  | | |
198
210
  |---|---|
199
211
  | **Input** | Source + test files, state.db (read-only) |
200
- | **Output** | `.ultra/test-report.json`, `.ultra/docs/test-coverage-gaps.md` |
212
+ | **Output** | `.ultra/test-report.json` with exact commands/change id, `.ultra/docs/test-coverage-gaps.md` |
201
213
  | **Next** | `/ultra-deliver` (only when `passed=true`) |