ultra-builder-pro-cli 0.9.0 → 0.11.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 (119) hide show
  1. package/CHANGELOG.md +92 -1
  2. package/README.md +11 -6
  3. package/adapters/_shared/codex-assets.cjs +23 -331
  4. package/adapters/_shared/handbook.cjs +2 -0
  5. package/adapters/_shared/runtime-assets.cjs +25 -0
  6. package/adapters/_shared/tests/handbook.test.cjs +3 -0
  7. package/adapters/_shared/tests/runtime-assets.test.cjs +12 -4
  8. package/adapters/claude.js +28 -5
  9. package/adapters/kimi.js +15 -138
  10. package/adapters/opencode.js +59 -63
  11. package/adapters/tests/claude.test.cjs +26 -9
  12. package/adapters/tests/codex.test.cjs +23 -9
  13. package/adapters/tests/kimi.test.cjs +15 -11
  14. package/adapters/tests/opencode.test.cjs +57 -10
  15. package/agents/code-reviewer.md +24 -85
  16. package/agents/debugger.md +30 -132
  17. package/agents/review-code.md +24 -104
  18. package/agents/review-comments.md +20 -83
  19. package/agents/review-coordinator.md +40 -137
  20. package/agents/review-design.md +21 -118
  21. package/agents/review-errors.md +22 -70
  22. package/agents/review-spec.md +36 -0
  23. package/agents/review-tests.md +20 -76
  24. package/agents/tdd-runner.md +26 -84
  25. package/commands/learn.md +5 -36
  26. package/commands/ultra-change.md +5 -43
  27. package/commands/ultra-deliver.md +4 -46
  28. package/commands/ultra-dev.md +4 -48
  29. package/commands/ultra-doctor.md +4 -30
  30. package/commands/ultra-init.md +5 -47
  31. package/commands/ultra-plan.md +5 -48
  32. package/commands/ultra-research.md +5 -54
  33. package/commands/ultra-status.md +5 -44
  34. package/commands/ultra-test.md +5 -45
  35. package/commands/ultra-think.md +5 -40
  36. package/docs/AGENT-CONTEXT.md +34 -12
  37. package/docs/ARCHITECTURE.md +31 -5
  38. package/docs/PLAN.zh-CN.md +3 -2
  39. package/docs/ROADMAP.md +5 -4
  40. package/docs/RUNTIME-COMPAT-MATRIX.md +7 -5
  41. package/docs/SKILL-AUTHORING.md +75 -0
  42. package/docs/USER-HANDBOOK-CONTRACT.md +9 -2
  43. package/hooks/README.md +6 -4
  44. package/hooks/active_task_context.py +14 -0
  45. package/hooks/context_spine.py +218 -0
  46. package/hooks/health_check.py +1 -1
  47. package/hooks/workflow_context.py +16 -123
  48. package/hooks/workflow_resume.py +21 -0
  49. package/mcp-server/lib/change-workflow.cjs +89 -11
  50. package/mcp-server/lib/change-workflow.test.cjs +202 -7
  51. package/mcp-server/lib/context-spine.cjs +331 -0
  52. package/mcp-server/lib/context-spine.test.cjs +73 -0
  53. package/mcp-server/lib/spec-learning.cjs +191 -0
  54. package/mcp-server/lib/spec-learning.test.cjs +62 -0
  55. package/mcp-server/lib/state-db.cjs +72 -10
  56. package/mcp-server/lib/state-db.test.cjs +7 -2
  57. package/mcp-server/server.cjs +31 -1
  58. package/mcp-server/tests/db-ops.test.cjs +3 -3
  59. package/mcp-server/tests/server-contract.test.cjs +74 -0
  60. package/mcp-server/tests/state-db.test.cjs +20 -3
  61. package/package.json +3 -2
  62. package/skills/cc-collab/SKILL.md +16 -18
  63. package/skills/code-review-expert/SKILL.md +39 -114
  64. package/skills/code-review-expert/references/correctness-reliability.md +30 -0
  65. package/skills/code-review-expert/references/design-boundaries.md +26 -0
  66. package/skills/code-review-expert/references/removal-plan.md +17 -45
  67. package/skills/codex-collab/SKILL.md +23 -28
  68. package/skills/codex-collab/evals/evals.json +18 -23
  69. package/skills/integration-rules/SKILL.md +28 -67
  70. package/skills/learn/SKILL.md +46 -105
  71. package/skills/security-rules/SKILL.md +34 -56
  72. package/skills/testing-rules/SKILL.md +28 -52
  73. package/skills/ultra-change/SKILL.md +61 -145
  74. package/skills/ultra-deliver/SKILL.md +63 -229
  75. package/skills/ultra-dev/SKILL.md +46 -338
  76. package/skills/ultra-doctor/SKILL.md +39 -71
  77. package/skills/ultra-init/SKILL.md +59 -139
  78. package/skills/ultra-plan/SKILL.md +50 -310
  79. package/skills/ultra-research/SKILL.md +59 -152
  80. package/skills/ultra-research/references/architecture.md +38 -0
  81. package/skills/ultra-research/references/problem-product.md +39 -0
  82. package/skills/ultra-research/references/quality-delivery.md +34 -0
  83. package/skills/ultra-research/references/synthesis.md +38 -0
  84. package/skills/ultra-research/references/users-scope.md +40 -0
  85. package/skills/ultra-review/SKILL.md +55 -427
  86. package/skills/ultra-review/references/unified-schema.md +76 -101
  87. package/skills/ultra-review/scripts/review_wait.py +242 -77
  88. package/skills/ultra-status/SKILL.md +38 -173
  89. package/skills/ultra-test/SKILL.md +41 -195
  90. package/skills/ultra-think/SKILL.md +43 -101
  91. package/skills/ultra-verify/SKILL.md +44 -84
  92. package/skills/ultra-verify/evals/evals.json +24 -27
  93. package/spec/cli-protocol.md +3 -0
  94. package/spec/mcp-tools.yaml +133 -4
  95. package/spec/schemas/command-manifest.schema.json +7 -25
  96. package/spec/schemas/skill-manifest.schema.json +9 -79
  97. package/spec/schemas/state-db.sql +31 -0
  98. package/skills/code-review-expert/references/code-quality-checklist.md +0 -112
  99. package/skills/code-review-expert/references/integration-checklist.md +0 -46
  100. package/skills/code-review-expert/references/security-checklist.md +0 -100
  101. package/skills/code-review-expert/references/solid-checklist.md +0 -65
  102. package/skills/ultra-research/steps/step-00-problem-validation.md +0 -154
  103. package/skills/ultra-research/steps/step-01-opportunity-discovery.md +0 -172
  104. package/skills/ultra-research/steps/step-02-market-assessment.md +0 -195
  105. package/skills/ultra-research/steps/step-03-competitive-landscape.md +0 -197
  106. package/skills/ultra-research/steps/step-04-product-strategy.md +0 -196
  107. package/skills/ultra-research/steps/step-05-assumptions-validation.md +0 -234
  108. package/skills/ultra-research/steps/step-10-user-personas.md +0 -169
  109. package/skills/ultra-research/steps/step-11-user-scenarios.md +0 -181
  110. package/skills/ultra-research/steps/step-20-user-stories.md +0 -156
  111. package/skills/ultra-research/steps/step-21-features-scope.md +0 -157
  112. package/skills/ultra-research/steps/step-22-success-metrics.md +0 -195
  113. package/skills/ultra-research/steps/step-30-architecture-context.md +0 -154
  114. package/skills/ultra-research/steps/step-31-solution-strategy.md +0 -172
  115. package/skills/ultra-research/steps/step-32-building-blocks.md +0 -188
  116. package/skills/ultra-research/steps/step-40-deployment.md +0 -123
  117. package/skills/ultra-research/steps/step-41-quality-risks.md +0 -135
  118. package/skills/ultra-research/steps/step-99-synthesis.md +0 -188
  119. package/skills/ultra-review/scripts/review_verdict_update.py +0 -99
