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,92 +1,52 @@
1
1
  ---
2
2
  name: ultra-verify
3
- description: Run independent two-model verification with the current host as primary and a read-only Codex advisor, then verify and synthesize the evidence.
3
+ description: Run independent two-model verification with the current host as primary and a read-only external advisor, then verify and synthesize both evidence sets. Use only when the user explicitly requests cross-model verification.
4
4
  ---
5
5
 
6
- # Ultra Verify — Independent Two-Model Verification
6
+ # Run independent cross-model verification
7
7
 
8
- Claude Code remains primary. It writes the first independent analysis, verifies consequential
9
- claims, and owns the final answer. Codex is an untrusted read-only advisor. Use this workflow only
10
- when the user explicitly asks for cross-model verification.
8
+ Claude Code writes the first analysis, verifies consequential claims, and owns the
9
+ final answer. Codex is an untrusted read-only advisor.
11
10
 
12
11
  ## Modes
13
12
 
14
- - `decision <question>`: architecture or product decision.
15
- - `diagnose <symptoms>`: independent root-cause hypotheses.
16
- - `audit <scope>`: evidence-backed findings.
17
- - `estimate <task>`: estimates with explicit assumptions.
18
-
19
- ## Preconditions
20
-
21
- 1. Confirm `codex --version` plus authentication.
22
- 2. Define the exact workspace, question, evidence standard, and response shape.
23
- 3. Do not send secrets, unrelated files, or an unbounded home directory.
24
- 4. Track four steps in the current host plan: primary analysis, advisor launch, completion wait,
25
- and verified synthesis.
26
-
27
- ## 1. Create the session and write the primary view
28
-
29
- ```bash
30
- SESSION_ID="$(date +%Y%m%d-%H%M%S)-verify-<mode>"
31
- SESSION_PATH=".ultra/collab/${SESSION_ID}"
32
- mkdir -p "${SESSION_PATH}"
33
- ```
34
-
35
- Write Claude Code's evidence-backed analysis to `${SESSION_PATH}/claude-analysis.md` before
36
- reading the advisor output. Record the mode, checkout, scope, and evidence boundary.
37
-
38
- ## 2. Launch the advisor read-only
39
-
40
- Give the advisor the bounded raw question and evidence without the primary conclusion.
41
-
42
- ```bash
43
- codex exec -s read-only \
44
- -o "${SESSION_PATH}/codex-output.md" \
45
- "<bounded prompt>" \
46
- 2> "${SESSION_PATH}/codex-error.log"
47
- ```
48
-
49
- Never enable write-capable automation, danger-full-access, or permission bypass for the advisor.
50
-
51
- ## 3. Wait for completed output
52
-
53
- Run the bundled waiter in an asynchronous or yielded shell session and poll it at bounded
54
- intervals; never hold one blocking tool call longer than 60 seconds.
55
-
56
- ```bash
57
- python3 "$CLAUDE_PLUGIN_ROOT/skills/ultra-verify/scripts/verify_wait.py" \
58
- "${SESSION_PATH}" --timeout 1200
59
- ```
60
-
61
- The waiter reports the advisor as `complete`, `failed`, `empty`, or `pending`. Read the output only
62
- after its status is `complete` and the file is non-empty. Preserve the error log when it fails.
63
-
64
- ## 4. Verify and synthesize
65
-
66
- Compare `claude-analysis.md` with `codex-output.md`:
67
-
68
- 1. Verify claims against the current checkout, tests, runtime, or primary documentation.
69
- 2. Separate verified agreement, useful dissent, and unsupported assertions.
70
- 3. Explain scope, version, and assumption differences before judging the result.
71
- 4. Write `synthesis.md` and `metadata.json`, then return one Claude Code-owned conclusion.
72
-
73
- Use `references/confidence-system.md` for evidence-based confidence and
74
- `references/cross-verify-modes.md` for mode-specific expectations. Model agreement never overrides
75
- failing tests or authoritative runtime evidence.
76
-
77
- ## Degraded operation
78
-
79
- - Advisor failure: return the primary analysis with an explicit single-source warning.
80
- - Never block the underlying user task solely because the advisor is absent, unauthenticated, or
81
- slow.
82
-
83
- ## Session files
84
-
85
- ```text
86
- .ultra/collab/<SESSION_ID>/
87
- claude-analysis.md
88
- codex-output.md
89
- codex-error.log
90
- metadata.json
91
- synthesis.md
92
- ```
13
+ - `decision`: one consequential architecture or product choice;
14
+ - `diagnose`: independent root-cause hypotheses;
15
+ - `audit`: evidence-backed findings over a bounded scope;
16
+ - `estimate`: an estimate with explicit assumptions and uncertainty.
17
+
18
+ ## Workflow
19
+
20
+ 1. Confirm the advisor CLI and authentication. Define the exact workspace, question,
21
+ evidence standard, and response shape. Exclude secrets and unrelated files.
22
+ 2. Create `.ultra/collab/<session-id>/` and write the primary host's evidence-backed
23
+ analysis to `claude-analysis.md` before reading advisor output.
24
+ 3. Launch Codex with the raw bounded question and evidence in a read-only sandbox. Do
25
+ not include the primary conclusion when independence matters:
26
+
27
+ ```bash
28
+ codex exec -s read-only \
29
+ -a never \
30
+ --ephemeral \
31
+ --ignore-user-config \
32
+ --ignore-rules \
33
+ -o "${SESSION_PATH}/codex-output.md" \
34
+ "<bounded prompt>" \
35
+ 2> "${SESSION_PATH}/codex-error.log"
36
+ ```
37
+ 4. Run `scripts/verify_wait.py` resolved relative to this skill directory. Use a
38
+ yielded or asynchronous shell session and poll at bounded intervals; do not hold a
39
+ blocking tool call longer than one minute.
40
+ 5. Read advisor output only after the waiter reports a complete, non-empty file.
41
+ 6. Verify both analyses against the current checkout, tests, runtime, or primary
42
+ documentation. Explain scope, version, evidence, and assumption differences before
43
+ judging disagreement.
44
+ 7. Write session metadata and a synthesis artifact, then return one host-owned
45
+ conclusion.
46
+
47
+ Read `references/cross-verify-modes.md` for mode-specific evidence and
48
+ `references/confidence-system.md` when confidence language is useful. Model agreement
49
+ never overrides failing tests or authoritative runtime evidence.
50
+
51
+ Advisor failure degrades to the primary analysis with a single-source warning. It does
52
+ not block the user's underlying task.
@@ -2,47 +2,44 @@
2
2
  "skill_name": "ultra-verify",
