File size: 1,711 Bytes
050d467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// BEFORE/AFTER WALKTHROUGH — See full version in chat or sandbox
// This shows the user experience difference with all 6 improvements

/*
BEFORE: 200+ noisy memories, 3/5 retrieval slots wasted on duplicates
  Past context:
  - I am allergic to peanuts.
  - Nothing with peanuts please      ← duplicate
  - I hate peanuts                   ← duplicate
  - I like spicy noodles.
  - What's a good restaurant near me? ← noise

AFTER: ~80 clean memories, all retrieval slots unique and relevant
  About the user:
  - Allergic to peanuts
  - Likes spicy noodles
  - Favorite cuisine is Filipino food

  Previous suggestions:
  - Suggested Thai place on 5th Ave (already recommended)

RESULT: SLM generates better reply with full context, no repetition.

| Aspect              | Before                    | After                           |
|---------------------|---------------------------|---------------------------------|
| Memories stored     | 200+ (noisy)              | ~80 (clean, deduplicated)       |
| Context slots       | 5 (3 wasted on dupes)     | 4-12 (all unique, relevant)     |
| Token budget        | Fixed                     | Dynamic (100-500)               |
| Prompt structure    | Flat list                 | Typed sections                  |
| Assistant recall    | None                      | Tracks recommendations          |
| Stale handling      | Never cleaned             | Heat-based eviction             |
| Duplicate handling  | None                      | 0.85 threshold auto-dedup       |
| Question storage    | Stored ❌                  | Filtered out ✅                  |
| Retrieval           | Fixed top-5, 0.45         | Dynamic k=3-12, 0.35-0.50      |
*/