repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: OpenClaw |
| #3 | --- |
| #4 | |
| #5 | Add long-term memory to [OpenClaw](https://github.com/openclaw/openclaw) agents with the `@mem0/openclaw-mem0` plugin. Your agent forgets everything between sessions — this plugin fixes that by automatically watching conversations, extracting what matters, and bringing it back when relevant. |
| #6 | |
| #7 | ## Overview |
| #8 | |
| #9 | <Frame> |
| #10 | <img src="/images/openclaw-architecture.png" alt="OpenClaw Mem0 Architecture" /> |
| #11 | </Frame> |
| #12 | |
| #13 | The plugin provides: |
| #14 | 1. **Auto-Recall** — Before the agent responds, memories matching the current message are injected into context |
| #15 | 2. **Auto-Capture** — After the agent responds, the exchange is sent to Mem0 which decides what's worth keeping |
| #16 | 3. **Agent Tools** — Five tools for explicit memory operations during conversations |
| #17 | |
| #18 | Both auto-recall and auto-capture run silently with no manual configuration required. |
| #19 | |
| #20 | ## Installation |
| #21 | |
| #22 | ```bash |
| #23 | openclaw plugins install @mem0/openclaw-mem0 |
| #24 | ``` |
| #25 | |
| #26 | ## Setup and Configuration |
| #27 | |
| #28 | ### Understanding `userId` |
| #29 | |
| #30 | The `userId` field is a **string you choose** to uniquely identify the user whose memories are being stored. It is **not** something you look up in the Mem0 dashboard — you define it yourself. |
| #31 | |
| #32 | Pick any stable, unique identifier for the user. Common choices: |
| #33 | |
| #34 | - Your application's internal user ID (e.g. `"user_123"`, `"alice@example.com"`) |
| #35 | - A UUID (e.g. `"550e8400-e29b-41d4-a716-446655440000"`) |
| #36 | - A simple username (e.g. `"alice"`) |
| #37 | |
| #38 | All memories are scoped to this `userId` — different values create separate memory namespaces. If you don't set it, it defaults to `"default"`, which means all users share the same memory space. |
| #39 | |
| #40 | <Tip>In a multi-user application, set `userId` dynamically per user (e.g. from your auth system) rather than hardcoding a single value.</Tip> |
| #41 | |
| #42 | ### Platform Mode (Mem0 Cloud) |
| #43 | |
| #44 | <Note>Get your API key from [app.mem0.ai](https://app.mem0.ai).</Note> |
| #45 | |
| #46 | Add to your `openclaw.json`: |
| #47 | |
| #48 | ```json5 |
| #49 | // plugins.entries |
| #50 | "openclaw-mem0": { |
| #51 | "enabled": true, |
| #52 | "config": { |
| #53 | "apiKey": "${MEM0_API_KEY}", |
| #54 | "userId": "alice" // any unique identifier you choose for this user |
| #55 | } |
| #56 | } |
| #57 | ``` |
| #58 | |
| #59 | ### Open-Source Mode (Self-hosted) |
| #60 | |
| #61 | No Mem0 key needed. Requires `OPENAI_API_KEY` for default embeddings/LLM. |
| #62 | |
| #63 | ```json5 |
| #64 | "openclaw-mem0": { |
| #65 | "enabled": true, |
| #66 | "config": { |
| #67 | "mode": "open-source", |
| #68 | "userId": "alice" // any unique identifier you choose for this user |
| #69 | } |
| #70 | } |
| #71 | ``` |
| #72 | |
| #73 | Sensible defaults work out of the box. To customize the embedder, vector store, or LLM: |
| #74 | |
| #75 | ```json5 |
| #76 | "config": { |
| #77 | "mode": "open-source", |
| #78 | "userId": "your-user-id", |
| #79 | "oss": { |
| #80 | "embedder": { "provider": "openai", "config": { "model": "text-embedding-3-small" } }, |
| #81 | "vectorStore": { "provider": "qdrant", "config": { "host": "localhost", "port": 6333 } }, |
| #82 | "llm": { "provider": "openai", "config": { "model": "gpt-4o" } } |
| #83 | } |
| #84 | } |
| #85 | ``` |
| #86 | |
| #87 | All `oss` fields are optional. See [Mem0 OSS docs](/open-source/node-quickstart) for available providers. |
| #88 | |
| #89 | ## Short-term vs Long-term Memory |
| #90 | |
| #91 | Memories are organized into two scopes: |
| #92 | |
| #93 | - **Session (short-term)** — Auto-capture stores memories scoped to the current session via Mem0's `run_id` / `runId` parameter. These are contextual to the ongoing conversation. |
| #94 | |
| #95 | - **User (long-term)** — The agent can explicitly store long-term memories using the `memory_store` tool (with `longTerm: true`, the default). These persist across all sessions for the user. |
| #96 | |
| #97 | During **auto-recall**, the plugin searches both scopes and presents them separately — long-term memories first, then session memories — so the agent has full context. |
| #98 | |
| #99 | ## Agent Tools |
| #100 | |
| #101 | The agent gets five tools it can call during conversations: |
| #102 | |
| #103 | | Tool | Description | |
| #104 | |------|-------------| |
| #105 | | `memory_search` | Search memories by natural language | |
| #106 | | `memory_list` | List all stored memories for a user | |
| #107 | | `memory_store` | Explicitly save a fact | |
| #108 | | `memory_get` | Retrieve a memory by ID | |
| #109 | | `memory_forget` | Delete by ID or by query | |
| #110 | |
| #111 | The `memory_search` and `memory_list` tools accept a `scope` parameter (`"session"`, `"long-term"`, or `"all"`) to control which memories are queried. The `memory_store` tool accepts a `longTerm` boolean (default: `true`) to choose where to store. |
| #112 | |
| #113 | ## CLI Commands |
| #114 | |
| #115 | ```bash |
| #116 | # Search all memories (long-term + session) |
| #117 | openclaw mem0 search "what languages does the user know" |
| #118 | |
| #119 | # Search only long-term memories |
| #120 | openclaw mem0 search "what languages does the user know" --scope long-term |
| #121 | |
| #122 | # Search only session/short-term memories |
| #123 | openclaw mem0 search "what languages does the user know" --scope session |
| #124 | |
| #125 | # View stats |
| #126 | openclaw mem0 stats |
| #127 | ``` |
| #128 | |
| #129 | ## Configuration Options |
| #130 | |
| #131 | ### General Options |
| #132 | |
| #133 | | Key | Type | Default | Description | |
| #134 | |-----|------|---------|-------------| |
| #135 | | `mode` | `"platform"` \| `"open-source"` | `"platform"` | Which backend to use | |
| #136 | | `userId` | `string` | `"default"` | Scope memories per user | |
| #137 | | `autoRecall` | `boolean` | `true` | Inject memories before each turn | |
| #138 | | `autoCapture` | `boolean` | `true` | Store facts after each turn | |
| #139 | | `topK` | `number` | `5` | Max memories per recall | |
| #140 | | `searchThreshold` | `number` | `0.3` | Min similarity (0–1) | |
| #141 | |
| #142 | ### Platform Mode Options |
| #143 | |
| #144 | | Key | Type | Default | Description | |
| #145 | |-----|------|---------|-------------| |
| #146 | | `apiKey` | `string` | — | **Required.** Mem0 API key (supports `${MEM0_API_KEY}`) | |
| #147 | | `orgId` | `string` | — | Organization ID | |
| #148 | | `projectId` | `string` | — | Project ID | |
| #149 | | `enableGraph` | `boolean` | `false` | Entity graph for relationships | |
| #150 | | `customInstructions` | `string` | *(built-in)* | Extraction rules — what to store, how to format | |
| #151 | | `customCategories` | `object` | *(12 defaults)* | Category name → description map for tagging | |
| #152 | |
| #153 | ### Open-Source Mode Options |
| #154 | |
| #155 | | Key | Type | Default | Description | |
| #156 | |-----|------|---------|-------------| |
| #157 | | `customPrompt` | `string` | *(built-in)* | Extraction prompt for memory processing | |
| #158 | | `oss.embedder.provider` | `string` | `"openai"` | Embedding provider (`"openai"`, `"ollama"`, etc.) | |
| #159 | | `oss.embedder.config` | `object` | — | Provider config: `apiKey`, `model`, `baseURL` | |
| #160 | | `oss.vectorStore.provider` | `string` | `"memory"` | Vector store (`"memory"`, `"qdrant"`, `"chroma"`, etc.) | |
| #161 | | `oss.vectorStore.config` | `object` | — | Provider config: `host`, `port`, `collectionName`, `dimension` | |
| #162 | | `oss.llm.provider` | `string` | `"openai"` | LLM provider (`"openai"`, `"anthropic"`, `"ollama"`, etc.) | |
| #163 | | `oss.llm.config` | `object` | — | Provider config: `apiKey`, `model`, `baseURL`, `temperature` | |
| #164 | | `oss.historyDbPath` | `string` | — | SQLite path for memory edit history | |
| #165 | |
| #166 | Everything inside `oss` is optional — defaults use OpenAI embeddings (`text-embedding-3-small`), in-memory vector store, and OpenAI LLM. |
| #167 | |
| #168 | ## Key Features |
| #169 | |
| #170 | 1. **Zero Configuration** — Auto-recall and auto-capture work out of the box with no prompting required |
| #171 | 2. **Dual Memory Scopes** — Session-scoped short-term and user-scoped long-term memories |
| #172 | 3. **Flexible Backend** — Use Mem0 Cloud for managed service or self-host with open-source mode |
| #173 | 4. **Rich Tool Suite** — Five agent tools for explicit memory operations when needed |
| #174 | |
| #175 | ## Conclusion |
| #176 | |
| #177 | The `@mem0/openclaw-mem0` plugin gives OpenClaw agents persistent memory with minimal setup. Whether using Mem0 Cloud or self-hosting, your agents can now remember user preferences, facts, and context across sessions automatically. |
| #178 | |
| #179 | <CardGroup cols={2}> |
| #180 | <Card title="OpenAI Agents SDK" icon="robot" href="/integrations/openai-agents-sdk"> |
| #181 | Build agents with OpenAI's SDK and Mem0 |
| #182 | </Card> |
| #183 | <Card title="LangGraph Integration" icon="diagram-project" href="/integrations/langgraph"> |
| #184 | Create stateful agent workflows with memory |
| #185 | </Card> |
| #186 | </CardGroup> |
| #187 |