3
3
  "evals": [
4
4
  {
5
- "id": 1,
6
- "prompt": "/ultra-verify decision 'Should we use PostgreSQL or MongoDB for our new microservice?'",
7
- "expected_output": "Claude writes its analysis first, launches Codex read-only, verifies both analyses, and returns one evidence-backed synthesis",
5
+ "id": "explicit-decision",
6
+ "prompt": "Run independent cross-model verification on the database choice, with the current host writing its view before the advisor.",
7
+ "should_trigger": true,
8
8
  "assertions": [
9
- "Claude writes its own analysis before reading advisor output",
10
- "Launches Codex with a read-only sandbox",
11
- "Creates a session directory under .ultra/collab/",
9
+ "Writes the primary analysis before reading advisor output",
10
+ "Launches the advisor in a read-only sandbox",
11
+ "Uses a bounded session directory and completion waiter",
12
12
  "Verifies consequential claims against authoritative evidence",
13
- "Separates verified agreement, useful dissent, and unsupported assertions"
13
+ "Returns one host-owned synthesis"
14
14
  ]
15
15
  },
16
16
  {
17
- "id": 2,
18
- "prompt": "/ultra-verify diagnose 'API returns 500 intermittently under load'",
19
- "expected_output": "Independent hypotheses are reconciled through discriminating checks and evidence strength",
17
+ "id": "explicit-diagnosis",
18
+ "prompt": "Use two independent models to diagnose the intermittent 500 response and reconcile their hypotheses with discriminating checks.",
19
+ "should_trigger": true,
20
20
  "assertions": [
21
- "Both analyses provide ranked hypotheses",
22
- "Duplicate hypotheses are merged by root cause",
23
- "Each retained hypothesis includes a verification step",
24
- "Investigation order follows evidence strength and verification cost"
21
+ "Keeps both initial hypotheses independent",
22
+ "Deduplicates by root cause after both outputs complete",
23
+ "Orders verification by evidence and diagnostic value",
24
+ "Does not decide by model vote"
25
25
  ]
26
26
  },
27
27
  {
28
- "id": 3,
29
- "prompt": "/ultra-verify audit",
30
- "expected_output": "Findings are deduplicated and verified against the current checkout without vote-based severity",
28
+ "id": "ordinary-analysis-negative",
29
+ "prompt": "Should this service use PostgreSQL or MongoDB?",
30
+ "should_trigger": false,
31
31
  "assertions": [
32
- "Uses the same scope and severity model for both analyses",
33
- "Verifies every reported location",
34
- "Retains uniquely reported findings when source evidence confirms them",
35
- "Severity does not depend on model agreement"
32
+ "Answers with the ordinary analysis workflow",
33
+ "Does not launch an external advisor without explicit cross-model intent"
36
34
  ]
37
35
  },
38
36
  {
39
- "id": 4,
40
- "prompt": "/ultra-verify estimate 'Implement OAuth2 login with two providers'",
41
- "expected_output": "Two estimates are reconciled by scope, assumptions, dependencies, and risk",
37
+ "id": "ordinary-review-negative",
38
+ "prompt": "Review these changes before I commit.",
39
+ "should_trigger": false,
42
40
  "assertions": [
43
- "Both analyses include work breakdowns and assumptions",
44
- "Large differences are explained rather than averaged mechanically",
45
- "Final range is supported by the reconciled work breakdown"
41
+ "Uses the standard review workflow",
42
+ "Does not substitute cross-model verification for native review"
46
43
  ]
47
44
  }
48
45
  ]
