@aikdna/kdna-core 0.2.3 → 0.4.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.
@@ -0,0 +1,342 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "KDNA_Patterns",
4
+ "type": "object",
5
+ "required": [
6
+ "meta",
7
+ "terminology",
8
+ "misunderstandings",
9
+ "self_check"
10
+ ],
11
+ "properties": {
12
+ "meta": {
13
+ "type": "object",
14
+ "required": [
15
+ "version",
16
+ "domain",
17
+ "created",
18
+ "purpose",
19
+ "load_condition"
20
+ ],
21
+ "properties": {
22
+ "version": {
23
+ "type": "string"
24
+ },
25
+ "domain": {
26
+ "type": "string",
27
+ "pattern": "^[a-z][a-z0-9_]*$"
28
+ },
29
+ "created": {
30
+ "type": "string"
31
+ },
32
+ "purpose": {
33
+ "type": "string"
34
+ },
35
+ "load_condition": {
36
+ "type": "string"
37
+ }
38
+ },
39
+ "additionalProperties": true
40
+ },
41
+ "terminology": {
42
+ "type": "object",
43
+ "minProperties": 1,
44
+ "properties": {
45
+ "standard_terms": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "object",
49
+ "required": [
50
+ "term",
51
+ "definition"
52
+ ],
53
+ "properties": {
54
+ "term": {
55
+ "type": "string"
56
+ },
57
+ "definition": {
58
+ "type": "string"
59
+ },
60
+ "applies_when": {
61
+ "type": "array",
62
+ "items": {
63
+ "type": "string"
64
+ }
65
+ },
66
+ "does_not_apply_when": {
67
+ "type": "array",
68
+ "items": {
69
+ "type": "string"
70
+ }
71
+ }
72
+ },
73
+ "additionalProperties": true
74
+ }
75
+ },
76
+ "preferred_terms": {
77
+ "type": "array",
78
+ "items": {
79
+ "type": "object",
80
+ "required": [
81
+ "term",
82
+ "definition"
83
+ ],
84
+ "properties": {
85
+ "term": {
86
+ "type": "string"
87
+ },
88
+ "definition": {
89
+ "type": "string"
90
+ },
91
+ "applies_when": {
92
+ "type": "array",
93
+ "items": {
94
+ "type": "string"
95
+ }
96
+ },
97
+ "does_not_apply_when": {
98
+ "type": "array",
99
+ "items": {
100
+ "type": "string"
101
+ }
102
+ }
103
+ },
104
+ "additionalProperties": true
105
+ }
106
+ },
107
+ "banned_terms": {
108
+ "type": "array",
109
+ "items": {
110
+ "type": "object",
111
+ "required": [
112
+ "term",
113
+ "why",
114
+ "replace_with"
115
+ ],
116
+ "properties": {
117
+ "term": {
118
+ "type": "string"
119
+ },
120
+ "why": {
121
+ "type": "string"
122
+ },
123
+ "replace_with": {
124
+ "type": "string"
125
+ },
126
+ "applies_when": {
127
+ "type": "array",
128
+ "items": {
129
+ "type": "string"
130
+ }
131
+ },
132
+ "does_not_apply_when": {
133
+ "type": "array",
134
+ "items": {
135
+ "type": "string"
136
+ }
137
+ }
138
+ },
139
+ "additionalProperties": true
140
+ }
141
+ }
142
+ },
143
+ "additionalProperties": true
144
+ },
145
+ "aesthetic_preferences": {
146
+ "type": "array",
147
+ "items": {
148
+ "type": "object",
149
+ "required": [
150
+ "prefer",
151
+ "avoid"
152
+ ],
153
+ "properties": {
154
+ "prefer": {
155
+ "type": "string"
156
+ },
157
+ "avoid": {
158
+ "type": "string"
159
+ },
160
+ "signals_good": {
161
+ "type": "array",
162
+ "items": { "type": "string" }
163
+ },
164
+ "signals_bad": {
165
+ "type": "array",
166
+ "items": { "type": "string" }
167
+ }
168
+ },
169
+ "additionalProperties": true
170
+ }
171
+ },
172
+ "boundaries": {
173
+ "type": "array",
174
+ "items": {
175
+ "type": "object",
176
+ "required": [
177
+ "rule",
178
+ "why"
179
+ ],
180
+ "properties": {
181
+ "rule": {
182
+ "type": "string"
183
+ },
184
+ "why": {
185
+ "type": "string"
186
+ },
187
+ "must_not_do": {
188
+ "type": "array",
189
+ "items": { "type": "string" }
190
+ },
191
+ "acceptable_exception": {
192
+ "type": "array",
193
+ "items": { "type": "string" }
194
+ }
195
+ },
196
+ "additionalProperties": true
197
+ }
198
+ },
199
+ "risk_model": {
200
+ "type": "object",
201
+ "properties": {
202
+ "highest_risk_errors": {
203
+ "type": "array",
204
+ "items": {
205
+ "type": "string"
206
+ }
207
+ },
208
+ "acceptable_errors": {
209
+ "type": "array",
210
+ "items": {
211
+ "type": "string"
212
+ }
213
+ },
214
+ "must_block_when": {
215
+ "type": "array",
216
+ "items": { "type": "string" }
217
+ },
218
+ "warn_when": {
219
+ "type": "array",
220
+ "items": { "type": "string" }
221
+ }
222
+ },
223
+ "additionalProperties": true
224
+ },
225
+ "misunderstandings": {
226
+ "type": "array",
227
+ "items": {
228
+ "type": "object",
229
+ "required": [
230
+ "id",
231
+ "wrong",
232
+ "correct",
233
+ "key_distinction",
234
+ "why",
235
+ "applies_when",
236
+ "does_not_apply_when",
237
+ "failure_risk",
238
+ "confidence"
239
+ ],
240
+ "properties": {
241
+ "id": {
242
+ "type": "string"
243
+ },
244
+ "wrong": {
245
+ "type": "string"
246
+ },
247
+ "correct": {
248
+ "type": "string"
249
+ },
250
+ "key_distinction": {
251
+ "type": "string"
252
+ },
253
+ "why": {
254
+ "type": "string"
255
+ },
256
+ "confidence": {
257
+ "type": "string"
258
+ },
259
+ "evidence_type": {
260
+ "type": "array",
261
+ "items": {
262
+ "type": "string"
263
+ }
264
+ },
265
+ "applies_when": {
266
+ "type": "array",
267
+ "items": {
268
+ "type": "string"
269
+ }
270
+ },
271
+ "does_not_apply_when": {
272
+ "type": "array",
273
+ "items": {
274
+ "type": "string"
275
+ }
276
+ },
277
+ "failure_risk": {
278
+ "type": "string"
279
+ }
280
+ },
281
+ "additionalProperties": true
282
+ }
283
+ },
284
+ "self_check": {
285
+ "type": "array",
286
+ "items": {
287
+ "anyOf": [
288
+ {
289
+ "type": "string"
290
+ },
291
+ {
292
+ "type": "object",
293
+ "required": [
294
+ "question"
295
+ ],
296
+ "properties": {
297
+ "question": {
298
+ "type": "string"
299
+ },
300
+ "applies_when": {
301
+ "type": "array",
302
+ "items": {
303
+ "type": "string"
304
+ }
305
+ }
306
+ },
307
+ "additionalProperties": true
308
+ }
309
+ ]
310
+ }
311
+ },
312
+ "counterexamples": {
313
+ "type": "array",
314
+ "items": {
315
+ "type": "object",
316
+ "required": [
317
+ "bad_example",
318
+ "why_bad"
319
+ ],
320
+ "properties": {
321
+ "bad_example": {
322
+ "type": "string"
323
+ },
324
+ "why_bad": {
325
+ "type": "string"
326
+ },
327
+ "violated_axioms": {
328
+ "type": "array",
329
+ "items": {
330
+ "type": "string"
331
+ }
332
+ },
333
+ "better_direction": {
334
+ "type": "string"
335
+ }
336
+ },
337
+ "additionalProperties": true
338
+ }
339
+ }
340
+ },
341
+ "additionalProperties": true
342
+ }
@@ -14,22 +14,11 @@
14
14
  "load_condition"
