# ReMe vs Mem0 Long-Term Memory in AgentScope: Architecture and Usage Guide

> Explore ReMe vs Mem0 long-term memory in AgentScope. Discover ReMe's structured cloud memory and Mem0's local vector store for semantic search.

- Repository: [AgentScope-AI/agentscope](https://github.com/agentscope-ai/agentscope)
- Tags: comparison
- Published: 2026-03-09

---

**ReMe provides structured, cloud-backed memory with three specialized types and automatic tool integration, while Mem0 offers a generic, local vector-store solution for semantic search only.**

AgentScope supports two distinct long-term memory backends that serve different architectural needs. When building agents that persist knowledge across sessions, choosing between **ReMe (Reflection Memory)** and **Mem0** depends on whether you require structured cloud services or flexible local vector storage. This guide examines the implementation differences, configuration patterns, and source code structure of both systems as implemented in the `agentscope-ai/agentscope` repository.

## Core Architecture and Library Dependencies

The fundamental distinction begins with the underlying libraries. **ReMe** builds on the `reme-ai` cloud-native service, which stores memories in a managed workspace and handles summarization and guideline generation on the platform. According to the source code in [`_reme_long_term_memory_base.py`](https://github.com/agentscope-ai/agentscope/blob/main/_reme_long_term_memory_base.py), ReMe operates as an async-first service that requires an active `ReMeApp` context to manage HTTPS connections to the backend.

**Mem0** relies on the open-source `mem0ai` library, which functions as a vector-store wrapper that keeps memories locally or in any supported vector database such as Qdrant. The implementation in [`_mem0_long_term_memory.py`](https://github.com/agentscope-ai/agentscope/blob/main/_mem0_long_term_memory.py) stores arbitrary text and metadata as vectors, performing retrieval strictly through semantic similarity without external cloud dependencies.

## Memory Types and Specialization

ReMe offers three specialized memory classes designed for distinct use cases, while Mem0 provides a single generic interface.

**ReMe** implements specialized long-term memory through:
- `ReMePersonalLongTermMemory` – Stores user-profile facts and preferences with automatic summarization
- `ReMeTaskLongTermMemory` – Records whole task trajectories and generates summaries automatically
- `ReMeToolLongTermMemory` – Persists raw tool-call results and synthesizes usage guidelines

**Mem0** exposes only `Mem0LongTermMemory`, a single generic class that stores arbitrary text/metadata vectors without specialized lifecycle management. This design suits applications where a unified semantic memory suffices rather than structured categorization.

## Interface Design: Agent Tools vs Developer API

The exposure of memory capabilities to agents differs significantly between the two systems.

**ReMe** automatically injects tool functions into an agent's toolbox. When using personal or task memory, the methods `record_to_memory` and `retrieve_from_memory` become available as callable tools within the agent's reasoning loop. The tool memory type (`ReMeToolLongTermMemory`) only provides direct developer methods without tool wrappers. All ReMe operations must execute inside an `async with` block that initializes the `ReMeApp` context, as enforced in [`_reme_long_term_memory_base.py`](https://github.com/agentscope-ai/agentscope/blob/main/_reme_long_term_memory_base.py).

**Mem0** exposes only developer-level methods (`record`, `retrieve`) without built-in tool wrappers. Agent authors must manually add these methods to the toolbox if they want agents to invoke memory operations directly. The Mem0 implementation requires no special context management beyond standard async/await patterns.

## Data Storage and Configuration Patterns

Storage architecture represents the most critical operational difference.

**ReMe** transmits data over HTTPS to the ReMe backend, persisting information within a specific `workspace_id`. The service handles indexing, summarization, and guideline synthesis automatically. Configuration requires initializing with an AgentScope model and embedding model, with optional `reme_config_path` parameters for fine-tuning the ReMe app behavior.

**Mem0** serializes data into a vector store via the `mem0` library, storing data locally on disk or in remote vector databases that the repository controls directly. Configuration requires a `ChatModelBase`, an `EmbeddingModelBase`, and a `VectorStoreConfig` object. The helper classes `AgentScopeLLM` and `AgentScopeEmbedding` in [`_mem0_utils.py`](https://github.com/agentscope-ai/agentscope/blob/main/_mem0_utils.py) bridge AgentScope models to the Mem0 interface.

## Implementation Examples

### Using ReMe Personal Memory with Tool Integration

The following example demonstrates the async context requirement and automatic tool availability in `ReMePersonalLongTermMemory`:

```python
import os
import asyncio
from agentscope.memory import ReMePersonalLongTermMemory
from agentscope.embedding import DashScopeTextEmbedding
from agentscope.model import DashScopeChatModel
from agentscope.message import Msg

async def demo_reme_personal():
    personal_mem = ReMePersonalLongTermMemory(
        agent_name="Friday",
        user_name="user_123",
        model=DashScopeChatModel(
            model_name="qwen3-max",
            api_key=os.getenv("DASHSCOPE_API_KEY"),
            stream=False,
        ),
        embedding_model=DashScopeTextEmbedding(
            model_name="text-embedding-v4",
            api_key=os.getenv("DASHSCOPE_API_KEY"),
            dimensions=1024,
        ),
    )

    async with personal_mem:                     # Required context manager

        # Record via tool function (available to the agent)

        await personal_mem.record_to_memory(
            thinking="User likes tea and lakes",
            content=[
                "prefers Longjing tea",
                "visits West Lake in the morning",
            ],
        )

        # Retrieve via tool function

        resp = await personal_mem.retrieve_from_memory(
            keywords=["tea", "West Lake"],
        )
        print("🧠 Retrieved:", resp.content[0].text)

        # Direct developer call (no tool wrapper)

        await personal_mem.record(
            msgs=[
                Msg(role="user", content="I work as a data scientist."),
                Msg(role="assistant", content="Got it!"),
            ],
        )
        summary = await personal_mem.retrieve(
            msg=Msg(role="user", content="What do you know about me?"),
        )
        print("📄 Summary:", summary)

asyncio.run(demo_reme_personal())

```

### Using Mem0 for Generic Semantic Storage

This example shows Mem0's configuration with local Qdrant storage and its simpler method interface:

```python
import os
import asyncio
from agentscope.memory import Mem0LongTermMemory
from agentscope.model import DashScopeChatModel
from agentscope.embedding import DashScopeTextEmbedding
from mem0.vector_stores.configs import VectorStoreConfig

async def demo_mem0():
    long_mem = Mem0LongTermMemory(
        agent_name="Friday",
        user_name="user_123",
        model=DashScopeChatModel(
            model_name="qwen-max-latest",
            api_key=os.getenv("DASHSCOPE_API_KEY"),
        ),
        embedding_model=DashScopeTextEmbedding(
            model_name="text-embedding-v3",
            api_key=os.getenv("DASHSCOPE_API_KEY"),
            dimensions=1024,
        ),
        vector_store_config=VectorStoreConfig(
            provider="qdrant",
            config={
                "on_disk": True,
                "path": "./qdrant_data",
                "embedding_model_dims": 1024,
            },
        ),
    )

    # Record a conversation fragment

    await long_mem.record(
        msgs=[
            Msg(role="user", content="I love hiking in the Alps."),
            Msg(role="assistant", content="Sounds great!"),
        ],
    )

    # Retrieve by semantic search

    result = await long_mem.retrieve(
        msg=Msg(role="user", content="Do you remember my hobby?"),
    )
    print("🔎 Retrieval:", result)

asyncio.run(demo_mem0())

```

### Configuring Agents with Different Memory Modes

When integrating with `ReActAgent`, the `long_term_memory_mode` parameter controls tool exposure:

```python
from agentscope.agent import ReActAgent
from agentscope.memory import ReMePersonalLongTermMemory, Mem0LongTermMemory

# ReMe-enabled agent (tools auto-added)

personal_mem = ReMePersonalLongTermMemory(...)
async with personal_mem:
    agent_reme = ReActAgent(
        name="Friday",
        sys_prompt="You have long-term personal memory.",
        model=..., formatter=..., toolkit=..., memory=..., 
        long_term_memory=personal_mem,
        long_term_memory_mode="both",   # record + retrieve tools

    )

# Mem0-enabled agent (no automatic tools)

semantic_mem = Mem0LongTermMemory(...)
agent_mem0 = ReActAgent(
    name="Friday",
    sys_prompt="You may call record/retrieve directly if implemented.",
    model=..., formatter=..., toolkit=..., memory=..., 
    long_term_memory=semantic_mem,
    long_term_memory_mode="none",    # Manual tool exposure required

)

```

## Key Source Files

Understanding the codebase structure helps when extending or debugging memory functionality:

- **[`src/agentscope/memory/_long_term_memory/_reme/_reme_long_term_memory_base.py`](https://github.com/agentscope-ai/agentscope/blob/main/src/agentscope/memory/_long_term_memory/_reme/_reme_long_term_memory_base.py)** – Abstract base handling ReMeApp lifecycle and model extraction
- **[`src/agentscope/memory/_long_term_memory/_reme/_reme_personal_long_term_memory.py`](https://github.com/agentscope-ai/agentscope/blob/main/src/agentscope/memory/_long_term_memory/_reme/_reme_personal_long_term_memory.py)** – User-specific facts with tool integration
- **[`src/agentscope/memory/_long_term_memory/_reme/_reme_task_long_term_memory.py`](https://github.com/agentscope-ai/agentscope/blob/main/src/agentscope/memory/_long_term_memory/_reme/_reme_task_long_term_memory.py)** – Task trajectory recording and summarization
- **[`src/agentscope/memory/_long_term_memory/_reme/_reme_tool_long_term_memory.py`](https://github.com/agentscope-ai/agentscope/blob/main/src/agentscope/memory/_long_term_memory/_reme/_reme_tool_long_term_memory.py)** – Tool call logging and guideline generation
- **[`src/agentscope/memory/_long_term_memory/_mem0/_mem0_long_term_memory.py`](https://github.com/agentscope-ai/agentscope/blob/main/src/agentscope/memory/_long_term_memory/_mem0/_mem0_long_term_memory.py)** – Generic vector-store implementation
- **[`src/agentscope/memory/_long_term_memory/_mem0/_mem0_utils.py`](https://github.com/agentscope-ai/agentscope/blob/main/src/agentscope/memory/_long_term_memory/_mem0/_mem0_utils.py)** – Adapter classes `AgentScopeLLM` and `AgentScopeEmbedding` for Mem0 compatibility

## Summary

- **ReMe** provides three specialized memory types (personal, task, tool) with automatic cloud synchronization, requiring async context management and exposing memory operations as agent tools.
- **Mem0** offers a single generic vector-store interface for local or remote semantic search, giving developers full data ownership but requiring manual tool integration.
- **ReMe** automatically summarizes trajectories and generates usage guidelines, while **Mem0** relies purely on embedding-based similarity retrieval.
- Choose **ReMe** for structured knowledge management with cloud-based persistence; choose **Mem0** for on-premises semantic memory with database flexibility.

## Frequently Asked Questions

### Can I use both ReMe and Mem0 in the same AgentScope application?

Yes. You can instantiate both `ReMePersonalLongTermMemory` and `Mem0LongTermMemory` within the same application, assigning them to different agents or the same agent via the `long_term_memory` parameter. Ensure you manage the `async with` context for ReMe instances while Mem0 operates with standard async calls. The `long_term_memory_mode` parameter in `ReActAgent` controls whether ReMe tools are exposed while Mem0 methods remain developer-facing.

### Does ReMe work offline or in air-gapped environments?

No. ReMe requires an active HTTPS connection to the ReMe cloud service, where memories persist in a managed `workspace_id`. The `reme-ai` library handles all indexing and summarization remotely. For offline or air-gapped deployments, use **Mem0** with a local vector store such as the Qdrant file-backed configuration shown in the examples above.

### How does memory retrieval performance compare between ReMe and Mem0?

ReMe retrieval performance depends on network latency to the cloud service and the ReMe platform's indexing speed, optimized for structured queries across categorized memories. Mem0 retrieval speed depends entirely on your chosen vector store (local Qdrant, Weaviate, etc.) and embedding model latency, with pure semantic search executing locally without network round-trips after the initial vectorization. For high-frequency retrieval scenarios, Mem0's local storage typically offers lower latency.

### Can I migrate existing Mem0 memories to ReMe or vice versa?

Direct migration requires custom code because the data models differ significantly. ReMe stores structured memory types with automatic summarization metadata in the cloud, while Mem0 stores raw vectors and metadata in your chosen vector database. To migrate, extract memories using the respective `retrieve` methods, transform the data format to match the target system's structure, and re-record using `record_to_memory` (for ReMe) or `record` (for Mem0). Note that ReMe's automatic summarization will process re-inserted Mem0 data as new entries rather than preserving original embeddings.