█

AI/TLDR

Buy me a coffee
Buy me a coffee

MemoryOS

An OS-style memory system for personalized AI agents, with short-, mid- and long-term memory tiers

Agent MemoryOpen source
Latest
V1.2
Updated
18 Jul 2025
Language
Python
License
Apache-2.0
$pip install memoryos-pro -i https://pypi.org/simple

What's new

V1.218 Jul 2025

Adds support for the ChromaDB vector database and fixes fixed LLM calls inside it.

IN SHORT

What is MemoryOS?

MemoryOS is a memory system for personalized AI agents from the BaiJia AI team, a research group led by Associate Professor Bai Ting at Beijing University of Posts and Telecommunications. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in Python and licensed Apache-2.0.

Updated Markdown version ↗

Overview

MemoryOS is a memory system for personalized AI agents from the BaiJia AI team, a research group led by Associate Professor Bai Ting at Beijing University of Posts and Telecommunications. It borrows from how operating systems manage memory: a hierarchical store with four core modules — Storage, Updating, Retrieval and Generation — so that a long-running assistant keeps a coherent picture of the user across many conversations. The project accompanies the paper "Memory OS of AI Agent" (arXiv 2506.06326), which the README says was accepted to the EMNLP 2025 main conference.

MemoryOS architecture diagram: an updater moves data between short-term (STM), mid-term (MTM) and long-term persona memory (LPM), a retriever feeds an LLM via RAG, and an API offers add, modify, delete and retrieve memory for downstream tasks
MemoryOS architecture: STM, MTM and LPM tiers, the updater and the retriever.MemoryOS README ↗

Memory is kept in three tiers. New user–assistant exchanges land in short-term memory; when it fills, the updater consolidates them into mid-term segments. Mid-term segments accumulate "heat" from how often they are visited and how long the interactions were, and once a segment passes a threshold its content is analysed into a long-term persona memory: a user profile, facts about the user and the assistant's own knowledge base. At answer time the retriever pulls from all of these layers and the generation step passes that context to the LLM.

It ships in several forms: a PyPI package (`memoryos-pro`), MemoryOS-MCP — an MCP server exposing `add_memory`, `retrieve_memory` and `get_user_profile` tools to clients such as Claude Desktop, Cline and Cursor — a ChromaDB-backed variant, a Docker image and a Flask playground that shows the three memory tiers filling as you chat. All model calls go through the OpenAI API interface, so OpenAI, Anthropic, DeepSeek, Qwen or a local vLLM endpoint can be used with a key and base URL; embeddings default to models such as BAAI/bge-m3 or Qwen3-Embedding-0.6B. On the LoCoMo long-term-memory benchmark the README reports average improvements of 49.11% in F1 and 46.18% in BLEU-1.

What it does

  • Three-tier memory — short-term, mid-term and long-term persona memory — with heat-based promotion between tiers
  • Automatic user-profile and knowledge extraction from past conversations
  • MemoryOS-MCP server with `add_memory`, `retrieve_memory` and `get_user_profile` tools for Claude Desktop, Cline and Cursor
  • Works with any OpenAI-compatible endpoint (OpenAI, Anthropic, DeepSeek, Qwen, vLLM) and configurable embedding models
  • PyPI package, ChromaDB variant, Docker image and a web playground
  • Scripts to reproduce the paper's LoCoMo evaluation

Getting started

You need Python 3.10+ and an OpenAI-compatible API key (OpenAI, DeepSeek, Qwen or a local vLLM endpoint).

Install the package

Install from PyPI, or clone the repository for the latest version.

bashbash
pip install memoryos-pro -i https://pypi.org/simple

# or the latest from GitHub
git clone https://github.com/BAI-LAB/MemoryOS.git
cd MemoryOS/memoryos-pypi
pip install -r requirements.txt

Add a memory and ask about it

Create a `Memoryos` instance per user and assistant, store a conversation turn, then ask a question that needs it. Capacities and the heat threshold control when memories move between tiers.

pythonpython
from memoryos import Memoryos

memo = Memoryos(
    user_id="demo_user",
    openai_api_key="YOUR_OPENAI_API_KEY",
    openai_base_url="",
    data_storage_path="./simple_demo_data",
    llm_model="gpt-4o-mini",
    assistant_id="demo_assistant",
    short_term_capacity=7,
    mid_term_heat_threshold=5,
    retrieval_queue_capacity=7,
    long_term_knowledge_capacity=100,
    embedding_model_name="BAAI/bge-m3",
)

memo.add_memory(
    user_input="Hi! I'm Tom, I work as a data scientist in San Francisco.",
    agent_response="Hello Tom! Nice to meet you. What kind of data do you work with?",
)
print(memo.get_response(query="What do you remember about my job?"))

Run the MCP server for an agent client

Fill in `config.json` (user id, API key, base URL, storage path, model, embedding model), start the server, then copy `mcp.json` into Cline, Cursor or Claude Desktop with the path to your environment's Python.

bashbash
cd memoryos-mcp
pip install -r requirements.txt
python server_new.py --config config.json

Or run it in Docker

Pull the published image, or build it from the repository's Dockerfile.

bashbash
docker pull ghcr.io/bai-lab/memoryos:latest
docker run -it --gpus=all ghcr.io/bai-lab/memoryos /bin/bash

Try the playground

Start the web demo and enter a user id, API key, model and base URL; the Help button explains each control. Memories are stored under `memoryos-playground/memdemo/data`.

bashbash
cd MemoryOS/memoryos-playground/memdemo/
python3 app.py
MemoryOS Platform playground with a chat interface and memory controls on the left and short-term, mid-term and long-term memory tabs on the right
The MemoryOS playground: chat on the left, the memory tiers filling on the right.MemoryOS README ↗

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Give a long-running chat assistant or companion a persistent user profile that builds up over many sessions
  • Add long-term memory to Claude Desktop, Cline or Cursor through the MemoryOS-MCP server
  • Research or benchmark agent-memory designs with a reproducible LoCoMo evaluation

How MemoryOS compares

MemoryOS alongside other open-source agent memory tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Claude-Mem★ 121kPersistent memory layer for coding agents: it captures what an agent does during a session, compresses it into semantic summaries, and injects the relevant parts back into later sessions.
Mem0★ 69.7kA memory layer that you add to existing LLM agents to extract, store, and recall user facts and preferences across sessions using vector, graph, and key-value backends.
Hindsight★ 64.3kAn agent memory server that stores facts and experiences, consolidates them into observations and mental models, and serves them back through retain, recall, and reflect operations.
MemPalace★ 60.8kLocal-first agent memory that stores conversations verbatim instead of summarising them, with a structured palace index, pluggable vector backends and an MCP server.
OpenViking★ 43.1kA context database that stores an agent's memories, resources, and skills as one browsable viking:// filesystem with three-tier (abstract/overview/details) on-demand loading.
Cognee★ 33.7kA graph-native memory engine that turns raw documents and conversations into a queryable knowledge graph for agents that need to build lasting knowledge.
Graphiti★ 33.2kA library that builds a temporal knowledge graph from an agent's conversations and data so facts can be tracked and queried as they change over time.
MemoryOS★ 1.6kAn OS-style memory system for personalized AI agents, with short-, mid- and long-term memory tiers