# A-MEM

> Agentic memory that lets LLM agents organize and link their notes Zettelkasten-style

- Category: Agents & Automation / Agent Memory
- Language: Python
- Licence: MIT
- Repository: https://github.com/agiresearch/A-mem
- Canonical page: https://ai-tldr.dev/tools/a-mem/

## In short

A-MEM (Agentic Memory) is a research memory system for LLM agents that stores each piece of information as a structured note and links related notes into an evolving network, inspired by the Zettelkasten method. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in Python and licensed MIT.

## Overview

A-MEM (Agentic Memory) is a research memory system for LLM agents that stores each piece of information as a structured note and links related notes into an evolving network, inspired by the Zettelkasten method. Instead of plain storage and retrieval, it generates tags, context, and keywords for new memories and connects them to existing ones.

It is aimed at developers and researchers building agents that need to reuse past experiences rather than start fresh on every task. It fits the memory-frameworks category by sitting between your agent and a vector store, handling organization, linking, and evolution on top of basic save and search.

A-MEM uses ChromaDB for vector storage and semantic search, and supports OpenAI or local Ollama models as the LLM backend. Note that this repository is meant for building agents; the authors point to a separate repo to reproduce the paper's published results.

## What it does

- Dynamic memory organization based on Zettelkasten principles, building an interconnected note network
- Semantic indexing, linking, and similarity search backed by ChromaDB vector storage
- Automatic note generation with structured attributes: tags, context, and extracted keywords
- Continuous memory evolution that updates metadata and creates links when memories are added or changed
- Pluggable LLM backends, supporting OpenAI (GPT-4, GPT-3.5) and Ollama for local deployment
- Standard CRUD operations: add, read, search, update, and delete notes by ID

## Getting started

A-MEM is installed from source. Clone the repo, install the package into a virtual environment, then initialize the memory system in Python.

1. Clone the repository

   Get the source from GitHub and move into the project directory.

```bash
git clone https://github.com/agiresearch/A-mem.git
cd A-mem
```

2. Create a virtual environment and install

   A virtual environment is recommended. Install the package with pip (use -e for editable/development mode).

```bash
python -m venv .venv
source .venv/bin/activate  # On Windows, use: .venv\Scripts\activate
pip install .
```

3. Initialize the memory system and add a note

   Create an AgenticMemorySystem with an embedding model and an LLM backend, then add and search memories.

```python
from agentic_memory.memory_system import AgenticMemorySystem

memory_system = AgenticMemorySystem(
    model_name='all-MiniLM-L6-v2',  # Embedding model for ChromaDB
    llm_backend="openai",           # LLM backend (openai/ollama)
    llm_model="gpt-4o-mini"         # LLM model name
)

memory_id = memory_system.add_note("Deep learning neural networks")
results = memory_system.search_agentic("neural networks", k=5)
for result in results:
    print(result['id'], result['content'])
```

## When to use it

- Give an LLM agent long-term memory so it can reuse past tasks and conversations instead of starting fresh each time
- Build a self-organizing knowledge base where related notes are automatically tagged and linked
- Run agent memory locally with Ollama models and ChromaDB when you want to avoid sending data to a hosted API
- Experiment with or extend the A-MEM research framework for studies on memory organization in LLM agents
