@tangleai/memory 0.21.1 → 0.24.1

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,695 @@
1
+ import { deepFreeze } from '@jarenjs/core/object';
2
+ export const DEFAULT_MEMORY_POLICY = deepFreeze({
3
+ "novelty": {
4
+ "enabled": false,
5
+ "threshold": 2
6
+ },
7
+ "contradiction": {
8
+ "enabled": false,
9
+ "threshold": 2,
10
+ "maxPairs": 20
11
+ },
12
+ "crystallization": {
13
+ "enabled": false,
14
+ "threshold": 2
15
+ },
16
+ "retrieval": {
17
+ "k": 10,
18
+ "minScore": 0
19
+ },
20
+ "embedding": {
21
+ "model": "hash-trigram-512",
22
+ "dims": 512,
23
+ "tier": "keyless"
24
+ }
25
+ });
26
+ export const POLICY_PROVENANCE = deepFreeze({
27
+ "reportId": "b003bccaac49b44931787955e5caa0efddb58fec706da029760e50540d8f5b14",
28
+ "registrationId": "617b777166ab601600cc8ff330e7f0edf7ba2fb0011368ef3089f2650d6c783f",
29
+ "cellId": "f9a742d02a54a2f222065707243200d84c7bd8afb9d2aacbd8b9ca524aaf49a6",
30
+ "sourceId": "74b047084f6109350af686fe5809d0c921f6c3381c7903562391a49aa107df6c",
31
+ "transitionId": "dc50dbb1fb2a572f2b0086584c641bca8a9f9cc02ceae6423b50f3d3ca36f7db",
32
+ "challengerId": "5121f66d7bcda05e6c56b8e950d361240fac3b25a8a89163f84ba0f25fca5e16",
33
+ "ingestTier": "live",
34
+ "retrievalTier": "live",
35
+ "embeddingTier": "keyless",
36
+ "qualifiesAsDefault": false,
37
+ "statement": "the challenger did not pass every registered clause, so the inert cell is the default and the result is a bounded null: no effect larger than 0.0024 was detectable at 89 pairs (paired SD 0.0115, standard error 0.0012, 86 tied, 3 acting)",
38
+ "power": {
39
+ "pairedSd": 0.011457984574326978,
40
+ "standardError": 0.0012145439357932172,
41
+ "minimumDetectableEffect": 0.002380462373715384,
42
+ "tiedPairs": 86,
43
+ "actingSetSize": 3
44
+ },
45
+ "interval": {
46
+ "low": -0.0014640789921688796,
47
+ "high": 0.003215677372980744
48
+ },
49
+ "clauses": [
50
+ {
51
+ "clause": "eligible",
52
+ "passed": true,
53
+ "detail": "both rows answered the same questions with no hidden failure"
54
+ },
55
+ {
56
+ "clause": "primary-objective",
57
+ "passed": true,
58
+ "detail": "locomo-f1, the registered primary"
59
+ },
60
+ {
61
+ "clause": "held-out-split",
62
+ "passed": true,
63
+ "detail": "measured on the held-out split"
64
+ },
65
+ {
66
+ "clause": "overall-interval",
67
+ "passed": false,
68
+ "detail": "the 95% lower bound is -0.0015"
69
+ },
70
+ {
71
+ "clause": "category-floor",
72
+ "passed": true,
73
+ "detail": "every category's one-sided lower bound is at least -0.05"
74
+ },
75
+ {
76
+ "clause": "token-ratio",
77
+ "passed": true,
78
+ "detail": "1.000× the control's tokens per answered question, against a ceiling of 1.10"
79
+ },
80
+ {
81
+ "clause": "call-ratio",
82
+ "passed": true,
83
+ "detail": "1.000× the control's calls per answered question, against a ceiling of 1.00"
84
+ },
85
+ {
86
+ "clause": "acting-set",
87
+ "passed": true,
88
+ "detail": "on the 3 prompts it changed the interval is [-0.0601, 0.0741]"
89
+ }
90
+ ]
91
+ });
92
+ export const MEASURED_MEMORY_POLICIES = deepFreeze({
93
+ "f9a742d02a54a2f222065707243200d84c7bd8afb9d2aacbd8b9ca524aaf49a6": {
94
+ "label": "inert",
95
+ "novelty": {
96
+ "enabled": false,
97
+ "threshold": 2
98
+ },
99
+ "contradiction": {
100
+ "enabled": false,
101
+ "threshold": 2,
102
+ "maxPairs": 20
103
+ },
104
+ "crystallization": {
105
+ "enabled": false,
106
+ "threshold": 2
107
+ },
108
+ "retrieval": {
109
+ "k": 10,
110
+ "minScore": 0
111
+ },
112
+ "embedding": {
113
+ "model": "hash-trigram-64",
114
+ "dims": 64,
115
+ "tier": "keyless"
116
+ }
117
+ },
118
+ "f67151cea75f246c313378d12b7217f7b7b9898b6d9a5e0bf7e6a8d060c1e306": {
119
+ "label": "shipped",
120
+ "novelty": {
121
+ "enabled": true,
122
+ "threshold": 0.97
123
+ },
124
+ "contradiction": {
125
+ "enabled": true,
126
+ "threshold": 0.8,
127
+ "maxPairs": 20
128
+ },
129
+ "crystallization": {
130
+ "enabled": true,
131
+ "threshold": 0.9
132
+ },
133
+ "retrieval": {
134
+ "k": 10,
135
+ "minScore": 0
136
+ },
137
+ "embedding": {
138
+ "model": "hash-trigram-64",
139
+ "dims": 64,
140
+ "tier": "keyless"
141
+ }
142
+ },
143
+ "8f4371ac643392077dcae24b64143e4d9d68027a5e0df5346042bc3b6d3970a2": {
144
+ "label": "novelty-0.99",
145
+ "novelty": {
146
+ "enabled": true,
147
+ "threshold": 0.99
148
+ },
149
+ "contradiction": {
150
+ "enabled": false,
151
+ "threshold": 2,
152
+ "maxPairs": 20
153
+ },
154
+ "crystallization": {
155
+ "enabled": false,
156
+ "threshold": 2
157
+ },
158
+ "retrieval": {
159
+ "k": 10,
160
+ "minScore": 0
161
+ },
162
+ "embedding": {
163
+ "model": "hash-trigram-64",
164
+ "dims": 64,
165
+ "tier": "keyless"
166
+ }
167
+ },
168
+ "ef9042b822e14635b46dfd2ee28c7c30af991ebc8d929ddce953623944fdc450": {
169
+ "label": "novelty-0.97",
170
+ "novelty": {
171
+ "enabled": true,
172
+ "threshold": 0.97
173
+ },
174
+ "contradiction": {
175
+ "enabled": false,
176
+ "threshold": 2,
177
+ "maxPairs": 20
178
+ },
179
+ "crystallization": {
180
+ "enabled": false,
181
+ "threshold": 2
182
+ },
183
+ "retrieval": {
184
+ "k": 10,
185
+ "minScore": 0
186
+ },
187
+ "embedding": {
188
+ "model": "hash-trigram-64",
189
+ "dims": 64,
190
+ "tier": "keyless"
191
+ }
192
+ },
193
+ "a9d1a7b130d3ee51ffcf94c930da79841973c89ae384b2a36b571061e7ca650b": {
194
+ "label": "novelty-0.9",
195
+ "novelty": {
196
+ "enabled": true,
197
+ "threshold": 0.9
198
+ },
199
+ "contradiction": {
200
+ "enabled": false,
201
+ "threshold": 2,
202
+ "maxPairs": 20
203
+ },
204
+ "crystallization": {
205
+ "enabled": false,
206
+ "threshold": 2
207
+ },
208
+ "retrieval": {
209
+ "k": 10,
210
+ "minScore": 0
211
+ },
212
+ "embedding": {
213
+ "model": "hash-trigram-64",
214
+ "dims": 64,
215
+ "tier": "keyless"
216
+ }
217
+ },
218
+ "a320fb75969d793e223e3d2bc8f4df4ae9eb24e0d487e42afbe88bc3a790fc40": {
219
+ "label": "novelty-0.75",
220
+ "novelty": {
221
+ "enabled": true,
222
+ "threshold": 0.75
223
+ },
224
+ "contradiction": {
225
+ "enabled": false,
226
+ "threshold": 2,
227
+ "maxPairs": 20
228
+ },
229
+ "crystallization": {
230
+ "enabled": false,
231
+ "threshold": 2
232
+ },
233
+ "retrieval": {
234
+ "k": 10,
235
+ "minScore": 0
236
+ },
237
+ "embedding": {
238
+ "model": "hash-trigram-64",
239
+ "dims": 64,
240
+ "tier": "keyless"
241
+ }
242
+ },
243
+ "85c244c4c54a57892681337a9cb980dc8244256abca994d73b6bd841837436a8": {
244
+ "label": "contradiction-0.9",
245
+ "novelty": {
246
+ "enabled": false,
247
+ "threshold": 2
248
+ },
249
+ "contradiction": {
250
+ "enabled": true,
251
+ "threshold": 0.9,
252
+ "maxPairs": 20
253
+ },
254
+ "crystallization": {
255
+ "enabled": false,
256
+ "threshold": 2
257
+ },
258
+ "retrieval": {
259
+ "k": 10,
260
+ "minScore": 0
261
+ },
262
+ "embedding": {
263
+ "model": "hash-trigram-64",
264
+ "dims": 64,
265
+ "tier": "keyless"
266
+ }
267
+ },
268
+ "765ad2fc3ff9dd8b0d62230b81fbef8e7cc98025a31f14a366545742359feaef": {
269
+ "label": "contradiction-0.8",
270
+ "novelty": {
271
+ "enabled": false,
272
+ "threshold": 2
273
+ },
274
+ "contradiction": {
275
+ "enabled": true,
276
+ "threshold": 0.8,
277
+ "maxPairs": 20
278
+ },
279
+ "crystallization": {
280
+ "enabled": false,
281
+ "threshold": 2
282
+ },
283
+ "retrieval": {
284
+ "k": 10,
285
+ "minScore": 0
286
+ },
287
+ "embedding": {
288
+ "model": "hash-trigram-64",
289
+ "dims": 64,
290
+ "tier": "keyless"
291
+ }
292
+ },
293
+ "21333850f2b96ee79faf026c54ba855d8baf61c926e3f9add5a88edd70d8008d": {
294
+ "label": "contradiction-0.75",
295
+ "novelty": {
296
+ "enabled": false,
297
+ "threshold": 2
298
+ },
299
+ "contradiction": {
300
+ "enabled": true,
301
+ "threshold": 0.75,
302
+ "maxPairs": 20
303
+ },
304
+ "crystallization": {
305
+ "enabled": false,
306
+ "threshold": 2
307
+ },
308
+ "retrieval": {
309
+ "k": 10,
310
+ "minScore": 0
311
+ },
312
+ "embedding": {
313
+ "model": "hash-trigram-64",
314
+ "dims": 64,
315
+ "tier": "keyless"
316
+ }
317
+ },
318
+ "b375c535c63898be8e2c9d7b8baf6396a3f067fb2befca7e3dc2abbe626211f1": {
319
+ "label": "crystallize-0.95",
320
+ "novelty": {
321
+ "enabled": false,
322
+ "threshold": 2
323
+ },
324
+ "contradiction": {
325
+ "enabled": false,
326
+ "threshold": 2,
327
+ "maxPairs": 20
328
+ },
329
+ "crystallization": {
330
+ "enabled": true,
331
+ "threshold": 0.95
332
+ },
333
+ "retrieval": {
334
+ "k": 10,
335
+ "minScore": 0
336
+ },
337
+ "embedding": {
338
+ "model": "hash-trigram-64",
339
+ "dims": 64,
340
+ "tier": "keyless"
341
+ }
342
+ },
343
+ "3cd5537c2d3f3cf58918aa41c01cdaa5cb607f4bd0c71c0dc64d195d44e2e8bc": {
344
+ "label": "crystallize-0.9",
345
+ "novelty": {
346
+ "enabled": false,
347
+ "threshold": 2
348
+ },
349
+ "contradiction": {
350
+ "enabled": false,
351
+ "threshold": 2,
352
+ "maxPairs": 20
353
+ },
354
+ "crystallization": {
355
+ "enabled": true,
356
+ "threshold": 0.9
357
+ },
358
+ "retrieval": {
359
+ "k": 10,
360
+ "minScore": 0
361
+ },
362
+ "embedding": {
363
+ "model": "hash-trigram-64",
364
+ "dims": 64,
365
+ "tier": "keyless"
366
+ }
367
+ },
368
+ "e481524a60243f398bbd3c476bf8a0d67e04ee1dbed0f693a7bfe1ac68226e5a": {
369
+ "label": "crystallize-0.82",
370
+ "novelty": {
371
+ "enabled": false,
372
+ "threshold": 2
373
+ },
374
+ "contradiction": {
375
+ "enabled": false,
376
+ "threshold": 2,
377
+ "maxPairs": 20
378
+ },
379
+ "crystallization": {
380
+ "enabled": true,
381
+ "threshold": 0.82
382
+ },
383
+ "retrieval": {
384
+ "k": 10,
385
+ "minScore": 0
386
+ },
387
+ "embedding": {
388
+ "model": "hash-trigram-64",
389
+ "dims": 64,
390
+ "tier": "keyless"
391
+ }
392
+ },
393
+ "4597a09585d6c91cdfa02a9b0511bb2e22b08355c2be3478293a8741ad25fad7": {
394
+ "label": "k-5",
395
+ "novelty": {
396
+ "enabled": false,
397
+ "threshold": 2
398
+ },
399
+ "contradiction": {
400
+ "enabled": false,
401
+ "threshold": 2,
402
+ "maxPairs": 20
403
+ },
404
+ "crystallization": {
405
+ "enabled": false,
406
+ "threshold": 2
407
+ },
408
+ "retrieval": {
409
+ "k": 5,
410
+ "minScore": 0
411
+ },
412
+ "embedding": {
413
+ "model": "hash-trigram-64",
414
+ "dims": 64,
415
+ "tier": "keyless"
416
+ }
417
+ },
418
+ "9dd2e0e54e57540934fc660961aa8863b427b0080122c686b437245824f82353": {
419
+ "label": "k-20",
420
+ "novelty": {
421
+ "enabled": false,
422
+ "threshold": 2
423
+ },
424
+ "contradiction": {
425
+ "enabled": false,
426
+ "threshold": 2,
427
+ "maxPairs": 20
428
+ },
429
+ "crystallization": {
430
+ "enabled": false,
431
+ "threshold": 2
432
+ },
433
+ "retrieval": {
434
+ "k": 20,
435
+ "minScore": 0
436
+ },
437
+ "embedding": {
438
+ "model": "hash-trigram-64",
439
+ "dims": 64,
440
+ "tier": "keyless"
441
+ }
442
+ },
443
+ "389ecc1162c85ed0b0d7013b06366dda47c10aa32e4e2399865c1d318d64ac8f": {
444
+ "label": "minScore-0.25",
445
+ "novelty": {
446
+ "enabled": false,
447
+ "threshold": 2
448
+ },
449
+ "contradiction": {
450
+ "enabled": false,
451
+ "threshold": 2,
452
+ "maxPairs": 20
453
+ },
454
+ "crystallization": {
455
+ "enabled": false,
456
+ "threshold": 2
457
+ },
458
+ "retrieval": {
459
+ "k": 10,
460
+ "minScore": 0.25
461
+ },
462
+ "embedding": {
463
+ "model": "hash-trigram-64",
464
+ "dims": 64,
465
+ "tier": "keyless"
466
+ }
467
+ },
468
+ "740d64209d16e0c978fa6164ab562b9b5cba9c07d583478a419bb76b4a0ab750": {
469
+ "label": "minScore-0.5",
470
+ "novelty": {
471
+ "enabled": false,
472
+ "threshold": 2
473
+ },
474
+ "contradiction": {
475
+ "enabled": false,
476
+ "threshold": 2,
477
+ "maxPairs": 20
478
+ },
479
+ "crystallization": {
480
+ "enabled": false,
481
+ "threshold": 2
482
+ },
483
+ "retrieval": {
484
+ "k": 10,
485
+ "minScore": 0.5
486
+ },
487
+ "embedding": {
488
+ "model": "hash-trigram-64",
489
+ "dims": 64,
490
+ "tier": "keyless"
491
+ }
492
+ },
493
+ "d9096e56b4baaca0013fc9c8da7391e62ecfa9afa69b1fb0502e5c088ffcce8d": {
494
+ "label": "minScore-0.75",
495
+ "novelty": {
496
+ "enabled": false,
497
+ "threshold": 2
498
+ },
499
+ "contradiction": {
500
+ "enabled": false,
501
+ "threshold": 2,
502
+ "maxPairs": 20
503
+ },
504
+ "crystallization": {
505
+ "enabled": false,
506
+ "threshold": 2
507
+ },
508
+ "retrieval": {
509
+ "k": 10,
510
+ "minScore": 0.75
511
+ },
512
+ "embedding": {
513
+ "model": "hash-trigram-64",
514
+ "dims": 64,
515
+ "tier": "keyless"
516
+ }
517
+ },
518
+ "d45077234e2380182db8674f3027536b86abfa23f3969a8f95434b6316540e59": {
519
+ "label": "offlineWidth-128",
520
+ "novelty": {
521
+ "enabled": false,
522
+ "threshold": 2
523
+ },
524
+ "contradiction": {
525
+ "enabled": false,
526
+ "threshold": 2,
527
+ "maxPairs": 20
528
+ },
529
+ "crystallization": {
530
+ "enabled": false,
531
+ "threshold": 2
532
+ },
533
+ "retrieval": {
534
+ "k": 10,
535
+ "minScore": 0
536
+ },
537
+ "embedding": {
538
+ "model": "hash-trigram-128",
539
+ "dims": 128,
540
+ "tier": "keyless"
541
+ }
542
+ },
543
+ "1b0ca83a22426b0f442c3db88e8cfce887bd074b62bcec7cc83a227cd9101152": {
544
+ "label": "offlineWidth-256",
545
+ "novelty": {
546
+ "enabled": false,
547
+ "threshold": 2
548
+ },
549
+ "contradiction": {
550
+ "enabled": false,
551
+ "threshold": 2,
552
+ "maxPairs": 20
553
+ },
554
+ "crystallization": {
555
+ "enabled": false,
556
+ "threshold": 2
557
+ },
558
+ "retrieval": {
559
+ "k": 10,
560
+ "minScore": 0
561
+ },
562
+ "embedding": {
563
+ "model": "hash-trigram-256",
564
+ "dims": 256,
565
+ "tier": "keyless"
566
+ }
567
+ },
568
+ "6ce2888155152fc3db419a6f6104cf9224cad39d155d001a0722bab769265bc7": {
569
+ "label": "offlineWidth-512",
570
+ "novelty": {
571
+ "enabled": false,
572
+ "threshold": 2
573
+ },
574
+ "contradiction": {
575
+ "enabled": false,
576
+ "threshold": 2,
577
+ "maxPairs": 20
578
+ },
579
+ "crystallization": {
580
+ "enabled": false,
581
+ "threshold": 2
582
+ },
583
+ "retrieval": {
584
+ "k": 10,
585
+ "minScore": 0
586
+ },
587
+ "embedding": {
588
+ "model": "hash-trigram-512",
589
+ "dims": 512,
590
+ "tier": "keyless"
591
+ }
592
+ },
593
+ "5121f66d7bcda05e6c56b8e950d361240fac3b25a8a89163f84ba0f25fca5e16": {
594
+ "label": "contradiction-0.8+minScore-0.25",
595
+ "novelty": {
596
+ "enabled": false,
597
+ "threshold": 2
598
+ },
599
+ "contradiction": {
600
+ "enabled": true,
601
+ "threshold": 0.8,
602
+ "maxPairs": 20
603
+ },
604
+ "crystallization": {
605
+ "enabled": false,
606
+ "threshold": 2
607
+ },
608
+ "retrieval": {
609
+ "k": 10,
610
+ "minScore": 0.25
611
+ },
612
+ "embedding": {
613
+ "model": "hash-trigram-64",
614
+ "dims": 64,
615
+ "tier": "keyless"
616
+ }
617
+ },
618
+ "9d546690fc0f992dc08428c3af5625ddc638265c450ea8691054ea6ac79f36eb": {
619
+ "label": "contradiction-0.8+minScore-0.5",
620
+ "novelty": {
621
+ "enabled": false,
622
+ "threshold": 2
623
+ },
624
+ "contradiction": {
625
+ "enabled": true,
626
+ "threshold": 0.8,
627
+ "maxPairs": 20
628
+ },
629
+ "crystallization": {
630
+ "enabled": false,
631
+ "threshold": 2
632
+ },
633
+ "retrieval": {
634
+ "k": 10,
635
+ "minScore": 0.5
636
+ },
637
+ "embedding": {
638
+ "model": "hash-trigram-64",
639
+ "dims": 64,
640
+ "tier": "keyless"
641
+ }
642
+ },
643
+ "4ba139a76833300ab402d55a46af91cf33aaee07827ffcb99b8407669680f962": {
644
+ "label": "contradiction-0.9+minScore-0.25",
645
+ "novelty": {
646
+ "enabled": false,
647
+ "threshold": 2
648
+ },
649
+ "contradiction": {
650
+ "enabled": true,
651
+ "threshold": 0.9,
652
+ "maxPairs": 20
653
+ },
654
+ "crystallization": {
655
+ "enabled": false,
656
+ "threshold": 2
657
+ },
658
+ "retrieval": {
659
+ "k": 10,
660
+ "minScore": 0.25
661
+ },
662
+ "embedding": {
663
+ "model": "hash-trigram-64",
664
+ "dims": 64,
665
+ "tier": "keyless"
666
+ }
667
+ },
668
+ "94d22325793ff13e78702b5f0d1841729b485c5e383348d522d276fda56a5a7d": {
669
+ "label": "contradiction-0.9+minScore-0.5",
670
+ "novelty": {
671
+ "enabled": false,
672
+ "threshold": 2
673
+ },
674
+ "contradiction": {
675
+ "enabled": true,
676
+ "threshold": 0.9,
677
+ "maxPairs": 20
678
+ },
679
+ "crystallization": {
680
+ "enabled": false,
681
+ "threshold": 2
682
+ },
683
+ "retrieval": {
684
+ "k": 10,
685
+ "minScore": 0.5
686
+ },
687
+ "embedding": {
688
+ "model": "hash-trigram-64",
689
+ "dims": 64,
690
+ "tier": "keyless"
691
+ }
692
+ }
693
+ });
694
+ export const SHIPPED_LEGACY_CELL_ID = "f67151cea75f246c313378d12b7217f7b7b9898b6d9a5e0bf7e6a8d060c1e306";
695
+ export const POLICY_CONTRACT_REVISION = "18108e1b0da8a91306e58b309004cbbdb43df9b43923b30c8a6b366bd8178e24";
package/src/policy.js ADDED
@@ -0,0 +1,13 @@
1
+ /** Serializable memory defaults selected by the registered policy experiment. */
2
+ import { DEFAULT_MEMORY_POLICY, MEASURED_MEMORY_POLICIES, SHIPPED_LEGACY_CELL_ID } from "./policy.gen.js";
3
+ export { DEFAULT_MEMORY_POLICY, POLICY_PROVENANCE, MEASURED_MEMORY_POLICIES, SHIPPED_LEGACY_CELL_ID, POLICY_CONTRACT_REVISION } from "./policy.gen.js";
4
+ /** The historical control is an explicit opt-in, including its historical hash width. */
5
+ export const SHIPPED_LEGACY_POLICY = MEASURED_MEMORY_POLICIES[SHIPPED_LEGACY_CELL_ID];
6
+ /** Disabled cosine policies lower to the existing threshold-2 seam. */
7
+ export function policyThresholds(policy = DEFAULT_MEMORY_POLICY) {
8
+ return {
9
+ novelty: policy.novelty.enabled ? policy.novelty.threshold : 2,
10
+ contradiction: policy.contradiction.enabled ? policy.contradiction.threshold : 2,
11
+ crystallize: policy.crystallization.enabled ? policy.crystallization.threshold : 2,
12
+ };
13
+ }