@kontextmind/kxm 0.7.125 → 0.7.127

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 (59) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.kxm/roles/planner.yaml +6 -7
  3. package/.kxm/roles/reviewer-arch.yaml +6 -7
  4. package/.kxm/roles/reviewer-cli.yaml +6 -7
  5. package/.kxm/roles/writer.yaml +8 -17
  6. package/CHANGELOG.md +17 -0
  7. package/docs/README.md +2 -0
  8. package/docs/architecture/access.md +2 -4
  9. package/docs/architecture/inventory.md +4 -0
  10. package/docs/contracts/validation.md +1 -1
  11. package/docs/contributing/harness-routing-internals.md +1 -1
  12. package/docs/contributing/learnings.md +105 -0
  13. package/docs/contributing/operating-rules.md +107 -0
  14. package/docs/contributing/test-matrix.md +1 -1
  15. package/docs/glossary.md +1 -1
  16. package/docs/guides/agent-skills.md +1 -1
  17. package/docs/operations/backup-and-restore.md +2 -2
  18. package/docs/reference/cli-reference.md +31 -74
  19. package/docs/reference/config-reference.md +83 -118
  20. package/docs/reference/harness-routing.md +15 -8
  21. package/examples/project/.kxm/models/critic-claude.yaml +6 -2
  22. package/examples/project/.kxm/models/critic-gemini.yaml +6 -2
  23. package/examples/project/.kxm/models/critic-grok.yaml +6 -2
  24. package/examples/project/.kxm/models/implementation.yaml +6 -2
  25. package/examples/project/.kxm/models/primary.yaml +6 -2
  26. package/examples/project/.kxm/roles/planner.yaml +8 -0
  27. package/examples/project/.kxm/roles/reviewer-arch.yaml +8 -0
  28. package/examples/project/.kxm/roles/reviewer-cli.yaml +8 -0
  29. package/examples/project/.kxm/roles/writer.yaml +8 -0
  30. package/package.json +1 -1
  31. package/plugins/kxm/.claude-plugin/plugin.json +1 -1
  32. package/plugins/kxm/dist/cli.js +1759 -1306
  33. package/plugins/kxm/dist/mcp-server.js +1 -1
  34. package/plugins/kxm/dist/runtime-supervisor.js +994 -245
  35. package/plugins/kxm/dist/runtime.js +1018 -269
  36. package/plugins/kxm/dist/server.js +55 -1
  37. package/plugins/kxm/package.json +1 -1
  38. package/plugins/kxm/skills/kxm/SKILL.md +1 -1
  39. package/plugins/kxm/skills/kxm-definitions/SKILL.md +3 -7
  40. package/plugins/kxm/src/autocomplete.ts +1 -1
  41. package/plugins/kxm/src/cli/project.ts +7 -1
  42. package/plugins/kxm/src/cli/roles.ts +46 -150
  43. package/plugins/kxm/src/cli.ts +8 -22
  44. package/plugins/kxm/src/engine.ts +24 -1
  45. package/plugins/kxm/src/init-guide-setup.ts +38 -4
  46. package/plugins/kxm/src/mcp-server.ts +1 -1
  47. package/plugins/kxm/src/permission.ts +11 -0
  48. package/plugins/kxm/src/policy-draft.mjs +56 -16
  49. package/plugins/kxm/src/project-config.ts +121 -10
  50. package/plugins/kxm/src/repair.ts +1 -0
  51. package/plugins/kxm/src/role.ts +40 -440
  52. package/plugins/kxm/src/routes.ts +28 -5
  53. package/plugins/kxm/src/template.ts +34 -1
  54. package/schemas/README.md +2 -1
  55. package/schemas/model.schema.json +111 -13
  56. package/schemas/role.schema.json +61 -31
  57. package/schemas/policy-draft/README.md +0 -17
  58. package/schemas/policy-draft/model.v2.schema.json +0 -140
  59. package/schemas/policy-draft/role.v2.schema.json +0 -91
@@ -1,42 +1,140 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schemas.kxm.dev/model.schema.json",
4
- "title": "KXM model profile",
5
- "description": "The filename determines the profile identity.",
4
+ "title": "KXM model route",
5
+ "description": "Live kxm.model.v2 route. Admission status is recorded on the route. This schema does not dispatch.",
6
6
  "type": "object",