@@ -105,6 +105,9 @@ as a fallback unless `ultra-tools <family> --help` lists it.
105
105
  | `change.get` | `change get` | 9 | any |
106
106
  | `change.list` | `change list` | 9 | any |
107
107
  | `change.context` | `change context` | 9 | mcp |
108
+ | `change.breadcrumb` | `change breadcrumb` | 10 | any |
109
+ | `change.learning_propose` | `change learning-propose` | 10 | mcp |
110
+ | `change.learning_resolve` | `change learning-resolve` | 10 | mcp |
108
111
  | `change.converge` | `change converge` | 9 | mcp |
109
112
  | `change.archive` | `change archive` | 9 | mcp |
110
113
  | `system.doctor` | `system doctor` | 9 | mcp |
@@ -3,7 +3,7 @@
3
3
  # Validated by spec/schemas/mcp-tools.schema.json (run `npm run test:spec`).
4
4
  # Trace: PLAN §7.3, decisions D12 / D29 / D31-D34.
5
5
 
6
- version: '1.0'
6
+ version: '1.1'
7
7
 
8
8
  info:
9
9
  title: Ultra Builder Pro MCP tool contracts
@@ -398,6 +398,8 @@ tools:
398
398
  - change_blocked
399
399
  - change_converged
400
400
  - change_archived
401
+ - spec_learning_proposed
402
+ - spec_learning_resolved
401
403
  payload: { type: object }
402
404
  output_schema:
403
405
  type: object
@@ -759,7 +761,7 @@ tools:
759
761
 
760
762
  - name: change.get
761
763
  family: change
762
- description: Read one continuous change unit from authoritative state.
764
+ description: Read one continuous change unit and its specification-learning candidates from authoritative state.
763
765
  phase: '9'
764
766
  readonly: true
765
767
  input_schema:
@@ -805,8 +807,8 @@ tools:
805
807
 
806
808
  - name: change.context
807
809
  family: change
808
- description: Compile an inspectable task context manifest from Ultra state and external provider metadata references.
809
- phase: '9'
810
+ description: Compile a role-scoped Context Spine manifest with readiness, budget, execution seam, and next-action evidence.
811
+ phase: '10'
810
812
  writer_role: mcp
811
813
  input_schema:
812
814
  type: object
@@ -815,7 +817,37 @@ tools:
815
817
  properties:
816
818
  id: { type: string }
817
819
  task_id: { type: string }
820
+ role: { type: string, enum: [plan, implement, check, review] }
821
+ gate: { type: string, enum: [alignment, planning, implementation, verification, review, convergence, recovery] }
822
+ next_action: { type: string, minLength: 3 }
818
823
  spec_refs: { type: array, items: { type: object } }
