About this project
agentmemory is a self-hosted persistent memory engine designed for AI coding agents. It solves the problem of agents losing context between sessions by silently capturing what an agent does, compressing it into searchable memory, and injecting relevant context when the next session starts. The project is built on the iii engine (pinned at v0.11.2) and requires Node.js 20 or newer.
Installation is a single command: `npx -y @agentmemory/agentmemory@latest`. The first run is interactive, letting you pick which agents to wire (Claude Code, Cursor, Codex, Gemini CLI, OpenCode, and more), choose an LLM provider or stay keyless, and optionally install globally. A demo command seeds sample sessions and exercises recall to verify the setup.
The system works with any agent that supports hooks, MCP, or REST API. It ships native plugins and hooks for Claude Code (12 hooks), Codex CLI (6 hooks), OpenCode (22 hooks), Devin (6 hooks), and others, plus MCP server support for GitHub Copilot CLI, Cursor, Gemini CLI, Cline, Goose, Kilo Code, Claude Desktop, Roo Code, and more. A single memory server is shared across all connected agents, so memories persist regardless of which agent you switch to.
Search uses a hybrid approach combining BM25 keyword search, vector embeddings, and structural graph matching, fused via Reciprocal Rank Fusion (RRF). In keyless mode (no API key), vector embeddings are disabled and BM25 handles retrieval. For free on-device semantic recall, setting `EMBEDDING_PROVIDER=local` downloads the Xenova/all-MiniLM-L6-v2 model locally after the first request. The project reports 95.2% R@5 on LongMemEval-S (500 questions) and 100% top-5 hit rate on its in-house coding-agent-life-v1 corpus.
Memory lifecycle includes four-tier consolidation, decay, and auto-forget, so stale information is pruned automatically. The system provides 54 MCP tools and 12 auto hooks for zero-manual-effort capture. A real-time viewer runs on port 3113 for inspecting stored memories. The runtime uses four ports: 3111 for REST/MCP HTTP, 3112 for iii streams, 3113 for the viewer, and 49134 for the iii worker WebSocket. Persistent state lives in platform-specific directories (macOS: ~/Library/Application Support/agentmemory, Linux: $XDG_DATA_HOME/agentmemory, Windows: %APPDATA%\agentmemory) and can be overridden with --data-dir or AGENTMEMORY_DATA_DIR.
The project emphasizes token efficiency, claiming roughly 170K tokens per year versus 19.5M+ for pasting full context, with costs around $10/year or $0 with local embeddings. It requires no external databases beyond SQLite and the bundled iii-engine. The project includes a reproducible evaluation harness for LongMemEval-S and its in-house corpus, with published scorecards in the docs/benchmarks directory. It also pairs with codegraph, Understand Anything, and Graphify for broader context-layer capabilities.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.