Skip to main content

Agent Memory System

The memory system provides MOOD MNKY agents with the ability to maintain context during conversations, recall past interactions, and build meaningful relationships with users over time. This system ensures that interactions feel continuous and personalized, even across multiple sessions.

Memory Architecture

Our agent memory system employs a multi-layered architecture to balance immediate context awareness with long-term relationship building:

Short-term Memory

Stores the current conversation context and recent exchanges

Working Memory

Holds active topics and recently accessed information relevant to the current interaction

Long-term Memory

Archives significant interactions, preferences, and insights discovered over time

Memory Components

Short-term Memory

Short-term memory provides immediate conversational context:
  • Conversation Buffer: Maintains the last 10-20 message exchanges
  • Active Entities: Tracks references to people, products, or concepts in the current conversation
  • Immediate Sentiment: Records the emotional tone of the current exchange
  • Attention Markers: Flags important elements requiring follow-up

Working Memory

Working memory connects short-term exchanges with broader context:
  • Active Topics: Main subjects under discussion across recent conversations
  • User Goals: Current objectives the user is working toward
  • Contextual Knowledge: Relevant facts and information pulled from the knowledge base
  • Interaction State: User’s current position in multi-step processes or flows

Long-term Memory

Long-term memory creates continuity and relationship depth over time:
  • Interaction History: Summarized records of past conversations
  • User Preferences: Discovered likes, dislikes, and preferences
  • Pattern Recognition: Behavioral and communication patterns identified over time
  • Relationship Insights: Understanding of the evolving relationship between user and agent

Memory Processes

Memory Processes Diagram The memory system employs several processes to manage information effectively:

Encoding

Information enters the memory system through:
  • Direct conversation inputs
  • Observed user behaviors and choices
  • System events and triggers
  • Integration with external data sources

Storage

Information is stored using:
  • Vectorized representations for semantic retrieval
  • Key-value pairs for attribute data
  • Graph structures for relationship mapping
  • Time-series data for temporal analysis

Retrieval

Memory retrieval occurs through:
  • Context-based Search: Finding relevant past interactions based on current context
  • Semantic Similarity: Identifying related memories based on meaning
  • Recency-based Access: Prioritizing recent interactions
  • Importance-weighted Recall: Focusing on significant memories first

Consolidation

Memory systems periodically:
  • Summarize conversational exchanges
  • Extract key insights and preferences
  • Generate relationship updates
  • Archive older, less relevant information

Memory Usage in Agent Interactions

Contextual Continuity

The memory system enables agents to:
  • Resume conversations after interruptions
  • Remember preferences without repeated statements
  • Reference past interactions appropriately
  • Recognize repeated questions or concerns
  • Adapt to evolving user needs over time

Privacy and Forgetting

Our memory system includes deliberate forgetting mechanisms:
  • Retention Policies: Different types of information have appropriate retention periods
  • Explicit Forgetting: Users can request removal of specific memories
  • Privacy Filters: Sensitive information is automatically identified and protected
  • Memory Reset Options: Users can initiate partial or complete memory resets
  • Data Minimization: Only necessary information is stored in long-term memory

Technical Implementation

1

Collection

Conversations and interactions are processed through NLP pipelines for semantic understanding.
2

Transformation

Raw conversational data is converted to structured memory representations.
3

Storage

Memory entries are stored in appropriate databases based on memory type and expected retrieval patterns.
4

Indexing

Memories are indexed for efficient retrieval through vector embeddings and metadata.
5

Retrieval

Context-aware algorithms select relevant memories during interactions.

Integration with Other Systems

The memory system integrates with several other components:
Memory system enriches queries with user context and stores user-specific knowledge extensions.
Long-term memory contributes to and utilizes user profile information for personalization.
Memory context is transferred during agent handoffs to maintain conversation continuity.
Anonymized memory patterns inform system improvements while preserving privacy.

Implementation Technologies

The memory system leverages several technologies:
  • Redis for short-term memory and caching
  • Vector database (Pinecone) for semantic memory storage
  • PostgreSQL for structured relationship data
  • TimescaleDB for time-series memory analysis
  • Langchain Memory components for integration with LLM workflows

Future Enhancements

Planned improvements to the memory system include:
  • Adaptive memory consolidation based on information importance
  • Enhanced reasoning over memory collections for deeper insights
  • Cross-user pattern recognition while preserving individual privacy
  • Emotional memory to better understand user sentiment patterns
  • Proactive memory retrieval that anticipates relevant past information
While our memory system enables personalized, continuous conversations, agents are designed to function effectively even with limited memory access. In cases where memory access is restricted or reset, agents gracefully adapt without compromising the quality of assistance.