Memory Types
MemMachine works as an intelligent memory layer on top of a user’s Agentic LLM experience. It gathers input via Python APIs in a Memory Instance, then determines if that input is profile, short-term and/or long-term:- Profile memory consists of information specific to the user and their experience.
- Short-term memory consists of episodic memory and summaries of the episodic memory. A raw episode consists of 1 message.
- Long-term memory consists of a batch of episodes that is generated from the short-term memories. The Episode batch is then ranked using a Reranker and deduplicated for the most frequent hits.
How does MemMachine sort into it’s Memory Types?
MemMachine utilizes an embedder to break apart user/agent language into distinct computer understandable derivatives. These derivatives are then passed through a re-ranker which compares the results to those found in the long-term memory buckets, then returns the top, sorted matches. After the re-ranker completes it’s activity, memory is stored into an associated database.Profile Memory
Profile memory specifically focuses on information and data specific to a user and their experience. The data is stored in a PostgreSQL database. Memory Storage Process- Raw user messages go into session_history
- An LLM analyzes conversations to extract meaningful knowledge
- Structured knowledge gets stored in memvergeprofile with vector embeddings
- The citations table links each piece of knowledge back to its source conversations
- Query: User asks a question or system needs context
- Semantic Search: System uses vector embeddings to find relevant knowledge
- Retrieval: Returns matching profile entries with their associated conversation sources
- Context: Citations provide traceability back to original conversations
Database Profile Memory Table Structures
MemMachine is built on a PostgreSQL database, which uses the pgvector extension to perform an efficient vector similarity search. Think of this as a way to instantly find similar or related information. The system’s memory is organized across three main tables that work together to store user profiles, conversation history, and the key relationships between them.Description: This is the main table for storing a user’s profile and their features. We use vector embeddings in this table to give us a powerful way to perform semantic searches.Purpose: This is where we store a user’s profile information. We use key-value pairs and vector embeddings to make it easy to find relevant user characteristics quickly through a semantic search.Here’s an example Profile table:Here are the fields you’ll find in this table:
Field | Explanation |
---|---|
id | Unique identifier for each knowledge entry. |
user_id | This integer is a unique ID specific to the user that is interacting with the agent. The ID organizes all information about the user, and only this user. |
tag | A high-level categorization (e.g., “Preferences”, “Skills”, “Background”). |
feature | An executive summary of the information (e.g., “likes_pizza”, “programming_language”) |
value | Detailed content of the knowledge (e.g., “Margherita with extra cheese”, “Python, JavaScript, Go”) |
create_at | This is a timestamp for when the listing in the table was created. |
update_at | This is a timestamp for when the listing in the table was last updated. |
embedding | MemMachine creates a detailed 1536-trait numerical fingerprint for each memory, enabling smart, meaning-based searches to find the most relevant context. |
metadata | A JSONB field for storing additional structured information about the knowledge entry. |
isolations | A JSONB field for storing isolation parameters, which can be used to restrict access to certain knowledge entries based on specific criteria. |
The
unique_utfv
constraint ensures no duplicate knowledge entries for the same user, tag, feature, and value combination.