Agentmemory
#1 Persistent memory for AI coding agents based on real-world benchmarks
Last verified:
What is Agentmemory?
agentmemory is an open-source persistent memory layer designed specifically for AI coding agents. It automatically captures every coding session—including tool calls, prompts, and interactions—compresses them into searchable semantic memories, and retrieves relevant context in milliseconds for future sessions. The tool solves the core problem of AI agents forgetting project context when sessions end, eliminating the need to repeatedly re-explain architecture, conventions, and past decisions.
Key features include 12 auto-capture hooks that silently record every action without manual intervention, triple-stream retrieval combining BM25 + vector search + knowledge graph with on-device reranking (achieving 95.2% R@5 on LongMemEval-S benchmarks), and 53 MCP tools for full memory management. It runs as a single Node process with zero external databases—state lives locally as JSON/SQLite. The tool supports 5 LLM providers (Claude default, Anthropic API, Gemini, MiniMax, OpenRouter), offers 125 REST endpoints, includes a real-time viewer on port 3113, and provides peer-to-peer sync, Obsidian export, and JSONL session import for replay.
agentmemory is built for developers using AI coding agents like Claude Code, Cursor, Codex CLI, Gemini CLI, Cline, Windsurf, Roo Code, OpenCode, Continue, Zed, Warp, and any MCP-compatible agent. It's ideal for teams using multiple agents on the same project who want shared context, developers on long-running projects who tire of re-explaining architecture, and anyone wanting local-first memory that doesn't send code to cloud vendors. The tool is MIT/APACHE-2.0 licensed with 9,361+ GitHub stars and was #1 trending on GitHub as of May 2026.
Agentmemory pricing
Pricing model: Freemium
Free and open source (MIT/APACHE-2.0 licensed). Runs entirely on your machine with no cloud costs. Works with local all-MiniLM-L6-v2 embedding model requiring no API key. If you want stronger embeddings, you can optionally use OpenAI text-embedding-3-large at roughly $10/year at typical coding-agent usage, or any other compatible embedding provider. npm package is @agentmemory/agentmemory.
Agentmemory pros
- 95.2% retrieval R@5 on LongMemEval-S benchmark, beating mem0 (68.5%) and Letta (83.2%)
- 92% fewer input tokens per session compared to pasting full context
- 12 auto-capture hooks requiring zero manual effort—memory is the default
- Zero external database dependencies—runs as single Node process with local JSON/SQLite
- 53 MCP tools providing full memory management surface
- Triple-stream retrieval (BM25 + vector + knowledge graph) with on-device reranking
- Works across all major AI coding agents—Claude Code, Cursor, Codex CLI, Gemini CLI, Cline, Windsurf, and more
- Shared memory across multiple agents on the same project
- Local-first by default—nothing leaves your machine unless you configure external providers
- Real-time viewer on port 3113 showing live observations and knowledge graph visualization
- 125 REST endpoints—every MCP tool has a REST twin for flexibility
- Hourly auto-consolidation compresses raw observations into semantic memories, merges duplicates, decays stale rows
- JSONL session import allows backfilling past transcripts (e.g., Claude Code or Cursor history)
- Knowledge graph extraction with entity/relation linking and temporal edge support
- Peer-to-peer sync with authenticated HTTPS for mesh federation
- Obsidian export with frontmatter-tagged markdown for graph view visualization
- 5 LLM provider options with BYO model flexibility
- Open source (MIT/APACHE-2.0) with 1,312 passing tests
- P50 retrieval under 20ms on a laptop
Agentmemory cons
- Requires separate memory server process running—no daemon mode yet
- Dependency on iii-engine (young Rust runtime maintained by single author)
- No built-in team sync—memory is per-machine, requires manual export/import for sharing
- SQLite storage layer instead of pgvector or Qdrant you may already use
- Auto-capture captures everything including sensitive data like secrets if cat'd during session
- Local embedding model (all-MiniLM-L6-v2) is small—recall degrades vs larger models
- No per-memory deletion—can only delete all memories for an agent
- No auth by default—must add before exposing over network
- If memory server is down, agent silently falls back to no-memory mode without obvious indication
Frequently asked questions about Agentmemory
Is agentmemory free?
Yes. It is MIT-licensed, runs entirely on your machine, and works with the local all-MiniLM-L6-v2 embedding model so there is no API key required. If you want stronger embeddings, you can plug in OpenAI's text-embedding-3-large at roughly $10/year at typical usage or any other compatible embedding provider.
Does it work with Claude Code, Cursor, and Codex CLI at the same time?
Yes—that is a headline feature. All three (and anything else MCP-compatible) read and write the same memory store via the server on localhost:3111. Memory captured by Claude Code is retrievable from Cursor in the next session, and vice versa.
How is it different from CLAUDE.md or .cursorrules?
CLAUDE.md and .cursorrules are flat files you load wholesale into context, capping out around 200 lines, going stale, and not sharing across agents. agentmemory is a retrieval pipeline—it stores thousands of memories and injects only the ~5 most relevant ones per query, meaning you can have hundreds of accumulated facts without burning your context window.
Will it leak my code to a third party?
Not by default. The default install uses local SQLite for storage and local embeddings (all-MiniLM-L6-v2) for vectors. Nothing leaves your machine unless you explicitly configure an external embedding provider like OpenAI or Voyage. For NDA work, run with the defaults.
Can I run it on a server for a team?
You can—the server binds to localhost by default but the README documents how to expose it over a network. You would need to add auth since it ships without auth (fine for localhost-only) before exposing publicly. The team-shared memory use case is not first-class yet; the recommended pattern is exporting/importing JSON for now.
What happens if the memory server is down?
The MCP client falls back to no-memory mode and works like a regular agent without memory. Hook scripts fail gracefully—they log the error but do not block the agent. This is the right default but means you will silently lose new memory captures if you do not notice the server is down. Check localhost:3111/agentmemory/health periodically.
How big does the SQLite database get?
Benchmarks report roughly 50MB per 1,000 sessions with full transcripts captured. The four-tier consolidation pipeline keeps long-term growth sub-linear because raw observations get compressed into semantic memories and pruned. For most users, you will never notice the disk usage.
What are the 12 auto-capture hooks?
The hooks are: SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, Stop, SessionEnd, Notification, TaskCompleted, PostToolUseFailure, Subagent, and a filesystem-watcher hook. Every PreToolUse, PostToolUse, SessionStart, Stop, and the rest fire into the memory pipeline without a line of glue code. Install the plugin and you are done.
What is triple-stream retrieval?
Triple-stream retrieval runs three retrievers in parallel: BM25 for keyword and identifier matches, vector search over all-MiniLM-L6-v2 embeddings for semantic matches, and knowledge-graph traversal for entity-linked memories (files, functions, decisions). Results get fused with reciprocal rank fusion (RRF) and reranked on-device. This is what the 95.2% R@5 number measures.
Should I use agentmemory?
Yes if you use multiple AI coding agents on the same project and want shared context, have felt the pain of re-explaining architecture on long-running projects, want measured retrieval quality instead of trusting vector search, want local-first memory that does not ship code to cloud vendors, or are already running an MCP-capable agent. Probably no if you are a solo developer on a small short-lived project where CLAUDE.md fits in 200 lines, need team-shared memory syncing across machines without manual export/import, are allergic to adding a Rust runtime and new SQLite store, or are already deep on mem0 or Letta where migration cost outweighs retrieval gain.