7
- "required": ["schema", "provider", "model"],
7
+ "required": ["schema", "harness", "model", "vendor", "status", "permissions"],
8
+ "additionalProperties": false,
8
9
  "properties": {
9
- "schema": { "const": "kxm.model.v1" },
10
- "provider": { "$ref": "common.schema.json#/$defs/identifier" },
10
+ "schema": { "const": "kxm.model.v2" },
11
+ "id": {
12
+ "type": "string",
13
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
14
+ "minLength": 1,
15
+ "maxLength": 64
16
+ },
17
+ "harness": {
18
+ "type": "string",
19
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
20
+ "minLength": 1,
21
+ "maxLength": 64
22
+ },
11
23
  "model": { "type": "string", "minLength": 1, "maxLength": 200 },
24
+ "vendor": { "type": "string", "minLength": 1, "maxLength": 64 },
25
+ "status": { "enum": ["admitted", "candidate", "retired"] },
26
+ "permissions": {
27
+ "type": "array",
28
+ "items": { "enum": ["edit", "read-only"] },
29
+ "minItems": 1,
30
+ "maxItems": 2,
31
+ "uniqueItems": true
32
+ },
33
+ "origin": {
34
+ "type": "object",
35
+ "required": ["source", "sha256"],
36
+ "additionalProperties": false,
37
+ "properties": {
38
+ "source": { "type": "string", "minLength": 1, "maxLength": 512 },
39
+ "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
40
+ }
41
+ },
12
42
  "thinking": { "type": "string", "minLength": 1, "maxLength": 64 },
13
43
  "tags": {
14
44
  "type": "array",
15
- "items": { "$ref": "common.schema.json#/$defs/identifier" },
45
+ "items": {
46
+ "type": "string",
47
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
48
+ "minLength": 1,
49
+ "maxLength": 64
50
+ },
16
51
  "uniqueItems": true,
17
52
  "maxItems": 32
18
53
  },
19
54
  "capabilities": {
20
55
  "type": "array",
21
- "items": { "$ref": "common.schema.json#/$defs/identifier" },
56
+ "items": {
57
+ "type": "string",
58
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
59
+ "minLength": 1,
60
+ "maxLength": 64
61
+ },
22
62
  "uniqueItems": true,
23
63
  "maxItems": 32
24
64
  },
25
65
  "priority": { "type": "integer", "minimum": -10000, "maximum": 10000 },
26
66
  "fallbacks": {
27
67
  "type": "array",
28
- "items": { "$ref": "common.schema.json#/$defs/modelSelector" },
29
- "maxItems": 8
68
+ "maxItems": 8,
69
+ "items": {
70
+ "oneOf": [
71
+ {
72
+ "type": "object",
73
+ "required": ["profile"],
74
+ "additionalProperties": false,
75
+ "properties": {
76
+ "profile": {
77
+ "type": "string",
78
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
79
+ "minLength": 1,
80
+ "maxLength": 64
81
+ }
82
+ }
83
+ },
84
+ {
85
+ "type": "object",
86
+ "required": ["tag"],
87
+ "additionalProperties": false,
88
+ "properties": {
89
+ "tag": {
90
+ "type": "string",
91
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
92
+ "minLength": 1,
93
+ "maxLength": 64
94
+ },
95
+ "capabilities": {
96
+ "type": "array",
97
+ "items": {
98
+ "type": "string",
99
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
100
+ "minLength": 1,
101
+ "maxLength": 64
102
+ },
103
+ "uniqueItems": true,
104
+ "maxItems": 32
105
+ }
106
+ }
107
+ },
108
+ {
109
+ "type": "object",
110
+ "required": ["provider", "model"],
111
+ "additionalProperties": false,
112
+ "properties": {
113
+ "provider": {
114
+ "type": "string",
115
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
116
+ "minLength": 1,
117
+ "maxLength": 64
118
+ },
119
+ "model": { "type": "string", "minLength": 1, "maxLength": 200 }
120
+ }
121
+ }
122
+ ]
123
+ }
30
124
  },
31
125
  "limits": {
32
126
  "type": "object",
127
+ "additionalProperties": false,
33
128
  "properties": {
34
129
  "contextTokens": { "type": "integer", "minimum": 1 },
35
130
  "outputTokens": { "type": "integer", "minimum": 1 },
36
- "timeoutMs": { "$ref": "common.schema.json#/$defs/durationMs" }
37
- },
38
- "additionalProperties": false
131
+ "timeoutMs": { "type": "integer", "minimum": 0, "maximum": 31536000000 }
132
+ }
39
133
  }
