@QingQ77: 30 runnable Jupyter notebooks that thoroughly cover LLM agent memory technologies from short-term to long-term, simple to production-grade. https://github.com/NirDiamant/Agent_Memory_Techniques… This repo covers L...
Summary
A GitHub repository containing 30 runnable Jupyter notebooks that comprehensively explain LLM agent memory technologies, from short-term context to production-grade patterns, covering methods like MemGPT, Zep, Graphiti, along with decision trees and comparison tables.
View Cached Full Text
Cached at: 05/08/26, 03:35 PM
30 runnable Jupyter notebooks that thoroughly cover LLM agent memory techniques from short-term to long-term, from simple to production-grade. https://github.com/NirDiamant/Agent_Memory_Techniques… This repository breaks down LLM agent memory into six directions: how to manage short-term context, how to store long-term information, how to build cognitive architectures, how to select retrieval routing, how to use existing frameworks, and how to evaluate and deploy. Each direction has a runnable notebook, from the most basic conversation buffer to MemGPT self-editing memory, Zep temporal knowledge graphs, Graphiti episodic-to-semantic extraction — all with code. It also covers Anthropic’s seven-layer memory definition and Mem0’s managed memory layer. Additionally, it includes a decision tree and comparison table for quick reference when you’re unsure which technique to use.
NirDiamant/Agent_Memory_Techniques
Source: https://github.com/NirDiamant/Agent_Memory_Techniques
🧠 Agent Memory Techniques
Learn every agent memory technique for LLM agents.
⭐ If you find this useful, please star the repo so more learners can discover it. 🧭 New here? Start with 01 Conversation Buffer Memory or pick a Learning Path. Prefer a visual? See the Decision Tree below.
30 runnable Jupyter notebooks covering conversation buffers, vector stores, knowledge graphs, episodic and semantic memory, working memory, MemGPT, Mem0, Letta, Zep, Graphiti, LoCoMo benchmarks, and production memory patterns.
📖 The RAG Techniques Book is HERE (https://europe-west1-rag-techniques-views-tracker.cloudfunctions.net/rag-techniques-tracker?notebook=agent-memory-techniques–readme&click=book-buy-amazon-title&target=https%3A%2F%2Fwww.amazon.com%2Fdp%2FB0D76734SZ%3Ftag%3Ddiamantai-amt-20&text=The%20RAG%20Techniques%20Book%20is%20HERE)
From the same author
#1 Best Seller on Amazon in Generative AI Want to go deeper on RAG (Retrieval-Augmented Generation, the technique of giving a model extra documents so it can answer better)? The book is the long version. You’ll get the intuition behind every technique. You’ll get side-by-side comparisons that show when each one wins and when it quietly fails. You’ll get illustrations that make the tricky parts click.
⏳ Launch window only: $0.99
The price goes up once the launch window closes. Readers who grab it now lock in the lowest price it will ever have.
👉 Get the book on Amazon before the price changes (https://europe-west1-rag-techniques-views-tracker.cloudfunctions.net/rag-techniques-tracker?notebook=agent-memory-techniques–readme&click=book-buy-amazon-cta&target=https%3A%2F%2Fwww.amazon.com%2Fdp%2FB0D76734SZ%3Ftag%3Ddiamantai-amt-20&text=Get%20the%20book%20on%20Amazon%20before%20the%20price%20changes)
📫 Stay Updated
🚀WeeklyUpdates 💡ExpertInsights 🎯Top 0.1%Content Join over 50,000 readers getting clear AI tutorials every week. Subscribers also get early access and a 33% discount on my book.
🗺️ Taxonomy of Agent Memory Techniques
The 30 techniques fall into six families. Each family solves a different memory problem. Each technique lives in its own notebook.
| Family | What it solves | Techniques |
|---|---|---|
| Short-term | Keep recent turns in memory without filling up the context window. | 01 - 05 |
| Long-term | Save knowledge across sessions, users, and time. | 06 - 11 |
| Cognitive architectures | Working, hierarchical, and reflective memory systems. | 12 - 19 |
| Retrieval & routing | Choose what to recall and when. | 20 - 23 |
| Frameworks | Production-ready memory libraries (Mem0, Letta, Zep, Graphiti). | 24 - 27 |
| Evaluation & production | Measure, benchmark, and deploy memory. | 28 - 30 |
📐 Compare Techniques at a Glance
Looking to filter by constraint (persistence, retrieval style, token cost, best-for use case)? See the side-by-side comparison matrix covering all 30 techniques in one table.
📚 All 30 Techniques
🔄 Short-Term Memory (Techniques 1-5)
Manage the conversation inside a single chat.
| # | Technique | Description | Notebook |
|---|---|---|---|
| 01 | Conversation Buffer Memory | Save the full conversation, word for word. The simplest pattern, and the base for everything else. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/01_conversation_buffer_memory/conversation_buffer_memory.ipynb) |
| 02 | Sliding Window Memory | Keep only the last few messages. You limit the size, but you keep the recent parts. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/02_sliding_window_memory/sliding_window_memory.ipynb) |
| 03 | Summary Memory | Replace old turns with a short summary written by the model. You lose length but keep the meaning. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/03_summary_memory/summary_memory.ipynb) |
| 04 | Summary Buffer Memory | Summarize older turns, but keep recent messages word for word. You get both. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/04_summary_buffer_memory/summary_buffer_memory.ipynb) |
| 05 | Token Buffer Memory | Trim the history to fit a strict token budget. Drop the oldest messages first. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/05_token_buffer_memory/token_buffer_memory.ipynb) |
💾 Long-Term Memory (Techniques 6-11)
Storage that survives across sessions and users.
| # | Technique | Description | Notebook |
|---|---|---|---|
| 06 | Vector Store Memory | Turn past messages into vectors (number lists that capture meaning). Search them later by similarity. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/06_vector_store_memory/vector_store_memory.ipynb) |
| 07 | Entity Memory | Pull out and track facts about people, projects, and preferences. Update them as the conversation grows. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/07_entity_memory/entity_memory.ipynb) |
| 08 | Knowledge Graph Memory | Build a graph of how entities connect. Walk the graph to reason over what the agent has learned. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/08_knowledge_graph_memory/knowledge_graph_memory.ipynb) |
| 09 | Episodic Memory | Store complete interactions with when-and-where context. Good for “what happened when” questions. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/09_episodic_memory/episodic_memory.ipynb) |
| 10 | Semantic Memory | Pull general facts out of interactions. Store them on their own, away from the raw episodes. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/10_semantic_memory/semantic_memory.ipynb) |
| 11 | Procedural Memory | Capture “how-to” knowledge: the procedures and workflows the agent picks up over time. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/11_procedural_memory/procedural_memory.ipynb) |
🧩 Cognitive Architectures (Techniques 12-19)
Patterns borrowed from how humans remember.
| # | Technique | Description | Notebook |
|---|---|---|---|
| 12 | Working Memory & Context Window | Manage the agent’s limited attention. Prioritize, pin, and evict context on the fly. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/12_working_memory_context_window/working_memory_context_window.ipynb) |
| 13 | Hierarchical Memory Layers | Tiered storage with hot, warm, and cold layers. Promote and demote items as they age. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/13_hierarchical_memory_layers/hierarchical_memory_layers.ipynb) |
| 14 | Memory Consolidation | Merge, deduplicate, and strengthen memories. Inspired by how the brain consolidates during sleep. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/14_memory_consolidation/memory_consolidation.ipynb) |
| 15 | Memory Compaction | Compress stored memories with summaries, entity extraction, or distillation. Save storage and tokens. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/15_memory_compaction/memory_compaction.ipynb) |
| 16 | Self-Reflection Memory | The agent looks back at its own actions. It writes notes on what worked, and uses them next time. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/16_self_reflection_memory/self_reflection_memory.ipynb) |
| 17 | Memory Routing | Pick the right memory store to read from or write to. Route by content type and intent. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/17_memory_routing/memory_routing.ipynb) |
| 18 | Temporal Memory | Attach timestamps to memories. Retrieve with time awareness and weight recent items higher. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/18_temporal_memory/temporal_memory.ipynb) |
| 19 | Forgetting & Decay | Forget on purpose. Use decay, access counts, or relevance to prune. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/19_forgetting_and_decay/forgetting_and_decay.ipynb) |
🔍 Retrieval & Multi-Agent (Techniques 20-23)
How agents find and share memories.
| # | Technique | Description | Notebook |
|---|---|---|---|
| 20 | Memory Retrieval Patterns | Compare retrieval strategies: semantic search, recency, hybrid scoring, diversity, and re-ranking. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/20_memory_retrieval_patterns/memory_retrieval_patterns.ipynb) |
| 21 | Cross-Session Memory | Save and reload agent state across sessions. The user picks up where they left off. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/21_cross_session_memory/cross_session_memory.ipynb) |
| 22 | Multi-Agent Shared Memory | Shared stores, message passing, and agreement protocols for multi-agent teams. | ✅ Notebook · Colab (https://colab.research.google.com/github/NirDiamant/Agent_Memory_Techniques/blob/main/all_techniques/22_multi_agent_shared_memory/multi_agent_shared_memory.ipynb) |
| 23 | Memory with Tools | Give the agent memory tool |
Similar Articles
@GitTrend0x: The Killer Open-Source Tool That Transforms AI from a Goldfish Memory to Perfect Recall https://github.com/run-llama/llama_index… Meet LlamaIndex, the most mature RAG framework in the Python ecosystem, with a blockbuster open-source project boasting 49k+ stars! AI…
Introduces LlamaIndex, a mature Python open-source framework with 49k+ stars, designed to provide AI assistants with persistent memory and efficient RAG capabilities through vectorized storage and semantic search.
ReasoningBank: an agent memory framework that lets LLM agents keep learning from wins and losses
ReasoningBank gives LLM agents a memory layer so they continuously learn from both successes and failures, driving higher task success rates and faster execution.
rohitg00/agentmemory
agentmemory is an open-source persistent memory layer for AI coding agents (Claude Code, Cursor, Gemini CLI, Codex CLI, etc.) that uses knowledge graphs, confidence scoring, and hybrid search to give agents long-term memory across sessions via MCP, hooks, or REST API. Built on the iii engine, it requires no external databases and exposes 51 MCP tools.
Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory
Mem0 introduces a scalable memory-centric architecture using graph-based representations to improve long-term conversational coherence in LLMs, significantly reducing latency and token costs while outperforming existing memory systems.
@QingQ77: 'Dive into Deep Learning' is an excellent introductory book, but its update speed struggles to keep pace with the field's development. Since the Transformer, content like CLIP, Diffusion, vLLM, and more has proliferated. While online resources are abundant, they are highly fragmented—today you study Attention, tomorrow LoRA, the day after...
This project is a systematic deep learning notes repository covering PyTorch, Transformers, generative models, and more. It aims to address the fragmentation of learning materials and provides code implementations along with practical guides.