@kontextmind/kxm 0.6.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 (227) hide show
  1. package/.claude-plugin/marketplace.json +19 -0
  2. package/.kxm/README.md +14 -0
  3. package/.kxm/assets/README.md +5 -0
  4. package/.kxm/assets/retrospectives/README.md +5 -0
  5. package/.kxm/config/README.md +5 -0
  6. package/.kxm/config/agents.json +43 -0
  7. package/.kxm/config/env.example +56 -0
  8. package/.kxm/config/update.example.yaml +9 -0
  9. package/.kxm/config/workflows/fix.json +160 -0
  10. package/.kxm/config/workflows/jira-development.json +116 -0
  11. package/.kxm/config/workflows/provenance-quorum.json +150 -0
  12. package/.kxm/config/workflows/v04-dogfood.json +72 -0
  13. package/CHANGELOG.md +465 -0
  14. package/LICENSE +21 -0
  15. package/README.md +306 -0
  16. package/SECURITY.md +72 -0
  17. package/docs/README.md +48 -0
  18. package/docs/agent-communication-envelopes-and-gates.md +553 -0
  19. package/docs/architecture.md +242 -0
  20. package/docs/assignment-runner.md +241 -0
  21. package/docs/configuration.md +361 -0
  22. package/docs/continuous-improvement.md +114 -0
  23. package/docs/getting-started.md +253 -0
  24. package/docs/kxm-handbook.md +1090 -0
  25. package/docs/operations.md +205 -0
  26. package/docs/provenance-gates.md +291 -0
  27. package/docs/skills.md +45 -0
  28. package/docs/templates/README.md +95 -0
  29. package/docs/templates/adr.md +88 -0
  30. package/docs/templates/architecture.md +120 -0
  31. package/docs/templates/bug-fix.md +109 -0
  32. package/docs/templates/feature.md +108 -0
  33. package/docs/templates/handoff.md +72 -0
  34. package/docs/templates/postmortem.md +77 -0
  35. package/docs/templates/research.md +100 -0
  36. package/docs/templates/review.md +85 -0
  37. package/docs/templates/runbook.md +73 -0
  38. package/docs/templates/test-plan.md +87 -0
  39. package/docs/templates/test-report.md +72 -0
  40. package/docs/test-matrix.md +121 -0
  41. package/docs/troubleshooting.md +249 -0
  42. package/docs/vnext/README.md +62 -0
  43. package/docs/vnext/architecture.md +185 -0
  44. package/docs/vnext/effects-and-recovery.md +172 -0
  45. package/docs/vnext/lifecycles.md +235 -0
  46. package/docs/vnext/migration.md +220 -0
  47. package/docs/vnext/routing.md +184 -0
  48. package/docs/vnext/synchronization.md +172 -0
  49. package/docs/vnext/terminology.md +240 -0
  50. package/docs/vnext/validation.md +335 -0
  51. package/docs/webhook-workflows.md +240 -0
  52. package/docs/workflow-guide.md +1150 -0
  53. package/examples/README.md +102 -0
  54. package/examples/provenance-workflow.json +40 -0
  55. package/examples/requester.ts +30 -0
  56. package/examples/reviewer-agent.ts +29 -0
  57. package/examples/roundtrip.ts +46 -0
  58. package/examples/vnext/.kxm/agents/coordinator.yaml +16 -0
  59. package/examples/vnext/.kxm/agents/critic-1.yaml +16 -0
  60. package/examples/vnext/.kxm/agents/critic-2.yaml +15 -0
  61. package/examples/vnext/.kxm/agents/critic-3.yaml +15 -0
  62. package/examples/vnext/.kxm/agents/implementer.yaml +15 -0
  63. package/examples/vnext/.kxm/agents/planner.yaml +13 -0
  64. package/examples/vnext/.kxm/agents/reproducer.yaml +15 -0
  65. package/examples/vnext/.kxm/agents/reviewer.yaml +15 -0
  66. package/examples/vnext/.kxm/gates.yaml +8 -0
  67. package/examples/vnext/.kxm/models/critic-claude.yaml +11 -0
  68. package/examples/vnext/.kxm/models/critic-gemini.yaml +11 -0
  69. package/examples/vnext/.kxm/models/critic-grok.yaml +12 -0
  70. package/examples/vnext/.kxm/models/implementation.yaml +14 -0
  71. package/examples/vnext/.kxm/models/primary.yaml +17 -0
  72. package/examples/vnext/.kxm/prices.yaml +111 -0
  73. package/examples/vnext/.kxm/project/env.yaml +7 -0
  74. package/examples/vnext/.kxm/project.yaml +32 -0
  75. package/examples/vnext/.kxm/repo/repo.yaml +8 -0
  76. package/examples/vnext/.kxm/workflows/default.yaml +92 -0
  77. package/examples/vnext/.kxm/workflows/fix.yaml +376 -0
  78. package/examples/vnext/.kxm/workflows/improve.yaml +57 -0
  79. package/examples/vnext/README.md +53 -0
  80. package/examples/vnext/records/assignment-result-recorded.json +63 -0
  81. package/examples/vnext/records/assignment-result.json +46 -0
  82. package/examples/vnext/records/context-candidate.json +42 -0
  83. package/examples/vnext/records/delivery-manifest.json +66 -0
  84. package/examples/vnext/records/effect-uncertainty-resolved-sync.json +67 -0
  85. package/examples/vnext/records/effect-uncertainty-resolved.json +62 -0
  86. package/examples/vnext/records/run-created.json +54 -0
  87. package/examples/vnext/records/sync-event.json +65 -0
  88. package/examples/vnext/repositories/api/.kxm/repo/env.yaml +7 -0
  89. package/examples/vnext/repositories/api/.kxm/repo/repo.yaml +8 -0
  90. package/examples/vnext/repositories/web/.kxm/repo/repo.yaml +8 -0
  91. package/examples/workflow-signal.ts +63 -0
  92. package/package.json +129 -0
  93. package/plugins/kxm/.claude-plugin/plugin.json +73 -0
  94. package/plugins/kxm/.mcp.json +19 -0
  95. package/plugins/kxm/README.md +93 -0
  96. package/plugins/kxm/dist/cli.js +42853 -0
  97. package/plugins/kxm/dist/client.js +416 -0
  98. package/plugins/kxm/dist/core.js +1823 -0
  99. package/plugins/kxm/dist/extension.js +3797 -0
  100. package/plugins/kxm/dist/mcp-server.js +17104 -0
  101. package/plugins/kxm/dist/runtime.js +23361 -0
  102. package/plugins/kxm/dist/server.js +13640 -0
  103. package/plugins/kxm/dist/vnext-runtime-supervisor.js +21109 -0
  104. package/plugins/kxm/package.json +12 -0
  105. package/plugins/kxm/skills/kxm/SKILL.md +97 -0
  106. package/plugins/kxm/skills/kxm/references/protocol.md +103 -0
  107. package/plugins/kxm/skills/kxm-session/SKILL.md +53 -0
  108. package/plugins/kxm/src/arbiter.ts +355 -0
  109. package/plugins/kxm/src/artifacts-exist.ts +62 -0
  110. package/plugins/kxm/src/autocomplete.ts +236 -0
  111. package/plugins/kxm/src/cli.ts +3707 -0
  112. package/plugins/kxm/src/client.ts +614 -0
  113. package/plugins/kxm/src/commands.ts +1063 -0
  114. package/plugins/kxm/src/config.ts +290 -0
  115. package/plugins/kxm/src/context/providers.ts +101 -0
  116. package/plugins/kxm/src/context-packet.ts +332 -0
  117. package/plugins/kxm/src/context.ts +499 -0
  118. package/plugins/kxm/src/core.ts +6 -0
  119. package/plugins/kxm/src/database.ts +563 -0
  120. package/plugins/kxm/src/diagnostics.ts +184 -0
  121. package/plugins/kxm/src/envelope.ts +118 -0
  122. package/plugins/kxm/src/extension.ts +895 -0
  123. package/plugins/kxm/src/external-effects.ts +299 -0
  124. package/plugins/kxm/src/github-watch.ts +255 -0
  125. package/plugins/kxm/src/hub-binding.ts +160 -0
  126. package/plugins/kxm/src/hub.ts +2502 -0
  127. package/plugins/kxm/src/improve.ts +383 -0
  128. package/plugins/kxm/src/inbox.ts +10 -0
  129. package/plugins/kxm/src/kxm-install-kind.ts +113 -0
  130. package/plugins/kxm/src/kxm-update-config.ts +39 -0
  131. package/plugins/kxm/src/kxm-update.ts +238 -0
  132. package/plugins/kxm/src/local-snapshot.ts +406 -0
  133. package/plugins/kxm/src/logger.ts +198 -0
  134. package/plugins/kxm/src/mcp-server.ts +143 -0
  135. package/plugins/kxm/src/memory.ts +385 -0
  136. package/plugins/kxm/src/nous-pi.ts +287 -0
  137. package/plugins/kxm/src/nous-provider.ts +729 -0
  138. package/plugins/kxm/src/price-calc.ts +87 -0
  139. package/plugins/kxm/src/prices.ts +121 -0
  140. package/plugins/kxm/src/protocol.ts +172 -0
  141. package/plugins/kxm/src/recovery.ts +211 -0
  142. package/plugins/kxm/src/redact.ts +26 -0
  143. package/plugins/kxm/src/retrospective.ts +400 -0
  144. package/plugins/kxm/src/routing.ts +830 -0
  145. package/plugins/kxm/src/runtime.ts +9 -0
  146. package/plugins/kxm/src/server.ts +117 -0
  147. package/plugins/kxm/src/session-work.ts +571 -0
  148. package/plugins/kxm/src/session.ts +184 -0
  149. package/plugins/kxm/src/skills.ts +535 -0
  150. package/plugins/kxm/src/state.ts +326 -0
  151. package/plugins/kxm/src/store.ts +637 -0
  152. package/plugins/kxm/src/studio-layout.ts +268 -0
  153. package/plugins/kxm/src/suggest.ts +162 -0
  154. package/plugins/kxm/src/task-manager.ts +244 -0
  155. package/plugins/kxm/src/telemetry.ts +116 -0
  156. package/plugins/kxm/src/tui.ts +1046 -0
  157. package/plugins/kxm/src/vnext-bindings.ts +403 -0
  158. package/plugins/kxm/src/vnext-config.ts +1646 -0
  159. package/plugins/kxm/src/vnext-engine-artifacts.ts +86 -0
  160. package/plugins/kxm/src/vnext-engine-command.ts +533 -0
  161. package/plugins/kxm/src/vnext-engine-compile.ts +722 -0
  162. package/plugins/kxm/src/vnext-engine-evidence.ts +273 -0
  163. package/plugins/kxm/src/vnext-engine-fold.ts +1400 -0
  164. package/plugins/kxm/src/vnext-engine-gate-records.ts +583 -0
  165. package/plugins/kxm/src/vnext-engine-plan.ts +717 -0
  166. package/plugins/kxm/src/vnext-engine.ts +2458 -0
  167. package/plugins/kxm/src/vnext-gate-hash.ts +10 -0
  168. package/plugins/kxm/src/vnext-harness.ts +1142 -0
  169. package/plugins/kxm/src/vnext-init.ts +430 -0
  170. package/plugins/kxm/src/vnext-migrate.ts +1848 -0
  171. package/plugins/kxm/src/vnext-oneshot-producer.ts +424 -0
  172. package/plugins/kxm/src/vnext-permission.ts +936 -0
  173. package/plugins/kxm/src/vnext-pi-producer.ts +628 -0
  174. package/plugins/kxm/src/vnext-repair.ts +1094 -0
  175. package/plugins/kxm/src/vnext-runtime-owner.ts +320 -0
  176. package/plugins/kxm/src/vnext-runtime-store.ts +1560 -0
  177. package/plugins/kxm/src/vnext-runtime-supervisor.ts +586 -0
  178. package/plugins/kxm/src/vnext-runtime.ts +663 -0
  179. package/plugins/kxm/src/vnext-template.ts +247 -0
  180. package/plugins/kxm/src/wiki.ts +313 -0
  181. package/plugins/kxm/src/workflow.ts +1548 -0
  182. package/schemas/vnext/README.md +46 -0
  183. package/schemas/vnext/agent.schema.json +40 -0
  184. package/schemas/vnext/assignment-result.schema.json +66 -0
  185. package/schemas/vnext/backup-manifest.schema.json +89 -0
  186. package/schemas/vnext/candidate.schema.json +109 -0
  187. package/schemas/vnext/common.schema.json +422 -0
  188. package/schemas/vnext/context-candidate.schema.json +76 -0
  189. package/schemas/vnext/context-packet.schema.json +192 -0
  190. package/schemas/vnext/delivery-manifest.schema.json +159 -0
  191. package/schemas/vnext/environment.schema.json +66 -0
  192. package/schemas/vnext/gate-registry.schema.json +109 -0
  193. package/schemas/vnext/handoff-manifest.schema.json +146 -0
  194. package/schemas/vnext/init-operation.schema.json +61 -0
  195. package/schemas/vnext/local-repository-bindings.schema.json +30 -0
  196. package/schemas/vnext/memory-record.schema.json +45 -0
  197. package/schemas/vnext/migration-decision.schema.json +26 -0
  198. package/schemas/vnext/migration-plan.schema.json +123 -0
  199. package/schemas/vnext/migration-receipt.schema.json +52 -0
  200. package/schemas/vnext/model.schema.json +42 -0
  201. package/schemas/vnext/permission-diff.schema.json +57 -0
  202. package/schemas/vnext/prices.schema.json +115 -0
  203. package/schemas/vnext/project.schema.json +85 -0
  204. package/schemas/vnext/repository.schema.json +24 -0
  205. package/schemas/vnext/run-event.schema.json +460 -0
  206. package/schemas/vnext/session-brief.schema.json +153 -0
  207. package/schemas/vnext/sync-event.schema.json +234 -0
  208. package/schemas/vnext/template-provenance.schema.json +38 -0
  209. package/schemas/vnext/workflow.schema.json +248 -0
  210. package/scripts/assignment-run.d.mts +354 -0
  211. package/scripts/assignment-run.mjs +4451 -0
  212. package/scripts/build-runtime.mjs +56 -0
  213. package/scripts/check-generated.mjs +77 -0
  214. package/scripts/check-versions.mjs +34 -0
  215. package/scripts/emit-codex-artifacts.d.mts +9 -0
  216. package/scripts/emit-codex-artifacts.mjs +91 -0
  217. package/scripts/harness-run.d.mts +83 -0
  218. package/scripts/harness-run.mjs +2095 -0
  219. package/scripts/kxm-hub.mjs +105 -0
  220. package/scripts/kxm-publish-npm.mjs +327 -0
  221. package/scripts/kxm-release-github.mjs +472 -0
  222. package/scripts/kxm-runtime-supervisor.mjs +7 -0
  223. package/scripts/kxm-worker.mjs +1127 -0
  224. package/scripts/kxm.mjs +27 -0
  225. package/scripts/roster-policy.d.mts +20 -0
  226. package/scripts/roster-policy.mjs +161 -0
  227. package/scripts/smoke-multi-pi.mjs +479 -0