15
15
  ],
16
16
  "properties": {
17
- "version": {
18
- "type": "string"
19
- },
20
- "domain": {
21
- "type": "string",
22
- "pattern": "^[a-z][a-z0-9_]*$"
23
- },
24
- "created": {
25
- "type": "string"
26
- },
27
- "purpose": {
28
- "type": "string"
29
- },
30
- "load_condition": {
31
- "type": "string"
32
- }
17
+ "version": { "type": "string" },
18
+ "domain": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
19
+ "created": { "type": "string" },
20
+ "purpose": { "type": "string" },
21
+ "load_condition": { "type": "string" }
33
22
  },
34
23
  "additionalProperties": true
35
24
  },
@@ -48,9 +37,40 @@
48
37
  "one_sentence",
49
38
  "logic",
50
39
  "so_what"
51
- ]
40
+ ],
41
+ "properties": {
42
+ "id": { "type": "string" },
43
+ "one_sentence": { "type": "string" },
44
+ "logic": {
45
+ "type": "array",
46
+ "items": { "type": "string" }
47
+ },
48
+ "so_what": { "type": "string" },
49
+ "tradeoffs": {
50
+ "type": "string",
51
+ "description": "Trade-offs inherent in this reasoning chain."
52
+ },
53
+ "conflict_resolution": {
54
+ "type": "string",
55
+ "description": "How to resolve conflicts when this chain clashes with other principles."
56
+ },
57
+ "when_not_to_use": {
58
+ "type": "string",
59
+ "description": "Situations where this reasoning chain should not be applied."
60
+ },
61
+ "evidence_required": {
62
+ "type": "array",
63
+ "items": { "type": "string" },
64
+ "description": "Evidence needed before this chain can be confidently applied."
65
+ },
66
+ "uncertainty_handling": {
67
+ "type": "string",
68
+ "description": "How to proceed when evidence is incomplete or ambiguous."
69
+ }
70
+ },
71
+ "additionalProperties": true
52
72
  }