824
+ context_refs:
825
+ type: array
826
+ maxItems: 64
827
+ items:
828
+ type: object
829
+ required: [ref, reason]
830
+ additionalProperties: false
831
+ properties:
832
+ ref: { type: string, minLength: 1 }
833
+ kind: { type: string, enum: [spec, source, test, docs, external], default: source }
834
+ reason: { type: string, minLength: 3 }
835
+ required: { type: boolean, default: true }
836
+ digest: { type: string, pattern: '^[0-9a-f]{64}$' }
837
+ budget:
838
+ type: object
839
+ additionalProperties: false
840
+ properties:
841
+ max_tokens: { type: integer, minimum: 1, default: 12000 }
842
+ max_files: { type: integer, minimum: 1, default: 12 }
843
+ execution_contract:
844
+ type: object
845
+ additionalProperties: false
846
+ properties:
847
+ slice_kind: { type: string, enum: [tracer_bullet, expand_contract, integration_checkpoint], default: tracer_bullet }
848
+ public_seam: { type: string }
849
+ verification_command: { type: string }
850
+ context_budget_percent: { type: integer, minimum: 1, maximum: 100, default: 40 }
819
851
  allowed_paths: { type: array, items: { type: string } }
820
852
  provider_refs:
821
853
  type: object
@@ -852,12 +884,96 @@ tools:
852
884
  manifest_hash: { type: string, pattern: '^[0-9a-f]{64}$' }
853
885
  manifest: { type: object }
854
886
  errors:
887
+ - { code: VALIDATION_ERROR, description: 'context role, gate, references, budget, or execution contract is invalid' }
855
888
  - { code: CHANGE_NOT_FOUND, description: 'change id does not exist' }
856
889
  - { code: CHANGE_TERMINAL, description: 'terminal change cannot compile a new context' }
890
+ - { code: TASK_NOT_FOUND, description: 'task id is not linked to the change' }
857
891
  - { code: PROVIDER_CONTENT_FORBIDDEN, description: 'provider payload content must remain external' }
858
892
  cli_subcommand: change context
859
893
  emits_events: [context_updated]
860
894
 
895
+ - name: change.breadcrumb
896
+ family: change
897
+ description: Read the compact DB-derived Context Spine position, readiness, and single recommended next action.
898
+ phase: '10'
899
+ readonly: true
900
+ writer_role: any
901
+ input_schema:
902
+ type: object
903
+ additionalProperties: false
904
+ properties:
905
+ id: { type: string }
906
+ output_schema:
907
+ type: object
908
+ required: [breadcrumb]
909
+ additionalProperties: false
910
+ properties:
911
+ breadcrumb: { type: object }
912
+ errors:
913
+ - { code: CHANGE_NOT_FOUND, description: 'explicit change id does not exist' }
914
+ - { code: STATE_DB_ERROR, description: 'runtime state could not be read' }
915
+ cli_subcommand: change breadcrumb
916
+ emits_events: []
917
+
918
+ - name: change.learning_propose
919
+ family: change
920
+ description: Propose one stable implementation discovery for approval-gated baseline specification convergence.
921
+ phase: '10'
922
+ writer_role: mcp
923
+ input_schema:
924
+ type: object
925
+ required: [change_id, target_ref, summary]
926
+ additionalProperties: false
927
+ properties:
928
+ id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
929
+ change_id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
930
+ task_id: { type: string }
931
+ target_ref: { type: string, minLength: 1 }
932
+ summary: { type: string, minLength: 3 }
933
+ evidence: { type: array, items: { type: string, minLength: 1 } }
934
+ output_schema:
935
+ type: object
936
+ required: [candidate]
937
+ additionalProperties: false
938
+ properties:
939
+ candidate: { type: object }
940
+ errors:
941
+ - { code: VALIDATION_ERROR, description: 'candidate id, target, summary, or evidence is invalid' }
942
+ - { code: CHANGE_NOT_FOUND, description: 'change id does not exist' }
943
+ - { code: CHANGE_NOT_MUTABLE, description: 'learning must resolve before convergence' }
944
+ - { code: TASK_NOT_FOUND, description: 'task is not linked to the change' }
945
+ - { code: DUPLICATE_LEARNING_ID, description: 'candidate id already exists' }
946
+ cli_subcommand: change learning-propose
947
+ emits_events: [spec_learning_proposed]
948
+
949
+ - name: change.learning_resolve
950
+ family: change
951
+ description: Approve, reject, or mark applied one specification-learning candidate through a guarded state transition.
952
+ phase: '10'
953
+ writer_role: mcp
954
+ input_schema:
955
+ type: object
956
+ required: [change_id, candidate_id, decision]
957
+ additionalProperties: false
958
+ properties:
959
+ change_id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
960
+ candidate_id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
961
+ decision: { type: string, enum: [approve, reject, apply] }
962
+ resolution: { type: string }
963
+ output_schema:
964
+ type: object
965
+ required: [candidate]
966
+ additionalProperties: false
967
+ properties:
968
+ candidate: { type: object }
969
+ errors:
970
+ - { code: VALIDATION_ERROR, description: 'decision or required resolution is invalid' }
971
+ - { code: CHANGE_NOT_FOUND, description: 'change id does not exist' }
972
+ - { code: LEARNING_NOT_FOUND, description: 'candidate id does not exist for the change' }
973
+ - { code: ILLEGAL_LEARNING_TRANSITION, description: 'candidate state transition is not permitted' }
974
+ cli_subcommand: change learning-resolve
975
+ emits_events: [spec_learning_resolved]
976
+
861
977
  - name: change.converge
