Overview
This example demonstrates a complete chat application that remembers user preferences, context, and conversations using Satori.Features
- Persistent memory across sessions
- Automatic information extraction
- Semantic context retrieval
- Natural conversation flow
Complete Implementation
API Route
app/api/chat/route.ts
Chat Interface
app/chat/page.tsx
Example Conversations
Conversation 1: Building Context
Sharing personal information
Sharing personal information
Sharing preferences
Sharing preferences
Sharing hobbies
Sharing hobbies
Conversation 2: Recalling Context (New Session)
Personalized greeting
Personalized greeting
User: “Hey, what’s up?”Assistant: “Hey Alex! How’s it going? Did you get a chance to go hiking this weekend?”Behind the scenes: Retrieved memories about name and hiking hobby
Context-aware recommendations
Context-aware recommendations
User: “I’m looking for a new side project to work on.”Assistant: “Since you love TypeScript and photography, have you thought about building a photo management app? You could use TypeScript with Next.js for the frontend and maybe add some AI features for automatic tagging. It would combine your technical preferences with your hobby!”Behind the scenes: Retrieved memories about TypeScript preference and photography hobby
Explicit recall
Explicit recall
User: “What do you remember about me?”Assistant: “Let me see… I know that your name is Alex and you work as a software engineer at Acme Corp. You prefer TypeScript over JavaScript because of the type safety. In your free time, you enjoy hiking and photography, and you try to get out into nature every weekend. Is there anything else you’d like me to remember?”Behind the scenes: Retrieved all relevant memories
Conversation 3: Updating Information
Correcting information
Correcting information
User: “Actually, I just started a new job at TechCo!”Assistant: “Congratulations on the new position at TechCo! That’s exciting. What will you be working on there?”Behind the scenes: Saves “User now works at TechCo” (new memory)
Forgetting information
Forgetting information
User: “Can you forget that I work at TechCo? I’d rather not share work details.”Assistant: “Of course, I’ve removed that information. Your privacy is important.”Behind the scenes: Searches for and deletes work-related memories
Key Features Demonstrated
Automatic Extraction
The LLM automatically identifies and saves important information without explicit commands
Semantic Retrieval
Context is retrieved based on meaning, not just keywords
Natural Flow
Memory operations happen transparently without disrupting conversation
User Control
Users can ask what’s remembered and request deletions
Customization Ideas
Add memory categories
Add memory categories
Add memory importance
Add memory importance
Add conversation summaries
Add conversation summaries