@@ -1,59 +1,10 @@
1
1
  ---
2
- description: Think-Driven Interactive Discovery — 17-step research with per-step web search and spec-file output
3
- argument-hint: [topic]
4
- allowed-tools: Task, Read, Write, WebSearch, WebFetch, Grep, Glob, AskUserQuestion
5
- model: opus
2
+ description: Research unresolved product or architecture decisions and update the authoritative baseline specifications
3
+ argument-hint: "[scope-or-question]"
6
4
  workflow-ref: "@skills/ultra-research/SKILL.md"
7
5
  ---
8
6
 
9
- # Ultra Research v2
7
+ # Research a baseline
10
8
 
11
- **Step-file architecture**: Each research step is a self-contained instruction file loaded just-in-time for maximum LLM attention density.
12
-
13
- ## How This Works
14
-
15
- 1. Read the main skill file: `skills/ultra-research/SKILL.md`
16
- 2. Follow the activation sequence (pre-checks → project type detection → step routing)
17
- 3. For each step: Read `skills/ultra-research/steps/step-{NN}-{name}.md` and follow ALL instructions
18
- 4. Each step writes output immediately to spec files, then presents [C] Continue gate
19
- 5. Only proceed to next step after user confirms [C]
20
-
21
- ## Step Sequence
22
-
23
- | Step | File | Focus |
24
- |------|------|-------|
25
- | **R0: Product Discovery** | | |
26
- | 00 | `step-00-problem-validation.md` | Validate the problem is real |
27
- | 01 | `step-01-opportunity-discovery.md` | Map opportunity space (OST) |
28
- | 02 | `step-02-market-assessment.md` | TAM/SAM/SOM sizing |
29
- | 03 | `step-03-competitive-landscape.md` | Competitor analysis |
30
- | 04 | `step-04-product-strategy.md` | Vision, segments, trade-offs |
31
- | 05 | `step-05-assumptions-validation.md` | Risk assumptions + experiments |
32
- | **R1: User & Scenario** | | |
33
- | 10 | `step-10-user-personas.md` | 2-3 personas |
34
- | 11 | `step-11-user-scenarios.md` | 3-5 user scenarios |
35
- | **R2: Feature Definition** | | |
36
- | 20 | `step-20-user-stories.md` | Stories + acceptance criteria |
37
- | 21 | `step-21-features-scope.md` | MVP scope + exclusions |
38
- | 22 | `step-22-success-metrics.md` | KPIs + targets |
39
- | **R3: Architecture** | | |
40
- | 30 | `step-30-architecture-context.md` | Quality goals, constraints |
41
- | 31 | `step-31-solution-strategy.md` | Tech stack decisions |
42
- | 32 | `step-32-building-blocks.md` | Modules + runtime scenarios |
43
- | **R4: Quality & Deploy** | | |
44
- | 40 | `step-40-deployment.md` | Infrastructure + CI/CD |
45
- | 41 | `step-41-quality-risks.md` | Quality scenarios + risks |
46
- | **Synthesis** | | |
47
- | 99 | `step-99-synthesis.md` | Distillate + validation |
48
-
49
- ## Critical Rules
50
-
51
- - **Read SKILL.md first** — it has activation logic and project type detection
52
- - **One step at a time** — never load multiple step files simultaneously
53
- - **Write immediately** — every step writes to spec file before presenting to user
54
- - **Web search mandatory** — factual claims need sources, no exceptions
55
- - **User gate** — halt at [C] Continue, do not auto-proceed
56
-
57
- ## Begin
58
-
59
- Read `skills/ultra-research/SKILL.md` now and follow the activation sequence.
9
+ Read and follow `@skills/ultra-research/SKILL.md`, using `$ARGUMENTS` to bound the research scope.
10
+ Treat the referenced skill as the only workflow definition.
@@ -1,49 +1,10 @@
1
1
  ---
