WujiangXu/A-mem
Linked-note memory for retrieving and updating an LLM agent’s conversation history
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
A-Mem is a Python research memory layer for LLM agents. When new content arrives, it generates a structured note with contextual descriptions and tags, looks for related historical memories, and links them by similarity. Existing notes can also be refined, so the memory state is not simply an append-only collection of conversation chunks.
The tree separates the memory layer (memory_layer.py, memory_layer_robust.py), LLM text parsing (llm_text_parsers.py), and dataset loading (load_dataset.py) from the evaluation entrypoints. The manifest includes Sentence Transformers, PyTorch, scikit-learn, and rank-bm25, but those dependencies alone do not establish how retrieval scores are combined. The visible integration boundary is Python code plus model-backend selection, not a standalone database service or a verified plugin protocol.
Key Capabilities & Differentiators
The original evaluator, test_advanced.py, requires OpenAI JSON schema support. test_advanced_robust.py removes that requirement and provides three backend choices: OpenAI, vLLM, and Ollama. The concrete examples use gpt-4o-mini, Qwen/Qwen2.5-3B-Instruct behind vLLM, and qwen2.5:3b through Ollama, with results written to a specified JSON file.
The LoCoMo run covers multi-hop, temporal, open-domain, single-hop, and adversarial QA. --ratio selects a dataset fraction, while --retrieve_k controls how many memories are retrieved per query and defaults to 10. run_k_sweep.sh reuses memories cached after the first pass and reruns QA, making retrieval depth tunable without rebuilding notes for each setting. That sweep does not measure memory construction cost, and no numerical result table is available for quantifying gains.
Trade-offs & Limitations
Compared with append-only vector memory, A-Mem tests a different design choice: give retrieved items structured context and links, and let later evidence change earlier notes. That may help recover relationships that isolated chunks miss, but it adds generation and update work on ingestion. It also makes the memory state sensitive to model output and ingestion order, so comparisons should hold both constant.
The repository is a fit for evaluating memory policy, not a drop-in replacement for a vector database or managed memory service. The supplied interface does not establish durability guarantees, concurrent writes, tenant isolation, or a versioned service API. Choose simpler vector retrieval for a low-complexity baseline, and evaluate A-mem-sys if the goal is to build an agent around this design. MIT permits commercial reuse of the code subject to its notice requirements; models and datasets need separate review.
Hardware & Deployment Guide
Set up a Python virtual environment or use the Conda example with Python 3.9, then install requirements.txt. For a first run, invoke test_advanced_robust.py with --dataset data/locomo10.json, the chosen --backend and --model, and a JSON --output path. OpenAI requires API access. For self-hosted generation, start the model service separately: the vLLM example uses an OpenAI-compatible server on port 30000, selected by --sglang_port 30000, with float16 and a configured maximum model length of 8192. Ollama requires the selected model to be available locally.
No container recipe, fixed hardware envelope, or tagged release is provided. Local serving capacity depends on the chosen model, context length, and concurrency; hosted generation does not eliminate local embedding and evaluation work. For reproducible runs, record installed package versions, model identifiers, retrieval depth, and cache state: the dependency list is unpinned, and cached runs do not exercise the same path as cold runs.
memory_layer.py and memory_layer_robust.py with separate original and robust evaluation scripts.openai, vllm, and ollama.--retrieve_k defaults to 10, and run_k_sweep.sh reuses cached memories to rerun QA at different retrieval depths.data/locomo10.json covers multi-hop, temporal, open-domain, single-hop, and adversarial QA.Reproducing A-Mem on LoCoMo and testing how linked, revisable notes affect historical QA across model backends and retrieval depths.
You need a production multi-tenant memory API, a durable vector database, or a turnkey offline deployment.
Quick Start & Installation
# Create and activate virtual environment python -m venv a-mem source a-mem/bin/activate # Linux/Mac a-mem\Scripts\activate # Windows # Install dependencies pip install -r requirements.txt
Comparison vs. Top RAG, Data & Memory Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| A-mem ★ | 1k | +2 | Python | MIT | Linked-note memory for retrieving and updating an LLM agent’s conversation histo |
| markitdown | 199.7k | +909 | Python | MIT | Python library and CLI that turn mixed-format documents into Markdown for RAG in |
| Scrapling | 107.9k | +1.8k | Python | BSD-3-Clause | Python HTTP and browser crawlers that turn websites into RAG-ready Markdown |
| mem0 | 70k | +498 | Python | Apache-2.0 | A vector-backed memory layer for AI agents that need to recall past conversation |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/WujiangXu/A-mem.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about A-mem
Where should I start if I want to integrate A-Mem into an agent?
How much RAM or GPU VRAM should I budget?
Can I use this commercially and keep the workload self-hosted?
When is A-Mem preferable to a vector store or append-only memory?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy