ultra-builder-pro-cli 0.7.0 → 0.9.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 (47) hide show
  1. package/CHANGELOG.md +60 -1
  2. package/README.md +49 -23
  3. package/adapters/_shared/codex-assets.cjs +28 -0
  4. package/adapters/_shared/handbook.cjs +9 -1
  5. package/adapters/_shared/path-rewrite.cjs +3 -0
  6. package/adapters/_shared/provenance.cjs +286 -0
  7. package/adapters/_shared/runtime-assets.cjs +2 -1
  8. package/adapters/_shared/tests/handbook.test.cjs +6 -1
  9. package/adapters/_shared/tests/path-rewrite.test.cjs +3 -1
  10. package/adapters/_shared/tests/provenance.test.cjs +133 -0
  11. package/adapters/_shared/tests/runtime-assets.test.cjs +4 -1
  12. package/adapters/claude.js +33 -0
  13. package/adapters/codex.js +87 -0
  14. package/adapters/kimi.js +642 -0
  15. package/adapters/opencode.js +66 -0
  16. package/adapters/tests/codex.test.cjs +37 -0
  17. package/adapters/tests/kimi-hook.test.cjs +122 -0
  18. package/adapters/tests/kimi.test.cjs +255 -0
  19. package/agents/debugger.md +12 -0
  20. package/bin/handbook.js +2 -2
  21. package/bin/install.js +72 -12
  22. package/bin/orchestrator.js +1 -1
  23. package/commands/ultra-change.md +3 -2
  24. package/docs/AGENT-CONTEXT.md +5 -3
  25. package/docs/ARCHITECTURE.md +40 -6
  26. package/docs/PLAN.zh-CN.md +8 -6
  27. package/docs/ROADMAP.md +4 -4
  28. package/docs/RUNTIME-COMPAT-MATRIX.md +109 -58
  29. package/docs/USER-HANDBOOK-CONTRACT.md +4 -1
  30. package/hooks/README.md +6 -2
  31. package/hooks/adapters/kimi.py +162 -0
  32. package/hooks/workflow_checkpoint.py +15 -1
  33. package/hooks/workflow_resume.py +96 -7
  34. package/mcp-server/lib/change-workflow.cjs +69 -0
  35. package/mcp-server/lib/change-workflow.test.cjs +87 -0
  36. package/mcp-server/lib/state-db.cjs +85 -2
  37. package/mcp-server/lib/state-db.test.cjs +56 -0
  38. package/mcp-server/tests/init-project.test.cjs +2 -2
  39. package/mcp-server/tests/state-db.test.cjs +3 -3
  40. package/package.json +4 -2
  41. package/skills/ultra-change/SKILL.md +12 -3
  42. package/skills/ultra-deliver/SKILL.md +3 -1
  43. package/skills/ultra-doctor/SKILL.md +10 -3
  44. package/skills/ultra-review/SKILL.md +3 -3
  45. package/spec/mcp-tools.yaml +5 -5
  46. package/spec/schemas/skill-manifest.schema.json +2 -2
  47. package/spec/schemas/state-db.sql +4 -2
package/bin/install.js CHANGED
@@ -4,18 +4,20 @@
4
4
  * ultra-builder-pro-cli — multi-runtime installer.
5
5
  *
6
6
  * Distributes Ultra Builder Pro assets — commands, agents, skills, hooks,
7
- * MCP server — to Claude Code, OpenCode, and Codex CLI via
7
+ * MCP server — to Claude Code, OpenCode, Codex CLI, and Kimi Code via
8
8
  * runtime-specific adapters under adapters/. Install is idempotent and
9
9
  * uses atomic writes; uninstall reverses via sentinel/manifest blocks.
10
10
  *
11
11
  * Usage:
12
12
  * npx ultra-builder-pro-cli [options]
13
13
  *
14
- * --claude / --opencode / --codex select runtime(s)
14
+ * --claude / --opencode / --codex / --kimi select runtime(s)
15
15
  * --all install to all supported runtimes
16
16
  * -g, --global install to runtime's global config dir
17
17
  * -l, --local install into current working directory
18
18
  * -u, --uninstall remove installed assets
19
+ * -d, --doctor inspect installation provenance without mutation
20
+ * --json emit machine-readable doctor output
19
21
  * -c, --config-dir <path> override config directory
20
22
  * -h, --help show help
21
23
  */
@@ -56,7 +58,7 @@ function printBanner() {
56
58
  paint('cyan', ' ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝╚══════╝╚═╝'),
57
59
  '',
58
60
  ` ${paint('bold', 'Ultra Builder Pro CLI')} ${paint('dim', 'v' + pkg.version)}`,
59
- ` ${paint('dim', 'Multi-runtime installer for Claude Code, OpenCode, and Codex')}`,
61
+ ` ${paint('dim', 'Multi-runtime installer for Claude Code, OpenCode, Codex, and Kimi Code')}`,
60
62
  '',
61
63
  ];
62
64
  console.log(banner.join('\n'));