2
- description: Real-time project status — progress + risks + workflow routing, via MCP task.list
3
- argument-hint: "[task-id]"
4
- allowed-tools: Read, Bash(git status), Bash(git log *), Grep, Glob, Task
5
- model: opus
2
+ description: Report authoritative Ultra health, readiness, evidence freshness, and one next action
3
+ argument-hint: "[task-or-change-id]"
6
4
  workflow-ref: "@skills/ultra-status/SKILL.md"
7
- mcp_tools_required:
8
- - task.list
9
- - task.get
10
- - change.list
11
- - system.doctor
12
5
  ---
13
6
 
14
- # /ultra-status
7
+ # Report Ultra status
15
8
 
16
- ## 目标
17
-
18
- 一次调用拿整个项目近况:任务进度(来自 state.db `task.list`)+ 测试状态(`test-report.json`)+
19
- 发布状态(`delivery-report.json`)+ active change + runtime health + 下一步命令路由。只读。
20
- 任务状态只接受 MCP `task.list`/`task.get`;失败时原样报告并停止,绝不读取
21
- `tasks.json` 冒充权威数据。旧 v4.4 数据必须先执行正式迁移。
22
-
23
- ## 参数
24
-
25
- | 位 | 含义 | 缺省 |
26
- |----|------|------|
27
- | `$1` | 单 task id(只看这个 task) | 不填 → 全局报告 |
28
-
29
- ## Workflow
30
-
31
- 完整 5 阶段见 `@skills/ultra-status/SKILL.md`(validation → load → progress → risk → routing)。
32
-
33
- **命令入口做的事**:
34
- 1. 环境检查(state.db 可达 + 有 task)
35
- 2. `task.list` + `change.list` + read-only `system.doctor`;读 test/delivery report
36
- 3. 算进度 + 风险(含 projection、incident、context/docs drift)
37
- 4. 初始交付后不再显示终局 Done;健康 baseline 的下一项日常工作路由到 `/ultra-change`
38
-
39
- ## 用法
40
-
41
- ```bash
42
- /ultra-status # 项目全局报告
43
- /ultra-status 3 # 只看 task 3
44
- ```
45
-
46
- ## 下一步
47
-
48
- 看输出的 `▶ Next Up` 块。常见场景:有 pending → `/ultra-dev`;全绿 → `/ultra-test`;
49
- test passed → `/ultra-deliver`;已归档且 baseline 健康 → `/ultra-change`。
9
+ Read and follow `@skills/ultra-status/SKILL.md`, using `$ARGUMENTS` to select a specific task or change.
10
+ Treat the referenced skill as the only workflow definition.
@@ -1,50 +1,10 @@
1
1
  ---
