# ReMe (MemoryScope)

> Long-term and context memory for AI agents — remember across sessions, compact long chats

- Category: Agents & Automation / Agent Memory
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/agentscope-ai/ReMe
- Canonical page: https://ai-tldr.dev/tools/reme-memoryscope/

## In short

ReMe (MemoryScope) is Long-term and context memory for AI agents — remember across sessions, compact long chats. It gives an agent long-term memory so that old conversations are compacted instead of lost, important facts are stored, and relevant context is recalled in later sessions. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

ReMe (formerly MemoryScope) is a Python memory framework for AI agents. It gives an agent long-term memory so that old conversations are compacted instead of lost, important facts are stored, and relevant context is recalled in later sessions. It targets two common problems: a limited context window and stateless sessions that always start from scratch.

It ships two memory systems. ReMeLight is file-based: memory is stored as readable Markdown and JSONL files (a MEMORY.md for long-term facts, a daily journal, and raw dialog logs) that you can open, edit, and copy. The vector-based ReMe system stores memories for semantic retrieval with hybrid vector plus BM25 search.

It fits the agent-memory category as a library you call from your own agent code rather than a hosted service. It suits developers who want personalized, persistent memory for assistants, coding helpers, or support bots, and it reports state-of-the-art results on the LoCoMo and HaluMem memory benchmarks.

## What it does

- File-based memory (ReMeLight): memory stored as editable Markdown and JSONL files you can read, edit, and copy to migrate
- Vector-based memory (ReMe) with hybrid retrieval combining vector search and BM25
- Context management: check_context, compact_memory, and compact_tool_result keep long conversations within the context window
- pre_reasoning_hook bundles tool-result compaction, context checks, and memory summarization into one async call
- Long-term memory persistence with semantic memory_search across past sessions
- Reported state-of-the-art results on the LoCoMo and HaluMem benchmarks

## Getting started

ReMe is a Python 3.10+ library installed from PyPI or source. Install it, then wire one of its memory systems into your agent's reasoning loop.

1. Install from PyPI

   Install the package with the file-based memory extra, which is recommended for a quick start.

```bash
pip install reme-ai[light]
```

2. Or install from source

   Clone the repo and install in editable mode if you want to track the latest changes.

```bash
git clone https://github.com/agentscope-ai/ReMe.git
cd ReMe
pip install -e ".[light]"
```

3. Use file-based memory (ReMeLight)

   Create a ReMeLight instance and call pre_reasoning_hook to compact history and recall memory before the model reasons.

```python
import asyncio
from reme.reme_light import ReMeLight

async def main():
    reme = ReMeLight(
        default_as_llm_config={"model_name": "qwen3.5-35b-a3b"},
        default_file_store_config={"fts_enabled": True, "vector_enabled": False},
        enable_load_env=True,
    )
    await reme.start()

    messages = [...]
    processed_messages, summary = await reme.pre_reasoning_hook(
        messages=messages,
        system_prompt="You are a helpful AI assistant.",
        compressed_summary="",
        max_input_length=128000,
    )
    await reme.close()

if __name__ == "__main__":
    asyncio.run(main())
```

4. Or use vector-based memory (ReMe)

   Configure an LLM and embedding model, then retrieve stored memories by query for a given user.

```python
import asyncio
from reme import ReMe

async def main():
    reme = ReMe(
        working_dir=".reme",
        default_llm_config={"backend": "openai", "model_name": "qwen3.5-plus"},
        default_embedding_model_config={"backend": "openai", "model_name": "text-embedding-v4"},
    )
    await reme.start()

    memories = await reme.retrieve_memory(query="Python programming", user_name="alice")
    await reme.close()

if __name__ == "__main__":
    asyncio.run(main())
```

## When to use it

- Give a personal assistant agent long-term memory of user preferences and past conversations across sessions
- Keep a coding assistant aware of project context and code-style preferences from earlier sessions
- Track a support bot's history of a user's issues and settings for more personalized replies
- Compact long multi-turn dialogues so key information survives a limited context window