53
73
  }
54
74
  },
55
75
  "additionalProperties": true
56
- }
76
+ }
@@ -15,7 +15,10 @@
15
15
  ],
16
16
  "properties": {
17
17
  "version": { "type": "string" },
18
- "domain": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
18
+ "domain": {
19
+ "type": "string",
20
+ "pattern": "^[a-z][a-z0-9_]*$"
21
+ },
19
22
  "created": { "type": "string" },
20
23
  "purpose": { "type": "string" },
21
24
  "load_condition": { "type": "string" }
@@ -29,19 +32,45 @@
29
32
  }
30
33
  },
31
34
  "scenes": {
35
+ "description": "Deprecated since v1.0-rc. Use scenarios (canonical) instead. Kept for backward compatibility.",
32
36
  "type": "array",
33
37
  "items": {
34
38
  "type": "object",
35
- "required": ["id", "name", "trigger_signal"],
39
+ "required": ["id", "name"],
36
40
  "properties": {
37
41
  "id": { "type": "string" },
38
42
  "name": { "type": "string" },
39
- "trigger_signal": { "type": "string" },
43
+ "trigger_signal": {
44
+ "type": "string",
45
+ "description": "Deprecated since v1.0-rc. Use trigger_signals (array) instead. Kept for backward compatibility."
46
+ },
47
+ "trigger_signals": {
48
+ "type": "array",
49
+ "items": { "type": "string" },
50
+ "description": "Signals that trigger this scene."
51
+ },
52
+ "negative_signals": {
53
+ "type": "array",
54
+ "items": { "type": "string" },
55
+ "description": "Signals that explicitly exclude this scene."
56
+ },
57
+ "classification_rule": {
58
+ "type": "string",
59
+ "description": "Rule for classifying input into this scene."
60
+ },
61
+ "risk_level": {
62
+ "type": "string",
63
+ "description": "Risk level associated with this scene."
64
+ },
65
+ "expected_judgment_shift": {
66
+ "type": "string",
67
+ "description": "How judgment should shift when this scene is detected."
68
+ },
40
69
  "sub_scenarios": {
41
70
  "type": "array",
42
71
  "items": {
43
72
  "type": "object",
44
- "required": ["id", "trap_belief", "three_questions", "action_template", "expected_result"],
73
+ "required": ["id", "trap_belief", "action_template", "expected_result"],
45
74
  "properties": {
46
75
  "id": { "type": "string" },
47
76
  "trap_belief": { "type": "string" },
@@ -70,10 +99,12 @@
70
99
  }
71
100
  },
72
101
  "expected_result": { "type": "string" }
73
- }
102
+ },
103
+ "additionalProperties": true
74
104
  }
75
105
  }
76
- }
106
+ },
107
+ "additionalProperties": true
77
108
  }
78
109
  }
79
110
  },
