@aikdna/kdna-core 0.2.3 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "KDNA core library — pure logic for loading, validating, linting, and rendering KDNA domain cognition packages. Zero Node.js dependencies.",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
@@ -0,0 +1,130 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "KDNA Composition Policy",
4
+ "description": "Schema for composition.policy.json — defines runtime composition behavior for domain clusters.",
5
+ "type": "object",
6
+ "required": ["policy_id", "version"],
7
+ "properties": {
8
+ "policy_id": {
9
+ "type": "string",
10
+ "description": "Unique policy identifier"
11
+ },
12
+ "version": {
13
+ "type": "string",
14
+ "description": "Semantic version of this policy"
15
+ },
16
+ "selection_policy": {
17
+ "type": "object",
18
+ "properties": {
19
+ "mode": {
20
+ "type": "string",
21
+ "enum": ["signal_based", "fixed", "staged", "overlay", "user_confirmed"]
22
+ },
23
+ "max_domains": { "type": "integer", "minimum": 1 },
24
+ "min_signal_score": { "type": "number", "minimum": 0, "maximum": 1 },
25
+ "ask_user_when_ambiguous": { "type": "boolean" }
26
+ }
27
+ },
28
+ "priority_policy": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "object",
32
+ "required": ["when", "domain", "priority", "effect"],
33
+ "properties": {
34
+ "when": { "type": "string", "description": "Condition expression triggering this rule" },
35
+ "domain": { "type": "string", "description": "Domain ID" },
36
+ "priority": { "type": "integer", "minimum": 0, "maximum": 100 },
37
+ "effect": {
38
+ "type": "string",
39
+ "enum": ["must_include", "block_or_require_confirmation", "deprioritize", "override"]
40
+ }
41
+ }
42
+ }
43
+ },
44
+ "conflict_policy": {
45
+ "type": "object",
46
+ "properties": {
47
+ "default": {
48
+ "type": "string",
49
+ "enum": ["surface", "priority_wins", "risk_wins", "block", "ask_user", "allow_with_warning"]
50
+ },
51
+ "rules": {
52
+ "type": "array",
53
+ "items": {
54
+ "type": "object",
55
+ "required": ["conflict_type", "action"],
56
+ "properties": {
57
+ "conflict_type": {
58
+ "type": "string",
59
+ "enum": ["value_conflict", "term_conflict", "risk_conflict", "stance_conflict", "framework_conflict", "output_policy_conflict", "priority_conflict"]
60
+ },
61
+ "action": {
62
+ "type": "string",
63
+ "enum": ["surface", "surface_and_ask", "risk_wins", "priority_wins", "block", "allow_with_warning"]
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ },
70
+ "merge_policy": {
71
+ "type": "object",
72
+ "properties": {
73
+ "axioms": { "type": "string", "enum": ["include_all_with_source", "dedupe_by_id", "select_by_priority"] },
74
+ "banned_terms": { "type": "string", "enum": ["union_with_source", "strictest_only", "priority_domain_only"] },
75
+ "self_checks": { "type": "string", "enum": ["dedupe_by_semantic_similarity", "include_all_with_source", "priority_domain_only"] },
76
+ "frameworks": { "type": "string", "enum": ["select_by_scenario", "include_all_with_source", "priority_domain_only"] },
77
+ "stances": { "type": "string", "enum": ["include_conflicts", "priority_domain_only", "merge_with_source"] }
78
+ }
79
+ },
80
+ "output_policy": {
81
+ "type": "object",
82
+ "properties": {
83
+ "must_show_loaded_domains": { "type": "boolean" },
84
+ "must_record_judgment_trace": { "type": "boolean" },
85
+ "must_surface_conflicts": { "type": "boolean" },
86
+ "must_include_uncertainty": { "type": "boolean" }
87
+ }
88
+ },
89
+ "governance": {
90
+ "type": "object",
91
+ "properties": {
92
+ "ownership": {
93
+ "type": "object",
94
+ "properties": {
95
+ "owner_team": { "type": "string" },
96
+ "maintainers": { "type": "array", "items": { "type": "string" } },
97
+ "approvers": { "type": "array", "items": { "type": "string" } },
98
+ "review_cycle": { "type": "string" }
99
+ }
100
+ },
101
+ "lifecycle": {
102
+ "type": "object",
103
+ "properties": {
104
+ "status": { "type": "string", "enum": ["draft", "review", "approved", "active", "deprecated", "archived"] },
105
+ "effective_from": { "type": "string" },
106
+ "expires_at": { "type": "string" },
107
+ "review_required_before": { "type": "string" }
108
+ }
109
+ },
110
+ "change_control": {
111
+ "type": "object",
112
+ "properties": {
113
+ "requires_approval_for": { "type": "array", "items": { "type": "string" } },
114
+ "minor_changes_allowed_for": { "type": "array", "items": { "type": "string" } },
115
+ "audit_log_required": { "type": "boolean" }
116
+ }
117
+ },
118
+ "deployment": {
119
+ "type": "object",
120
+ "properties": {
121
+ "environments": { "type": "array", "items": { "type": "string" } },
122
+ "active_version": { "type": "string" },
123
+ "rollout_strategy": { "type": "string", "enum": ["manual", "canary", "all_at_once"] },
124
+ "rollback_version": { "type": "string" }
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
@@ -42,8 +42,34 @@
42
42
  "outcome": { "type": "string" },
43
43
  "kdna_analysis": { "type": "string" },
44
44
  "modern_parallel": { "type": "string" },
45
- "axiom": { "type": "string" }
46
- }
45
+ "axiom": { "type": "string" },
46
+ "judgment_path": {
47
+ "type": "string",
48
+ "description": "The judgment process applied in this case."
49
+ },
50
+ "good_response": {
51
+ "type": "string",
52
+ "description": "An example of a good judgment response."
53
+ },
54
+ "bad_response": {
55
+ "type": "string",
56
+ "description": "An example of a poor judgment response."
57
+ },
58
+ "why_good": {
59
+ "type": "string",
60
+ "description": "Why the good response aligns with domain judgment."
61
+ },
62
+ "why_bad": {
63
+ "type": "string",
64
+ "description": "Why the bad response violates domain judgment."
65
+ },
66
+ "triggered_axioms": {
67
+ "type": "array",
68
+ "items": { "type": "string" },
69
+ "description": "Axioms triggered by this case."
70
+ }
71
+ },
72
+ "additionalProperties": true
47
73
  }
48
74
  }
49
75
  },
@@ -1,53 +1,132 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://aikdna.com/schema/KDNA_Cluster.schema.json",
4
3
  "title": "KDNA Cluster Manifest",
5
- "description": "Defines a composable group of KDNA packages that work together as a judgment system.",
4
+ "description": "Schema for kdna.cluster.json defines a composable judgment system of KDNA domains.",
6
5
  "type": "object",
7
- "required": ["name", "version", "packages"],
6
+ "required": ["cluster_id", "name", "version", "domains", "composition"],
8
7
  "properties": {
8
+ "cluster_id": {
9
+ "type": "string",
10
+ "description": "Fully qualified cluster identifier, e.g., @company/product-launch-system"
11
+ },
9
12
  "name": {
10
13
  "type": "string",
11
- "description": "Cluster identifier in lowercase snake_case."
14
+ "description": "Human-readable cluster name"
12
15
  },
13
16
  "version": {
14
17
  "type": "string",
15
- "description": "Semantic version of this cluster."
18
+ "description": "Semantic version of this cluster manifest"
19
+ },
20
+ "description": {
21
+ "type": "string",
22
+ "description": "What judgment system this cluster provides"
23
+ },
24
+ "type": {
25
+ "type": "string",
26
+ "enum": ["horizontal", "vertical", "governance", "enterprise_system"],
27
+ "description": "Cluster type determining default loading strategy"
28
+ },
29
+ "status": {
30
+ "type": "string",
31
+ "enum": ["draft", "experimental", "stable", "deprecated"]
16
32
  },
17
- "purpose": {
33
+ "access": {
18
34
  "type": "string",
19
- "description": "What complex domain task this cluster addresses."
35
+ "enum": ["open", "licensed", "runtime"]
20
36
  },
21
- "packages": {
37
+ "domains": {
22
38
  "type": "array",
23
- "description": "KDNA packages that form this cluster.",
24
- "minItems": 2,
25
39
  "items": {
26
40
  "type": "object",
27
- "required": ["id", "role"],
41
+ "required": ["id", "version", "role", "required", "load_condition"],
28
42
  "properties": {
29
- "id": { "type": "string" },
43
+ "id": {
44
+ "type": "string",
45
+ "description": "Fully qualified domain name (@scope/name)"
46
+ },
47
+ "version": {
48
+ "type": "string",
49
+ "description": "Semver range, e.g., ^1.2.0"
50
+ },
30
51
  "role": {
31
52
  "type": "string",
32
- "enum": ["primary", "advisor", "constraint", "critic"]
53
+ "enum": ["primary", "advisor", "risk_guard", "style_and_trust", "evaluator"]
33
54
  },
34
- "use_when": {
35
- "type": "array",
36
- "items": { "type": "string" },
37
- "description": "Keywords or conditions that trigger this package."
55
+ "required": {
56
+ "type": "boolean",
57
+ "description": "Whether this domain must load for cluster to function"
58
+ },
59
+ "load_condition": {
60
+ "type": "string",
61
+ "description": "When this domain should activate"
38
62
  }
39
63
  }
40
64
  }
41
65
  },
42
- "composition_rules": {
66
+ "relationships": {
43
67
  "type": "array",
44
- "items": { "type": "string" },
45
- "description": "Rules governing how packages in this cluster interact."
68
+ "items": {
69
+ "type": "object",
70
+ "required": ["from", "to", "type"],
71
+ "properties": {
72
+ "from": { "type": "string" },
73
+ "to": { "type": "string" },
74
+ "type": {
75
+ "type": "string",
76
+ "enum": ["depends_on", "constrains", "overrides", "blocks", "informs", "extends", "refines", "conflicts_with", "evaluates", "expressed_through"]
77
+ },
78
+ "description": { "type": "string" }
79
+ }
80
+ }
46
81
  },
47
- "routing_questions": {
48
- "type": "array",
49
- "items": { "type": "string" },
50
- "description": "Questions that help the router select the right primary and advisors."
82
+ "composition": {
83
+ "type": "object",
84
+ "required": ["strategy", "conflict_policy", "priority_order"],
85
+ "properties": {
86
+ "strategy": {
87
+ "type": "string",
88
+ "enum": ["fixed", "signal_based", "staged", "overlay", "user_confirmed"]
89
+ },
90
+ "max_active_domains": {
91
+ "type": "integer",
92
+ "minimum": 1
93
+ },
94
+ "default_domains": {
95
+ "type": "array",
96
+ "items": { "type": "string" }
97
+ },
98
+ "conflict_policy": {
99
+ "type": "string",
100
+ "enum": ["surface", "priority", "block", "ask_user"]
101
+ },
102
+ "priority_order": {
103
+ "type": "array",
104
+ "items": { "type": "string" },
105
+ "description": "Ordered list of domain names, highest priority first"
106
+ }
107
+ }
108
+ },
109
+ "token_budget": {
110
+ "type": "object",
111
+ "properties": {
112
+ "max_context_tokens": { "type": "integer" },
113
+ "domain_summary_mode": {
114
+ "type": "string",
115
+ "enum": ["full", "compact", "axioms_only", "scenario_only"]
116
+ },
117
+ "compression_strategy": { "type": "string" }
118
+ }
119
+ },
120
+ "evaluation": {
121
+ "type": "object",
122
+ "properties": {
123
+ "eval_set": { "type": "string" },
124
+ "minimum_pass_rate": { "type": "number", "minimum": 0, "maximum": 1 },
125
+ "required_dimensions": {
126
+ "type": "array",
127
+ "items": { "type": "string" }
128
+ }
129
+ }
51
130
  }
52
131
  }
53
132
  }
@@ -40,6 +40,39 @@
40
40
  },
41
41
  "additionalProperties": true
42
42
  },
43
+ "highest_question": {
44
+ "type": "string",
45
+ "description": "The highest-order question this domain answers."
46
+ },
47
+ "worldview": {
48
+ "type": "array",
49
+ "items": {
50
+ "type": "string"
51
+ },
52
+ "description": "Default assumptions about how the world works in this domain."
53
+ },
54
+ "judgment_role": {
55
+ "type": "object",
56
+ "properties": {
57
+ "acts_as": {
58
+ "type": "string"
59
+ },
60
+ "does_not_act_as": {
61
+ "type": "string"
62
+ },
63
+ "responsibility": {
64
+ "type": "string"
65
+ }
66
+ },
67
+ "additionalProperties": true
68
+ },
69
+ "value_order": {
70
+ "type": "array",
71
+ "items": {
72
+ "type": "string"
73
+ },
74
+ "description": "Priority ordering of values in this domain."
75
+ },
43
76
  "axioms": {
44
77
  "type": "array",
45
78
  "items": {
@@ -49,7 +82,46 @@
49
82
  "one_sentence",
50
83
  "full_statement",
51
84
  "why"
52
- ]
85
+ ],
86
+ "properties": {
87
+ "id": {
88
+ "type": "string"
89
+ },
90
+ "one_sentence": {
91
+ "type": "string"
92
+ },
93
+ "full_statement": {
94
+ "type": "string"
95
+ },
96
+ "why": {
97
+ "type": "string"
98
+ },
99
+ "confidence": {
100
+ "type": "string"
101
+ },
102
+ "evidence_type": {
103
+ "type": "array",
104
+ "items": {
105
+ "type": "string"
106
+ }
107
+ },
108
+ "applies_when": {
109
+ "type": "array",
110
+ "items": {
111
+ "type": "string"
112
+ }
113
+ },
114
+ "does_not_apply_when": {
115
+ "type": "array",
116
+ "items": {
117
+ "type": "string"
118
+ }
119
+ },
120
+ "failure_risk": {
121
+ "type": "string"
122
+ }
123
+ },
124
+ "additionalProperties": true
53
125
  }
54
126
  },
55
127
  "ontology": {
@@ -62,7 +134,37 @@
62
134
  "essence",
63
135
  "boundary",
64
136
  "trigger_signal"
65
- ]
137
+ ],
138
+ "properties": {
139
+ "id": {
140
+ "type": "string"
141
+ },
142
+ "one_sentence": {
143
+ "type": "string"
144
+ },
145
+ "essence": {
146
+ "type": "string"
147
+ },
148
+ "boundary": {
149
+ "type": "string"
150
+ },
151
+ "trigger_signal": {
152
+ "type": "string"
153
+ },
154
+ "applies_when": {
155
+ "type": "array",
156
+ "items": {
157
+ "type": "string"
158
+ }
159
+ },
160
+ "does_not_apply_when": {
161
+ "type": "array",
162
+ "items": {
163
+ "type": "string"
164
+ }
165
+ }
166
+ },
167
+ "additionalProperties": true
66
168
  }
67
169
  },
68
170
  "frameworks": {
@@ -74,7 +176,37 @@
74
176
  "name",
75
177
  "when_to_use",
76
178
  "steps"
77
- ]
179
+ ],
180
+ "properties": {
181
+ "id": {
182
+ "type": "string"
183
+ },
184
+ "name": {
185
+ "type": "string"
186
+ },
187
+ "when_to_use": {
188
+ "type": "string"
189
+ },
190
+ "steps": {
191
+ "type": "array",
192
+ "items": {
193
+ "type": "string"
194
+ }
195
+ },
196
+ "applies_when": {
197
+ "type": "array",
198
+ "items": {
199
+ "type": "string"
200
+ }
201
+ },
202
+ "does_not_apply_when": {
203
+ "type": "array",
204
+ "items": {
205
+ "type": "string"
206
+ }
207
+ }
208
+ },
209
+ "additionalProperties": true
78
210
  }
