ultimate-brain 0.4.0 → 0.5.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/.agents/skills/brain-apply/SKILL.md +35 -22
- package/.agents/skills/brain-catch-up/SKILL.md +30 -22
- package/.agents/skills/brain-howto/SKILL.md +1 -1
- package/.agents/skills/brain-howto/references/guide.md +70 -43
- package/.agents/skills/brain-ingest/SKILL.md +10 -6
- package/.agents/skills/brain-ingest/references/cli-inputs.md +19 -3
- package/.agents/skills/brain-ingest/references/extraction.md +23 -1
- package/.agents/skills/brain-ingest/references/notion.md +4 -3
- package/.agents/skills/brain-ingest/references/sources.md +25 -5
- package/.agents/skills/brain-notion-change/SKILL.md +2 -0
- package/.agents/skills/brain-query/SKILL.md +17 -7
- package/.agents/skills/brain-sync/SKILL.md +16 -10
- package/.agents/skills/brain-sync/references/formats.md +1 -1
- package/dist/cli.js +3 -3
- package/dist/commands/report.js +81 -4
- package/dist/commands/source.js +34 -0
- package/dist/commands/status.js +2 -2
- package/dist/lib/apply.js +237 -33
- package/dist/lib/diff.js +31 -0
- package/dist/lib/ids.js +2 -0
- package/dist/lib/index-builder.js +6 -1
- package/dist/lib/lint.js +39 -8
- package/dist/lib/note-new.js +21 -2
- package/dist/lib/paths.js +1 -0
- package/dist/lib/proposals.js +72 -18
- package/dist/lib/query.js +1 -1
- package/dist/lib/schemas.js +1 -1
- package/dist/lib/sync.js +129 -53
- package/package.json +1 -1
- package/spec/schemas/brain.schema.json +3 -0
- package/spec/schemas/note.schema.json +130 -2
- package/spec/schemas/proposal.schema.json +461 -14
- package/templates/brain/brain.json +2 -1
- package/templates/brain/knowledge/references/.gitkeep +0 -0
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"enum": [
|
|
39
39
|
"update_fact",
|
|
40
40
|
"add_to_note",
|
|
41
|
+
"update_body",
|
|
41
42
|
"add_link",
|
|
42
43
|
"supersede",
|
|
43
44
|
"contradiction",
|
|
@@ -64,6 +65,10 @@
|
|
|
64
65
|
"type": "string",
|
|
65
66
|
"minLength": 1
|
|
66
67
|
},
|
|
68
|
+
"before_hash": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
71
|
+
},
|
|
67
72
|
"supersedes": {
|
|
68
73
|
"$ref": "note.schema.json#/$defs/id"
|
|
69
74
|
},
|
|
@@ -100,6 +105,7 @@
|
|
|
100
105
|
"enum": [
|
|
101
106
|
"approve",
|
|
102
107
|
"reject",
|
|
108
|
+
"fix",
|
|
103
109
|
"edit"
|
|
104
110
|
]
|
|
105
111
|
},
|
|
@@ -110,6 +116,52 @@
|
|
|
110
116
|
"type": "string",
|
|
111
117
|
"minLength": 1
|
|
112
118
|
},
|
|
119
|
+
"fixes": {
|
|
120
|
+
"description": "On fix: the corrected values the skill read from the What to fix text (spec/schema.md §11.3).",
|
|
121
|
+
"type": "array",
|
|
122
|
+
"minItems": 1,
|
|
123
|
+
"items": {
|
|
124
|
+
"type": "object",
|
|
125
|
+
"required": [
|
|
126
|
+
"value"
|
|
127
|
+
],
|
|
128
|
+
"additionalProperties": false,
|
|
129
|
+
"properties": {
|
|
130
|
+
"value": {},
|
|
131
|
+
"change": {
|
|
132
|
+
"type": "integer",
|
|
133
|
+
"minimum": 0
|
|
134
|
+
},
|
|
135
|
+
"note": {
|
|
136
|
+
"$ref": "note.schema.json#/$defs/id"
|
|
137
|
+
},
|
|
138
|
+
"field": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"minLength": 1
|
|
141
|
+
},
|
|
142
|
+
"link": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"required": [
|
|
145
|
+
"field",
|
|
146
|
+
"value"
|
|
147
|
+
],
|
|
148
|
+
"additionalProperties": false,
|
|
149
|
+
"properties": {
|
|
150
|
+
"target": {
|
|
151
|
+
"$ref": "note.schema.json#/$defs/id"
|
|
152
|
+
},
|
|
153
|
+
"field": {
|
|
154
|
+
"type": "string"
|
|
155
|
+
},
|
|
156
|
+
"value": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"minLength": 1
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
113
165
|
"exclude": {
|
|
114
166
|
"type": "array",
|
|
115
167
|
"minItems": 1,
|
|
@@ -130,6 +182,10 @@
|
|
|
130
182
|
"value": {
|
|
131
183
|
"type": "string",
|
|
132
184
|
"minLength": 1
|
|
185
|
+
},
|
|
186
|
+
"change": {
|
|
187
|
+
"type": "integer",
|
|
188
|
+
"minimum": 0
|
|
133
189
|
}
|
|
134
190
|
},
|
|
135
191
|
"oneOf": [
|
|
@@ -153,6 +209,11 @@
|
|
|
153
209
|
"required": [
|
|
154
210
|
"target"
|
|
155
211
|
]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"required": [
|
|
215
|
+
"change"
|
|
216
|
+
]
|
|
156
217
|
}
|
|
157
218
|
]
|
|
158
219
|
}
|
|
@@ -163,8 +224,46 @@
|
|
|
163
224
|
"value"
|
|
164
225
|
],
|
|
165
226
|
"not": {
|
|
166
|
-
"
|
|
167
|
-
|
|
227
|
+
"anyOf": [
|
|
228
|
+
{
|
|
229
|
+
"required": [
|
|
230
|
+
"note"
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"required": [
|
|
235
|
+
"change"
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"required": [
|
|
243
|
+
"change"
|
|
244
|
+
],
|
|
245
|
+
"not": {
|
|
246
|
+
"anyOf": [
|
|
247
|
+
{
|
|
248
|
+
"required": [
|
|
249
|
+
"note"
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"required": [
|
|
254
|
+
"target"
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"required": [
|
|
259
|
+
"field"
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"required": [
|
|
264
|
+
"value"
|
|
265
|
+
]
|
|
266
|
+
}
|
|
168
267
|
]
|
|
169
268
|
}
|
|
170
269
|
}
|
|
@@ -181,18 +280,51 @@
|
|
|
181
280
|
]
|
|
182
281
|
}
|
|
183
282
|
},
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
"
|
|
187
|
-
"
|
|
283
|
+
"allOf": [
|
|
284
|
+
{
|
|
285
|
+
"if": {
|
|
286
|
+
"properties": {
|
|
287
|
+
"action": {
|
|
288
|
+
"const": "edit"
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
"then": {
|
|
293
|
+
"required": [
|
|
294
|
+
"value"
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"if": {
|
|
300
|
+
"properties": {
|
|
301
|
+
"action": {
|
|
302
|
+
"const": "fix"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"then": {
|
|
307
|
+
"required": [
|
|
308
|
+
"note",
|
|
309
|
+
"fixes"
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"if": {
|
|
315
|
+
"required": [
|
|
316
|
+
"fixes"
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
"then": {
|
|
320
|
+
"properties": {
|
|
321
|
+
"action": {
|
|
322
|
+
"const": "fix"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
188
325
|
}
|
|
189
326
|
}
|
|
190
|
-
|
|
191
|
-
"then": {
|
|
192
|
-
"required": [
|
|
193
|
-
"value"
|
|
194
|
-
]
|
|
195
|
-
}
|
|
327
|
+
]
|
|
196
328
|
},
|
|
197
329
|
"notion": {
|
|
198
330
|
"$ref": "note.schema.json#/$defs/notionPageId"
|
|
@@ -276,6 +408,38 @@
|
|
|
276
408
|
"$ref": "note.schema.json#/$defs/id"
|
|
277
409
|
}
|
|
278
410
|
},
|
|
411
|
+
"changes": {
|
|
412
|
+
"description": "review_notes only: the update_fact, update_body and add_to_note items of the same ingest, in render order (spec/schema.md §11.3).",
|
|
413
|
+
"type": "array",
|
|
414
|
+
"items": {
|
|
415
|
+
"$ref": "#/$defs/change"
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
"deferred_from": {
|
|
419
|
+
"type": "string",
|
|
420
|
+
"pattern": "^prp-[0-9abcdefghjkmnpqrstvwxyz]{8}$"
|
|
421
|
+
},
|
|
422
|
+
"dropped": {
|
|
423
|
+
"type": "array",
|
|
424
|
+
"minItems": 1,
|
|
425
|
+
"items": {
|
|
426
|
+
"type": "object",
|
|
427
|
+
"required": [
|
|
428
|
+
"change",
|
|
429
|
+
"reason"
|
|
430
|
+
],
|
|
431
|
+
"additionalProperties": false,
|
|
432
|
+
"properties": {
|
|
433
|
+
"change": {
|
|
434
|
+
"type": "integer",
|
|
435
|
+
"minimum": 0
|
|
436
|
+
},
|
|
437
|
+
"reason": {
|
|
438
|
+
"const": "stale"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
},
|
|
279
443
|
"answer": {
|
|
280
444
|
"type": "string",
|
|
281
445
|
"minLength": 1
|
|
@@ -339,6 +503,46 @@
|
|
|
339
503
|
}
|
|
340
504
|
}
|
|
341
505
|
},
|
|
506
|
+
{
|
|
507
|
+
"if": {
|
|
508
|
+
"properties": {
|
|
509
|
+
"kind": {
|
|
510
|
+
"const": "update_body"
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
"then": {
|
|
515
|
+
"required": [
|
|
516
|
+
"target",
|
|
517
|
+
"content",
|
|
518
|
+
"before_hash"
|
|
519
|
+
],
|
|
520
|
+
"not": {
|
|
521
|
+
"anyOf": [
|
|
522
|
+
{
|
|
523
|
+
"required": [
|
|
524
|
+
"field"
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"required": [
|
|
529
|
+
"before"
|
|
530
|
+
]
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"required": [
|
|
534
|
+
"after"
|
|
535
|
+
]
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"required": [
|
|
539
|
+
"note"
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
},
|
|
342
546
|
{
|
|
343
547
|
"if": {
|
|
344
548
|
"properties": {
|
|
@@ -563,6 +767,7 @@
|
|
|
563
767
|
"properties": {
|
|
564
768
|
"action": {
|
|
565
769
|
"enum": [
|
|
770
|
+
"fix",
|
|
566
771
|
"edit"
|
|
567
772
|
]
|
|
568
773
|
}
|
|
@@ -620,6 +825,7 @@
|
|
|
620
825
|
"action": {
|
|
621
826
|
"enum": [
|
|
622
827
|
"approve",
|
|
828
|
+
"fix",
|
|
623
829
|
"edit"
|
|
624
830
|
]
|
|
625
831
|
}
|
|
@@ -670,6 +876,7 @@
|
|
|
670
876
|
"action": {
|
|
671
877
|
"enum": [
|
|
672
878
|
"approve",
|
|
879
|
+
"fix",
|
|
673
880
|
"edit"
|
|
674
881
|
]
|
|
675
882
|
}
|
|
@@ -705,6 +912,7 @@
|
|
|
705
912
|
"update_fact",
|
|
706
913
|
"contradiction",
|
|
707
914
|
"add_to_note",
|
|
915
|
+
"update_body",
|
|
708
916
|
"answer"
|
|
709
917
|
]
|
|
710
918
|
}
|
|
@@ -766,7 +974,10 @@
|
|
|
766
974
|
"decision": {
|
|
767
975
|
"properties": {
|
|
768
976
|
"action": {
|
|
769
|
-
"
|
|
977
|
+
"enum": [
|
|
978
|
+
"approve",
|
|
979
|
+
"fix"
|
|
980
|
+
]
|
|
770
981
|
}
|
|
771
982
|
}
|
|
772
983
|
}
|
|
@@ -809,6 +1020,16 @@
|
|
|
809
1020
|
"minItems": 1
|
|
810
1021
|
}
|
|
811
1022
|
}
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
"required": [
|
|
1026
|
+
"changes"
|
|
1027
|
+
],
|
|
1028
|
+
"properties": {
|
|
1029
|
+
"changes": {
|
|
1030
|
+
"minItems": 1
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
812
1033
|
}
|
|
813
1034
|
],
|
|
814
1035
|
"not": {
|
|
@@ -1011,6 +1232,11 @@
|
|
|
1011
1232
|
"required": [
|
|
1012
1233
|
"note"
|
|
1013
1234
|
]
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
"required": [
|
|
1238
|
+
"change"
|
|
1239
|
+
]
|
|
1014
1240
|
}
|
|
1015
1241
|
]
|
|
1016
1242
|
}
|
|
@@ -1056,6 +1282,11 @@
|
|
|
1056
1282
|
"field",
|
|
1057
1283
|
"value"
|
|
1058
1284
|
]
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
"required": [
|
|
1288
|
+
"change"
|
|
1289
|
+
]
|
|
1059
1290
|
}
|
|
1060
1291
|
]
|
|
1061
1292
|
}
|
|
@@ -1064,6 +1295,222 @@
|
|
|
1064
1295
|
}
|
|
1065
1296
|
}
|
|
1066
1297
|
}
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
"if": {
|
|
1301
|
+
"required": [
|
|
1302
|
+
"before_hash"
|
|
1303
|
+
]
|
|
1304
|
+
},
|
|
1305
|
+
"then": {
|
|
1306
|
+
"properties": {
|
|
1307
|
+
"kind": {
|
|
1308
|
+
"const": "update_body"
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
"if": {
|
|
1315
|
+
"anyOf": [
|
|
1316
|
+
{
|
|
1317
|
+
"required": [
|
|
1318
|
+
"changes"
|
|
1319
|
+
]
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
"required": [
|
|
1323
|
+
"deferred_from"
|
|
1324
|
+
]
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
"required": [
|
|
1328
|
+
"dropped"
|
|
1329
|
+
]
|
|
1330
|
+
}
|
|
1331
|
+
]
|
|
1332
|
+
},
|
|
1333
|
+
"then": {
|
|
1334
|
+
"properties": {
|
|
1335
|
+
"kind": {
|
|
1336
|
+
"const": "review_notes"
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
"if": {
|
|
1343
|
+
"required": [
|
|
1344
|
+
"dropped"
|
|
1345
|
+
]
|
|
1346
|
+
},
|
|
1347
|
+
"then": {
|
|
1348
|
+
"properties": {
|
|
1349
|
+
"status": {
|
|
1350
|
+
"const": "applied"
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
],
|
|
1356
|
+
"$defs": {
|
|
1357
|
+
"change": {
|
|
1358
|
+
"type": "object",
|
|
1359
|
+
"required": [
|
|
1360
|
+
"kind",
|
|
1361
|
+
"target"
|
|
1362
|
+
],
|
|
1363
|
+
"additionalProperties": false,
|
|
1364
|
+
"properties": {
|
|
1365
|
+
"kind": {
|
|
1366
|
+
"enum": [
|
|
1367
|
+
"update_fact",
|
|
1368
|
+
"update_body",
|
|
1369
|
+
"add_to_note"
|
|
1370
|
+
]
|
|
1371
|
+
},
|
|
1372
|
+
"target": {
|
|
1373
|
+
"$ref": "note.schema.json#/$defs/id"
|
|
1374
|
+
},
|
|
1375
|
+
"why": {
|
|
1376
|
+
"type": "string",
|
|
1377
|
+
"minLength": 1
|
|
1378
|
+
},
|
|
1379
|
+
"field": {
|
|
1380
|
+
"type": "string",
|
|
1381
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
1382
|
+
},
|
|
1383
|
+
"before": {
|
|
1384
|
+
"$ref": "note.schema.json#/$defs/factValue"
|
|
1385
|
+
},
|
|
1386
|
+
"after": {
|
|
1387
|
+
"$ref": "note.schema.json#/$defs/factValue"
|
|
1388
|
+
},
|
|
1389
|
+
"from": {
|
|
1390
|
+
"$ref": "note.schema.json#/$defs/dateOrMonth"
|
|
1391
|
+
},
|
|
1392
|
+
"content": {
|
|
1393
|
+
"type": "string",
|
|
1394
|
+
"minLength": 1
|
|
1395
|
+
},
|
|
1396
|
+
"before_hash": {
|
|
1397
|
+
"type": "string",
|
|
1398
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
"allOf": [
|
|
1402
|
+
{
|
|
1403
|
+
"if": {
|
|
1404
|
+
"properties": {
|
|
1405
|
+
"kind": {
|
|
1406
|
+
"const": "update_fact"
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
"then": {
|
|
1411
|
+
"required": [
|
|
1412
|
+
"field",
|
|
1413
|
+
"after"
|
|
1414
|
+
],
|
|
1415
|
+
"not": {
|
|
1416
|
+
"anyOf": [
|
|
1417
|
+
{
|
|
1418
|
+
"required": [
|
|
1419
|
+
"content"
|
|
1420
|
+
]
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
"required": [
|
|
1424
|
+
"before_hash"
|
|
1425
|
+
]
|
|
1426
|
+
}
|
|
1427
|
+
]
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
"if": {
|
|
1433
|
+
"properties": {
|
|
1434
|
+
"kind": {
|
|
1435
|
+
"const": "update_body"
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
},
|
|
1439
|
+
"then": {
|
|
1440
|
+
"required": [
|
|
1441
|
+
"content",
|
|
1442
|
+
"before_hash"
|
|
1443
|
+
],
|
|
1444
|
+
"not": {
|
|
1445
|
+
"anyOf": [
|
|
1446
|
+
{
|
|
1447
|
+
"required": [
|
|
1448
|
+
"field"
|
|
1449
|
+
]
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
"required": [
|
|
1453
|
+
"before"
|
|
1454
|
+
]
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
"required": [
|
|
1458
|
+
"after"
|
|
1459
|
+
]
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
"required": [
|
|
1463
|
+
"from"
|
|
1464
|
+
]
|
|
1465
|
+
}
|
|
1466
|
+
]
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
"if": {
|
|
1472
|
+
"properties": {
|
|
1473
|
+
"kind": {
|
|
1474
|
+
"const": "add_to_note"
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
"then": {
|
|
1479
|
+
"required": [
|
|
1480
|
+
"content"
|
|
1481
|
+
],
|
|
1482
|
+
"not": {
|
|
1483
|
+
"anyOf": [
|
|
1484
|
+
{
|
|
1485
|
+
"required": [
|
|
1486
|
+
"field"
|
|
1487
|
+
]
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
"required": [
|
|
1491
|
+
"before"
|
|
1492
|
+
]
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
"required": [
|
|
1496
|
+
"after"
|
|
1497
|
+
]
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
"required": [
|
|
1501
|
+
"from"
|
|
1502
|
+
]
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
"required": [
|
|
1506
|
+
"before_hash"
|
|
1507
|
+
]
|
|
1508
|
+
}
|
|
1509
|
+
]
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
]
|
|
1067
1514
|
}
|
|
1068
|
-
|
|
1515
|
+
}
|
|
1069
1516
|
}
|
|
File without changes
|