Skip to main content

What are Memories?

Memories are discrete pieces of information extracted from user conversations. They complement traits by storing:
  • Specific facts that don’t fit trait schemas
  • Events and experiences mentioned
  • Contextual information for future conversations

Memory Structure

interface Memory {
  id: string;
  profileId: string;
  content: string;          // The extracted information
  type: 'fact' | 'preference' | 'event' | 'context';
  importance: number;       // 0.0 - 1.0
  decayFactor: number;      // Decreases over time
  sourceMessageIds: string[];
  createdAt: Date;
  lastAccessedAt: Date | null;
}

Memory Types

Fact

Concrete information: “Works at Acme Corp as a senior engineer”

Preference

Likes and dislikes: “Prefers dark mode IDEs”

Event

Things that happened: “Started a new project last week”

Context

Situational info: “Currently debugging a production issue”

Importance Scoring

Memories are scored by likely future relevance:
ScoreDescriptionExamples
0.8+Core identity/roleJob title, primary tech stack
0.6-0.8Ongoing projectsCurrent goals, active work
0.4-0.6PreferencesTool preferences, working style
< 0.4Ephemeral contextToday’s specific task

Memory Decay

Over time, memories become less relevant. The decayFactor (starting at 1.0) decreases:
  • Unused memories decay faster
  • Accessed memories are “refreshed”
  • Low importance memories decay faster
This ensures recent and frequently-relevant information takes priority.

Memory Retrieval

When building context for a request, GetProfile retrieves memories based on:
  1. Recency: More recent memories score higher
  2. Importance: Higher importance memories are prioritized
  3. Relevance: (Future) Semantic similarity to the current query
  4. Access patterns: Frequently accessed memories are boosted

Example: Memory Extraction

Given this conversation:
User: I'm working on migrating our monolith to microservices at work. 
      We're using Kubernetes and having some issues with the service mesh.
      By the way, I'll be on vacation next week.
GetProfile extracts:
[
  {
    "content": "Working on migrating a monolith to microservices",
    "type": "event",
    "importance": 0.8
  },
  {
    "content": "Uses Kubernetes at work",
    "type": "fact",
    "importance": 0.7
  },
  {
    "content": "Experiencing issues with service mesh",
    "type": "context",
    "importance": 0.6
  },
  {
    "content": "Will be on vacation next week",
    "type": "event",
    "importance": 0.4
  }
]

Deduplication

GetProfile automatically handles duplicate memories:
  • Identical content is merged
  • Similar memories may be consolidated
  • Source messages are aggregated