ultra-builder-pro-cli 0.8.1 → 0.10.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 (61) hide show
  1. package/CHANGELOG.md +79 -1
  2. package/README.md +45 -26
  3. package/adapters/_shared/codex-assets.cjs +38 -0
  4. package/adapters/_shared/handbook.cjs +10 -1
  5. package/adapters/_shared/path-rewrite.cjs +3 -0
  6. package/adapters/_shared/runtime-assets.cjs +3 -1
  7. package/adapters/_shared/tests/handbook.test.cjs +9 -1
  8. package/adapters/_shared/tests/path-rewrite.test.cjs +3 -1
  9. package/adapters/_shared/tests/runtime-assets.test.cjs +5 -1
  10. package/adapters/kimi.js +642 -0
  11. package/adapters/opencode.js +46 -17
  12. package/adapters/tests/claude.test.cjs +4 -1
  13. package/adapters/tests/codex.test.cjs +4 -3
  14. package/adapters/tests/kimi-hook.test.cjs +122 -0
  15. package/adapters/tests/kimi.test.cjs +259 -0
  16. package/adapters/tests/opencode.test.cjs +46 -3
  17. package/bin/handbook.js +2 -2
  18. package/bin/install.js +9 -4
  19. package/bin/orchestrator.js +1 -1
  20. package/docs/AGENT-CONTEXT.md +39 -15
  21. package/docs/ARCHITECTURE.md +35 -9
  22. package/docs/PLAN.zh-CN.md +5 -4
  23. package/docs/ROADMAP.md +8 -7
  24. package/docs/RUNTIME-COMPAT-MATRIX.md +110 -64
  25. package/docs/USER-HANDBOOK-CONTRACT.md +13 -3
  26. package/hooks/README.md +6 -4
  27. package/hooks/active_task_context.py +14 -0
  28. package/hooks/adapters/kimi.py +162 -0
  29. package/hooks/context_spine.py +218 -0
  30. package/hooks/health_check.py +1 -1
  31. package/hooks/workflow_context.py +16 -123
  32. package/hooks/workflow_resume.py +21 -0
  33. package/mcp-server/lib/change-workflow.cjs +89 -11
  34. package/mcp-server/lib/change-workflow.test.cjs +202 -7
  35. package/mcp-server/lib/context-spine.cjs +331 -0
  36. package/mcp-server/lib/context-spine.test.cjs +73 -0
  37. package/mcp-server/lib/spec-learning.cjs +191 -0
  38. package/mcp-server/lib/spec-learning.test.cjs +62 -0
  39. package/mcp-server/lib/state-db.cjs +149 -4
  40. package/mcp-server/lib/state-db.test.cjs +61 -0
  41. package/mcp-server/server.cjs +31 -1
  42. package/mcp-server/tests/db-ops.test.cjs +3 -3
  43. package/mcp-server/tests/init-project.test.cjs +2 -2
  44. package/mcp-server/tests/server-contract.test.cjs +74 -0
  45. package/mcp-server/tests/state-db.test.cjs +20 -3
  46. package/package.json +4 -2
  47. package/skills/learn/SKILL.md +1 -0
  48. package/skills/ultra-change/SKILL.md +91 -118
  49. package/skills/ultra-deliver/SKILL.md +93 -221
  50. package/skills/ultra-dev/SKILL.md +81 -310
  51. package/skills/ultra-doctor/SKILL.md +1 -0
  52. package/skills/ultra-init/SKILL.md +1 -0
  53. package/skills/ultra-plan/SKILL.md +72 -292
  54. package/skills/ultra-review/SKILL.md +79 -407
  55. package/skills/ultra-status/SKILL.md +55 -168
  56. package/skills/ultra-test/SKILL.md +64 -183
  57. package/skills/ultra-think/SKILL.md +1 -0
  58. package/spec/cli-protocol.md +3 -0
  59. package/spec/mcp-tools.yaml +136 -7
  60. package/spec/schemas/skill-manifest.schema.json +2 -2
  61. package/spec/schemas/state-db.sql +35 -2
package/bin/install.js CHANGED
@@ -4,14 +4,14 @@
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
@@ -58,7 +58,7 @@ function printBanner() {
58
58
  paint('cyan', ' ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝╚══════╝╚═╝'),
59
59
  '',
60
60
  ` ${paint('bold', 'Ultra Builder Pro CLI')} ${paint('dim', 'v' + pkg.version)}`,
61
- ` ${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')}`,
62
62
  '',
63
63
  ];
