Think of an AI Agent as a new employee at your data company. Without memory, this employee lives in a state of permanent “Groundhog Day.” Every time you speak to him, it’s his first day on the job. He doesn’t remember the SQL query you asked for 5 minutes ago, doesn’t remember your preference for partitioned tables, and certainly doesn’t remember the mistake he made last week.
What is “Memory” in an AI Agent?
In the context of AI and Large Language Models (LLMs), a Memory System is not a single component (like RAM in a computer). Instead, it is a multi-layered architectural framework designed to store, retrieve, and synthesize information across different timescales.
Memory is what turns a stateless API caller into a true, stateful agent. It enables continuity, personalization, and learning over time. Without it, every interaction is isolated; with it, the agent becomes a colleague that grows with you.
记忆是把一个“无状态 API 调用者”变成真正的“有状态 Agent”的关键。它实现了连续性、个性化和长期学习。没有记忆,每次交互都是孤立的;有了记忆,Agent 就变成了一位与你一同成长的同事。
In cognitive architectures for LLMs, we classify memory into four distinct types, borrowing heavily from cognitive psychology (Atkinson-Shiffrin model) but adapted for software engineering.
CN: 在 LLM 的认知架构中,我们借鉴认知心理学(Atkinson-Shiffrin 模型)并将其适配到软件工程,将记忆划分为四种不同类型。
Type of Memory System
- Short-Term Memory (STM) / Working Memory
- Long-Term Memory (LTM)
- Episodic Memory
- Semantic Memory
Memory Operation Primitives
Store, Recall, Update and Forget
Short-term Memory: Conversation State(LangGraph)
State, Reducers, Checkpointer and Thread
Short-term Memory: Sliding Window Memory
Sliding window keeps only the most recent N messages,
automatically evicts oldest messages,
System messages should never be trimmed,
Tool call pairs must be preserved together 配对必须一起保留
Sliding window loses long-term context 滑动窗口丢失长期上下文
Long-term Memory: User Profile(PostgreSQL)
Also called User Profile; User Preference Storage; User Preference Modeling, Personalization Layer; Contextual Memory; Persistent Memory
Long-term Memory: mem0
Extract, Store, Retrieve and Update

