{"_id":"@cr7258/memory-elasticsearch","_rev":"3-8c44b416fcf95f288f13903bb5d601e5","name":"@cr7258/memory-elasticsearch","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@cr7258/memory-elasticsearch","version":"0.0.1","license":"Apache-2.0","_id":"@cr7258/memory-elasticsearch@0.0.1","maintainers":[{"name":"cr7258","email":"chengzw258@163.com"}],"dist":{"shasum":"24ede665a6f42213044f8816833b04eff19ec3e7","tarball":"https://registry.npmjs.org/@cr7258/memory-elasticsearch/-/memory-elasticsearch-0.0.1.tgz","fileCount":7,"integrity":"sha512-ISRaviK8N1wYQB45L+ZFFOn0r/mRhVHfSAud++eTNxMBoZCs+EVf8Vdb9e4nwn7KGCdu6F4S74zVRLVg6t8wNA==","signatures":[{"sig":"MEUCIQDmhCbrVhD6xkvlucVO5HUgJYZM1ZdfTz+QJ/eQCnuHMAIgKjA06uKXvYBQKK0vnpNEvyVKqfjxCcKXrb2pCKiHyWM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":219395},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"50f0b58803ee81fc20d5dc81982307cbb16e697b","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"cr7258","email":"chengzw258@163.com"},"openclaw":{"build":{"openclawVersion":"2026.5.27"},"compat":{"pluginApi":">=2026.4.24","minGatewayVersion":">=2026.4.24"},"install":{"npmSpec":"@cr7258/memory-elasticsearch"},"extensions":["./dist/index.js"]},"_npmVersion":"10.9.4","description":"Elasticsearch-backed long-term memory plugin for OpenClaw with BM25 + vector hybrid retrieval.","directories":{},"_nodeVersion":"22.22.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","vitest":"^4.0.18","typescript":"^5.8.3","@types/node":"^22.15.0"},"_npmOperationalInternal":{"tmp":"tmp/memory-elasticsearch_0.0.1_1780367016618_0.6954835848877168","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@cr7258/memory-elasticsearch","version":"0.0.2","license":"Apache-2.0","_id":"@cr7258/memory-elasticsearch@0.0.2","maintainers":[{"name":"cr7258","email":"chengzw258@163.com"}],"dist":{"shasum":"099b44ac4176ffe04cde7671c5574b08960644d6","tarball":"https://registry.npmjs.org/@cr7258/memory-elasticsearch/-/memory-elasticsearch-0.0.2.tgz","fileCount":7,"integrity":"sha512-tR3my+tm5+xJmc0mqoXPo/IJJUQl5XD9H1lXBncLzMZSP8HRm1vaONHv1TKt5fApHU+b9phzUqJUz1UaiVIpuQ==","signatures":[{"sig":"MEYCIQChoPQN3cHGqqzvN3X0mrtNkvXHTPxFraBiGvsUt3K5bQIhAK70F7XhWKjnSXGN+Z4noWaJaICb1V3OROuCPCFbIczt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":213624},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"4982a31ef16877d992e0665aed8075295bec7cbf","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"cr7258","email":"chengzw258@163.com"},"openclaw":{"build":{"openclawVersion":"2026.5.27"},"compat":{"pluginApi":">=2026.4.24","minGatewayVersion":">=2026.4.24"},"install":{"npmSpec":"@cr7258/memory-elasticsearch"},"extensions":["./dist/index.js"]},"_npmVersion":"10.9.4","description":"Elasticsearch-backed long-term memory plugin for OpenClaw with BM25 + vector hybrid retrieval.","directories":{},"_nodeVersion":"22.22.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","vitest":"^4.0.18","typescript":"^5.8.3","@types/node":"^22.15.0"},"_npmOperationalInternal":{"tmp":"tmp/memory-elasticsearch_0.0.2_1780369312597_0.3451278860261242","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@cr7258/memory-elasticsearch","version":"0.0.3","type":"module","description":"Elasticsearch-backed long-term memory plugin for OpenClaw with BM25 + vector hybrid retrieval.","license":"Apache-2.0","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup","test":"vitest run","typecheck":"tsc --noEmit"},"openclaw":{"extensions":["./dist/index.js"],"compat":{"pluginApi":">=2026.4.24","minGatewayVersion":">=2026.4.24"},"build":{"openclawVersion":"2026.5.27"},"install":{"npmSpec":"@cr7258/memory-elasticsearch"}},"devDependencies":{"@types/node":"^22.15.0","tsup":"^8.5.0","typescript":"^5.8.3","vitest":"^4.0.18"},"_id":"@cr7258/memory-elasticsearch@0.0.3","gitHead":"55399e091699c958471aa6981194288818cb13c0","_nodeVersion":"22.22.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-3Rr0TaER42KrKMSATfPKxKe71bsGgcRcMogCb2areQerca+TL8CqgA+AW2SfEntlEmMEsJFM4ayZvoelP06nSQ==","shasum":"9fa92eebf6304e3d42e3933fae89c8fed4b40407","tarball":"https://registry.npmjs.org/@cr7258/memory-elasticsearch/-/memory-elasticsearch-0.0.3.tgz","fileCount":7,"unpackedSize":217553,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDPyJY3lDkEOmU2XtKEV6xJMkWcIdzQBp6D7k7gYQ98vgIhAPF41yncML5KfxAmT8NPxuzpu5UHkNQRgCH/3Skjsdsk"}]},"_npmUser":{"name":"cr7258","email":"chengzw258@163.com"},"directories":{},"maintainers":[{"name":"cr7258","email":"chengzw258@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/memory-elasticsearch_0.0.3_1780376057546_0.21094976243276053"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-02T02:23:36.516Z","modified":"2026-06-02T04:54:17.788Z","0.0.1":"2026-06-02T02:23:36.784Z","0.0.2":"2026-06-02T03:01:52.744Z","0.0.3":"2026-06-02T04:54:17.681Z"},"license":"Apache-2.0","description":"Elasticsearch-backed long-term memory plugin for OpenClaw with BM25 + vector hybrid retrieval.","maintainers":[{"name":"cr7258","email":"chengzw258@163.com"}],"readme":"# memory-elasticsearch\n\nElasticsearch-backed memory plugin for OpenClaw.\n\nIt replaces the active OpenClaw memory slot with an Elasticsearch store that supports:\n\n- automatic memory recall before prompt construction\n- automatic memory capture after agent turns\n- manual memory search, add, list, update, delete, and triage tools\n- OpenAI-compatible LLM and embedding providers\n- app-level hybrid retrieval using vector search plus BM25\n- optional Jina reranking with `jina-reranker-v3`\n\nAll stored memories are persistent memories. The plugin does not split storage into session-scoped and long-term memories.\n\n## Prerequisites\n\n- OpenClaw with plugin support\n- Elasticsearch with `dense_vector` and kNN support\n- an OpenAI-compatible chat model\n- an OpenAI-compatible embedding model\n- optional Jina API key when reranking is enabled\n\nThe embedding model and Elasticsearch index dimensions must match. If you change the embedding model or `embeddingDims`, use a new index or recreate the old one.\n\nFor local development, a single-node Elasticsearch instance is enough:\n\n```bash\ndocker run --name openclaw-memory-es \\\n  -p 9200:9200 \\\n  -e discovery.type=single-node \\\n  -e xpack.security.enabled=false \\\n  docker.elastic.co/elasticsearch/elasticsearch:8.15.5\n```\n\nUse your own secured Elasticsearch URL in production. The plugin supports no auth, API key auth, and basic auth.\n\n## Install\n\nFrom npm:\n\n```bash\nopenclaw plugins install npm:@cr7258/memory-elasticsearch\n```\n\nFrom GitHub:\n\n```bash\nopenclaw plugins install git:github.com/cr7258/memory-elasticsearch@main\n```\n\n## Uninstall\n\nRemove the installed plugin package:\n\n```bash\nopenclaw plugins uninstall memory-elasticsearch\n```\n\nThen restart the gateway:\n\n```bash\nopenclaw gateway restart\n```\n\nUninstalling the plugin does not delete Elasticsearch data. Delete the memory index only when you are sure you no longer need the stored memories:\n\n```bash\ncurl -X DELETE 'http://localhost:9200/openclaw-memory'\n```\n\n## Initialize\n\nRun `init` after the plugin is installed. This command writes plugin config to `~/.openclaw/openclaw.json`, stores provided API keys in `~/.openclaw/.env`, and selects this plugin as the active memory backend.\n\nShared OpenAI-compatible endpoint:\n\n```bash\nexport OPENAI_API_KEY=<your-api-key>\nopenclaw memory-es init \\\n  --base-url https://openrouter.ai/api/v1 \\\n  --api-key $OPENAI_API_KEY \\\n  --llm-model qwen/qwen3.6-plus \\\n  --embedding-model qwen/qwen3-embedding-8b \\\n  --embedding-dims 4096 \\\n  --elasticsearch-url http://localhost:9200 \\\n  --index openclaw-memory\n```\n\nSeparate LLM and embedding endpoints:\n\n```bash\nopenclaw memory-es init \\\n  --llm-base-url https://openrouter.ai/api/v1 \\\n  --llm-api-key <llm-api-key> \\\n  --llm-model qwen/qwen3.6-plus \\\n  --embedding-base-url https://api.openai.com/v1 \\\n  --embedding-api-key <embedding-api-key> \\\n  --embedding-model text-embedding-3-small \\\n  --embedding-dims 1536 \\\n  --elasticsearch-url http://localhost:9200 \\\n  --index openclaw-memory\n```\n\nEnable Jina reranking:\n\n```bash\nopenclaw memory-es init \\\n  --reuse-values \\\n  --reranker \\\n  --reranker-api-key <jina-api-key> \\\n  --reranker-model jina-reranker-v3\n```\n\nDisable Jina reranking while keeping the rest of the current config:\n\n```bash\nopenclaw memory-es init --reuse-values --reranker false\n```\n\nAfter initialization, restart the gateway so the plugin is loaded with the new config:\n\n```bash\nopenclaw gateway restart\n```\n\n## Configuration Written by Init\n\n`init` stores API key references in OpenClaw config and writes the secret values to `~/.openclaw/.env`.\n\nDefault environment variable names:\n\n- `OPENAI_API_KEY`: shared OpenAI-compatible key\n- `OPENAI_LLM_API_KEY`: LLM key when `--llm-api-key` is used\n- `OPENAI_EMBEDDING_API_KEY`: embedding key when `--embedding-api-key` is used\n- `JINA_API_KEY`: Jina reranker key when `--reranker-api-key` is used\n\nMinimal generated config shape:\n\n```json\n{\n  \"plugins\": {\n    \"entries\": {\n      \"memory-elasticsearch\": {\n        \"enabled\": true,\n        \"hooks\": {\n          \"allowConversationAccess\": true\n        },\n        \"config\": {\n          \"userId\": \"alice\",\n          \"autoRecall\": true,\n          \"autoCapture\": true,\n          \"topK\": 5,\n          \"searchThreshold\": 0.05,\n          \"elasticsearch\": {\n            \"url\": \"http://localhost:9200\",\n            \"index\": \"openclaw-memory\"\n          },\n          \"openaiCompatible\": {\n            \"llm\": {\n              \"baseUrl\": \"https://api.openai.com/v1\",\n              \"apiKey\": \"${OPENAI_API_KEY}\",\n              \"model\": \"gpt-4o-mini\"\n            },\n            \"embedding\": {\n              \"baseUrl\": \"https://api.openai.com/v1\",\n              \"apiKey\": \"${OPENAI_API_KEY}\",\n              \"model\": \"text-embedding-3-small\",\n              \"dims\": 1536\n            }\n          },\n          \"search\": {\n            \"mode\": \"hybrid\",\n            \"semanticWeight\": 0.6,\n            \"keywordWeight\": 0.4\n          },\n          \"reranker\": {\n            \"enabled\": false,\n            \"provider\": \"jina\",\n            \"baseUrl\": \"https://api.jina.ai\",\n            \"model\": \"jina-reranker-v3\"\n          }\n        }\n      }\n    },\n    \"slots\": {\n      \"memory\": \"memory-elasticsearch\"\n    }\n  }\n}\n```\n\n## Use Memory from the CLI\n\n```bash\nopenclaw memory-es status\nopenclaw memory-es status --json\n```\n\nSearch memories:\n\n```bash\nopenclaw memory-es search \"what languages does the user know\"\n```\n\nList memories:\n\n```bash\nopenclaw memory-es list\nopenclaw memory-es list --user-id alice --top-k 20\n```\n\nAdd an explicit memory:\n\n```bash\nopenclaw memory-es add \"User prefers Elasticsearch for OpenClaw memory\"\n```\n\nPreview durable memory candidates without storing them:\n\n```bash\nopenclaw memory-es triage \"Remember this: user prefers qwen/qwen3-embedding-8b for embeddings\"\n```\n\nDelete by exact memory ID:\n\n```bash\nopenclaw memory-es delete --memory-id <memory-id>\n```\n\nDelete by query. The plugin searches first and deletes only literal text matches:\n\n```bash\nopenclaw memory-es delete --query \"User prefers Elasticsearch\"\n```\n\nDelete all memories for a user:\n\n```bash\nopenclaw memory-es delete --all --confirm --user-id alice\n```\n\nAny command can return JSON when it supports `--json`:\n\n```bash\nopenclaw memory-es search \"preferences\" --json\nopenclaw memory-es list --json\nopenclaw memory-es status --json\n```\n","readmeFilename":"README.md"}