2
- description: Pre-delivery quality audit — Anti-Pattern + Coverage Gap + Wiring + E2E + Perf + Security
3
- argument-hint: [scope]
4
- allowed-tools: Bash, Read, Write, Edit, Task, Grep, Glob, AskUserQuestion
5
- model: opus
2
+ description: Run the independent pre-delivery verification gate and record current acceptance evidence
3
+ argument-hint: "[scope]"
6
4
  workflow-ref: "@skills/ultra-test/SKILL.md"
7
- mcp_tools_required:
8
- - task.list
9
- - change.list
10
5
  ---
11
6
 
12
- # /ultra-test
7
+ # Verify delivery readiness
13
8
 
14
- ## 目标
15
-
16
- `/ultra-deliver` 前的项目级质量审计:6 类 gate(Anti-Pattern / Coverage Gap /
17
- Wiring / E2E / Performance / Security)× auto-fix loop。**只读** state.db,
18
- 写 `.ultra/test-report.json` 作为 `/ultra-deliver` 的准入凭证。
19
- completed-task 前置检查必须来自 MCP `task.list`;失败时停止,绝不回退到
20
- `tasks.json`。`LEGACY_STATE_MIGRATION_REQUIRED` 必须先完成 v4.4→v4.5 迁移。
21
-
22
- **注意**:这不是跑单测(那是 `/ultra-dev`)。这是交付前的体检。
23
-
24
- ## 参数
25
-
26
- | 位 | 含义 | 缺省 |
27
- |----|------|------|
28
- | `$1` | 审计范围(`all`/`anti-pattern`/`coverage`/`e2e`/`perf`/`security`) | `all` |
29
-
30
- ## Workflow
31
-
32
- 完整 8 步见 `@skills/ultra-test/SKILL.md`(pre-check → 6 gates → auto-fix → persist → report)。
33
-
34
- **命令入口做的事**:
35
- 1. 探测项目类型 + `task.list` 确认 ≥1 completed
36
- 2. 按 scope 跑 gates;失败进 auto-fix(最多 5 轮)
37
- 3. 写 `.ultra/test-report.json`(change_id + exact commands + gate 明细 + blocking_issues)
38
- 4. 通过 → 提示 `/ultra-deliver`
39
-
40
- ## 用法
41
-
42
- ```bash
43
- /ultra-test # 全量审计
44
- /ultra-test security # 只跑安全审计
45
- /ultra-test coverage # 只找覆盖缺口
46
- ```
47
-
48
- ## 下一步
49
-
50
- `passed=true` → `/ultra-deliver`;`passed=false` → 修或跟进 `blocking_issues`。
9
+ Read and follow `@skills/ultra-test/SKILL.md`, using `$ARGUMENTS` to bound the verification scope.
10
+ Treat the referenced skill as the only workflow definition.
@@ -1,45 +1,10 @@
1
1
  ---
2
- description: Deep analysis with adversarial reasoning — Evidence-First + Multi-Perspective + Stress-Test + Confidence-Quantified recommendation
3
- argument-hint: "[problem or decision to analyze]"
4
- allowed-tools: Read, Grep, Glob, Bash, Write, Task, WebSearch, WebFetch, AskUserQuestion, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa, mcp__context7__resolve-library-id, mcp__context7__query-docs
5
- model: opus
2
+ description: Analyze a consequential question with evidence, uncertainty, and proportionate stress testing
3
+ argument-hint: "[question]"
6
4
  workflow-ref: "@skills/ultra-think/SKILL.md"