@@ -0,0 +1,422 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.kxm.dev/vnext/common.schema.json",
4
+ "title": "KXM vNext common definitions",
5
+ "$defs": {
6
+ "identifier": {
7
+ "type": "string",
8
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
9
+ "minLength": 1,
10
+ "maxLength": 64
11
+ },
12
+ "opaqueId": {
13
+ "type": "string",
14
+ "pattern": "^[a-z][a-z0-9]{1,15}_[A-Za-z0-9][A-Za-z0-9_-]{5,127}$",
15
+ "maxLength": 144
16
+ },
17
+ "sha256": {
18
+ "type": "string",
19
+ "pattern": "^sha256:[a-f0-9]{64}$"
20
+ },
21
+ "gitCommit": {
22
+ "type": "string",
23
+ "pattern": "^[a-f0-9]{40,64}$"
24
+ },
25
+ "timestamp": {
26
+ "type": "string",
27
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]{1,9})?Z$"
28
+ },
29
+ "monotonicNs": {
30
+ "type": "string",
31
+ "pattern": "^(?:0|[1-9][0-9]*)$",
32
+ "maxLength": 32
33
+ },
34
+ "durationMs": {
35
+ "type": "integer",
36
+ "minimum": 0,
37
+ "maximum": 31536000000
38
+ },
39
+ "relativePath": {
40
+ "type": "string",
41
+ "pattern": "^(?:\\.|(?!(?:.*/)?(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|[Cc][Oo][Mm][1-9¹²³]|[Ll][Pp][Tt][1-9¹²³]|[Cc][Oo][Nn][Ii][Nn]\\$|[Cc][Oo][Nn][Oo][Uu][Tt]\\$|[Cc][Ll][Oo][Cc][Kk]\\$)[ ]*(?:\\.[^/]*)?(?:/|$))(?!.*[<>:\"\\\\|?*])(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*//)(?!.*[. ](?:/|$))[^/\\u0000-\\u001F]+(?:/[^/\\u0000-\\u001F]+)*)$",
42
+ "minLength": 1,
43
+ "maxLength": 1024
44
+ },
45
+ "repositoryAccess": {
46
+ "enum": ["none", "read", "write"]
47
+ },
48
+ "modelSelector": {
49
+ "oneOf": [
50
+ {
51
+ "type": "object",
52
+ "required": ["profile"],
53
+ "properties": {
54
+ "profile": { "$ref": "#/$defs/identifier" }
55
+ },
56
+ "additionalProperties": false
57
+ },
58
+ {
59
+ "type": "object",
60
+ "required": ["tag"],
61
+ "properties": {
62
+ "tag": { "$ref": "#/$defs/identifier" },
63
+ "capabilities": {
64
+ "type": "array",
65
+ "items": { "$ref": "#/$defs/identifier" },
66
+ "uniqueItems": true,
67
+ "maxItems": 32
68
+ }
69
+ },
70
+ "additionalProperties": false
71
+ },
72
+ {
73
+ "type": "object",
74
+ "required": ["provider", "model"],
75
+ "properties": {
76
+ "provider": { "$ref": "#/$defs/identifier" },
77
+ "model": { "type": "string", "minLength": 1, "maxLength": 200 }
78
+ },
79
+ "additionalProperties": false
80
+ }
81
+ ]
82
+ },
83
+ "toolPolicy": {
84
+ "type": "object",
85
+ "properties": {
86
+ "preset": { "$ref": "#/$defs/identifier" },
87
+ "allow": {
88
+ "type": "array",
89
+ "items": { "$ref": "#/$defs/identifier" },
90
+ "uniqueItems": true,
91
+ "maxItems": 128
92
+ },
93
+ "deny": {
94
+ "type": "array",
95
+ "items": { "$ref": "#/$defs/identifier" },
96
+ "uniqueItems": true,
97
+ "maxItems": 128
98
+ }
99
+ },
100
+ "minProperties": 1,
101
+ "additionalProperties": false
102
+ },
103
+ "secretGrant": {
104
+ "type": "object",
105
+ "required": ["ref"],
106
+ "properties": {
107
+ "ref": { "$ref": "#/$defs/identifier" },
108
+ "as": {
109
+ "type": "string",
110
+ "pattern": "^[A-Z_][A-Z0-9_]*$",
111
+ "maxLength": 128
112
+ },
113
+ "required": { "type": "boolean", "default": true }
114
+ },
115
+ "additionalProperties": false
116
+ },
117
+ "lifecycleStatus": {
118
+ "enum": [
119
+ "queued",
120
+ "offered",
121
+ "accepted",
122
+ "declined",
123
+ "expired",
124
+ "created",
125
+ "preparing",
126
+ "pending",
127
+ "running",
128
+ "waiting",
129
+ "blocked_uncertain",
130
+ "cancelling",
131
+ "cancelled",
132
+ "completed",
133
+ "failed",
134
+ "skipped",
135
+ "passed",
136
+ "dispatched",
137
+ "executing",
138
+ "reattaching",
139
+ "retry_pending",
140
+ "result_recorded",
141
+ "terminal",
142
+ "starting",
143
+ "settling",
144
+ "connection_lost",
145
+ "intent_recorded",
146
+ "observed",
147
+ "receipt_recorded",
148
+ "settled",
149
+ "planned",
150
+ "delivering",
151
+ "partial",
152
+ "delivered",
153
+ "outbox_pending",
154
+ "acknowledged",
155
+ "rejected",
156
+ "omitted",
157
+ "active",
158
+ "idle",
159
+ "closed"
160
+ ]
161
+ },
162
+ "runEventType": {
163
+ "enum": [
164
+ "run.created",
165
+ "run.status_changed",
166
+ "run.cancel_requested",
167
+ "step.entered",
168
+ "step.status_changed",
169
+ "step.outcome_recorded",
170
+ "step.transitioned",
171
+ "assignment.created",
172
+ "assignment.accepted",
173
+ "assignment.dispatched",
174
+ "assignment.executing",
175
+ "assignment.reattaching",
176
+ "assignment.retry_pending",
177
+ "assignment.result_recorded",
178
+ "assignment.terminal",
179
+ "attempt.created",
180
+ "attempt.status_changed",
181
+ "attempt.connection_lost",
182
+ "effect.intent_recorded",
183
+ "effect.dispatched",
184
+ "effect.observed",
185
+ "effect.receipt_recorded",
186
+ "effect.settled",
187
+ "effect.blocked_uncertain",
188
+ "effect.uncertainty_resolved",
189
+ "workspace.snapshot_pinned",
190
+ "workspace.materialized",
191
+ "model.resolved",
192
+ "session.scope_rotated",
193
+ "approval.recorded",
194
+ "lease.acquired",
195
+ "lease.released",
196
+ "lease.lost",
197
+ "delivery.status_changed",
198
+ "candidate.created",
199
+ "routing.attempt.recorded"
200
+ ]
201
+ },
202
+ "effectClass": {
203
+ "enum": [
204
+ "read-only",
205
+ "workspace-mutation",
206
+ "external-idempotent",
207
+ "receipt-queryable",
208
+ "external-non-idempotent",
209
+ "unknown"
210
+ ]
211
+ },
212
+ "effectPolicy": {
213
+ "type": "object",
214
+ "required": ["class", "sharedMutable"],
215
+ "properties": {
216
+ "class": { "$ref": "#/$defs/effectClass" },
217
+ "idempotencyKey": {
218
+ "enum": ["run", "step", "assignment", "attempt", "explicit"]
219
+ },
220
+ "receiptQuery": { "$ref": "#/$defs/identifier" },
221
+ "sharedMutable": { "type": "boolean" }
222
+ },
223
+ "allOf": [
224
+ {
225
+ "if": { "properties": { "class": { "const": "external-idempotent" } }, "required": ["class"] },
226
+ "then": { "required": ["idempotencyKey", "receiptQuery"] }
227
+ },
228
+ {
229
+ "if": { "properties": { "class": { "const": "receipt-queryable" } }, "required": ["class"] },
230
+ "then": { "required": ["receiptQuery"] }
231
+ },
232
+ {
233
+ "if": { "properties": { "class": { "enum": ["read-only", "workspace-mutation"] } }, "required": ["class"] },
234
+ "then": { "properties": { "sharedMutable": { "const": false } } }
235
+ },
236
+ {
237
+ "if": { "properties": { "class": { "enum": ["external-non-idempotent", "unknown"] } }, "required": ["class"] },
238
+ "then": {
239
+ "not": {
240
+ "anyOf": [
241
+ { "required": ["idempotencyKey"] },
242
+ { "required": ["receiptQuery"] }
243
+ ]
244
+ }
245
+ }
246
+ }
247
+ ],
248
+ "additionalProperties": false
249
+ },
250
+ "actor": {
251
+ "type": "object",
252
+ "required": ["kind", "id"],
253
+ "properties": {
254
+ "kind": { "enum": ["human", "runtime", "hub", "agent", "adapter"] },
255
+ "id": { "type": "string", "minLength": 1, "maxLength": 200 }
256
+ },
257
+ "additionalProperties": false
258
+ },
259
+ "executorResolution": {
260
+ "type": "object",
261
+ "required": ["id", "kind", "executorVersion", "harness", "harnessVersion"],
262
+ "properties": {
263
+ "id": { "$ref": "#/$defs/identifier" },
264
+ "kind": { "enum": ["local", "ssh"] },
265
+ "executorVersion": { "type": "string", "minLength": 1, "maxLength": 128 },
266
+ "harness": { "$ref": "#/$defs/identifier" },
267
+ "harnessVersion": { "type": "string", "minLength": 1, "maxLength": 128 },
268
+ "helperGeneration": { "type": "string", "minLength": 1, "maxLength": 256 }
269
+ },
270
+ "additionalProperties": false
271
+ },
272
+ "lease": {
273
+ "type": "object",
274
+ "required": ["id", "fencingToken", "acquiredAt", "expiresAt"],
275
+ "properties": {
276
+ "id": { "$ref": "#/$defs/opaqueId" },
277
+ "fencingToken": { "type": "string", "minLength": 1, "maxLength": 256 },
278
+ "acquiredAt": { "$ref": "#/$defs/timestamp" },
279
+ "expiresAt": { "$ref": "#/$defs/timestamp" },
280
+ "operation": { "$ref": "#/$defs/identifier" }
281
+ },
282
+ "additionalProperties": false
283
+ },
284
+ "evidenceRef": {
285
+ "type": "object",
286
+ "required": ["id", "kind"],
287
+ "properties": {
288
+ "id": { "$ref": "#/$defs/opaqueId" },
289
+ "kind": { "$ref": "#/$defs/identifier" },
290
+ "hash": { "$ref": "#/$defs/sha256" },
291
+ "status": { "$ref": "#/$defs/identifier" },
292
+ "producerId": { "$ref": "#/$defs/opaqueId" }
293
+ },
294
+ "additionalProperties": false
295
+ },
296
+ "artifactRef": {
297
+ "type": "object",
298
+ "required": ["id", "kind", "hash", "size", "availability"],
299
+ "properties": {
300
+ "id": { "$ref": "#/$defs/opaqueId" },
301
+ "kind": { "$ref": "#/$defs/identifier" },
302
+ "hash": { "$ref": "#/$defs/sha256" },
303
+ "size": { "type": "integer", "minimum": 0, "maximum": 1099511627776 },
304
+ "classification": {
305
+ "enum": ["public", "project", "sensitive", "secret"]
306
+ },
307
+ "availability": {
308
+ "enum": ["local", "online-runtime", "hub", "external"]
309
+ }
310
+ },
311
+ "additionalProperties": false
312
+ },
313
+ "receipt": {
314
+ "type": "object",
315
+ "required": ["provider", "kind", "id"],
316
+ "properties": {
317
+ "provider": { "$ref": "#/$defs/identifier" },
318
+ "kind": { "$ref": "#/$defs/identifier" },
319
+ "id": { "type": "string", "minLength": 1, "maxLength": 512 },
320
+ "url": { "type": "string", "minLength": 1, "maxLength": 2048 },
321
+ "hash": { "$ref": "#/$defs/sha256" },
322
+ "observedAt": { "$ref": "#/$defs/timestamp" }
323
+ },
324
+ "additionalProperties": false
325
+ },
326
+ "timing": {
327
+ "type": "object",
328
+ "required": ["durationMs"],
329
+ "properties": {
330
+ "startedAt": { "$ref": "#/$defs/timestamp" },
331
+ "finishedAt": { "$ref": "#/$defs/timestamp" },
332
+ "durationMs": { "$ref": "#/$defs/durationMs" },
333
+ "queueMs": { "$ref": "#/$defs/durationMs" },
334
+ "agentMs": { "$ref": "#/$defs/durationMs" }
335
+ },
336
+ "additionalProperties": false
337
+ },
338
+ "usage": {
339
+ "type": "object",
340
+ "properties": {
341
+ "inputTokens": { "type": "integer", "minimum": 0 },
342
+ "outputTokens": { "type": "integer", "minimum": 0 },
343
+ "cacheReadTokens": { "type": "integer", "minimum": 0 },
344
+ "cacheWriteTokens": { "type": "integer", "minimum": 0 },
345
+ "cost": { "type": "number", "minimum": 0 },
346
+ "currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
347
+ "costKind": { "enum": ["reported", "estimated", "unknown"] }
348
+ },
349
+ "additionalProperties": false
350
+ },
351
+ "modelResolution": {
352
+ "type": "object",
353
+ "required": ["provider", "model"],
354
+ "properties": {
355
+ "profile": { "$ref": "#/$defs/identifier" },
356
+ "provider": { "$ref": "#/$defs/identifier" },
357
+ "model": { "type": "string", "minLength": 1, "maxLength": 200 },
358
+ "tags": {
359
+ "type": "array",
360
+ "items": { "$ref": "#/$defs/identifier" },
361
+ "uniqueItems": true,
362
+ "maxItems": 32
363
+ },
364
+ "thinking": { "type": "string", "minLength": 1, "maxLength": 64 }
365
+ },
366
+ "additionalProperties": false
367
+ },
368
+ "fileChanges": {
369
+ "type": "object",
370
+ "required": ["repositoryId"],
371
+ "properties": {
372
+ "repositoryId": { "$ref": "#/$defs/identifier" },
373
+ "added": {
374
+ "type": "array",
375
+ "items": { "$ref": "#/$defs/relativePath" },
376
+ "uniqueItems": true,
377
+ "maxItems": 1000
378
+ },
379
+ "modified": {
380
+ "type": "array",
381
+ "items": { "$ref": "#/$defs/relativePath" },
382
+ "uniqueItems": true,
383
+ "maxItems": 1000
384
+ },
385
+ "deleted": {
386
+ "type": "array",
387
+ "items": { "$ref": "#/$defs/relativePath" },
388
+ "uniqueItems": true,
389
+ "maxItems": 1000
390
+ },
391
+ "redactedPathCount": { "type": "integer", "minimum": 0 }
392
+ },
393
+ "additionalProperties": false
394
+ },
395
+ "environmentResolution": {
396
+ "type": "object",
397
+ "required": ["name", "scope", "status", "source"],
398
+ "properties": {
399
+ "name": {
400
+ "type": "string",
401
+ "pattern": "^[A-Z_][A-Z0-9_]*$",
402
+ "maxLength": 128
403
+ },
404
+ "scope": { "type": "string", "minLength": 1, "maxLength": 160 },
405
+ "status": { "enum": ["resolved", "missing", "denied", "not-required"] },
406
+ "source": { "enum": ["default", "host", "project", "repository", "secret-ref", "runtime"] },
407
+ "version": { "type": "string", "minLength": 1, "maxLength": 200 }
408
+ },
409
+ "additionalProperties": false
410
+ },
411
+ "errorSummary": {
412
+ "type": "object",
413
+ "required": ["class", "component", "retryable"],
414
+ "properties": {
415
+ "class": { "$ref": "#/$defs/identifier" },
416
+ "component": { "type": "string", "minLength": 1, "maxLength": 128 },
417
+ "retryable": { "type": "boolean" }
418
+ },
419
+ "additionalProperties": false
420
+ }
421
+ }
422
+ }
@@ -0,0 +1,76 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.kxm.dev/vnext/context-candidate.schema.json",
4
+ "title": "KXM evidence-linked improvement candidate",
5
+ "type": "object",
6
+ "required": [
7
+ "schema",
8
+ "id",
9
+ "projectId",
10
+ "sourceRunId",
11
+ "type",
12
+ "scope",
13
+ "summary",
14
+ "authority",
15
+ "confidence",
16
+ "status",
17
+ "activation",
18
+ "evidenceRefs",
19
+ "createdAt"
20
+ ],
21
+ "properties": {
22
+ "schema": { "const": "kxm.context-candidate.v1" },
23
+ "id": { "$ref": "common.schema.json#/$defs/opaqueId" },
24
+ "projectId": { "$ref": "common.schema.json#/$defs/opaqueId" },
25
+ "sourceRunId": { "$ref": "common.schema.json#/$defs/opaqueId" },
26
+ "sourceConfigRevision": { "$ref": "common.schema.json#/$defs/sha256" },
27
+ "sourceMemoryRevision": { "$ref": "common.schema.json#/$defs/opaqueId" },
28
+ "type": { "enum": ["knowledge", "skill", "workflow", "agent", "model", "environment", "template", "temporal-state"] },
29
+ "scope": {
30
+ "type": "object",
31
+ "required": ["kind"],
32
+ "properties": {
33
+ "kind": { "enum": ["project", "repository"] },
34
+ "repositoryId": { "$ref": "common.schema.json#/$defs/identifier" }
35
+ },
36
+ "allOf": [
37
+ {
38
+ "if": { "properties": { "kind": { "const": "repository" } }, "required": ["kind"] },
39
+ "then": { "required": ["repositoryId"] },
40
+ "else": { "not": { "required": ["repositoryId"] } }
41
+ }
42
+ ],
43
+ "additionalProperties": false
44
+ },
45
+ "summary": { "type": "string", "minLength": 1, "maxLength": 2000 },
46
+ "authority": { "const": "evidence" },
47
+ "confidence": { "enum": ["verified", "probable", "uncertain"] },
48
+ "status": { "enum": ["proposed", "evaluating", "review-required", "promoted", "rejected", "quarantined"] },
49
+ "activation": { "const": "review-required" },
50
+ "targetPath": { "$ref": "common.schema.json#/$defs/relativePath" },
51
+ "proposedChange": { "$ref": "common.schema.json#/$defs/artifactRef" },
52
+ "evidenceRefs": {
53
+ "type": "array",
54
+ "items": { "$ref": "common.schema.json#/$defs/evidenceRef" },
55
+ "minItems": 1,
56
+ "maxItems": 64
57
+ },
58
+ "evaluation": {
59
+ "type": "object",
60
+ "properties": {
61
+ "status": { "enum": ["not-started", "running", "passed", "failed", "quarantined"] },
62
+ "metric": { "$ref": "common.schema.json#/$defs/identifier" },
63
+ "expectedDirection": { "enum": ["increase", "decrease", "maintain"] },
64
+ "evidenceRefs": {
65
+ "type": "array",
66
+ "items": { "$ref": "common.schema.json#/$defs/evidenceRef" },
67
+ "maxItems": 64
68
+ }
69
+ },
70
+ "additionalProperties": false
71
+ },
72
+ "createdAt": { "$ref": "common.schema.json#/$defs/timestamp" },
73
+ "updatedAt": { "$ref": "common.schema.json#/$defs/timestamp" }
74
+ },
75
+ "additionalProperties": false
76
+ }