rohitg00 writes agentmemory, a persistent memory solution for AI coding agents designed to eliminate the need for repetitive context re-explanation between sessions. By silently capturing tool usage and session details through various hooks (including native plugins for Claude Code, Cursor, and Codex), it compresses observations into searchable structured memories that are injected back into subsequent conversations. The system utilizes a hybrid retrieval approach combining BM25 keyword matching, vector embeddings, and knowledge graph traversal to ensure high-quality context injection with significant token savings compared to standard long-context prompting.
- Supports multiple agents including Claude Code, Cursor, GitHub Copilot CLI, Devin, Gemini CLI, OpenCode, Hermes, and more via MCP or native plugins.
- Employs a 4-tier memory consolidation model: Working (raw observations), Episodic (session summaries), Semantic (extracted facts), and Procedural (workflow patterns).
- Offers high retrieval accuracy; real-world benchmarks show up to 95.2% R@5 on the LongMemEval-S dataset.
- Reduces LLM token costs significantly, claiming ~170K tokens per year compared to millions when pasting full context.
- Includes a real-time visualizer (on port 3113) and an observability console for monitoring memory writes, traces, and graph structures.
This tutorial details how to implement persistent memory in Claude Desktop using a local knowledge graph. It covers installation of dependencies (Node.js and Claude Desktop), configuration of `mcp.json` and Claude settings, and how to leverage the Knowledge Graph Memory Server for personalized and consistent responses.