862
978
  family: change
863
979
  description: Deterministically verify task, spec, test, documentation, review, context, and incident diagnosis structure before closure.
@@ -880,6 +996,19 @@ tools:
880
996
  category: { type: string, enum: [diagnosis, diff, tests, spec, docs, review] }
881
997
  status: { type: string, enum: [pass, fail, not_applicable] }
882
998
  evidence: { type: string, minLength: 3 }
999
+ axis: { type: string, enum: [spec_fidelity, engineering_standards] }
1000
+ seam: { type: string, minLength: 3 }
1001
+ signal:
1002
+ type: object
1003
+ additionalProperties: false
1004
+ required: [command, expected_red, observed_red, observed_green, deterministic]
1005
+ properties:
1006
+ command: { type: string, minLength: 3 }
1007
+ expected_red: { type: string, minLength: 3 }
1008
+ observed_red: { type: boolean }
1009
+ observed_green: { type: boolean }
1010
+ deterministic: { type: boolean }
1011
+ duration_ms: { type: number, minimum: 0 }
883
1012
  output_schema:
884
1013
  type: object
885
1014
  required: [ready, status, blockers]
@@ -1,47 +1,29 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://ultra-builder-pro.dev/spec/command-manifest.schema.json",
4
- "title": "Command manifest (frontmatter)",
5
- "description": "YAML frontmatter contract for commands/ultra-*.md thin-shell files. Phase 3 薄壳化: 命令文件 ≤ 80 行正文,真实 workflow 放 skills/<name>/SKILL.md。additionalProperties=false (PLAN R19).",
4
+ "title": "Ultra command launcher frontmatter",
5
+ "description": "Portable source contract for a thin command launcher. Runtime metadata and workflow procedure belong outside the command file.",
6
6
  "type": "object",
7
- "required": ["description"],
7
+ "required": ["description", "workflow-ref"],
8
8
  "additionalProperties": false,
9
9
  "properties": {
10
10
  "description": {
11
11
  "type": "string",
12
12
  "minLength": 10,
13
- "description": "一句话触发描述; 给 runtime 的 skill router / 用户命令列表使用"
13
+ "maxLength": 240,
14
+ "description": "Concise user-visible action description."
14
15
  },
15
16
  "argument-hint": {
16
17
  "oneOf": [
17
18
  { "type": "string" },
18
19
  { "type": "array", "items": { "type": "string" }, "minItems": 1 }
19
20
  ],
20
- "description": "Claude Code convention: hint shown after slash-command name. Both `argument-hint: [foo]` (YAML array form) and `argument-hint: \"[foo]\"` (string form) are accepted."
21
- },
22
- "allowed-tools": {
23
- "type": "string",
24
- "description": "Claude Code convention: comma-separated tool allowlist"
25
- },
26
- "model": {
27
- "type": "string",
28
- "enum": ["haiku", "sonnet", "opus"],
29
- "description": "Claude Code convention: model routing hint"
21
+ "description": "Optional host launcher hint; it does not define argument semantics."
30
22
  },
31
23
  "workflow-ref": {
32
24
  "type": "string",
33
25
  "pattern": "^@skills/[a-z][a-z0-9\\-]*/SKILL\\.md$",
34
- "description": "Phase 3 薄壳关键字段: 指向 skills/<name>/SKILL.md; 存在即表示该命令已迁为薄壳"
35
- },
36
- "mcp_tools_required": {
37
- "type": "array",
38
- "items": { "type": "string", "pattern": "^[a-z]+\\.[a-z_]+$" },
39
- "uniqueItems": true,
40
- "description": "Phase 3+: 命令运行时会调用的 MCP tool 名单; 无 MCP 时走 cli_fallback"
41
- },
42
- "cli_fallback": {
43
- "type": "string",
44
- "description": "Phase 3+: MCP 不可达时回退的 ultra-tools 子命令 (e.g. 'init' -> 'ultra-tools init')"
26
+ "description": "The single Skill that owns this workflow."
45
27
  }
46
28
  }
