---
name: memu
version: 1.0.10
description: 24/7 Always-On Proactive Memory for AI Agents. Built for long-running use and reduces LLM token cost of keeping agents always online.
homepage: https://memu.bot
repository: https://github.com/NevaMind-AI/memU
metadata: {"emoji":"🧠","category":"memory"}
---

# MemU 🧠

24/7 always-on proactive memory for AI agents.

## Overview

MemU continuously captures and understands user intent without needing explicit commands. It transforms raw interactions into structured, searchable, proactive intelligence.

**Key Features:**
- 🤖 24/7 proactive agent - continuous background monitoring
- 🎯 User intention capture - remembers goals, preferences, context
- 💰 Cost efficient - caches insights, avoids redundant LLM calls
- 🗂️ File-system-like memory - hierarchical, instantly accessible
- 🔄 Cross-references - memories link to each other
- 📥 Persistent & portable - export, backup, transfer like files

## Memory Structure

```
memory/
├── preferences/
│   ├── communication_style.md
│   └── topic_interests.md
├── relationships/
│   ├── contacts/
│   └── interaction_history/
├── knowledge/
│   ├── domain_expertise/
│   └── learned_skills/
└── context/
    ├── recent_conversations/
    └── pending_tasks/
```

## Installation Options

### Option 1: Cloud Version (Recommended for Quick Start)

Use hosted service at https://memu.so - no installation needed!

**API Base URL:** `https://api.memu.so`
**Auth:** `Authorization: Bearer YOUR_API_KEY`

### Option 2: Self-Hosted

Requires Python 3.13+

```bash
# Install from source
git clone https://github.com/NevaMind-AI/memU.git
cd memU
pip install -e .

# Quick test (in-memory)
export OPENAI_API_KEY=your_api_key
cd tests
python test_inmemory.py

# With PostgreSQL (persistent storage)
docker run -d \
  --name memu-postgres \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=memu \
  -p 5432:5432 \
  pgvector/pgvector:pg16
export OPENAI_API_KEY=your_api_key
cd tests
python test_postgres.py
```

## Core APIs

### `memorize()` - Continuous Learning

Processes inputs in real-time and immediately updates memory:

```python
result = await service.memorize(
    resource_url="path/to/file.json",  # File path or URL
    modality="conversation",            # conversation | document | image | video | audio
    user={"user_id": "123"}             # Optional: scope to a user
)
```

### `retrieve()` - Dual-Mode Intelligence

MemU supports both **proactive context loading** and **reactive querying**:

```python
# RAG-based retrieval (fast, proactive context)
result = await service.retrieve(
    queries=[
        {"role": "user", "content": {"text": "What are their preferences?"}},
        {"role": "user", "content": {"text": "Tell me about work habits"}}
    ],
    where={"user_id": "123"},  # Optional: scope filter
    method="rag"  # or "llm" for deeper reasoning
)

# Returns context-aware results:
{
    "categories": [...],     # Relevant topic areas (auto-prioritized)
    "items": [...],          # Specific memory facts
    "resources": [...],      # Original sources for traceability
    "next_step_query": "..." # Predicted follow-up context
}
```

## Proactive Use Cases

### 1. Information Recommendation
Agent monitors interests and proactively surfaces relevant content based on:
- Reading history
- Saved articles
- Search queries

### 2. Email Management
Learns communication patterns and handles routine correspondence:
- Response templates
- Priority contacts
- Scheduling preferences
- Categorization and prioritization

### 3. Trading & Financial Monitoring
Tracks market context and user investment behavior:
- Risk tolerance
- Preferred sectors
- Response patterns to market events
- Portfolio rebalancing triggers

## Custom LLM and Embedding Providers

MemU supports custom providers beyond OpenAI:

```python
from memu import MemUService

service = MemUService(
    llm_profiles={
        "default": {
            "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
            "api_key": "your_api_key",
            "chat_model": "qwen3-max",
        },
        "embedding": {
            "base_url": "https://api.voyageai.com/v1",
            "api_key": "your_voyage_api_key",
            "embed_model": "voyage-3.5-lite"
        }
    }
)
```

## OpenRouter Integration

```python
from memu import MemUService

service = MemUService(
    llm_profiles={
        "default": {
            "provider": "openrouter",
            "client_backend": "httpx",
            "base_url": "https://openrouter.ai",
            "api_key": "your_openrouter_api_key",
            "chat_model": "anthropic/claude-3.5-sonnet",
            "embed_model": "openai/text-embedding-3-small",
        }
    }
)
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `OPENAI_API_KEY` | OpenAI API key |
| `OPENROUTER_API_KEY` | OpenRouter API key |

## Performance

MemU achieves **92.09% average accuracy** on Locomo benchmark.

## Resources

- **API Documentation:** https://memu.pro/docs
- **Cloud Version:** https://app.memu.so
- **GitHub:** https://github.com/NevaMind-AI/memU
- **Discord:** https://discord.gg/memu