7
- cli_fallback: "direct user interaction"
8
5
  ---
9
6
 
10
- # /ultra-think
7
+ # Analyze a consequential question
11
8
 
12
- ## 目标
13
-
14
- 结构化深度分析复杂问题/决策/诊断。Evidence-First 标注(Fact/Inference/Speculation)+
15
- 多视角 + 对抗压测(Steel-Man / Pre-Mortem / Sensitivity / Second-Order)→
16
- 量化置信度的推荐 + 验证计划。
17
-
18
- ## 参数
19
-
20
- <problem>
21
- $ARGUMENTS
22
- </problem>
23
-
24
- ## Workflow
25
-
26
- 完整 5 步见 `@skills/ultra-think/SKILL.md`(Scope → Evidence → Multi-Perspective →
27
- Adversarial → Synthesis)。
28
-
29
- **命令入口做的事**:
30
- 1. 读 `$ARGUMENTS` 判定问题范围 — 模糊 → 用 Host 原生提问界面最多澄清 3 个问题
31
- 2. 简单问题 → 直接答;复杂 → 跑完整框架
32
- 3. 输出 Markdown 报告(Problem / Analysis / Options / Adversarial / Recommendation /
33
- Verification / Next Steps)
34
-
35
- ## 用法
36
-
37
- ```bash
38
- /ultra-think "should we switch from REST to gRPC for the internal API?"
39
- /ultra-think "why is the deploy pipeline flaky every 3rd run?"
40
- ```
41
-
42
- ## 下一步
43
-
44
- 方案进入 spec → `/ultra-research` 补证据或 `/ultra-plan` 直接排任务;
45
- 纯诊断 → 跟着 Verification Plan 走,取证后再定。
9
+ Read and follow `@skills/ultra-think/SKILL.md`, treating `$ARGUMENTS` as the question to resolve.
10
+ Treat the referenced skill as the only workflow definition.
@@ -44,14 +44,14 @@ reports are projections or workflow artifacts.
44
44
 
45
45
  ## 3. Live MCP and declared contracts
46
46
 
47
- `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
48
48
  five families:
49
49
 
50
50
  | Family | Live tools |
51
51
  |---|---|
52
52
  | `task.*` | create, update, list, get, switch_tag, delete, init_project, expand, parse_prd, dependency_topo, append_event, subscribe_events |
53
53
  | `session.*` | spawn, close, get, list, admission_check, heartbeat, subscribe_events |
54
- | `change.*` | create, update, get, list, context, converge, archive |
54
+ | `change.*` | create, update, get, list, context, breadcrumb, learning_propose, learning_resolve, converge, archive |
55
55
  | `system.*` | doctor |
56
56
  | `plan.*` | export, get |
57
57
 
@@ -62,7 +62,26 @@ capability map documents those replacements.
62
62
  Any new MCP contract starts in `spec/mcp-tools.yaml` with valid and invalid
63
63
  fixtures. Do not add an ad-hoc server handler first.
64
64
 
65
- ## 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
66
85
 
67
86
  | Host | Plugin form | Workflow entry | Hook form | Collaboration companions |
68
87
  |---|---|---|---|---|
@@ -75,9 +94,10 @@ The current host remains primary. Collaboration skills call another runtime
75
94
  only when explicitly requested, use it as a read-only advisor, and return the
76
95
  evidence to the primary host for final verification.
77
96
 
78
- ## 5. Hook boundary
97
+ ## 6. Hook boundary
79
98
 
80
- 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:
81
101
 
82
102
  - `health_check.py` and `workflow_context.py` on session start;
83
103
  - `active_task_context.py` before an edit;
@@ -86,7 +106,9 @@ The canonical Python hook allowlist contains seven workflow-only adapters:
86
106
  - `pre_stop_check.py` at stop;
87
107
  - `subagent_tracker.py` for bounded worker lifecycle evidence.
88
108
 
89
- `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;
90
112
  `active_task_context.py` always protects the task projection but limits ordinary
91
113
  edit guidance to an active workflow. Compact/stop/subagent hooks remain
92
114
  active-workflow scoped. OpenCode natively injects baseline/change context and
@@ -95,7 +117,7 @@ protects the projection; full health inspection is available through
95
117
  Generic command blocking, post-edit governance, and unrelated user hooks are not
96
118
  copied into Ultra Builder Pro.
97
119
 
98
- ## 6. Memory boundary
120
+ ## 7. Memory boundary
99
121
 
100
122
  Ultra Builder Pro has no memory MCP family, recall skill, prompt capture,
