{"_id":"@adbm-ai/openclaw-mem0","name":"@adbm-ai/openclaw-mem0","dist-tags":{"latest":"0.3.2"},"versions":{"0.3.2":{"name":"@adbm-ai/openclaw-mem0","version":"0.3.2","type":"module","description":"Mem0 memory backend for OpenClaw — platform or self-hosted open-source","license":"Apache-2.0","keywords":["openclaw","plugin","memory","mem0","long-term-memory"],"scripts":{"test":"vitest run"},"dependencies":{"@sinclair/typebox":"0.34.47","@adbm-ai/mem0ai":"^2.3.2"},"openclaw":{"extensions":["./index.ts"]},"devDependencies":{"vitest":"^4.0.18"},"publishConfig":{"access":"public"},"_id":"@adbm-ai/openclaw-mem0@0.3.2","gitHead":"349d93c7fedfdbec754166871de3daf3ce1e9a41","_nodeVersion":"20.20.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-XCeikIuitfqZmKuN+VPUBNqopinoMJ4lIeU+apK0lrXjNqq/oz3YVcpdVQ71A0mMnJ1z/mLWV2+2KMsilQyAyw==","shasum":"b4b9623d54ba662bf7f658e050bc57fc0d1bb1dc","tarball":"https://registry.npmjs.org/@adbm-ai/openclaw-mem0/-/openclaw-mem0-0.3.2.tgz","fileCount":6,"unpackedSize":73147,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDHyenCgTOH7LCoI0OppeqLYz1/Ss++xSGS9Rxc1p2QrgIhAJTXQ0YRuJyECr/PdtjOs5DcV7j+HQ0hsOX5c3ztRbMn"}]},"_npmUser":{"name":"adb-storage-m","email":"haojielin964@gmail.com"},"directories":{},"maintainers":[{"name":"adb-storage-m","email":"haojielin964@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-mem0_0.3.2_1773655451769_0.3266895164860799"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-16T10:04:11.691Z","0.3.2":"2026-03-16T10:04:11.918Z","modified":"2026-03-16T10:04:12.145Z"},"maintainers":[{"name":"adb-storage-m","email":"haojielin964@gmail.com"}],"description":"Mem0 memory backend for OpenClaw — platform or self-hosted open-source","keywords":["openclaw","plugin","memory","mem0","long-term-memory"],"license":"Apache-2.0","readme":"# @mem0/openclaw-mem0\n\nLong-term memory for [OpenClaw](https://github.com/openclaw/openclaw) agents, powered by [Mem0](https://mem0.ai).\n\nYour agent forgets everything between sessions. This plugin fixes that. It watches conversations, extracts what matters, and brings it back when relevant — automatically.\n\n## How it works\n\n<p align=\"center\">\n  <img src=\"../docs/images/openclaw-architecture.png\" alt=\"Architecture\" width=\"800\" />\n</p>\n\n**Auto-Recall** — Before the agent responds, the plugin searches Mem0 for memories that match the current message and injects them into context.\n\n**Auto-Capture** — After the agent responds, the plugin sends the exchange to Mem0. Mem0 decides what's worth keeping — new facts get stored, stale ones updated, duplicates merged.\n\nBoth run silently. No prompting, no configuration, no manual calls.\n\n### Short-term vs long-term memory\n\nMemories are organized into two scopes:\n\n- **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 and automatically recalled alongside long-term memories.\n\n- **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.\n\nDuring **auto-recall**, the plugin searches both scopes and presents them separately — long-term memories first, then session memories — so the agent has full context.\n\nThe agent tools (`memory_search`, `memory_list`) 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.\n\nAll new parameters are optional and backward-compatible — existing configurations work without changes.\n\n### Per-agent memory isolation\n\nIn multi-agent setups, each agent automatically gets its own memory namespace. Session keys following the pattern `agent:<agentId>:<uuid>` are parsed to derive isolated namespaces (`${userId}:agent:${agentId}`). Single-agent deployments are unaffected — plain session keys and `agent:main:*` keys resolve to the configured `userId`.\n\n**How it works:**\n\n- The agent's session key is inspected on every recall/capture cycle\n- If the key matches `agent:<name>:<uuid>`, memories are stored under `userId:agent:<name>`\n- Different agents never see each other's memories unless explicitly queried\n\n**Explicit cross-agent queries:**\n\nAll memory tools (`memory_search`, `memory_store`, `memory_list`, `memory_forget`) accept an optional `agentId` parameter to query another agent's namespace:\n\n```\nmemory_search({ query: \"user's tech stack\", agentId: \"researcher\" })\n```\n\nResolution priority: explicit `agentId` > explicit `userId` > session-derived > configured default.\n\n## Setup\n\n```bash\nopenclaw plugins install @mem0/openclaw-mem0\n```\n\n### Understanding `userId`\n\nThe `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.\n\nPick any stable, unique identifier for the user. Common choices:\n\n- Your application's internal user ID (e.g. `\"user_123\"`, `\"alice@example.com\"`)\n- A UUID (e.g. `\"550e8400-e29b-41d4-a716-446655440000\"`)\n- A simple username (e.g. `\"alice\"`)\n\nAll 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.\n\n> **Tip:** In a multi-user application, set `userId` dynamically per user (e.g. from your auth system) rather than hardcoding a single value.\n\n### Platform (Mem0 Cloud)\n\nGet an API key from [app.mem0.ai](https://app.mem0.ai), then add to your `openclaw.json`:\n\n```json5\n// plugins.entries\n\"openclaw-mem0\": {\n  \"enabled\": true,\n  \"config\": {\n    \"apiKey\": \"${MEM0_API_KEY}\",\n    \"userId\": \"alice\"  // any unique identifier you choose for this user\n  }\n}\n```\n\n### Open-Source (Self-hosted)\n\nNo Mem0 key needed. Requires `OPENAI_API_KEY` for default embeddings/LLM.\n\n```json5\n\"openclaw-mem0\": {\n  \"enabled\": true,\n  \"config\": {\n    \"mode\": \"open-source\",\n    \"userId\": \"alice\"  // any unique identifier you choose for this user\n  }\n}\n```\n\nSensible defaults out of the box. To customize the embedder, vector store, or LLM:\n\n```json5\n\"config\": {\n  \"mode\": \"open-source\",\n  \"userId\": \"your-user-id\",\n  \"oss\": {\n    \"embedder\": { \"provider\": \"openai\", \"config\": { \"model\": \"text-embedding-3-small\" } },\n    \"vectorStore\": { \"provider\": \"qdrant\", \"config\": { \"host\": \"localhost\", \"port\": 6333 } },\n    \"llm\": { \"provider\": \"openai\", \"config\": { \"model\": \"gpt-4o\" } }\n  }\n}\n```\n\nAll `oss` fields are optional. See [Mem0 OSS docs](https://docs.mem0.ai/open-source/node-quickstart) for providers.\n\n## Agent tools\n\nThe agent gets five tools it can call during conversations:\n\n| Tool | Description |\n|------|-------------|\n| `memory_search` | Search memories by natural language. Optional `agentId` to scope to a specific agent. |\n| `memory_list` | List all stored memories for a user. Optional `agentId` to scope to a specific agent. |\n| `memory_store` | Explicitly save a fact. Optional `agentId` to store under a specific agent's namespace. |\n| `memory_get` | Retrieve a memory by ID |\n| `memory_forget` | Delete by ID or by query. Optional `agentId` to scope deletion to a specific agent. |\n\n## CLI\n\n```bash\n# Search all memories (long-term + session)\nopenclaw mem0 search \"what languages does the user know\"\n\n# Search only long-term memories\nopenclaw mem0 search \"what languages does the user know\" --scope long-term\n\n# Search only session/short-term memories\nopenclaw mem0 search \"what languages does the user know\" --scope session\n\n# Stats\nopenclaw mem0 stats\n\n# Search a specific agent's memories\nopenclaw mem0 search \"user preferences\" --agent researcher\n\n# Stats for a specific agent\nopenclaw mem0 stats --agent researcher\n```\n\n## Options\n\n### General\n\n| Key | Type | Default | |\n|-----|------|---------|---|\n| `mode` | `\"platform\"` \\| `\"open-source\"` | `\"platform\"` | Which backend to use |\n| `userId` | `string` | `\"default\"` | Any unique identifier you choose for the user (e.g. `\"alice\"`, `\"user_123\"`). All memories are scoped to this value. Not found in any dashboard — you define it yourself. |\n| `autoRecall` | `boolean` | `true` | Inject memories before each turn |\n| `autoCapture` | `boolean` | `true` | Store facts after each turn |\n| `topK` | `number` | `5` | Max memories per recall |\n| `searchThreshold` | `number` | `0.3` | Min similarity (0–1) |\n\n### Platform mode\n\n| Key | Type | Default | |\n|-----|------|---------|---|\n| `apiKey` | `string` | — | **Required.** Mem0 API key (supports `${MEM0_API_KEY}`) |\n| `orgId` | `string` | — | Organization ID |\n| `projectId` | `string` | — | Project ID |\n| `enableGraph` | `boolean` | `false` | Entity graph for relationships |\n| `customInstructions` | `string` | *(built-in)* | Extraction rules — what to store, how to format |\n| `customCategories` | `object` | *(12 defaults)* | Category name → description map for tagging |\n\n### Open-source mode\n\nWorks with zero extra config. The `oss` block lets you swap out any component:\n\n| Key | Type | Default | |\n|-----|------|---------|---|\n| `customPrompt` | `string` | *(built-in)* | Extraction prompt for memory processing |\n| `oss.embedder.provider` | `string` | `\"openai\"` | Embedding provider (`\"openai\"`, `\"ollama\"`, etc.) |\n| `oss.embedder.config` | `object` | — | Provider config: `apiKey`, `model`, `baseURL` |\n| `oss.vectorStore.provider` | `string` | `\"memory\"` | Vector store (`\"memory\"`, `\"qdrant\"`, `\"chroma\"`, etc.) |\n| `oss.vectorStore.config` | `object` | — | Provider config: `host`, `port`, `collectionName`, `dimension` |\n| `oss.llm.provider` | `string` | `\"openai\"` | LLM provider (`\"openai\"`, `\"anthropic\"`, `\"ollama\"`, etc.) |\n| `oss.llm.config` | `object` | — | Provider config: `apiKey`, `model`, `baseURL`, `temperature` |\n| `oss.historyDbPath` | `string` | — | SQLite path for memory edit history |\n\nEverything inside `oss` is optional — defaults use OpenAI embeddings (`text-embedding-3-small`), in-memory vector store, and OpenAI LLM. Override only what you need.\n\n## License\n\nApache 2.0\n","readmeFilename":"README.md","_rev":"1-654b79bc4a00e0ee59a9fdb1878ff9b4"}