MemSync uses two distinct types of memories to capture different kinds of information from user interactions. Understanding these types helps you optimize how your AI application stores and retrieves context.
Semantic memories represent stable, lasting facts that are not tied to a specific time or place. These are the core truths about a user that remain relatively constant over time.
Episodic memories relate to current situations, goals, or projects that might change over time. They are tied to specific moments and could evolve or become outdated.
# Examples of content that becomes semantic memoryuser_input = [ "I work as a data scientist at Microsoft", # Job/identity "I have two cats named Luna and Max", # Personal facts "I prefer Python over JavaScript", # Preferences "I studied computer science at MIT" # Background/education]
# Examples of content that becomes episodic memoryuser_input = [ "I'm currently working on a React project", # Current project "I'm learning Spanish this semester", # Active learning "I just started a new diet plan", # Recent change "I'm planning to visit Japan next month" # Future plans]
When new information conflicts with existing semantic memories, MemSync intelligently handles updates:
Copy
// Original semantic memory{ "memory": "Works as a software engineer at Google", "type": "semantic", "categories": ["career"]}// New information: "I just got promoted to Senior Software Engineer"// Results in updated memory:{ "memory": "Works as a Senior Software Engineer at Google", "type": "semantic", "categories": ["career"]}
Episodic memories can evolve or transition to semantic memories:
Copy
// Original episodic memory{ "memory": "Currently learning React for a new project", "type": "episodic", "categories": ["learning", "career"]}// After project completion: "I've become proficient in React"// May become semantic memory:{ "memory": "Proficient in React development", "type": "semantic", "categories": ["career"]}
# Good for finding current contextmemories = memsync.search_memories( query="What is the user currently working on?", categories=["career", "learning"], limit=5)
# Best for comprehensive personalizationmemories = memsync.search_memories( query="Tell me about the user's background and current projects", limit=15, rerank=True)