101
123
  transcript capture, observation journal, or session-summary hook. Persistent
@@ -113,14 +135,14 @@ ultra-tools legacy-memory prune --confirm DELETE_ULTRA_LEGACY_MEMORY
113
135
 
114
136
  Archive before prune; the confirmation token is intentionally required.
115
137
 
116
- ## 7. Project state layout
138
+ ## 8. Project state layout
117
139
 
118
140
  ```text
119
141
  .ultra/
120
142
  ├── state.db # authoritative SQLite store
121
143
  ├── workflow-state.json # active workflow/recovery checkpoint
122
144
  ├── changes/
123
- │ ├── active/<id>/ # intent, delta, plan, compiled context, verification
145
+ │ ├── active/<id>/ # intent, delta, plan, context v2, learning, verification
124
146
  │ └── archive/ # converged packets after baseline reconciliation
125
147
  ├── tasks/ # projections and task contexts
126
148
  ├── specs/ # research/product/architecture artifacts
@@ -130,7 +152,7 @@ Archive before prune; the confirmation token is intentionally required.
130
152
  └── delivery-report.json
131
153
  ```
132
154
 
133
- ## 8. User handbook integration
155
+ ## 9. User handbook integration
134
156
 
135
157
  General engineering doctrine remains user-owned in `CLAUDE.md` or `AGENTS.md`.
136
158
  Ultra Builder Pro contributes one managed section only. Preview or apply it with:
@@ -140,12 +162,12 @@ ubp-handbook preview --runtime codex
140
162
  ubp-handbook apply --runtime codex
141
163
  ```
142
164
 
143
- Supported runtime names are `claude`, `codex`, and `opencode`. Apply creates a
165
+ Supported runtime names are `claude`, `codex`, `opencode`, and `kimi`. Apply creates a
144
166
  timestamped backup, replaces only the marked block, and can migrate the old
145
167
  Codex `## Ultra Builder Pro Runtime Contract` section without touching the next
146
168
  user section. Plugin adapters themselves do not silently overwrite handbooks.
147
169
 
148
- ## 9. Verification
170
+ ## 10. Verification
149
171
 
150
172
  Run `npm run test:all`, `python3 -m pytest hooks/tests -q`, and `npm audit`.
151
173
  Adapter tests assert the allowlisted assets, native manifests, hook boundary,
@@ -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
@@ -10,8 +10,9 @@
10
10
  > Kimi Code 采用各自 native plugin 呈现,其他旧 runtime adapter 已退役。下文所有与此冲突的
11
11
  > memory/hindsight 章节仅作为历史实施记录,不再是当前需求或运行时契约。
12
12
 
13
- **当前状态**:v0.9.0;四宿主 native plugin、29 个 live MCP tool、
14
- schema 9.1(15 表)、持续 change/context/convergence/doctor、incident debug lane、
13
+ **当前状态**:v0.11.0;四宿主 native plugin、32 个 live MCP tool、
14
+ schema 10.0(16 表)、portable Skill authoring contract、双轴 review、
15
+ Context Spine v2 / breadcrumb / spec-learning、持续 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
@@ -13,7 +13,7 @@ sharing one authoritative workflow store.
13
13
 
14
14
  **Distribution channels (v1.0)**: npm · Homebrew · pip.
15
15
 
16
- **Release line**: `0.9.x`; every release is gated by `npm run verify:release`.
16
+ **Release line**: `0.11.x`; every release is gated by `npm run verify:release`.
17
17
 
18
18
  ---
19
19
 
@@ -43,20 +43,21 @@ sharing one 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
@@ -46,7 +46,7 @@ not presented as nonexistent custom agents.
46
46
 
47
47
  | Lifecycle | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
48
48
  |---|---|---|---|---|
49
- | Session context/health | FULL, native `SessionStart` | DEGRADED, native context; health via `system.doctor` | FULL, native `SessionStart` | FULL, session-start skill + `SessionStart` hooks |
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
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
51
  | Pre-compact checkpoint | FULL | FULL | FULL | FULL, native `PreCompact` |
52
52
  | Post-compact context injection | FULL | FULL, native compacting context | FULL, native `PostCompact` restore | DEGRADED; checkpoint restoration runs, but Kimi 0.26/0.27 does not reinject fire-and-forget hook text |
@@ -69,12 +69,14 @@ generic post-edit policy.
69
69
  | Capability | Claude Code | OpenCode | Codex | Kimi Code 0.26+ |
70
70
  |---|---|---|---|---|