40
134
  },
41
- "additionalProperties": false
135
+ "if": {
136
+ "properties": { "harness": { "const": "pi" } },
137
+ "required": ["harness"]
138
+ },
139
+ "then": { "required": ["origin"] }
42
140
  }
@@ -1,14 +1,46 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schemas.kxm.dev/role.schema.json",
4
- "title": "KXM role definition",
5
- "description": "The filename determines the role identity unless explicitly declared.",
4
+ "title": "KXM role",
5
+ "description": "Live kxm.role.v2 role. Specialty identity is separate from purpose. Roster order is configured preference, not a measured ranking.",
6
6
  "type": "object",
7
- "required": ["schema", "description"],
7
+ "required": ["schema", "purpose", "permission", "description", "roster"],
8
+ "additionalProperties": false,
8
9
  "properties": {
9
- "schema": { "const": "kxm.role.v1" },
10
- "id": { "$ref": "common.schema.json#/$defs/identifier" },
10
+ "schema": { "const": "kxm.role.v2" },
11
+ "id": {
12
+ "type": "string",
13
+ "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
14
+ "minLength": 1,
15
+ "maxLength": 64
16
+ },
17
+ "extends": { "$ref": "common.schema.json#/$defs/identifier" },
18
+ "purpose": {
19
+ "enum": ["writer", "planner", "reviewer-arch", "reviewer-cli", "experiment"]
20
+ },
21
+ "permission": { "enum": ["edit", "read-only"] },
11
22
  "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
23
+ "roster": {
24
+ "type": "array",
25
+ "maxItems": 32,
26
+ "items": {
27
+ "type": "object",
28
+ "required": ["route"],
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "route": {
32
+ "type": "string",
33
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
34
+ "minLength": 1,
35
+ "maxLength": 64
36
+ },
37
+ "effort": {
38
+ "enum": ["off", "minimal", "low", "medium", "high", "xhigh", "max"]
39
+ },
40
+ "mode": { "enum": ["headless", "interactive", "either"] }
41
+ }
42
+ }
43
+ },
12
44
  "skills": {
13
45
  "type": "array",
14
46
  "items": { "type": "string", "minLength": 1, "maxLength": 128 },
@@ -16,23 +48,23 @@
16
48
  },
17
49
  "tools": {
18
50
  "type": "object",
51
+ "additionalProperties": false,
19
52
  "properties": {
20
53
  "preset": { "type": "string" },
21
54
  "allow": { "type": "array", "items": { "type": "string" } },
22
55
  "deny": { "type": "array", "items": { "type": "string" } }
23
- },
24
- "additionalProperties": false
56
+ }
25
57
  },
26
58
  "produces": {
27
59
  "type": "array",
28
60
  "items": {
29
61
  "type": "object",
30
62
  "required": ["template"],
63
+ "additionalProperties": false,
31
64
  "properties": {
32
65
  "template": { "type": "string" },
33
66
  "schema": { "type": "string" }
34
- },
35
- "additionalProperties": false
67
+ }
36
68
  }
37
69
  },
38
70
  "consumes": {
@@ -40,37 +72,35 @@
40
72
  "items": {
41
73
  "type": "object",
42
74
  "required": ["template"],
75
+ "additionalProperties": false,
43
76
  "properties": {
44
77
  "template": { "type": "string" },
45
78
  "schema": { "type": "string" }
46
- },
47
- "additionalProperties": false
48
- }
49
- },
50
- "roster": {
51
- "type": "array",
52
- "items": {
53
- "type": "object",
54
- "required": ["harness", "model"],
55
- "properties": {
56
- "harness": { "$ref": "common.schema.json#/$defs/identifier" },
57
- "model": { "$ref": "common.schema.json#/$defs/modelSelector" },
58
- "provider": { "type": "string" },
59
- "effort": { "enum": ["low", "medium", "high", "xhigh"] },
60
- "mode": { "enum": ["headless", "interactive", "either"] }
61
- },
62
- "additionalProperties": false
79
+ }
63
80
  }
64
81
  },