@@ -69,6 +71,7 @@ function printHelp() {
69
71
  ${paint('cyan', '--claude')} Claude Code
70
72
  ${paint('cyan', '--opencode')} OpenCode
71
73
  ${paint('cyan', '--codex')} Codex CLI (OpenAI)
74
+ ${paint('cyan', '--kimi')} Kimi Code (Moonshot AI)
72
75
  ${paint('cyan', '--all')} all supported runtimes
73
76
 
74
77
  ${paint('yellow', 'Scope:')}
@@ -77,6 +80,8 @@ function printHelp() {
77
80
 
78
81
  ${paint('yellow', 'Other:')}
79
82
  ${paint('cyan', '-u, --uninstall')} remove installed assets
83
+ ${paint('cyan', '-d, --doctor')} verify installed version, provenance, managed assets, and live entry points
84
+ ${paint('cyan', '--json')} emit machine-readable doctor output (doctor only)
80
85
  ${paint('cyan', '-c, --config-dir')} override runtime's config directory (string path)
81
86
  ${paint('cyan', '-h, --help')} show this help
82
87
  ${paint('cyan', '-v, --version')} show CLI version
@@ -90,6 +95,12 @@ function printHelp() {
90
95
 
91
96
  ${paint('dim', '# Uninstall from OpenCode')}
92
97
  npx ultra-builder-pro-cli --opencode --global --uninstall
98
+
99
+ ${paint('dim', '# Install to Kimi Code globally')}
100
+ npx ultra-builder-pro-cli --kimi --global
101
+
102
+ ${paint('dim', '# Verify all host installations without changing them')}
103
+ npx ultra-builder-pro-cli --all --global --doctor
93
104
  `);
94
105
  }
95
106
 
@@ -100,6 +111,8 @@ function parseArgs(argv) {
100
111
  global: false,
101
112
  local: false,
102
113
  uninstall: false,
114
+ doctor: false,
115
+ json: false,
103
116
  help: false,
104
117
  version: false,
105
118
  configDir: null,
@@ -111,12 +124,15 @@ function parseArgs(argv) {
111
124
  case '--claude': runtimes.add('claude'); break;
112
125
  case '--opencode': runtimes.add('opencode'); break;
113
126
  case '--codex': runtimes.add('codex'); break;
127
+ case '--kimi': runtimes.add('kimi'); break;
114
128
  case '--all':
115
129
  SUPPORTED_RUNTIMES.forEach(r => runtimes.add(r));
116
130
  break;
117
131
  case '-g': case '--global': flags.global = true; break;
118
132
  case '-l': case '--local': flags.local = true; break;
119
133
  case '-u': case '--uninstall': flags.uninstall = true; break;
134
+ case '-d': case '--doctor': flags.doctor = true; break;
135
+ case '--json': flags.json = true; break;
120
136
  case '-h': case '--help': flags.help = true; break;
121
137
  case '-v': case '--version': flags.version = true; break;
122
138
  case '-c': case '--config-dir':
@@ -178,30 +194,74 @@ async function main() {
178
194
  return;
179
195
  }
180
196
 
181
- printBanner();
182
-
183
197
  if (flags.help) {
198
+ printBanner();
184
199
  printHelp();
185
200
  return;
186
201
  }
187
202
 
203
+ if (flags.doctor && flags.uninstall) bail('cannot combine --doctor and --uninstall');
204
+ if (flags.json && !flags.doctor) bail('--json is available only with --doctor');
205
+
188
206
  if (runtimes.length === 0) {
189
- bail('no runtime selected; use --claude / --opencode / --codex / --all');
207
+ bail('no runtime selected; use --claude / --opencode / --codex / --kimi / --all');
190
208
  }
191
209
 
192
210
  const scope = resolveScope(flags);
193
211
  const repoRoot = path.resolve(__dirname, '..');
194
212
  const configDir = flags.configDir ? expandTilde(flags.configDir) : null;
195
213
 
196
- const mode = flags.uninstall ? 'uninstall' : 'install';
197
- console.log(` ${paint('bold', 'Mode:')} ${mode}`);
198
- console.log(` ${paint('bold', 'Scope:')} ${scope}`);
199
- console.log(` ${paint('bold', 'Runtimes:')} ${runtimes.join(', ')}`);
200
- if (configDir) console.log(` ${paint('bold', 'ConfigDir:')} ${configDir}`);
201
- console.log();
214
+ if (!flags.json) printBanner();
215
+
216
+ const mode = flags.doctor ? 'doctor' : flags.uninstall ? 'uninstall' : 'install';
217
+ if (!flags.json) {
218
+ console.log(` ${paint('bold', 'Mode:')} ${mode}`);
219
+ console.log(` ${paint('bold', 'Scope:')} ${scope}`);
220
+ console.log(` ${paint('bold', 'Runtimes:')} ${runtimes.join(', ')}`);
221
+ if (configDir) console.log(` ${paint('bold', 'ConfigDir:')} ${configDir}`);
222
+ console.log();
223
+ }
202
224
 
203
225
  const ctx = { repoRoot, scope, configDir, homeDir: os.homedir() };
204
226
 
227
+ if (flags.doctor) {
228
+ const reports = [];
229
+ for (const runtime of runtimes) {
230
+ const adapter = loadAdapter(runtime);
231
+ try {
232
+ if (typeof adapter.doctor !== 'function') throw new Error('adapter does not expose doctor()');
233
+ reports.push(await adapter.doctor(ctx));
234
+ } catch (error) {
235
+ reports.push({
236
+ adapter: runtime,
237
+ status: 'degraded',
238
+ manifest_path: null,
239
+ checks: {},
240
+ issues: [{ code: 'DOCTOR_FAILED', message: error.message }],
241
+ });
242
+ }
243
+ }
244
+ const output = {
245
+ status: reports.every((report) => report.status === 'healthy') ? 'healthy' : 'degraded',
246
+ reports,
247
+ };
248
+ if (flags.json) {
249
+ process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
250
+ } else {
251
+ for (const report of reports) {
252
+ const color = report.status === 'healthy' ? 'green' : 'red';
253
+ console.log(` ${paint(color, report.status === 'healthy' ? '✓' : '✗')} ${report.adapter}: ${report.status}`);
254
+ for (const finding of report.issues || []) {
255
+ const location = finding.path ? ` (${finding.path})` : '';
256
+ console.log(` ${finding.code}${location}`);
257
+ }
258
+ }
259
+ console.log();
260
+ }
261
+ if (output.status !== 'healthy') process.exitCode = 2;
262
+ return;
263
+ }
264
+
205
265
  let failed = 0;
206
266
  for (const runtime of runtimes) {
207
267
  const adapter = loadAdapter(runtime);
@@ -47,7 +47,7 @@ function optInAllowed(settings) {
47
47
  }
48
48
 
49
49
  function parseRuntimes() {
50
- const raw = process.env.UBP_ORCH_RUNTIMES || 'claude,opencode,codex';
50
+ const raw = process.env.UBP_ORCH_RUNTIMES || 'claude,opencode,codex,kimi';
51
51
  const runtimes = [...new Set(raw.split(',').map((s) => s.trim()).filter(Boolean))];
52
52
  const invalid = runtimes.filter((runtime) => !isSupportedRuntime(runtime));
53
53
  if (invalid.length > 0) {
@@ -28,8 +28,9 @@ mcp_tools_required:
28
28
  1. 先查 active/blocked change,匹配则恢复,避免重复创建。
29
29
  2. 按 `quick / standard / major / incident` 分类并声明 docs impact。
30
30
  3. 调 `change.create`,为 change 创建至少一个带 `change_id` 的 task。
31
- 4. standard/major 写 delta + plan;调 `change.context` 编译最小上下文。
32
- 5. 路由到 `/ultra-dev`、`/ultra-test`、`/ultra-review`、`/ultra-deliver`。
31
+ 4. standard/major 写 delta + plan;incident 完成结构化 `diagnosis.md`。
32
+ 5. 调 `change.context` 编译最小上下文;incident 先走 debugger 诊断切片。
33
+ 6. 路由到 `/ultra-dev`、`/ultra-test`、`/ultra-review`、`/ultra-deliver`。
33
34
 
34
35
  Memory 与代码图谱只允许以外部 provider 元数据引用出现;本命令不保存 provider
35
36
  正文,也不自动刷新外部 provider。
@@ -1,7 +1,7 @@
1
1
  # Ultra Builder Pro — Agent Context
2
2
 
3
- Current shared runtime contract for the native Claude Code, OpenCode, and Codex
4
- plugins.
3
+ Current shared runtime contract for the native Claude Code, OpenCode, Codex,
4
+ and Kimi Code plugins.
5
5
 
6
6
  ## 1. Ownership boundary
7
7
 
@@ -12,7 +12,8 @@ Ultra Builder Pro owns only:
12
12
  `ultra-think`, plus the daily `ultra-change` and diagnostic `ultra-doctor`;
13
13
  - four internal agent-only rule skills: `code-review-expert`, `security-rules`,
14
14
  `integration-rules`, and `testing-rules`;
15
- - the host-specific collaboration companions and `ultra-verify`;
15
+ - the host-specific collaboration companions, `ultra-verify`, and the minimal
16
+ Kimi session bootstrap required to establish the shared runtime boundary;
16
17
  - bounded review/debug agents, workflow-only hooks, MCP task state, and the
17
18
  portable CLI/orchestrator.
18
19
 
@@ -68,6 +69,7 @@ fixtures. Do not add an ad-hoc server handler first.
68
69
  | Claude Code | `.claude-plugin/plugin.json`, native commands/skills/agents, `.mcp.json` | `/ultra-*`, `/learn` | native `hooks/hooks.json` | `codex-collab`, `ultra-verify` |
69
70
  | Codex | personal plugin with `.codex-plugin/plugin.json`, namespaced skills, TOML agents, `.mcp.json` | `$ultra-builder-pro:ultra-*`, `$ultra-builder-pro:learn` | native `hooks/hooks.json` through the Codex wire adapter | `cc-collab`, `ultra-verify` |
70
71
  | OpenCode | config bundle plus native JavaScript plugin | `/ultra-*`, `/learn` | `event`, system transform, compaction, and tool lifecycle handlers | `cc-collab`, `codex-collab`, `ultra-verify` |
72
+ | Kimi Code 0.26+ | managed `kimi.plugin.json` plugin with commands, skills, hooks, and MCP | `/ultra-builder-pro:ultra-*`, `/ultra-builder-pro:learn` | native hooks through the Kimi wire adapter | `cc-collab`, `codex-collab`, `ultra-verify` |
71
73
 
72
74
  The current host remains primary. Collaboration skills call another runtime
73
75
  only when explicitly requested, use it as a read-only advisor, and return the
@@ -10,7 +10,7 @@
10
10
 
11
11
  `ultra-builder-pro-cli` is a multi-runtime plugin suite that **distributes** the
12
12
  Ultra Builder Pro engineering loop (skills + commands + workflow hooks) as
13
- native Claude Code, OpenCode, and Codex plugins, and
13
+ native Claude Code, OpenCode, Codex, and Kimi Code plugins, and
14
14
  **runs** that loop with isolated sessions sharing one authoritative state
15
15
  store (`.ultra/state.db`).
16
16
 
@@ -23,7 +23,7 @@ the supported hosts share.
23
23
  ┌──────────────────────────┐
24
24
  │ runtime CLI │
25
25
  │ (claude / opencode / │
26
- │ codex) │
26
+ │ codex / kimi) │
27
27
  └────────────┬─────────────┘
28
28
  │
29
29
  ┌───────────────────┼────────────────────┐
@@ -141,6 +141,14 @@ but all require completed linked tasks, current context, declared documentation
141
141
  impact, and no open incident. Memory and graph payloads never enter Ultra;
142
142
  `context_snapshots.provider_refs_json` stores metadata references only.
143
143
 
144
+ `incident` is the canonical debug lane. Creating one also registers a durable
145
+ `diagnosis.md` artifact with five mandatory sections: reproduction, hypotheses,
146
+ root cause, regression test, and recovery. Convergence validates the artifact
147
+ structure and refreshes its content hash, so a debugger result that exists only
148
+ in chat cannot satisfy delivery. A host-native debugger may produce the bounded
149
+ analysis, but the primary agent owns the artifact, linked task, regression
150
+ evidence, and final convergence decision.
151
+
144
152
  Mutating MCP calls enqueue durable `projection_jobs`. Success is exposed in MCP
145
153
  response metadata; failure becomes a retryable structured incident instead of a
146
154
  swallowed warning. `system.doctor` is read-only by default and performs only
@@ -148,7 +156,7 @@ backup-first mechanical recovery when explicitly requested.
148
156
 
149
157
  ## 5. Sessions — the execution unit
150
158
 
151
- A **session** is the standard unit of execution across all three runtimes
159
+ A **session** is the standard unit of execution across all four runtimes
152
160
  (D20). One session =
153
161
 
154
162
  - a fresh OS process for the runtime,
@@ -168,7 +176,33 @@ This admission gate is the smallest piece that prevents two agents from
168
176
  silently double-writing the same task — it is part of the v0.1 minimum
169
177
  execution layer, not deferred to Phase 5.
170
178
 
171
- ## 6. Two timelines — rule layer vs execution layer
179
+ ## 6. Compaction recovery — checkpoint as a validated consumer
180
+
181
+ `workflow_checkpoint.py` validates the current non-terminal workflow and writes
182
+ a schema-versioned checkpoint atomically before compaction. On resume,
183
+ `workflow_resume.py` reads both the live workflow and checkpoint defensively,
184
+ rejects corrupt, non-object, schema-mismatched, or terminal candidates, and
185
+ selects the newest valid state. A newer live state wins; a newer checkpoint can
186
+ atomically restore a missing or older live state before context is re-injected.
187
+ The checkpoint is therefore a recovery artifact and consumer, never a second
188
+ durable authority alongside `.ultra/state.db`.
189
+
190
+ ## 7. Installation provenance — read-only cross-host diagnosis
191
+
192
+ Every Claude Code, OpenCode, Codex, and Kimi Code adapter writes a normalized
193
+ `provenance.json` for the assets it owns. The manifest records adapter/package
194
+ identity, source metadata, per-file SHA-256 hashes, an aggregate digest, and the
195
+ host-specific plugin, MCP, hook, launcher, and runtime contracts expected at
196
+ that install scope. It never attributes a package to an enclosing consumer
197
+ repository commit.
198
+
199
+ `ubp --doctor [--json]` is read-only: it recomputes hashes and validates those
200
+ entry points, returning a non-zero degraded result for missing/corrupt
201
+ provenance, content drift, or broken host wiring. This is separate from
202
+ `system.doctor`, which diagnoses project state, projection, incidents, sessions,
203
+ and backup-first workflow recovery.
204
+
205
+ ## 8. Two timelines — rule layer vs execution layer
172
206
 
173
207
  The roadmap separates two concerns that compete for the same surface
174
208
  area (D13):
@@ -196,7 +230,7 @@ value from "skills + tasks survive across sessions" long before they get
196
230
  value from "ten agents in parallel." Each milestone is independently
197
231
  shippable; downstream slip never blocks an earlier release.
198
232
 
199
- ## 7. Where to look next
233
+ ## 9. Where to look next
200
234
 
201
235
  | Question | File |
202
236
  |----------------------------------------------------|-----------------------------------------------------|
@@ -206,7 +240,7 @@ shippable; downstream slip never blocks an earlier release.
206
240
  | What does a tasks.json look like after projection? | [`spec/fixtures/valid/tasks.v4.5.json`](../spec/fixtures/valid/tasks.v4.5.json) |
207
241
  | Phase-by-phase work breakdown + decision log | [`docs/PLAN.zh-CN.md`](./PLAN.zh-CN.md) |
208
242
 
209
- ## 8. Verifying the architecture
243
+ ## 10. Verifying the architecture
210
244
 
211
245
  Every contract on this page is enforced by `npm run test:spec`:
212
246
 
@@ -1,17 +1,18 @@
1
1
  # ultra-builder-pro-cli — 历史执行计划与决策日志
2
2
 
3
- > **2026-07-17 当前生效边界(D50-D52,覆盖下文旧 Phase 6/7 的内置图谱、memory 与 runtime 设计)**:
3
+ > **2026-07-17 当前生效边界(D50-D53,覆盖下文旧 Phase 6/7 的内置图谱、memory 与 runtime 设计)**:
4
4
  > Ultra Builder Pro 不再拥有 `memory.*`、recall、prompt/transcript/observation/summary
5
5
  > 收集 hook 或私有 agent memory。跨会话记忆全部交给独立安装的 cloud-mem/claude-mem。
6
6
  > 插件只保留 12 个 Ultra 公共 workflow(新增 daily `ultra-change` 与诊断
7
7
  > `ultra-doctor`)、4 个 agent-only 规则 skill、宿主专属 collab companion、
8
8
  > workflow/change hook 与 `.ultra/state.db` 权威。Memory 和代码图谱内容全部由外部
9
- > provider 所有,Ultra 只保存 provider 元数据引用。Claude Code、Codex、OpenCode
10
- > 采用各自 native plugin 呈现,其他旧 runtime adapter 已退役。下文所有与此冲突的
9
+ > provider 所有,Ultra 只保存 provider 元数据引用。Claude Code、Codex、OpenCode、
10
+ > Kimi Code 采用各自 native plugin 呈现,其他旧 runtime adapter 已退役。下文所有与此冲突的
11
11
  > memory/hindsight 章节仅作为历史实施记录,不再是当前需求或运行时契约。
12
12
 
13
- **当前状态**:v0.7.0 发布候选;三宿主 native plugin、29 个 live MCP tool、
14
- schema 9.0(15 表)、持续 change/context/convergence/doctor 已落地;npm 发布由
13
+ **当前状态**:v0.9.0;四宿主 native plugin、29 个 live MCP tool、
14
+ schema 9.1(15 表)、持续 change/context/convergence/doctor、incident debug lane、
15
+ checkpoint 恢复消费与跨宿主安装 provenance/doctor 已落地;npm 发布由
15
16
  `v*.*.*` tag 触发。以下 Phase 0-9 正文保留为 2026-04 的实施历史,不再作为
16
17
  当前 runtime 或发布状态的事实来源。
17
18
  **历史版本**:0.3.1-plan · 2026-04-17 Codex 第二轮评审收尾
@@ -27,7 +28,7 @@ schema 9.0(15 表)、持续 change/context/convergence/doctor 已落地;np
27
28
  - **Phase 4.6 拆 a/b**(R6 + D35):v0.1 只跑 smoke flow,full conformance 推 v0.2
28
29
  - **Codex 第二轮结论**:"小改后开工"(tl;dr);本版已完成小改
29
30
 
30
- **总决策数**:D1-D52(当前边界以 D50-D52 为准)
31
+ **总决策数**:D1-D53(当前边界以 D50-D53 为准)
31
32
  **总风险数**:R1-R32(v0.3.1 新增 R25-R32 共 8 条)
32
33
 
33
34
  ---
@@ -1639,6 +1640,7 @@ Week 18 buffer(ship 中任何 Phase 的 25% 滑动吃掉)
1639
1640
  | **D50** | **2026-07-15** | **重划插件与记忆边界**:Claude Code、Codex、OpenCode 改为各自 native plugin;只打包 10 个 Ultra 公共 workflow、4 个 agent-only 规则 skill 与宿主专属 collab companion;删除 6 个外部 skill、recall、Impeccable 残留、Ultra memory MCP/store/wrapper/capture hooks;持久记忆由独立 cloud-mem/claude-mem 负责;用户 handbook 通过可预览、可备份的 managed block 显式同步 | 用户确认最终方案;运行时 allowlist、conformance、hook 与 handbook 回归测试共同锁定边界 |
1640
1641
  | **D51** | **2026-07-17** | **runtime 收敛为 Claude Code、OpenCode、Codex**:删除第四 runtime 的 adapter、安装参数、collab skill、prompt、schema、pricing、调度与测试面;`ultra-verify` 改为当前宿主主责加单一只读外部顾问 | 用户确认不再需要第四 runtime;0.6.0 退役契约阻止其重新进入活跃源码或发布包 |
1641
1642
  | **D52** | **2026-07-17** | **初始交付后进入持续变更闭环**:新增 `ultra-change` / `ultra-doctor`、change/context/artifact/trace/incident/projection/consumer 状态、delta-first spec、确定性 convergence 与 baseline reconciliation;删除内置 code-graph watcher 和通用命令代理,Memory/图谱只保留外部 provider 元数据引用 | 用户确认采用最佳组合落地;解决日常小改导致 spec/context 漂移、投影失败静默和异常无恢复证据的问题 |
1643
+ | **D53** | **2026-07-17** | **Harness 缺口一次性闭环**:`incident` 成为带五段 `diagnosis.md` 结构门禁的 canonical debug lane;compact checkpoint 由 resume 消费、校验、择新并原子恢复;三宿主安装写 normalized provenance,`ubp --doctor` 只读校验 asset hash 与 plugin/hook/MCP/runtime contract | 将 GSD 的 debug/fresh context、GStack 的 checkpoint/readiness 与 ECC 的 doctor/provenance 思路收敛为 Ultra 自有契约;Memory 与图谱继续由外部 provider 所有,且不恢复任何已退役 surface |
1642
1644
 
1643
1645
  ---
1644
1646
 
package/docs/ROADMAP.md CHANGED
@@ -6,14 +6,14 @@
6
6
  > when historical plan text differs.
7
7
 
8
8
  **Goal**: distribute the Ultra Builder Pro engineering loop as native Claude
9
- Code, OpenCode, and Codex plugins, and run it with isolated sessions sharing one
10
- authoritative workflow store.
9
+ Code, OpenCode, Codex, and Kimi Code plugins, and run it with isolated sessions
10
+ sharing one authoritative workflow store.
11
11
 
12
- **First-class runtimes**: Claude Code · OpenCode · Codex.
12
+ **First-class runtimes**: Claude Code · OpenCode · Codex · Kimi Code.
13
13
 
14
14
  **Distribution channels (v1.0)**: npm · Homebrew · pip.
15
15
 
16
- **Release line**: `0.7.x`; every release is gated by `npm run verify:release`.
16
+ **Release line**: `0.9.x`; every release is gated by `npm run verify:release`.
17
17
 
18
18
  ---
19
19
 
@@ -1,99 +1,150 @@
1
1
  # Runtime Compatibility Matrix
2
2
 
3
- Current presentation contract for Ultra Builder Pro. Claude Code, OpenCode, and
4
- Codex are the supported native plugin hosts. The canonical asset boundary lives
5
- in `adapters/_shared/runtime-assets.cjs`.
3
+ Current presentation contract for Ultra Builder Pro. Claude Code, OpenCode,
4
+ Codex, and Kimi Code 0.26+ are supported native plugin hosts. The canonical
5
+ asset boundary lives in `adapters/_shared/runtime-assets.cjs`.
6
6
 
7
- Legend: **FULL** = native host surface, **DEGRADED** = supported but missing an
8
- equivalent lifecycle/control surface, **N/A** = intentionally not installed.
7
+ Legend: **FULL** = native host surface, **FUNCTIONAL** = the complete outcome is
8
+ available through a different native host primitive, **DEGRADED** = supported
9
+ but missing an equivalent lifecycle/control surface, **N/A** = intentionally
10
+ not installed.
9
11
 
10
12
  ## 1. Plugin and workflow surface
11
13
 
12
- | Capability | Claude Code | OpenCode | Codex |
13
- |---|---|---|---|
14
- | Package form | `.claude-plugin` native plugin | native config bundle + JS plugin | personal `.codex-plugin` |
15
- | Public entry | `/ultra-*`, `/learn` | `/ultra-*`, `/learn` | `$ultra-builder-pro:<skill>` |
16
- | Public Ultra workflows | 12 | 12 | 12 |
17
- | Internal agent-rule skills | 4, non-user-facing | 4, non-user-facing | 4 with implicit invocation disabled |
18
- | Collaboration companions | `codex-collab`, `ultra-verify` | `cc-collab`, `codex-collab`, `ultra-verify` | `cc-collab`, `ultra-verify` |
19
- | External browser/deploy/framework skills | N/A | N/A | N/A |
20
-
21
- Codex converts the workflows into namespaced skills and records eleven legacy
14
+ | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
15
+ |---|---|---|---|---|
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 | 12 | 12 | 12 |
19
+ | Internal agent-rule skills | 4, non-user-facing | 4, non-user-facing | 4 with implicit invocation disabled | 4, consumed by review workers |
20
+ | Collaboration companions | `codex-collab`, `ultra-verify` | `cc-collab`, `codex-collab`, `ultra-verify` | `cc-collab`, `ultra-verify` | `cc-collab`, `codex-collab`, `ultra-verify` |
21
+ | Host bootstrap | native plugin context | native plugin context | native plugin context | `using-ultra-builder-pro` session-start skill |
22
+ | External browser/deploy/framework skills | N/A | N/A | N/A | N/A |
23
+
24
+ Codex converts workflows into namespaced skills and records eleven legacy
22
25
  command mappings in `command-map.json`; `ultra-review` remains directly
23
- invocable as a skill.
26
+ invocable as a skill. Kimi registers all twelve commands through its native
27
+ plugin command directory and exposes the allowlisted skills independently.
24
28
 
25
29
  ## 2. Agents and collaboration
26
30
 
27
- | Capability | Claude Code | OpenCode | Codex |
28
- |---|---|---|---|
29
- | Bundled review/debug agents | FULL, native Markdown agents | FULL, native agent frontmatter | FULL, nine managed TOML custom agents |
30
- | Native bounded delegation | native agent surface | native agent surface | native Codex subagents |
31
- | Cross-host advisor | explicit and read-only | explicit and read-only | explicit and read-only |
32
- | Primary-agent ownership | FULL | FULL | FULL |
31
+ | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
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` |
34
+ | Plugin custom-agent registration | FULL | FULL | FULL | N/A; the 0.26 manifest has no custom-agent field |
35
+ | Native bounded delegation | native agent surface | native agent surface | native Codex subagents | native `Agent` / `AgentSwarm` |
36
+ | Cross-host advisor | explicit and read-only | explicit and read-only | explicit and read-only | explicit and read-only |
37
+ | Primary-agent ownership | FULL | FULL | FULL | FULL |
33
38
 
34
- No bundled agent owns private persistent memory. It receives current-checkout
39
+ No bundled worker owns private persistent memory. It receives current-checkout
35
40
  evidence and bounded context from the primary host, then returns a result for
36
- primary verification.
41
+ primary verification. On Kimi, the review workflow reads the bundled worker
42
+ template before creating the corresponding `AgentSwarm` item; the templates are
43
+ not presented as nonexistent custom agents.
37
44
 
38
45
  ## 3. Workflow hooks
39
46
 
40
- | Lifecycle | Claude Code | OpenCode | Codex |
41
- |---|---|---|---|
42
- | Session context/health | FULL, native `SessionStart` | DEGRADED, native context; health via `system.doctor` | FULL, native `SessionStart` |
43
- | Active edit boundary | FULL, `PreToolUse Edit|Write` | FULL, `tool.execute.before` rejects projection writes | FULL, `PreToolUse Edit|Write|apply_patch` |
44
- | Compaction recovery | FULL, `PreCompact` + resume matcher | FULL, native compacting context | FULL, `PreCompact` + `PostCompact` |
45
- | Incomplete-stop gate | FULL, native blocking `Stop` | DEGRADED, no equivalent blocking stop hook | FULL, native blocking `Stop` |
46
- | Subagent lifecycle evidence | FULL | DEGRADED, no equivalent packaged event | FULL |
47
+ | Lifecycle | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
48
+ |---|---|---|---|---|
49
+ | Session context/health | FULL, native `SessionStart` | DEGRADED, native context; health via `system.doctor` | FULL, native `SessionStart` | FULL, session-start skill + `SessionStart` 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 |
51
+ | Pre-compact checkpoint | FULL | FULL | FULL | FULL, native `PreCompact` |
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
+ | Incomplete-stop gate | FULL, native blocking `Stop` | DEGRADED, no equivalent blocking stop hook | FULL, native blocking `Stop` | FULL, native structured deny |
54
+ | Subagent lifecycle evidence | FULL | DEGRADED, no equivalent packaged event | FULL | FULL, native `SubagentStart` / `SubagentStop` |
55
+
56
+ Kimi's session bootstrap therefore also instructs recovery to inspect
57
+ `.ultra/runtime/checkpoint.json` and call Ultra status/doctor after compaction.
58
+ This keeps durable recovery intact without claiming dynamic context injection
59
+ that the host does not guarantee.
47
60
 
48
61
  Health/context hooks inspect initialized projects; projection protection also
49
- applies at baseline, while compact/stop/subagent enforcement remains active-workflow scoped.
50
- No host receives prompt capture, transcript
51
- capture, observation journaling, session-summary memory, generic command
52
- blocking, or generic post-edit policy.
62
+ applies at baseline, while compact/stop/subagent enforcement remains
63
+ active-workflow scoped. No host receives prompt capture, transcript capture,
64
+ observation journaling, session-summary memory, generic command blocking, or
65
+ generic post-edit policy.
53
66
 
54
67
  ## 4. MCP and state
55
68
 
56
- | Capability | Claude Code | OpenCode | Codex |
57
- |---|---|---|---|
58
- | stdio MCP registration | plugin `.mcp.json` | `opencode.json` local MCP entry | plugin `.mcp.json` |
59
- | Live/declared contracts | 29 | 29 | 29 |
60
- | Host-native review/discovery/ask | native | native | documented in `codex-capability-map.json` |
61
- | Durable authority | project `.ultra/state.db` | project `.ultra/state.db` | project `.ultra/state.db` |
62
- | Ultra memory API | N/A | N/A | N/A |
69
+ | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
70
+ |---|---|---|---|---|
71
+ | stdio MCP registration | plugin `.mcp.json` | `opencode.json` local MCP entry | plugin `.mcp.json` | plugin `mcpServers` entry |
72
+ | Live/declared contracts | 29 | 29 | 29 | 29 |
73
+ | Host-native review/discovery/ask | native | native | documented in `codex-capability-map.json` | native Kimi tools and workers |
74
+ | Durable authority | project `.ultra/state.db` | project `.ultra/state.db` | project `.ultra/state.db` | project `.ultra/state.db` |
75
+ | Ultra memory API | N/A | N/A | N/A | N/A |
63
76
 
64
77
  All 29 `task.*`, `session.*`, `change.*`, `system.*`, and `plan.*` operations
65
78
  registered by `mcp-server/server.cjs` are live. Review, impact discovery, skill
66
79
  loading, and user interaction remain host-native surfaces.
67
80
 
81
+ Kimi starts plugin MCP processes with the managed plugin root as `cwd`. The
82
+ generated launcher recovers the project from the inherited `PWD`, sets
83
+ `UBP_ROOT_DIR` and `UBP_DB_PATH`, and refuses to start if that project boundary
84
+ cannot be established. On POSIX it intentionally uses `env node` because Kimi
85
+ 0.26/0.27's embedded Node ABI differs from the ABI used to install `better-sqlite3`.
86
+
68
87
  ## 5. User handbook presentation
69
88
 
70
- | Capability | Claude Code | OpenCode | Codex |
71
- |---|---|---|---|
72
- | Durable user file | `~/.claude/CLAUDE.md` | `~/.config/opencode/AGENTS.md` | `~/.codex/AGENTS.md` |
73
- | Automatic overwrite by plugin install | no | no | no |
74
- | Explicit managed-block sync | `ubp-handbook --runtime claude` | `ubp-handbook --runtime opencode` | `ubp-handbook --runtime codex` |
75
- | Backup before change | FULL | FULL | FULL |
89
+ | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
90
+ |---|---|---|---|---|
91
+ | Durable user file | `~/.claude/CLAUDE.md` | `~/.config/opencode/AGENTS.md` | `~/.codex/AGENTS.md` | `~/.kimi-code/AGENTS.md` |
92
+ | Automatic overwrite by plugin install | no | no | no | no |
93
+ | Explicit managed-block sync | `ubp-handbook --runtime claude` | `ubp-handbook --runtime opencode` | `ubp-handbook --runtime codex` | `ubp-handbook --runtime kimi` |
94
+ | Backup before change | FULL | FULL | FULL | FULL |
76
95
 
77
- ## 6. Install, update, and uninstall
96
+ The Kimi plugin installer does not edit `~/.kimi-code/config.toml`. Handbook
97
+ sync remains a separate, previewable action so user policy and plugin mechanics
98
+ do not become one irreversible mutation.
78
99
 
79
- | Capability | Claude Code | OpenCode | Codex |
80
- |---|---|---|---|
81
- | Adapter install | FULL | FULL | FULL |
82
- | Native update | next host session | host restart | cachebuster + `codex plugin add`, then new task |
83
- | Removes stale managed assets | FULL | FULL | FULL |
84
- | Preserves unrelated config | FULL | FULL | FULL |
85
- | Uninstall ownership guard | managed plugin root | sentinels + owned MCP entry | managed root/manifest/agent headers |
100
+ ## 6. Install, update, and uninstall
86
101
 
87
- ## 7. Verification sources
102
+ | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
103
+ |---|---|---|---|---|
104
+ | Adapter install | FULL | FULL | FULL | FULL |
105
+ | Global install command | `ubp --claude --global` | `ubp --opencode --global` | `ubp --codex --global` | `ubp --kimi --global` |
106
+ | Native update visibility | next host session | host restart | cachebuster + new task | `/reload` or new session |
107
+ | Removes stale managed assets | FULL | FULL | FULL | FULL |
108
+ | Preserves unrelated config | FULL | FULL | FULL | FULL, including `config.toml` and unrelated registry records |
109
+ | Uninstall ownership guard | managed plugin root | sentinels + owned MCP entry | managed root/manifest/agent headers | managed root + exact registry record |
110
+ | Normalized install provenance | FULL | FULL | FULL | FULL |
111
+ | Read-only `ubp --doctor` | FULL | FULL | FULL | FULL |
112
+ | Asset-content and host-contract drift detection | FULL | FULL | FULL | FULL |
113
+
114
+ Kimi's global managed root is
115
+ `~/.kimi-code/plugins/managed/ultra-builder-pro`; its only registry mutation is
116
+ the owned `ultra-builder-pro` entry in `~/.kimi-code/plugins/installed.json`.
117
+ Reinstall preserves the user's enabled/capability choices and unrelated plugin
118
+ records. Uninstall refuses an unmanaged or conflicting root.
119
+
120
+ ## 7. Durable schema compatibility
121
+
122
+ | Capability | Contract |
123
+ |---|---|
124
+ | Current state schema | `9.1` |
125
+ | Runtime values | `claude`, `opencode`, `codex`, `kimi` |
126
+ | Upgrade from pre-Kimi schema | transactionally rebuilds only constrained `events` and `sessions` tables |
127
+ | Preservation gate | rows, IDs, indexes, foreign keys, telemetry, incidents, and migration history remain intact |
128
+ | Failure behavior | rollback; no partially upgraded authority database |
129
+
130
+ ## 8. Verification sources
88
131
 
89
132
  - `adapters/tests/*.test.cjs` verifies each installer and native manifest.
90
133
  - `tests/conformance/<runtime>/*.test.cjs` verifies command/skill, hook, MCP,
91
- idempotency, and smoke presentation.
134
+ idempotency, and smoke presentation for all four hosts.
135
+ - `tests/conformance/kimi/smoke.test.cjs` reproduces Kimi's plugin-root MCP
136
+ `cwd` and proves that the first state write lands in the active project.
92
137
  - `adapters/_shared/tests/runtime-assets.test.cjs` prevents retired or external
93
138
  skills and generic/memory hooks from re-entering a package.
94
139
  - `tests/retired-runtime.test.cjs` prevents retired runtime code or prompt text
95
140
  from re-entering active product surfaces.
96
141
  - `adapters/_shared/tests/handbook.test.cjs` verifies host rendering, backup,
97
142
  migration, and idempotency.
143
+ - `adapters/_shared/tests/provenance.test.cjs` verifies normalized manifests,
144
+ content hashes, source attribution, corruption handling, and contract drift.
145
+ - `tests/install.test.cjs` verifies healthy four-host doctor output and
146
+ host-specific hook/MCP degradation after controlled tampering.
147
+ - `tests/package-smoke.test.cjs` installs the packed tarball into a clean
148
+ consumer and executes a live MCP round trip through every generated launcher.
98
149
 
99
150
  Any capability claim elsewhere must match current adapter code and these tests.
@@ -15,8 +15,9 @@ syntax:
15
15
  | Claude Code | `~/.claude/CLAUDE.md` | `/ultra-plan` |
16
16
  | Codex | `~/.codex/AGENTS.md` | `$ultra-builder-pro:ultra-plan` |
17
17
  | OpenCode | `~/.config/opencode/AGENTS.md` | `/ultra-plan` |
18
+ | Kimi Code | `~/.kimi-code/AGENTS.md` | `/ultra-builder-pro:ultra-plan` |
18
19
 
19
- The renderer never copies Claude Code-only APIs into Codex or OpenCode. Each
20
+ The renderer never copies Claude Code-only APIs into Codex, OpenCode, or Kimi. Each
20
21
  host receives only its native invocation and collaboration names.
21
22
 
22
23
  ## Managed-block contract
@@ -42,6 +43,7 @@ Preview the full merged result before applying:
42
43
  ubp-handbook preview --runtime claude
43
44
  ubp-handbook preview --runtime codex
44
45
  ubp-handbook preview --runtime opencode
46
+ ubp-handbook preview --runtime kimi
45
47
  ```
46
48
 
47
49
  Apply when the preview is correct:
@@ -50,6 +52,7 @@ Apply when the preview is correct:
50
52
  ubp-handbook apply --runtime claude
51
53
  ubp-handbook apply --runtime codex
52
54
  ubp-handbook apply --runtime opencode
55
+ ubp-handbook apply --runtime kimi
53
56
  ```
54
57
 
55
58
  An existing target is copied to
package/hooks/README.md CHANGED
@@ -9,8 +9,8 @@ bounded to the relevant Ultra projection or a non-terminal workflow.
9
9
  | Session start | `health_check.py` | Read-only integrity, incident, projection, session, and change-artifact checks |
10
10
  | Session start | `workflow_context.py` | Inject baseline/active workflow/change context and filtered provider metadata references |
11
11
  | Before edit | `active_task_context.py` | Protect `tasks.json` projection and restate an active task boundary |
12
- | Before compact | `workflow_checkpoint.py` | Atomically save a minimal workflow checkpoint |
13
- | After compact/resume | `workflow_resume.py` | Re-inject the current workflow boundary |
12
+ | Before compact | `workflow_checkpoint.py` | Validate and atomically save a minimal workflow checkpoint |
13
+ | After compact/resume | `workflow_resume.py` | Select the newest valid live/checkpoint state, restore it atomically when needed, and re-inject the boundary |
14
14
  | Stop | `pre_stop_check.py` | Block once when the Ultra workflow is incomplete |
15
15
  | Subagent lifecycle | `subagent_tracker.py` | Append lifecycle evidence under `.ultra/runtime/` |
16
16
 
@@ -18,6 +18,10 @@ The plugin deliberately does not capture prompts, tool observations, transcripts
18
18
  cross-session memory or code-graph content. Generic command blocking and post-edit policy are
19
19
  user/repository governance. Persistent Memory/graph content belongs to separately installed providers.
20
20
 
21
+ The checkpoint is a recovery artifact, not a second authority. A valid newer
22
+ live workflow wins; a newer valid checkpoint may restore a missing or older
23
+ live file; corrupt, non-object, or terminal checkpoints are ignored.
24
+
21
25
  Runtime wiring:
22
26
 
23
27
  - Claude Code: native `hooks/hooks.json` with `${CLAUDE_PLUGIN_ROOT}` paths.