71
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 |
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 |
73
75
  | Host-native review/discovery/ask | native | native | documented in `codex-capability-map.json` | native Kimi tools and workers |
74
76
  | Durable authority | project `.ultra/state.db` | project `.ultra/state.db` | project `.ultra/state.db` | project `.ultra/state.db` |
75
77
  | Ultra memory API | N/A | N/A | N/A | N/A |
76
78
 
77
- All 29 `task.*`, `session.*`, `change.*`, `system.*`, and `plan.*` operations
79
+ All 32 `task.*`, `session.*`, `change.*`, `system.*`, and `plan.*` operations
78
80
  registered by `mcp-server/server.cjs` are live. Review, impact discovery, skill
79
81
  loading, and user interaction remain host-native surfaces.
80
82
 
@@ -121,9 +123,9 @@ records. Uninstall refuses an unmanaged or conflicting root.
121
123
 
122
124
  | Capability | Contract |
123
125
  |---|---|
124
- | Current state schema | `9.1` |
126
+ | Current state schema | `10.0` |
125
127
  | Runtime values | `claude`, `opencode`, `codex`, `kimi` |
126
- | Upgrade from pre-Kimi schema | transactionally rebuilds only constrained `events` and `sessions` tables |
128
+ | Upgrade from earlier schema | preserves Kimi runtime rows, adds Context Spine columns and `spec_learning_candidates` transactionally |
127
129
  | Preservation gate | rows, IDs, indexes, foreign keys, telemetry, incidents, and migration history remain intact |
128
130
  | Failure behavior | rollback; no partially upgraded authority database |
129
131
 
@@ -0,0 +1,75 @@
1
+ # Skill authoring contract
2
+
3
+ Ultra Builder Pro keeps one portable source workflow and adapts only runtime metadata
4
+ or host invocation details. This contract follows OpenAI Skills guidance and the Agent
5
+ Skills progressive-disclosure format:
6
+
7
+ - <https://learn.chatgpt.com/docs/build-skills>
8
+ - <https://learn.chatgpt.com/docs/customization/overview>
9
+ - <https://agentskills.io/specification>
10
+ - <https://agentskills.io/skill-creation/best-practices>
11
+
12
+ ## Surface ownership
13
+
14
+ | Content | Owner |
15
+ |---|---|
16
+ | Repeatable task procedure and conditional references | `skills/<name>/SKILL.md` |
17
+ | Codex display, invocation policy, and dependencies | `skills/<name>/agents/openai.yaml` after adaptation |
18
+ | Host launcher | `commands/<name>.md` |
19
+ | Durable repository or user engineering policy | `AGENTS.md` or the host equivalent |
20
+ | Deterministic lifecycle enforcement | one hook implementation |
21
+ | Live external data or actions | MCP server or connector |
22
+ | Bounded delegated role | `agents/<name>.md` |
23
+
24
+ Do not duplicate a rule across these surfaces.
25
+
26
+ ## Portable `SKILL.md`
27
+
28
+ Source frontmatter contains only `name` and `description`. The description says what
29
+ the Skill does and when it should activate. The body uses imperative, outcome-oriented
30
+ steps and includes only information an agent cannot reliably infer from the task,
31
+ repository, or host policy.
32
+
33
+ Keep the main file compact. Move conditional domain detail to `references/`, reusable
34
+ deterministic work to `scripts/`, and output material to `assets/`. Reference a file
35
+ only from the main workflow or one directly relevant reference.
36
+
37
+ ## Language
38
+
39
+ The standards do not prohibit Chinese. Ultra source prompts use English as a project
40
+ policy because one source is transformed for Claude Code, Codex, OpenCode, and Kimi
41
+ Code. The host or user instruction controls the response language; a workflow must not
42
+ hard-code the user's output language unless language is itself part of the task.
43
+
44
+ Maintainer documentation may use the language appropriate for its audience. English
45
+ source prompts are a portability rule, not a claim that multilingual Skills are invalid.
46
+
47
+ ## Content that does not belong in a Skill prompt
48
+
49
+ - release notes, migration history, old-version behavior, or implementation diary;
50
+ - host tool inventories, model pins, package paths, and dependency metadata shared by
51
+ only one runtime;
52
+ - generic engineering doctrine already owned by user or repository instructions;
53
+ - one-off project facts, volatile external facts, or copied datasets;
54
+ - duplicated command bodies, hook policy, MCP schemas, or private memory behavior;
55
+ - arbitrary coverage, confidence, complexity, option-count, or severity thresholds;
56
+ - pattern matching that turns TODOs, mocks, catch blocks, or line counts directly into
57
+ findings without a reachable impact;
58
+ - tutorial-style old/new or good/bad comparisons that do not change the workflow;
59
+ - menus of hypothetical alternatives when one repository default already satisfies the
60
+ contract.
61
+
62
+ Comparison is appropriate only when the task requires a real decision or verification:
63
+ compare credible alternatives against shared constraints, accepted specification
64
+ against delivered behavior, or independent analyses against authoritative evidence.
65
+
66
+ ## Review checklist
67
+
68
+ 1. Does the description state a precise use condition?
69
+ 2. Is every instruction reusable for this Skill rather than copied global policy?
70
+ 3. Is host-specific metadata outside the portable prompt?
71
+ 4. Does each conditional reference earn its context cost?
72
+ 5. Are judgments evidence-based rather than threshold-based?
73
+ 6. Are commands thin and agents bounded?
74
+ 7. Do positive and negative trigger evals cover accidental activation?
75
+ 8. Do source, four generated runtimes, and package contents pass validation?
@@ -7,8 +7,8 @@ only one small managed section describing its runtime boundary.
7
7
  ## Source and render targets
