{"_id":"@apexlgf/openclaw-mem0-plugin","_rev":"4-2e9bef7a12dbf37cffe70ee87dde1cb2","name":"@apexlgf/openclaw-mem0-plugin","dist-tags":{"latest":"2.1.0"},"versions":{"2.0.0":{"name":"@apexlgf/openclaw-mem0-plugin","version":"2.0.0","keywords":["openclaw","plugin","memory","mem0"],"author":{"name":"xray20161@gmail.com"},"license":"Apache-2.0","_id":"@apexlgf/openclaw-mem0-plugin@2.0.0","maintainers":[{"name":"apexlgf","email":"liuguifeng@gmail.com"}],"homepage":"https://github.com/xRay2016/openclaw-mem0#readme","bugs":{"url":"https://github.com/xRay2016/openclaw-mem0/issues"},"dist":{"shasum":"e9bbe31105a621a269ab0494d92ff30632a4e54c","tarball":"https://registry.npmjs.org/@apexlgf/openclaw-mem0-plugin/-/openclaw-mem0-plugin-2.0.0.tgz","fileCount":37,"integrity":"sha512-SF6TrqxSpHNH70GmE4Jf8rTQO/BzvdUgNDkPYk47FmkSymgTTppEdf7gjzo1623YHvHhXEQuKOdSBJrBnHobqw==","signatures":[{"sig":"MEQCIDH4FAS5DrHNfNUj/iM0GszvR5yMhnCT7Ipd9WqKrKU6AiBGD38DQkdn5LlQt5rCobaxIWYJ+dyO+T1cofmsD7FZQQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":162523},"main":"index.js","type":"module","gitHead":"bc8552c4aeb4d63afa6a95731ff932a0e8e6e3db","moltbot":{"extensions":["./index.ts"]},"scripts":{"test":"node --experimental-vm-modules node_modules/jest/bin/jest.js"},"_npmUser":{"name":"apexlgf","email":"liuguifeng@gmail.com"},"clawdbot":{"extensions":["./index.ts"]},"openclaw":{"extensions":["./index.ts"]},"repository":{"url":"git+https://github.com/xRay2016/openclaw-mem0.git","type":"git"},"_npmVersion":"10.9.4","description":"OpenClaw memory plugin using mem0","directories":{},"_nodeVersion":"22.22.1","dependencies":{"dotenv":"^17.2.4","mem0ai":"^2.2.2","openclaw":"^2026.2.9","@sinclair/typebox":"^0.34.48"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","jest":"^30.2.0","@swc/core":"^1.15.21","@swc/jest":"^0.2.39"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-mem0-plugin_2.0.0_1774874651350_0.8514368279545212","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@apexlgf/openclaw-mem0-plugin","version":"2.0.1","keywords":["openclaw","plugin","memory","mem0"],"author":{"name":"xray20161@gmail.com"},"license":"Apache-2.0","_id":"@apexlgf/openclaw-mem0-plugin@2.0.1","maintainers":[{"name":"apexlgf","email":"liuguifeng@gmail.com"}],"homepage":"https://github.com/xRay2016/openclaw-mem0#readme","bugs":{"url":"https://github.com/xRay2016/openclaw-mem0/issues"},"dist":{"shasum":"a2635bd5d3148c1e5493ecab66ab9199f49d5cbb","tarball":"https://registry.npmjs.org/@apexlgf/openclaw-mem0-plugin/-/openclaw-mem0-plugin-2.0.1.tgz","fileCount":26,"integrity":"sha512-MjV8CBtRIdcCC5FvCLfVLdMJkD88uptmyCegHFyHT+HCViKbYrdbPjeg24vBLYbVmwh3gysVuCa4pIWNqNxJfg==","signatures":[{"sig":"MEQCIGvOVCGGK/eF1CQCIBJam4cgPW3zZUV97Kn/tZxuh+VZAiBVKVuHLih2Yc2ijaLsstOkbWL/ssHLDiwBNYBvNBVW4A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122830},"main":"index.js","type":"module","gitHead":"9b11eb6cab9b99e99059a36a7068f20a46978eed","moltbot":{"extensions":["./index.ts"]},"scripts":{"test":"node --experimental-vm-modules node_modules/jest/bin/jest.js"},"_npmUser":{"name":"apexlgf","email":"liuguifeng@gmail.com"},"clawdbot":{"extensions":["./index.ts"]},"openclaw":{"extensions":["./index.ts"]},"repository":{"url":"git+https://github.com/xRay2016/openclaw-mem0.git","type":"git"},"_npmVersion":"10.9.4","description":"OpenClaw memory plugin using mem0","directories":{},"_nodeVersion":"22.22.1","dependencies":{"dotenv":"^17.2.4","mem0ai":"^2.2.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","jest":"^30.2.0","@swc/core":"^1.15.21","@swc/jest":"^0.2.39"},"peerDependencies":{"openclaw":">=2026.2.0","@sinclair/typebox":">=0.34.0"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-mem0-plugin_2.0.1_1774875905952_0.5609149670336981","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@apexlgf/openclaw-mem0-plugin","version":"2.0.2","keywords":["openclaw","plugin","memory","mem0"],"author":{"name":"xray20161@gmail.com"},"license":"Apache-2.0","_id":"@apexlgf/openclaw-mem0-plugin@2.0.2","maintainers":[{"name":"apexlgf","email":"liuguifeng@gmail.com"}],"homepage":"https://github.com/xRay2016/openclaw-mem0#readme","bugs":{"url":"https://github.com/xRay2016/openclaw-mem0/issues"},"dist":{"shasum":"c3e582d304e3ef7d71de658e1982242b3a8b4987","tarball":"https://registry.npmjs.org/@apexlgf/openclaw-mem0-plugin/-/openclaw-mem0-plugin-2.0.2.tgz","fileCount":26,"integrity":"sha512-p08cIdyFKsc75ClyW+QyaN5L2XZ1RuLgjufUX18rzfO6HDJXrj60nnABFQ+WCIxzMLYwMC9hnj7FRwvrU/x0eA==","signatures":[{"sig":"MEYCIQDzhELSUTph1TuKsbzAb4uTIO+PvZjgC/0cZhNjC/IwCgIhAJFFolx8nI5WQbGmWlJBMoGWpBAJ02EHVq9Bu0FwFIkQ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122830},"main":"index.js","type":"module","gitHead":"0f7aac1fae27a11194711b2cd9dada600394122c","moltbot":{"extensions":["./index.ts"]},"scripts":{"test":"node --experimental-vm-modules node_modules/jest/bin/jest.js"},"_npmUser":{"name":"apexlgf","email":"liuguifeng@gmail.com"},"clawdbot":{"extensions":["./index.ts"]},"openclaw":{"extensions":["./index.ts"]},"repository":{"url":"git+https://github.com/xRay2016/openclaw-mem0.git","type":"git"},"_npmVersion":"10.9.4","description":"OpenClaw memory plugin using mem0","directories":{},"_nodeVersion":"22.22.1","dependencies":{"dotenv":"^17.2.4","mem0ai":"^2.2.2","@sinclair/typebox":"^0.34.48"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","jest":"^30.2.0","@swc/core":"^1.15.21","@swc/jest":"^0.2.39"},"peerDependencies":{"openclaw":">=2026.2.0"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-mem0-plugin_2.0.2_1774876228476_0.965127121467475","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@apexlgf/openclaw-mem0-plugin","version":"2.1.0","description":"OpenClaw memory plugin using mem0","homepage":"https://github.com/xRay2016/openclaw-mem0#readme","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/xRay2016/openclaw-mem0.git"},"main":"index.js","type":"module","scripts":{"test":"node --experimental-vm-modules node_modules/jest/bin/jest.js"},"dependencies":{"@sinclair/typebox":"^0.34.48","dotenv":"^17.2.4","mem0ai":"^2.2.2"},"peerDependencies":{"openclaw":">=2026.2.0"},"keywords":["openclaw","plugin","memory","mem0"],"openclaw":{"extensions":["./index.ts"]},"clawdbot":{"extensions":["./index.ts"]},"moltbot":{"extensions":["./index.ts"]},"author":{"name":"xray20161@gmail.com"},"license":"Apache-2.0","devDependencies":{"@swc/core":"^1.15.21","@swc/jest":"^0.2.39","jest":"^30.2.0","tsx":"^4.21.0"},"_id":"@apexlgf/openclaw-mem0-plugin@2.1.0","gitHead":"a9155f659f6a42baf0422ebd36fa85bddedcc730","bugs":{"url":"https://github.com/xRay2016/openclaw-mem0/issues"},"_nodeVersion":"22.22.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-McuVGJc9PYllmdZewfhMCj3a/qHAWo4Ewz/HWemvWN38DgjcBAoquJNs8j1WDRLV6/vcr8ccUl7DJN6uZJcwjQ==","shasum":"ee8ed49a84a1096e229817c252d6661e016c471b","tarball":"https://registry.npmjs.org/@apexlgf/openclaw-mem0-plugin/-/openclaw-mem0-plugin-2.1.0.tgz","fileCount":28,"unpackedSize":147098,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGsR4RZ1W/bdxqrviTTWiQ7jjLVdPeOyFHe4EbZr1zpyAiEAo6cfOflYeIsMokP1arxnXeNqC0EkDvbah22yrz0CnB8="}]},"_npmUser":{"name":"apexlgf","email":"liuguifeng@gmail.com"},"directories":{},"maintainers":[{"name":"apexlgf","email":"liuguifeng@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-mem0-plugin_2.1.0_1774937933091_0.2971429370814094"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-30T12:44:11.258Z","modified":"2026-03-31T06:18:53.359Z","2.0.0":"2026-03-30T12:44:11.498Z","2.0.1":"2026-03-30T13:05:06.094Z","2.0.2":"2026-03-30T13:10:28.649Z","2.1.0":"2026-03-31T06:18:53.246Z"},"bugs":{"url":"https://github.com/xRay2016/openclaw-mem0/issues"},"author":{"name":"xray20161@gmail.com"},"license":"Apache-2.0","homepage":"https://github.com/xRay2016/openclaw-mem0#readme","keywords":["openclaw","plugin","memory","mem0"],"repository":{"type":"git","url":"git+https://github.com/xRay2016/openclaw-mem0.git"},"description":"OpenClaw memory plugin using mem0","maintainers":[{"name":"apexlgf","email":"liuguifeng@gmail.com"}],"readme":"# OpenClaw Mem0 Plugin\n\n[中文文档](README_zh.md)\n\nThis is an OpenClaw plugin that integrates with [Mem0](https://github.com/mem0ai/mem0) to provide intelligent long-term memory capabilities for your agents.\n\n## Features\n\n- **Auto-Recall**: Automatically searches for relevant past interactions and injects them into the context before the agent starts (`before_agent_start`).\n- **Auto-Capture**: Automatically analyzes conversation turns and stores key information into long-term memory after the agent finishes (`agent_end`).\n- **Hybrid Scope**: Supports both **Session Memory** (short-term, current conversation) and **User Memory** (long-term, cross-conversation).\n- **Dual Mode**: Supports both **Mem0 Platform** (Cloud) and **Open-Source** (Self-hosted) backends.\n- **Three-Layer Memory Architecture**: System knowledge (read-only from file), shared pool (cross-agent), and private namespaces (per-agent) — providing fine-grained memory isolation and sharing.\n- **Volcengine Async Support**: Native support for Volcengine-hosted Mem0 API with async job polling (`checkJobStatus`, `addAndWait`).\n- **Tools**: Provides 5 powerful tools for agents to interact with memory manually:\n  - `memory_search`: Search for specific information.\n  - `memory_store`: Explicitly save important facts (with `scope` for shared/private control).\n  - `memory_get`: Retrieve a specific memory by ID.\n  - `memory_list`: List all memories for a user.\n  - `memory_forget`: Delete specific or matching memories (GDPR compliant).\n\n## Installation\n\nInstall via OpenClaw CLI (npm registry):\n\n```bash\nopenclaw plugins install @apexlgf/openclaw-mem0-plugin\n```\n\n## Configuration\n\nYou can configure the plugin in your `~/.openclaw/openclaw.json`. The API key and host can be obtained from the platform.\n\n### Platform Mode (Recommended)\n\nUse the managed Mem0 Cloud service.\n\n```json\n\"openclaw-mem0-plugin\": {\n    \"enabled\": true,\n    \"config\": {\n        \"mode\": \"platform\",\n        \"apiKey\": \"your-mem0-api-key\",\n        \"userId\": \"openclaw-user\",\n        \"host\": \"https://api.mem0.ai\"\n    }\n}\n```\n\n### Volcengine-Hosted Mem0\n\nFor Volcengine (火山引擎) hosted Mem0 instances, just set the `host` to your Volcengine endpoint. The plugin automatically detects async responses (PENDING status with `event_id`) and handles job polling internally.\n\n```json\n\"openclaw-mem0-plugin\": {\n    \"enabled\": true,\n    \"config\": {\n        \"mode\": \"platform\",\n        \"apiKey\": \"your-volcengine-api-key\",\n        \"userId\": \"openclaw-user\",\n        \"host\": \"https://mem0-xxx.mem0.volces.com:8000\"\n    }\n}\n```\n\n> **Note**: Volcengine API processes memory writes asynchronously. All writes (including auto-capture and `memory_store`) use fire-and-forget mode — the tool returns immediately while the memory is queued for processing (~2-3 minutes). Use `addAndWait()` programmatically if you need confirmation before proceeding.\n\n## Three-Layer Memory Architecture\n\nWhen `agentIsolation` is enabled, the plugin creates a three-layer namespace architecture to manage memory visibility and isolation:\n\n```\n┌─────────────────────────────────────────────────────────┐\n│                    Memory Layers                         │\n├──────────────────┬──────────────────┬────────────────────┤\n│  System Layer    │  Shared Layer    │  Private Layer     │\n│  (system_        │  (pool_shared)   │  (agent_{id}_      │\n│   knowledge)     │                  │   private)         │\n├──────────────────┼──────────────────┼────────────────────┤\n│  Read: All       │  Read: All       │  Read: Owner only  │\n│  Write: File     │  Write: Agents   │  Write: Owner only │\n│         only     │    (scope:       │    (default)       │\n│                  │     \"shared\")    │                    │\n├──────────────────┼──────────────────┼────────────────────┤\n│  Company rules,  │  User profile,   │  Agent-specific    │\n│  SOPs, domain    │  cross-team      │  working context,  │\n│  knowledge       │  decisions       │  domain prefs      │\n└──────────────────┴──────────────────┴────────────────────┘\n```\n\n| Layer | User ID Format | Read | Write | Source |\n|-------|---------------|------|-------|--------|\n| **System** | `system_knowledge` | All agents | File owner only | `systemMemoryFile` config |\n| **Shared** | `pool_shared` | All agents | Agents via `scope: \"shared\"` | `memory_store` tool |\n| **Private** | `agent_{agentId}_private` | Owner agent only | Owner agent only | Default behavior |\n\n### Enabling Multi-Agent Isolation\n\n```json\n\"openclaw-mem0-plugin\": {\n    \"enabled\": true,\n    \"config\": {\n        \"mode\": \"platform\",\n        \"apiKey\": \"your-mem0-api-key\",\n        \"userId\": \"openclaw-user\",\n        \"agentIsolation\": true\n    }\n}\n```\n\n**How it works:**\n- **Writes** go to the agent's private namespace by default (`agent_{agentId}_private`)\n- **Reads** search across all applicable layers (private + shared + system), merge and deduplicate results\n- The `agentId` is automatically extracted from OpenClaw's `sessionKey` (format: `agent:{agentId}:{rest}`)\n- When `agentIsolation: false` (default), all behavior is identical to pre-isolation versions — fully backward compatible\n\n### Writing Shared Memories\n\nAgents can write to the shared layer using the `scope` parameter in `memory_store`:\n\n```\nUser: \"Remember that our company's fiscal year starts in April — all agents should know this.\"\nAgent: calls memory_store({ text: \"Company fiscal year starts in April\", scope: \"shared\" })\n```\n\n- `scope: \"private\"` (default) — only this agent can see it\n- `scope: \"shared\"` — all agents can see it, suitable for user preferences, company facts, cross-agent decisions\n\n### System Memory (Read-Only Knowledge Base)\n\nSystem memory provides a **file-based, read-only** knowledge layer. Contents are loaded from a Markdown file on plugin startup and made available to all agents via vector search — but agents cannot modify it.\n\n#### Configuration\n\n```json\n\"openclaw-mem0-plugin\": {\n    \"enabled\": true,\n    \"config\": {\n        \"mode\": \"platform\",\n        \"apiKey\": \"your-mem0-api-key\",\n        \"userId\": \"openclaw-user\",\n        \"agentIsolation\": true,\n        \"systemMemoryFile\": \"./System_Memory.md\"\n    }\n}\n```\n\n#### File Location\n\nThe path is resolved via OpenClaw's `resolvePath()`, which is **relative to the agent's workspace directory** (where your config file lives):\n\n```\nyour-agent/\n├── openclaw.plugin.json\n├── config.yaml\n├── System_Memory.md        ← place it here\n└── ...\n```\n\nYou can also use an absolute path:\n\n```json\n\"systemMemoryFile\": \"/path/to/shared/System_Memory.md\"\n```\n\n#### File Format\n\nThe file is split into chunks by `## ` (H2) headers for optimal Mem0 ingestion. Each section becomes a separate memory entry.\n\n**Example `System_Memory.md`:**\n\n```markdown\n# Company Knowledge Base\n\n## Company Profile\nAcme Corp was founded in 2020. Headquarters in San Francisco.\nOur mission is to make AI accessible to every business.\nThe fiscal year runs from April 1 to March 31.\n\n## Product Information\nOur main product is AcmeBot, an AI-powered customer service platform.\nPricing: Starter ($29/mo), Professional ($99/mo), Enterprise (custom).\nFree trial: 14 days, no credit card required.\n\n## Customer Service Policies\nRefund window: 30 days from purchase for all plans.\nSLA: 99.9% uptime for Enterprise plans, 99.5% for others.\nSupport hours: Mon-Fri 9am-6pm PST (Enterprise: 24/7).\nEscalation: After 2 failed resolution attempts, escalate to senior support.\n\n## Communication Guidelines\nAlways address customers by name when available.\nUse professional but friendly tone.\nNever share internal pricing or roadmap details.\nFor competitor comparisons, focus on our strengths without disparaging others.\n```\n\n#### How It Works\n\n1. On plugin startup, the file is read and a SHA-256 content hash is computed\n2. The hash is compared against a local cache file (`.System_Memory.md.hash`)\n3. If unchanged — no API calls are made (zero startup cost)\n4. If changed — old system memories are deleted and new content is re-synced to Mem0\n5. All agents automatically search the `system_knowledge` layer during auto-recall and `memory_search`\n\n> **Note**: System memory is **read-only** for agents. To update system knowledge, edit the Markdown file and restart the plugin. The change detection ensures only modified content triggers re-sync.\n\n### Open-Source Mode (Self-Hosted)\n\nConnect to your self-hosted Mem0 instance.\n\n**Note**: You must manually install the `mem0ai` package in your OpenClaw environment, as this dependency is not bundled to keep the plugin lightweight.\n\n```json\n\"openclaw-mem0-plugin\": {\n    \"enabled\": true,\n    \"config\": {\n        \"mode\": \"open-source\",\n        \"oss\": {\n            \"vectorStore\": {\n                \"provider\": \"chroma\",\n                \"config\": {\n                    \"collectionName\": \"memories\",\n                    \"path\": \"./chroma_db\"\n                }\n            }\n        }\n    }\n}\n```\n\n## Usage\n\n### 1. Automatic Memory (Zero-Shot)\nJust enable the plugin. When you chat with your agent:\n- It will automatically \"remember\" facts you shared in previous conversations.\n- It will \"recall\" relevant context when you ask related questions.\n\n### 2. Manual Tools\nYour agents can proactively use tools:\n\n- **User**: \"Please remember that I'm allergic to peanuts.\"\n- **Agent**: Calls `memory_store({ text: \"User is allergic to peanuts\", longTerm: true })`\n\n- **User**: \"What was that book I mentioned last week?\"\n- **Agent**: Calls `memory_search({ query: \"book mentioned last week\", scope: \"long-term\" })`\n\n- **User**: \"Save this as shared knowledge for all agents: our API rate limit is 1000 req/min.\"\n- **Agent**: Calls `memory_store({ text: \"API rate limit is 1000 req/min\", scope: \"shared\" })`\n\n## CLI Commands\n\nThis plugin extends the OpenClaw CLI with memory management commands:\n\n```bash\n# Search memories\nopenclaw mem0 search \"hobbies\"\n\n# Show memory statistics\nopenclaw mem0 stats\n```\n\n## Configuration Reference\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `mode` | `string` | `\"platform\"` | `\"platform\"` or `\"open-source\"` |\n| `apiKey` | `string` | — | Mem0 API key (platform mode) |\n| `host` | `string` | `\"https://api.mem0.ai\"` | Mem0 API endpoint |\n| `userId` | `string` | `\"default\"` | Default user ID for scoping memories |\n| `agentIsolation` | `boolean` | `false` | Enable per-agent memory isolation (three-layer architecture) |\n| `systemMemoryFile` | `string` | — | Path to a Markdown file for system-level knowledge (read-only layer) |\n| `autoRecall` | `boolean` | `true` | Auto-inject memories before agent start |\n| `autoCapture` | `boolean` | `true` | Auto-store memories after agent end |\n| `topK` | `number` | `5` | Max memories to retrieve per search |\n| `searchThreshold` | `number` | `0.5` | Minimum similarity score (0–1) |\n| `enableGraph` | `boolean` | `false` | Enable graph memory (platform only) |\n| `customInstructions` | `string` | — | Natural language rules for what to store/exclude |\n| `customCategories` | `object` | — | Category name → description map for tagging |\n| `oss` | `object` | — | Open-source mode config (embedder, vectorStore, llm) |\n\n## Acknowledgements\n\nThis project is modified from [mem0/openclaw](https://github.com/mem0ai/mem0/tree/main/openclaw).\n\n## License\n\nApache License Version 2.0\n","readmeFilename":"README.md"}