# Mem0

> A memory layer that lets LLM agents remember users across sessions

- Category: Agents & Automation / Agent Memory
- Language: Python
- Repository: https://github.com/mem0ai/mem0
- Website: https://mem0.ai
- Canonical page: https://ai-tldr.dev/tools/mem0/

## In short

Mem0 (pronounced "mem-zero") is a memory layer you add to LLM-based assistants and agents. It extracts useful facts from conversations, stores them, and recalls them later, so your agent remembers user preferences and history across separate sessions instead of starting fresh each time. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in Python.

## Overview

Mem0 (pronounced "mem-zero") is a memory layer you add to LLM-based assistants and agents. It extracts useful facts from conversations, stores them, and recalls them later, so your agent remembers user preferences and history across separate sessions instead of starting fresh each time.

It fits the agent-memory category as a memory framework: you keep your existing model and app, and Mem0 handles capturing, storing, and retrieving what the user said. It supports multiple levels of memory (user, session, and agent state) and backs them with vector, graph, and key-value stores.

It is aimed at developers building customer-support chatbots, AI assistants, and autonomous systems. You can run it as a Python or JavaScript library for prototyping, host the server yourself with Docker, or use the managed cloud platform.

## What it does

- Multi-level memory that retains user, session, and agent state for personalization
- Pluggable storage across vector, graph, and key-value backends
- Multi-signal retrieval that fuses semantic, BM25 keyword, and entity matching
- Temporal reasoning that ranks the right dated memory for current, past, and upcoming queries
- Python and JavaScript SDKs, plus a CLI for managing memories from the terminal
- Library, self-hosted Docker server, and managed cloud deployment options

## Getting started

Install the SDK for your language, or use the CLI to manage memories from the terminal. The library is the quickest way to test and prototype.

1. Install the Python library

   Install the core package from PyPI. For hybrid search with BM25 keyword matching and entity extraction, install the NLP extra and the spaCy model.

```bash
pip install mem0ai

# Optional: hybrid search with BM25 + entity extraction
pip install mem0ai[nlp]
python -m spacy download en_core_web_sm
```

2. Or install the JavaScript SDK

   Use npm if you are working in a JS or TypeScript project.

```bash
npm install mem0ai
```

3. Add and search memories from the CLI

   Initialize the CLI, store a memory for a user, then search it back. Pass --user-id to scope memories to a specific person.

```bash
mem0 init
mem0 add "Prefers dark mode and vim keybindings" --user-id alice
mem0 search "What does Alice prefer?" --user-id alice
```

4. Run the server yourself (optional)

   For a team setup, start the self-hosted stack with Docker Compose. The dashboard is served at localhost:3000.

```bash
cd server && docker compose up -d
```

## When to use it

- Give a customer-support chatbot recall of a user's past tickets and history for tailored help
- Keep an AI assistant's conversations consistent and context-rich across separate sessions
- Track user preferences (like dark mode or keybindings) so an agent personalizes its behavior
- Store agent-confirmed actions and facts so autonomous systems learn over time