8
8
 
9
9
  `adapters/_shared/handbook.cjs` is the canonical source. It renders the common
10
- authority, memory, hook, agent, and package boundaries with host-native command
11
- syntax:
10
+ authority, Context Spine, specification-learning, memory, hook, agent, and
11
+ package boundaries with host-native command syntax:
12
12
 
13
13
  | Runtime | Default target | Main invocation form |
14
14
  |---|---|---|
@@ -20,6 +20,13 @@ syntax:
20
20
  The renderer never copies Claude Code-only APIs into Codex, OpenCode, or Kimi. Each
21
21
  host receives only its native invocation and collaboration names.
22
22
 
23
+ The managed block deliberately stays short. It says that `.ultra/state.db` is
24
+ authoritative; `change.context` compiles role/gate readiness, bounded references,
25
+ fresh-context budget, public seam, and exact verification; hooks inject only the
26
+ DB-derived `change.breadcrumb`; and unresolved specification learning or either
27
+ failed review axis blocks convergence. Detailed procedures remain in the plugin
28
+ skills so user handbooks do not accumulate duplicated prompt sediment.
29
+
23
30
  ## Managed-block contract
24
31
 
25
32
  The owned content is bounded by:
package/hooks/README.md CHANGED
@@ -7,10 +7,11 @@ bounded to the relevant Ultra projection or a non-terminal workflow.
7
7
  | Lifecycle | Hook | Purpose |
8
8
  |---|---|---|
9
9
  | Session start | `health_check.py` | Read-only integrity, incident, projection, session, and change-artifact checks |
10
- | Session start | `workflow_context.py` | Inject baseline/active workflow/change context and filtered provider metadata references |
11
- | Before edit | `active_task_context.py` | Protect `tasks.json` projection and restate an active task boundary |
10
+ | Shared helper | `context_spine.py` | Read the latest role/gate/readiness snapshot from state.db and derive one compact breadcrumb |
11
+ | Session start | `workflow_context.py` | Inject the DB-derived breadcrumb without intent or provider payloads |
12
+ | Before edit | `active_task_context.py` | Protect `tasks.json` and restate the same DB-derived task breadcrumb |
12
13
  | 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
+ | After compact/resume | `workflow_resume.py` | Prefer the DB breadcrumb; restore the minimal file checkpoint only when no active change owns recovery |
14
15
  | Stop | `pre_stop_check.py` | Block once when the Ultra workflow is incomplete |
15
16
  | Subagent lifecycle | `subagent_tracker.py` | Append lifecycle evidence under `.ultra/runtime/` |
16
17
 
@@ -18,7 +19,8 @@ The plugin deliberately does not capture prompts, tool observations, transcripts
18
19
  cross-session memory or code-graph content. Generic command blocking and post-edit policy are
19
20
  user/repository governance. Persistent Memory/graph content belongs to separately installed providers.
20
21
 
21
- The checkpoint is a recovery artifact, not a second authority. A valid newer
22
+ `context_spine.py` is an imported library, not an eighth lifecycle registration.
23
+ Registering it separately would duplicate hook execution. The checkpoint is a recovery artifact, not a second authority. A valid newer
22
24
  live workflow wins; a newer valid checkpoint may restore a missing or older
23
25
  live file; corrupt, non-object, or terminal checkpoints are ignored.
24
26