47
29
  }
@@ -1,94 +1,24 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://ultra-builder-pro.dev/spec/skill-manifest.schema.json",
4
- "title": "Skill manifest (frontmatter)",
5
- "description": "YAML frontmatter contract for skills/*/SKILL.md. Strict additionalProperties=false: any new field must be added here AND propagated through validate-skills.cjs (PLAN R19 single-source rule).",
4
+ "title": "Portable Agent Skill frontmatter",
5
+ "description": "Canonical source contract for skills/*/SKILL.md. Host invocation policy, UI metadata, runtime dependencies, and command hints belong in adapters or host-native metadata, not model instructions.",
6
6
  "type": "object",
7
7
  "required": ["name", "description"],
8
8
  "additionalProperties": false,
9
9
  "properties": {
10
10
  "name": {
11
11
  "type": "string",
12
- "pattern": "^[a-z][a-z0-9\\-]*$",
13
- "description": "kebab-case slug; matches the directory name"
12
+ "minLength": 1,
13
+ "maxLength": 64,
14
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
15
+ "description": "Portable Agent Skills name; must match the parent directory."
14
16
  },
15
17
  "description": {
16
18
  "type": "string",
17
19
  "minLength": 10,
18
- "description": "human-readable trigger sentence consumed by the runtime's skill router"
19
- },
20
- "runtime": {
21
- "oneOf": [
22
- { "type": "string", "enum": ["claude", "opencode", "codex", "kimi", "all"] },
23
- {
24
- "type": "array",
25
- "items": { "type": "string", "enum": ["claude", "opencode", "codex", "kimi"] },
26
- "minItems": 1,
27
- "uniqueItems": true
28
- }
29
- ],
30
- "description": "v4.5 — which runtime(s) this skill targets. Defaults to 'all' when absent (Phase 4 adapter installs everywhere)."
31
- },
32
- "mcp_tools_required": {
33
- "type": "array",
34
- "items": { "type": "string", "pattern": "^[a-z]+\\.[a-z_]+$" },
35
- "uniqueItems": true,
36
- "description": "v4.5 — MCP tool names this skill calls; Phase 3+ generators verify availability"
37
- },
38
- "cli_fallback": {
39
- "type": "string",
40
- "description": "v4.5 — ultra-tools subcommand to fall back to when MCP unreachable"
41
- },
42
- "complexity_hint": {
43
- "type": "string",
44
- "enum": ["haiku", "sonnet", "opus"],
45
- "description": "v4.5 — model routing hint (Phase 7+)"
46
- },
47
- "argument-hint": {
48
- "type": "string",
49
- "description": "Claude Code convention: hint shown after slash-command name"
50
- },
51
- "allowed-tools": {
52
- "type": "string",
53
- "description": "Claude Code convention: comma-separated tool allowlist"
54
- },
55
- "user-invocable": {
56
- "type": "boolean",
57
- "description": "Claude Code convention: can the user call this via slash command"
58
- },
59
- "disable-model-invocation": {
60
- "type": "boolean",
61
- "description": "Claude Code convention: skill is not auto-invoked by the model"
62
- },
63
- "context": {
64
- "type": "string",
65
- "enum": ["fork", "main"],
66
- "description": "Claude Code convention: 'fork' isolates skill output from main conversation"
67
- },
68
- "license": {
69
- "type": "string",
70
- "description": "third-party skill license (e.g. MIT)"
71
- },
72
- "metadata": {
73
- "type": "object",
74
- "additionalProperties": true,
75
- "properties": {
76
- "author": { "type": "string" },
77
- "version": { "type": "string" }
78
- },
79
- "description": "third-party metadata block (vercel skills, etc.)"
80
- }
81
- },
82
- "allOf": [
83
- {
84
- "if": { "required": ["user-invocable"], "properties": { "user-invocable": { "const": true } } },
85
- "then": {
86
- "not": {
87
- "required": ["disable-model-invocation"],
88
- "properties": { "disable-model-invocation": { "const": true } }
89
- },
90
- "errorMessage": "user-invocable=true cannot coexist with disable-model-invocation=true"
91
- }
20
+ "maxLength": 1024,
21
+ "description": "Concise discovery metadata that states both what the skill does and when to use it."
92
22
  }
93
- ]
23
+ }
94
24
  }
