{
  "markdown": "# A-MEM: Self-evolving memory for coding agents\n\n<p align=\"center\">\n  <a href=\"https://pypi.org/project/a-mem/\"><img src=\"https://img.shields.io/pypi/v/a-mem\" alt=\"PyPI version\"></a>\n  <a href=\"https://pypi.org/project/a-mem/\"><img src=\"https://img.shields.io/pypi/dm/a-mem\" alt=\"PyPI downloads\"></a>\n  <a href=\"https://registry.modelcontextprotocol.io/?q=io.github.DiaaAj%2Fa-mem-mcp\"><img src=\"https://img.shields.io/badge/MCP-Registry-blue\" alt=\"MCP Registry\"></a>\n</p>\n\n**mcp-name: io.github.DiaaAj/a-mem-mcp**\n\nA-MEM is a self-evolving memory system for coding agents. Unlike simple vector stores, A-MEM automatically organizes knowledge into a Zettelkasten-style graph with dynamic relationships. Memories don't just get stored—they evolve and connect over time.\n\nCurrently tested with **Claude Code**. Support for other MCP-compatible agents is planned.\n\n<img src=\"/Figure/demo.gif\">\n\n## Quick Start\n\n### Install\n\n```bash\npip install a-mem\n```\n\n### Add to Claude Code\n\n```bash\nclaude mcp add a-mem -s user -- a-mem-mcp \\\n  -e LLM_BACKEND=openai \\\n  -e LLM_MODEL=gpt-4o-mini \\\n  -e OPENAI_API_KEY=sk-...\n```\n\nThat's it! A session-start hook installs automatically to remind Claude to use memory.\n\n> **Note:** Memory is stored per-project in `./chroma_db`. For global memory across all projects, see [Memory Scope](#memory-scope).\n\n### Uninstall\n\n```bash\na-mem-uninstall-hook   # Remove hooks first\npip uninstall a-mem\n```\n\n## How It Works\n\n```\nt=0              t=1                t=2\n\n                 ◉───◉             ◉───◉\n ◉               │                 ╱ │ ╲\n                 ◉                ◉──┼──◉\n                                     │\n                                     ◉\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━▶\n            self-evolving memory\n```\n\n1. **Add a memory** → A-MEM extracts keywords, context, and tags via LLM\n2. **Find neighbors** → Searches for semantically similar existing memories\n3. **Evolve** → Decides whether to link, strengthen connections, or update related memories\n4. **Store** → Persists to ChromaDB with full metadata and relationships\n\nThe result: a knowledge graph that grows smarter over time, not just bigger.\n\n## Features\n\n**Self-Evolving Memory**\nMemories aren't static. When you add new knowledge, A-MEM automatically finds related memories and strengthens connections, updates context, and evolves tags.\n\n**Semantic + Structural Search**\nCombines vector similarity with graph traversal. Find memories by meaning, then explore their connections.\n\n**Peek and Drill**\nStart with breadth-first search to capture relevant memories via lightweight metadata (id, context, keywords, tags). Then drill depth-first into specific memories with `read_memory_note` for full content. This minimizes token usage while maximizing recall.\n\n## MCP Tools\n\nA-MEM exposes 8 tools to your coding agent:\n\n| Tool | Description |\n|------|-------------|\n| `add_memory_note` | Store new knowledge (async, returns immediately) |\n| `search_memories` | Semantic search across all memories |\n| `search_memories_agentic` | Search + follow graph connections |\n| `search_memories_by_time` | Search within a time range |\n| `read_memory_note` | Get full details (supports bulk reads) |\n| `update_memory_note` | Modify existing memory |\n| `delete_memory_note` | Remove a memory |\n| `check_task_status` | Check async task completion |\n\n### Example Usage\n\n```python\n# The agent calls these automatically, but here's what happens:\n\n# Store a memory (returns task_id immediately)\nadd_memory_note(content=\"Auth uses JWT in httpOnly cookies, validated by AuthMiddleware\")\n\n# Search later\nsearch_memories(query=\"authentication flow\", k=5)\n\n# Deep search with connections\nsearch_memories_agentic(query=\"security\", k=5)\n```\n\n## Advanced Configuration\n\n### JSON Config\n\nFor more control, edit `~/.claude/settings.json` (global) or `.claude/settings.local.json` (project):\n\n```json\n{\n  \"mcpServers\": {\n    \"a-mem\": {\n      \"command\": \"a-mem-mcp\",\n      \"env\": {\n        \"LLM_BACKEND\": \"openai\",\n        \"LLM_MODEL\": \"gpt-4o-mini\",\n        \"OPENAI_API_KEY\": \"sk-...\"\n      }\n    }\n  }\n}\n```\n\n### Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `LLM_BACKEND` | `openai`, `ollama`, `sglang`, `openrouter` | `openai` |\n| `LLM_MODEL` | Model name | `gpt-4o-mini` |\n| `OPENAI_API_KEY` | OpenAI API key | — |\n| `EMBEDDING_MODEL` | Sentence transformer model | `all-MiniLM-L6-v2` |\n| `CHROMA_DB_PATH` | Storage directory | `./chroma_db` |\n| `EVO_THRESHOLD` | Evolution trigger threshold | `100` |\n\n### Memory Scope\n\n- **Project-specific** (default): Each project gets isolated memory in `./chroma_db`\n- **Global**: Share across projects by setting `CHROMA_DB_PATH=~/.local/share/a-mem/chroma_db`\n\n### Alternative Backends\n\n**Ollama (local, free)**\n```bash\nclaude mcp add a-mem -s user -- a-mem-mcp \\\n  -e LLM_BACKEND=ollama \\\n  -e LLM_MODEL=llama2\n```\n\n**OpenRouter (100+ models)**\n```bash\nclaude mcp add a-mem -s user -- a-mem-mcp \\\n  -e LLM_BACKEND=openrouter \\\n  -e LLM_MODEL=anthropic/claude-3.5-sonnet \\\n  -e OPENROUTER_API_KEY=sk-or-...\n```\n\n### Hook Management (Claude Code)\n\nThe session-start hook reminds Claude to use memory tools. It installs automatically with Claude Code, but you can manage it manually:\n\n```bash\na-mem-install-hook     # Install/reinstall hook\na-mem-uninstall-hook   # Remove hook completely\n```\n\n## Python API\n\nUse A-MEM directly in Python (works with any agent or application):\n\n```python\nfrom agentic_memory.memory_system import AgenticMemorySystem\n\nmemory = AgenticMemorySystem(\n    llm_backend=\"openai\",\n    llm_model=\"gpt-4o-mini\"\n)\n\n# Add (auto-generates keywords, tags, context)\nmemory_id = memory.add_note(\"FastAPI app uses dependency injection for DB sessions\")\n\n# Search\nresults = memory.search(\"database patterns\", k=5)\n\n# Read full details\nnote = memory.read(memory_id)\nprint(note.keywords, note.tags, note.links)\n```\n\n## Research\n\nA-MEM implements concepts from the paper:\n\n> **A-MEM: Agentic Memory for LLM Agents**\n> Xu et al., 2025\n> [arXiv:2502.12110](https://arxiv.org/pdf/2502.12110)\n",
  "bytes": 6090,
  "sha": "760ec58b518b96b5087e2f836a06d01f7102d3da99e5085c6ec140866a546c3e",
  "repo_slug": "diaaaj/a-mem-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_diaaaj_a_mem_mcp_8a5c40cd/readme"
}