{
  "type": "comparison",
  "id": "research-memory-libraries",
  "title": "Research memory libraries compared: A-MEM vs MemoryOS vs MemOS vs LightRAG",
  "summary": "Four open-source memory systems that started as research papers. What each one stores, how many LLM calls a write costs, whether memories survive a restart, and how close each is to something you can run in an agent today.",
  "author": "Agentica Author",
  "tags": [
    "memory",
    "research",
    "rag",
    "knowledge-graph",
    "python",
    "self-hosted"
  ],
  "published": "2026-10-30",
  "last_verified": "2026-10-30",
  "entries": [
    "a-mem",
    "memoryos",
    "memos",
    "lightrag",
    "mem0",
    "zep",
    "letta",
    "chroma",
    "qdrant",
    "openclaw",
    "hermes-agent",
    "omnimemeval"
  ],
  "links": {
    "html": "https://indexagentica.com/compare/research-memory-libraries/",
    "markdown": "https://indexagentica.com/compare/research-memory-libraries.md",
    "json": "https://indexagentica.com/api/longform/compare/research-memory-libraries.json",
    "source": "https://github.com/Drudley/indexagentica/blob/main/content-long/compare/research-memory-libraries.md"
  },
  "status": "published",
  "comparison": {
    "subjects": [
      {
        "id": "a-mem",
        "name": "A-MEM (Agentic Memory)",
        "summary": "Research memory library for LLM agents that writes Zettelkasten-style linked notes and evolves them, backed by ChromaDB.",
        "url": "https://indexagentica.com/entries/a-mem/",
        "json": "https://indexagentica.com/api/entries/a-mem.json"
      },
      {
        "id": "memoryos",
        "name": "MemoryOS",
        "summary": "Hierarchical short/mid/long-term memory system for personalized agents, as a PyPI package and an MCP server.",
        "url": "https://indexagentica.com/entries/memoryos/",
        "json": "https://indexagentica.com/api/entries/memoryos.json"
      },
      {
        "id": "memos",
        "name": "MemOS",
        "summary": "Open-source memory operating system for LLMs and agents with a unified API for adding, retrieving, editing and deleting graph-structured, multi-modal memory.",
        "url": "https://indexagentica.com/entries/memos/",
        "json": "https://indexagentica.com/api/entries/memos.json"
      },
      {
        "id": "lightrag",
        "name": "LightRAG",
        "summary": "Graph-plus-vector RAG framework from HKU with a server, web UI and Ollama-compatible API; pluggable storage backends.",
        "url": "https://indexagentica.com/entries/lightrag/",
        "json": "https://indexagentica.com/api/entries/lightrag.json"
      }
    ],
    "criteria": [
      "What it stores",
      "Install",
      "Persistence",
      "LLM cost of a write",
      "Agent access",
      "Maturity",
      "License"
    ],
    "rows": {
      "a-mem": {
        "What it stores": "Zettelkasten-style notes with keywords, tags, context and links; adding a note can rewrite its neighbours' tags and context (memory evolution)",
        "Install": "From source only (git clone, pip install .). The PyPI name agentic-memory belongs to an unrelated project",
        "Persistence": "None in the main class: AgenticMemorySystem keeps notes in a Python dict and an in-memory Chroma client that it resets on start. A PersistentChromaRetriever exists but is not wired in",
        "LLM cost of a write": "One LLM call per add_note once there are neighbours (the evolution decision); none for the first note",
        "Agent access": "Python API only (add_note, search_agentic, update, delete)",
        "Maturity": "Library companion to a NeurIPS 2025 paper; last commit Dec 2025, no releases",
        "License": "MIT"
      },
      "memoryos": {
        "What it stores": "Per-user short-term QA pairs, mid-term topic sessions scored by heat, and a long-term user profile plus user and assistant knowledge",
        "Install": "pip install memoryos-pro (0.1.0, Jul 2025) pins numpy 1.24 and faiss-gpu; it failed to build on Python 3.13 and installed on 3.10. The GitHub code is newer than the PyPI package",
        "Persistence": "JSON files per user under data_storage_path; a new instance reloaded them. A ChromaDB variant is in the repo",
        "LLM cost of a write": "None until short-term is full, then five or six calls per add (continuity, summaries, keywords) in our stub run; profile and knowledge updates fire when a session's heat passes the threshold",
        "Agent access": "Python API, and MemoryOS-MCP with add_memory, retrieve_memory and get_user_profile tools; any OpenAI-compatible LLM endpoint",
        "Maturity": "EMNLP 2025 paper; last commit Jul 2026; PyPI package not updated since Jul 2025",
        "License": "Apache-2.0 (the PyPI metadata says MIT and still has template project links)"
      },
      "memos": {
        "What it stores": "MemCubes: plaintext memory plus, in the paper, activation (KV cache) and parameter-level memory, with provenance and versions",
        "Install": "Hosted Cloud API (key), self-host with docker compose (MemOS API, Neo4j, Qdrant), or npm local plugins for OpenClaw, Hermes Agent and DeepSeek Harness. PyPI package is named MemoryOS (2.0.33)",
        "Persistence": "Neo4j plus Qdrant when self-hosted; SQLite in the local plugins; MemOS Cloud when hosted",
        "LLM cost of a write": "Not measured here; the server uses a configured LLM and embedder for extraction",
        "Agent access": "REST API (add/message, search/memory), and plugins that recall before and save after each agent turn",
        "Maturity": "Most active of the four: release v2.0.34 on 2026-09-23, commits this week, a company (MemTensor) behind it",
        "License": "Apache-2.0"
      },
      "lightrag": {
        "What it stores": "Documents split into chunks, plus an entity-relation knowledge graph extracted from them, each with vector indexes",
        "Install": "pip install lightrag-hku (1.5.7, Python 3.10+); add the [api] extra for lightrag-server and web UI; Docker Compose and a setup wizard",
        "Persistence": "Local JSON, NanoVectorDB and NetworkX files by default (in RAM, for testing only); PostgreSQL, MongoDB or OpenSearch for production, or Milvus, Qdrant, Neo4j, Memgraph per store",
        "LLM cost of a write": "Two calls per chunk by default (extraction plus one gleaning pass); deletion rebuilds from cache",
        "Agent access": "Python API, REST server with an Ollama-compatible API, and a web UI; no official MCP server",
        "Maturity": "Large and active: about 40k stars, releases every few weeks through 2026 (latest v1.5.7, 2026-09-02), commits this week",
        "License": "MIT"
      }
    },
    "table": [
      {
        "entry": "a-mem",
        "name": "A-MEM (Agentic Memory)",
        "url": "https://indexagentica.com/entries/a-mem/",
        "values": {
          "What it stores": "Zettelkasten-style notes with keywords, tags, context and links; adding a note can rewrite its neighbours' tags and context (memory evolution)",
          "Install": "From source only (git clone, pip install .). The PyPI name agentic-memory belongs to an unrelated project",
          "Persistence": "None in the main class: AgenticMemorySystem keeps notes in a Python dict and an in-memory Chroma client that it resets on start. A PersistentChromaRetriever exists but is not wired in",
          "LLM cost of a write": "One LLM call per add_note once there are neighbours (the evolution decision); none for the first note",
          "Agent access": "Python API only (add_note, search_agentic, update, delete)",
          "Maturity": "Library companion to a NeurIPS 2025 paper; last commit Dec 2025, no releases",
          "License": "MIT"
        }
      },
      {
        "entry": "memoryos",
        "name": "MemoryOS",
        "url": "https://indexagentica.com/entries/memoryos/",
        "values": {
          "What it stores": "Per-user short-term QA pairs, mid-term topic sessions scored by heat, and a long-term user profile plus user and assistant knowledge",
          "Install": "pip install memoryos-pro (0.1.0, Jul 2025) pins numpy 1.24 and faiss-gpu; it failed to build on Python 3.13 and installed on 3.10. The GitHub code is newer than the PyPI package",
          "Persistence": "JSON files per user under data_storage_path; a new instance reloaded them. A ChromaDB variant is in the repo",
          "LLM cost of a write": "None until short-term is full, then five or six calls per add (continuity, summaries, keywords) in our stub run; profile and knowledge updates fire when a session's heat passes the threshold",
          "Agent access": "Python API, and MemoryOS-MCP with add_memory, retrieve_memory and get_user_profile tools; any OpenAI-compatible LLM endpoint",
          "Maturity": "EMNLP 2025 paper; last commit Jul 2026; PyPI package not updated since Jul 2025",
          "License": "Apache-2.0 (the PyPI metadata says MIT and still has template project links)"
        }
      },
      {
        "entry": "memos",
        "name": "MemOS",
        "url": "https://indexagentica.com/entries/memos/",
        "values": {
          "What it stores": "MemCubes: plaintext memory plus, in the paper, activation (KV cache) and parameter-level memory, with provenance and versions",
          "Install": "Hosted Cloud API (key), self-host with docker compose (MemOS API, Neo4j, Qdrant), or npm local plugins for OpenClaw, Hermes Agent and DeepSeek Harness. PyPI package is named MemoryOS (2.0.33)",
          "Persistence": "Neo4j plus Qdrant when self-hosted; SQLite in the local plugins; MemOS Cloud when hosted",
          "LLM cost of a write": "Not measured here; the server uses a configured LLM and embedder for extraction",
          "Agent access": "REST API (add/message, search/memory), and plugins that recall before and save after each agent turn",
          "Maturity": "Most active of the four: release v2.0.34 on 2026-09-23, commits this week, a company (MemTensor) behind it",
          "License": "Apache-2.0"
        }
      },
      {
        "entry": "lightrag",
        "name": "LightRAG",
        "url": "https://indexagentica.com/entries/lightrag/",
        "values": {
          "What it stores": "Documents split into chunks, plus an entity-relation knowledge graph extracted from them, each with vector indexes",
          "Install": "pip install lightrag-hku (1.5.7, Python 3.10+); add the [api] extra for lightrag-server and web UI; Docker Compose and a setup wizard",
          "Persistence": "Local JSON, NanoVectorDB and NetworkX files by default (in RAM, for testing only); PostgreSQL, MongoDB or OpenSearch for production, or Milvus, Qdrant, Neo4j, Memgraph per store",
          "LLM cost of a write": "Two calls per chunk by default (extraction plus one gleaning pass); deletion rebuilds from cache",
          "Agent access": "Python API, REST server with an Ollama-compatible API, and a web UI; no official MCP server",
          "Maturity": "Large and active: about 40k stars, releases every few weeks through 2026 (latest v1.5.7, 2026-09-02), commits this week",
          "License": "MIT"
        }
      }
    ],
    "verdict": "None of these is a drop-in Mem0 or Zep. Building a chat assistant that should learn a user's preferences over months? MemoryOS has the clearest model for it and an MCP server, but plan to install from GitHub on Python 3.10. Want the most production-ready option with a hosted fallback, or memory for OpenClaw or Hermes Agent? MemOS. Your agent's memory is really a growing pile of documents and you need questions that span them? LightRAG, with PostgreSQL behind it. A-MEM is worth reading and borrowing ideas from, but its main class keeps nothing after exit, so treat it as research code."
  },
  "entries_detail": [
    {
      "id": "a-mem",
      "name": "A-MEM (Agentic Memory)",
      "summary": "Research memory library for LLM agents that writes Zettelkasten-style linked notes and evolves them, backed by ChromaDB.",
      "url": "https://indexagentica.com/entries/a-mem/",
      "json": "https://indexagentica.com/api/entries/a-mem.json"
    },
    {
      "id": "memoryos",
      "name": "MemoryOS",
      "summary": "Hierarchical short/mid/long-term memory system for personalized agents, as a PyPI package and an MCP server.",
      "url": "https://indexagentica.com/entries/memoryos/",
      "json": "https://indexagentica.com/api/entries/memoryos.json"
    },
    {
      "id": "memos",
      "name": "MemOS",
      "summary": "Open-source memory operating system for LLMs and agents with a unified API for adding, retrieving, editing and deleting graph-structured, multi-modal memory.",
      "url": "https://indexagentica.com/entries/memos/",
      "json": "https://indexagentica.com/api/entries/memos.json"
    },
    {
      "id": "lightrag",
      "name": "LightRAG",
      "summary": "Graph-plus-vector RAG framework from HKU with a server, web UI and Ollama-compatible API; pluggable storage backends.",
      "url": "https://indexagentica.com/entries/lightrag/",
      "json": "https://indexagentica.com/api/entries/lightrag.json"
    },
    {
      "id": "mem0",
      "name": "Mem0",
      "summary": "Memory layer for AI agents and apps: drop-in persistent memory that lets agents learn from past interactions.",
      "url": "https://indexagentica.com/entries/mem0/",
      "json": "https://indexagentica.com/api/entries/mem0.json"
    },
    {
      "id": "zep",
      "name": "Zep",
      "summary": "Unified context layer that combines business data, documents and conversations into governed context and memory for agents.",
      "url": "https://indexagentica.com/entries/zep/",
      "json": "https://indexagentica.com/api/entries/zep.json"
    },
    {
      "id": "letta",
      "name": "Letta",
      "summary": "Platform for stateful agents with memory, identity and the ability to learn over time (formerly MemGPT); terminal UI, App Server, desktop app and Agent SDK.",
      "url": "https://indexagentica.com/entries/letta/",
      "json": "https://indexagentica.com/api/entries/letta.json"
    },
    {
      "id": "chroma",
      "name": "Chroma",
      "summary": "Open-source search and data infrastructure for AI (vector database).",
      "url": "https://indexagentica.com/entries/chroma/",
      "json": "https://indexagentica.com/api/entries/chroma.json"
    },
    {
      "id": "qdrant",
      "name": "Qdrant",
      "summary": "Open-source vector search engine and database written in Rust, self-hosted or as Qdrant Cloud.",
      "url": "https://indexagentica.com/entries/qdrant/",
      "json": "https://indexagentica.com/api/entries/qdrant.json"
    },
    {
      "id": "openclaw",
      "name": "OpenClaw",
      "summary": "Open-source personal AI assistant that runs on your own machine behind one Gateway and talks to you over WhatsApp, Telegram, Slack, Discord, iMessage and 20+ other channels.",
      "url": "https://indexagentica.com/entries/openclaw/",
      "json": "https://indexagentica.com/api/entries/openclaw.json"
    },
    {
      "id": "hermes-agent",
      "name": "Hermes Agent",
      "summary": "Nous Research's self-improving open-source agent: terminal UI plus messaging gateway, agent-curated memory and skills it writes and refines from experience.",
      "url": "https://indexagentica.com/entries/hermes-agent/",
      "json": "https://indexagentica.com/api/entries/hermes-agent.json"
    },
    {
      "id": "omnimemeval",
      "name": "OmniMemEval",
      "summary": "MemTensor's evaluation framework for memory backends (LoCoMo, LongMemEval, BEAM, PersonaMem v2, HaluMem) and memory-equipped agents on AgentBench domains.",
      "url": "https://indexagentica.com/entries/omnimemeval/",
      "json": "https://indexagentica.com/api/entries/omnimemeval.json"
    }
  ],
  "related": [
    {
      "type": "comparison",
      "id": "agent-memory-layers",
      "title": "Memory layers for AI agents",
      "url": "https://indexagentica.com/compare/agent-memory-layers/",
      "json": "https://indexagentica.com/api/longform/compare/agent-memory-layers.json"
    },
    {
      "type": "guide",
      "id": "give-an-agent-long-term-memory",
      "title": "Give an agent long-term memory",
      "url": "https://indexagentica.com/guides/give-an-agent-long-term-memory/",
      "json": "https://indexagentica.com/api/longform/guides/give-an-agent-long-term-memory.json"
    },
    {
      "type": "comparison",
      "id": "coding-agent-memory-servers",
      "title": "Memory servers for coding agents compared: m3 Memory vs agentmemory vs Basic Memory vs MCP Memory Service",
      "url": "https://indexagentica.com/compare/coding-agent-memory-servers/",
      "json": "https://indexagentica.com/api/longform/compare/coding-agent-memory-servers.json"
    },
    {
      "type": "comparison",
      "id": "vector-databases-for-agents",
      "title": "Vector databases for agents compared",
      "url": "https://indexagentica.com/compare/vector-databases-for-agents/",
      "json": "https://indexagentica.com/api/longform/compare/vector-databases-for-agents.json"
    }
  ],
  "sources": [
    {
      "title": "A-MEM README (agiresearch/A-mem)",
      "url": "https://github.com/agiresearch/A-mem",
      "accessed": "2026-10-30"
    },
    {
      "title": "A-MEM source, memory_system.py",
      "url": "https://github.com/agiresearch/A-mem/blob/main/agentic_memory/memory_system.py",
      "accessed": "2026-10-30"
    },
    {
      "title": "arXiv 2502.12110: A-MEM, Agentic Memory for LLM Agents",
      "url": "https://arxiv.org/abs/2502.12110",
      "accessed": "2026-10-30"
    },
    {
      "title": "MemoryOS README (BAI-LAB/MemoryOS)",
      "url": "https://github.com/BAI-LAB/MemoryOS",
      "accessed": "2026-10-30"
    },
    {
      "title": "PyPI: memoryos-pro",
      "url": "https://pypi.org/project/memoryos-pro/",
      "accessed": "2026-10-30"
    },
    {
      "title": "arXiv 2506.06326: Memory OS of AI Agent",
      "url": "https://arxiv.org/abs/2506.06326",
      "accessed": "2026-10-30"
    },
    {
      "title": "MemOS README (MemTensor/MemOS)",
      "url": "https://github.com/MemTensor/MemOS",
      "accessed": "2026-10-30"
    },
    {
      "title": "PyPI: MemoryOS (MemTensor MemOS)",
      "url": "https://pypi.org/project/MemoryOS/",
      "accessed": "2026-10-30"
    },
    {
      "title": "arXiv 2507.03724: MemOS, A Memory OS for AI System",
      "url": "https://arxiv.org/abs/2507.03724",
      "accessed": "2026-10-30"
    },
    {
      "title": "LightRAG README (HKUDS/LightRAG)",
      "url": "https://github.com/HKUDS/LightRAG",
      "accessed": "2026-10-30"
    },
    {
      "title": "PyPI: lightrag-hku",
      "url": "https://pypi.org/project/lightrag-hku/",
      "accessed": "2026-10-30"
    },
    {
      "title": "arXiv 2410.05779: LightRAG, Simple and Fast Retrieval-Augmented Generation",
      "url": "https://arxiv.org/abs/2410.05779",
      "accessed": "2026-10-30"
    }
  ],
  "front_matter": {
    "id": "research-memory-libraries",
    "type": "comparison",
    "title": "Research memory libraries compared: A-MEM vs MemoryOS vs MemOS vs LightRAG",
    "summary": "Four open-source memory systems that started as research papers. What each one stores, how many LLM calls a write costs, whether memories survive a restart, and how close each is to something you can run in an agent today.",
    "description": "A primary-source comparison of A-MEM, MemoryOS, MemOS and LightRAG, checked on 2026-10-30 against each project's README, source, package registry and arXiv paper. A-MEM, MemoryOS and LightRAG were installed and run offline with a stubbed LLM to count LLM calls and test persistence; MemOS was not run. Benchmark figures are the projects' own claims.",
    "author": "Agentica Author",
    "tags": [
      "memory",
      "research",
      "rag",
      "knowledge-graph",
      "python",
      "self-hosted"
    ],
    "entries": [
      "a-mem",
      "memoryos",
      "memos",
      "lightrag",
      "mem0",
      "zep",
      "letta",
      "chroma",
      "qdrant",
      "openclaw",
      "hermes-agent",
      "omnimemeval"
    ],
    "related": [
      "agent-memory-layers",
      "give-an-agent-long-term-memory",
      "coding-agent-memory-servers",
      "vector-databases-for-agents"
    ],
    "subjects": [
      "a-mem",
      "memoryos",
      "memos",
      "lightrag"
    ],
    "criteria": [
      "What it stores",
      "Install",
      "Persistence",
      "LLM cost of a write",
      "Agent access",
      "Maturity",
      "License"
    ],
    "rows": {
      "a-mem": {
        "What it stores": "Zettelkasten-style notes with keywords, tags, context and links; adding a note can rewrite its neighbours' tags and context (memory evolution)",
        "Install": "From source only (git clone, pip install .). The PyPI name agentic-memory belongs to an unrelated project",
        "Persistence": "None in the main class: AgenticMemorySystem keeps notes in a Python dict and an in-memory Chroma client that it resets on start. A PersistentChromaRetriever exists but is not wired in",
        "LLM cost of a write": "One LLM call per add_note once there are neighbours (the evolution decision); none for the first note",
        "Agent access": "Python API only (add_note, search_agentic, update, delete)",
        "Maturity": "Library companion to a NeurIPS 2025 paper; last commit Dec 2025, no releases",
        "License": "MIT"
      },
      "memoryos": {
        "What it stores": "Per-user short-term QA pairs, mid-term topic sessions scored by heat, and a long-term user profile plus user and assistant knowledge",
        "Install": "pip install memoryos-pro (0.1.0, Jul 2025) pins numpy 1.24 and faiss-gpu; it failed to build on Python 3.13 and installed on 3.10. The GitHub code is newer than the PyPI package",
        "Persistence": "JSON files per user under data_storage_path; a new instance reloaded them. A ChromaDB variant is in the repo",
        "LLM cost of a write": "None until short-term is full, then five or six calls per add (continuity, summaries, keywords) in our stub run; profile and knowledge updates fire when a session's heat passes the threshold",
        "Agent access": "Python API, and MemoryOS-MCP with add_memory, retrieve_memory and get_user_profile tools; any OpenAI-compatible LLM endpoint",
        "Maturity": "EMNLP 2025 paper; last commit Jul 2026; PyPI package not updated since Jul 2025",
        "License": "Apache-2.0 (the PyPI metadata says MIT and still has template project links)"
      },
      "memos": {
        "What it stores": "MemCubes: plaintext memory plus, in the paper, activation (KV cache) and parameter-level memory, with provenance and versions",
        "Install": "Hosted Cloud API (key), self-host with docker compose (MemOS API, Neo4j, Qdrant), or npm local plugins for OpenClaw, Hermes Agent and DeepSeek Harness. PyPI package is named MemoryOS (2.0.33)",
        "Persistence": "Neo4j plus Qdrant when self-hosted; SQLite in the local plugins; MemOS Cloud when hosted",
        "LLM cost of a write": "Not measured here; the server uses a configured LLM and embedder for extraction",
        "Agent access": "REST API (add/message, search/memory), and plugins that recall before and save after each agent turn",
        "Maturity": "Most active of the four: release v2.0.34 on 2026-09-23, commits this week, a company (MemTensor) behind it",
        "License": "Apache-2.0"
      },
      "lightrag": {
        "What it stores": "Documents split into chunks, plus an entity-relation knowledge graph extracted from them, each with vector indexes",
        "Install": "pip install lightrag-hku (1.5.7, Python 3.10+); add the [api] extra for lightrag-server and web UI; Docker Compose and a setup wizard",
        "Persistence": "Local JSON, NanoVectorDB and NetworkX files by default (in RAM, for testing only); PostgreSQL, MongoDB or OpenSearch for production, or Milvus, Qdrant, Neo4j, Memgraph per store",
        "LLM cost of a write": "Two calls per chunk by default (extraction plus one gleaning pass); deletion rebuilds from cache",
        "Agent access": "Python API, REST server with an Ollama-compatible API, and a web UI; no official MCP server",
        "Maturity": "Large and active: about 40k stars, releases every few weeks through 2026 (latest v1.5.7, 2026-09-02), commits this week",
        "License": "MIT"
      }
    },
    "verdict": "None of these is a drop-in Mem0 or Zep. Building a chat assistant that should learn a user's preferences over months? MemoryOS has the clearest model for it and an MCP server, but plan to install from GitHub on Python 3.10. Want the most production-ready option with a hosted fallback, or memory for OpenClaw or Hermes Agent? MemOS. Your agent's memory is really a growing pile of documents and you need questions that span them? LightRAG, with PostgreSQL behind it. A-MEM is worth reading and borrowing ideas from, but its main class keeps nothing after exit, so treat it as research code.",
    "sources": [
      {
        "title": "A-MEM README (agiresearch/A-mem)",
        "url": "https://github.com/agiresearch/A-mem",
        "accessed": "2026-10-30"
      },
      {
        "title": "A-MEM source, memory_system.py",
        "url": "https://github.com/agiresearch/A-mem/blob/main/agentic_memory/memory_system.py",
        "accessed": "2026-10-30"
      },
      {
        "title": "arXiv 2502.12110: A-MEM, Agentic Memory for LLM Agents",
        "url": "https://arxiv.org/abs/2502.12110",
        "accessed": "2026-10-30"
      },
      {
        "title": "MemoryOS README (BAI-LAB/MemoryOS)",
        "url": "https://github.com/BAI-LAB/MemoryOS",
        "accessed": "2026-10-30"
      },
      {
        "title": "PyPI: memoryos-pro",
        "url": "https://pypi.org/project/memoryos-pro/",
        "accessed": "2026-10-30"
      },
      {
        "title": "arXiv 2506.06326: Memory OS of AI Agent",
        "url": "https://arxiv.org/abs/2506.06326",
        "accessed": "2026-10-30"
      },
      {
        "title": "MemOS README (MemTensor/MemOS)",
        "url": "https://github.com/MemTensor/MemOS",
        "accessed": "2026-10-30"
      },
      {
        "title": "PyPI: MemoryOS (MemTensor MemOS)",
        "url": "https://pypi.org/project/MemoryOS/",
        "accessed": "2026-10-30"
      },
      {
        "title": "arXiv 2507.03724: MemOS, A Memory OS for AI System",
        "url": "https://arxiv.org/abs/2507.03724",
        "accessed": "2026-10-30"
      },
      {
        "title": "LightRAG README (HKUDS/LightRAG)",
        "url": "https://github.com/HKUDS/LightRAG",
        "accessed": "2026-10-30"
      },
      {
        "title": "PyPI: lightrag-hku",
        "url": "https://pypi.org/project/lightrag-hku/",
        "accessed": "2026-10-30"
      },
      {
        "title": "arXiv 2410.05779: LightRAG, Simple and Fast Retrieval-Augmented Generation",
        "url": "https://arxiv.org/abs/2410.05779",
        "accessed": "2026-10-30"
      }
    ],
    "last_verified": "2026-10-30",
    "published": "2026-10-30"
  },
  "markdown": "\nMost agent memory products you will meet ([Mem0](https://indexagentica.com/entries/mem0/), [Zep](https://indexagentica.com/entries/zep/), [Letta](https://indexagentica.com/entries/letta/) and the rest in [Agent memory layers compared](https://indexagentica.com/compare/agent-memory-layers/)) are built as products first. The four here started as papers, and each one bets on a different idea of what memory is:\n\n- [A-MEM](https://indexagentica.com/entries/a-mem/): memory as a **linked notebook** that reorganises itself.\n- [MemoryOS](https://indexagentica.com/entries/memoryos/): memory as an **operating-system hierarchy**, from recent turns to a long-term user profile.\n- [MemOS](https://indexagentica.com/entries/memos/): memory as a **managed system resource**, from plain text up to model weights.\n- [LightRAG](https://indexagentica.com/entries/lightrag/): memory as a **knowledge graph over documents**.\n\nPapers report results on their own benchmarks; the code you can install is a separate question. This page is about the code: what installs, what persists, what an LLM call costs you, and how an agent reaches it. If you just need memory working in an agent this week, start with [Give an agent long-term memory](https://indexagentica.com/guides/give-an-agent-long-term-memory/) instead.\n\n## What we ran\n\nOn 2026-10-30 we installed three of the four and ran them **offline**: the LLM was replaced by a stub that counts calls and returns an empty or neutral answer, and embeddings were a real local model (A-MEM, MemoryOS) or a hashing stand-in (LightRAG). That tells you how much LLM work each write triggers and what is stored where. It says nothing about answer quality, and the call counts depend partly on what the stub returned. MemOS needs Neo4j, Qdrant and LLM keys to self-host, so it is covered from its README and paper only.\n\n| | Installed | Version run | Result |\n|---|---|---|---|\n| A-MEM | from source on Python 3.13 | commit ceffb86 (2025-12-12) | worked; nothing persisted |\n| MemoryOS | `memoryos-pro` 0.1.0 | failed on Python 3.13, worked on 3.10 | worked; JSON files persisted |\n| LightRAG | `lightrag-hku` 1.5.7 on Python 3.13 | 1.5.7 | worked; files persisted; delete worked |\n| MemOS | not installed | | |\n\n## A-MEM: good ideas, research-grade code\n\nThe paper (NeurIPS 2025) writes each memory as a structured note and links it to similar notes, Zettelkasten-style. When a new note arrives, an LLM looks at its nearest neighbours and decides whether to strengthen links or rewrite the neighbours' tags and context. The README says plainly that this repository is the library version and points to a separate repository for reproducing the paper.\n\nWhat the code does today:\n\n- **One LLM call per write** after the first note: the evolution decision, made with the neighbours retrieved from Chroma. Our three `add_note()` calls made two LLM calls.\n- **Nothing persists.** `AgenticMemorySystem` keeps notes in a Python dict and uses an in-memory Chroma client, and its constructor resets that client. A second instance saw 0 notes. Worse, creating the second instance broke the first one in the same process: its next search raised `NotFoundError: Collection ... does not exist`. The repo has a `PersistentChromaRetriever` class, but the main class does not use it.\n- **Install from source.** `pip install agentic-memory` installs an unrelated project (\"A Graph-Theoretic Memory Kernel\", from a different author). Clone the repo and run `pip install .`. It pulls in sentence-transformers and therefore PyTorch.\n- LLM backends are OpenAI, or Ollama through LiteLLM.\n\nUse it to study the evolution idea, or fork it and wire in the persistent retriever. Don't put it behind a long-running agent as is.\n\n## MemoryOS: a clear model for personal assistants\n\nMemoryOS (EMNLP 2025) is built for one assistant talking to one user over a long time. New turns go into short-term memory. When that fills, they are grouped into mid-term topic sessions. Sessions that get revisited build up \"heat\", and once a session passes the heat threshold, an LLM distils it into a long-term user profile and knowledge entries. Retrieval pulls from all three levels.\n\nWhat we saw with `short_term_capacity=3`:\n\n- The first two writes made no LLM calls. From the third on, each `add_memory()` made five or six: a continuity check, a meta-summary, a multi-topic summary and keyword extraction.\n- One `get_response()` made nine LLM calls in our run. That included a profile analysis and knowledge extraction, because the session had just crossed the heat threshold, as well as the answer itself.\n- State is three JSON files per user (`short_term.json`, `mid_term.json`, `long_term_user.json`), and a new instance loaded them back.\n\nInstall friction is the main catch. The PyPI package `memoryos-pro` 0.1.0 dates from July 2025, pins `numpy==1.24.*` and `faiss-gpu`, and failed to build on Python 3.13; it installed on 3.10. Its metadata still carries template values (author \"Your Name\", links to `pypa/sampleproject`) and says MIT, while the repository is Apache-2.0. The README describes a newer API than the package: its example passes `embedding_model_name`, which 0.1.0's `Memoryos()` does not accept. Install from the GitHub `memoryos-pypi` folder if you want what the README shows.\n\nFor agents, the repo's MemoryOS-MCP server exposes `add_memory`, `retrieve_memory` and `get_user_profile`, and all model calls go through an OpenAI-compatible endpoint, and the README lists vLLM for local models. Note that a write is LLM-heavy once the short-term buffer is full, so put a cheap model on it.\n\n## MemOS: the one that became a product\n\nMemOS (arXiv 2507.03724, from MemTensor) has the broadest idea: a MemCube unit that can hold plain-text memory, activation memory (KV cache) or parameter-level memory, with provenance and versions, and move between them. The code you can deploy today is mostly the plain-text part, packaged four ways:\n\n- a hosted **Cloud API** (`mpg-` keys, `add/message` and `search/memory` endpoints),\n- **self-hosting** with `docker compose up` (the MemOS API plus Neo4j and Qdrant) or uvicorn,\n- a **Cloud plugin** for OpenClaw and DeepSeek Harness,\n- a **local plugin** for [OpenClaw](https://indexagentica.com/entries/openclaw/), [Hermes Agent](https://indexagentica.com/entries/hermes-agent/) and DeepSeek Harness that keeps everything in local SQLite with hybrid FTS5 plus vector search.\n\nThe plugins recall memories before each agent turn and save the new messages after it, so the agent does not need to call a tool. That is the main practical difference from the other three.\n\nIt is the most actively maintained of the four (GitHub release v2.0.34 on 2026-09-23 and commits this week). The README's benchmark table (LoCoMo 88.83, LongMemEval 89.20, and results on [OmniMemEval](https://indexagentica.com/entries/omnimemeval/), MemTensor's own evaluation) is the project's claim and was not reproduced here.\n\nOne naming trap: MemOS's PyPI package is called **`MemoryOS`** (2.0.33). That is not BAI-LAB's MemoryOS above, whose package is `memoryos-pro`. MemOS imports as `memos` and BAI-LAB's as `memoryos`, so check which one you installed.\n\n## LightRAG: memory as documents plus a graph\n\nLightRAG is a retrieval framework rather than a conversation memory. You insert documents; it chunks them, has an LLM extract entities and relations into a knowledge graph, and indexes chunks, entities and relations as vectors. Queries run in five modes: `naive` (chunks only), `local` (entities), `global` (relations), `hybrid`, and `mix`, the default. It fits agents whose memory is a growing body of notes, tickets or reports, and questions span many of them.\n\nWhat we saw on 1.5.7:\n\n- **Two LLM calls per chunk** at insert: extraction plus one \"gleaning\" pass (`entity_extract_max_gleaning` defaults to 1). Two short documents made four calls.\n- Default storage is nine local files (JSON key-value stores, NanoVectorDB vector files and a GraphML graph). The README says these defaults hold everything in RAM and are for testing only, and recommends PostgreSQL for production. MongoDB and OpenSearch also cover all four stores, or mix Milvus or [Qdrant](https://indexagentica.com/entries/qdrant/) for vectors with Neo4j or Memgraph for the graph.\n- A `naive` query with `only_need_context=True` returned the right chunk without calling the LLM. After `adelete_by_doc_id()`, the same query no longer found it, and the deletion made no LLM calls in our run.\n- Pick the embedding model up front. The README warns that changing it means re-embedding everything, and there is no re-embedding tool.\n\n`lightrag-server` (the `[api]` extra or Docker) adds a REST API, an Ollama-compatible chat API and a web UI. It **binds to 0.0.0.0 with no authentication by default**. Set `LIGHTRAG_API_KEY` (or accounts with a token secret), and note that the Ollama-compatible `/api/*` routes stay open unless you also set `WHITELIST_PATHS=/health`. There is no official MCP server; agents call the REST API or the Python library.\n\n## How to choose\n\n- **Personal assistant that should learn about one user over months:** MemoryOS's three-level design matches the problem, and it has an MCP server. Budget for LLM calls on writes, and install from GitHub.\n- **You want something maintained, with a hosted option or OpenClaw/Hermes integration:** MemOS.\n- **Your memory is mostly documents and you need cross-document answers:** LightRAG, on PostgreSQL, with auth turned on.\n- **You want to experiment with self-organising memory:** read A-MEM's code and paper, then add persistence yourself.\n- **You want a product, not a paper:** see [Agent memory layers compared](https://indexagentica.com/compare/agent-memory-layers/), or [memory servers for coding agents](https://indexagentica.com/compare/coding-agent-memory-servers/) if the agent is Claude Code, Codex or Cursor.\n\n## The offline probes\n\nThese are the scripts behind the numbers above. They need no API keys. Each replaces the LLM with a stub, so they measure plumbing, not quality.\n\nLightRAG (`pip install lightrag-hku==1.5.7`):\n\n```python\nimport asyncio, hashlib, os, shutil, numpy as np\nfrom lightrag import LightRAG, QueryParam\nfrom lightrag.utils import EmbeddingFunc\n\nWD = \"./lr_probe\"; shutil.rmtree(WD, ignore_errors=True)\ncalls = []\n\nasync def stub_llm(prompt, system_prompt=None, history_messages=[], **kw):\n    calls.append(prompt[:60]); return \"\"          # extract nothing\n\nasync def hash_embed(texts):                      # stand-in for a real embedder\n    out = []\n    for t in texts:\n        v = np.zeros(256)\n        for w in t.lower().split():\n            v[int(hashlib.md5(w.encode()).hexdigest(), 16) % 256] += 1\n        out.append(v / (np.linalg.norm(v) or 1))\n    return np.array(out)\n\nasync def main():\n    rag = LightRAG(working_dir=WD, llm_model_func=stub_llm,\n                   embedding_func=EmbeddingFunc(embedding_dim=256, func=hash_embed))\n    await rag.initialize_storages()\n    await rag.ainsert([\"Niko prefers window seats on long flights.\",\n                       \"The staging database is Postgres 16 on port 5433.\"], ids=[\"pref-1\", \"infra-1\"])\n    print(\"LLM calls during insert:\", len(calls))  # 4\n    print(\"files:\", sorted(os.listdir(WD)))\n    q = QueryParam(mode=\"naive\", only_need_context=True, chunk_top_k=1)\n    print(\"found:\", \"5433\" in str(await rag.aquery(\"staging database port\", param=q)))   # True\n    await rag.adelete_by_doc_id(\"infra-1\")\n    print(\"after delete:\", \"5433\" in str(await rag.aquery(\"staging database port\", param=q)))  # False\n    await rag.finalize_storages()\n\nasyncio.run(main())\n```\n\nA-MEM (clone `agiresearch/A-mem`, `pip install .`):\n\n```python\nimport json, os\nos.environ.setdefault(\"OPENAI_API_KEY\", \"sk-offline-stub\")   # the constructor builds an OpenAI client\nfrom agentic_memory.memory_system import AgenticMemorySystem\n\ncalls = []\ndef stub(prompt, response_format=None, temperature=0.7):\n    calls.append(prompt[:80])\n    return json.dumps({\"should_evolve\": False, \"actions\": [], \"suggested_connections\": [],\n                       \"tags_to_update\": [], \"new_context_neighborhood\": [], \"new_tags_neighborhood\": []})\n\nm = AgenticMemorySystem(model_name=\"all-MiniLM-L6-v2\", llm_backend=\"openai\")\nm.llm_controller.llm.get_completion = stub\nfor t in [\"Niko prefers window seats on long flights.\",\n          \"The staging database is Postgres 16 on port 5433.\",\n          \"Niko's flight to Berlin leaves on Friday.\"]:\n    m.add_note(t)\nprint(\"LLM calls:\", len(calls))                                   # 2\nprint(m.search(\"staging db port\", k=1)[0][\"content\"])             # the Postgres note\nm2 = AgenticMemorySystem(model_name=\"all-MiniLM-L6-v2\", llm_backend=\"openai\")\nprint(\"second instance sees:\", len(m2.memories))                  # 0\nm.search(\"staging db port\", k=1)                                  # raises NotFoundError\n```\n\nMemoryOS (`pip install memoryos-pro==0.1.0` on Python 3.10):\n\n```python\nimport os, shutil\nimport memoryos.utils as u\ncalls = []\ndef stub(self, model, messages, temperature=0.7, max_tokens=2000):\n    calls.append(messages[-1][\"content\"][:60]); return \"stub\"\nu.OpenAIClient.chat_completion = stub\nfrom memoryos import Memoryos\n\nD = \"./mo_probe\"; shutil.rmtree(D, ignore_errors=True)\nmk = lambda: Memoryos(user_id=\"niko\", openai_api_key=\"sk-offline-stub\",\n                      data_storage_path=D, short_term_capacity=3)\nm = mk()\nfor q, a in [(\"I prefer window seats on long flights.\", \"Noted.\"),\n             (\"Our staging database is Postgres 16 on port 5433.\", \"Got it.\"),\n             (\"My flight to Berlin leaves Friday.\", \"Have a good trip.\"),\n             (\"I'm vegetarian.\", \"Noted.\"),\n             (\"Remind me the staging port later.\", \"Will do.\")]:\n    m.add_memory(user_input=q, agent_response=a)\n    print(\"LLM calls so far:\", len(calls))                       # 0, 0, 6, 11, 16\nn = len(calls); m.get_response(query=\"Which port is staging on?\")\nprint(\"get_response calls:\", len(calls) - n)                    # 9\nprint(sorted(os.path.relpath(os.path.join(r, f), D) for r, _, fs in os.walk(D) for f in fs))\nprint(\"reloaded short-term items:\", len(mk().short_term_memory.get_all()))   # 2\n```\n",
  "raw": "---\nid: research-memory-libraries\ntype: comparison\ntitle: \"Research memory libraries compared: A-MEM vs MemoryOS vs MemOS vs LightRAG\"\nsummary: \"Four open-source memory systems that started as research papers. What each one stores, how many LLM calls a write costs, whether memories survive a restart, and how close each is to something you can run in an agent today.\"\ndescription: \"A primary-source comparison of A-MEM, MemoryOS, MemOS and LightRAG, checked on 2026-10-30 against each project's README, source, package registry and arXiv paper. A-MEM, MemoryOS and LightRAG were installed and run offline with a stubbed LLM to count LLM calls and test persistence; MemOS was not run. Benchmark figures are the projects' own claims.\"\nauthor: Agentica Author\ntags: [memory, research, rag, knowledge-graph, python, self-hosted]\nentries: [a-mem, memoryos, memos, lightrag, mem0, zep, letta, chroma, qdrant, openclaw, hermes-agent, omnimemeval]\nrelated: [agent-memory-layers, give-an-agent-long-term-memory, coding-agent-memory-servers, vector-databases-for-agents]\nsubjects: [a-mem, memoryos, memos, lightrag]\ncriteria:\n  - What it stores\n  - Install\n  - Persistence\n  - LLM cost of a write\n  - Agent access\n  - Maturity\n  - License\nrows:\n  a-mem:\n    What it stores: \"Zettelkasten-style notes with keywords, tags, context and links; adding a note can rewrite its neighbours' tags and context (memory evolution)\"\n    Install: \"From source only (git clone, pip install .). The PyPI name agentic-memory belongs to an unrelated project\"\n    Persistence: \"None in the main class: AgenticMemorySystem keeps notes in a Python dict and an in-memory Chroma client that it resets on start. A PersistentChromaRetriever exists but is not wired in\"\n    LLM cost of a write: \"One LLM call per add_note once there are neighbours (the evolution decision); none for the first note\"\n    Agent access: \"Python API only (add_note, search_agentic, update, delete)\"\n    Maturity: \"Library companion to a NeurIPS 2025 paper; last commit Dec 2025, no releases\"\n    License: \"MIT\"\n  memoryos:\n    What it stores: \"Per-user short-term QA pairs, mid-term topic sessions scored by heat, and a long-term user profile plus user and assistant knowledge\"\n    Install: \"pip install memoryos-pro (0.1.0, Jul 2025) pins numpy 1.24 and faiss-gpu; it failed to build on Python 3.13 and installed on 3.10. The GitHub code is newer than the PyPI package\"\n    Persistence: \"JSON files per user under data_storage_path; a new instance reloaded them. A ChromaDB variant is in the repo\"\n    LLM cost of a write: \"None until short-term is full, then five or six calls per add (continuity, summaries, keywords) in our stub run; profile and knowledge updates fire when a session's heat passes the threshold\"\n    Agent access: \"Python API, and MemoryOS-MCP with add_memory, retrieve_memory and get_user_profile tools; any OpenAI-compatible LLM endpoint\"\n    Maturity: \"EMNLP 2025 paper; last commit Jul 2026; PyPI package not updated since Jul 2025\"\n    License: \"Apache-2.0 (the PyPI metadata says MIT and still has template project links)\"\n  memos:\n    What it stores: \"MemCubes: plaintext memory plus, in the paper, activation (KV cache) and parameter-level memory, with provenance and versions\"\n    Install: \"Hosted Cloud API (key), self-host with docker compose (MemOS API, Neo4j, Qdrant), or npm local plugins for OpenClaw, Hermes Agent and DeepSeek Harness. PyPI package is named MemoryOS (2.0.33)\"\n    Persistence: \"Neo4j plus Qdrant when self-hosted; SQLite in the local plugins; MemOS Cloud when hosted\"\n    LLM cost of a write: \"Not measured here; the server uses a configured LLM and embedder for extraction\"\n    Agent access: \"REST API (add/message, search/memory), and plugins that recall before and save after each agent turn\"\n    Maturity: \"Most active of the four: release v2.0.34 on 2026-09-23, commits this week, a company (MemTensor) behind it\"\n    License: \"Apache-2.0\"\n  lightrag:\n    What it stores: \"Documents split into chunks, plus an entity-relation knowledge graph extracted from them, each with vector indexes\"\n    Install: \"pip install lightrag-hku (1.5.7, Python 3.10+); add the [api] extra for lightrag-server and web UI; Docker Compose and a setup wizard\"\n    Persistence: \"Local JSON, NanoVectorDB and NetworkX files by default (in RAM, for testing only); PostgreSQL, MongoDB or OpenSearch for production, or Milvus, Qdrant, Neo4j, Memgraph per store\"\n    LLM cost of a write: \"Two calls per chunk by default (extraction plus one gleaning pass); deletion rebuilds from cache\"\n    Agent access: \"Python API, REST server with an Ollama-compatible API, and a web UI; no official MCP server\"\n    Maturity: \"Large and active: about 40k stars, releases every few weeks through 2026 (latest v1.5.7, 2026-09-02), commits this week\"\n    License: \"MIT\"\nverdict: \"None of these is a drop-in Mem0 or Zep. Building a chat assistant that should learn a user's preferences over months? MemoryOS has the clearest model for it and an MCP server, but plan to install from GitHub on Python 3.10. Want the most production-ready option with a hosted fallback, or memory for OpenClaw or Hermes Agent? MemOS. Your agent's memory is really a growing pile of documents and you need questions that span them? LightRAG, with PostgreSQL behind it. A-MEM is worth reading and borrowing ideas from, but its main class keeps nothing after exit, so treat it as research code.\"\nsources:\n  - {title: \"A-MEM README (agiresearch/A-mem)\", url: \"https://github.com/agiresearch/A-mem\", accessed: 2026-10-30}\n  - {title: \"A-MEM source, memory_system.py\", url: \"https://github.com/agiresearch/A-mem/blob/main/agentic_memory/memory_system.py\", accessed: 2026-10-30}\n  - {title: \"arXiv 2502.12110: A-MEM, Agentic Memory for LLM Agents\", url: \"https://arxiv.org/abs/2502.12110\", accessed: 2026-10-30}\n  - {title: \"MemoryOS README (BAI-LAB/MemoryOS)\", url: \"https://github.com/BAI-LAB/MemoryOS\", accessed: 2026-10-30}\n  - {title: \"PyPI: memoryos-pro\", url: \"https://pypi.org/project/memoryos-pro/\", accessed: 2026-10-30}\n  - {title: \"arXiv 2506.06326: Memory OS of AI Agent\", url: \"https://arxiv.org/abs/2506.06326\", accessed: 2026-10-30}\n  - {title: \"MemOS README (MemTensor/MemOS)\", url: \"https://github.com/MemTensor/MemOS\", accessed: 2026-10-30}\n  - {title: \"PyPI: MemoryOS (MemTensor MemOS)\", url: \"https://pypi.org/project/MemoryOS/\", accessed: 2026-10-30}\n  - {title: \"arXiv 2507.03724: MemOS, A Memory OS for AI System\", url: \"https://arxiv.org/abs/2507.03724\", accessed: 2026-10-30}\n  - {title: \"LightRAG README (HKUDS/LightRAG)\", url: \"https://github.com/HKUDS/LightRAG\", accessed: 2026-10-30}\n  - {title: \"PyPI: lightrag-hku\", url: \"https://pypi.org/project/lightrag-hku/\", accessed: 2026-10-30}\n  - {title: \"arXiv 2410.05779: LightRAG, Simple and Fast Retrieval-Augmented Generation\", url: \"https://arxiv.org/abs/2410.05779\", accessed: 2026-10-30}\nlast_verified: 2026-10-30\npublished: 2026-10-30\n---\n\nMost agent memory products you will meet ([Mem0](https://indexagentica.com/entries/mem0/), [Zep](https://indexagentica.com/entries/zep/), [Letta](https://indexagentica.com/entries/letta/) and the rest in [Agent memory layers compared](https://indexagentica.com/compare/agent-memory-layers/)) are built as products first. The four here started as papers, and each one bets on a different idea of what memory is:\n\n- [A-MEM](https://indexagentica.com/entries/a-mem/): memory as a **linked notebook** that reorganises itself.\n- [MemoryOS](https://indexagentica.com/entries/memoryos/): memory as an **operating-system hierarchy**, from recent turns to a long-term user profile.\n- [MemOS](https://indexagentica.com/entries/memos/): memory as a **managed system resource**, from plain text up to model weights.\n- [LightRAG](https://indexagentica.com/entries/lightrag/): memory as a **knowledge graph over documents**.\n\nPapers report results on their own benchmarks; the code you can install is a separate question. This page is about the code: what installs, what persists, what an LLM call costs you, and how an agent reaches it. If you just need memory working in an agent this week, start with [Give an agent long-term memory](https://indexagentica.com/guides/give-an-agent-long-term-memory/) instead.\n\n## What we ran\n\nOn 2026-10-30 we installed three of the four and ran them **offline**: the LLM was replaced by a stub that counts calls and returns an empty or neutral answer, and embeddings were a real local model (A-MEM, MemoryOS) or a hashing stand-in (LightRAG). That tells you how much LLM work each write triggers and what is stored where. It says nothing about answer quality, and the call counts depend partly on what the stub returned. MemOS needs Neo4j, Qdrant and LLM keys to self-host, so it is covered from its README and paper only.\n\n| | Installed | Version run | Result |\n|---|---|---|---|\n| A-MEM | from source on Python 3.13 | commit ceffb86 (2025-12-12) | worked; nothing persisted |\n| MemoryOS | `memoryos-pro` 0.1.0 | failed on Python 3.13, worked on 3.10 | worked; JSON files persisted |\n| LightRAG | `lightrag-hku` 1.5.7 on Python 3.13 | 1.5.7 | worked; files persisted; delete worked |\n| MemOS | not installed | | |\n\n## A-MEM: good ideas, research-grade code\n\nThe paper (NeurIPS 2025) writes each memory as a structured note and links it to similar notes, Zettelkasten-style. When a new note arrives, an LLM looks at its nearest neighbours and decides whether to strengthen links or rewrite the neighbours' tags and context. The README says plainly that this repository is the library version and points to a separate repository for reproducing the paper.\n\nWhat the code does today:\n\n- **One LLM call per write** after the first note: the evolution decision, made with the neighbours retrieved from Chroma. Our three `add_note()` calls made two LLM calls.\n- **Nothing persists.** `AgenticMemorySystem` keeps notes in a Python dict and uses an in-memory Chroma client, and its constructor resets that client. A second instance saw 0 notes. Worse, creating the second instance broke the first one in the same process: its next search raised `NotFoundError: Collection ... does not exist`. The repo has a `PersistentChromaRetriever` class, but the main class does not use it.\n- **Install from source.** `pip install agentic-memory` installs an unrelated project (\"A Graph-Theoretic Memory Kernel\", from a different author). Clone the repo and run `pip install .`. It pulls in sentence-transformers and therefore PyTorch.\n- LLM backends are OpenAI, or Ollama through LiteLLM.\n\nUse it to study the evolution idea, or fork it and wire in the persistent retriever. Don't put it behind a long-running agent as is.\n\n## MemoryOS: a clear model for personal assistants\n\nMemoryOS (EMNLP 2025) is built for one assistant talking to one user over a long time. New turns go into short-term memory. When that fills, they are grouped into mid-term topic sessions. Sessions that get revisited build up \"heat\", and once a session passes the heat threshold, an LLM distils it into a long-term user profile and knowledge entries. Retrieval pulls from all three levels.\n\nWhat we saw with `short_term_capacity=3`:\n\n- The first two writes made no LLM calls. From the third on, each `add_memory()` made five or six: a continuity check, a meta-summary, a multi-topic summary and keyword extraction.\n- One `get_response()` made nine LLM calls in our run. That included a profile analysis and knowledge extraction, because the session had just crossed the heat threshold, as well as the answer itself.\n- State is three JSON files per user (`short_term.json`, `mid_term.json`, `long_term_user.json`), and a new instance loaded them back.\n\nInstall friction is the main catch. The PyPI package `memoryos-pro` 0.1.0 dates from July 2025, pins `numpy==1.24.*` and `faiss-gpu`, and failed to build on Python 3.13; it installed on 3.10. Its metadata still carries template values (author \"Your Name\", links to `pypa/sampleproject`) and says MIT, while the repository is Apache-2.0. The README describes a newer API than the package: its example passes `embedding_model_name`, which 0.1.0's `Memoryos()` does not accept. Install from the GitHub `memoryos-pypi` folder if you want what the README shows.\n\nFor agents, the repo's MemoryOS-MCP server exposes `add_memory`, `retrieve_memory` and `get_user_profile`, and all model calls go through an OpenAI-compatible endpoint, and the README lists vLLM for local models. Note that a write is LLM-heavy once the short-term buffer is full, so put a cheap model on it.\n\n## MemOS: the one that became a product\n\nMemOS (arXiv 2507.03724, from MemTensor) has the broadest idea: a MemCube unit that can hold plain-text memory, activation memory (KV cache) or parameter-level memory, with provenance and versions, and move between them. The code you can deploy today is mostly the plain-text part, packaged four ways:\n\n- a hosted **Cloud API** (`mpg-` keys, `add/message` and `search/memory` endpoints),\n- **self-hosting** with `docker compose up` (the MemOS API plus Neo4j and Qdrant) or uvicorn,\n- a **Cloud plugin** for OpenClaw and DeepSeek Harness,\n- a **local plugin** for [OpenClaw](https://indexagentica.com/entries/openclaw/), [Hermes Agent](https://indexagentica.com/entries/hermes-agent/) and DeepSeek Harness that keeps everything in local SQLite with hybrid FTS5 plus vector search.\n\nThe plugins recall memories before each agent turn and save the new messages after it, so the agent does not need to call a tool. That is the main practical difference from the other three.\n\nIt is the most actively maintained of the four (GitHub release v2.0.34 on 2026-09-23 and commits this week). The README's benchmark table (LoCoMo 88.83, LongMemEval 89.20, and results on [OmniMemEval](https://indexagentica.com/entries/omnimemeval/), MemTensor's own evaluation) is the project's claim and was not reproduced here.\n\nOne naming trap: MemOS's PyPI package is called **`MemoryOS`** (2.0.33). That is not BAI-LAB's MemoryOS above, whose package is `memoryos-pro`. MemOS imports as `memos` and BAI-LAB's as `memoryos`, so check which one you installed.\n\n## LightRAG: memory as documents plus a graph\n\nLightRAG is a retrieval framework rather than a conversation memory. You insert documents; it chunks them, has an LLM extract entities and relations into a knowledge graph, and indexes chunks, entities and relations as vectors. Queries run in five modes: `naive` (chunks only), `local` (entities), `global` (relations), `hybrid`, and `mix`, the default. It fits agents whose memory is a growing body of notes, tickets or reports, and questions span many of them.\n\nWhat we saw on 1.5.7:\n\n- **Two LLM calls per chunk** at insert: extraction plus one \"gleaning\" pass (`entity_extract_max_gleaning` defaults to 1). Two short documents made four calls.\n- Default storage is nine local files (JSON key-value stores, NanoVectorDB vector files and a GraphML graph). The README says these defaults hold everything in RAM and are for testing only, and recommends PostgreSQL for production. MongoDB and OpenSearch also cover all four stores, or mix Milvus or [Qdrant](https://indexagentica.com/entries/qdrant/) for vectors with Neo4j or Memgraph for the graph.\n- A `naive` query with `only_need_context=True` returned the right chunk without calling the LLM. After `adelete_by_doc_id()`, the same query no longer found it, and the deletion made no LLM calls in our run.\n- Pick the embedding model up front. The README warns that changing it means re-embedding everything, and there is no re-embedding tool.\n\n`lightrag-server` (the `[api]` extra or Docker) adds a REST API, an Ollama-compatible chat API and a web UI. It **binds to 0.0.0.0 with no authentication by default**. Set `LIGHTRAG_API_KEY` (or accounts with a token secret), and note that the Ollama-compatible `/api/*` routes stay open unless you also set `WHITELIST_PATHS=/health`. There is no official MCP server; agents call the REST API or the Python library.\n\n## How to choose\n\n- **Personal assistant that should learn about one user over months:** MemoryOS's three-level design matches the problem, and it has an MCP server. Budget for LLM calls on writes, and install from GitHub.\n- **You want something maintained, with a hosted option or OpenClaw/Hermes integration:** MemOS.\n- **Your memory is mostly documents and you need cross-document answers:** LightRAG, on PostgreSQL, with auth turned on.\n- **You want to experiment with self-organising memory:** read A-MEM's code and paper, then add persistence yourself.\n- **You want a product, not a paper:** see [Agent memory layers compared](https://indexagentica.com/compare/agent-memory-layers/), or [memory servers for coding agents](https://indexagentica.com/compare/coding-agent-memory-servers/) if the agent is Claude Code, Codex or Cursor.\n\n## The offline probes\n\nThese are the scripts behind the numbers above. They need no API keys. Each replaces the LLM with a stub, so they measure plumbing, not quality.\n\nLightRAG (`pip install lightrag-hku==1.5.7`):\n\n```python\nimport asyncio, hashlib, os, shutil, numpy as np\nfrom lightrag import LightRAG, QueryParam\nfrom lightrag.utils import EmbeddingFunc\n\nWD = \"./lr_probe\"; shutil.rmtree(WD, ignore_errors=True)\ncalls = []\n\nasync def stub_llm(prompt, system_prompt=None, history_messages=[], **kw):\n    calls.append(prompt[:60]); return \"\"          # extract nothing\n\nasync def hash_embed(texts):                      # stand-in for a real embedder\n    out = []\n    for t in texts:\n        v = np.zeros(256)\n        for w in t.lower().split():\n            v[int(hashlib.md5(w.encode()).hexdigest(), 16) % 256] += 1\n        out.append(v / (np.linalg.norm(v) or 1))\n    return np.array(out)\n\nasync def main():\n    rag = LightRAG(working_dir=WD, llm_model_func=stub_llm,\n                   embedding_func=EmbeddingFunc(embedding_dim=256, func=hash_embed))\n    await rag.initialize_storages()\n    await rag.ainsert([\"Niko prefers window seats on long flights.\",\n                       \"The staging database is Postgres 16 on port 5433.\"], ids=[\"pref-1\", \"infra-1\"])\n    print(\"LLM calls during insert:\", len(calls))  # 4\n    print(\"files:\", sorted(os.listdir(WD)))\n    q = QueryParam(mode=\"naive\", only_need_context=True, chunk_top_k=1)\n    print(\"found:\", \"5433\" in str(await rag.aquery(\"staging database port\", param=q)))   # True\n    await rag.adelete_by_doc_id(\"infra-1\")\n    print(\"after delete:\", \"5433\" in str(await rag.aquery(\"staging database port\", param=q)))  # False\n    await rag.finalize_storages()\n\nasyncio.run(main())\n```\n\nA-MEM (clone `agiresearch/A-mem`, `pip install .`):\n\n```python\nimport json, os\nos.environ.setdefault(\"OPENAI_API_KEY\", \"sk-offline-stub\")   # the constructor builds an OpenAI client\nfrom agentic_memory.memory_system import AgenticMemorySystem\n\ncalls = []\ndef stub(prompt, response_format=None, temperature=0.7):\n    calls.append(prompt[:80])\n    return json.dumps({\"should_evolve\": False, \"actions\": [], \"suggested_connections\": [],\n                       \"tags_to_update\": [], \"new_context_neighborhood\": [], \"new_tags_neighborhood\": []})\n\nm = AgenticMemorySystem(model_name=\"all-MiniLM-L6-v2\", llm_backend=\"openai\")\nm.llm_controller.llm.get_completion = stub\nfor t in [\"Niko prefers window seats on long flights.\",\n          \"The staging database is Postgres 16 on port 5433.\",\n          \"Niko's flight to Berlin leaves on Friday.\"]:\n    m.add_note(t)\nprint(\"LLM calls:\", len(calls))                                   # 2\nprint(m.search(\"staging db port\", k=1)[0][\"content\"])             # the Postgres note\nm2 = AgenticMemorySystem(model_name=\"all-MiniLM-L6-v2\", llm_backend=\"openai\")\nprint(\"second instance sees:\", len(m2.memories))                  # 0\nm.search(\"staging db port\", k=1)                                  # raises NotFoundError\n```\n\nMemoryOS (`pip install memoryos-pro==0.1.0` on Python 3.10):\n\n```python\nimport os, shutil\nimport memoryos.utils as u\ncalls = []\ndef stub(self, model, messages, temperature=0.7, max_tokens=2000):\n    calls.append(messages[-1][\"content\"][:60]); return \"stub\"\nu.OpenAIClient.chat_completion = stub\nfrom memoryos import Memoryos\n\nD = \"./mo_probe\"; shutil.rmtree(D, ignore_errors=True)\nmk = lambda: Memoryos(user_id=\"niko\", openai_api_key=\"sk-offline-stub\",\n                      data_storage_path=D, short_term_capacity=3)\nm = mk()\nfor q, a in [(\"I prefer window seats on long flights.\", \"Noted.\"),\n             (\"Our staging database is Postgres 16 on port 5433.\", \"Got it.\"),\n             (\"My flight to Berlin leaves Friday.\", \"Have a good trip.\"),\n             (\"I'm vegetarian.\", \"Noted.\"),\n             (\"Remind me the staging port later.\", \"Will do.\")]:\n    m.add_memory(user_input=q, agent_response=a)\n    print(\"LLM calls so far:\", len(calls))                       # 0, 0, 6, 11, 16\nn = len(calls); m.get_response(query=\"Which port is staging on?\")\nprint(\"get_response calls:\", len(calls) - n)                    # 9\nprint(sorted(os.path.relpath(os.path.join(r, f), D) for r, _, fs in os.walk(D) for f in fs))\nprint(\"reloaded short-term items:\", len(mk().short_term_memory.get_all()))   # 2\n```\n",
  "html": "<p>Most agent memory products you will meet (<a href=\"/entries/mem0/\">Mem0</a>, <a href=\"/entries/zep/\">Zep</a>, <a href=\"/entries/letta/\">Letta</a> and the rest in <a href=\"/compare/agent-memory-layers/\">Agent memory layers compared</a>) are built as products first. The four here started as papers, and each one bets on a different idea of what memory is:</p>\n<ul><li><a href=\"/entries/a-mem/\">A-MEM</a>: memory as a <strong>linked notebook</strong> that reorganises itself.</li><li><a href=\"/entries/memoryos/\">MemoryOS</a>: memory as an <strong>operating-system hierarchy</strong>, from recent turns to a long-term user profile.</li><li><a href=\"/entries/memos/\">MemOS</a>: memory as a <strong>managed system resource</strong>, from plain text up to model weights.</li><li><a href=\"/entries/lightrag/\">LightRAG</a>: memory as a <strong>knowledge graph over documents</strong>.</li></ul>\n<p>Papers report results on their own benchmarks; the code you can install is a separate question. This page is about the code: what installs, what persists, what an LLM call costs you, and how an agent reaches it. If you just need memory working in an agent this week, start with <a href=\"/guides/give-an-agent-long-term-memory/\">Give an agent long-term memory</a> instead.</p>\n<h2>What we ran</h2>\n<p>On 2026-10-30 we installed three of the four and ran them <strong>offline</strong>: the LLM was replaced by a stub that counts calls and returns an empty or neutral answer, and embeddings were a real local model (A-MEM, MemoryOS) or a hashing stand-in (LightRAG). That tells you how much LLM work each write triggers and what is stored where. It says nothing about answer quality, and the call counts depend partly on what the stub returned. MemOS needs Neo4j, Qdrant and LLM keys to self-host, so it is covered from its README and paper only.</p>\n<table><thead><tr><th scope=\"col\"></th><th scope=\"col\">Installed</th><th scope=\"col\">Version run</th><th scope=\"col\">Result</th></tr></thead><tbody><tr><td>A-MEM</td><td>from source on Python 3.13</td><td>commit ceffb86 (2025-12-12)</td><td>worked; nothing persisted</td></tr><tr><td>MemoryOS</td><td><code>memoryos-pro</code> 0.1.0</td><td>failed on Python 3.13, worked on 3.10</td><td>worked; JSON files persisted</td></tr><tr><td>LightRAG</td><td><code>lightrag-hku</code> 1.5.7 on Python 3.13</td><td>1.5.7</td><td>worked; files persisted; delete worked</td></tr><tr><td>MemOS</td><td>not installed</td><td></td><td></td></tr></tbody></table>\n<h2>A-MEM: good ideas, research-grade code</h2>\n<p>The paper (NeurIPS 2025) writes each memory as a structured note and links it to similar notes, Zettelkasten-style. When a new note arrives, an LLM looks at its nearest neighbours and decides whether to strengthen links or rewrite the neighbours&#39; tags and context. The README says plainly that this repository is the library version and points to a separate repository for reproducing the paper.</p>\n<p>What the code does today:</p>\n<ul><li><strong>One LLM call per write</strong> after the first note: the evolution decision, made with the neighbours retrieved from Chroma. Our three <code>add_note()</code> calls made two LLM calls.</li><li><strong>Nothing persists.</strong> <code>AgenticMemorySystem</code> keeps notes in a Python dict and uses an in-memory Chroma client, and its constructor resets that client. A second instance saw 0 notes. Worse, creating the second instance broke the first one in the same process: its next search raised <code>NotFoundError: Collection ... does not exist</code>. The repo has a <code>PersistentChromaRetriever</code> class, but the main class does not use it.</li><li><strong>Install from source.</strong> <code>pip install agentic-memory</code> installs an unrelated project (&quot;A Graph-Theoretic Memory Kernel&quot;, from a different author). Clone the repo and run <code>pip install .</code>. It pulls in sentence-transformers and therefore PyTorch.</li><li>LLM backends are OpenAI, or Ollama through LiteLLM.</li></ul>\n<p>Use it to study the evolution idea, or fork it and wire in the persistent retriever. Don&#39;t put it behind a long-running agent as is.</p>\n<h2>MemoryOS: a clear model for personal assistants</h2>\n<p>MemoryOS (EMNLP 2025) is built for one assistant talking to one user over a long time. New turns go into short-term memory. When that fills, they are grouped into mid-term topic sessions. Sessions that get revisited build up &quot;heat&quot;, and once a session passes the heat threshold, an LLM distils it into a long-term user profile and knowledge entries. Retrieval pulls from all three levels.</p>\n<p>What we saw with <code>short_term_capacity=3</code>:</p>\n<ul><li>The first two writes made no LLM calls. From the third on, each <code>add_memory()</code> made five or six: a continuity check, a meta-summary, a multi-topic summary and keyword extraction.</li><li>One <code>get_response()</code> made nine LLM calls in our run. That included a profile analysis and knowledge extraction, because the session had just crossed the heat threshold, as well as the answer itself.</li><li>State is three JSON files per user (<code>short_term.json</code>, <code>mid_term.json</code>, <code>long_term_user.json</code>), and a new instance loaded them back.</li></ul>\n<p>Install friction is the main catch. The PyPI package <code>memoryos-pro</code> 0.1.0 dates from July 2025, pins <code>numpy==1.24.*</code> and <code>faiss-gpu</code>, and failed to build on Python 3.13; it installed on 3.10. Its metadata still carries template values (author &quot;Your Name&quot;, links to <code>pypa/sampleproject</code>) and says MIT, while the repository is Apache-2.0. The README describes a newer API than the package: its example passes <code>embedding_model_name</code>, which 0.1.0&#39;s <code>Memoryos()</code> does not accept. Install from the GitHub <code>memoryos-pypi</code> folder if you want what the README shows.</p>\n<p>For agents, the repo&#39;s MemoryOS-MCP server exposes <code>add_memory</code>, <code>retrieve_memory</code> and <code>get_user_profile</code>, and all model calls go through an OpenAI-compatible endpoint, and the README lists vLLM for local models. Note that a write is LLM-heavy once the short-term buffer is full, so put a cheap model on it.</p>\n<h2>MemOS: the one that became a product</h2>\n<p>MemOS (arXiv 2507.03724, from MemTensor) has the broadest idea: a MemCube unit that can hold plain-text memory, activation memory (KV cache) or parameter-level memory, with provenance and versions, and move between them. The code you can deploy today is mostly the plain-text part, packaged four ways:</p>\n<ul><li>a hosted <strong>Cloud API</strong> (<code>mpg-</code> keys, <code>add/message</code> and <code>search/memory</code> endpoints),</li><li><strong>self-hosting</strong> with <code>docker compose up</code> (the MemOS API plus Neo4j and Qdrant) or uvicorn,</li><li>a <strong>Cloud plugin</strong> for OpenClaw and DeepSeek Harness,</li><li>a <strong>local plugin</strong> for <a href=\"/entries/openclaw/\">OpenClaw</a>, <a href=\"/entries/hermes-agent/\">Hermes Agent</a> and DeepSeek Harness that keeps everything in local SQLite with hybrid FTS5 plus vector search.</li></ul>\n<p>The plugins recall memories before each agent turn and save the new messages after it, so the agent does not need to call a tool. That is the main practical difference from the other three.</p>\n<p>It is the most actively maintained of the four (GitHub release v2.0.34 on 2026-09-23 and commits this week). The README&#39;s benchmark table (LoCoMo 88.83, LongMemEval 89.20, and results on <a href=\"/entries/omnimemeval/\">OmniMemEval</a>, MemTensor&#39;s own evaluation) is the project&#39;s claim and was not reproduced here.</p>\n<p>One naming trap: MemOS&#39;s PyPI package is called <strong><code>MemoryOS</code></strong> (2.0.33). That is not BAI-LAB&#39;s MemoryOS above, whose package is <code>memoryos-pro</code>. MemOS imports as <code>memos</code> and BAI-LAB&#39;s as <code>memoryos</code>, so check which one you installed.</p>\n<h2>LightRAG: memory as documents plus a graph</h2>\n<p>LightRAG is a retrieval framework rather than a conversation memory. You insert documents; it chunks them, has an LLM extract entities and relations into a knowledge graph, and indexes chunks, entities and relations as vectors. Queries run in five modes: <code>naive</code> (chunks only), <code>local</code> (entities), <code>global</code> (relations), <code>hybrid</code>, and <code>mix</code>, the default. It fits agents whose memory is a growing body of notes, tickets or reports, and questions span many of them.</p>\n<p>What we saw on 1.5.7:</p>\n<ul><li><strong>Two LLM calls per chunk</strong> at insert: extraction plus one &quot;gleaning&quot; pass (<code>entity_extract_max_gleaning</code> defaults to 1). Two short documents made four calls.</li><li>Default storage is nine local files (JSON key-value stores, NanoVectorDB vector files and a GraphML graph). The README says these defaults hold everything in RAM and are for testing only, and recommends PostgreSQL for production. MongoDB and OpenSearch also cover all four stores, or mix Milvus or <a href=\"/entries/qdrant/\">Qdrant</a> for vectors with Neo4j or Memgraph for the graph.</li><li>A <code>naive</code> query with <code>only_need_context=True</code> returned the right chunk without calling the LLM. After <code>adelete_by_doc_id()</code>, the same query no longer found it, and the deletion made no LLM calls in our run.</li><li>Pick the embedding model up front. The README warns that changing it means re-embedding everything, and there is no re-embedding tool.</li></ul>\n<p><code>lightrag-server</code> (the <code>[api]</code> extra or Docker) adds a REST API, an Ollama-compatible chat API and a web UI. It <strong>binds to 0.0.0.0 with no authentication by default</strong>. Set <code>LIGHTRAG_API_KEY</code> (or accounts with a token secret), and note that the Ollama-compatible <code>/api/*</code> routes stay open unless you also set <code>WHITELIST_PATHS=/health</code>. There is no official MCP server; agents call the REST API or the Python library.</p>\n<h2>How to choose</h2>\n<ul><li><strong>Personal assistant that should learn about one user over months:</strong> MemoryOS&#39;s three-level design matches the problem, and it has an MCP server. Budget for LLM calls on writes, and install from GitHub.</li><li><strong>You want something maintained, with a hosted option or OpenClaw/Hermes integration:</strong> MemOS.</li><li><strong>Your memory is mostly documents and you need cross-document answers:</strong> LightRAG, on PostgreSQL, with auth turned on.</li><li><strong>You want to experiment with self-organising memory:</strong> read A-MEM&#39;s code and paper, then add persistence yourself.</li><li><strong>You want a product, not a paper:</strong> see <a href=\"/compare/agent-memory-layers/\">Agent memory layers compared</a>, or <a href=\"/compare/coding-agent-memory-servers/\">memory servers for coding agents</a> if the agent is Claude Code, Codex or Cursor.</li></ul>\n<h2>The offline probes</h2>\n<p>These are the scripts behind the numbers above. They need no API keys. Each replaces the LLM with a stub, so they measure plumbing, not quality.</p>\n<p>LightRAG (<code>pip install lightrag-hku==1.5.7</code>):</p>\n<pre><code class=\"language-python\">import asyncio, hashlib, os, shutil, numpy as np\nfrom lightrag import LightRAG, QueryParam\nfrom lightrag.utils import EmbeddingFunc\n\nWD = &quot;./lr_probe&quot;; shutil.rmtree(WD, ignore_errors=True)\ncalls = []\n\nasync def stub_llm(prompt, system_prompt=None, history_messages=[], **kw):\n    calls.append(prompt[:60]); return &quot;&quot;          # extract nothing\n\nasync def hash_embed(texts):                      # stand-in for a real embedder\n    out = []\n    for t in texts:\n        v = np.zeros(256)\n        for w in t.lower().split():\n            v[int(hashlib.md5(w.encode()).hexdigest(), 16) % 256] += 1\n        out.append(v / (np.linalg.norm(v) or 1))\n    return np.array(out)\n\nasync def main():\n    rag = LightRAG(working_dir=WD, llm_model_func=stub_llm,\n                   embedding_func=EmbeddingFunc(embedding_dim=256, func=hash_embed))\n    await rag.initialize_storages()\n    await rag.ainsert([&quot;Niko prefers window seats on long flights.&quot;,\n                       &quot;The staging database is Postgres 16 on port 5433.&quot;], ids=[&quot;pref-1&quot;, &quot;infra-1&quot;])\n    print(&quot;LLM calls during insert:&quot;, len(calls))  # 4\n    print(&quot;files:&quot;, sorted(os.listdir(WD)))\n    q = QueryParam(mode=&quot;naive&quot;, only_need_context=True, chunk_top_k=1)\n    print(&quot;found:&quot;, &quot;5433&quot; in str(await rag.aquery(&quot;staging database port&quot;, param=q)))   # True\n    await rag.adelete_by_doc_id(&quot;infra-1&quot;)\n    print(&quot;after delete:&quot;, &quot;5433&quot; in str(await rag.aquery(&quot;staging database port&quot;, param=q)))  # False\n    await rag.finalize_storages()\n\nasyncio.run(main())</code></pre>\n<p>A-MEM (clone <code>agiresearch/A-mem</code>, <code>pip install .</code>):</p>\n<pre><code class=\"language-python\">import json, os\nos.environ.setdefault(&quot;OPENAI_API_KEY&quot;, &quot;sk-offline-stub&quot;)   # the constructor builds an OpenAI client\nfrom agentic_memory.memory_system import AgenticMemorySystem\n\ncalls = []\ndef stub(prompt, response_format=None, temperature=0.7):\n    calls.append(prompt[:80])\n    return json.dumps({&quot;should_evolve&quot;: False, &quot;actions&quot;: [], &quot;suggested_connections&quot;: [],\n                       &quot;tags_to_update&quot;: [], &quot;new_context_neighborhood&quot;: [], &quot;new_tags_neighborhood&quot;: []})\n\nm = AgenticMemorySystem(model_name=&quot;all-MiniLM-L6-v2&quot;, llm_backend=&quot;openai&quot;)\nm.llm_controller.llm.get_completion = stub\nfor t in [&quot;Niko prefers window seats on long flights.&quot;,\n          &quot;The staging database is Postgres 16 on port 5433.&quot;,\n          &quot;Niko&#39;s flight to Berlin leaves on Friday.&quot;]:\n    m.add_note(t)\nprint(&quot;LLM calls:&quot;, len(calls))                                   # 2\nprint(m.search(&quot;staging db port&quot;, k=1)[0][&quot;content&quot;])             # the Postgres note\nm2 = AgenticMemorySystem(model_name=&quot;all-MiniLM-L6-v2&quot;, llm_backend=&quot;openai&quot;)\nprint(&quot;second instance sees:&quot;, len(m2.memories))                  # 0\nm.search(&quot;staging db port&quot;, k=1)                                  # raises NotFoundError</code></pre>\n<p>MemoryOS (<code>pip install memoryos-pro==0.1.0</code> on Python 3.10):</p>\n<pre><code class=\"language-python\">import os, shutil\nimport memoryos.utils as u\ncalls = []\ndef stub(self, model, messages, temperature=0.7, max_tokens=2000):\n    calls.append(messages[-1][&quot;content&quot;][:60]); return &quot;stub&quot;\nu.OpenAIClient.chat_completion = stub\nfrom memoryos import Memoryos\n\nD = &quot;./mo_probe&quot;; shutil.rmtree(D, ignore_errors=True)\nmk = lambda: Memoryos(user_id=&quot;niko&quot;, openai_api_key=&quot;sk-offline-stub&quot;,\n                      data_storage_path=D, short_term_capacity=3)\nm = mk()\nfor q, a in [(&quot;I prefer window seats on long flights.&quot;, &quot;Noted.&quot;),\n             (&quot;Our staging database is Postgres 16 on port 5433.&quot;, &quot;Got it.&quot;),\n             (&quot;My flight to Berlin leaves Friday.&quot;, &quot;Have a good trip.&quot;),\n             (&quot;I&#39;m vegetarian.&quot;, &quot;Noted.&quot;),\n             (&quot;Remind me the staging port later.&quot;, &quot;Will do.&quot;)]:\n    m.add_memory(user_input=q, agent_response=a)\n    print(&quot;LLM calls so far:&quot;, len(calls))                       # 0, 0, 6, 11, 16\nn = len(calls); m.get_response(query=&quot;Which port is staging on?&quot;)\nprint(&quot;get_response calls:&quot;, len(calls) - n)                    # 9\nprint(sorted(os.path.relpath(os.path.join(r, f), D) for r, _, fs in os.walk(D) for f in fs))\nprint(&quot;reloaded short-term items:&quot;, len(mk().short_term_memory.get_all()))   # 2</code></pre>"
}
