← Back to Plugins
Tools

Mem0 Lite

5p00kyy By 5p00kyy 👁 6 views ▲ 0 votes

Capture-only Mem0 plugin for OpenClaw. Runs alongside QMD/memory-core without slot conflicts.

GitHub

Configuration Example

{
  "mem0-lite": {
    "enabled": true,
    "config": {
      "mode": "open-source",
      "userId": "alice",
      "autoCapture": true,
      "sessionFilter": ":direct:",
      "oss": {
        "vectorStore": {
          "provider": "qdrant",
          "config": { "host": "localhost", "port": 6333 }
        }
      }
    }
  }
}

README

# openclaw-mem0-lite

**Capture-only Mem0 plugin for OpenClaw.** Runs alongside `memory-core` or QMD without slot conflicts.

## Why?

The official `openclaw-mem0` plugin claims the `memory` slot, which means you can't run it alongside QMD or `memory-core`. You have to choose one or the other.

This plugin only does **background capture** — the part that catches things the agent forgets to write to files. Your primary memory engine (QMD, `memory-core`, etc.) stays in charge of search and retrieval.

Think of it as a safety net: QMD is the brain, Qdrant is the insurance.

**Related issues:**
- [mem0ai/mem0#4126](https://github.com/mem0ai/mem0/issues/4126) — per-agent memory configuration
- [openclaw/openclaw#38417](https://github.com/openclaw/openclaw/issues/38417) — per-agent plugin slot overrides

## Features

- **Auto-capture only** — stores key facts to Qdrant/Mem0 after each agent turn
- **Session filtering** — only captures from DM sessions by default. Avoids Discord group contamination, cron noise, and sub-agent junk
- **No slot conflict** — uses `kind: "general"`, not `kind: "memory"`. QMD/memory-core stays your search engine
- **No auto-recall** — doesn't inject memories into context (that's QMD's job)
- **No tools registered** — doesn't expose `memory_search`/`memory_store` (that's QMD's job)
- **CLI** — `openclaw mem0-lite stats` and `openclaw mem0-lite search <query>`
- **Both modes** — works with Mem0 Platform (cloud) and open-source (self-hosted Qdrant)

## Install

```bash
# Copy to extensions directory
cp -r openclaw-mem0-lite ~/.openclaw/extensions/

# If using open-source mode, copy the vendor directory from openclaw-mem0:
cp -r ~/.openclaw/extensions/openclaw-mem0/vendor ~/.openclaw/extensions/openclaw-mem0-lite/
cp -r ~/.openclaw/extensions/openclaw-mem0/node_modules ~/.openclaw/extensions/openclaw-mem0-lite/

# Add to config
openclaw config set plugins.allow '["...your-existing-plugins...", "mem0-lite"]' --strict-json
openclaw config set plugins.entries.mem0-lite.enabled true --strict-json
openclaw config set plugins.entries.mem0-lite.config.userId '"your-user-id"' --strict-json

# Restart gateway
openclaw gateway restart
```

## Configuration

Add to `openclaw.json` under `plugins.entries`:

```json
{
  "mem0-lite": {
    "enabled": true,
    "config": {
      "mode": "open-source",
      "userId": "alice",
      "autoCapture": true,
      "sessionFilter": ":direct:",
      "oss": {
        "vectorStore": {
          "provider": "qdrant",
          "config": { "host": "localhost", "port": 6333 }
        }
      }
    }
  }
}
```

### Config options

| Key | Default | Description |
|-----|---------|-------------|
| `mode` | `"open-source"` | `"platform"` for Mem0 cloud, `"open-source"` for self-hosted |
| `userId` | `"default"` | User ID for scoping memories |
| `autoCapture` | `true` | Enable/disable capture |
| `sessionFilter` | `":direct:"` | Only capture from sessions whose key contains this string. Empty string = capture everything |
| `customInstructions` | _(built-in)_ | Natural language rules for what Mem0 should store/exclude |
| `apiKey` | — | Mem0 Platform API key (platform mode only) |
| `oss` | — | Open-source config: embedder, vectorStore, llm |

### Session filter examples

| Filter | Captures from |
|--------|--------------|
| `":direct:"` | DM sessions only (default) |
| `":direct:6988897209"` | Only DMs with a specific user |
| `""` | All sessions (no filtering) |
| `"telegram"` | Only Telegram sessions |
| `"discord"` | Only Discord sessions |

## How it works

After each agent turn, the plugin:

1. Checks if the session key matches the filter (default: DMs only)
2. Extracts the last 10 messages from the conversation
3. Skips heartbeat acks, NO_REPLY, and injected memory context
4. Sends to Mem0/Qdrant for fact extraction and storage

That's it. No search injection, no tool registration, no slot claiming.

## Architecture

```
User message → Agent processes → Agent responds
                                       ↓
                              mem0-lite captures
                              (if session matches filter)
                                       ↓
                              Qdrant stores facts
                                       ↓
                              Dream cycle / manual review
                              promotes to files, prunes junk
```

Your memory stack:
- **QMD / memory-core** — primary search, auto-recall, file indexing
- **LCM** — conversation history DAG
- **mem0-lite** — background capture safety net

## CLI

```bash
openclaw mem0-lite stats           # Memory count, config info
openclaw mem0-lite search "query"  # Search captured memories
```

## FAQ

**Why not just use the official mem0 plugin?**
It claims the `memory` slot. You can't run it alongside QMD. If you want QMD's hybrid search (BM25 + vector + reranking + temporal decay) AND Mem0's auto-capture, you need both — which is what this plugin enables.

**Will this capture Discord group messages?**
Not by default. The `sessionFilter` defaults to `":direct:"` which only captures DM sessions. Discord groups, cron jobs, and sub-agents are excluded.

**Does this inject memories into the agent's context?**
No. That's QMD's job. This plugin is write-only.

**Do I need Qdrant running?**
For open-source mode, yes. `docker run -d -p 6333:6333 qdrant/qdrant` is enough.

## License

MIT
tools

Comments

Sign in to leave a comment

Loading comments...