Extracted Facts Memory
Uses an LLM to extract discrete facts, preferences, and entity information from conversations and stores them as structured, deduplicated records. Unlike vector store memory (which stores chunks of raw text), this pattern stores clean, human-readable facts that are injected into future sessions as explicit context.
This is how ChatGPT's memory feature works.
Structure
During a conversation, an extraction step identifies facts worth remembering. These are stored as structured records. On future sessions, relevant facts are loaded into the system prompt so the agent has context it wouldn't otherwise have.
Mechanism
- Write Path
- Read Path
- Lifecycle
- An LLM analyzes conversation turns for extractable facts
- Facts are stored as structured records:
"User prefers TypeScript over JavaScript" - Deduplication and conflict resolution on write (newer facts override older)
- Storage: key-value store, JSON documents, or database rows
- User can also explicitly say "remember that I prefer dark mode"
- On session start, relevant facts are retrieved and injected into the system prompt
- Retrieval can be: all facts (small sets), filtered by topic, or ranked by relevance
- Facts are presented as plain-text context the model can reference
- Example injection:
"Known about this user: Prefers Python. Works at Acme Corp. Timezone: PST."
- Created: Extracted automatically from conversations or saved explicitly by user
- Updated: Overwritten when contradicting facts are detected
- Deleted: User can remove individual facts or clear all
- Persists: Across all future sessions indefinitely
- Visibility: Facts should be visible and editable by the user (transparency)
Key Characteristics
- Clean and structured — stores discrete facts, not raw text chunks
- Human-readable — users can see, edit, and delete individual memories
- Cross-session personalization — agent knows your preferences without being told
- Extraction quality varies — LLM may extract wrong or irrelevant facts
- Privacy sensitive — stores personal information that requires careful handling
When to Use
- Users interact with the agent repeatedly and expect it to remember preferences
- You need personalization across sessions (language, tools, coding style, name)
- Facts are more useful than raw conversation history
- Users want transparency and control over what the agent remembers
- You're building a personal assistant or ongoing relationship with the agent