@@ -197,11 +197,40 @@ CREATE TABLE IF NOT EXISTS context_snapshots (
197
197
  provider_refs_json TEXT NOT NULL DEFAULT '{}',
198
198
  manifest_path TEXT NOT NULL,
199
199
  manifest_hash TEXT NOT NULL,
200
+ role TEXT NOT NULL DEFAULT 'plan'
201
+ CHECK (role IN ('plan', 'implement', 'check', 'review')),
202
+ gate TEXT NOT NULL DEFAULT 'alignment'
203
+ CHECK (gate IN ('alignment', 'planning', 'implementation', 'verification', 'review', 'convergence', 'recovery')),
204
+ next_action TEXT NOT NULL DEFAULT 'Resolve the next Ultra workflow action.',
205
+ readiness TEXT NOT NULL DEFAULT 'ready'
206
+ CHECK (readiness IN ('ready', 'blocked')),
207
+ blockers_json TEXT NOT NULL DEFAULT '[]',
208
+ context_json TEXT NOT NULL DEFAULT '{}',
209
+ token_estimate INTEGER NOT NULL DEFAULT 0 CHECK (token_estimate >= 0),
210
+ token_budget INTEGER NOT NULL DEFAULT 12000 CHECK (token_budget > 0),
200
211
  created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
201
212
  );
202
213
 
203
214
  CREATE INDEX IF NOT EXISTS context_snapshots_change ON context_snapshots(change_id, created_at);
204
215
 
216
+ CREATE TABLE IF NOT EXISTS spec_learning_candidates (
217
+ id TEXT PRIMARY KEY,
218
+ change_id TEXT NOT NULL REFERENCES changes(id) ON DELETE CASCADE,
219
+ task_id TEXT REFERENCES tasks(id) ON DELETE SET NULL,
220
+ target_ref TEXT NOT NULL,
221
+ summary TEXT NOT NULL,
222
+ evidence_json TEXT NOT NULL DEFAULT '[]',
223
+ status TEXT NOT NULL DEFAULT 'proposed'
224
+ CHECK (status IN ('proposed', 'approved', 'rejected', 'applied')),
225
+ resolution TEXT,
226
+ proposed_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
227
+ resolved_at TEXT,
228
+ applied_at TEXT
229
+ );
230
+
231
+ CREATE INDEX IF NOT EXISTS spec_learning_change
232
+ ON spec_learning_candidates(change_id, status, proposed_at);
233
+
205
234
  CREATE TABLE IF NOT EXISTS trace_links (
206
235
  id INTEGER PRIMARY KEY AUTOINCREMENT,
207
236
  change_id TEXT NOT NULL REFERENCES changes(id) ON DELETE CASCADE,
@@ -274,3 +303,5 @@ INSERT OR IGNORE INTO schema_version (version, description)
274
303
  VALUES ('9.0', 'Continuous change units, context snapshots, trace links, incidents, projection outbox, and durable consumers');
275
304
  INSERT OR IGNORE INTO schema_version (version, description)
276
305
  VALUES ('9.1', 'Kimi runtime support in durable events and sessions');
306
+ INSERT OR IGNORE INTO schema_version (version, description)
307
+ VALUES ('10.0', 'Role-scoped context snapshots, deterministic breadcrumbs, and approval-gated specification learning');