ltcmp
BK—404
08–25–24






long-term core memory profiles
filling in the gaps of Mem0’s episodic memory

Summary:
Mem0's search() function is great at answering "what happened to this person?" - But it's less good at answering "who is this person?"

I believe that answering the second question is our next step to acheiving AI assistants that can help users grow over time, rather than approaching each conversation as a singular issue. That’s why I’ve coined my feature proposal as “long-term” memory profiles (ltcmp); a condensed source of truth about the user’s core qualities (configurable per application use-case).

Right now with Mem0, every time you want baseline context about a user, you're either searching through memories hoping to reconstruct a coherent picture, or you're stuffing your entire memory store into context and hoping the LLM figures it out. Neither scales well. So ltcmps evolve with the user’s interactions.

The Problem: Episodic Memory Alone Isn't Enough
I’m building Mindme, a wellness companion aimed at even entering the therepuetic space. Our users can have 200+ memories stored across months of conversations. So when they start a new session, the system should be able to understand:
  • Who is this person? (role, demographics, communication style)
  • What are they working on? (current goals, context)
  • What matters to them? (preferences, values)

With only search(), you'd need to either:
  1. Run multiple searches hoping to cover these bases
  2. Retrieve all memories and let the LLM synthesize
  3. Hard-code some kind of user profile table outside Mem0

None of these are great. The first is brittle, the second doesn't scale, and the third defeats the purpose of having an integrated memory system like Mem0.

The Solution: Episodic + Semantic Memory
The fix maps to how human memory actually works. Cognitive scientists distinguish between:
  • Episodic memory: Specific events ("I had coffee with Sarah this morning")
  • Semantic memory: General knowledge ("I prefer morning meetings”)

Just ask yourself, which of these would you rather your personal AI assistant remember about you? Which memory seems more useful?

Right now, Mem0's search() is largely episodic. The new get_profile() is semantic; a distilled, stable representation of who someone is, updated incrementally as new information arrives.

Using both together gives you comprehensive context without the overhead of processing hundreds of memories every session.

Architecture Overview
The profile system adds three main components:
  1. Profile generation: LLM synthesizes memories into a 200-400 token summary
  2. Auto-update trigger: profiles refresh based on memory count/time elapsed
  3. Version history: Full audit trail of how profiles evolve

The auto-update logic checks two configurable conditions:
  • Memory count threshold: If current_memories - memories_at_last_update >= memory_count, then trigger update
  • Time threshold: If now - last_update_timestamp >= time_elapsed, trigger update

The Generation Prompts
Two prompts (configurable) drive profile generation:

Initial/Full Generation: Used when creating a new profile or forcing total refresh
Example
    Generate a concise user profile (200-400 tokens) covering:
        1. Demographics and Role
        2. Communication Preferences 
        3. Key Expertise/Skills
        4. Major Interests and Preferences   
        5. Current Goals/ContextFocus on stable, high-level traits, not events

Incremental Update: Used when updating an existing profile with new memories
Example
    Update the existing profile with new memories while maintaining coherence.
        1. Preserve core identity
        2. Integrate new information
        3. Update current context (replace outdated goals)
        4. Maintain consistency
        5. Stay within 200-400 tokens
The incremental prompt is key for efficiency: rather than regenerating from scratch, it only processes new memories against the existing profile. This matters when you have hundreds of memories but only 5 new ones since the last update.

Usage Patterns Basic: Profile as Session Context
The most common pattern is to inject the profile into your system prompt. The
profile provides stable context ("Bob is anxious about needles, prefers afternoon appointments"), while search provides event-specific context ("Bob asked about blood tests yesterday").

You can also override the default prompt for domain-specific profiles. This is
useful when the default categories (demographics, skills, interests) don't map to your use case.

Manual Updates
Sometimes you need to force a refresh after a significant event or milestone. In Mindme’s use case, this may be if the user was promoted to a new job or moved to a new city, or left a relationship they often spoke about.

Profile History
For audit trails or understanding how a user's profile evolved:
Each history entry includes:
  • version: sequential version number
  • update_reason: why this update happened (initial, memory_count, time_elapsed, manual)
  • memory count: How many memories existed at generation time
  • created_at: Timestamp

Quality Metrics
Profiles include quality signals to help you decide whether to trust them:
  • confidence_score: Higher with more memories, lower if profile is stale or memories are sparse
  • warnings: Flags like “low_memory_count” or “stale_profile” when quality might be degraded

This lets you build conditional logic to add a disclaimer to the prompt context if confidence is low, or force an update if the profile is stale.



and yeah that’s basically it ty for reading :]