memory-improvements / src /beforeAfterWalkthrough.ts
loudiman's picture
Add beforeAfterWalkthrough
050d467 verified
// 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 |
*/