# r3 Documentation

MCP server for persistent AI memory. Local Redis storage with optional cloud sync.

Quickstart
API reference

## How r3 works

r3 is an MCP server that gives AI applications persistent memory. By default, it uses an embedded Redis server for local storage. No setup required. Optionally add cloud sync with Mem0.

Add r3 to your MCP client's configuration:

```json
{
  "mcpServers": {
    "r3": {
      "command": "npx",
      "args": ["@n3wth/r3"]
    }
  }
}
```

Tell your assistant, “Remember that I prefer TypeScript.” In a later conversation, it can use that preference when recommending a language for your project.

## Architecture

Antigravity CLI → MCP → r3 server → Redis (L1 cache) → Mem0 Cloud (L2 storage).

## Core concepts

### Memories

Each memory contains:

- **Content**: The information to remember
- **User ID**: Who it belongs to
- **Priority**: How important it is (affects caching)
- **Metadata**: Additional context

### Caching layers

1. **L1 (Redis)**: Hot data, 24-hour TTL
2. **L2 (Cloud)**: Permanent storage with vector search

### MCP tools

r3 provides these tools to MCP clients:

- `add_memory`: Store new information
- `search_memory`: Find relevant context
- `get_all_memories`: List all memories
- `delete_memory`: Remove specific memory
- `cache_stats`: Monitor performance

## When to use r3

**Good for:**

- User preferences and settings
- Conversation history
- Facts about users or projects
- Context that should persist

**Not for:**

- Sensitive data (use encryption)
- Large files (use object storage)
- Real-time data (use streaming)

## Get help

- [GitHub Issues](https://github.com/n3wth/r3/issues)

Source: https://r3.n3wth.com/docs/introduction
