agentmemory: Persistent Memory for AI Coding Agents

Summary
agentmemory provides persistent memory for AI coding agents, ensuring they remember past interactions and project context across sessions. This eliminates the need for re-explaining, significantly boosting agent efficiency and reducing token costs. Built on the `iii engine`, it offers high retrieval accuracy and multi-agent support without external databases.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
agentmemory is a groundbreaking open-source repository that provides persistent memory for AI coding agents. It addresses the common problem of agents forgetting context between sessions, which often leads to repetitive explanations and wasted time. By silently capturing agent actions, compressing them into searchable memory, and injecting relevant context, agentmemory ensures your coding agent remembers everything, from architectural decisions to specific code patterns.
Built on the iii engine, agentmemory offers impressive retrieval accuracy (95.2% R@5), significant token savings (up to 92% fewer tokens), and supports a wide array of agents through MCP or REST API. It operates without external databases, relying on SQLite and the iii engine for its robust memory management.
Installation
To get started with agentmemory, you can install it globally via npm or use npx for a quick run. First, ensure you have Node.js (>= 20) and iii-engine or Docker installed.
npm install -g @agentmemory/agentmemory
agentmemory # start the memory server on :3111
agentmemory demo # seed sample sessions + prove recall
Alternatively, for a quick start without global installation:
npx @agentmemory/agentmemory
For detailed agent-specific wiring and configuration, please refer to the official documentation.
Examples
To see agentmemory in action, run the demo command:
npx @agentmemory/agentmemory demo
This command seeds three realistic sessions (e.g., JWT auth, N+1 query fix, rate limiting) and performs semantic searches against them. You'll see it find "N+1 query fix" when you search "database performance optimization", a capability beyond simple keyword matching. You can also open the real-time viewer at http://localhost:3113 to watch memory build live and replay sessions. agentmemory supports integration with various agents like Claude Code, Cursor, and Codex CLI, allowing them to leverage its persistent memory capabilities.
Why Use agentmemory
AI coding agents often forget context between sessions, leading to repetitive explanations and wasted time. agentmemory solves this by providing a robust, searchable memory system that silently captures and compresses agent interactions. Unlike built-in agent memory solutions, which often have limited capacity (e.g., 200-line caps) and basic search, agentmemory offers unlimited scale, advanced hybrid search (BM25, vector, and knowledge graph), and significant token savings (up to 92% fewer tokens).
It supports multi-agent coordination, ensuring that all your agents share a common, evolving understanding of your projects. Real-world benchmarks show 95.2% retrieval accuracy and a cost of approximately $10/year for token usage, making it a highly efficient and effective solution for enhancing your AI coding workflow. With agentmemory, your agent just knows, eliminating the need for constant re-explaining.
Links
For more information, examples, and detailed usage instructions, visit the official resources: