ultra-builder-pro-cli 0.9.0 → 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 (52) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +11 -6
  3. package/adapters/_shared/codex-assets.cjs +10 -0
  4. package/adapters/_shared/handbook.cjs +2 -0
  5. package/adapters/_shared/runtime-assets.cjs +1 -0
  6. package/adapters/_shared/tests/handbook.test.cjs +3 -0
  7. package/adapters/_shared/tests/runtime-assets.test.cjs +1 -0
  8. package/adapters/kimi.js +2 -2
  9. package/adapters/opencode.js +46 -17
  10. package/adapters/tests/claude.test.cjs +4 -1
  11. package/adapters/tests/codex.test.cjs +4 -3
  12. package/adapters/tests/kimi.test.cjs +6 -2
  13. package/adapters/tests/opencode.test.cjs +46 -3
  14. package/docs/AGENT-CONTEXT.md +34 -12
  15. package/docs/ARCHITECTURE.md +31 -5
  16. package/docs/PLAN.zh-CN.md +3 -2
  17. package/docs/ROADMAP.md +5 -4
  18. package/docs/RUNTIME-COMPAT-MATRIX.md +7 -5
  19. package/docs/USER-HANDBOOK-CONTRACT.md +9 -2
  20. package/hooks/README.md +6 -4
  21. package/hooks/active_task_context.py +14 -0
  22. package/hooks/context_spine.py +218 -0
  23. package/hooks/health_check.py +1 -1
  24. package/hooks/workflow_context.py +16 -123
  25. package/hooks/workflow_resume.py +21 -0
  26. package/mcp-server/lib/change-workflow.cjs +89 -11
  27. package/mcp-server/lib/change-workflow.test.cjs +202 -7
  28. package/mcp-server/lib/context-spine.cjs +331 -0
  29. package/mcp-server/lib/context-spine.test.cjs +73 -0
  30. package/mcp-server/lib/spec-learning.cjs +191 -0
  31. package/mcp-server/lib/spec-learning.test.cjs +62 -0
  32. package/mcp-server/lib/state-db.cjs +72 -10
  33. package/mcp-server/lib/state-db.test.cjs +7 -2
  34. package/mcp-server/server.cjs +31 -1
  35. package/mcp-server/tests/db-ops.test.cjs +3 -3
  36. package/mcp-server/tests/server-contract.test.cjs +74 -0
  37. package/mcp-server/tests/state-db.test.cjs +20 -3
  38. package/package.json +1 -1
  39. package/skills/learn/SKILL.md +1 -0
  40. package/skills/ultra-change/SKILL.md +91 -118
  41. package/skills/ultra-deliver/SKILL.md +93 -221
  42. package/skills/ultra-dev/SKILL.md +81 -310
  43. package/skills/ultra-doctor/SKILL.md +1 -0
  44. package/skills/ultra-init/SKILL.md +1 -0
  45. package/skills/ultra-plan/SKILL.md +72 -292
  46. package/skills/ultra-review/SKILL.md +79 -407
  47. package/skills/ultra-status/SKILL.md +55 -168
  48. package/skills/ultra-test/SKILL.md +64 -183
  49. package/skills/ultra-think/SKILL.md +1 -0
  50. package/spec/cli-protocol.md +3 -0
  51. package/spec/mcp-tools.yaml +133 -4
  52. package/spec/schemas/state-db.sql +31 -0
@@ -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]
@@ -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');