npm package: @maximem/memory-plugin
Description: Maximem memory plugin for OpenClaw (formrely ClawdBot and MoltBot) with auto recall and capture
Author: Maximem
Latest version: 0.3.1

# Maximem Memory Plugin for OpenClaw / MoltBot

```bash
npm install @maximem/memory-plugin
```

OpenClaw plugin and MoltBot plugin for persistent cross-channel memory. Uses the Maximem backend for auto recall and auto capture: **before_agent_start** the plugin recalls relevant memories; at **agent_end** it captures conversation context.

## Features

- **Auto-Recall**: Automatically injects relevant memories before each LLM turn
- **Auto-Capture**: Automatically stores conversation context after each turn
- **Slash Commands**: `/remember` and `/recall` for direct memory interaction
- **OpenClaw Agent**: `maximem_store`, `maximem_search`, `maximem_forget` for agent-driven memory operations
- **CLI Commands**: Terminal-based memory management with `openclaw maximem`
- **Cross-Channel**: Memories persist across Telegram, Slack, WhatsApp, Discord, and all supported channels

## How it works

- `before_agent_start` → recall (inject relevant memories into context)
- `agent_end` → capture (store conversation context)

## API Key

Get your [API key](https://app.maximem.ai) from Maximem AI.


## Installation

### From npm

```bash
openclaw plugins install @maximem/memory-plugin
```

### Verify Installation

```bash
openclaw plugins list
openclaw plugins info memory-plugin
openclaw plugins doctor
```

## Configuration

## Option 1: Environment Variable (Recommended)

### macOS/Linux (zsh)
```
echo 'export MAXIMEM_API_KEY="mx_..."' >> ~/.zshrc
source ~/.zshrc
```

### macOS/Linux (bash)
```  
echo 'export MAXIMEM_API_KEY="mx_..."' >> ~/.bashrc
source ~/.bashrc
```
### Windows PowerShell
```
[System.Environment]::SetEnvironmentVariable("MAXIMEM_API_KEY", "mx_...", "User")
```

## Option 2: Config File

Edit `~/.openclaw/openclaw.json`:

```json
{
  "plugins": {
    "entries": {
      "memory-plugin": {
        "enabled": true,
        "config": {
          "apiKey": "mx_...",
          "autoRecall": true,
          "autoCapture": true,
          "maxRecallTokens": 1000,
          "minPromptLength": 5,
          "captureDebounceMs": 2000
        }
      }
    }
  },
  "agents": {
    "list": [{
      "id": "main",
      "tools": {
        "allow": ["maximem_store", "maximem_search", "maximem_forget"]
      }
    }]
  }
}
```

### Configuration Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `apiKey` | string | - | Maximem API key (or set `MAXIMEM_API_KEY` env var) |
| `autoRecall` | boolean | `true` | Automatically inject memories before each turn |
| `autoCapture` | boolean | `true` | Automatically capture conversation after each turn |
| `maxRecallTokens` | number | `1000` | Maximum tokens for recalled memory context (100-10000) |
| `minPromptLength` | number | `5` | Minimum prompt length to trigger recall |
| `captureDebounceMs` | number | `2000` | Debounce window for batching captures (milliseconds) |

## Usage

### Slash Commands

Use these commands directly in any supported chat channel (Whatsapp, Slack, etc.):

#### `/remember [text]`

Manually save information to long-term memory:

```
/remember My favorite programming language is TypeScript
/remember I prefer dark themes for all applications
/remember Project deadline is March 15, 2026
```

#### `/recall [query]`

Search your long-term memory:

```
/recall favorite programming language
/recall project deadline
/recall preferences
```

### CLI Commands

Manage memories from the terminal:

#### Search Memories

```bash
openclaw maximem search "favorite color"
openclaw maximem search "deadlines" --limit 20
openclaw maximem search "preferences" --category preference --json
```

<!-- Options:
- `-l, --limit <n>` - Maximum results (default: 10)
- `-c, --category <cat>` - Filter by category
- `--json` - Output as JSON -->

<!-- #### View Statistics

```bash
openclaw maximem stats
``` -->

<!-- #### Wipe All Memories

```bash
# Dry run (preview only)
openclaw maximem wipe --dry-run

# With confirmation prompt
openclaw maximem wipe

# Skip confirmation
openclaw maximem wipe --yes
``` -->

### OpenClaw Agent

Enable tools in your agent configuration to let the Agent use memory operations:

```json
{
  "agents": {
    "list": [{
      "id": "main",
      "tools": {
        "allow": ["maximem_store", "maximem_search", "maximem_forget"]
      }
    }]
  }
}
```

The Agent can then autonomously:
- **Store** important facts when users share information
- **Search** memories when answering questions about past conversations
- **Forget** specific memories when requested

<!-- ## How It Works

### Auto-Recall Flow

1. User sends a message
2. **Before** the LLM processes it, the plugin queries Maximem for relevant memories
3. Memories are injected into the context as XML-tagged content
4. LLM responds with awareness of past conversations

### Auto-Capture Flow

1. User and LLM have a conversation
2. **After** the LLM responds, the plugin sends the conversation to Maximem
3. Maximem extracts memory-worthy facts and stores them
4. Future conversations can recall this information -->

## Support

- **Documentation**: [memoryplugin-for-openclaw.com](memoryplugin-for-openclaw.com)

- **Issues**: [GitHub Issues](https://github.com/gauravmaximem/moltbot-memory-plugin-maximem/issues)
- **Email**: shreyansh.g@maximem.ai