79
211
  },
80
212
  "core_structure": {
@@ -85,18 +217,67 @@
85
217
  "from",
86
218
  "to",
87
219
  "via"
88
- ]
220
+ ],
221
+ "properties": {
222
+ "from": {
223
+ "type": "string"
224
+ },
225
+ "to": {
226
+ "type": "string"
227
+ },
228
+ "via": {
229
+ "type": "string"
230
+ },
231
+ "applies_when": {
232
+ "type": "array",
233
+ "items": {
234
+ "type": "string"
235
+ }
236
+ },
237
+ "does_not_apply_when": {
238
+ "type": "array",
239
+ "items": {
240
+ "type": "string"
241
+ }
242
+ }
243
+ },
244
+ "additionalProperties": true
89
245
  }
90
246
  },
91
247
  "stances": {
92
248
  "type": "array",
93
249
  "items": {
94
250
  "anyOf": [
95
- { "type": "string" },
96
- { "type": "object", "required": ["stance"] }
251
+ {
252
+ "type": "string"
253
+ },
254
+ {
255
+ "type": "object",
256
+ "required": [
257
+ "stance"
258
+ ],
259
+ "properties": {
260
+ "stance": {
261
+ "type": "string"
262
+ },
263
+ "applies_when": {
264
+ "type": "array",
265
+ "items": {
266
+ "type": "string"
267
+ }
268
+ },
269
+ "does_not_apply_when": {
270
+ "type": "array",
271
+ "items": {
272
+ "type": "string"
273
+ }
274
+ }
275
+ },
276
+ "additionalProperties": true
277
+ }
97
278
  ]
98
279
  }
99
280
  }