@@ -0,0 +1,101 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "KDNA_Scenarios (Strict)",
4
+ "type": "object",
5
+ "required": ["meta", "scenarios"],
6
+ "properties": {
7
+ "meta": {
8
+ "type": "object",
9
+ "required": [
10
+ "version",
11
+ "domain",
12
+ "created",
13
+ "purpose",
14
+ "load_condition"
15
+ ],
16
+ "properties": {
17
+ "version": { "type": "string" },
18
+ "domain": {
19
+ "type": "string",
20
+ "pattern": "^[a-z][a-z0-9_]*$"
21
+ },
22
+ "created": { "type": "string" },
23
+ "purpose": { "type": "string" },
24
+ "load_condition": { "type": "string" }
25
+ },
26
+ "additionalProperties": true
27
+ },
28
+ "scenarios": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "object",
32
+ "required": ["id", "name", "trigger_signals"],
33
+ "properties": {
34
+ "id": { "type": "string" },
35
+ "name": { "type": "string" },
36
+ "trigger_signals": {
37
+ "type": "array",
38
+ "items": { "type": "string" },
39
+ "description": "Signals that trigger this scenario."
40
+ },
41
+ "negative_signals": {
42
+ "type": "array",
43
+ "items": { "type": "string" },
44
+ "description": "Signals that explicitly exclude this scenario."
45
+ },
46
+ "classification_rule": {
47
+ "type": "string",
48
+ "description": "Rule for classifying input into this scenario."
49
+ },
50
+ "risk_level": {
51
+ "type": "string",
52
+ "description": "Risk level associated with this scenario."
53
+ },
54
+ "expected_judgment_shift": {
55
+ "type": "string",
56
+ "description": "How judgment should shift when this scenario is detected."
57
+ },
58
+ "sub_scenarios": {
59
+ "type": "array",
60
+ "items": {
61
+ "type": "object",
62
+ "required": ["id", "trap_belief", "action_template", "expected_result"],
63
+ "properties": {
64
+ "id": { "type": "string" },
65
+ "trap_belief": { "type": "string" },
66
+ "three_questions": {
67
+ "type": "object",
68
+ "required": ["belief", "state", "need"],
69
+ "properties": {
70
+ "belief": { "type": "string" },
71
+ "state": { "type": "string" },
72
+ "need": { "type": "string" }
73
+ }
74
+ },
75
+ "action_template": {
76
+ "type": "array",
77
+ "items": { "type": "string" }
78
+ },
79
+ "replace": {
80
+ "type": "array",
81
+ "items": {
82
+ "type": "object",
83
+ "required": ["avoid", "use"],
84
+ "properties": {
85
+ "avoid": { "type": "string" },
86
+ "use": { "type": "string" }
87
+ }
88
+ }
89
+ },
90
+ "expected_result": { "type": "string" }
91
+ },
92
+ "additionalProperties": true
93
+ }
94
+ }
95
+ },
96
+ "additionalProperties": true
97
+ }
98
+ }
99
+ },
100
+ "additionalProperties": false
101
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "KDNA_Eval",
4
+ "type": "object",
5
+ "required": [
6
+ "id",
7
+ "domain",
8
+ "input",
9
+ "expected_classification",
10
+ "output_rubric"
11
+ ],
12
+ "properties": {
13
+ "id": {
14
+ "type": "string",
15
+ "description": "Unique identifier for this eval case."
16
+ },
17
+ "domain": {
18
+ "type": "string",
19
+ "description": "The domain this eval tests, e.g., @aikdna/writing."
20
+ },
21
+ "input": {
22
+ "type": "string",
23
+ "description": "The user input text to be evaluated."
24
+ },
25
+ "expected_classification": {
26
+ "type": "string",
27
+ "description": "The scenario or state the input should be classified into."
28
+ },
29
+ "expected_axioms": {
30
+ "type": "array",
31
+ "items": { "type": "string" },
32
+ "description": "Axiom IDs that should be triggered by this input."
33
+ },
34
+ "expected_misunderstandings_avoided": {
35
+ "type": "array",
36
+ "items": { "type": "string" },
37
+ "description": "Misunderstanding IDs the agent should avoid falling into."
38
+ },
39
+ "expected_banned_terms_avoided": {
40
+ "type": "array",
41
+ "items": { "type": "string" },
42
+ "description": "Banned terms the agent should avoid using."
43
+ },
44
+ "output_rubric": {
45
+ "type": "string",
46
+ "description": "What the judgment output should contain to pass."
47
+ },
48
+ "pass": {
49
+ "type": "boolean",
50
+ "description": "Whether this eval passed (set during verification)."
51
+ },
52
+ "evidence": {
53
+ "type": "string",
54
+ "description": "Explanation of why the eval passed or failed."
55
+ }
56
+ },
57
+ "additionalProperties": true
58
+ }