AI Wikis / Agentic Web
AI Memory Systems: A Comparative Survey
Report summary
Executive Summary: Modern AI systems augment stateless models with various memory mechanisms to persist context, facts, and user data across time. We identify many memory types – e.g. short-term (conversation context), long-term (persistent knowledge), episodic, semantic, procedural memory – and tec
Key topics
- AI Wikis / Agentic Web
- AI Wikis
- Agentic Web
- AI
- UAIX
- AI Memory
- SQL
- Python
- Runtime
Research provenance
For citation, use the report title and canonical URL. Archival presence does not establish authorship or promote report statements into portfolio evidence.
This page renders the archived Markdown as safe, formatted HTML. It is background research and does not become a portfolio claim without evidence review.
Full report
On this page
Executive Summary: Modern AI systems augment stateless models with various memory mechanisms to persist context, facts, and user data across time. We identify many memory types – e.g. short-term (conversation context), long-term (persistent knowledge), episodic, semantic, procedural memory – and technical mechanisms like retrieval-augmented generation (RAG), vector embeddings (vector databases), knowledge graphs, caches, session states, fine-tuned weights, and neural memory networks. Each has distinct data structures (e.g. token buffers, vectors, graph edges, key–value stores) and retrieval methods (sliding windows, ANN search, graph queries, embedding models). We detail how these work, their use cases and limits, and how they interoperate. For example, production AI often composes vector search + graph traversal + user memory before each generation to supply a full context【30†L536-L543】. We compare major platforms (OpenAI’s ChatGPT memory, Anthropic Claude, Microsoft Copilot, LangChain/LlamaIndex, Weaviate, Pinecone, Milvus, Chroma, etc.) citing official docs. Privacy and governance are critical: user memories must be controlled (e.g. ChatGPT lets users delete saved facts【13†L34-L43】; Claude offers “zero data retention” modes) and secured. Finally, a comparison table contrasts each approach on persistence, capacity, latency, cost, integration effort, and best use cases.
Memory Types in AI
- Short-term (Working) Memory: The model’s immediate context window (chat history). LLMs have no inherent memory beyond their token buffer【6†L168-L176】, so agents use a rolling context window or in-memory buffer to retain recent inputs. For example, a chatbot holds the last n messages and discards older ones as it exceeds its token limit【6†L193-L202】. This lets it maintain dialogue coherence (smoother responses over turns). Implementation: typically a FIFO buffer of tokens or messages; updating is trivial (append newest, drop oldest). Scalability: limited by model’s max tokens; cost negligible. Latency: essentially instant (in memory). Use case: real-time conversation. Limitation: cannot store information beyond a session, and large buffers slow down inference.
- Long-term (Persistent) Memory: Data retained across sessions, enabling personalization or knowledge recall【6†L213-L219】. In practice, this is stored externally (databases, vector indexes, knowledge bases). A common pattern is Retrieval-Augmented Generation (RAG): documents or knowledge are chunked, embedded into a vector database, and at query time relevant chunks are retrieved to condition the LLM【39†L1-L4】. This offloads heavy memory from the model and avoids retraining. Data structures: vector stores of embeddings or graph DBs. Retrieval: approximate nearest neighbor (ANN) search on vectors (e.g. HNSW indexes), or graph traversals. Updating: typically offline or background (e.g. re-embedding new documents). Latency: vector search often <50 ms (depending on scale). Scalability: millions–billions of items (Milvus scales to tens of billions【37†L72-L74】). Cost: high storage/indexing costs; queries consume CPU/GPUs (and service fees). Use cases: knowledge-base Q&A, personalization (remembering user profile, preferences). Limitation: if not updated, memory can become stale. Pure RAG alone can’t do multi-hop reasoning or personalization (no persistent user model)【30†L431-L439】; pure LLM weights can’t be updated without costly retraining.
- Episodic Memory: A log of specific past events or interactions (e.g. conversation transcripts, actions). Analogous to human episodic recall, it records what happened when. AI agents implement this by appending structured event records (time-stamped actions/responses) to a store. Use case: case-based reasoning, sequential decision tasks. For example, a recommender might log a user’s past choices to improve future suggestions. Implementation: often a time-indexed database or file logs. Retrieval: simple lookup (by session/user ID) or filtering (time range). Limitation: grows unbounded; retrieving relevant episodes requires indexing or summarization. Tools like LlamaIndex treat conversation history as episodic memory flushed into vector stores【35†L42-L49】.
- Semantic Memory: General facts and concepts (e.g. encyclopedic knowledge). In AI this is usually a knowledge base or vector space of encoded facts. For instance, an AI legal assistant might store case law and precedents (facts about law) in a knowledge graph or dense index【6†L247-L254】. Structure: graph of entities (nodes) and relations (edges), or document store with embeddings. Retrieval: graph queries (multi-hop SPARQL/Gremlin) or semantic search in a vector DB. Updating: controlled edits to the graph or continuous ingestion of new documents. Latency: graph traversals can be slower (especially multi-hop); vector search is fast. Use: fact lookup, reasoning chains, compliance checks. Limitation: building and curating a comprehensive knowledge graph is labor-intensive and error-prone【30†L461-L468】【30†L481-L490】.
- Procedural Memory: Stored skills and procedures (AI “how-to” rules). In practice, this is embedded in model weights (trained patterns) or rule engines, not explicitly manipulated at runtime. An AI agent’s system prompt or script could represent procedural memory (e.g. “How to answer customer requests”). Agents learn automated workflows (e.g. via reinforcement learning) and store them as part of their policy (weights) or explicit task templates. Use: repetitive tasks, skill execution (e.g. always use a calculator for math). Limitations: hard to adapt on the fly without retraining.
- Vector Embeddings / Vector DB: Though not a “memory” type per se, embeddings are the backbone of many memories (especially RAG/semantic memory). Text or data is encoded into vectors (dense numeric representations). These are stored in vector databases (Weaviate, Pinecone, Milvus, Chroma, etc.). Data structure: high-dimensional vectors. Indexing: ANN indexes (like HNSW or IVF) support nearest-neighbor search. Retrieval: query text is embedded and nearest vectors are fetched. Updating: vectors are upserted or deleted; indexing usually asynchronous. Latency: typically 10–100 ms depending on size and cluster. Scalability: designed to handle millions to billions of vectors (Milvus claims “scale to tens of billions”【37†L72-L74】). Use cases: Semantic search, document retrieval for RAG, similarity search. Limitations: Requires computing embeddings; index rebuilds can be costly; relevance depends on embedding quality.
- External Databases and Files: Any persistent storage (SQL/NoSQL databases, file systems, object stores) can serve as memory by logging context or artifacts. For example, Anthropic’s Claude uses a client-side file directory
/memoriesas a primitive memory tool【15†L185-L194】. On each session start Claude “checks its memory directory” and reads any relevant files to pick up context【15†L219-L228】. Retrieval: simple file read or DB query. Consistency: fully consistent (especially if client-controlled). Latency: filesystem/DB lookup (milliseconds). Use: project context, logs, static resources. Limitations: lack semantic indexing (must code retrieval logic); suitable for structured or small data.
- Session/State Memory: Tied to a user session or conversation thread. This can be just the conversation history, or a session ID mapping to stored variables in a database. LangChain calls short-term memory “thread-scoped” state【32†L99-L107】. Implementation: key-value store (e.g. Redis) or application memory keyed by session. Retrieval: by session ID lookup. Use: keep user preferences or intermediate state for chatbots. Limitation: usually ephemeral (cleared after session ends unless saved to long-term store).
- Cache: A temporary in-memory store (e.g. LRU cache or Redis) used to speed up repetitive computations (like model queries or vector searches). Structure: hashmap (key → response or vectors). Update: on every query, cache result. Retrieval: fast lookup if key matches. Use: accelerate repeated prompts or intermediate steps. Limitation: cache hit rate falls with high variability; must invalidate stale entries. Not suitable for long-term personalization.
- Fine-tuning / Continual Learning: Considered a kind of “memory” in that model weights encode learned information. Updating model weights on new data (fine-tuning or continual learning frameworks) is one way to give a model new knowledge. Data: training dataset. Update: offline gradient-based training. Retrieval: implicit in model outputs. Latency: high during training, but inference remains as usual. Use: permanently imbue domain knowledge or user data into the model. Limitation: slow, expensive, risk of catastrophic forgetting; not real-time. Unlike RAG, it cannot easily add or remove individual facts on the fly.
- Neural Memory Networks & Attention: Some architectures explicitly incorporate memory-like modules (e.g. Neural Turing Machines, End-to-End Memory Networks). Modern LLMs use attention as a form of dynamic short-term memory: they compute key-value attention over past tokens in the context window each time they generate. This is latent memory within a session – no persistence beyond the input. Structure: matrices of key/value vectors. Use: in-model context management. Limitation: none persists beyond each generation; also attention’s quadratic scaling limits context length.
Technical Mechanisms: Data Flow and Integration
AI systems often compose multiple memory types. A common pattern (the “enterprise context layer”) is to feed queries through vector search, graph traversal, and memory retrieval before calling the LLM【30†L536-L543】. The data flow can be illustrated as:
flowchart LR
subgraph ExternalMemory
vectordb[(Vector DB)]
kg[(Knowledge Graph)]
memstore[(Session/Memory Store)]
end
UserInput([User Query])
UserInput --> vectordb
UserInput --> kg
UserInput --> memstore
vectordb -->|documents| Context((Context Buffer))
kg -->|facts| Context
memstore -->|user data| Context
Context --> LLM([LLM (Transformer)])
LLM -->|Answer| Response([AI Response])
Here the user query (and possibly its embedding or entities) triggers:
- a vector search (e.g. in Milvus/Pinecone/Chroma) retrieving top-k similar documents or contexts (RAG),
- a knowledge-graph traversal extracting related entities/facts (if used), and
- a user/session memory lookup (e.g. saved profiles). These pieces of context are merged into the prompt for the LLM. For example, Atlan describes a four-stage flow: "vector search identifies relevant documents, graph traversal gathers connected context, memory retrieval injects session/user info, then LLM inference runs on the composed context"【30†L536-L543】.
Interoperability & Integration Patterns: Modern AI stacks rarely use one memory mode in isolation. In practice:
- RAG + Memory: A vector DB (text index) supplies factual context, while a separate user memory store holds personal preferences. For instance, ChatGPT uses both conversation history and a “memory” of user info【13†L34-L43】.
- Hybrid KG & RAG (Graph RAG): GraphRAG methods combine vector search to find seed nodes and then traverse a knowledge graph for multi-hop insights【30†L473-L481】. This yields better reasoning over linked facts than flat similarity alone.
- Session + Long-term Memory: Agents often first retrieve any persistent user profile (e.g. “Alice prefers Italian food”) and then feed that plus current session logs into the prompt. LangChain’s memory framework does this via “stores” that persist across threads【32†L99-L107】.
- Cache & Memory: Systems may cache recent memory queries for efficiency, but proper invalidation is needed to avoid stale info.
- LRU vs Summarization: When short-term buffers overflow, one can either discard old info (as in sliding window) or compress it (summarize into long-term store). LlamaIndex, for example, flushes older chat messages from a short-term queue into long-term “memory blocks” which can include vector indexes or fact summaries【35†L42-L49】.
Conflict & Redundancy: Combining memories can cause overlap or conflicts (e.g. the same fact in both a knowledge base and a memory store). Systems need reconciliation rules. The UAIX perspective would emphasize explicit provenance and conflict resolution: each memory update should be traceable (source authority, timestamp, veracity) so agents can prefer authoritative sources in case of conflict.
Privacy, Security, and Governance
Persistent memory often contains sensitive user or corporate data. This raises privacy/governance issues:
- User Control: Users must be able to manage their memory. OpenAI’s ChatGPT allows users to review, delete or turn off “saved memories”【13†L34-L43】. Microsoft’s Copilot similarly lets users delete or disable saved memories【21†L130-L138】. Such controls align with data protection regulations (e.g. GDPR “right to be forgotten”).
- Data Encryption and Access: Memory stores (vector DBs, logs) should be secured. Claude’s memory tool runs client-side, giving developers full control and enabling “Zero Data Retention” policies【15†L203-L210】. Enterprise implementations might encrypt memory at rest and audit accesses.
- Bias and Poisoning: Memory can introduce bias (e.g. repeatedly feeding user preferences) or be poisoned (an attacker injecting malicious facts). Strict validation and content filtering should guard memory writes. UAIX-style evidence logs (immutably recording memory updates) could help audit anomalies.
- Consistency and Reliability: Vector indexes (like Pinecone) are often eventually consistent【41†L252-L260】. This must be accounted for: newly added memory might not be immediately retrievable. For critical facts, one might use a strongly consistent DB or write-through caching.
- Governance: Organizations should have policies for what memories are stored, for how long, and when to retire them. Systems like Atlan build “context graphs” with freshness guarantees from governed metadata【30†L483-L492】, ensuring source authority and timeliness. Similarly, AI systems should track memory provenance and use case tags (e.g. training vs runtime memory) to enforce governance.
Comparative Implementations and Platforms
- OpenAI (ChatGPT): Provides built-in memory features. The official help docs explain that ChatGPT can “remember helpful information between conversations” as Saved Memories【13†L34-L43】, such as your name or preferences. ChatGPT keeps chat history (session context) unless cleared. Users can instruct ChatGPT to remember specific facts, or delete them later. Tech details are proprietary, but likely ChatGPT stores profile data in a database, retrieves it to augment prompts, and uses conversation threads as short-term memory.
- Anthropic (Claude): Offers a Memory Tool in its API【15†L185-L194】. This is an explicit file-system-based memory: developers provide a
/memoriesdirectory on their server, and Claude willcreate/read/update/deletefiles there. Claude checks this directory at the start of each session and uses it for context【15†L219-L228】. Memory is entirely client-managed, giving flexibility and security. Use cases include multi-turn project assistance and iterative learning. The trade-off is that the developer must code memory management (no automatic semantic indexing). Claude’s memory tool is “zero data retention” capable – once output is returned, data isn’t stored by Anthropic. - Google (Bard, Gemini): As of 2026 Google’s LLM offerings have limited user-facing memory features. Google’s knowledge graph (used in search) functions somewhat like semantic memory, but Bard’s public features don’t yet include personal memory beyond conversation context. (Some media say Bard is testing memory; an official “Memory” feature has not been broadly released. Google did pilot allowing Bard to remember preferences in research programs.)
- Meta (LLaMA, etc.): Meta’s open models (Llama) don’t include built-in memory. However, research prototypes (e.g. MBart with memory modules) exist. No widely-used persistent memory features are available. Meta’s work tends to focus on latent memory (model weights) and retrieval-augmented models (using external indices via tools).
- Microsoft (Copilot for 365): Integrates memory in its Copilot suite. The Microsoft support doc explains Copilot “learns key details” from chats (like your role, common tasks) and these become memories influencing future responses【21†L130-L138】. Users can explicitly tell Copilot to remember something (“Remember I prefer Excel for reports”). Copilot’s memory appears to be stored in Microsoft’s cloud (tied to the user’s M365 account). It supports management: users can view or delete saved memories in Copilot settings. Technical details are not public, but it likely uses a structured user profile DB plus chat context. The system also merges or updates memories (e.g. updating outdated info) automatically【21†L163-L172】.
- LangChain Framework: LangChain (and the newer LangGraph) provides open-source memory abstractions for developers【32†L99-L107】【33†L6-L10】. It formalizes short-term memory (in-session chat history) vs. long-term (persistent stores). LangChain offers built-in memory modules: e.g.
ConversationBufferMemory(keep last N messages),ConversationSummaryMemory(summarize long chats), and evenKnowledgeGraphMemoryfor simple semantic info. LangChain is a library, not a storage engine: it integrates with vector DBs (Weaviate, Pinecone, etc.), SQL, Redis, etc. Its docs describe memory types (semantic, episodic, procedural) analogous to human memory【33†L6-L10】. LangChain’s memory is typically a wrapper around a store: e.g. using SQLite for simple key-value, or a vector DB for embedding-based retrieval. The framework simplifies updating (on each user message or as background tasks) and retrieval (automatically feeding memory into prompts). - LlamaIndex (formerly GPT Index): Focused on document and conversation memory. It provides a
Memoryclass that combines short-term and long-term memory【35†L42-L49】【35†L174-L183】. Short-term chat history is a FIFO queue of messages (up to a token limit). When full, messages are “flushed” into long-term memory blocks. LlamaIndex includes blocks likeFactExtractionMemoryBlock(extract facts via an LLM) orVectorMemoryBlock(store messages in a vector index like Chroma)【35†L174-L183】. In retrieval, it merges short and long memory into the prompt. This approach automates context compression: older exchanges become part of an embedding index or fact list, conserving prompt space. LlamaIndex is agnostic of LLM provider, and relies on embedding models for its memory blocks. - Vector Databases: Products like Pinecone, Weaviate, Milvus, Chroma, Qdrant, Redis Vector are the backbone of RAG-style memory.
- Weaviate (open-source/cloud) offers a vector store with an optional built-in knowledge graph (class hierarchy, ontologies)【28†L172-L180】. Its blog explains using vector DBs as long-term memory alongside context windows.
- Milvus (open-source by Zilliz) is built for scale, claiming support for “tens of billions of vectors”【37†L72-L74】. It is often used with LangChain (Milvus has first-class integrations).
- Pinecone (managed SaaS) abstracts away infrastructure. It supports full-text (BM25) and hybrid search in the same system【41†L197-L205】, and is eventually consistent (recent writes may not appear immediately)【41†L252-L260】.
- Chroma is an open-source local/managed store (used by default in LlamaIndex).
- All these provide Python/REST APIs. They index vectors, run ANN queries, and return nearest-neighbor results with sub-second latency (depends on dimension and cluster size).
- Use cases: powering RAG, semantic similarity, recommending. Limitations: cost (managed services or large self-hosted clusters), need embedding models.
- Knowledge Graph Platforms: Systems like Neo4j, Amazon Neptune, GraphDB are used to implement graph-structured memory. A modern variant is Atlan’s context graph, which is a governed knowledge graph built from enterprise metadata【30†L483-L492】. These platforms support SPARQL/Gremlin or Cypher queries. They excel at structured, multi-hop queries but are less suited for unstructured memory (documents). Building them requires data modeling and governance. In practice, they complement vector stores: one might use a graph for policy or compliance rules while using vectors for raw text retrieval.
- Caching Layers: Some AI platforms incorporate caches. For instance, a conversational app might cache recent vector search results or LLM outputs (e.g. OpenAI’s API users often implement caching). Memory plugins (third-party) also exist; for example, “MemoryPlugin” is an extension that intercepts ChatGPT web chats to store past user messages in a browser-local cache (unofficial).
- Fine-tuning Services: Tools like OpenAI’s fine-tuning or HuggingFace’s AutoTrain are not memory layers per se, but are used to incorporate new data into model weights. This approach is heavy-weight compared to RAG, but offers integrated “memory” (the model itself). For incremental updates, frameworks like LoRA or Elastic Weight Consolidation are research-active areas.
Table: Memory Mechanisms Compared
| Memory / System | Persistence | Capacity (scale) | Retrieval Latency | Cost | Ease of Integration | Typical Use Cases |
|---|---|---|---|---|---|---|
| Short-term (Context) | Ephemeral (session) | Limited by LLM context (~thousands of tokens) | Low (inference time) | Minimal | Built-in (no extra infrastructure) | Chatbot dialogue management, immediate context |
| Vector DB / RAG | Persistent index (cloud or self-hosted) | High (millions–billions of docs/vectors) | Moderate (10–100 ms/query) | Moderate–High (compute + storage) | Moderate (requires embedding model + DB) | Semantic search, document retrieval, knowledge Q&A |
| Knowledge Graph | Persistent (graph DB) | Moderate (nodes/edges count) | Moderate–High (multi-hop queries) | High (engineering effort) | Hard (requires schema, specialized queries) | Complex reasoning, compliance checks, entity relationships |
| Session/State Store | Persistent (DB or cache) | Low (per-user context) | Very Low (direct lookup) | Low | Easy (DB key lookup) | User profiles, session variables |
| Cache (KV-store) | Ephemeral (in-memory) | Moderate (server memory) | Very Low (hash lookup) | Low | Easy (standard caching lib) | Speeding repeated queries, intermediate results |
| LLM Weights (Fine-tune) | Persistent (model file) | Very High (knowledge capacity) | High (retraining, but inference standard) | Very High (compute) | Hard (requires training pipelines) | Integrating broad knowledge, closed-domain specialization |
| Tool/File Memory | Persistent (filesystem/DB) | Low–Moderate (files or tables) | Low–Moderate (OS/DB access) | Low | Moderate (developer-managed) | Project context (e.g. Claude’s memory tool) |
| Attention / Cache | Ephemeral (per-query) | LLM’s context limit | Low (within model) | N/A (model cost) | N/A (built-in) | Token-level context management (not persistent) |
Conclusions
AI memory systems span a spectrum from volatile context windows to durable knowledge bases. Short-term memory (chat history) enables coherent conversations, while long-term memory (RAG, knowledge graphs, profile stores) provides grounding and personalization【6†L193-L202】【6†L225-L229】. Modern architectures compose these: e.g. retrieval-augmented generation (vector search) for broad knowledge, plus a knowledge graph for structured reasoning, plus user memory for personalization【30†L512-L519】【30†L536-L543】. Major providers reflect this: OpenAI and Microsoft offer user-profile memories in their assistants【13†L34-L43】【21†L130-L138】; Anthropic gives a file-based memory tool【15†L185-L194】; LangChain/LlamaIndex supply frameworks tying memories to LLMs【32†L99-L107】【35†L42-L49】; and vector DB vendors focus on scalable embedding stores【37†L72-L74】. Each approach has trade-offs in persistence, latency, and cost. Crucially, any AI memory strategy must address privacy and security – exposing personal data in memory is risky without proper controls (some systems even allow “zero data retention”)【15†L203-L210】【13†L34-L43】. In summary, AI memory is a multifaceted field: a robust solution often layers multiple techniques, with careful governance of what gets remembered and how.