compound-agent 1.2.8 → 1.2.10

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