64
64
  console.log(banner.join('\n'));
@@ -71,6 +71,7 @@ function printHelp() {
71
71
  ${paint('cyan', '--claude')} Claude Code
72
72
  ${paint('cyan', '--opencode')} OpenCode
73
73
  ${paint('cyan', '--codex')} Codex CLI (OpenAI)
74
+ ${paint('cyan', '--kimi')} Kimi Code (Moonshot AI)
74
75
  ${paint('cyan', '--all')} all supported runtimes
75
76
 
76
77
  ${paint('yellow', 'Scope:')}
@@ -95,6 +96,9 @@ function printHelp() {
95
96
  ${paint('dim', '# Uninstall from OpenCode')}
96
97
  npx ultra-builder-pro-cli --opencode --global --uninstall
97
98
 
99
+ ${paint('dim', '# Install to Kimi Code globally')}
100
+ npx ultra-builder-pro-cli --kimi --global
101
+
98
102
  ${paint('dim', '# Verify all host installations without changing them')}
99
103
  npx ultra-builder-pro-cli --all --global --doctor
100
104
  `);
@@ -120,6 +124,7 @@ function parseArgs(argv) {
120
124
  case '--claude': runtimes.add('claude'); break;
121
125
  case '--opencode': runtimes.add('opencode'); break;
122
126
  case '--codex': runtimes.add('codex'); break;
127
+ case '--kimi': runtimes.add('kimi'); break;
123
128
  case '--all':
124
129
  SUPPORTED_RUNTIMES.forEach(r => runtimes.add(r));
125
130
  break;
@@ -199,7 +204,7 @@ async function main() {
199
204
  if (flags.json && !flags.doctor) bail('--json is available only with --doctor');
200
205
 
201
206
  if (runtimes.length === 0) {
202
- bail('no runtime selected; use --claude / --opencode / --codex / --all');
207
+ bail('no runtime selected; use --claude / --opencode / --codex / --kimi / --all');
203
208
  }
204
209
 
205
210
  const scope = resolveScope(flags);
@@ -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) {
@@ -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
 
@@ -43,14 +44,14 @@ reports are projections or workflow artifacts.
43
44
 
44
45
  ## 3. Live MCP and declared contracts
45
46
 
46
- `spec/mcp-tools.yaml` declares and the bundled server registers 29 tools across
47
+ `spec/mcp-tools.yaml` declares and the bundled server registers 32 tools across
47
48
  five families:
48
49
 
49
50
  | Family | Live tools |
50
51
  |---|---|
51
52
  | `task.*` | create, update, list, get, switch_tag, delete, init_project, expand, parse_prd, dependency_topo, append_event, subscribe_events |
52
53
  | `session.*` | spawn, close, get, list, admission_check, heartbeat, subscribe_events |
53
- | `change.*` | create, update, get, list, context, converge, archive |
54
+ | `change.*` | create, update, get, list, context, breadcrumb, learning_propose, learning_resolve, converge, archive |
54
55
  | `system.*` | doctor |
55
56
  | `plan.*` | export, get |
56
57
 
@@ -61,21 +62,42 @@ capability map documents those replacements.
61
62
  Any new MCP contract starts in `spec/mcp-tools.yaml` with valid and invalid
62
63
  fixtures. Do not add an ad-hoc server handler first.
63
64
 
64
- ## 4. Native host presentation
65
+ ## 4. Context Spine contract
66
+
67
+ Context Manifest v2 is a DB-backed role handoff, not a static codebase summary.
68
+ `change.context` compiles required references, digests, readiness, context budget,
69
+ public seam, exact verification command, and one next action for `plan`,
70
+ `implement`, `check`, or `review`. The default fresh-context contract is at most
71
+ 12 files, about 12k tokens, and 40% of the host context; wider work must use an
72
+ explicit `expand_contract`.
73
+
74
+ `change.breadcrumb` is the only compact router. Hooks may inject its change/task,
75
+ role, gate, readiness, blockers, and one next action. They must not inject intent
76
+ bodies, transcripts, external memory, or graph payloads. Missing references,
77
+ digest drift, HEAD drift, or budget overflow blocks readiness.
78
+
79
+ Stable discoveries use `change.learning_propose`; they reach the baseline only
80
+ through approve/reject/apply transitions in `change.learning_resolve`. Unresolved
81
+ learning blocks convergence. Review contributes two independent axes,
82
+ `spec_fidelity` and `engineering_standards`; neither can replace the other.
83
+
84
+ ## 5. Native host presentation
65
85
 
66
86
  | Host | Plugin form | Workflow entry | Hook form | Collaboration companions |
67
87
  |---|---|---|---|---|
68
88
  | Claude Code | `.claude-plugin/plugin.json`, native commands/skills/agents, `.mcp.json` | `/ultra-*`, `/learn` | native `hooks/hooks.json` | `codex-collab`, `ultra-verify` |
69
89
  | 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
90
  | OpenCode | config bundle plus native JavaScript plugin | `/ultra-*`, `/learn` | `event`, system transform, compaction, and tool lifecycle handlers | `cc-collab`, `codex-collab`, `ultra-verify` |
91
+ | 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
92
 
72
93
  The current host remains primary. Collaboration skills call another runtime
73
94
  only when explicitly requested, use it as a read-only advisor, and return the
74
95
  evidence to the primary host for final verification.
75
96
 
76
- ## 5. Hook boundary
97
+ ## 6. Hook boundary
77
98
 
78
- The canonical Python hook allowlist contains seven workflow-only adapters:
99
+ The canonical Python hook bundle contains seven executable workflow hooks plus
100
+ the shared read-only `context_spine.py` breadcrumb helper:
79
101
 
80
102
  - `health_check.py` and `workflow_context.py` on session start;
81
103
  - `active_task_context.py` before an edit;
@@ -84,7 +106,9 @@ The canonical Python hook allowlist contains seven workflow-only adapters:
84
106
  - `pre_stop_check.py` at stop;
85
107
  - `subagent_tracker.py` for bounded worker lifecycle evidence.
86
108
 
87
- `health_check.py` and `workflow_context.py` may inspect any initialized project;
109
+ `workflow_context.py`, `active_task_context.py`, and `workflow_resume.py` read the
110
+ same DB-derived breadcrumb through `context_spine.py`. `health_check.py` and
111
+ `workflow_context.py` may inspect any initialized project;
88
112
  `active_task_context.py` always protects the task projection but limits ordinary
89
113
  edit guidance to an active workflow. Compact/stop/subagent hooks remain
90
114
  active-workflow scoped. OpenCode natively injects baseline/change context and
@@ -93,7 +117,7 @@ protects the projection; full health inspection is available through
93
117
  Generic command blocking, post-edit governance, and unrelated user hooks are not
94
118
  copied into Ultra Builder Pro.
95
119
 
96
- ## 6. Memory boundary
120
+ ## 7. Memory boundary
97
121
 
98
122
  Ultra Builder Pro has no memory MCP family, recall skill, prompt capture,
99
123
  transcript capture, observation journal, or session-summary hook. Persistent
@@ -111,14 +135,14 @@ ultra-tools legacy-memory prune --confirm DELETE_ULTRA_LEGACY_MEMORY
111
135
 
112
136
  Archive before prune; the confirmation token is intentionally required.
113
137
 
114
- ## 7. Project state layout
138
+ ## 8. Project state layout
115
139
 
116
140
  ```text
117
141
  .ultra/
118
142
  ├── state.db # authoritative SQLite store
119
143
  ├── workflow-state.json # active workflow/recovery checkpoint
120
144
  ├── changes/
121
- │ ├── active/<id>/ # intent, delta, plan, compiled context, verification
145
+ │ ├── active/<id>/ # intent, delta, plan, context v2, learning, verification
122
146
  │ └── archive/ # converged packets after baseline reconciliation
123
147
  ├── tasks/ # projections and task contexts
124
148
  ├── specs/ # research/product/architecture artifacts
@@ -128,7 +152,7 @@ Archive before prune; the confirmation token is intentionally required.
128
152
  └── delivery-report.json
129
153
  ```
130
154
 
131
- ## 8. User handbook integration
155
+ ## 9. User handbook integration
132
156
 
133
157
  General engineering doctrine remains user-owned in `CLAUDE.md` or `AGENTS.md`.
134
158
  Ultra Builder Pro contributes one managed section only. Preview or apply it with:
@@ -138,12 +162,12 @@ ubp-handbook preview --runtime codex
138
162
  ubp-handbook apply --runtime codex
139
163
  ```
140
164
 
141
- Supported runtime names are `claude`, `codex`, and `opencode`. Apply creates a
165
+ Supported runtime names are `claude`, `codex`, `opencode`, and `kimi`. Apply creates a
142
166
  timestamped backup, replaces only the marked block, and can migrate the old
143
167
  Codex `## Ultra Builder Pro Runtime Contract` section without touching the next
144
168
  user section. Plugin adapters themselves do not silently overwrite handbooks.
145
169
 
146
- ## 9. Verification
170
+ ## 10. Verification
147
171
 
148
172
  Run `npm run test:all`, `python3 -m pytest hooks/tests -q`, and `npm audit`.
149
173
  Adapter tests assert the allowlisted assets, native manifests, hook boundary,
@@ -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
  ┌───────────────────┼────────────────────┐
@@ -53,7 +53,7 @@ the supported hosts share.
53
53
  | Layer | Role | Form |
54
54
  |--------------|----------------------------------------------|-------------------------------------------------------|
55
55
  | **skill** | knowledge carrier; tells the runtime *what to do* | `skills/<name>/SKILL.md` discovered natively by all supported runtimes |
56
- | **MCP** | authoritative workflow-state API | stdio MCP server exposing 29 live tools across task/session/change/system/plan families in [`spec/mcp-tools.yaml`](../spec/mcp-tools.yaml) |
56
+ | **MCP** | authoritative workflow-state and Context Spine API | stdio MCP server exposing 32 live tools across task/session/change/system/plan families in [`spec/mcp-tools.yaml`](../spec/mcp-tools.yaml) |
57
57
  | **CLI** | explicit initialization, recovery, diagnostics, and orchestration | `ultra-tools` / `ubp-orchestrator`; only commands listed by `--help` are executable (see [`spec/cli-protocol.md`](../spec/cli-protocol.md)) |
58
58
 
59
59
  Why three: skills give us behavior portability across runtimes; MCP gives
@@ -70,7 +70,7 @@ RPC, and host-native loaders own resolution and invocation.
70
70
 
71
71
  All durable Ultra workflow state lives in one SQLite file with WAL enabled. Schema is
72
72
  fixed in [`spec/schemas/state-db.sql`](../spec/schemas/state-db.sql) and
73
- covers fifteen tables:
73
+ covers sixteen tables:
74
74
 
75
75
  | Table | Holds | Phase |
76
76
  |--------------------|---------------------------------------------------|-------|
@@ -84,7 +84,8 @@ covers fifteen tables:
84
84
  | `circuit_breaker` | bounded retry and halt state for failed tasks | 5 |
85
85
  | `changes` | continuous feature/fix/incident lifecycle | 8C |
86
86
  | `artifacts` | intent/context/verification artifact registry | 8C |
87
- | `context_snapshots`| compiled context hashes, git head, provider refs | 8C |
87
+ | `context_snapshots`| role/gate context, readiness, budget, execution seam, hashes, git head, provider refs | 10 |
88
+ | `spec_learning_candidates` | approval-gated implementation discoveries for baseline convergence | 10 |
88
89
  | `trace_links` | task/spec/change traceability | 8C |
89
90
  | `incidents` | structured runtime failures and resolutions | 8C |
90
91
  | `projection_jobs` | durable projection outbox/retry state | 8C |
@@ -101,7 +102,8 @@ Two rules make this work:
101
102
  2. **Single writer for mutable tables, multi-writer for `events`.**
102
103
  `.ultra/state.db` opens in WAL with `busy_timeout=5000`. The MCP
103
104
  server holds the single writer connection for `tasks`, `sessions`,
104
- `telemetry`, `specs_refs`, and `migration_history`; the CLI calls
105
+ `changes`, `context_snapshots`, `spec_learning_candidates`, `telemetry`,
106
+ `specs_refs`, and `migration_history`; the CLI calls
105
107
  those tools over stdio rather than opening its own writer. The
106
108
  `events` table is append-only and explicitly multi-writer — CLI and
107
109
  orchestrator processes append directly to it under the same WAL +
@@ -133,7 +135,8 @@ active -> blocked -> active -> ready -> archived
133
135
  | |
134
136
  ├─ intent + delta + plan └─ verification + baseline reconciliation
135
137
  ├─ linked tasks
136
- └─ context-manifest (current HEAD + provider metadata references)
138
+ ├─ context-manifest v2 (role + gate + readiness + execution seam)
139
+ └─ spec-learning candidates (proposed -> approved/rejected -> applied)
137
140
  ```
138
141
 
139
142
  `quick`, `standard`, `major`, and `incident` kinds require different evidence,
@@ -141,6 +144,29 @@ but all require completed linked tasks, current context, declared documentation
141
144
  impact, and no open incident. Memory and graph payloads never enter Ultra;
142
145
  `context_snapshots.provider_refs_json` stores metadata references only.
143
146
 
147
+ ### Context Spine
148
+
149
+ Context Manifest v2 is the handoff contract between planning, implementation,
150
+ checking, review, convergence, and recovery. Each snapshot records:
151
+
152
+ - one role (`plan`, `implement`, `check`, or `review`) and lifecycle gate;
153
+ - required context references with local digests and reasons;
154
+ - readiness blockers for missing/stale references or budget overflow;
155
+ - a fresh-context budget (12 files / about 12k tokens / 40% by default);
156
+ - an execution contract (`slice_kind`, public seam, exact verification command);
157
+ - one deterministic next action.
158
+
159
+ `change.breadcrumb` derives the compact current position from state.db. Session,
160
+ edit, and resume hooks inject only this breadcrumb, never the intent body,
161
+ provider content, or a conversation summary. A changed git HEAD marks the
162
+ snapshot stale and routes back to `change.context`.
163
+
164
+ `change.learning_propose` records a durable implementation discovery without
165
+ silently rewriting the baseline. `change.learning_resolve` enforces approval,
166
+ rejection, and applied transitions. Proposed or merely approved candidates block
167
+ convergence, so daily work cannot leave accepted behavior stranded in chat or a
168
+ delta packet.
169
+
144
170
  `incident` is the canonical debug lane. Creating one also registers a durable
145
171
  `diagnosis.md` artifact with five mandatory sections: reproduction, hypotheses,
146
172
  root cause, regression test, and recovery. Convergence validates the artifact
@@ -156,7 +182,7 @@ backup-first mechanical recovery when explicitly requested.
156
182
 
157
183
  ## 5. Sessions — the execution unit
158
184
 
159
- A **session** is the standard unit of execution across all three runtimes
185
+ A **session** is the standard unit of execution across all four runtimes
160
186
  (D20). One session =
161
187
 
162
188
  - a fresh OS process for the runtime,
@@ -189,7 +215,7 @@ durable authority alongside `.ultra/state.db`.
189
215
 
190
216
  ## 7. Installation provenance — read-only cross-host diagnosis
191
217
 
192
- Every Claude Code, OpenCode, and Codex adapter writes a normalized
218
+ Every Claude Code, OpenCode, Codex, and Kimi Code adapter writes a normalized
193
219
  `provenance.json` for the assets it owns. The manifest records adapter/package
194
220
  identity, source metadata, per-file SHA-256 hashes, an aggregate digest, and the
195
221
  host-specific plugin, MCP, hook, launcher, and runtime contracts expected at
@@ -6,12 +6,13 @@
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.8.1;三宿主 native plugin、29 个 live MCP tool、
14
- schema 9.0(15 表)、持续 change/context/convergence/doctor、incident debug lane、
13
+ **当前状态**:v0.10.0;四宿主 native plugin、32 个 live MCP tool、
14
+ schema 10.0(16 表)、Context Spine v2 / breadcrumb / spec-learning、持续
15
+ change/context/convergence/doctor、incident debug lane、
15
16
  checkpoint 恢复消费与跨宿主安装 provenance/doctor 已落地;npm 发布由
16
17
  `v*.*.*` tag 触发。以下 Phase 0-9 正文保留为 2026-04 的实施历史,不再作为
17
18
  当前 runtime 或发布状态的事实来源。
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.10.x`; every release is gated by `npm run verify:release`.
17
17
 
18
18
  ---
19
19
 
@@ -43,20 +43,21 @@ authoritative workflow store.
43
43
  | 8A | Plan automation (parse / topo / expand + artifact + human gate) | ✅ done (D47, `a932cb8`) → v0.3 |
44
44
  | 8B | Execution automation (dispatch / parallel worktree / merge) | ✅ done (D48, `8224159`) — **v0.3 ready** |
45
45
  | 8C | Continuous change packets + context compiler + convergence + doctor | ✅ done (D52) |
46
+ | 10 | Context Spine v2 + breadcrumb + fresh-context budget + spec learning + two-axis review | ✅ done |
46
47
  | 9 | Release pipeline | npm tag publishing live; Homebrew / pip not implemented |
47
48
 
48
49
  ## What is in the repo today
49
50
 
50
51
  ```
51
52
  spec/ ← Phase 1 single source of truth
52
- ├── mcp-tools.yaml (29 live tools across 5 families)
53
+ ├── mcp-tools.yaml (32 live tools across 5 families)
53
54
  ├── cli-protocol.md (CLI ↔ MCP mapping table)
54
55
  ├── schemas/ (state-db.sql + 4 JSON schemas)
55
56
  ├── fixtures/{valid,invalid}/ (+ v4.4-project for migration)
56
57
  └── scripts/test-all.cjs (npm run test:spec — 7 validation stages)
57
58
 
58
59
  mcp-server/ ← Phase 2 authoritative state layer
59
- ├── server.cjs (stdio MCP server, 29 task/session/change/system/plan tools)
60
+ ├── server.cjs (stdio MCP server, 32 task/session/change/system/plan tools)
60
61
  ├── lib/
61
62
  │ ├── state-db.cjs (SQLite + WAL + pragmas)
62
63
  │ ├── state-ops.cjs (full write API, status state machine)
@@ -74,7 +75,7 @@ bin/install.js ← multi-runtime installer
74
75
  bin/handbook.js ← explicit managed user-handbook sync
75
76
  adapters/ ← native Claude/OpenCode/Codex plugin builders
76
77
  skills/ ← allowlisted Ultra workflows, internal rules, and collab companions
77
- hooks/ ← 7 workflow-only Python hooks; OpenCode uses native JavaScript hooks
78
+ hooks/ ← 7 executable workflow hooks + shared Context Spine helper; OpenCode uses native JavaScript hooks
78
79
  docs/
79
80
  ├── PLAN.zh-CN.md historical phase plan + decision log
80
81
  ├── ARCHITECTURE.md Phase 1 single-page entry point
@@ -1,97 +1,141 @@
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, validated checkpoint + resume/restore matcher | FULL, native compacting context | FULL, validated checkpoint + `PostCompact` restore |
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, DB-derived Context Spine breadcrumb on native `SessionStart` | DEGRADED, projected v2 breadcrumb; health via `system.doctor` | FULL, DB-derived breadcrumb on native `SessionStart` | FULL, DB-derived breadcrumb via session-start skill + 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 |
63
-
64
- All 29 `task.*`, `session.*`, `change.*`, `system.*`, and `plan.*` operations
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 | 32 | 32 | 32 | 32 |
73
+ | Context Spine v2 / breadcrumb | FULL | FULL, DB-generated projection consumed by native JS | FULL | FULL |
74
+ | Approval-gated spec learning | FULL | FULL | FULL | FULL |
75
+ | 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 |
78
+
79
+ All 32 `task.*`, `session.*`, `change.*`, `system.*`, and `plan.*` operations
65
80
  registered by `mcp-server/server.cjs` are live. Review, impact discovery, skill
66
81
  loading, and user interaction remain host-native surfaces.
67
82
 
83
+ Kimi starts plugin MCP processes with the managed plugin root as `cwd`. The
84
+ generated launcher recovers the project from the inherited `PWD`, sets
85
+ `UBP_ROOT_DIR` and `UBP_DB_PATH`, and refuses to start if that project boundary
86
+ cannot be established. On POSIX it intentionally uses `env node` because Kimi
87
+ 0.26/0.27's embedded Node ABI differs from the ABI used to install `better-sqlite3`.
88
+
68
89
  ## 5. User handbook presentation
69
90
 
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 |
91
+ | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
92
+ |---|---|---|---|---|
93
+ | Durable user file | `~/.claude/CLAUDE.md` | `~/.config/opencode/AGENTS.md` | `~/.codex/AGENTS.md` | `~/.kimi-code/AGENTS.md` |
94
+ | Automatic overwrite by plugin install | no | no | no | no |
95
+ | Explicit managed-block sync | `ubp-handbook --runtime claude` | `ubp-handbook --runtime opencode` | `ubp-handbook --runtime codex` | `ubp-handbook --runtime kimi` |
96
+ | Backup before change | FULL | FULL | FULL | FULL |
76
97
 
77
- ## 6. Install, update, and uninstall
98
+ The Kimi plugin installer does not edit `~/.kimi-code/config.toml`. Handbook
99
+ sync remains a separate, previewable action so user policy and plugin mechanics
100
+ do not become one irreversible mutation.
78
101
 
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 |
86
- | Normalized install provenance | FULL | FULL | FULL |
87
- | Read-only `ubp --doctor` | FULL | FULL | FULL |
88
- | Asset-content and host-contract drift detection | FULL | FULL | FULL |
102
+ ## 6. Install, update, and uninstall
89
103
 
90
- ## 7. Verification sources
104
+ | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
105
+ |---|---|---|---|---|
106
+ | Adapter install | FULL | FULL | FULL | FULL |
107
+ | Global install command | `ubp --claude --global` | `ubp --opencode --global` | `ubp --codex --global` | `ubp --kimi --global` |
108
+ | Native update visibility | next host session | host restart | cachebuster + new task | `/reload` or new session |
109
+ | Removes stale managed assets | FULL | FULL | FULL | FULL |
110
+ | Preserves unrelated config | FULL | FULL | FULL | FULL, including `config.toml` and unrelated registry records |
111
+ | Uninstall ownership guard | managed plugin root | sentinels + owned MCP entry | managed root/manifest/agent headers | managed root + exact registry record |
112
+ | Normalized install provenance | FULL | FULL | FULL | FULL |
113
+ | Read-only `ubp --doctor` | FULL | FULL | FULL | FULL |
114
+ | Asset-content and host-contract drift detection | FULL | FULL | FULL | FULL |
115
+
116
+ Kimi's global managed root is
117
+ `~/.kimi-code/plugins/managed/ultra-builder-pro`; its only registry mutation is
118
+ the owned `ultra-builder-pro` entry in `~/.kimi-code/plugins/installed.json`.
119
+ Reinstall preserves the user's enabled/capability choices and unrelated plugin
120
+ records. Uninstall refuses an unmanaged or conflicting root.
121
+
122
+ ## 7. Durable schema compatibility
123
+
124
+ | Capability | Contract |
125
+ |---|---|
126
+ | Current state schema | `10.0` |
127
+ | Runtime values | `claude`, `opencode`, `codex`, `kimi` |
128
+ | Upgrade from earlier schema | preserves Kimi runtime rows, adds Context Spine columns and `spec_learning_candidates` transactionally |
129
+ | Preservation gate | rows, IDs, indexes, foreign keys, telemetry, incidents, and migration history remain intact |
130
+ | Failure behavior | rollback; no partially upgraded authority database |
131
+
132
+ ## 8. Verification sources
91
133
 
92
134
  - `adapters/tests/*.test.cjs` verifies each installer and native manifest.
93
135
  - `tests/conformance/<runtime>/*.test.cjs` verifies command/skill, hook, MCP,
94
- idempotency, and smoke presentation.
136
+ idempotency, and smoke presentation for all four hosts.
137
+ - `tests/conformance/kimi/smoke.test.cjs` reproduces Kimi's plugin-root MCP
138
+ `cwd` and proves that the first state write lands in the active project.
95
139
  - `adapters/_shared/tests/runtime-assets.test.cjs` prevents retired or external
96
140
  skills and generic/memory hooks from re-entering a package.
97
141
  - `tests/retired-runtime.test.cjs` prevents retired runtime code or prompt text
@@ -100,7 +144,9 @@ loading, and user interaction remain host-native surfaces.
100
144
  migration, and idempotency.
101
145
  - `adapters/_shared/tests/provenance.test.cjs` verifies normalized manifests,
102
146
  content hashes, source attribution, corruption handling, and contract drift.
103
- - `tests/install.test.cjs` verifies healthy three-host doctor output and
147
+ - `tests/install.test.cjs` verifies healthy four-host doctor output and
104
148
  host-specific hook/MCP degradation after controlled tampering.
149
+ - `tests/package-smoke.test.cjs` installs the packed tarball into a clean
150
+ consumer and executes a live MCP round trip through every generated launcher.
105
151
 
106
152
  Any capability claim elsewhere must match current adapter code and these tests.