NirDiamant/Agent_Memory_Techniques

★ 1,069⑂ 0

Agent memory for LLMs: 30 runnable Jupyter notebooks covering conversation buffers, vector stores, knowledge graphs, episodic and semantic memory, MemGPT, Mem0, Letta, Zep, Graphiti

About NirDiamant/Agent_Memory_Techniques

NirDiamant/Agent_Memory_Techniques is an open-source project on GitHub, mainly written in Jupyter Notebook. Agent memory for LLMs: 30 runnable Jupyter notebooks covering conversation buffers, vector stores, knowledge graphs, episodic and semantic memory, MemGPT It currently holds 1,069 stars and 0 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the AI Agent Memory board.

GitHub Repository Details

Repository NirDiamant/Agent_Memory_Techniques · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

🧠 Agent Memory Techniques

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Agent Memory Techniques for LLMs: 30 runnable Jupyter notebooks covering every major memory pattern

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.

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/License: Apache 2.0 https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Python 3.10+ https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Jupyter https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/GitHub Stars https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Issues https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Contributions Welcome

---

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/LinkedIn https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Twitter https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Reddit https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Discord https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Sponsor

🎓 From memory demos to production agents

Prompt to Production - my full course on building software with AI the way professionals do: the methods and paradigms behind reliable, efficient, modular production systems, taught systematically. 17 modules, each pairing a video lecture with a hands-on lab, from your first structured prompt to a working production system.

The course is live. Every module is out, lecture and lab.

🎁 Try a full module, free

🎬
7-minute
video lecture
🛠️
Hands-on
tutorial
🤖
AI assistant
inside Claude Code

One npm install adds the module's AI assistant to your Claude Code, and it guides you through the tutorial as you build.

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Claim your free module

👉 Get the full course

📖 The book of this repo

Agent Memory Made Simple - the 464-page visual guide to everything in this repo: all 30 techniques, 184 custom illustrations, zero code required.

Get it on Amazon (paperback · Kindle · free on Kindle Unlimited) →

More from the series: RAG Made Simple - Amazon Bestseller in Generative AI · 1,500+ readers · ⭐ 4.6

---

📫 Stay Updated

🚀
Weekly
Updates
💡
Expert
Insights
🎯
Top 0.1%
Content

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Subscribe to DiamantAI Newsletter

Join over 50,000 readers getting clear AI tutorials every week. Subscribers also get early access and a 33% discount on my book.

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/DiamantAI newsletter

---

💡 Why Agent Memory Matters

### 💡 Quick Answer (for search engines and skimmers)
> Agent memory is the set of techniques that let an LLM-based agent (a system built around a Large Language Model) remember information across turns, sessions, and tasks. Without memory, an agent re-derives context every time and cannot personalize, learn, or maintain coherence over long interactions. This repository documents 30 distinct memory techniques, grouped into six families: short-term context management, long-term storage, cognitive architectures, retrieval and multi-agent patterns, batteries-included frameworks, and production deployment patterns.

Think about a friend who forgets every conversation you've ever had. Every morning you're strangers again. That's what most AI agents are like today.

Every AI agent eventually hits the same wall: it forgets.

In 2026, AI agents are everywhere. But most of them still forget what you told them yesterday. Without strong memory, an agent can't keep context across conversations. It can't learn from past chats. It can't build a lasting relationship with you.

The landscape is shifting fast:

But there's no single hands-on guide that teaches you how each technique works, when to use it, and how to build it yourself.

That's why this repository exists. 30 techniques. Runnable notebooks. Real code you can use today.

---

🗺️ Taxonomy of Agent Memory Techniques

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Agent memory taxonomy: 30 techniques across 6 families (short-term, long-term, cognitive architectures, retrieval, frameworks, production)

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 |

---

🧭 Which Technique Do I Need?

30 techniques grouped by what you are building. Pick the group that matches your goal, then open the technique inside it.

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Decision tree: which agent memory technique do I need?

Quick text version:

