compound-agent 1.0.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,2601 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Memory item type definitions using Zod schemas.
5
+ *
6
+ * Supports 4 memory item types via discriminated union:
7
+ * - lesson: Knowledge learned from mistakes
8
+ * - solution: Problem-resolution pairs
9
+ * - pattern: Code pattern transformations (bad -> good)
10
+ * - preference: User workflow preferences
11
+ *
12
+ * Deletion model:
13
+ * - Set `deleted: true` and `deletedAt` on an item to mark it deleted
14
+ * - LegacyTombstoneSchema handles backward-compat reads of old
15
+ * minimal tombstone records { id, deleted: true, deletedAt }
16
+ * - LegacyLessonSchema handles old quick/full type records
17
+ */
18
+
19
+ declare const SourceSchema: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
20
+ declare const ContextSchema: z.ZodObject<{
21
+ tool: z.ZodString;
22
+ intent: z.ZodString;
23
+ }, "strip", z.ZodTypeAny, {
24
+ tool: string;
25
+ intent: string;
26
+ }, {
27
+ tool: string;
28
+ intent: string;
29
+ }>;
30
+ declare const SeveritySchema: z.ZodEnum<["high", "medium", "low"]>;
31
+ /** @deprecated Use MemoryItemTypeSchema instead. Kept for parsing old JSONL records. */
32
+ declare const LessonTypeSchema: z.ZodEnum<["quick", "full"]>;
33
+ /** Memory item type enum: lesson, solution, pattern, preference. */
34
+ declare const MemoryItemTypeSchema: z.ZodEnum<["lesson", "solution", "pattern", "preference"]>;
35
+ /**
36
+ * Lesson memory item schema.
37
+ * Replaces the old quick/full distinction with a single 'lesson' type.
38
+ * Pattern field is optional for lessons.
39
+ */
40
+ declare const LessonItemSchema: z.ZodObject<{
41
+ type: z.ZodLiteral<"lesson">;
42
+ pattern: z.ZodOptional<z.ZodObject<{
43
+ bad: z.ZodString;
44
+ good: z.ZodString;
45
+ }, "strip", z.ZodTypeAny, {
46
+ bad: string;
47
+ good: string;
48
+ }, {
49
+ bad: string;
50
+ good: string;
51
+ }>>;
52
+ id: z.ZodString;
53
+ trigger: z.ZodString;
54
+ insight: z.ZodString;
55
+ tags: z.ZodArray<z.ZodString, "many">;
56
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
57
+ context: z.ZodObject<{
58
+ tool: z.ZodString;
59
+ intent: z.ZodString;
60
+ }, "strip", z.ZodTypeAny, {
61
+ tool: string;
62
+ intent: string;
63
+ }, {
64
+ tool: string;
65
+ intent: string;
66
+ }>;
67
+ created: z.ZodString;
68
+ confirmed: z.ZodBoolean;
69
+ supersedes: z.ZodArray<z.ZodString, "many">;
70
+ related: z.ZodArray<z.ZodString, "many">;
71
+ evidence: z.ZodOptional<z.ZodString>;
72
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
73
+ deleted: z.ZodOptional<z.ZodBoolean>;
74
+ deletedAt: z.ZodOptional<z.ZodString>;
75
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
76
+ citation: z.ZodOptional<z.ZodObject<{
77
+ file: z.ZodString;
78
+ line: z.ZodOptional<z.ZodNumber>;
79
+ commit: z.ZodOptional<z.ZodString>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ file: string;
82
+ line?: number | undefined;
83
+ commit?: string | undefined;
84
+ }, {
85
+ file: string;
86
+ line?: number | undefined;
87
+ commit?: string | undefined;
88
+ }>>;
89
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
90
+ compactedAt: z.ZodOptional<z.ZodString>;
91
+ lastRetrieved: z.ZodOptional<z.ZodString>;
92
+ invalidatedAt: z.ZodOptional<z.ZodString>;
93
+ invalidationReason: z.ZodOptional<z.ZodString>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ type: "lesson";
96
+ id: string;
97
+ trigger: string;
98
+ insight: string;
99
+ tags: string[];
100
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
101
+ context: {
102
+ tool: string;
103
+ intent: string;
104
+ };
105
+ created: string;
106
+ confirmed: boolean;
107
+ supersedes: string[];
108
+ related: string[];
109
+ pattern?: {
110
+ bad: string;
111
+ good: string;
112
+ } | undefined;
113
+ evidence?: string | undefined;
114
+ severity?: "high" | "medium" | "low" | undefined;
115
+ deleted?: boolean | undefined;
116
+ deletedAt?: string | undefined;
117
+ retrievalCount?: number | undefined;
118
+ citation?: {
119
+ file: string;
120
+ line?: number | undefined;
121
+ commit?: string | undefined;
122
+ } | undefined;
123
+ compactionLevel?: 0 | 1 | 2 | undefined;
124
+ compactedAt?: string | undefined;
125
+ lastRetrieved?: string | undefined;
126
+ invalidatedAt?: string | undefined;
127
+ invalidationReason?: string | undefined;
128
+ }, {
129
+ type: "lesson";
130
+ id: string;
131
+ trigger: string;
132
+ insight: string;
133
+ tags: string[];
134
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
135
+ context: {
136
+ tool: string;
137
+ intent: string;
138
+ };
139
+ created: string;
140
+ confirmed: boolean;
141
+ supersedes: string[];
142
+ related: string[];
143
+ pattern?: {
144
+ bad: string;
145
+ good: string;
146
+ } | undefined;
147
+ evidence?: string | undefined;
148
+ severity?: "high" | "medium" | "low" | undefined;
149
+ deleted?: boolean | undefined;
150
+ deletedAt?: string | undefined;
151
+ retrievalCount?: number | undefined;
152
+ citation?: {
153
+ file: string;
154
+ line?: number | undefined;
155
+ commit?: string | undefined;
156
+ } | undefined;
157
+ compactionLevel?: 0 | 1 | 2 | undefined;
158
+ compactedAt?: string | undefined;
159
+ lastRetrieved?: string | undefined;
160
+ invalidatedAt?: string | undefined;
161
+ invalidationReason?: string | undefined;
162
+ }>;
163
+ /**
164
+ * Solution memory item schema.
165
+ * Uses trigger as "problem" and insight as "resolution".
166
+ * Pattern field is optional.
167
+ */
168
+ declare const SolutionItemSchema: z.ZodObject<{
169
+ type: z.ZodLiteral<"solution">;
170
+ pattern: z.ZodOptional<z.ZodObject<{
171
+ bad: z.ZodString;
172
+ good: z.ZodString;
173
+ }, "strip", z.ZodTypeAny, {
174
+ bad: string;
175
+ good: string;
176
+ }, {
177
+ bad: string;
178
+ good: string;
179
+ }>>;
180
+ id: z.ZodString;
181
+ trigger: z.ZodString;
182
+ insight: z.ZodString;
183
+ tags: z.ZodArray<z.ZodString, "many">;
184
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
185
+ context: z.ZodObject<{
186
+ tool: z.ZodString;
187
+ intent: z.ZodString;
188
+ }, "strip", z.ZodTypeAny, {
189
+ tool: string;
190
+ intent: string;
191
+ }, {
192
+ tool: string;
193
+ intent: string;
194
+ }>;
195
+ created: z.ZodString;
196
+ confirmed: z.ZodBoolean;
197
+ supersedes: z.ZodArray<z.ZodString, "many">;
198
+ related: z.ZodArray<z.ZodString, "many">;
199
+ evidence: z.ZodOptional<z.ZodString>;
200
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
201
+ deleted: z.ZodOptional<z.ZodBoolean>;
202
+ deletedAt: z.ZodOptional<z.ZodString>;
203
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
204
+ citation: z.ZodOptional<z.ZodObject<{
205
+ file: z.ZodString;
206
+ line: z.ZodOptional<z.ZodNumber>;
207
+ commit: z.ZodOptional<z.ZodString>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ file: string;
210
+ line?: number | undefined;
211
+ commit?: string | undefined;
212
+ }, {
213
+ file: string;
214
+ line?: number | undefined;
215
+ commit?: string | undefined;
216
+ }>>;
217
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
218
+ compactedAt: z.ZodOptional<z.ZodString>;
219
+ lastRetrieved: z.ZodOptional<z.ZodString>;
220
+ invalidatedAt: z.ZodOptional<z.ZodString>;
221
+ invalidationReason: z.ZodOptional<z.ZodString>;
222
+ }, "strip", z.ZodTypeAny, {
223
+ type: "solution";
224
+ id: string;
225
+ trigger: string;
226
+ insight: string;
227
+ tags: string[];
228
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
229
+ context: {
230
+ tool: string;
231
+ intent: string;
232
+ };
233
+ created: string;
234
+ confirmed: boolean;
235
+ supersedes: string[];
236
+ related: string[];
237
+ pattern?: {
238
+ bad: string;
239
+ good: string;
240
+ } | undefined;
241
+ evidence?: string | undefined;
242
+ severity?: "high" | "medium" | "low" | undefined;
243
+ deleted?: boolean | undefined;
244
+ deletedAt?: string | undefined;
245
+ retrievalCount?: number | undefined;
246
+ citation?: {
247
+ file: string;
248
+ line?: number | undefined;
249
+ commit?: string | undefined;
250
+ } | undefined;
251
+ compactionLevel?: 0 | 1 | 2 | undefined;
252
+ compactedAt?: string | undefined;
253
+ lastRetrieved?: string | undefined;
254
+ invalidatedAt?: string | undefined;
255
+ invalidationReason?: string | undefined;
256
+ }, {
257
+ type: "solution";
258
+ id: string;
259
+ trigger: string;
260
+ insight: string;
261
+ tags: string[];
262
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
263
+ context: {
264
+ tool: string;
265
+ intent: string;
266
+ };
267
+ created: string;
268
+ confirmed: boolean;
269
+ supersedes: string[];
270
+ related: string[];
271
+ pattern?: {
272
+ bad: string;
273
+ good: string;
274
+ } | undefined;
275
+ evidence?: string | undefined;
276
+ severity?: "high" | "medium" | "low" | undefined;
277
+ deleted?: boolean | undefined;
278
+ deletedAt?: string | undefined;
279
+ retrievalCount?: number | undefined;
280
+ citation?: {
281
+ file: string;
282
+ line?: number | undefined;
283
+ commit?: string | undefined;
284
+ } | undefined;
285
+ compactionLevel?: 0 | 1 | 2 | undefined;
286
+ compactedAt?: string | undefined;
287
+ lastRetrieved?: string | undefined;
288
+ invalidatedAt?: string | undefined;
289
+ invalidationReason?: string | undefined;
290
+ }>;
291
+ /**
292
+ * Pattern memory item schema.
293
+ * Pattern field is REQUIRED (bad -> good code transformation).
294
+ */
295
+ declare const PatternItemSchema: z.ZodObject<{
296
+ type: z.ZodLiteral<"pattern">;
297
+ pattern: z.ZodObject<{
298
+ bad: z.ZodString;
299
+ good: z.ZodString;
300
+ }, "strip", z.ZodTypeAny, {
301
+ bad: string;
302
+ good: string;
303
+ }, {
304
+ bad: string;
305
+ good: string;
306
+ }>;
307
+ id: z.ZodString;
308
+ trigger: z.ZodString;
309
+ insight: z.ZodString;
310
+ tags: z.ZodArray<z.ZodString, "many">;
311
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
312
+ context: z.ZodObject<{
313
+ tool: z.ZodString;
314
+ intent: z.ZodString;
315
+ }, "strip", z.ZodTypeAny, {
316
+ tool: string;
317
+ intent: string;
318
+ }, {
319
+ tool: string;
320
+ intent: string;
321
+ }>;
322
+ created: z.ZodString;
323
+ confirmed: z.ZodBoolean;
324
+ supersedes: z.ZodArray<z.ZodString, "many">;
325
+ related: z.ZodArray<z.ZodString, "many">;
326
+ evidence: z.ZodOptional<z.ZodString>;
327
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
328
+ deleted: z.ZodOptional<z.ZodBoolean>;
329
+ deletedAt: z.ZodOptional<z.ZodString>;
330
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
331
+ citation: z.ZodOptional<z.ZodObject<{
332
+ file: z.ZodString;
333
+ line: z.ZodOptional<z.ZodNumber>;
334
+ commit: z.ZodOptional<z.ZodString>;
335
+ }, "strip", z.ZodTypeAny, {
336
+ file: string;
337
+ line?: number | undefined;
338
+ commit?: string | undefined;
339
+ }, {
340
+ file: string;
341
+ line?: number | undefined;
342
+ commit?: string | undefined;
343
+ }>>;
344
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
345
+ compactedAt: z.ZodOptional<z.ZodString>;
346
+ lastRetrieved: z.ZodOptional<z.ZodString>;
347
+ invalidatedAt: z.ZodOptional<z.ZodString>;
348
+ invalidationReason: z.ZodOptional<z.ZodString>;
349
+ }, "strip", z.ZodTypeAny, {
350
+ type: "pattern";
351
+ pattern: {
352
+ bad: string;
353
+ good: string;
354
+ };
355
+ id: string;
356
+ trigger: string;
357
+ insight: string;
358
+ tags: string[];
359
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
360
+ context: {
361
+ tool: string;
362
+ intent: string;
363
+ };
364
+ created: string;
365
+ confirmed: boolean;
366
+ supersedes: string[];
367
+ related: string[];
368
+ evidence?: string | undefined;
369
+ severity?: "high" | "medium" | "low" | undefined;
370
+ deleted?: boolean | undefined;
371
+ deletedAt?: string | undefined;
372
+ retrievalCount?: number | undefined;
373
+ citation?: {
374
+ file: string;
375
+ line?: number | undefined;
376
+ commit?: string | undefined;
377
+ } | undefined;
378
+ compactionLevel?: 0 | 1 | 2 | undefined;
379
+ compactedAt?: string | undefined;
380
+ lastRetrieved?: string | undefined;
381
+ invalidatedAt?: string | undefined;
382
+ invalidationReason?: string | undefined;
383
+ }, {
384
+ type: "pattern";
385
+ pattern: {
386
+ bad: string;
387
+ good: string;
388
+ };
389
+ id: string;
390
+ trigger: string;
391
+ insight: string;
392
+ tags: string[];
393
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
394
+ context: {
395
+ tool: string;
396
+ intent: string;
397
+ };
398
+ created: string;
399
+ confirmed: boolean;
400
+ supersedes: string[];
401
+ related: string[];
402
+ evidence?: string | undefined;
403
+ severity?: "high" | "medium" | "low" | undefined;
404
+ deleted?: boolean | undefined;
405
+ deletedAt?: string | undefined;
406
+ retrievalCount?: number | undefined;
407
+ citation?: {
408
+ file: string;
409
+ line?: number | undefined;
410
+ commit?: string | undefined;
411
+ } | undefined;
412
+ compactionLevel?: 0 | 1 | 2 | undefined;
413
+ compactedAt?: string | undefined;
414
+ lastRetrieved?: string | undefined;
415
+ invalidatedAt?: string | undefined;
416
+ invalidationReason?: string | undefined;
417
+ }>;
418
+ /**
419
+ * Preference memory item schema.
420
+ * Captures user workflow preferences.
421
+ * Pattern field is optional.
422
+ */
423
+ declare const PreferenceItemSchema: z.ZodObject<{
424
+ type: z.ZodLiteral<"preference">;
425
+ pattern: z.ZodOptional<z.ZodObject<{
426
+ bad: z.ZodString;
427
+ good: z.ZodString;
428
+ }, "strip", z.ZodTypeAny, {
429
+ bad: string;
430
+ good: string;
431
+ }, {
432
+ bad: string;
433
+ good: string;
434
+ }>>;
435
+ id: z.ZodString;
436
+ trigger: z.ZodString;
437
+ insight: z.ZodString;
438
+ tags: z.ZodArray<z.ZodString, "many">;
439
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
440
+ context: z.ZodObject<{
441
+ tool: z.ZodString;
442
+ intent: z.ZodString;
443
+ }, "strip", z.ZodTypeAny, {
444
+ tool: string;
445
+ intent: string;
446
+ }, {
447
+ tool: string;
448
+ intent: string;
449
+ }>;
450
+ created: z.ZodString;
451
+ confirmed: z.ZodBoolean;
452
+ supersedes: z.ZodArray<z.ZodString, "many">;
453
+ related: z.ZodArray<z.ZodString, "many">;
454
+ evidence: z.ZodOptional<z.ZodString>;
455
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
456
+ deleted: z.ZodOptional<z.ZodBoolean>;
457
+ deletedAt: z.ZodOptional<z.ZodString>;
458
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
459
+ citation: z.ZodOptional<z.ZodObject<{
460
+ file: z.ZodString;
461
+ line: z.ZodOptional<z.ZodNumber>;
462
+ commit: z.ZodOptional<z.ZodString>;
463
+ }, "strip", z.ZodTypeAny, {
464
+ file: string;
465
+ line?: number | undefined;
466
+ commit?: string | undefined;
467
+ }, {
468
+ file: string;
469
+ line?: number | undefined;
470
+ commit?: string | undefined;
471
+ }>>;
472
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
473
+ compactedAt: z.ZodOptional<z.ZodString>;
474
+ lastRetrieved: z.ZodOptional<z.ZodString>;
475
+ invalidatedAt: z.ZodOptional<z.ZodString>;
476
+ invalidationReason: z.ZodOptional<z.ZodString>;
477
+ }, "strip", z.ZodTypeAny, {
478
+ type: "preference";
479
+ id: string;
480
+ trigger: string;
481
+ insight: string;
482
+ tags: string[];
483
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
484
+ context: {
485
+ tool: string;
486
+ intent: string;
487
+ };
488
+ created: string;
489
+ confirmed: boolean;
490
+ supersedes: string[];
491
+ related: string[];
492
+ pattern?: {
493
+ bad: string;
494
+ good: string;
495
+ } | undefined;
496
+ evidence?: string | undefined;
497
+ severity?: "high" | "medium" | "low" | undefined;
498
+ deleted?: boolean | undefined;
499
+ deletedAt?: string | undefined;
500
+ retrievalCount?: number | undefined;
501
+ citation?: {
502
+ file: string;
503
+ line?: number | undefined;
504
+ commit?: string | undefined;
505
+ } | undefined;
506
+ compactionLevel?: 0 | 1 | 2 | undefined;
507
+ compactedAt?: string | undefined;
508
+ lastRetrieved?: string | undefined;
509
+ invalidatedAt?: string | undefined;
510
+ invalidationReason?: string | undefined;
511
+ }, {
512
+ type: "preference";
513
+ id: string;
514
+ trigger: string;
515
+ insight: string;
516
+ tags: string[];
517
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
518
+ context: {
519
+ tool: string;
520
+ intent: string;
521
+ };
522
+ created: string;
523
+ confirmed: boolean;
524
+ supersedes: string[];
525
+ related: string[];
526
+ pattern?: {
527
+ bad: string;
528
+ good: string;
529
+ } | undefined;
530
+ evidence?: string | undefined;
531
+ severity?: "high" | "medium" | "low" | undefined;
532
+ deleted?: boolean | undefined;
533
+ deletedAt?: string | undefined;
534
+ retrievalCount?: number | undefined;
535
+ citation?: {
536
+ file: string;
537
+ line?: number | undefined;
538
+ commit?: string | undefined;
539
+ } | undefined;
540
+ compactionLevel?: 0 | 1 | 2 | undefined;
541
+ compactedAt?: string | undefined;
542
+ lastRetrieved?: string | undefined;
543
+ invalidatedAt?: string | undefined;
544
+ invalidationReason?: string | undefined;
545
+ }>;
546
+ /**
547
+ * Unified memory item schema (discriminated union on 'type' field).
548
+ * Accepts: lesson, solution, pattern, preference.
549
+ */
550
+ declare const MemoryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
551
+ type: z.ZodLiteral<"lesson">;
552
+ pattern: z.ZodOptional<z.ZodObject<{
553
+ bad: z.ZodString;
554
+ good: z.ZodString;
555
+ }, "strip", z.ZodTypeAny, {
556
+ bad: string;
557
+ good: string;
558
+ }, {
559
+ bad: string;
560
+ good: string;
561
+ }>>;
562
+ id: z.ZodString;
563
+ trigger: z.ZodString;
564
+ insight: z.ZodString;
565
+ tags: z.ZodArray<z.ZodString, "many">;
566
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
567
+ context: z.ZodObject<{
568
+ tool: z.ZodString;
569
+ intent: z.ZodString;
570
+ }, "strip", z.ZodTypeAny, {
571
+ tool: string;
572
+ intent: string;
573
+ }, {
574
+ tool: string;
575
+ intent: string;
576
+ }>;
577
+ created: z.ZodString;
578
+ confirmed: z.ZodBoolean;
579
+ supersedes: z.ZodArray<z.ZodString, "many">;
580
+ related: z.ZodArray<z.ZodString, "many">;
581
+ evidence: z.ZodOptional<z.ZodString>;
582
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
583
+ deleted: z.ZodOptional<z.ZodBoolean>;
584
+ deletedAt: z.ZodOptional<z.ZodString>;
585
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
586
+ citation: z.ZodOptional<z.ZodObject<{
587
+ file: z.ZodString;
588
+ line: z.ZodOptional<z.ZodNumber>;
589
+ commit: z.ZodOptional<z.ZodString>;
590
+ }, "strip", z.ZodTypeAny, {
591
+ file: string;
592
+ line?: number | undefined;
593
+ commit?: string | undefined;
594
+ }, {
595
+ file: string;
596
+ line?: number | undefined;
597
+ commit?: string | undefined;
598
+ }>>;
599
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
600
+ compactedAt: z.ZodOptional<z.ZodString>;
601
+ lastRetrieved: z.ZodOptional<z.ZodString>;
602
+ invalidatedAt: z.ZodOptional<z.ZodString>;
603
+ invalidationReason: z.ZodOptional<z.ZodString>;
604
+ }, "strip", z.ZodTypeAny, {
605
+ type: "lesson";
606
+ id: string;
607
+ trigger: string;
608
+ insight: string;
609
+ tags: string[];
610
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
611
+ context: {
612
+ tool: string;
613
+ intent: string;
614
+ };
615
+ created: string;
616
+ confirmed: boolean;
617
+ supersedes: string[];
618
+ related: string[];
619
+ pattern?: {
620
+ bad: string;
621
+ good: string;
622
+ } | undefined;
623
+ evidence?: string | undefined;
624
+ severity?: "high" | "medium" | "low" | undefined;
625
+ deleted?: boolean | undefined;
626
+ deletedAt?: string | undefined;
627
+ retrievalCount?: number | undefined;
628
+ citation?: {
629
+ file: string;
630
+ line?: number | undefined;
631
+ commit?: string | undefined;
632
+ } | undefined;
633
+ compactionLevel?: 0 | 1 | 2 | undefined;
634
+ compactedAt?: string | undefined;
635
+ lastRetrieved?: string | undefined;
636
+ invalidatedAt?: string | undefined;
637
+ invalidationReason?: string | undefined;
638
+ }, {
639
+ type: "lesson";
640
+ id: string;
641
+ trigger: string;
642
+ insight: string;
643
+ tags: string[];
644
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
645
+ context: {
646
+ tool: string;
647
+ intent: string;
648
+ };
649
+ created: string;
650
+ confirmed: boolean;
651
+ supersedes: string[];
652
+ related: string[];
653
+ pattern?: {
654
+ bad: string;
655
+ good: string;
656
+ } | undefined;
657
+ evidence?: string | undefined;
658
+ severity?: "high" | "medium" | "low" | undefined;
659
+ deleted?: boolean | undefined;
660
+ deletedAt?: string | undefined;
661
+ retrievalCount?: number | undefined;
662
+ citation?: {
663
+ file: string;
664
+ line?: number | undefined;
665
+ commit?: string | undefined;
666
+ } | undefined;
667
+ compactionLevel?: 0 | 1 | 2 | undefined;
668
+ compactedAt?: string | undefined;
669
+ lastRetrieved?: string | undefined;
670
+ invalidatedAt?: string | undefined;
671
+ invalidationReason?: string | undefined;
672
+ }>, z.ZodObject<{
673
+ type: z.ZodLiteral<"solution">;
674
+ pattern: z.ZodOptional<z.ZodObject<{
675
+ bad: z.ZodString;
676
+ good: z.ZodString;
677
+ }, "strip", z.ZodTypeAny, {
678
+ bad: string;
679
+ good: string;
680
+ }, {
681
+ bad: string;
682
+ good: string;
683
+ }>>;
684
+ id: z.ZodString;
685
+ trigger: z.ZodString;
686
+ insight: z.ZodString;
687
+ tags: z.ZodArray<z.ZodString, "many">;
688
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
689
+ context: z.ZodObject<{
690
+ tool: z.ZodString;
691
+ intent: z.ZodString;
692
+ }, "strip", z.ZodTypeAny, {
693
+ tool: string;
694
+ intent: string;
695
+ }, {
696
+ tool: string;
697
+ intent: string;
698
+ }>;
699
+ created: z.ZodString;
700
+ confirmed: z.ZodBoolean;
701
+ supersedes: z.ZodArray<z.ZodString, "many">;
702
+ related: z.ZodArray<z.ZodString, "many">;
703
+ evidence: z.ZodOptional<z.ZodString>;
704
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
705
+ deleted: z.ZodOptional<z.ZodBoolean>;
706
+ deletedAt: z.ZodOptional<z.ZodString>;
707
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
708
+ citation: z.ZodOptional<z.ZodObject<{
709
+ file: z.ZodString;
710
+ line: z.ZodOptional<z.ZodNumber>;
711
+ commit: z.ZodOptional<z.ZodString>;
712
+ }, "strip", z.ZodTypeAny, {
713
+ file: string;
714
+ line?: number | undefined;
715
+ commit?: string | undefined;
716
+ }, {
717
+ file: string;
718
+ line?: number | undefined;
719
+ commit?: string | undefined;
720
+ }>>;
721
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
722
+ compactedAt: z.ZodOptional<z.ZodString>;
723
+ lastRetrieved: z.ZodOptional<z.ZodString>;
724
+ invalidatedAt: z.ZodOptional<z.ZodString>;
725
+ invalidationReason: z.ZodOptional<z.ZodString>;
726
+ }, "strip", z.ZodTypeAny, {
727
+ type: "solution";
728
+ id: string;
729
+ trigger: string;
730
+ insight: string;
731
+ tags: string[];
732
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
733
+ context: {
734
+ tool: string;
735
+ intent: string;
736
+ };
737
+ created: string;
738
+ confirmed: boolean;
739
+ supersedes: string[];
740
+ related: string[];
741
+ pattern?: {
742
+ bad: string;
743
+ good: string;
744
+ } | undefined;
745
+ evidence?: string | undefined;
746
+ severity?: "high" | "medium" | "low" | undefined;
747
+ deleted?: boolean | undefined;
748
+ deletedAt?: string | undefined;
749
+ retrievalCount?: number | undefined;
750
+ citation?: {
751
+ file: string;
752
+ line?: number | undefined;
753
+ commit?: string | undefined;
754
+ } | undefined;
755
+ compactionLevel?: 0 | 1 | 2 | undefined;
756
+ compactedAt?: string | undefined;
757
+ lastRetrieved?: string | undefined;
758
+ invalidatedAt?: string | undefined;
759
+ invalidationReason?: string | undefined;
760
+ }, {
761
+ type: "solution";
762
+ id: string;
763
+ trigger: string;
764
+ insight: string;
765
+ tags: string[];
766
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
767
+ context: {
768
+ tool: string;
769
+ intent: string;
770
+ };
771
+ created: string;
772
+ confirmed: boolean;
773
+ supersedes: string[];
774
+ related: string[];
775
+ pattern?: {
776
+ bad: string;
777
+ good: string;
778
+ } | undefined;
779
+ evidence?: string | undefined;
780
+ severity?: "high" | "medium" | "low" | undefined;
781
+ deleted?: boolean | undefined;
782
+ deletedAt?: string | undefined;
783
+ retrievalCount?: number | undefined;
784
+ citation?: {
785
+ file: string;
786
+ line?: number | undefined;
787
+ commit?: string | undefined;
788
+ } | undefined;
789
+ compactionLevel?: 0 | 1 | 2 | undefined;
790
+ compactedAt?: string | undefined;
791
+ lastRetrieved?: string | undefined;
792
+ invalidatedAt?: string | undefined;
793
+ invalidationReason?: string | undefined;
794
+ }>, z.ZodObject<{
795
+ type: z.ZodLiteral<"pattern">;
796
+ pattern: z.ZodObject<{
797
+ bad: z.ZodString;
798
+ good: z.ZodString;
799
+ }, "strip", z.ZodTypeAny, {
800
+ bad: string;
801
+ good: string;
802
+ }, {
803
+ bad: string;
804
+ good: string;
805
+ }>;
806
+ id: z.ZodString;
807
+ trigger: z.ZodString;
808
+ insight: z.ZodString;
809
+ tags: z.ZodArray<z.ZodString, "many">;
810
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
811
+ context: z.ZodObject<{
812
+ tool: z.ZodString;
813
+ intent: z.ZodString;
814
+ }, "strip", z.ZodTypeAny, {
815
+ tool: string;
816
+ intent: string;
817
+ }, {
818
+ tool: string;
819
+ intent: string;
820
+ }>;
821
+ created: z.ZodString;
822
+ confirmed: z.ZodBoolean;
823
+ supersedes: z.ZodArray<z.ZodString, "many">;
824
+ related: z.ZodArray<z.ZodString, "many">;
825
+ evidence: z.ZodOptional<z.ZodString>;
826
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
827
+ deleted: z.ZodOptional<z.ZodBoolean>;
828
+ deletedAt: z.ZodOptional<z.ZodString>;
829
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
830
+ citation: z.ZodOptional<z.ZodObject<{
831
+ file: z.ZodString;
832
+ line: z.ZodOptional<z.ZodNumber>;
833
+ commit: z.ZodOptional<z.ZodString>;
834
+ }, "strip", z.ZodTypeAny, {
835
+ file: string;
836
+ line?: number | undefined;
837
+ commit?: string | undefined;
838
+ }, {
839
+ file: string;
840
+ line?: number | undefined;
841
+ commit?: string | undefined;
842
+ }>>;
843
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
844
+ compactedAt: z.ZodOptional<z.ZodString>;
845
+ lastRetrieved: z.ZodOptional<z.ZodString>;
846
+ invalidatedAt: z.ZodOptional<z.ZodString>;
847
+ invalidationReason: z.ZodOptional<z.ZodString>;
848
+ }, "strip", z.ZodTypeAny, {
849
+ type: "pattern";
850
+ pattern: {
851
+ bad: string;
852
+ good: string;
853
+ };
854
+ id: string;
855
+ trigger: string;
856
+ insight: string;
857
+ tags: string[];
858
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
859
+ context: {
860
+ tool: string;
861
+ intent: string;
862
+ };
863
+ created: string;
864
+ confirmed: boolean;
865
+ supersedes: string[];
866
+ related: string[];
867
+ evidence?: string | undefined;
868
+ severity?: "high" | "medium" | "low" | undefined;
869
+ deleted?: boolean | undefined;
870
+ deletedAt?: string | undefined;
871
+ retrievalCount?: number | undefined;
872
+ citation?: {
873
+ file: string;
874
+ line?: number | undefined;
875
+ commit?: string | undefined;
876
+ } | undefined;
877
+ compactionLevel?: 0 | 1 | 2 | undefined;
878
+ compactedAt?: string | undefined;
879
+ lastRetrieved?: string | undefined;
880
+ invalidatedAt?: string | undefined;
881
+ invalidationReason?: string | undefined;
882
+ }, {
883
+ type: "pattern";
884
+ pattern: {
885
+ bad: string;
886
+ good: string;
887
+ };
888
+ id: string;
889
+ trigger: string;
890
+ insight: string;
891
+ tags: string[];
892
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
893
+ context: {
894
+ tool: string;
895
+ intent: string;
896
+ };
897
+ created: string;
898
+ confirmed: boolean;
899
+ supersedes: string[];
900
+ related: string[];
901
+ evidence?: string | undefined;
902
+ severity?: "high" | "medium" | "low" | undefined;
903
+ deleted?: boolean | undefined;
904
+ deletedAt?: string | undefined;
905
+ retrievalCount?: number | undefined;
906
+ citation?: {
907
+ file: string;
908
+ line?: number | undefined;
909
+ commit?: string | undefined;
910
+ } | undefined;
911
+ compactionLevel?: 0 | 1 | 2 | undefined;
912
+ compactedAt?: string | undefined;
913
+ lastRetrieved?: string | undefined;
914
+ invalidatedAt?: string | undefined;
915
+ invalidationReason?: string | undefined;
916
+ }>, z.ZodObject<{
917
+ type: z.ZodLiteral<"preference">;
918
+ pattern: z.ZodOptional<z.ZodObject<{
919
+ bad: z.ZodString;
920
+ good: z.ZodString;
921
+ }, "strip", z.ZodTypeAny, {
922
+ bad: string;
923
+ good: string;
924
+ }, {
925
+ bad: string;
926
+ good: string;
927
+ }>>;
928
+ id: z.ZodString;
929
+ trigger: z.ZodString;
930
+ insight: z.ZodString;
931
+ tags: z.ZodArray<z.ZodString, "many">;
932
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
933
+ context: z.ZodObject<{
934
+ tool: z.ZodString;
935
+ intent: z.ZodString;
936
+ }, "strip", z.ZodTypeAny, {
937
+ tool: string;
938
+ intent: string;
939
+ }, {
940
+ tool: string;
941
+ intent: string;
942
+ }>;
943
+ created: z.ZodString;
944
+ confirmed: z.ZodBoolean;
945
+ supersedes: z.ZodArray<z.ZodString, "many">;
946
+ related: z.ZodArray<z.ZodString, "many">;
947
+ evidence: z.ZodOptional<z.ZodString>;
948
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
949
+ deleted: z.ZodOptional<z.ZodBoolean>;
950
+ deletedAt: z.ZodOptional<z.ZodString>;
951
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
952
+ citation: z.ZodOptional<z.ZodObject<{
953
+ file: z.ZodString;
954
+ line: z.ZodOptional<z.ZodNumber>;
955
+ commit: z.ZodOptional<z.ZodString>;
956
+ }, "strip", z.ZodTypeAny, {
957
+ file: string;
958
+ line?: number | undefined;
959
+ commit?: string | undefined;
960
+ }, {
961
+ file: string;
962
+ line?: number | undefined;
963
+ commit?: string | undefined;
964
+ }>>;
965
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
966
+ compactedAt: z.ZodOptional<z.ZodString>;
967
+ lastRetrieved: z.ZodOptional<z.ZodString>;
968
+ invalidatedAt: z.ZodOptional<z.ZodString>;
969
+ invalidationReason: z.ZodOptional<z.ZodString>;
970
+ }, "strip", z.ZodTypeAny, {
971
+ type: "preference";
972
+ id: string;
973
+ trigger: string;
974
+ insight: string;
975
+ tags: string[];
976
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
977
+ context: {
978
+ tool: string;
979
+ intent: string;
980
+ };
981
+ created: string;
982
+ confirmed: boolean;
983
+ supersedes: string[];
984
+ related: string[];
985
+ pattern?: {
986
+ bad: string;
987
+ good: string;
988
+ } | undefined;
989
+ evidence?: string | undefined;
990
+ severity?: "high" | "medium" | "low" | undefined;
991
+ deleted?: boolean | undefined;
992
+ deletedAt?: string | undefined;
993
+ retrievalCount?: number | undefined;
994
+ citation?: {
995
+ file: string;
996
+ line?: number | undefined;
997
+ commit?: string | undefined;
998
+ } | undefined;
999
+ compactionLevel?: 0 | 1 | 2 | undefined;
1000
+ compactedAt?: string | undefined;
1001
+ lastRetrieved?: string | undefined;
1002
+ invalidatedAt?: string | undefined;
1003
+ invalidationReason?: string | undefined;
1004
+ }, {
1005
+ type: "preference";
1006
+ id: string;
1007
+ trigger: string;
1008
+ insight: string;
1009
+ tags: string[];
1010
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1011
+ context: {
1012
+ tool: string;
1013
+ intent: string;
1014
+ };
1015
+ created: string;
1016
+ confirmed: boolean;
1017
+ supersedes: string[];
1018
+ related: string[];
1019
+ pattern?: {
1020
+ bad: string;
1021
+ good: string;
1022
+ } | undefined;
1023
+ evidence?: string | undefined;
1024
+ severity?: "high" | "medium" | "low" | undefined;
1025
+ deleted?: boolean | undefined;
1026
+ deletedAt?: string | undefined;
1027
+ retrievalCount?: number | undefined;
1028
+ citation?: {
1029
+ file: string;
1030
+ line?: number | undefined;
1031
+ commit?: string | undefined;
1032
+ } | undefined;
1033
+ compactionLevel?: 0 | 1 | 2 | undefined;
1034
+ compactedAt?: string | undefined;
1035
+ lastRetrieved?: string | undefined;
1036
+ invalidatedAt?: string | undefined;
1037
+ invalidationReason?: string | undefined;
1038
+ }>]>;
1039
+ /**
1040
+ * Legacy lesson schema for reading old JSONL records with type: 'quick' | 'full'.
1041
+ * Use this only for parsing existing data files; new records use MemoryItemSchema.
1042
+ */
1043
+ declare const LegacyLessonSchema: z.ZodObject<{
1044
+ type: z.ZodEnum<["quick", "full"]>;
1045
+ pattern: z.ZodOptional<z.ZodObject<{
1046
+ bad: z.ZodString;
1047
+ good: z.ZodString;
1048
+ }, "strip", z.ZodTypeAny, {
1049
+ bad: string;
1050
+ good: string;
1051
+ }, {
1052
+ bad: string;
1053
+ good: string;
1054
+ }>>;
1055
+ id: z.ZodString;
1056
+ trigger: z.ZodString;
1057
+ insight: z.ZodString;
1058
+ tags: z.ZodArray<z.ZodString, "many">;
1059
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
1060
+ context: z.ZodObject<{
1061
+ tool: z.ZodString;
1062
+ intent: z.ZodString;
1063
+ }, "strip", z.ZodTypeAny, {
1064
+ tool: string;
1065
+ intent: string;
1066
+ }, {
1067
+ tool: string;
1068
+ intent: string;
1069
+ }>;
1070
+ created: z.ZodString;
1071
+ confirmed: z.ZodBoolean;
1072
+ supersedes: z.ZodArray<z.ZodString, "many">;
1073
+ related: z.ZodArray<z.ZodString, "many">;
1074
+ evidence: z.ZodOptional<z.ZodString>;
1075
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
1076
+ deleted: z.ZodOptional<z.ZodBoolean>;
1077
+ deletedAt: z.ZodOptional<z.ZodString>;
1078
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
1079
+ citation: z.ZodOptional<z.ZodObject<{
1080
+ file: z.ZodString;
1081
+ line: z.ZodOptional<z.ZodNumber>;
1082
+ commit: z.ZodOptional<z.ZodString>;
1083
+ }, "strip", z.ZodTypeAny, {
1084
+ file: string;
1085
+ line?: number | undefined;
1086
+ commit?: string | undefined;
1087
+ }, {
1088
+ file: string;
1089
+ line?: number | undefined;
1090
+ commit?: string | undefined;
1091
+ }>>;
1092
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1093
+ compactedAt: z.ZodOptional<z.ZodString>;
1094
+ lastRetrieved: z.ZodOptional<z.ZodString>;
1095
+ invalidatedAt: z.ZodOptional<z.ZodString>;
1096
+ invalidationReason: z.ZodOptional<z.ZodString>;
1097
+ }, "strip", z.ZodTypeAny, {
1098
+ type: "quick" | "full";
1099
+ id: string;
1100
+ trigger: string;
1101
+ insight: string;
1102
+ tags: string[];
1103
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1104
+ context: {
1105
+ tool: string;
1106
+ intent: string;
1107
+ };
1108
+ created: string;
1109
+ confirmed: boolean;
1110
+ supersedes: string[];
1111
+ related: string[];
1112
+ pattern?: {
1113
+ bad: string;
1114
+ good: string;
1115
+ } | undefined;
1116
+ evidence?: string | undefined;
1117
+ severity?: "high" | "medium" | "low" | undefined;
1118
+ deleted?: boolean | undefined;
1119
+ deletedAt?: string | undefined;
1120
+ retrievalCount?: number | undefined;
1121
+ citation?: {
1122
+ file: string;
1123
+ line?: number | undefined;
1124
+ commit?: string | undefined;
1125
+ } | undefined;
1126
+ compactionLevel?: 0 | 1 | 2 | undefined;
1127
+ compactedAt?: string | undefined;
1128
+ lastRetrieved?: string | undefined;
1129
+ invalidatedAt?: string | undefined;
1130
+ invalidationReason?: string | undefined;
1131
+ }, {
1132
+ type: "quick" | "full";
1133
+ id: string;
1134
+ trigger: string;
1135
+ insight: string;
1136
+ tags: string[];
1137
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1138
+ context: {
1139
+ tool: string;
1140
+ intent: string;
1141
+ };
1142
+ created: string;
1143
+ confirmed: boolean;
1144
+ supersedes: string[];
1145
+ related: string[];
1146
+ pattern?: {
1147
+ bad: string;
1148
+ good: string;
1149
+ } | undefined;
1150
+ evidence?: string | undefined;
1151
+ severity?: "high" | "medium" | "low" | undefined;
1152
+ deleted?: boolean | undefined;
1153
+ deletedAt?: string | undefined;
1154
+ retrievalCount?: number | undefined;
1155
+ citation?: {
1156
+ file: string;
1157
+ line?: number | undefined;
1158
+ commit?: string | undefined;
1159
+ } | undefined;
1160
+ compactionLevel?: 0 | 1 | 2 | undefined;
1161
+ compactedAt?: string | undefined;
1162
+ lastRetrieved?: string | undefined;
1163
+ invalidatedAt?: string | undefined;
1164
+ invalidationReason?: string | undefined;
1165
+ }>;
1166
+ /**
1167
+ * LessonSchema - now equivalent to LessonItemSchema.
1168
+ *
1169
+ * For backward compatibility, existing code that imports LessonSchema
1170
+ * continues to work. The type field is now z.literal('lesson').
1171
+ *
1172
+ * To parse old quick/full records, use LegacyLessonSchema.
1173
+ */
1174
+ declare const LessonSchema: z.ZodObject<{
1175
+ type: z.ZodLiteral<"lesson">;
1176
+ pattern: z.ZodOptional<z.ZodObject<{
1177
+ bad: z.ZodString;
1178
+ good: z.ZodString;
1179
+ }, "strip", z.ZodTypeAny, {
1180
+ bad: string;
1181
+ good: string;
1182
+ }, {
1183
+ bad: string;
1184
+ good: string;
1185
+ }>>;
1186
+ id: z.ZodString;
1187
+ trigger: z.ZodString;
1188
+ insight: z.ZodString;
1189
+ tags: z.ZodArray<z.ZodString, "many">;
1190
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
1191
+ context: z.ZodObject<{
1192
+ tool: z.ZodString;
1193
+ intent: z.ZodString;
1194
+ }, "strip", z.ZodTypeAny, {
1195
+ tool: string;
1196
+ intent: string;
1197
+ }, {
1198
+ tool: string;
1199
+ intent: string;
1200
+ }>;
1201
+ created: z.ZodString;
1202
+ confirmed: z.ZodBoolean;
1203
+ supersedes: z.ZodArray<z.ZodString, "many">;
1204
+ related: z.ZodArray<z.ZodString, "many">;
1205
+ evidence: z.ZodOptional<z.ZodString>;
1206
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
1207
+ deleted: z.ZodOptional<z.ZodBoolean>;
1208
+ deletedAt: z.ZodOptional<z.ZodString>;
1209
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
1210
+ citation: z.ZodOptional<z.ZodObject<{
1211
+ file: z.ZodString;
1212
+ line: z.ZodOptional<z.ZodNumber>;
1213
+ commit: z.ZodOptional<z.ZodString>;
1214
+ }, "strip", z.ZodTypeAny, {
1215
+ file: string;
1216
+ line?: number | undefined;
1217
+ commit?: string | undefined;
1218
+ }, {
1219
+ file: string;
1220
+ line?: number | undefined;
1221
+ commit?: string | undefined;
1222
+ }>>;
1223
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1224
+ compactedAt: z.ZodOptional<z.ZodString>;
1225
+ lastRetrieved: z.ZodOptional<z.ZodString>;
1226
+ invalidatedAt: z.ZodOptional<z.ZodString>;
1227
+ invalidationReason: z.ZodOptional<z.ZodString>;
1228
+ }, "strip", z.ZodTypeAny, {
1229
+ type: "lesson";
1230
+ id: string;
1231
+ trigger: string;
1232
+ insight: string;
1233
+ tags: string[];
1234
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1235
+ context: {
1236
+ tool: string;
1237
+ intent: string;
1238
+ };
1239
+ created: string;
1240
+ confirmed: boolean;
1241
+ supersedes: string[];
1242
+ related: string[];
1243
+ pattern?: {
1244
+ bad: string;
1245
+ good: string;
1246
+ } | undefined;
1247
+ evidence?: string | undefined;
1248
+ severity?: "high" | "medium" | "low" | undefined;
1249
+ deleted?: boolean | undefined;
1250
+ deletedAt?: string | undefined;
1251
+ retrievalCount?: number | undefined;
1252
+ citation?: {
1253
+ file: string;
1254
+ line?: number | undefined;
1255
+ commit?: string | undefined;
1256
+ } | undefined;
1257
+ compactionLevel?: 0 | 1 | 2 | undefined;
1258
+ compactedAt?: string | undefined;
1259
+ lastRetrieved?: string | undefined;
1260
+ invalidatedAt?: string | undefined;
1261
+ invalidationReason?: string | undefined;
1262
+ }, {
1263
+ type: "lesson";
1264
+ id: string;
1265
+ trigger: string;
1266
+ insight: string;
1267
+ tags: string[];
1268
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1269
+ context: {
1270
+ tool: string;
1271
+ intent: string;
1272
+ };
1273
+ created: string;
1274
+ confirmed: boolean;
1275
+ supersedes: string[];
1276
+ related: string[];
1277
+ pattern?: {
1278
+ bad: string;
1279
+ good: string;
1280
+ } | undefined;
1281
+ evidence?: string | undefined;
1282
+ severity?: "high" | "medium" | "low" | undefined;
1283
+ deleted?: boolean | undefined;
1284
+ deletedAt?: string | undefined;
1285
+ retrievalCount?: number | undefined;
1286
+ citation?: {
1287
+ file: string;
1288
+ line?: number | undefined;
1289
+ commit?: string | undefined;
1290
+ } | undefined;
1291
+ compactionLevel?: 0 | 1 | 2 | undefined;
1292
+ compactedAt?: string | undefined;
1293
+ lastRetrieved?: string | undefined;
1294
+ invalidatedAt?: string | undefined;
1295
+ invalidationReason?: string | undefined;
1296
+ }>;
1297
+ /**
1298
+ * Legacy tombstone format for backward-compatible reads.
1299
+ * Old JSONL files may contain minimal { id, deleted, deletedAt } records.
1300
+ */
1301
+ declare const LegacyTombstoneSchema: z.ZodObject<{
1302
+ id: z.ZodString;
1303
+ deleted: z.ZodLiteral<true>;
1304
+ deletedAt: z.ZodString;
1305
+ }, "strip", z.ZodTypeAny, {
1306
+ id: string;
1307
+ deleted: true;
1308
+ deletedAt: string;
1309
+ }, {
1310
+ id: string;
1311
+ deleted: true;
1312
+ deletedAt: string;
1313
+ }>;
1314
+ /**
1315
+ * LessonRecord schema - union for reading JSONL files.
1316
+ *
1317
+ * Accepts:
1318
+ * 1. Any new memory item type (lesson, solution, pattern, preference)
1319
+ * 2. A legacy lesson (type: 'quick' | 'full')
1320
+ * 3. A legacy tombstone (minimal: { id, deleted: true, deletedAt })
1321
+ */
1322
+ declare const LessonRecordSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1323
+ type: z.ZodLiteral<"lesson">;
1324
+ pattern: z.ZodOptional<z.ZodObject<{
1325
+ bad: z.ZodString;
1326
+ good: z.ZodString;
1327
+ }, "strip", z.ZodTypeAny, {
1328
+ bad: string;
1329
+ good: string;
1330
+ }, {
1331
+ bad: string;
1332
+ good: string;
1333
+ }>>;
1334
+ id: z.ZodString;
1335
+ trigger: z.ZodString;
1336
+ insight: z.ZodString;
1337
+ tags: z.ZodArray<z.ZodString, "many">;
1338
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
1339
+ context: z.ZodObject<{
1340
+ tool: z.ZodString;
1341
+ intent: z.ZodString;
1342
+ }, "strip", z.ZodTypeAny, {
1343
+ tool: string;
1344
+ intent: string;
1345
+ }, {
1346
+ tool: string;
1347
+ intent: string;
1348
+ }>;
1349
+ created: z.ZodString;
1350
+ confirmed: z.ZodBoolean;
1351
+ supersedes: z.ZodArray<z.ZodString, "many">;
1352
+ related: z.ZodArray<z.ZodString, "many">;
1353
+ evidence: z.ZodOptional<z.ZodString>;
1354
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
1355
+ deleted: z.ZodOptional<z.ZodBoolean>;
1356
+ deletedAt: z.ZodOptional<z.ZodString>;
1357
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
1358
+ citation: z.ZodOptional<z.ZodObject<{
1359
+ file: z.ZodString;
1360
+ line: z.ZodOptional<z.ZodNumber>;
1361
+ commit: z.ZodOptional<z.ZodString>;
1362
+ }, "strip", z.ZodTypeAny, {
1363
+ file: string;
1364
+ line?: number | undefined;
1365
+ commit?: string | undefined;
1366
+ }, {
1367
+ file: string;
1368
+ line?: number | undefined;
1369
+ commit?: string | undefined;
1370
+ }>>;
1371
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1372
+ compactedAt: z.ZodOptional<z.ZodString>;
1373
+ lastRetrieved: z.ZodOptional<z.ZodString>;
1374
+ invalidatedAt: z.ZodOptional<z.ZodString>;
1375
+ invalidationReason: z.ZodOptional<z.ZodString>;
1376
+ }, "strip", z.ZodTypeAny, {
1377
+ type: "lesson";
1378
+ id: string;
1379
+ trigger: string;
1380
+ insight: string;
1381
+ tags: string[];
1382
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1383
+ context: {
1384
+ tool: string;
1385
+ intent: string;
1386
+ };
1387
+ created: string;
1388
+ confirmed: boolean;
1389
+ supersedes: string[];
1390
+ related: string[];
1391
+ pattern?: {
1392
+ bad: string;
1393
+ good: string;
1394
+ } | undefined;
1395
+ evidence?: string | undefined;
1396
+ severity?: "high" | "medium" | "low" | undefined;
1397
+ deleted?: boolean | undefined;
1398
+ deletedAt?: string | undefined;
1399
+ retrievalCount?: number | undefined;
1400
+ citation?: {
1401
+ file: string;
1402
+ line?: number | undefined;
1403
+ commit?: string | undefined;
1404
+ } | undefined;
1405
+ compactionLevel?: 0 | 1 | 2 | undefined;
1406
+ compactedAt?: string | undefined;
1407
+ lastRetrieved?: string | undefined;
1408
+ invalidatedAt?: string | undefined;
1409
+ invalidationReason?: string | undefined;
1410
+ }, {
1411
+ type: "lesson";
1412
+ id: string;
1413
+ trigger: string;
1414
+ insight: string;
1415
+ tags: string[];
1416
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1417
+ context: {
1418
+ tool: string;
1419
+ intent: string;
1420
+ };
1421
+ created: string;
1422
+ confirmed: boolean;
1423
+ supersedes: string[];
1424
+ related: string[];
1425
+ pattern?: {
1426
+ bad: string;
1427
+ good: string;
1428
+ } | undefined;
1429
+ evidence?: string | undefined;
1430
+ severity?: "high" | "medium" | "low" | undefined;
1431
+ deleted?: boolean | undefined;
1432
+ deletedAt?: string | undefined;
1433
+ retrievalCount?: number | undefined;
1434
+ citation?: {
1435
+ file: string;
1436
+ line?: number | undefined;
1437
+ commit?: string | undefined;
1438
+ } | undefined;
1439
+ compactionLevel?: 0 | 1 | 2 | undefined;
1440
+ compactedAt?: string | undefined;
1441
+ lastRetrieved?: string | undefined;
1442
+ invalidatedAt?: string | undefined;
1443
+ invalidationReason?: string | undefined;
1444
+ }>, z.ZodObject<{
1445
+ type: z.ZodLiteral<"solution">;
1446
+ pattern: z.ZodOptional<z.ZodObject<{
1447
+ bad: z.ZodString;
1448
+ good: z.ZodString;
1449
+ }, "strip", z.ZodTypeAny, {
1450
+ bad: string;
1451
+ good: string;
1452
+ }, {
1453
+ bad: string;
1454
+ good: string;
1455
+ }>>;
1456
+ id: z.ZodString;
1457
+ trigger: z.ZodString;
1458
+ insight: z.ZodString;
1459
+ tags: z.ZodArray<z.ZodString, "many">;
1460
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
1461
+ context: z.ZodObject<{
1462
+ tool: z.ZodString;
1463
+ intent: z.ZodString;
1464
+ }, "strip", z.ZodTypeAny, {
1465
+ tool: string;
1466
+ intent: string;
1467
+ }, {
1468
+ tool: string;
1469
+ intent: string;
1470
+ }>;
1471
+ created: z.ZodString;
1472
+ confirmed: z.ZodBoolean;
1473
+ supersedes: z.ZodArray<z.ZodString, "many">;
1474
+ related: z.ZodArray<z.ZodString, "many">;
1475
+ evidence: z.ZodOptional<z.ZodString>;
1476
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
1477
+ deleted: z.ZodOptional<z.ZodBoolean>;
1478
+ deletedAt: z.ZodOptional<z.ZodString>;
1479
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
1480
+ citation: z.ZodOptional<z.ZodObject<{
1481
+ file: z.ZodString;
1482
+ line: z.ZodOptional<z.ZodNumber>;
1483
+ commit: z.ZodOptional<z.ZodString>;
1484
+ }, "strip", z.ZodTypeAny, {
1485
+ file: string;
1486
+ line?: number | undefined;
1487
+ commit?: string | undefined;
1488
+ }, {
1489
+ file: string;
1490
+ line?: number | undefined;
1491
+ commit?: string | undefined;
1492
+ }>>;
1493
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1494
+ compactedAt: z.ZodOptional<z.ZodString>;
1495
+ lastRetrieved: z.ZodOptional<z.ZodString>;
1496
+ invalidatedAt: z.ZodOptional<z.ZodString>;
1497
+ invalidationReason: z.ZodOptional<z.ZodString>;
1498
+ }, "strip", z.ZodTypeAny, {
1499
+ type: "solution";
1500
+ id: string;
1501
+ trigger: string;
1502
+ insight: string;
1503
+ tags: string[];
1504
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1505
+ context: {
1506
+ tool: string;
1507
+ intent: string;
1508
+ };
1509
+ created: string;
1510
+ confirmed: boolean;
1511
+ supersedes: string[];
1512
+ related: string[];
1513
+ pattern?: {
1514
+ bad: string;
1515
+ good: string;
1516
+ } | undefined;
1517
+ evidence?: string | undefined;
1518
+ severity?: "high" | "medium" | "low" | undefined;
1519
+ deleted?: boolean | undefined;
1520
+ deletedAt?: string | undefined;
1521
+ retrievalCount?: number | undefined;
1522
+ citation?: {
1523
+ file: string;
1524
+ line?: number | undefined;
1525
+ commit?: string | undefined;
1526
+ } | undefined;
1527
+ compactionLevel?: 0 | 1 | 2 | undefined;
1528
+ compactedAt?: string | undefined;
1529
+ lastRetrieved?: string | undefined;
1530
+ invalidatedAt?: string | undefined;
1531
+ invalidationReason?: string | undefined;
1532
+ }, {
1533
+ type: "solution";
1534
+ id: string;
1535
+ trigger: string;
1536
+ insight: string;
1537
+ tags: string[];
1538
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1539
+ context: {
1540
+ tool: string;
1541
+ intent: string;
1542
+ };
1543
+ created: string;
1544
+ confirmed: boolean;
1545
+ supersedes: string[];
1546
+ related: string[];
1547
+ pattern?: {
1548
+ bad: string;
1549
+ good: string;
1550
+ } | undefined;
1551
+ evidence?: string | undefined;
1552
+ severity?: "high" | "medium" | "low" | undefined;
1553
+ deleted?: boolean | undefined;
1554
+ deletedAt?: string | undefined;
1555
+ retrievalCount?: number | undefined;
1556
+ citation?: {
1557
+ file: string;
1558
+ line?: number | undefined;
1559
+ commit?: string | undefined;
1560
+ } | undefined;
1561
+ compactionLevel?: 0 | 1 | 2 | undefined;
1562
+ compactedAt?: string | undefined;
1563
+ lastRetrieved?: string | undefined;
1564
+ invalidatedAt?: string | undefined;
1565
+ invalidationReason?: string | undefined;
1566
+ }>, z.ZodObject<{
1567
+ type: z.ZodLiteral<"pattern">;
1568
+ pattern: z.ZodObject<{
1569
+ bad: z.ZodString;
1570
+ good: z.ZodString;
1571
+ }, "strip", z.ZodTypeAny, {
1572
+ bad: string;
1573
+ good: string;
1574
+ }, {
1575
+ bad: string;
1576
+ good: string;
1577
+ }>;
1578
+ id: z.ZodString;
1579
+ trigger: z.ZodString;
1580
+ insight: z.ZodString;
1581
+ tags: z.ZodArray<z.ZodString, "many">;
1582
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
1583
+ context: z.ZodObject<{
1584
+ tool: z.ZodString;
1585
+ intent: z.ZodString;
1586
+ }, "strip", z.ZodTypeAny, {
1587
+ tool: string;
1588
+ intent: string;
1589
+ }, {
1590
+ tool: string;
1591
+ intent: string;
1592
+ }>;
1593
+ created: z.ZodString;
1594
+ confirmed: z.ZodBoolean;
1595
+ supersedes: z.ZodArray<z.ZodString, "many">;
1596
+ related: z.ZodArray<z.ZodString, "many">;
1597
+ evidence: z.ZodOptional<z.ZodString>;
1598
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
1599
+ deleted: z.ZodOptional<z.ZodBoolean>;
1600
+ deletedAt: z.ZodOptional<z.ZodString>;
1601
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
1602
+ citation: z.ZodOptional<z.ZodObject<{
1603
+ file: z.ZodString;
1604
+ line: z.ZodOptional<z.ZodNumber>;
1605
+ commit: z.ZodOptional<z.ZodString>;
1606
+ }, "strip", z.ZodTypeAny, {
1607
+ file: string;
1608
+ line?: number | undefined;
1609
+ commit?: string | undefined;
1610
+ }, {
1611
+ file: string;
1612
+ line?: number | undefined;
1613
+ commit?: string | undefined;
1614
+ }>>;
1615
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1616
+ compactedAt: z.ZodOptional<z.ZodString>;
1617
+ lastRetrieved: z.ZodOptional<z.ZodString>;
1618
+ invalidatedAt: z.ZodOptional<z.ZodString>;
1619
+ invalidationReason: z.ZodOptional<z.ZodString>;
1620
+ }, "strip", z.ZodTypeAny, {
1621
+ type: "pattern";
1622
+ pattern: {
1623
+ bad: string;
1624
+ good: string;
1625
+ };
1626
+ id: string;
1627
+ trigger: string;
1628
+ insight: string;
1629
+ tags: string[];
1630
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1631
+ context: {
1632
+ tool: string;
1633
+ intent: string;
1634
+ };
1635
+ created: string;
1636
+ confirmed: boolean;
1637
+ supersedes: string[];
1638
+ related: string[];
1639
+ evidence?: string | undefined;
1640
+ severity?: "high" | "medium" | "low" | undefined;
1641
+ deleted?: boolean | undefined;
1642
+ deletedAt?: string | undefined;
1643
+ retrievalCount?: number | undefined;
1644
+ citation?: {
1645
+ file: string;
1646
+ line?: number | undefined;
1647
+ commit?: string | undefined;
1648
+ } | undefined;
1649
+ compactionLevel?: 0 | 1 | 2 | undefined;
1650
+ compactedAt?: string | undefined;
1651
+ lastRetrieved?: string | undefined;
1652
+ invalidatedAt?: string | undefined;
1653
+ invalidationReason?: string | undefined;
1654
+ }, {
1655
+ type: "pattern";
1656
+ pattern: {
1657
+ bad: string;
1658
+ good: string;
1659
+ };
1660
+ id: string;
1661
+ trigger: string;
1662
+ insight: string;
1663
+ tags: string[];
1664
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1665
+ context: {
1666
+ tool: string;
1667
+ intent: string;
1668
+ };
1669
+ created: string;
1670
+ confirmed: boolean;
1671
+ supersedes: string[];
1672
+ related: string[];
1673
+ evidence?: string | undefined;
1674
+ severity?: "high" | "medium" | "low" | undefined;
1675
+ deleted?: boolean | undefined;
1676
+ deletedAt?: string | undefined;
1677
+ retrievalCount?: number | undefined;
1678
+ citation?: {
1679
+ file: string;
1680
+ line?: number | undefined;
1681
+ commit?: string | undefined;
1682
+ } | undefined;
1683
+ compactionLevel?: 0 | 1 | 2 | undefined;
1684
+ compactedAt?: string | undefined;
1685
+ lastRetrieved?: string | undefined;
1686
+ invalidatedAt?: string | undefined;
1687
+ invalidationReason?: string | undefined;
1688
+ }>, z.ZodObject<{
1689
+ type: z.ZodLiteral<"preference">;
1690
+ pattern: z.ZodOptional<z.ZodObject<{
1691
+ bad: z.ZodString;
1692
+ good: z.ZodString;
1693
+ }, "strip", z.ZodTypeAny, {
1694
+ bad: string;
1695
+ good: string;
1696
+ }, {
1697
+ bad: string;
1698
+ good: string;
1699
+ }>>;
1700
+ id: z.ZodString;
1701
+ trigger: z.ZodString;
1702
+ insight: z.ZodString;
1703
+ tags: z.ZodArray<z.ZodString, "many">;
1704
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
1705
+ context: z.ZodObject<{
1706
+ tool: z.ZodString;
1707
+ intent: z.ZodString;
1708
+ }, "strip", z.ZodTypeAny, {
1709
+ tool: string;
1710
+ intent: string;
1711
+ }, {
1712
+ tool: string;
1713
+ intent: string;
1714
+ }>;
1715
+ created: z.ZodString;
1716
+ confirmed: z.ZodBoolean;
1717
+ supersedes: z.ZodArray<z.ZodString, "many">;
1718
+ related: z.ZodArray<z.ZodString, "many">;
1719
+ evidence: z.ZodOptional<z.ZodString>;
1720
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
1721
+ deleted: z.ZodOptional<z.ZodBoolean>;
1722
+ deletedAt: z.ZodOptional<z.ZodString>;
1723
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
1724
+ citation: z.ZodOptional<z.ZodObject<{
1725
+ file: z.ZodString;
1726
+ line: z.ZodOptional<z.ZodNumber>;
1727
+ commit: z.ZodOptional<z.ZodString>;
1728
+ }, "strip", z.ZodTypeAny, {
1729
+ file: string;
1730
+ line?: number | undefined;
1731
+ commit?: string | undefined;
1732
+ }, {
1733
+ file: string;
1734
+ line?: number | undefined;
1735
+ commit?: string | undefined;
1736
+ }>>;
1737
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1738
+ compactedAt: z.ZodOptional<z.ZodString>;
1739
+ lastRetrieved: z.ZodOptional<z.ZodString>;
1740
+ invalidatedAt: z.ZodOptional<z.ZodString>;
1741
+ invalidationReason: z.ZodOptional<z.ZodString>;
1742
+ }, "strip", z.ZodTypeAny, {
1743
+ type: "preference";
1744
+ id: string;
1745
+ trigger: string;
1746
+ insight: string;
1747
+ tags: string[];
1748
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1749
+ context: {
1750
+ tool: string;
1751
+ intent: string;
1752
+ };
1753
+ created: string;
1754
+ confirmed: boolean;
1755
+ supersedes: string[];
1756
+ related: string[];
1757
+ pattern?: {
1758
+ bad: string;
1759
+ good: string;
1760
+ } | undefined;
1761
+ evidence?: string | undefined;
1762
+ severity?: "high" | "medium" | "low" | undefined;
1763
+ deleted?: boolean | undefined;
1764
+ deletedAt?: string | undefined;
1765
+ retrievalCount?: number | undefined;
1766
+ citation?: {
1767
+ file: string;
1768
+ line?: number | undefined;
1769
+ commit?: string | undefined;
1770
+ } | undefined;
1771
+ compactionLevel?: 0 | 1 | 2 | undefined;
1772
+ compactedAt?: string | undefined;
1773
+ lastRetrieved?: string | undefined;
1774
+ invalidatedAt?: string | undefined;
1775
+ invalidationReason?: string | undefined;
1776
+ }, {
1777
+ type: "preference";
1778
+ id: string;
1779
+ trigger: string;
1780
+ insight: string;
1781
+ tags: string[];
1782
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1783
+ context: {
1784
+ tool: string;
1785
+ intent: string;
1786
+ };
1787
+ created: string;
1788
+ confirmed: boolean;
1789
+ supersedes: string[];
1790
+ related: string[];
1791
+ pattern?: {
1792
+ bad: string;
1793
+ good: string;
1794
+ } | undefined;
1795
+ evidence?: string | undefined;
1796
+ severity?: "high" | "medium" | "low" | undefined;
1797
+ deleted?: boolean | undefined;
1798
+ deletedAt?: string | undefined;
1799
+ retrievalCount?: number | undefined;
1800
+ citation?: {
1801
+ file: string;
1802
+ line?: number | undefined;
1803
+ commit?: string | undefined;
1804
+ } | undefined;
1805
+ compactionLevel?: 0 | 1 | 2 | undefined;
1806
+ compactedAt?: string | undefined;
1807
+ lastRetrieved?: string | undefined;
1808
+ invalidatedAt?: string | undefined;
1809
+ invalidationReason?: string | undefined;
1810
+ }>]>, z.ZodObject<{
1811
+ type: z.ZodEnum<["quick", "full"]>;
1812
+ pattern: z.ZodOptional<z.ZodObject<{
1813
+ bad: z.ZodString;
1814
+ good: z.ZodString;
1815
+ }, "strip", z.ZodTypeAny, {
1816
+ bad: string;
1817
+ good: string;
1818
+ }, {
1819
+ bad: string;
1820
+ good: string;
1821
+ }>>;
1822
+ id: z.ZodString;
1823
+ trigger: z.ZodString;
1824
+ insight: z.ZodString;
1825
+ tags: z.ZodArray<z.ZodString, "many">;
1826
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
1827
+ context: z.ZodObject<{
1828
+ tool: z.ZodString;
1829
+ intent: z.ZodString;
1830
+ }, "strip", z.ZodTypeAny, {
1831
+ tool: string;
1832
+ intent: string;
1833
+ }, {
1834
+ tool: string;
1835
+ intent: string;
1836
+ }>;
1837
+ created: z.ZodString;
1838
+ confirmed: z.ZodBoolean;
1839
+ supersedes: z.ZodArray<z.ZodString, "many">;
1840
+ related: z.ZodArray<z.ZodString, "many">;
1841
+ evidence: z.ZodOptional<z.ZodString>;
1842
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
1843
+ deleted: z.ZodOptional<z.ZodBoolean>;
1844
+ deletedAt: z.ZodOptional<z.ZodString>;
1845
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
1846
+ citation: z.ZodOptional<z.ZodObject<{
1847
+ file: z.ZodString;
1848
+ line: z.ZodOptional<z.ZodNumber>;
1849
+ commit: z.ZodOptional<z.ZodString>;
1850
+ }, "strip", z.ZodTypeAny, {
1851
+ file: string;
1852
+ line?: number | undefined;
1853
+ commit?: string | undefined;
1854
+ }, {
1855
+ file: string;
1856
+ line?: number | undefined;
1857
+ commit?: string | undefined;
1858
+ }>>;
1859
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1860
+ compactedAt: z.ZodOptional<z.ZodString>;
1861
+ lastRetrieved: z.ZodOptional<z.ZodString>;
1862
+ invalidatedAt: z.ZodOptional<z.ZodString>;
1863
+ invalidationReason: z.ZodOptional<z.ZodString>;
1864
+ }, "strip", z.ZodTypeAny, {
1865
+ type: "quick" | "full";
1866
+ id: string;
1867
+ trigger: string;
1868
+ insight: string;
1869
+ tags: string[];
1870
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1871
+ context: {
1872
+ tool: string;
1873
+ intent: string;
1874
+ };
1875
+ created: string;
1876
+ confirmed: boolean;
1877
+ supersedes: string[];
1878
+ related: string[];
1879
+ pattern?: {
1880
+ bad: string;
1881
+ good: string;
1882
+ } | undefined;
1883
+ evidence?: string | undefined;
1884
+ severity?: "high" | "medium" | "low" | undefined;
1885
+ deleted?: boolean | undefined;
1886
+ deletedAt?: string | undefined;
1887
+ retrievalCount?: number | undefined;
1888
+ citation?: {
1889
+ file: string;
1890
+ line?: number | undefined;
1891
+ commit?: string | undefined;
1892
+ } | undefined;
1893
+ compactionLevel?: 0 | 1 | 2 | undefined;
1894
+ compactedAt?: string | undefined;
1895
+ lastRetrieved?: string | undefined;
1896
+ invalidatedAt?: string | undefined;
1897
+ invalidationReason?: string | undefined;
1898
+ }, {
1899
+ type: "quick" | "full";
1900
+ id: string;
1901
+ trigger: string;
1902
+ insight: string;
1903
+ tags: string[];
1904
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
1905
+ context: {
1906
+ tool: string;
1907
+ intent: string;
1908
+ };
1909
+ created: string;
1910
+ confirmed: boolean;
1911
+ supersedes: string[];
1912
+ related: string[];
1913
+ pattern?: {
1914
+ bad: string;
1915
+ good: string;
1916
+ } | undefined;
1917
+ evidence?: string | undefined;
1918
+ severity?: "high" | "medium" | "low" | undefined;
1919
+ deleted?: boolean | undefined;
1920
+ deletedAt?: string | undefined;
1921
+ retrievalCount?: number | undefined;
1922
+ citation?: {
1923
+ file: string;
1924
+ line?: number | undefined;
1925
+ commit?: string | undefined;
1926
+ } | undefined;
1927
+ compactionLevel?: 0 | 1 | 2 | undefined;
1928
+ compactedAt?: string | undefined;
1929
+ lastRetrieved?: string | undefined;
1930
+ invalidatedAt?: string | undefined;
1931
+ invalidationReason?: string | undefined;
1932
+ }>, z.ZodObject<{
1933
+ id: z.ZodString;
1934
+ deleted: z.ZodLiteral<true>;
1935
+ deletedAt: z.ZodString;
1936
+ }, "strip", z.ZodTypeAny, {
1937
+ id: string;
1938
+ deleted: true;
1939
+ deletedAt: string;
1940
+ }, {
1941
+ id: string;
1942
+ deleted: true;
1943
+ deletedAt: string;
1944
+ }>]>;
1945
+ /**
1946
+ * MemoryItemRecord schema - alias for LessonRecordSchema.
1947
+ * Parses all memory item types plus legacy formats.
1948
+ */
1949
+ declare const MemoryItemRecordSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1950
+ type: z.ZodLiteral<"lesson">;
1951
+ pattern: z.ZodOptional<z.ZodObject<{
1952
+ bad: z.ZodString;
1953
+ good: z.ZodString;
1954
+ }, "strip", z.ZodTypeAny, {
1955
+ bad: string;
1956
+ good: string;
1957
+ }, {
1958
+ bad: string;
1959
+ good: string;
1960
+ }>>;
1961
+ id: z.ZodString;
1962
+ trigger: z.ZodString;
1963
+ insight: z.ZodString;
1964
+ tags: z.ZodArray<z.ZodString, "many">;
1965
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
1966
+ context: z.ZodObject<{
1967
+ tool: z.ZodString;
1968
+ intent: z.ZodString;
1969
+ }, "strip", z.ZodTypeAny, {
1970
+ tool: string;
1971
+ intent: string;
1972
+ }, {
1973
+ tool: string;
1974
+ intent: string;
1975
+ }>;
1976
+ created: z.ZodString;
1977
+ confirmed: z.ZodBoolean;
1978
+ supersedes: z.ZodArray<z.ZodString, "many">;
1979
+ related: z.ZodArray<z.ZodString, "many">;
1980
+ evidence: z.ZodOptional<z.ZodString>;
1981
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
1982
+ deleted: z.ZodOptional<z.ZodBoolean>;
1983
+ deletedAt: z.ZodOptional<z.ZodString>;
1984
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
1985
+ citation: z.ZodOptional<z.ZodObject<{
1986
+ file: z.ZodString;
1987
+ line: z.ZodOptional<z.ZodNumber>;
1988
+ commit: z.ZodOptional<z.ZodString>;
1989
+ }, "strip", z.ZodTypeAny, {
1990
+ file: string;
1991
+ line?: number | undefined;
1992
+ commit?: string | undefined;
1993
+ }, {
1994
+ file: string;
1995
+ line?: number | undefined;
1996
+ commit?: string | undefined;
1997
+ }>>;
1998
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1999
+ compactedAt: z.ZodOptional<z.ZodString>;
2000
+ lastRetrieved: z.ZodOptional<z.ZodString>;
2001
+ invalidatedAt: z.ZodOptional<z.ZodString>;
2002
+ invalidationReason: z.ZodOptional<z.ZodString>;
2003
+ }, "strip", z.ZodTypeAny, {
2004
+ type: "lesson";
2005
+ id: string;
2006
+ trigger: string;
2007
+ insight: string;
2008
+ tags: string[];
2009
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2010
+ context: {
2011
+ tool: string;
2012
+ intent: string;
2013
+ };
2014
+ created: string;
2015
+ confirmed: boolean;
2016
+ supersedes: string[];
2017
+ related: string[];
2018
+ pattern?: {
2019
+ bad: string;
2020
+ good: string;
2021
+ } | undefined;
2022
+ evidence?: string | undefined;
2023
+ severity?: "high" | "medium" | "low" | undefined;
2024
+ deleted?: boolean | undefined;
2025
+ deletedAt?: string | undefined;
2026
+ retrievalCount?: number | undefined;
2027
+ citation?: {
2028
+ file: string;
2029
+ line?: number | undefined;
2030
+ commit?: string | undefined;
2031
+ } | undefined;
2032
+ compactionLevel?: 0 | 1 | 2 | undefined;
2033
+ compactedAt?: string | undefined;
2034
+ lastRetrieved?: string | undefined;
2035
+ invalidatedAt?: string | undefined;
2036
+ invalidationReason?: string | undefined;
2037
+ }, {
2038
+ type: "lesson";
2039
+ id: string;
2040
+ trigger: string;
2041
+ insight: string;
2042
+ tags: string[];
2043
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2044
+ context: {
2045
+ tool: string;
2046
+ intent: string;
2047
+ };
2048
+ created: string;
2049
+ confirmed: boolean;
2050
+ supersedes: string[];
2051
+ related: string[];
2052
+ pattern?: {
2053
+ bad: string;
2054
+ good: string;
2055
+ } | undefined;
2056
+ evidence?: string | undefined;
2057
+ severity?: "high" | "medium" | "low" | undefined;
2058
+ deleted?: boolean | undefined;
2059
+ deletedAt?: string | undefined;
2060
+ retrievalCount?: number | undefined;
2061
+ citation?: {
2062
+ file: string;
2063
+ line?: number | undefined;
2064
+ commit?: string | undefined;
2065
+ } | undefined;
2066
+ compactionLevel?: 0 | 1 | 2 | undefined;
2067
+ compactedAt?: string | undefined;
2068
+ lastRetrieved?: string | undefined;
2069
+ invalidatedAt?: string | undefined;
2070
+ invalidationReason?: string | undefined;
2071
+ }>, z.ZodObject<{
2072
+ type: z.ZodLiteral<"solution">;
2073
+ pattern: z.ZodOptional<z.ZodObject<{
2074
+ bad: z.ZodString;
2075
+ good: z.ZodString;
2076
+ }, "strip", z.ZodTypeAny, {
2077
+ bad: string;
2078
+ good: string;
2079
+ }, {
2080
+ bad: string;
2081
+ good: string;
2082
+ }>>;
2083
+ id: z.ZodString;
2084
+ trigger: z.ZodString;
2085
+ insight: z.ZodString;
2086
+ tags: z.ZodArray<z.ZodString, "many">;
2087
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
2088
+ context: z.ZodObject<{
2089
+ tool: z.ZodString;
2090
+ intent: z.ZodString;
2091
+ }, "strip", z.ZodTypeAny, {
2092
+ tool: string;
2093
+ intent: string;
2094
+ }, {
2095
+ tool: string;
2096
+ intent: string;
2097
+ }>;
2098
+ created: z.ZodString;
2099
+ confirmed: z.ZodBoolean;
2100
+ supersedes: z.ZodArray<z.ZodString, "many">;
2101
+ related: z.ZodArray<z.ZodString, "many">;
2102
+ evidence: z.ZodOptional<z.ZodString>;
2103
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
2104
+ deleted: z.ZodOptional<z.ZodBoolean>;
2105
+ deletedAt: z.ZodOptional<z.ZodString>;
2106
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
2107
+ citation: z.ZodOptional<z.ZodObject<{
2108
+ file: z.ZodString;
2109
+ line: z.ZodOptional<z.ZodNumber>;
2110
+ commit: z.ZodOptional<z.ZodString>;
2111
+ }, "strip", z.ZodTypeAny, {
2112
+ file: string;
2113
+ line?: number | undefined;
2114
+ commit?: string | undefined;
2115
+ }, {
2116
+ file: string;
2117
+ line?: number | undefined;
2118
+ commit?: string | undefined;
2119
+ }>>;
2120
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
2121
+ compactedAt: z.ZodOptional<z.ZodString>;
2122
+ lastRetrieved: z.ZodOptional<z.ZodString>;
2123
+ invalidatedAt: z.ZodOptional<z.ZodString>;
2124
+ invalidationReason: z.ZodOptional<z.ZodString>;
2125
+ }, "strip", z.ZodTypeAny, {
2126
+ type: "solution";
2127
+ id: string;
2128
+ trigger: string;
2129
+ insight: string;
2130
+ tags: string[];
2131
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2132
+ context: {
2133
+ tool: string;
2134
+ intent: string;
2135
+ };
2136
+ created: string;
2137
+ confirmed: boolean;
2138
+ supersedes: string[];
2139
+ related: string[];
2140
+ pattern?: {
2141
+ bad: string;
2142
+ good: string;
2143
+ } | undefined;
2144
+ evidence?: string | undefined;
2145
+ severity?: "high" | "medium" | "low" | undefined;
2146
+ deleted?: boolean | undefined;
2147
+ deletedAt?: string | undefined;
2148
+ retrievalCount?: number | undefined;
2149
+ citation?: {
2150
+ file: string;
2151
+ line?: number | undefined;
2152
+ commit?: string | undefined;
2153
+ } | undefined;
2154
+ compactionLevel?: 0 | 1 | 2 | undefined;
2155
+ compactedAt?: string | undefined;
2156
+ lastRetrieved?: string | undefined;
2157
+ invalidatedAt?: string | undefined;
2158
+ invalidationReason?: string | undefined;
2159
+ }, {
2160
+ type: "solution";
2161
+ id: string;
2162
+ trigger: string;
2163
+ insight: string;
2164
+ tags: string[];
2165
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2166
+ context: {
2167
+ tool: string;
2168
+ intent: string;
2169
+ };
2170
+ created: string;
2171
+ confirmed: boolean;
2172
+ supersedes: string[];
2173
+ related: string[];
2174
+ pattern?: {
2175
+ bad: string;
2176
+ good: string;
2177
+ } | undefined;
2178
+ evidence?: string | undefined;
2179
+ severity?: "high" | "medium" | "low" | undefined;
2180
+ deleted?: boolean | undefined;
2181
+ deletedAt?: string | undefined;
2182
+ retrievalCount?: number | undefined;
2183
+ citation?: {
2184
+ file: string;
2185
+ line?: number | undefined;
2186
+ commit?: string | undefined;
2187
+ } | undefined;
2188
+ compactionLevel?: 0 | 1 | 2 | undefined;
2189
+ compactedAt?: string | undefined;
2190
+ lastRetrieved?: string | undefined;
2191
+ invalidatedAt?: string | undefined;
2192
+ invalidationReason?: string | undefined;
2193
+ }>, z.ZodObject<{
2194
+ type: z.ZodLiteral<"pattern">;
2195
+ pattern: z.ZodObject<{
2196
+ bad: z.ZodString;
2197
+ good: z.ZodString;
2198
+ }, "strip", z.ZodTypeAny, {
2199
+ bad: string;
2200
+ good: string;
2201
+ }, {
2202
+ bad: string;
2203
+ good: string;
2204
+ }>;
2205
+ id: z.ZodString;
2206
+ trigger: z.ZodString;
2207
+ insight: z.ZodString;
2208
+ tags: z.ZodArray<z.ZodString, "many">;
2209
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
2210
+ context: z.ZodObject<{
2211
+ tool: z.ZodString;
2212
+ intent: z.ZodString;
2213
+ }, "strip", z.ZodTypeAny, {
2214
+ tool: string;
2215
+ intent: string;
2216
+ }, {
2217
+ tool: string;
2218
+ intent: string;
2219
+ }>;
2220
+ created: z.ZodString;
2221
+ confirmed: z.ZodBoolean;
2222
+ supersedes: z.ZodArray<z.ZodString, "many">;
2223
+ related: z.ZodArray<z.ZodString, "many">;
2224
+ evidence: z.ZodOptional<z.ZodString>;
2225
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
2226
+ deleted: z.ZodOptional<z.ZodBoolean>;
2227
+ deletedAt: z.ZodOptional<z.ZodString>;
2228
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
2229
+ citation: z.ZodOptional<z.ZodObject<{
2230
+ file: z.ZodString;
2231
+ line: z.ZodOptional<z.ZodNumber>;
2232
+ commit: z.ZodOptional<z.ZodString>;
2233
+ }, "strip", z.ZodTypeAny, {
2234
+ file: string;
2235
+ line?: number | undefined;
2236
+ commit?: string | undefined;
2237
+ }, {
2238
+ file: string;
2239
+ line?: number | undefined;
2240
+ commit?: string | undefined;
2241
+ }>>;
2242
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
2243
+ compactedAt: z.ZodOptional<z.ZodString>;
2244
+ lastRetrieved: z.ZodOptional<z.ZodString>;
2245
+ invalidatedAt: z.ZodOptional<z.ZodString>;
2246
+ invalidationReason: z.ZodOptional<z.ZodString>;
2247
+ }, "strip", z.ZodTypeAny, {
2248
+ type: "pattern";
2249
+ pattern: {
2250
+ bad: string;
2251
+ good: string;
2252
+ };
2253
+ id: string;
2254
+ trigger: string;
2255
+ insight: string;
2256
+ tags: string[];
2257
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2258
+ context: {
2259
+ tool: string;
2260
+ intent: string;
2261
+ };
2262
+ created: string;
2263
+ confirmed: boolean;
2264
+ supersedes: string[];
2265
+ related: string[];
2266
+ evidence?: string | undefined;
2267
+ severity?: "high" | "medium" | "low" | undefined;
2268
+ deleted?: boolean | undefined;
2269
+ deletedAt?: string | undefined;
2270
+ retrievalCount?: number | undefined;
2271
+ citation?: {
2272
+ file: string;
2273
+ line?: number | undefined;
2274
+ commit?: string | undefined;
2275
+ } | undefined;
2276
+ compactionLevel?: 0 | 1 | 2 | undefined;
2277
+ compactedAt?: string | undefined;
2278
+ lastRetrieved?: string | undefined;
2279
+ invalidatedAt?: string | undefined;
2280
+ invalidationReason?: string | undefined;
2281
+ }, {
2282
+ type: "pattern";
2283
+ pattern: {
2284
+ bad: string;
2285
+ good: string;
2286
+ };
2287
+ id: string;
2288
+ trigger: string;
2289
+ insight: string;
2290
+ tags: string[];
2291
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2292
+ context: {
2293
+ tool: string;
2294
+ intent: string;
2295
+ };
2296
+ created: string;
2297
+ confirmed: boolean;
2298
+ supersedes: string[];
2299
+ related: string[];
2300
+ evidence?: string | undefined;
2301
+ severity?: "high" | "medium" | "low" | undefined;
2302
+ deleted?: boolean | undefined;
2303
+ deletedAt?: string | undefined;
2304
+ retrievalCount?: number | undefined;
2305
+ citation?: {
2306
+ file: string;
2307
+ line?: number | undefined;
2308
+ commit?: string | undefined;
2309
+ } | undefined;
2310
+ compactionLevel?: 0 | 1 | 2 | undefined;
2311
+ compactedAt?: string | undefined;
2312
+ lastRetrieved?: string | undefined;
2313
+ invalidatedAt?: string | undefined;
2314
+ invalidationReason?: string | undefined;
2315
+ }>, z.ZodObject<{
2316
+ type: z.ZodLiteral<"preference">;
2317
+ pattern: z.ZodOptional<z.ZodObject<{
2318
+ bad: z.ZodString;
2319
+ good: z.ZodString;
2320
+ }, "strip", z.ZodTypeAny, {
2321
+ bad: string;
2322
+ good: string;
2323
+ }, {
2324
+ bad: string;
2325
+ good: string;
2326
+ }>>;
2327
+ id: z.ZodString;
2328
+ trigger: z.ZodString;
2329
+ insight: z.ZodString;
2330
+ tags: z.ZodArray<z.ZodString, "many">;
2331
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
2332
+ context: z.ZodObject<{
2333
+ tool: z.ZodString;
2334
+ intent: z.ZodString;
2335
+ }, "strip", z.ZodTypeAny, {
2336
+ tool: string;
2337
+ intent: string;
2338
+ }, {
2339
+ tool: string;
2340
+ intent: string;
2341
+ }>;
2342
+ created: z.ZodString;
2343
+ confirmed: z.ZodBoolean;
2344
+ supersedes: z.ZodArray<z.ZodString, "many">;
2345
+ related: z.ZodArray<z.ZodString, "many">;
2346
+ evidence: z.ZodOptional<z.ZodString>;
2347
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
2348
+ deleted: z.ZodOptional<z.ZodBoolean>;
2349
+ deletedAt: z.ZodOptional<z.ZodString>;
2350
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
2351
+ citation: z.ZodOptional<z.ZodObject<{
2352
+ file: z.ZodString;
2353
+ line: z.ZodOptional<z.ZodNumber>;
2354
+ commit: z.ZodOptional<z.ZodString>;
2355
+ }, "strip", z.ZodTypeAny, {
2356
+ file: string;
2357
+ line?: number | undefined;
2358
+ commit?: string | undefined;
2359
+ }, {
2360
+ file: string;
2361
+ line?: number | undefined;
2362
+ commit?: string | undefined;
2363
+ }>>;
2364
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
2365
+ compactedAt: z.ZodOptional<z.ZodString>;
2366
+ lastRetrieved: z.ZodOptional<z.ZodString>;
2367
+ invalidatedAt: z.ZodOptional<z.ZodString>;
2368
+ invalidationReason: z.ZodOptional<z.ZodString>;
2369
+ }, "strip", z.ZodTypeAny, {
2370
+ type: "preference";
2371
+ id: string;
2372
+ trigger: string;
2373
+ insight: string;
2374
+ tags: string[];
2375
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2376
+ context: {
2377
+ tool: string;
2378
+ intent: string;
2379
+ };
2380
+ created: string;
2381
+ confirmed: boolean;
2382
+ supersedes: string[];
2383
+ related: string[];
2384
+ pattern?: {
2385
+ bad: string;
2386
+ good: string;
2387
+ } | undefined;
2388
+ evidence?: string | undefined;
2389
+ severity?: "high" | "medium" | "low" | undefined;
2390
+ deleted?: boolean | undefined;
2391
+ deletedAt?: string | undefined;
2392
+ retrievalCount?: number | undefined;
2393
+ citation?: {
2394
+ file: string;
2395
+ line?: number | undefined;
2396
+ commit?: string | undefined;
2397
+ } | undefined;
2398
+ compactionLevel?: 0 | 1 | 2 | undefined;
2399
+ compactedAt?: string | undefined;
2400
+ lastRetrieved?: string | undefined;
2401
+ invalidatedAt?: string | undefined;
2402
+ invalidationReason?: string | undefined;
2403
+ }, {
2404
+ type: "preference";
2405
+ id: string;
2406
+ trigger: string;
2407
+ insight: string;
2408
+ tags: string[];
2409
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2410
+ context: {
2411
+ tool: string;
2412
+ intent: string;
2413
+ };
2414
+ created: string;
2415
+ confirmed: boolean;
2416
+ supersedes: string[];
2417
+ related: string[];
2418
+ pattern?: {
2419
+ bad: string;
2420
+ good: string;
2421
+ } | undefined;
2422
+ evidence?: string | undefined;
2423
+ severity?: "high" | "medium" | "low" | undefined;
2424
+ deleted?: boolean | undefined;
2425
+ deletedAt?: string | undefined;
2426
+ retrievalCount?: number | undefined;
2427
+ citation?: {
2428
+ file: string;
2429
+ line?: number | undefined;
2430
+ commit?: string | undefined;
2431
+ } | undefined;
2432
+ compactionLevel?: 0 | 1 | 2 | undefined;
2433
+ compactedAt?: string | undefined;
2434
+ lastRetrieved?: string | undefined;
2435
+ invalidatedAt?: string | undefined;
2436
+ invalidationReason?: string | undefined;
2437
+ }>]>, z.ZodObject<{
2438
+ type: z.ZodEnum<["quick", "full"]>;
2439
+ pattern: z.ZodOptional<z.ZodObject<{
2440
+ bad: z.ZodString;
2441
+ good: z.ZodString;
2442
+ }, "strip", z.ZodTypeAny, {
2443
+ bad: string;
2444
+ good: string;
2445
+ }, {
2446
+ bad: string;
2447
+ good: string;
2448
+ }>>;
2449
+ id: z.ZodString;
2450
+ trigger: z.ZodString;
2451
+ insight: z.ZodString;
2452
+ tags: z.ZodArray<z.ZodString, "many">;
2453
+ source: z.ZodEnum<["user_correction", "self_correction", "test_failure", "manual"]>;
2454
+ context: z.ZodObject<{
2455
+ tool: z.ZodString;
2456
+ intent: z.ZodString;
2457
+ }, "strip", z.ZodTypeAny, {
2458
+ tool: string;
2459
+ intent: string;
2460
+ }, {
2461
+ tool: string;
2462
+ intent: string;
2463
+ }>;
2464
+ created: z.ZodString;
2465
+ confirmed: z.ZodBoolean;
2466
+ supersedes: z.ZodArray<z.ZodString, "many">;
2467
+ related: z.ZodArray<z.ZodString, "many">;
2468
+ evidence: z.ZodOptional<z.ZodString>;
2469
+ severity: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
2470
+ deleted: z.ZodOptional<z.ZodBoolean>;
2471
+ deletedAt: z.ZodOptional<z.ZodString>;
2472
+ retrievalCount: z.ZodOptional<z.ZodNumber>;
2473
+ citation: z.ZodOptional<z.ZodObject<{
2474
+ file: z.ZodString;
2475
+ line: z.ZodOptional<z.ZodNumber>;
2476
+ commit: z.ZodOptional<z.ZodString>;
2477
+ }, "strip", z.ZodTypeAny, {
2478
+ file: string;
2479
+ line?: number | undefined;
2480
+ commit?: string | undefined;
2481
+ }, {
2482
+ file: string;
2483
+ line?: number | undefined;
2484
+ commit?: string | undefined;
2485
+ }>>;
2486
+ compactionLevel: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
2487
+ compactedAt: z.ZodOptional<z.ZodString>;
2488
+ lastRetrieved: z.ZodOptional<z.ZodString>;
2489
+ invalidatedAt: z.ZodOptional<z.ZodString>;
2490
+ invalidationReason: z.ZodOptional<z.ZodString>;
2491
+ }, "strip", z.ZodTypeAny, {
2492
+ type: "quick" | "full";
2493
+ id: string;
2494
+ trigger: string;
2495
+ insight: string;
2496
+ tags: string[];
2497
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2498
+ context: {
2499
+ tool: string;
2500
+ intent: string;
2501
+ };
2502
+ created: string;
2503
+ confirmed: boolean;
2504
+ supersedes: string[];
2505
+ related: string[];
2506
+ pattern?: {
2507
+ bad: string;
2508
+ good: string;
2509
+ } | undefined;
2510
+ evidence?: string | undefined;
2511
+ severity?: "high" | "medium" | "low" | undefined;
2512
+ deleted?: boolean | undefined;
2513
+ deletedAt?: string | undefined;
2514
+ retrievalCount?: number | undefined;
2515
+ citation?: {
2516
+ file: string;
2517
+ line?: number | undefined;
2518
+ commit?: string | undefined;
2519
+ } | undefined;
2520
+ compactionLevel?: 0 | 1 | 2 | undefined;
2521
+ compactedAt?: string | undefined;
2522
+ lastRetrieved?: string | undefined;
2523
+ invalidatedAt?: string | undefined;
2524
+ invalidationReason?: string | undefined;
2525
+ }, {
2526
+ type: "quick" | "full";
2527
+ id: string;
2528
+ trigger: string;
2529
+ insight: string;
2530
+ tags: string[];
2531
+ source: "user_correction" | "self_correction" | "test_failure" | "manual";
2532
+ context: {
2533
+ tool: string;
2534
+ intent: string;
2535
+ };
2536
+ created: string;
2537
+ confirmed: boolean;
2538
+ supersedes: string[];
2539
+ related: string[];
2540
+ pattern?: {
2541
+ bad: string;
2542
+ good: string;
2543
+ } | undefined;
2544
+ evidence?: string | undefined;
2545
+ severity?: "high" | "medium" | "low" | undefined;
2546
+ deleted?: boolean | undefined;
2547
+ deletedAt?: string | undefined;
2548
+ retrievalCount?: number | undefined;
2549
+ citation?: {
2550
+ file: string;
2551
+ line?: number | undefined;
2552
+ commit?: string | undefined;
2553
+ } | undefined;
2554
+ compactionLevel?: 0 | 1 | 2 | undefined;
2555
+ compactedAt?: string | undefined;
2556
+ lastRetrieved?: string | undefined;
2557
+ invalidatedAt?: string | undefined;
2558
+ invalidationReason?: string | undefined;
2559
+ }>, z.ZodObject<{
2560
+ id: z.ZodString;
2561
+ deleted: z.ZodLiteral<true>;
2562
+ deletedAt: z.ZodString;
2563
+ }, "strip", z.ZodTypeAny, {
2564
+ id: string;
2565
+ deleted: true;
2566
+ deletedAt: string;
2567
+ }, {
2568
+ id: string;
2569
+ deleted: true;
2570
+ deletedAt: string;
2571
+ }>]>;
2572
+ type Lesson = z.infer<typeof LessonSchema>;
2573
+ /** @deprecated Use MemoryItemType instead. */
2574
+ type LessonType = z.infer<typeof LessonTypeSchema>;
2575
+ type LessonRecord = z.infer<typeof LessonRecordSchema>;
2576
+ type Source = z.infer<typeof SourceSchema>;
2577
+ type Severity = z.infer<typeof SeveritySchema>;
2578
+ type Context = z.infer<typeof ContextSchema>;
2579
+ /** Unified memory item type (discriminated union). */
2580
+ type MemoryItem = z.infer<typeof MemoryItemSchema>;
2581
+ /** Memory item type enum: 'lesson' | 'solution' | 'pattern' | 'preference'. */
2582
+ type MemoryItemType = z.infer<typeof MemoryItemTypeSchema>;
2583
+ /** Solution memory item. */
2584
+ type Solution = z.infer<typeof SolutionItemSchema>;
2585
+ /** Pattern memory item (not to be confused with Pattern = {bad, good}). */
2586
+ type PatternItem = z.infer<typeof PatternItemSchema>;
2587
+ /** Preference memory item. */
2588
+ type Preference = z.infer<typeof PreferenceItemSchema>;
2589
+ /** Record type for reading JSONL files (all types + legacy). */
2590
+ type MemoryItemRecord = z.infer<typeof MemoryItemRecordSchema>;
2591
+ /**
2592
+ * Generate deterministic memory item ID from insight text.
2593
+ * Format: {prefix} + 8 hex characters from SHA-256 hash.
2594
+ *
2595
+ * @param insight - The insight text to hash
2596
+ * @param type - Memory item type (default: 'lesson' for backward compat)
2597
+ * @returns ID string like L1a2b3c4d, S1a2b3c4d, P1a2b3c4d, or R1a2b3c4d
2598
+ */
2599
+ declare function generateId(insight: string, type?: MemoryItemType): string;
2600
+
2601
+ export { type Context as C, type Lesson as L, type MemoryItem as M, type PatternItem as P, type Severity as S, type MemoryItemType as a, LegacyLessonSchema as b, LegacyTombstoneSchema as c, LessonItemSchema as d, type LessonRecord as e, LessonRecordSchema as f, LessonSchema as g, type LessonType as h, LessonTypeSchema as i, type MemoryItemRecord as j, MemoryItemRecordSchema as k, MemoryItemSchema as l, MemoryItemTypeSchema as m, PatternItemSchema as n, type Preference as o, PreferenceItemSchema as p, type Solution as q, SolutionItemSchema as r, type Source as s, generateId as t };