{"_id":"@tablestore/openclaw-mem0","_rev":"5634330-69b8d660da10b426ea079d4b","dist-tags":{"latest":"0.8.7"},"name":"@tablestore/openclaw-mem0","time":{"created":"2026-03-17T04:19:44.424Z","modified":"2026-06-06T04:56:37.791Z","0.8.3":"2026-04-01T14:34:26.094Z","0.8.4":"2026-04-22T12:24:51.417Z","0.8.5":"2026-05-13T02:40:14.257Z","0.8.6":"2026-05-13T08:34:35.328Z","0.8.7":"2026-06-02T02:21:01.879Z"},"versions":{"0.8.3":{"name":"@tablestore/openclaw-mem0","version":"0.8.3","type":"module","description":"Mem0 memory backend for OpenClaw with Alibaba Cloud Tablestore vector store","license":"Apache-2.0","keywords":["openclaw","plugin","memory","mem0","long-term-memory","tablestore","vector-store"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"test":"vitest run","pack":"bash ../shell/build-plugin.sh"},"dependencies":{"@sinclair/typebox":"0.34.47","mem0ai":"^2.2.1","tablestore":"^5.6.0","@alicloud/tablestore20201209":"^1.0.0","@alicloud/openapi-client":"^0.4.0","@alicloud/tea-util":"^1.4.0","@alicloud/ots20160620":"^1.0.0","@alicloud/credentials":"^2.4.2"},"openclaw":{"extensions":["./index.ts"]},"devDependencies":{"vitest":"^4.0.18"},"_id":"@tablestore/openclaw-mem0@0.8.3","bundleDependencies":["mem0ai","tablestore","@alicloud/tablestore20201209","@alicloud/openapi-client","@alicloud/tea-util","@alicloud/ots20160620","@alicloud/credentials"],"_integrity":"sha512-vZAG77fxw4Bt4K+wMuEl5CSCRE4FXKo1UdqFfdMp0KliE68nh8VE+uqujWYX7OCglNZQm7q6ZRkdXL3ulFk+mw==","_resolved":"/root/mem0-tablestore/openclaw/tablestore-openclaw-mem0-0.8.3.tgz","_from":"file:tablestore-openclaw-mem0-0.8.3.tgz","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-vZAG77fxw4Bt4K+wMuEl5CSCRE4FXKo1UdqFfdMp0KliE68nh8VE+uqujWYX7OCglNZQm7q6ZRkdXL3ulFk+mw==","shasum":"e1e538f0d010160303980092ea3d85bf5adf3144","tarball":"https://registry.npmmirror.com/@tablestore/openclaw-mem0/-/openclaw-mem0-0.8.3.tgz","fileCount":7014,"unpackedSize":74020284,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCWQntkZalr5xsj8mMYpx1INyF/z/NI+eymyfmtyxq/7QIgJGlUjo1MrMznSAxb80kPvaNg/LMQ5W9WK/xtQhFcbdQ="}],"size":12874118},"_npmUser":{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},"directories":{},"maintainers":[{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-mem0_0.8.3_1775054065542_0.6409807978705866"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-04-01T14:34:26.094Z","publish_time":1775054066094,"_source_registry_name":"default"},"0.8.4":{"name":"@tablestore/openclaw-mem0","version":"0.8.4","type":"module","description":"Mem0 memory backend for OpenClaw with Alibaba Cloud Tablestore vector store","license":"Apache-2.0","keywords":["openclaw","plugin","memory","mem0","long-term-memory","tablestore","vector-store"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"test":"vitest run","pack":"bash ../shell/build-plugin.sh"},"dependencies":{"@sinclair/typebox":"0.34.47","mem0ai":"^2.2.1","tablestore":"^5.6.0","@alicloud/tablestore20201209":"^1.0.0","@alicloud/openapi-client":"^0.4.0","@alicloud/tea-util":"^1.4.0","@alicloud/ots20160620":"^1.0.0","@alicloud/credentials":"^2.4.2"},"openclaw":{"extensions":["./index.ts"]},"devDependencies":{"vitest":"^4.0.18"},"_id":"@tablestore/openclaw-mem0@0.8.4","bundleDependencies":["mem0ai","tablestore","@alicloud/tablestore20201209","@alicloud/openapi-client","@alicloud/tea-util","@alicloud/ots20160620","@alicloud/credentials"],"_integrity":"sha512-u4p5NRiNTqw64cBkSz5tLiJq9oFsHIBeLt8WtZoCWFDTDfhZHZBpb79hVf03iVgm9RJ1bSLrr+xBsLcmd7J48g==","_resolved":"/root/tablestore-openclaw-mem0-0.8.4.tgz","_from":"file:tablestore-openclaw-mem0-0.8.4.tgz","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-u4p5NRiNTqw64cBkSz5tLiJq9oFsHIBeLt8WtZoCWFDTDfhZHZBpb79hVf03iVgm9RJ1bSLrr+xBsLcmd7J48g==","shasum":"a86105174ddc5b2fe8799d018209d0f42359721e","tarball":"https://registry.npmmirror.com/@tablestore/openclaw-mem0/-/openclaw-mem0-0.8.4.tgz","fileCount":4833,"unpackedSize":62231758,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCL1nkNa2S7k5FrPOypgD7e1tfwunuUWz6t8cLjiQ3M+AIgCetzhxBDje5n8ioJgkZZGEBjVTS7pY7t0x7tnK/2bzM="}],"size":10090878},"_npmUser":{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},"directories":{},"maintainers":[{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-mem0_0.8.4_1776860690630_0.7393994101799481"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-04-22T12:24:51.417Z","publish_time":1776860691417,"_source_registry_name":"default"},"0.8.5":{"name":"@tablestore/openclaw-mem0","version":"0.8.5","type":"module","description":"Mem0 memory backend for OpenClaw with Alibaba Cloud Tablestore vector store","license":"Apache-2.0","keywords":["openclaw","plugin","memory","mem0","long-term-memory","tablestore","vector-store"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"test":"vitest run","pack":"bash ../shell/build-plugin.sh"},"dependencies":{"@sinclair/typebox":"0.34.47","mem0ai":"^2.2.1","tablestore":"^5.6.0","@alicloud/tablestore20201209":"^1.0.0","@alicloud/openapi-client":"^0.4.0","@alicloud/tea-util":"^1.4.0","@alicloud/ots20160620":"^1.0.0","@alicloud/credentials":"^2.4.2"},"openclaw":{"extensions":["./index.ts"]},"devDependencies":{"vitest":"^4.0.18"},"_id":"@tablestore/openclaw-mem0@0.8.5","bundleDependencies":["mem0ai","tablestore","@alicloud/tablestore20201209","@alicloud/openapi-client","@alicloud/tea-util","@alicloud/ots20160620","@alicloud/credentials"],"_integrity":"sha512-GvS8Nwfj25EG4t1TEAVfQ1acw0k4zqyVlxXLNWT+83rHJL5WGzYTb5qj2Jq4U/2fzru6wbisp7ZHsO4zo2bouA==","_resolved":"/apsarapangu/disk2/mem0-tablestore/openclaw/tablestore-openclaw-mem0-0.8.5.tgz","_from":"file:tablestore-openclaw-mem0-0.8.5.tgz","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-GvS8Nwfj25EG4t1TEAVfQ1acw0k4zqyVlxXLNWT+83rHJL5WGzYTb5qj2Jq4U/2fzru6wbisp7ZHsO4zo2bouA==","shasum":"f1c531029aefff06d18488914ec1c90270886a2c","tarball":"https://registry.npmmirror.com/@tablestore/openclaw-mem0/-/openclaw-mem0-0.8.5.tgz","fileCount":7055,"unpackedSize":74269506,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCycZG5H7GuQbxpEO1JD22k4+1OPUNAGazKE4Rm3SxJqAIgD/6hjz8IJ0epi1WAbMIFncTu7TMs0t2X2qDA7WJGMz8="}],"size":12931946},"_npmUser":{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},"directories":{},"maintainers":[{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},{"name":"yiche.lx","email":"yiche.lx@alibaba-inc.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-mem0_0.8.5_1778640013708_0.7864506588171059"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-05-13T02:40:14.257Z","publish_time":1778640014257,"_source_registry_name":"default"},"0.8.6":{"name":"@tablestore/openclaw-mem0","version":"0.8.6","type":"module","description":"Mem0 memory backend for OpenClaw with Alibaba Cloud Tablestore vector store","license":"Apache-2.0","keywords":["openclaw","plugin","memory","mem0","long-term-memory","tablestore","vector-store"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"test":"vitest run","pack":"bash ../shell/build-plugin.sh"},"dependencies":{"mem0ai":"^2.2.1","tablestore":"^5.6.0","@alicloud/tablestore20201209":"^1.0.0","@alicloud/openapi-client":"^0.4.0","@alicloud/tea-util":"^1.4.0","@alicloud/ots20160620":"^1.0.0","@alicloud/credentials":"^2.4.2"},"openclaw":{"extensions":["./index.js"]},"devDependencies":{"@sinclair/typebox":"0.34.47","esbuild":"^0.27.7","vitest":"^4.0.18"},"_id":"@tablestore/openclaw-mem0@0.8.6","bundleDependencies":["mem0ai","tablestore","@alicloud/tablestore20201209","@alicloud/openapi-client","@alicloud/tea-util","@alicloud/ots20160620","@alicloud/credentials"],"gitHead":"77cb72512f078517799d6cf4dafe78b16d414873","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-5QwRqfdyDPcrWEG4hcjMmB3KVpSQlxbm6wND4FUaR32ViC/XN3NjzFnMlmZz17XqotFbBNjcSKNWtzja+FZExw==","shasum":"eaf9ff870687a06ac92d0154065cf6622661ae8e","tarball":"https://registry.npmmirror.com/@tablestore/openclaw-mem0/-/openclaw-mem0-0.8.6.tgz","fileCount":2884,"unpackedSize":44054959,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHp7rC+Cei8QhzLvivWDo5jMLEycgULpdttfoA93IrCXAiEAu2U5XXh1s3HaAlFnIzHyj6DRCwRvwqIGN5n79YVFJ3o="}],"size":6876176},"_npmUser":{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},"directories":{},"maintainers":[{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},{"name":"yiche.lx","email":"yiche.lx@alibaba-inc.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-mem0_0.8.6_1778661274863_0.5038650306422301"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-05-13T08:34:35.328Z","publish_time":1778661275328,"_source_registry_name":"default"},"0.8.7":{"name":"@tablestore/openclaw-mem0","version":"0.8.7","type":"module","description":"Mem0 memory backend for OpenClaw with Alibaba Cloud Tablestore vector store","license":"Apache-2.0","keywords":["openclaw","plugin","memory","mem0","long-term-memory","tablestore","vector-store"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"test":"vitest run","pack":"bash ../shell/build-plugin.sh"},"dependencies":{"mem0ai":"^2.2.1","tablestore":"^5.6.0","@alicloud/tablestore20201209":"^1.0.0","@alicloud/openapi-client":"^0.4.0","@alicloud/tea-util":"^1.4.0","@alicloud/ots20160620":"^1.0.0","@alicloud/credentials":"^2.4.2"},"openclaw":{"extensions":["./index.js"]},"devDependencies":{"@sinclair/typebox":"0.34.47","esbuild":"^0.27.7","vitest":"^4.0.18"},"_id":"@tablestore/openclaw-mem0@0.8.7","bundleDependencies":["mem0ai","tablestore","@alicloud/tablestore20201209","@alicloud/openapi-client","@alicloud/tea-util","@alicloud/ots20160620","@alicloud/credentials"],"_integrity":"sha512-FsC0+9mlRLF4IOUH9mADZXO5vV3k0USEfoCvxaLaZOH3BxHk6eY+WIwqlkLxrOKKBGO36a+v/Bzs194MpXlQYQ==","_resolved":"/apsarapangu/disk2/mem0-tablestore/openclaw/tablestore-openclaw-mem0-0.8.7.tgz","_from":"file:/apsarapangu/disk2/mem0-tablestore/openclaw/tablestore-openclaw-mem0-0.8.7.tgz","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-FsC0+9mlRLF4IOUH9mADZXO5vV3k0USEfoCvxaLaZOH3BxHk6eY+WIwqlkLxrOKKBGO36a+v/Bzs194MpXlQYQ==","shasum":"35123bf88ccfe58ec0859a69113013113af56391","tarball":"https://registry.npmmirror.com/@tablestore/openclaw-mem0/-/openclaw-mem0-0.8.7.tgz","fileCount":2885,"unpackedSize":44072083,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCtZsYseEKnSgl3zWXnArBZtp4CJQY0IHVTWdrYskxvnwIgBkLHnytUvNdFRqO2Xgo2LlLLxK+78QThQjpchSi+V28="}],"size":6880719},"_npmUser":{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},"directories":{},"maintainers":[{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},{"name":"yiche.lx","email":"yiche.lx@alibaba-inc.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-mem0_0.8.7_1780366861547_0.747615322249265"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-06-02T02:21:01.879Z","publish_time":1780366861879,"_source_registry_name":"default"}},"description":"Mem0 memory backend for OpenClaw with Alibaba Cloud Tablestore vector store","keywords":["openclaw","plugin","memory","mem0","long-term-memory","tablestore","vector-store"],"license":"Apache-2.0","maintainers":[{"name":"nashiluoyuji","email":"nashiluoyuji@gmail.com"},{"name":"yiche.lx","email":"yiche.lx@alibaba-inc.com"}],"readme":"# @tablestore/openclaw-mem0\n\nLong-term memory for [OpenClaw](https://github.com/openclaw/openclaw) agents, powered by [Mem0](https://mem0.ai) with Alibaba Cloud Tablestore as the vector store backend.\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## What's New in 0.8.6\n\n- Reduce the plugin tarball size by pruning dev-only files from bundled dependencies, including unused Tablestore SDK samples, source maps, tests, TypeScript sources, and bundled protobuf CLI files.\n\n## What's New in 0.8.5\n\n- Agent-specific Tablestore tables now use the configured `tableName` as the base. For example, `tableName: \"custom_memories\"` with `agentId: \"researcher\"` writes to `custom_memories_agent_researcher`.\n- Long or invalid agent/table name combinations fall back to a deterministic, Tablestore-safe 32-character table name.\n\n## What's New in 0.8.4\n\n- Add `captureFilterPrompt` so auto-capture and explicit `memory_store` calls can use a narrower extraction prompt without replacing the plugin's global default prompt.\n- Add `recallFilterPrompt` in open-source mode so the plugin can decide whether recall is needed and optionally rewrite the search query before memory lookup.\n- Expose `generateResponse()` on the bundled OSS `Memory` class so the plugin can evaluate recall filters with the configured Mem0 LLM.\n- Preserve the current `0.8.3` Tablestore compatibility fixes, per-agent table isolation, batch embedding, and fire-and-forget capture path while porting the prompt-filter feature.\n- Keep the build flow on plain `npm install --ignore-scripts` and ignore `.pnpm-store/` artifacts.\n\n## What's New in 0.8.3\n\n- Add `legacyMemoryCompatibility` for Tablestore to support the legacy-memory-compatible row layout with `[document_id, tenant_id]`, string embeddings, and `payload_source` / `payload` / `text` columns.\n- Fail fast when an existing table uses a different primary key shape than the selected schema mode.\n- Downgrade exact-match filters to `payload` term queries when reusing old mem0 Python search indexes that do not expose `meta_*` fields.\n- Pass `embeddingDims` to OpenAI-compatible embedding requests so DashScope/OpenAI/Azure dimensions stay aligned with the configured Tablestore index dimension.\n- Keep plugin builds unminified to avoid the runtime regressions seen in minified Tablestore/OpenAPI bundles.\n\n## How it works\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### Prompt filters\n\nTwo optional prompt-filter settings let you customize capture and recall without replacing the whole plugin configuration:\n\n- `captureFilterPrompt` narrows what gets extracted during auto-capture and explicit `memory_store` calls.\n- `recallFilterPrompt` runs before auto-recall in open-source mode and returns JSON telling the plugin whether to search and what query to search for.\n\nExample:\n\n```json5\n\"openclaw-mem0\": {\n  \"enabled\": true,\n  \"config\": {\n    \"mode\": \"open-source\",\n    \"userId\": \"alice\",\n    \"captureFilterPrompt\": \"Only store durable user preferences, project facts, and explicit follow-up commitments.\",\n    \"recallFilterPrompt\": \"Recall memory only when the latest user message depends on past preferences, identity, or active project context. Return JSON with should_recall and query.\"\n  }\n}\n```\n\nNotes:\n\n- In platform mode, `captureFilterPrompt` overrides `customInstructions` for add/capture calls.\n- `recallFilterPrompt` is currently evaluated only in open-source mode. Platform mode logs a warning and falls back to the normal recall path.\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**Tablestore table isolation:**\n\nIn open-source mode with the Tablestore vector store, agent-scoped memories use a dedicated physical table. The table name is built from the configured `oss.vectorStore.config.tableName`:\n\n```\n<tableName>_agent_<agentId>\n```\n\nFor example, `tableName: \"custom_memories\"` and `agentId: \"researcher\"` uses `custom_memories_agent_researcher`. If the combined name would violate Tablestore table-name limits, the plugin uses a deterministic hash suffix while preserving as much of the configured base table name as possible.\n\n## Setup\n\n```bash\nopenclaw plugins install @tablestore/openclaw-mem0@0.8.6\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### Open-Source with Alibaba Cloud Tablestore\n\nUse [Alibaba Cloud Tablestore](https://www.alibabacloud.com/product/table-store) as a persistent, serverless vector store. No external vector database to manage.\n\n#### Minimal configuration (auto-create Tablestore instance)\n\nIf you don't have an existing Tablestore instance, omit `endpoint` and `instanceName` — the plugin will **automatically create** a new Tablestore VCU instance in `cn-hangzhou` on first use:\n\n```json5\n\"openclaw-mem0\": {\n  \"enabled\": true,\n  \"config\": {\n    \"mode\": \"open-source\",\n    \"userId\": \"alice\",\n    \"oss\": {\n      \"vectorStore\": {\n        \"provider\": \"tablestore\",\n        \"config\": {\n          \"accessKeyId\": \"${ALIBABA_CLOUD_ACCESS_KEY_ID}\",\n          \"accessKeySecret\": \"${ALIBABA_CLOUD_ACCESS_KEY_SECRET}\"\n        }\n      }\n    }\n  }\n}\n```\n\n#### Minimal configuration (with existing Tablestore instance)\n\nIf you already have a Tablestore instance, provide `endpoint` and `instanceName`:\n\n```json5\n\"openclaw-mem0\": {\n  \"enabled\": true,\n  \"config\": {\n    \"mode\": \"open-source\",\n    \"userId\": \"alice\",\n    \"oss\": {\n      \"vectorStore\": {\n        \"provider\": \"tablestore\",\n        \"config\": {\n          \"endpoint\": \"https://your-instance.cn-hangzhou.ots.aliyuncs.com\",\n          \"instanceName\": \"your-instance-name\",\n          \"accessKeyId\": \"${ALIBABA_CLOUD_ACCESS_KEY_ID}\",\n          \"accessKeySecret\": \"${ALIBABA_CLOUD_ACCESS_KEY_SECRET}\",\n          \"tableName\": \"mem0_vectors\",       // optional, default: \"mem0_vectors\"\n          \"indexName\": \"mem0_vectors_index\",  // optional, default: \"<tableName>_index\"\n          \"dimension\": 1536,                  // optional, must match your embedding model\n          \"legacyMemoryCompatibility\": true   // optional, default: false\n        }\n      }\n    }\n  }\n}\n```\n\n#### Full configuration with Alibaba Cloud Bailian (DashScope)\n\nUse Alibaba Cloud Bailian (DashScope) for both embeddings and LLM, eliminating the need for an OpenAI API key:\n\n```json5\n\"openclaw-mem0\": {\n  \"enabled\": true,\n  \"config\": {\n    \"mode\": \"open-source\",\n    \"userId\": \"alice\",\n    \"oss\": {\n      \"embedder\": {\n        \"provider\": \"openai\",\n        \"config\": {\n          \"apiKey\": \"${DASHSCOPE_API_KEY}\",\n          \"model\": \"text-embedding-v3\",\n          \"baseURL\": \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n          \"embeddingDims\": 1024\n        }\n      },\n      \"vectorStore\": {\n        \"provider\": \"tablestore\",\n        \"config\": {\n          // endpoint and instanceName are optional — omit to auto-create a new instance\n          \"endpoint\": \"https://your-instance.cn-hangzhou.ots.aliyuncs.com\",\n          \"instanceName\": \"your-instance-name\",\n          \"accessKeyId\": \"${ALIBABA_CLOUD_ACCESS_KEY_ID}\",\n          \"accessKeySecret\": \"${ALIBABA_CLOUD_ACCESS_KEY_SECRET}\",\n          \"dimension\": 1024\n        }\n      },\n      \"llm\": {\n        \"provider\": \"openai\",\n        \"config\": {\n          \"apiKey\": \"${DASHSCOPE_API_KEY}\",\n          \"model\": \"qwen-plus\",\n          \"baseURL\": \"https://dashscope.aliyuncs.com/compatible-mode/v1\"\n        }\n      }\n    }\n  }\n}\n```\n\n> **Note:** DashScope's `text-embedding-v3` model outputs 1024-dimensional vectors by default. Make sure the `dimension` in the Tablestore config matches your embedding model's output dimension.\n\nWhen `legacyMemoryCompatibility` is enabled, the plugin writes rows in the legacy-memory-compatible Tablestore layout:\n- Primary key: `[document_id, tenant_id]`\n- Fixed `tenant_id`: `\"__default\"`\n- `embedding` stored as a JSON string instead of binary\n- `payload_source`, `payload`, and `text` columns are written alongside the existing `meta_*` filter columns\n- When reusing older mem0 Python-managed search indexes that do not have `meta_*` filter fields, exact-match filters are downgraded to `payload` match queries over the stored `key=value` terms; range filters still require the `meta_*` fields to exist\n\nThe switch is off by default. Existing installations keep using the current single-primary-key schema unless you opt in.\n\nRecommended usage:\n- Enable it only for new tables, or point `tableName` to a fresh table\n- If the target table already exists with the old primary key layout, keep the switch off or use a different `tableName`\n- This switch changes the table primary key shape; the plugin does not auto-migrate existing Tablestore tables\n\nThe Tablestore provider automatically creates the data table and search index on first use. The search index includes a VECTOR field for cosine-similarity KNN search and KEYWORD fields for metadata filtering (`user_id`, `agent_id`, `run_id`, etc.).\n\n#### Building and installing the plugin\n\nSince the Tablestore provider is bundled into a custom build of `mem0ai`, you need to build the plugin from source:\n\n```bash\n# 1. Clone the repo and build the plugin tgz\ncd mem0-tablestore\nbash shell/build-plugin.sh\n\n# 2. Install on any machine (no npm registry needed)\ncd openclaw\nopenclaw plugins install ./tablestore-openclaw-mem0-0.8.6.tgz\n\n# 3. Rebuild native addons (required for better-sqlite3)\ncd ~/.openclaw/extensions/openclaw-mem0\nnpm rebuild better-sqlite3\n\n# 4. Restart the gateway to load the new plugin\nopenclaw gateway restart\n```\n\nThe build script bundles the modified `mem0ai` and the `tablestore` SDK into the plugin package, so end-users do not need to install any extra dependencies.\n\n#### Troubleshooting\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `Cannot read properties of null (reading 'QueryType')` | Tablestore SDK failed to load in the runtime environment | Check that `tablestore` is in `node_modules`. Run `node -e \"console.log(require('tablestore').QueryType)\"` in the plugin directory to verify. |\n| `401 Incorrect API key provided` | Embedding requests are being sent to OpenAI instead of DashScope | Ensure `baseURL` is set in the embedder config (e.g. `\"baseURL\": \"https://dashscope.aliyuncs.com/compatible-mode/v1\"`). |\n| `Could not locate the bindings file` (better-sqlite3) | Native addon not compiled for the current platform | Run `cd ~/.openclaw/extensions/openclaw-mem0 && npm rebuild better-sqlite3`. |\n| `OTSObjectNotExist` on first use | Normal — the table/index is being created | Wait 5-10 seconds and retry. The provider auto-creates tables on first `initialize()`. |\n| Plugin not loading after install | openclaw config not updated | Ensure `openclaw.json` has `\"openclaw-mem0\"` in `plugins.allow` and `plugins.slots.memory`. Restart gateway after config changes. |\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.5` | 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| `captureFilterPrompt` | `string` | — | Optional per-call capture prompt. Overrides `customInstructions` for add/capture calls |\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| `captureFilterPrompt` | `string` | — | Optional per-call extraction prompt for auto-capture and `memory_store` |\n| `recallFilterPrompt` | `string` | — | Optional LLM gate for auto-recall. Open-source mode only |\n| `oss.embedder.provider` | `string` | `\"openai\"` | Embedding provider (`\"openai\"`, `\"ollama\"`, etc.) |\n| `oss.embedder.config` | `object` | — | Provider config: `apiKey`, `model`, `baseURL`, `embeddingDims` |\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### Tablestore vector store config\n\nWhen using `\"provider\": \"tablestore\"` (or `\"aliyun_tablestore\"`), the following config keys are available:\n\n| Key | Type | Default | |\n|-----|------|---------|---|\n| `endpoint` | `string` | — | Optional. Tablestore instance endpoint URL. If omitted, a new instance is auto-created. |\n| `instanceName` | `string` | — | Optional. Tablestore instance name. If omitted, a new instance is auto-created. |\n| `accessKeyId` | `string` | — | Alibaba Cloud AccessKey ID. Required unless `roleName` is set. (supports `${ALIBABA_CLOUD_ACCESS_KEY_ID}`) |\n| `accessKeySecret` | `string` | — | Alibaba Cloud AccessKey Secret. Required unless `roleName` is set. (supports `${ALIBABA_CLOUD_ACCESS_KEY_SECRET}`) |\n| `roleName` | `string` | — | ECS RAM Role name for automatic credential retrieval. When set, `accessKeyId` and `accessKeySecret` are fetched from the ECS metadata service and refreshed automatically before expiration. (supports `${TABLESTORE_ROLE_NAME}`) |\n| `stsToken` | `string` | — | Optional STS token for temporary credentials |\n| `regionId` | `string` | — | Region ID (e.g. `\"cn-hangzhou\"`). Required when auto-provisioning. (supports `${TABLESTORE_REGION_ID}`) |\n| `tableName` | `string` | `\"mem0_vectors\"` | Data table name |\n| `indexName` | `string` | `\"<tableName>_index\"` | Search index name |\n| `dimension` | `number` | `1536` | Vector dimension (must match your embedding model) |\n| `legacyMemoryCompatibility` | `boolean` | `false` | Use the legacy-memory-compatible row schema with dual primary key, `tenant_id=\"__default\"`, string embeddings, and `payload_source/payload/text` columns. Older mem0 Python indexes missing `meta_*` fields fall back to exact-match `payload` term queries |\n\n#### Authentication modes\n\nThe plugin supports two authentication modes:\n\n**1. AccessKey (static credentials)**\n\nProvide `accessKeyId` and `accessKeySecret` directly in the config or via environment variables. Suitable for development or non-ECS environments.\n\n**2. ECS RAM Role (automatic, recommended for ECS)**\n\nSet `roleName` to the name of the RAM role attached to your ECS instance. The plugin will automatically fetch temporary STS credentials from the ECS metadata service (`http://100.100.100.200/latest/meta-data/ram/security-credentials/{roleName}`), cache them, and refresh before expiration. No AccessKey needed in the config.\n\n```json5\n\"vectorStore\": {\n  \"provider\": \"tablestore\",\n  \"config\": {\n    \"roleName\": \"EcsRamRoleForTablestore\"\n    // No accessKeyId or accessKeySecret needed\n  }\n}\n```\n\nEnvironment variable: `TABLESTORE_ROLE_NAME`\n\n## License\n\nApache 2.0\n","_source_registry_name":"default"}