65
82
  "policy": {
66
83
  "type": "object",
84
+ "additionalProperties": false,
67
85
  "properties": {
68
86
  "vendorIndependenceRequired": { "type": "boolean" },
69
87
  "maxTransitions": { "type": "integer", "minimum": 1 },
70
- "requiresGateVerification": { "type": "boolean" }
71
- },
72
- "additionalProperties": false
88
+ "requiresGateVerification": { "type": "boolean" },
89
+ "fallback": {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "properties": {
93
+ "onError": {
94
+ "type": "array",
95
+ "items": { "enum": ["rate_limit", "transport", "provider_unavailable"] },
96
+ "uniqueItems": true,
97
+ "default": []
98
+ },
99
+ "maxSwitches": { "type": "integer", "minimum": 0 },
100
+ "revert": { "enum": ["next_run", "never"] }
101
+ }
102
+ }
103
+ }
73
104
  }
74
- },
75
- "additionalProperties": false
105
+ }
76
106
  }
@@ -1,17 +0,0 @@
1
- # Policy-draft schemas (non-authoritative)
2
-
3
- `kxm.model.v2` and `kxm.role.v2` here are **passive scaffolding**. They are not
4
- operator settings, live registry identities, or admission.
5
-
6
- - Live project models remain `kxm.model.v1` under `schemas/`.
7
- - Live CLI roles remain `kxm.role.v1`.
8
- - Runner admission remains `.kxm/roster.yaml` via the trusted control Git loader.
9
- - This directory is not discovered as a KXM project resource.
10
-
11
- Pure validation lives in `plugins/kxm/src/policy-draft.mjs`
12
- (`validatePolicyDraft`). Callers must supply draft documents, evidence bytes,
13
- and code-owned ceilings explicitly. The function does not read files, Git,
14
- credentials, or cwd, and it does not dispatch or admit a route.
15
-
16
- Roster `route` lists are configured preference order, not a measured ranking.
17
- `status: candidate` is stored as candidate data and is never treated as admitted.
@@ -1,140 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://schemas.kxm.dev/policy-draft/model.v2.schema.json",
4
- "title": "KXM policy-draft model route",
5
- "description": "Passive kxm.model.v2 scaffolding. Not live registry selection, admission, or operator settings.",
6
- "type": "object",
7
- "required": ["schema", "harness", "model", "vendor", "status", "permissions"],
8
- "additionalProperties": false,
9
- "properties": {
10
- "schema": { "const": "kxm.model.v2" },
11
- "id": {
12
- "type": "string",
13
- "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
14
- "minLength": 1,
15
- "maxLength": 64
16
- },
17
- "harness": {
18
- "type": "string",
19
- "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
20
- "minLength": 1,
21
- "maxLength": 64
22
- },
23
- "model": { "type": "string", "minLength": 1, "maxLength": 200 },
24
- "vendor": { "type": "string", "minLength": 1, "maxLength": 64 },
25
- "status": { "enum": ["admitted", "candidate", "retired"] },
26
- "permissions": {
27
- "type": "array",
28
- "items": { "enum": ["edit", "read-only"] },
29
- "minItems": 1,
30
- "maxItems": 2,
31
- "uniqueItems": true
32
- },
33
- "origin": {
34
- "type": "object",
35
- "required": ["source", "sha256"],
36
- "additionalProperties": false,
37
- "properties": {
38
- "source": { "type": "string", "minLength": 1, "maxLength": 512 },
39
- "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
40
- }
41
- },
42
- "thinking": { "type": "string", "minLength": 1, "maxLength": 64 },
43
- "tags": {
44
- "type": "array",
45
- "items": {
46
- "type": "string",
47
- "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
48
- "minLength": 1,
49
- "maxLength": 64
50
- },
51
- "uniqueItems": true,
52
- "maxItems": 32
53
- },
54
- "capabilities": {
55
- "type": "array",
56
- "items": {
57
- "type": "string",
58
- "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
59
- "minLength": 1,
60
- "maxLength": 64
61
- },
62
- "uniqueItems": true,
63
- "maxItems": 32
64
- },
65
- "priority": { "type": "integer", "minimum": -10000, "maximum": 10000 },
66
- "fallbacks": {
67
- "type": "array",
68
- "maxItems": 8,
69
- "items": {
70
- "oneOf": [
71
- {
72
- "type": "object",
73
- "required": ["profile"],
74
- "additionalProperties": false,
75
- "properties": {
76
- "profile": {
77
- "type": "string",
78
- "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
79
- "minLength": 1,
80
- "maxLength": 64
81
- }
82
- }
83
- },
84
- {
85
- "type": "object",
86
- "required": ["tag"],
87
- "additionalProperties": false,
88
- "properties": {
89
- "tag": {
90
- "type": "string",
91
- "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
92
- "minLength": 1,
93
- "maxLength": 64
94
- },
95
- "capabilities": {
96
- "type": "array",
97
- "items": {
98
- "type": "string",
99
- "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
100
- "minLength": 1,
101
- "maxLength": 64
102
- },
103
- "uniqueItems": true,
104
- "maxItems": 32
105
- }
106
- }
107
- },
108
- {
109
- "type": "object",
110
- "required": ["provider", "model"],
111
- "additionalProperties": false,
112
- "properties": {
113
- "provider": {
114
- "type": "string",
115
- "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
116
- "minLength": 1,
117
- "maxLength": 64
118
- },
119
- "model": { "type": "string", "minLength": 1, "maxLength": 200 }
120
- }
121
- }
122
- ]
123
- }
124
- },
125
- "limits": {
126
- "type": "object",
127
- "additionalProperties": false,
128
- "properties": {
129
- "contextTokens": { "type": "integer", "minimum": 1 },
130
- "outputTokens": { "type": "integer", "minimum": 1 },
131
- "timeoutMs": { "type": "integer", "minimum": 0, "maximum": 31536000000 }
132
- }
133
- }
134
- },
135
- "if": {
136
- "properties": { "harness": { "const": "pi" } },
137
- "required": ["harness"]
138
- },
139
- "then": { "required": ["origin"] }
140
- }
@@ -1,91 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://schemas.kxm.dev/policy-draft/role.v2.schema.json",
4
- "title": "KXM policy-draft role",
5
- "description": "Passive kxm.role.v2 scaffolding. Specialty identity is separate from purpose. Roster order is configured preference, not a measured ranking. Not live admission or operator settings.",
6
- "type": "object",
7
- "required": ["schema", "purpose", "permission", "description", "roster"],
8
- "additionalProperties": false,
9
- "properties": {
10
- "schema": { "const": "kxm.role.v2" },
11
- "id": {
12
- "type": "string",
13
- "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$",
14
- "minLength": 1,
15
- "maxLength": 64
16
- },
17
- "purpose": {
18
- "enum": ["writer", "planner", "reviewer-arch", "reviewer-cli", "experiment"]
19
- },
20
- "permission": { "enum": ["edit", "read-only"] },
21
- "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
22
- "roster": {
23
- "type": "array",
24
- "maxItems": 32,
25
- "items": {
26
- "type": "object",
27
- "required": ["route"],
28
- "additionalProperties": false,
29
- "properties": {
30
- "route": {
31
- "type": "string",
32
- "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
33
- "minLength": 1,
34
- "maxLength": 64
35
- },
36
- "effort": {
37
- "enum": ["off", "minimal", "low", "medium", "high", "xhigh", "max"]
38
- },
39
- "mode": { "enum": ["headless", "interactive", "either"] }
40
- }
41
- }
42
- },
43
- "skills": {
44
- "type": "array",
45
- "items": { "type": "string", "minLength": 1, "maxLength": 128 },
46
- "maxItems": 64
47
- },
48
- "tools": {
49
- "type": "object",
50
- "additionalProperties": false,
51
- "properties": {
52
- "preset": { "type": "string" },
53
- "allow": { "type": "array", "items": { "type": "string" } },
54
- "deny": { "type": "array", "items": { "type": "string" } }
55
- }
56
- },
57
- "produces": {
58
- "type": "array",
59
- "items": {
60
- "type": "object",
61
- "required": ["template"],
62
- "additionalProperties": false,
63
- "properties": {
64
- "template": { "type": "string" },
65
- "schema": { "type": "string" }
66
- }
67
- }
68
- },
69
- "consumes": {
70
- "type": "array",
71
- "items": {
72
- "type": "object",
73
- "required": ["template"],
74
- "additionalProperties": false,
75
- "properties": {
76
- "template": { "type": "string" },
77
- "schema": { "type": "string" }
78
- }
79
- }
80
- },
81
- "policy": {
82
- "type": "object",
83
- "additionalProperties": false,
84
- "properties": {
85
- "vendorIndependenceRequired": { "type": "boolean" },
86
- "maxTransitions": { "type": "integer", "minimum": 1 },
87
- "requiresGateVerification": { "type": "boolean" }
88
- }
89
- }
90
- }
91
- }