Still not sure? Start with 01 Conversation Buffer. Almost every other technique builds on it.

---

📐 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

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Short-term memory techniques for LLM agents: conversation buffers, sliding window, summary, token budget

🔄 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 | | 02 | Sliding Window Memory | Keep only the last few messages. You limit the size, but you keep the recent parts. | ✅ Notebook · Colab | | 03 | Summary Memory | Replace old turns with a short summary written by the model. You lose length but keep the meaning. | ✅ Notebook · Colab | | 04 | Summary Buffer Memory | Summarize older turns, but keep recent messages word for word. You get both. | ✅ Notebook · Colab | | 05 | Token Buffer Memory | Trim the history to fit a strict token budget. Drop the oldest messages first. | ✅ Notebook · Colab |

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Long-term memory techniques for LLM agents: vector store, entity, knowledge graph, episodic, semantic, procedural

💾 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 | | 07 | Entity Memory | Pull out and track facts about people, projects, and preferences. Update them as the conversation grows. | ✅ Notebook · Colab | | 08 | Knowledge Graph Memory | Build a graph of how entities connect. Walk the graph to reason over what the agent has learned. | ✅ Notebook · Colab | | 09 | Episodic Memory | Store complete interactions with when-and-where context. Good for "what happened when" questions. | ✅ Notebook · Colab | | 10 | Semantic Memory | Pull general facts out of interactions. Store them on their own, away from the raw episodes. | ✅ Notebook · Colab | | 11 | Procedural Memory | Capture "how-to" knowledge: the procedures and workflows the agent picks up over time. | ✅ Notebook · Colab |

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Cognitive architecture memory patterns: working memory, hierarchical layers, consolidation, compaction, self-reflection, routing, temporal, forgetting

🧩 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 | | 13 | Hierarchical Memory Layers | Tiered storage with hot, warm, and cold layers. Promote and demote items as they age. | ✅ Notebook · Colab | | 14 | Memory Consolidation | Merge, deduplicate, and strengthen memories. Inspired by how the brain consolidates during sleep. | ✅ Notebook · Colab | | 15 | Memory Compaction | Compress stored memories with summaries, entity extraction, or distillation. Save storage and tokens. | ✅ Notebook · Colab | | 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 | | 17 | Memory Routing | Pick the right memory store to read from or write to. Route by content type and intent. | ✅ Notebook · Colab | | 18 | Temporal Memory | Attach timestamps to memories. Retrieve with time awareness and weight recent items higher. | ✅ Notebook · Colab | | 19 | Forgetting & Decay | Forget on purpose. Use decay, access counts, or relevance to prune. | ✅ Notebook · Colab |

https://github.com/NirDiamant/Agent_Memory_Techniques/blob/HEAD/Memory retrieval and multi-agent patterns: retrieval patterns, cross-session memory, multi-agent shared memory, memory as tools

🔍 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 | | 21 | Cross-Session Memory | Save and reload agent state across sessions. The user picks up where they left off. | ✅ Notebook · Colab | | 22 | Multi-Agent Shared Memory | Shared stores, message passing, and agreement protocols for multi-agent teams. | ✅ Notebook

GitHub Stars & Activity

1,069Stars
0Forks
0Open issues
Jupyter NotebookLanguage

GitHub Popularity

GitHub stars1,069
Forks0
Open issues0
Primary languageJupyter Notebook
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

thedotmack / claude-mem

TypeScript★ 94,311⑂ 0
2

666ghj / MiroFish

Python★ 74,064⑂ 0
3

mem0ai / mem0

Python★ 65,695⑂ 0
4

bojieli / ai-agent-book

Python★ 48,844⑂ 0
5

pingcap / tidb

Go★ 40,554⑂ 0
6

volcengine / OpenViking

Python★ 38,148⑂ 0
7

topoteretes / cognee

Python★ 30,855⑂ 0
8

supermemoryai / supermemory

TypeScript★ 30,665⑂ 0

More AI Rankings