100
281
  },
101
282
  "additionalProperties": true
102
- }
283
+ }
@@ -40,8 +40,34 @@
40
40
  "indicators": {
41
41
  "type": "array",
42
42
  "items": { "type": "string" }
43
+ },
44
+ "changed_judgments": {
45
+ "type": "array",
46
+ "items": { "type": "string" },
47
+ "description": "Judgments that changed at this stage."
48
+ },
49
+ "deprecated_axioms": {
50
+ "type": "array",
51
+ "items": { "type": "string" },
52
+ "description": "Axioms that are no longer held at this stage."
53
+ },
54
+ "new_failure_modes": {
55
+ "type": "array",
56
+ "items": { "type": "string" },
57
+ "description": "New failure patterns that emerge at this stage."
58
+ },
59
+ "eval_results": {
60
+ "type": "array",
61
+ "items": { "type": "string" },
62
+ "description": "Evaluation results associated with this stage."
63
+ },
64
+ "known_limitations": {
65
+ "type": "array",
66
+ "items": { "type": "string" },
67
+ "description": "Known limitations at this stage."
43
68
  }
44
- }
69
+ },
70
+ "additionalProperties": true
45
71
  }
46
72
  },
47
73
  "evolution_layers": {
@@ -55,7 +81,8 @@
55
81
  "capability": { "type": "string" },
56
82
  "from_stage": { "type": "string" },
57
83
  "to_stage": { "type": "string" }
58
- }
84
+ },
85
+ "additionalProperties": true
59
86
  }
60
87
  },
61
88
  "measurement": {
@@ -68,8 +95,34 @@
68
95
  "what": { "type": "string" },
69
96
  "how": { "type": "string" },
70
97
  "threshold": { "type": "string" }
71
- }
98
+ },
99
+ "additionalProperties": true
72
100
  }
101
+ },
102
+ "changed_judgments": {
103
+ "type": "array",
104
+ "items": { "type": "string" },
105
+ "description": "Domain-wide judgment changes across versions."
106
+ },
107
+ "deprecated_axioms": {
108
+ "type": "array",
109
+ "items": { "type": "string" },
110
+ "description": "Axioms deprecated across the domain's evolution."
111
+ },
112
+ "new_failure_modes": {
113
+ "type": "array",
114
+ "items": { "type": "string" },
115
+ "description": "New failure modes discovered over time."
116
+ },
117
+ "eval_results": {
118
+ "type": "array",
119
+ "items": { "type": "string" },
120
+ "description": "Evaluation results across versions."
121
+ },
122
+ "known_limitations": {
123
+ "type": "array",
124
+ "items": { "type": "string" },
125
+ "description": "Known limitations of the domain's judgment model."
73
126
  }
74
127
  },
75
128
  "additionalProperties": true