Skip to content
LinkedInX

What Is Memory

Target audience: Those who want AI to remember information across multiple turns or sessions, those dealing with AI forgetting earlier context in long conversations
Prerequisites: Basic understanding of Context Engineering

Memory is the mechanism by which an AI agent retains information across conversation turns and sessions, and recalls it when needed. Where context engineering handles “what to show the model right now,” memory handles “what to keep around for later.”

Context vs. Memory

AspectContextMemory
TimeframeWhat’s visible right nowWhat persists across turns and sessions
RoleSupplies the immediate judgment materialStorage that can be recalled later
ExampleCurrent instructions, the last tool resultUser preferences, past task history
This table scrolls horizontally. Keyboard users can focus the table and use the left and right arrow keys.

Information stored in memory is still passed to the model as context whenever it’s actually used. Memory is simply a storage layer that gets loaded into context later.

Short-Term vs. Long-Term Memory

TypeDescriptionImplementation examples
Short-term memoryWorking state valid only for the current sessionConversation history, the most recent tool result
Long-term memoryInformation retained across sessionsUser preferences, past task results, documents
This table scrolls horizontally. Keyboard users can focus the table and use the left and right arrow keys.

Patterns for Implementing Long-Term Memory

1. Compression via Summarization

Instead of keeping an entire conversation or log, summarize and store the important decisions, open issues, and constraints. Passing an entire long history every time crowds the context window and buries important information.

Store past information as vectors and use similarity search to recall only what’s relevant to the current task. This approach shares its underlying idea with RAG.

3. Structured Storage

User settings, profiles, and project constraints are easier to reference accurately later if stored as structured files or records rather than free-form text.

# Example user profile
Preferred answer style: Concise, bullet-point focused
Language: English
Project constraint: Never deploy to production without approval

Things to Watch Out For

  • Don’t mix in stale information: Resolved issues or outdated hypotheses left in memory can lead the AI to reason from wrong assumptions
  • Don’t store everything: Storing indiscriminately adds noise and buries what matters
  • Keep provenance: Recording when and from which task a piece of information came makes it easier to spot when it’s gone stale

Pages in This Section

PageContent
Short-Term and Long-Term MemoryLifespan and write criteria for each type
Memory Versus RAGHow to choose between two similar mechanisms
Long-Term Memory Storage PatternsComparing files, structured records, vector search, and summaries
This table scrolls horizontally. Keyboard users can focus the table and use the left and right arrow keys.

Summary

  • Memory retains and recalls information across conversation turns and sessions
  • If context is “what to show now,” memory is “what to keep for later”
  • Short-term memory is conversation history; long-term memory is implemented via summarization, vector search, or structured storage
  • Storing everything indiscriminately hurts quality — organizing stale information and tracking provenance matters more
Quiz