From d96c48fdd1b28b3bf2d6e5a82fd704207e797961 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Sun, 15 Mar 2026 07:17:38 +0800 Subject: [PATCH 01/10] Make binary packages publicly accessible Add publishConfig with public access to darwin-arm64 and win-x64 binary packages. --- examples/@memclaw/bin-darwin-arm64/package.json | 3 +++ examples/@memclaw/bin-win-x64/package.json | 3 +++ 2 files changed, 6 insertions(+) diff --git a/examples/@memclaw/bin-darwin-arm64/package.json b/examples/@memclaw/bin-darwin-arm64/package.json index a89376b..0131c7e 100644 --- a/examples/@memclaw/bin-darwin-arm64/package.json +++ b/examples/@memclaw/bin-darwin-arm64/package.json @@ -2,6 +2,9 @@ "name": "@memclaw/bin-darwin-arm64", "version": "0.1.0", "description": "MemClaw binaries for macOS Apple Silicon", + "publishConfig": { + "access": "public" + }, "os": [ "darwin" ], diff --git a/examples/@memclaw/bin-win-x64/package.json b/examples/@memclaw/bin-win-x64/package.json index dd80f70..9619c88 100644 --- a/examples/@memclaw/bin-win-x64/package.json +++ b/examples/@memclaw/bin-win-x64/package.json @@ -2,6 +2,9 @@ "name": "@memclaw/bin-win-x64", "version": "0.1.0", "description": "MemClaw binaries for Windows x64", + "publishConfig": { + "access": "public" + }, "os": [ "win32" ], From 2ec6b0c7fac675411e0a11e047901bab558fc94b Mon Sep 17 00:00:00 2001 From: Sopaco Date: Sun, 15 Mar 2026 07:47:32 +0800 Subject: [PATCH 02/10] add memclaw for openclaw memory plugin --- examples/{memclaw => @memclaw/plugin}/.gitignore | 0 examples/{memclaw => @memclaw/plugin}/README.md | 0 examples/{memclaw => @memclaw/plugin}/README_zh.md | 0 examples/{memclaw => @memclaw/plugin}/index.ts | 0 examples/{memclaw => @memclaw/plugin}/openclaw.plugin.json | 0 examples/{memclaw => @memclaw/plugin}/package.json | 5 ++++- examples/{memclaw => @memclaw/plugin}/plugin-impl.ts | 0 examples/{memclaw => @memclaw/plugin}/skill/SKILL.md | 0 .../plugin}/skill/references/maintenance.md | 0 .../{memclaw => @memclaw/plugin}/skill/references/setup.md | 0 .../{memclaw => @memclaw/plugin}/skill/references/tools.md | 0 examples/{memclaw => @memclaw/plugin}/src/binaries.ts | 0 examples/{memclaw => @memclaw/plugin}/src/client.ts | 0 examples/{memclaw => @memclaw/plugin}/src/config.ts | 0 examples/{memclaw => @memclaw/plugin}/src/migrate.ts | 0 examples/{memclaw => @memclaw/plugin}/tsconfig.json | 0 16 files changed, 4 insertions(+), 1 deletion(-) rename examples/{memclaw => @memclaw/plugin}/.gitignore (100%) rename examples/{memclaw => @memclaw/plugin}/README.md (100%) rename examples/{memclaw => @memclaw/plugin}/README_zh.md (100%) rename examples/{memclaw => @memclaw/plugin}/index.ts (100%) rename examples/{memclaw => @memclaw/plugin}/openclaw.plugin.json (100%) rename examples/{memclaw => @memclaw/plugin}/package.json (92%) rename examples/{memclaw => @memclaw/plugin}/plugin-impl.ts (100%) rename examples/{memclaw => @memclaw/plugin}/skill/SKILL.md (100%) rename examples/{memclaw => @memclaw/plugin}/skill/references/maintenance.md (100%) rename examples/{memclaw => @memclaw/plugin}/skill/references/setup.md (100%) rename examples/{memclaw => @memclaw/plugin}/skill/references/tools.md (100%) rename examples/{memclaw => @memclaw/plugin}/src/binaries.ts (100%) rename examples/{memclaw => @memclaw/plugin}/src/client.ts (100%) rename examples/{memclaw => @memclaw/plugin}/src/config.ts (100%) rename examples/{memclaw => @memclaw/plugin}/src/migrate.ts (100%) rename examples/{memclaw => @memclaw/plugin}/tsconfig.json (100%) diff --git a/examples/memclaw/.gitignore b/examples/@memclaw/plugin/.gitignore similarity index 100% rename from examples/memclaw/.gitignore rename to examples/@memclaw/plugin/.gitignore diff --git a/examples/memclaw/README.md b/examples/@memclaw/plugin/README.md similarity index 100% rename from examples/memclaw/README.md rename to examples/@memclaw/plugin/README.md diff --git a/examples/memclaw/README_zh.md b/examples/@memclaw/plugin/README_zh.md similarity index 100% rename from examples/memclaw/README_zh.md rename to examples/@memclaw/plugin/README_zh.md diff --git a/examples/memclaw/index.ts b/examples/@memclaw/plugin/index.ts similarity index 100% rename from examples/memclaw/index.ts rename to examples/@memclaw/plugin/index.ts diff --git a/examples/memclaw/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json similarity index 100% rename from examples/memclaw/openclaw.plugin.json rename to examples/@memclaw/plugin/openclaw.plugin.json diff --git a/examples/memclaw/package.json b/examples/@memclaw/plugin/package.json similarity index 92% rename from examples/memclaw/package.json rename to examples/@memclaw/plugin/package.json index d297f76..d587b1d 100644 --- a/examples/memclaw/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,7 +1,10 @@ { - "name": "memclaw", + "name": "@openclaw/memclaw", "version": "0.9.0", "description": "MemClaw - The Cortex Memory' plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", + "publishConfig": { + "access": "public" + }, "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { diff --git a/examples/memclaw/plugin-impl.ts b/examples/@memclaw/plugin/plugin-impl.ts similarity index 100% rename from examples/memclaw/plugin-impl.ts rename to examples/@memclaw/plugin/plugin-impl.ts diff --git a/examples/memclaw/skill/SKILL.md b/examples/@memclaw/plugin/skill/SKILL.md similarity index 100% rename from examples/memclaw/skill/SKILL.md rename to examples/@memclaw/plugin/skill/SKILL.md diff --git a/examples/memclaw/skill/references/maintenance.md b/examples/@memclaw/plugin/skill/references/maintenance.md similarity index 100% rename from examples/memclaw/skill/references/maintenance.md rename to examples/@memclaw/plugin/skill/references/maintenance.md diff --git a/examples/memclaw/skill/references/setup.md b/examples/@memclaw/plugin/skill/references/setup.md similarity index 100% rename from examples/memclaw/skill/references/setup.md rename to examples/@memclaw/plugin/skill/references/setup.md diff --git a/examples/memclaw/skill/references/tools.md b/examples/@memclaw/plugin/skill/references/tools.md similarity index 100% rename from examples/memclaw/skill/references/tools.md rename to examples/@memclaw/plugin/skill/references/tools.md diff --git a/examples/memclaw/src/binaries.ts b/examples/@memclaw/plugin/src/binaries.ts similarity index 100% rename from examples/memclaw/src/binaries.ts rename to examples/@memclaw/plugin/src/binaries.ts diff --git a/examples/memclaw/src/client.ts b/examples/@memclaw/plugin/src/client.ts similarity index 100% rename from examples/memclaw/src/client.ts rename to examples/@memclaw/plugin/src/client.ts diff --git a/examples/memclaw/src/config.ts b/examples/@memclaw/plugin/src/config.ts similarity index 100% rename from examples/memclaw/src/config.ts rename to examples/@memclaw/plugin/src/config.ts diff --git a/examples/memclaw/src/migrate.ts b/examples/@memclaw/plugin/src/migrate.ts similarity index 100% rename from examples/memclaw/src/migrate.ts rename to examples/@memclaw/plugin/src/migrate.ts diff --git a/examples/memclaw/tsconfig.json b/examples/@memclaw/plugin/tsconfig.json similarity index 100% rename from examples/memclaw/tsconfig.json rename to examples/@memclaw/plugin/tsconfig.json From b2400b7c466e1f595869cbfd8b0a0bd83698a6e8 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Sun, 15 Mar 2026 09:41:17 +0800 Subject: [PATCH 03/10] Update package name and installation instructions Change package name from @openclaw/memclaw to @memclaw/plugin Update installation command and file paths accordingly --- examples/@memclaw/plugin/README.md | 36 +++++++++++----- examples/@memclaw/plugin/openclaw.plugin.json | 2 +- examples/@memclaw/plugin/package.json | 4 +- .../@memclaw/plugin/skill/references/setup.md | 43 +------------------ 4 files changed, 30 insertions(+), 55 deletions(-) diff --git a/examples/@memclaw/plugin/README.md b/examples/@memclaw/plugin/README.md index 48fbb3a..2032cc7 100644 --- a/examples/@memclaw/plugin/README.md +++ b/examples/@memclaw/plugin/README.md @@ -59,7 +59,7 @@ OpenClaw + MemClaw Plugin ### Install Plugin ```bash -openclaw plugins install memclaw +openclaw plugins install @memclaw/plugin ``` ### Local Development Installation @@ -69,30 +69,44 @@ For developers who want to use a local version of memclaw or develop the plugin: ```bash # Clone the repository git clone https://github.com/sopaco/cortex-mem.git -cd cortex-mem/examples/memclaw +cd cortex-mem/examples/@memclaw/plugin # Install dependencies bun install # Build the plugin bun run build +``` + +**Option A: Use plugins.load.paths** + +```json +{ + "plugins": { + "load": { + "paths": ["/path/to/cortex-mem/examples/@memclaw/plugin"] + }, + "entries": { + "memclaw": { "enabled": true } + } + } +} +``` + +**Option B: Symlink to extensions directory** -# Create a symlink to the plugin directory -# This makes OpenClaw use your local version -mkdir -p ~/.openclaw/plugins -ln -sf "$(pwd)" ~/.openclaw/plugins/memclaw +```bash +mkdir -p ~/.openclaw/extensions +ln -sf "$(pwd)" ~/.openclaw/extensions/memclaw ``` -Then configure in `openclaw.json` with the local plugin path: +Then enable in `openclaw.json`: ```json { "plugins": { "entries": { - "memclaw": { - "enabled": true, - "path": "./plugins/memclaw" - } + "memclaw": { "enabled": true } } } } diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index a3d654c..2760ff9 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,7 +1,7 @@ { "id": "memclaw", "name": "MemClaw", - "version": "0.1.0", + "version": "0.9.0", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", "skills": ["skill"], diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index d587b1d..e577a85 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,5 +1,5 @@ { - "name": "@openclaw/memclaw", + "name": "@memclaw/plugin", "version": "0.9.0", "description": "MemClaw - The Cortex Memory' plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "publishConfig": { @@ -42,7 +42,7 @@ "@memclaw/bin-win-x64": "0.1.0" }, "engines": { - "node": ">=22.0.0" + "node": ">=20.0.0" }, "files": [ "dist/", diff --git a/examples/@memclaw/plugin/skill/references/setup.md b/examples/@memclaw/plugin/skill/references/setup.md index c1f3ecc..df57561 100644 --- a/examples/@memclaw/plugin/skill/references/setup.md +++ b/examples/@memclaw/plugin/skill/references/setup.md @@ -7,54 +7,15 @@ Installation and configuration guide for MemClaw. | Requirement | Details | |-------------|---------| | **Platforms** | Windows x86, macOS Apple Silicon | -| **Node.js** | ≥ 22.0.0 | +| **Node.js** | ≥ 20.0.0 | | **OpenClaw** | Installed and configured | ## Installation -### Method 1: Install from ClawHub - -```bash -openclaw plugins install memclaw -``` - -### Method 2: Local Development Installation - -For developers using a local version or developing the plugin: - ```bash -# Clone the repository -git clone https://github.com/sopaco/cortex-mem.git -cd cortex-mem/examples/memclaw - -# Install dependencies -bun install - -# Build the plugin -bun run build - -# Create symlink to plugin directory -mkdir -p ~/.openclaw/plugins -ln -sf "$(pwd)" ~/.openclaw/plugins/memclaw +openclaw plugins install @memclaw/plugin ``` -Configure in `openclaw.json` with local path: - -```json -{ - "plugins": { - "entries": { - "memclaw": { - "enabled": true, - "path": "./plugins/memclaw" - } - } - } -} -``` - -After code changes, rebuild with `bun run build` and restart OpenClaw. - ## OpenClaw Configuration Edit your `openclaw.json`: From cc95a4d36e28fae8c932f0f619458b61b5de2833 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Sun, 15 Mar 2026 09:51:17 +0800 Subject: [PATCH 04/10] Update plugin version to 0.9.1 and format code with consistent indentation --- examples/@memclaw/plugin/index.ts | 78 +++++----- examples/@memclaw/plugin/openclaw.plugin.json | 140 +++++++++--------- examples/@memclaw/plugin/package.json | 2 +- 3 files changed, 110 insertions(+), 110 deletions(-) diff --git a/examples/@memclaw/plugin/index.ts b/examples/@memclaw/plugin/index.ts index 127a229..afc1682 100644 --- a/examples/@memclaw/plugin/index.ts +++ b/examples/@memclaw/plugin/index.ts @@ -26,62 +26,62 @@ * } */ -import { createPlugin } from "./plugin-impl.js"; +import { createPlugin } from './plugin-impl.js'; // Re-export types -export type { CortexMemClient } from "./src/client.js"; -export type { MemClawConfig } from "./src/config.js"; +export type { CortexMemClient } from './src/client.js'; +export type { MemClawConfig } from './src/config.js'; // OpenClaw Plugin API types interface PluginLogger { - debug?: (msg: string, ...args: unknown[]) => void; - info: (msg: string, ...args: unknown[]) => void; - warn: (msg: string, ...args: unknown[]) => void; - error: (msg: string, ...args: unknown[]) => void; + debug?: (msg: string, ...args: unknown[]) => void; + info: (msg: string, ...args: unknown[]) => void; + warn: (msg: string, ...args: unknown[]) => void; + error: (msg: string, ...args: unknown[]) => void; } interface ToolDefinition { - name: string; - description: string; - parameters: object; - execute: (_id: string, params: Record) => Promise; - optional?: boolean; + name: string; + description: string; + parameters: object; + execute: (_id: string, params: Record) => Promise; + optional?: boolean; } interface PluginAPI { - pluginConfig?: Record; - registerTool(tool: ToolDefinition, opts?: { optional?: boolean }): void; - registerService(service: { - id: string; - start: () => Promise; - stop: () => Promise; - }): void; - logger: PluginLogger; + pluginConfig?: Record; + registerTool(tool: ToolDefinition, opts?: { optional?: boolean }): void; + registerService(service: { + id: string; + start: () => Promise; + stop: () => Promise; + }): void; + logger: PluginLogger; } // Default export - main plugin function export default function memclawPlugin(api: PluginAPI) { - return createPlugin(api); + return createPlugin(api); } // Named export - object style registration export const plugin = { - id: "memclaw", - name: "MemClaw", - version: "0.9.0", - configSchema: { - type: "object", - properties: { - serviceUrl: { type: "string", default: "http://localhost:8085" }, - defaultSessionId: { type: "string", default: "default" }, - searchLimit: { type: "integer", default: 10 }, - minScore: { type: "number", default: 0.6 }, - tenantId: { type: "string", default: "tenant_claw" }, - autoStartServices: { type: "boolean", default: true }, - }, - required: [], - }, - register(api: PluginAPI) { - return createPlugin(api); - }, + id: 'memclaw', + name: 'MemClaw', + version: '0.9.1', + configSchema: { + type: 'object', + properties: { + serviceUrl: { type: 'string', default: 'http://localhost:8085' }, + defaultSessionId: { type: 'string', default: 'default' }, + searchLimit: { type: 'integer', default: 10 }, + minScore: { type: 'number', default: 0.6 }, + tenantId: { type: 'string', default: 'tenant_claw' }, + autoStartServices: { type: 'boolean', default: true } + }, + required: [] + }, + register(api: PluginAPI) { + return createPlugin(api); + } }; diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index 2760ff9..8933013 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,72 +1,72 @@ { - "id": "memclaw", - "name": "MemClaw", - "version": "0.9.0", - "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", - "kind": "memory", - "skills": ["skill"], - "configSchema": { - "type": "object", - "properties": { - "serviceUrl": { - "type": "string", - "description": "Cortex Memory service URL", - "default": "http://127.0.0.1:8085" - }, - "defaultSessionId": { - "type": "string", - "description": "Default session ID for memory operations", - "default": "default" - }, - "searchLimit": { - "type": "integer", - "description": "Default number of search results", - "default": 10, - "minimum": 1, - "maximum": 50 - }, - "minScore": { - "type": "number", - "description": "Minimum relevance score for search results", - "default": 0.6, - "minimum": 0, - "maximum": 1 - }, - "tenantId": { - "type": "string", - "description": "Tenant ID for data isolation", - "default": "tenant_claw" - }, - "autoStartServices": { - "type": "boolean", - "description": "Automatically start Qdrant and cortex-mem-service if not running", - "default": true - }, - "qdrantPort": { - "type": "integer", - "description": "Qdrant port (default: 6333 for HTTP, 6334 for gRPC)", - "default": 6334 - }, - "servicePort": { - "type": "integer", - "description": "cortex-mem-service port", - "default": 8085 - } - }, - "required": [] - }, - "uiHints": { - "serviceUrl": { - "label": "Service URL", - "description": "The HTTP endpoint of your cortex-mem-service instance" - }, - "tenantId": { - "label": "Tenant ID", - "description": "Tenant identifier for data isolation" - }, - "autoStartServices": { - "label": "Auto-start Services", - "description": "Automatically start Qdrant and cortex-mem-service when plugin loads" - } - } + "id": "memclaw", + "name": "MemClaw", + "version": "0.9.1", + "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", + "kind": "memory", + "skills": ["skill"], + "configSchema": { + "type": "object", + "properties": { + "serviceUrl": { + "type": "string", + "description": "Cortex Memory service URL", + "default": "http://127.0.0.1:8085" + }, + "defaultSessionId": { + "type": "string", + "description": "Default session ID for memory operations", + "default": "default" + }, + "searchLimit": { + "type": "integer", + "description": "Default number of search results", + "default": 10, + "minimum": 1, + "maximum": 50 + }, + "minScore": { + "type": "number", + "description": "Minimum relevance score for search results", + "default": 0.6, + "minimum": 0, + "maximum": 1 + }, + "tenantId": { + "type": "string", + "description": "Tenant ID for data isolation", + "default": "tenant_claw" + }, + "autoStartServices": { + "type": "boolean", + "description": "Automatically start Qdrant and cortex-mem-service if not running", + "default": true + }, + "qdrantPort": { + "type": "integer", + "description": "Qdrant port (default: 6333 for HTTP, 6334 for gRPC)", + "default": 6334 + }, + "servicePort": { + "type": "integer", + "description": "cortex-mem-service port", + "default": 8085 + } + }, + "required": [] + }, + "uiHints": { + "serviceUrl": { + "label": "Service URL", + "description": "The HTTP endpoint of your cortex-mem-service instance" + }, + "tenantId": { + "label": "Tenant ID", + "description": "Tenant identifier for data isolation" + }, + "autoStartServices": { + "label": "Auto-start Services", + "description": "Automatically start Qdrant and cortex-mem-service when plugin loads" + } + } } diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index e577a85..b415f3e 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@memclaw/plugin", - "version": "0.9.0", + "version": "0.9.1", "description": "MemClaw - The Cortex Memory' plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "publishConfig": { "access": "public" From ec6a04b516f7ba0254d1e7b17f82f9f789d021a2 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Sun, 15 Mar 2026 09:59:31 +0800 Subject: [PATCH 05/10] Add MemClaw plugin distribution files and update version to 0.9.2 --- examples/@memclaw/plugin/dist/index.d.ts | 100 ++++ examples/@memclaw/plugin/dist/index.d.ts.map | 1 + examples/@memclaw/plugin/dist/index.js | 58 +++ examples/@memclaw/plugin/dist/index.js.map | 1 + .../@memclaw/plugin/dist/plugin-impl.d.ts | 40 ++ .../@memclaw/plugin/dist/plugin-impl.d.ts.map | 1 + examples/@memclaw/plugin/dist/plugin-impl.js | 445 ++++++++++++++++++ .../@memclaw/plugin/dist/plugin-impl.js.map | 1 + .../@memclaw/plugin/dist/src/binaries.d.ts | 29 ++ .../plugin/dist/src/binaries.d.ts.map | 1 + examples/@memclaw/plugin/dist/src/binaries.js | 292 ++++++++++++ .../@memclaw/plugin/dist/src/binaries.js.map | 1 + examples/@memclaw/plugin/dist/src/client.d.ts | 88 ++++ .../@memclaw/plugin/dist/src/client.d.ts.map | 1 + examples/@memclaw/plugin/dist/src/client.js | 131 ++++++ .../@memclaw/plugin/dist/src/client.js.map | 1 + examples/@memclaw/plugin/dist/src/config.d.ts | 50 ++ .../@memclaw/plugin/dist/src/config.d.ts.map | 1 + examples/@memclaw/plugin/dist/src/config.js | 257 ++++++++++ .../@memclaw/plugin/dist/src/config.js.map | 1 + .../@memclaw/plugin/dist/src/migrate.d.ts | 26 + .../@memclaw/plugin/dist/src/migrate.d.ts.map | 1 + examples/@memclaw/plugin/dist/src/migrate.js | 287 +++++++++++ .../@memclaw/plugin/dist/src/migrate.js.map | 1 + examples/@memclaw/plugin/index.ts | 2 +- examples/@memclaw/plugin/openclaw.plugin.json | 2 +- examples/@memclaw/plugin/package.json | 2 +- 27 files changed, 1818 insertions(+), 3 deletions(-) create mode 100644 examples/@memclaw/plugin/dist/index.d.ts create mode 100644 examples/@memclaw/plugin/dist/index.d.ts.map create mode 100644 examples/@memclaw/plugin/dist/index.js create mode 100644 examples/@memclaw/plugin/dist/index.js.map create mode 100644 examples/@memclaw/plugin/dist/plugin-impl.d.ts create mode 100644 examples/@memclaw/plugin/dist/plugin-impl.d.ts.map create mode 100644 examples/@memclaw/plugin/dist/plugin-impl.js create mode 100644 examples/@memclaw/plugin/dist/plugin-impl.js.map create mode 100644 examples/@memclaw/plugin/dist/src/binaries.d.ts create mode 100644 examples/@memclaw/plugin/dist/src/binaries.d.ts.map create mode 100644 examples/@memclaw/plugin/dist/src/binaries.js create mode 100644 examples/@memclaw/plugin/dist/src/binaries.js.map create mode 100644 examples/@memclaw/plugin/dist/src/client.d.ts create mode 100644 examples/@memclaw/plugin/dist/src/client.d.ts.map create mode 100644 examples/@memclaw/plugin/dist/src/client.js create mode 100644 examples/@memclaw/plugin/dist/src/client.js.map create mode 100644 examples/@memclaw/plugin/dist/src/config.d.ts create mode 100644 examples/@memclaw/plugin/dist/src/config.d.ts.map create mode 100644 examples/@memclaw/plugin/dist/src/config.js create mode 100644 examples/@memclaw/plugin/dist/src/config.js.map create mode 100644 examples/@memclaw/plugin/dist/src/migrate.d.ts create mode 100644 examples/@memclaw/plugin/dist/src/migrate.d.ts.map create mode 100644 examples/@memclaw/plugin/dist/src/migrate.js create mode 100644 examples/@memclaw/plugin/dist/src/migrate.js.map diff --git a/examples/@memclaw/plugin/dist/index.d.ts b/examples/@memclaw/plugin/dist/index.d.ts new file mode 100644 index 0000000..dc93e87 --- /dev/null +++ b/examples/@memclaw/plugin/dist/index.d.ts @@ -0,0 +1,100 @@ +/** + * MemClaw - Layered Semantic Memory for OpenClaw + * + * Provides: + * - L0/L1/L2 tiered memory retrieval + * - Automatic service startup (Qdrant + cortex-mem-service) + * - Migration from OpenClaw native memory + * + * Installation: + * openclaw plugins install memclaw + * + * Configuration (in openclaw.json): + * { + * "plugins": { + * "entries": { + * "memclaw": { + * "enabled": true, + * "config": { + * "serviceUrl": "http://127.0.0.1:8085", + * "tenantId": "tenant_claw", + * "autoStartServices": true + * } + * } + * } + * } + * } + */ +export type { CortexMemClient } from './src/client.js'; +export type { MemClawConfig } from './src/config.js'; +interface PluginLogger { + debug?: (msg: string, ...args: unknown[]) => void; + info: (msg: string, ...args: unknown[]) => void; + warn: (msg: string, ...args: unknown[]) => void; + error: (msg: string, ...args: unknown[]) => void; +} +interface ToolDefinition { + name: string; + description: string; + parameters: object; + execute: (_id: string, params: Record) => Promise; + optional?: boolean; +} +interface PluginAPI { + pluginConfig?: Record; + registerTool(tool: ToolDefinition, opts?: { + optional?: boolean; + }): void; + registerService(service: { + id: string; + start: () => Promise; + stop: () => Promise; + }): void; + logger: PluginLogger; +} +export default function memclawPlugin(api: PluginAPI): { + id: string; + name: string; + version: string; +}; +export declare const plugin: { + id: string; + name: string; + version: string; + configSchema: { + type: string; + properties: { + serviceUrl: { + type: string; + default: string; + }; + defaultSessionId: { + type: string; + default: string; + }; + searchLimit: { + type: string; + default: number; + }; + minScore: { + type: string; + default: number; + }; + tenantId: { + type: string; + default: string; + }; + autoStartServices: { + type: string; + default: boolean; + }; + }; + required: never[]; + }; + register(api: PluginAPI): { + id: string; + name: string; + version: string; + }; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/index.d.ts.map b/examples/@memclaw/plugin/dist/index.d.ts.map new file mode 100644 index 0000000..b78986e --- /dev/null +++ b/examples/@memclaw/plugin/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,UAAU,YAAY;IACrB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAClD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAChD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAChD,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACjD;AAED,UAAU,cAAc;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,SAAS;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACxE,eAAe,CAAC,OAAO,EAAE;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC1B,GAAG,IAAI,CAAC;IACT,MAAM,EAAE,YAAY,CAAC;CACrB;AAGD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,GAAG,EAAE,SAAS;;;;EAEnD;AAGD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgBJ,SAAS;;;;;CAGvB,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js new file mode 100644 index 0000000..696e5a3 --- /dev/null +++ b/examples/@memclaw/plugin/dist/index.js @@ -0,0 +1,58 @@ +"use strict"; +/** + * MemClaw - Layered Semantic Memory for OpenClaw + * + * Provides: + * - L0/L1/L2 tiered memory retrieval + * - Automatic service startup (Qdrant + cortex-mem-service) + * - Migration from OpenClaw native memory + * + * Installation: + * openclaw plugins install memclaw + * + * Configuration (in openclaw.json): + * { + * "plugins": { + * "entries": { + * "memclaw": { + * "enabled": true, + * "config": { + * "serviceUrl": "http://127.0.0.1:8085", + * "tenantId": "tenant_claw", + * "autoStartServices": true + * } + * } + * } + * } + * } + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.plugin = void 0; +exports.default = memclawPlugin; +const plugin_impl_js_1 = require("./plugin-impl.js"); +// Default export - main plugin function +function memclawPlugin(api) { + return (0, plugin_impl_js_1.createPlugin)(api); +} +// Named export - object style registration +exports.plugin = { + id: 'memclaw', + name: 'MemClaw', + version: '0.9.2', + configSchema: { + type: 'object', + properties: { + serviceUrl: { type: 'string', default: 'http://localhost:8085' }, + defaultSessionId: { type: 'string', default: 'default' }, + searchLimit: { type: 'integer', default: 10 }, + minScore: { type: 'number', default: 0.6 }, + tenantId: { type: 'string', default: 'tenant_claw' }, + autoStartServices: { type: 'boolean', default: true } + }, + required: [] + }, + register(api) { + return (0, plugin_impl_js_1.createPlugin)(api); + } +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/index.js.map b/examples/@memclaw/plugin/dist/index.js.map new file mode 100644 index 0000000..9c4ed82 --- /dev/null +++ b/examples/@memclaw/plugin/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAoCH,gCAEC;AApCD,qDAAgD;AAiChD,wCAAwC;AACxC,SAAwB,aAAa,CAAC,GAAc;IACnD,OAAO,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,2CAA2C;AAC9B,QAAA,MAAM,GAAG;IACrB,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,OAAO;IAChB,YAAY,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACX,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,uBAAuB,EAAE;YAChE,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE;YACxD,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;YAC7C,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;YAC1C,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE;YACpD,iBAAiB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;SACrD;QACD,QAAQ,EAAE,EAAE;KACZ;IACD,QAAQ,CAAC,GAAc;QACtB,OAAO,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;CACD,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/plugin-impl.d.ts b/examples/@memclaw/plugin/dist/plugin-impl.d.ts new file mode 100644 index 0000000..1fabc32 --- /dev/null +++ b/examples/@memclaw/plugin/dist/plugin-impl.d.ts @@ -0,0 +1,40 @@ +/** + * MemClaw Plugin Implementation + * + * Provides layered semantic memory for OpenClaw with: + * - Automatic service startup + * - Memory tools (search, recall, add, list, close) + * - Migration from OpenClaw native memory + */ +interface PluginLogger { + debug?: (msg: string, ...args: unknown[]) => void; + info: (msg: string, ...args: unknown[]) => void; + warn: (msg: string, ...args: unknown[]) => void; + error: (msg: string, ...args: unknown[]) => void; +} +interface ToolDefinition { + name: string; + description: string; + parameters: object; + execute: (_id: string, params: Record) => Promise; + optional?: boolean; +} +interface PluginAPI { + pluginConfig?: Record; + registerTool(tool: ToolDefinition, opts?: { + optional?: boolean; + }): void; + registerService(service: { + id: string; + start: () => Promise; + stop: () => Promise; + }): void; + logger: PluginLogger; +} +export declare function createPlugin(api: PluginAPI): { + id: string; + name: string; + version: string; +}; +export {}; +//# sourceMappingURL=plugin-impl.d.ts.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/plugin-impl.d.ts.map b/examples/@memclaw/plugin/dist/plugin-impl.d.ts.map new file mode 100644 index 0000000..ab0f929 --- /dev/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G,IAAI,CAAC;IACT,MAAM,EAAE,YAAY,CAAC;CACtB;AAuJD,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS;;;;EAiW1C"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/plugin-impl.js b/examples/@memclaw/plugin/dist/plugin-impl.js new file mode 100644 index 0000000..af27bf2 --- /dev/null +++ b/examples/@memclaw/plugin/dist/plugin-impl.js @@ -0,0 +1,445 @@ +"use strict"; +/** + * MemClaw Plugin Implementation + * + * Provides layered semantic memory for OpenClaw with: + * - Automatic service startup + * - Memory tools (search, recall, add, list, close) + * - Migration from OpenClaw native memory + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createPlugin = createPlugin; +const client_js_1 = require("./src/client.js"); +const config_js_1 = require("./src/config.js"); +const binaries_js_1 = require("./src/binaries.js"); +const migrate_js_1 = require("./src/migrate.js"); +// Tool schemas +const toolSchemas = { + cortex_search: { + name: "cortex_search", + description: `Layered semantic search across memory using L0/L1/L2 tiered retrieval. +Returns relevant memories ranked by relevance score. + +Use this tool when you need to: +- Find past conversations or decisions +- Search for specific information across all sessions +- Discover related memories by semantic similarity`, + inputSchema: { + type: "object", + properties: { + query: { + type: "string", + description: "The search query - can be natural language or keywords", + }, + scope: { + type: "string", + description: "Optional session/thread ID to limit search scope", + }, + limit: { + type: "integer", + description: "Maximum number of results to return (default: 10)", + default: 10, + }, + min_score: { + type: "number", + description: "Minimum relevance score threshold (0-1, default: 0.6)", + default: 0.6, + }, + }, + required: ["query"], + }, + }, + cortex_recall: { + name: "cortex_recall", + description: `Recall memories using L0/L1/L2 tiered retrieval. + +The search engine internally performs tiered retrieval: +- L0 (Abstract): Quick filtering by summary +- L1 (Overview): Context refinement +- L2 (Full): Precise matching with full content + +Returns results with snippet (summary) and content (if available). + +Use this when you need memories with more context than a simple search.`, + inputSchema: { + type: "object", + properties: { + query: { + type: "string", + description: "The search query", + }, + scope: { + type: "string", + description: "Optional session/thread ID to limit search scope", + }, + limit: { + type: "integer", + description: "Maximum number of results (default: 10)", + default: 10, + }, + }, + required: ["query"], + }, + }, + cortex_add_memory: { + name: "cortex_add_memory", + description: `Add a message to memory for a specific session. +This stores the message and automatically triggers: +- Vector embedding for semantic search +- L0/L1 layer generation (async) + +Use this to persist important information that should be searchable later.`, + inputSchema: { + type: "object", + properties: { + content: { + type: "string", + description: "The content to store in memory", + }, + role: { + type: "string", + enum: ["user", "assistant", "system"], + description: "Role of the message sender (default: user)", + default: "user", + }, + session_id: { + type: "string", + description: "Session/thread ID (uses default if not specified)", + }, + }, + required: ["content"], + }, + }, + cortex_list_sessions: { + name: "cortex_list_sessions", + description: `List all memory sessions with their status. +Shows session IDs, message counts, and creation/update times.`, + inputSchema: { + type: "object", + properties: {}, + }, + }, + cortex_close_session: { + name: "cortex_close_session", + description: `Close a memory session and trigger full memory extraction. + +This triggers the complete memory processing pipeline: +1. Extracts structured memories (user preferences, entities, decisions) +2. Generates complete L0/L1 layer summaries +3. Indexes all extracted memories into the vector database + +Note: This is a potentially long-running operation (may take 30-60s).`, + inputSchema: { + type: "object", + properties: { + session_id: { + type: "string", + description: "Session/thread ID to close (uses default if not specified)", + }, + }, + }, + }, + cortex_migrate: { + name: "cortex_migrate", + description: `Migrate memories from OpenClaw's native memory system to MemClaw. + +This will: +1. Find your OpenClaw memory files (memory/*.md and MEMORY.md) +2. Convert them to MemClaw's L2 format +3. Generate L0/L1 layers and vector index + +Use this once during initial setup to preserve your existing memories.`, + inputSchema: { + type: "object", + properties: {}, + }, + }, +}; +function createPlugin(api) { + const config = (api.pluginConfig ?? {}); + const serviceUrl = config.serviceUrl ?? "http://localhost:8085"; + const defaultSessionId = config.defaultSessionId ?? "default"; + const searchLimit = config.searchLimit ?? 10; + const minScore = config.minScore ?? 0.6; + const tenantId = config.tenantId ?? "tenant_claw"; + const autoStartServices = config.autoStartServices ?? true; + const client = new client_js_1.CortexMemClient(serviceUrl); + let servicesStarted = false; + const log = (msg) => api.logger.info(`[memclaw] ${msg}`); + log("Initializing MemClaw plugin..."); + // Ensure config file exists + const { created, path: configPath } = (0, config_js_1.ensureConfigExists)(); + if (created) { + log(`Created configuration file: ${configPath}`); + log("Opening configuration file for editing..."); + (0, config_js_1.openConfigFile)(configPath).catch((err) => { + api.logger.warn(`Could not open config file: ${err}`); + api.logger.warn(`Please manually edit: ${configPath}`); + }); + api.logger.info(` +╔══════════════════════════════════════════════════════════╗ +║ MemClaw First Run ║ +║ ║ +║ A configuration file has been created: ║ +║ ${configPath.padEnd(52)}║ +║ ║ +║ Please fill in the required fields: ║ +║ - llm.api_key (your LLM API key) ║ +║ - embedding.api_key (your embedding API key) ║ +║ ║ +║ Save the file and restart OpenClaw to apply changes. ║ +╚══════════════════════════════════════════════════════════╝ + `); + } + // Register service lifecycle + api.registerService({ + id: "memclaw", + start: async () => { + // Skip service startup if config was just created (first run) + // User needs to fill in API keys first + if (created) { + log("First run detected. Please complete configuration and restart OpenClaw."); + return; + } + if (!autoStartServices) { + log("Auto-start disabled, skipping service startup"); + return; + } + // Check if binaries are available + const hasQdrant = (0, binaries_js_1.isBinaryAvailable)("qdrant"); + const hasService = (0, binaries_js_1.isBinaryAvailable)("cortex-mem-service"); + if (!hasQdrant || !hasService) { + log("Some binaries are missing. Services may need manual setup."); + log(`Run 'memclaw setup' or check the admin skill for installation instructions.`); + } + // Validate config + const parsedConfig = (0, config_js_1.parseConfig)(configPath); + const validation = (0, config_js_1.validateConfig)(parsedConfig); + if (!validation.valid) { + api.logger.warn(`Configuration incomplete: ${validation.errors.join(", ")}`); + api.logger.warn(`Please edit: ${configPath}`); + return; + } + // Start services + try { + log("Starting services..."); + await (0, binaries_js_1.ensureAllServices)(log); + servicesStarted = true; + // Switch tenant + await client.switchTenant(tenantId); + log(`Switched to tenant: ${tenantId}`); + log("MemClaw services started successfully"); + } + catch (err) { + api.logger.error(`Failed to start services: ${err}`); + api.logger.warn("Memory features may not work correctly"); + } + }, + stop: async () => { + log("Stopping MemClaw..."); + servicesStarted = false; + }, + }); + // Helper to check if services are ready + const ensureServicesReady = async () => { + if (!servicesStarted) { + const status = await (0, binaries_js_1.checkServiceStatus)(); + if (!status.cortexMemService) { + throw new Error("cortex-mem-service is not running. Please start the service first."); + } + } + }; + // Register tools + // cortex_search + api.registerTool({ + name: toolSchemas.cortex_search.name, + description: toolSchemas.cortex_search.description, + parameters: toolSchemas.cortex_search.inputSchema, + execute: async (_id, params) => { + const input = params; + try { + await ensureServicesReady(); + const results = await client.search({ + query: input.query, + thread: input.scope, + limit: input.limit ?? searchLimit, + min_score: input.min_score ?? minScore, + }); + const formatted = results + .map((r, i) => `${i + 1}. [Score: ${r.score.toFixed(2)}] ${r.snippet}\n URI: ${r.uri}`) + .join("\n\n"); + return { + content: `Found ${results.length} results for "${input.query}":\n\n${formatted}`, + results: results.map((r) => ({ + uri: r.uri, + score: r.score, + snippet: r.snippet, + })), + total: results.length, + }; + } + catch (error) { + const message = error instanceof Error ? error.message : String(error); + api.logger.error(`cortex_search failed: ${message}`); + return { error: `Search failed: ${message}` }; + } + }, + }); + // cortex_recall + api.registerTool({ + name: toolSchemas.cortex_recall.name, + description: toolSchemas.cortex_recall.description, + parameters: toolSchemas.cortex_recall.inputSchema, + execute: async (_id, params) => { + const input = params; + try { + await ensureServicesReady(); + const results = await client.recall(input.query, input.scope, input.limit ?? 10); + const formatted = results + .map((r, i) => { + let content = `${i + 1}. [Score: ${r.score.toFixed(2)}] URI: ${r.uri}\n`; + content += ` Snippet: ${r.snippet}\n`; + if (r.content) { + const preview = r.content.length > 300 ? r.content.substring(0, 300) + "..." : r.content; + content += ` Content: ${preview}\n`; + } + return content; + }) + .join("\n"); + return { + content: `Recalled ${results.length} memories:\n\n${formatted}`, + results, + total: results.length, + }; + } + catch (error) { + const message = error instanceof Error ? error.message : String(error); + api.logger.error(`cortex_recall failed: ${message}`); + return { error: `Recall failed: ${message}` }; + } + }, + }); + // cortex_add_memory + api.registerTool({ + name: toolSchemas.cortex_add_memory.name, + description: toolSchemas.cortex_add_memory.description, + parameters: toolSchemas.cortex_add_memory.inputSchema, + execute: async (_id, params) => { + const input = params; + try { + await ensureServicesReady(); + const sessionId = input.session_id ?? defaultSessionId; + const result = await client.addMessage(sessionId, { + role: (input.role ?? "user"), + content: input.content, + }); + return { + content: `Memory stored successfully in session "${sessionId}".\nResult: ${result}`, + success: true, + message_uri: result, + }; + } + catch (error) { + const message = error instanceof Error ? error.message : String(error); + api.logger.error(`cortex_add_memory failed: ${message}`); + return { error: `Failed to add memory: ${message}` }; + } + }, + }); + // cortex_list_sessions + api.registerTool({ + name: toolSchemas.cortex_list_sessions.name, + description: toolSchemas.cortex_list_sessions.description, + parameters: toolSchemas.cortex_list_sessions.inputSchema, + execute: async (_id, _params) => { + try { + await ensureServicesReady(); + const sessions = await client.listSessions(); + if (sessions.length === 0) { + return { content: "No sessions found." }; + } + const formatted = sessions + .map((s, i) => { + const created = new Date(s.created_at).toLocaleDateString(); + return `${i + 1}. ${s.thread_id} (${s.status}, ${s.message_count} messages, created ${created})`; + }) + .join("\n"); + return { + content: `Found ${sessions.length} sessions:\n\n${formatted}`, + sessions: sessions.map((s) => ({ + thread_id: s.thread_id, + status: s.status, + message_count: s.message_count, + created_at: s.created_at, + })), + }; + } + catch (error) { + const message = error instanceof Error ? error.message : String(error); + api.logger.error(`cortex_list_sessions failed: ${message}`); + return { error: `Failed to list sessions: ${message}` }; + } + }, + }); + // cortex_close_session + api.registerTool({ + name: toolSchemas.cortex_close_session.name, + description: toolSchemas.cortex_close_session.description, + parameters: toolSchemas.cortex_close_session.inputSchema, + execute: async (_id, params) => { + const input = params; + try { + await ensureServicesReady(); + const sessionId = input.session_id ?? defaultSessionId; + const result = await client.closeSession(sessionId); + return { + content: `Session "${sessionId}" closed successfully.\nStatus: ${result.status}, Messages: ${result.message_count}\n\nMemory extraction pipeline triggered.`, + success: true, + session: { + thread_id: result.thread_id, + status: result.status, + message_count: result.message_count, + }, + }; + } + catch (error) { + const message = error instanceof Error ? error.message : String(error); + api.logger.error(`cortex_close_session failed: ${message}`); + return { error: `Failed to close session: ${message}` }; + } + }, + }); + // cortex_migrate + api.registerTool({ + name: toolSchemas.cortex_migrate.name, + description: toolSchemas.cortex_migrate.description, + parameters: toolSchemas.cortex_migrate.inputSchema, + execute: async (_id, _params) => { + try { + // Check if migration is possible + const { possible, reason } = (0, migrate_js_1.canMigrate)(); + if (!possible) { + return { content: `Migration not possible: ${reason}` }; + } + // Run migration + const result = await (0, migrate_js_1.migrateFromOpenClaw)((msg) => api.logger.info(`[migrate] ${msg}`)); + return { + content: `Migration completed!\n- Daily logs migrated: ${result.dailyLogsMigrated}\n- MEMORY.md migrated: ${result.memoryMdMigrated}\n- Sessions created: ${result.sessionsCreated.length}\n${result.errors.length > 0 ? `- Errors: ${result.errors.length}` : ""}`, + result, + }; + } + catch (error) { + const message = error instanceof Error ? error.message : String(error); + api.logger.error(`cortex_migrate failed: ${message}`); + return { error: `Migration failed: ${message}` }; + } + }, + }); + log("MemClaw plugin initialized"); + return { + id: "memclaw", + name: "MemClaw", + version: "0.1.0", + }; +} +//# sourceMappingURL=plugin-impl.js.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/plugin-impl.js.map b/examples/@memclaw/plugin/dist/plugin-impl.js.map new file mode 100644 index 0000000..365e820 --- /dev/null +++ b/examples/@memclaw/plugin/dist/plugin-impl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-impl.js","sourceRoot":"","sources":["../plugin-impl.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AA6MH,oCAiWC;AA5iBD,+CAAkD;AAClD,+CAMyB;AACzB,mDAI2B;AAC3B,iDAAmE;AAyCnE,eAAe;AACf,MAAM,WAAW,GAAG;IAClB,aAAa,EAAE;QACb,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE;;;;;;mDAMkC;QAC/C,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,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,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/binaries.d.ts b/examples/@memclaw/plugin/dist/src/binaries.d.ts new file mode 100644 index 0000000..9a40686 --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/binaries.d.ts @@ -0,0 +1,29 @@ +/** + * Binary management for MemClaw + * + * Binaries are bundled in platform-specific npm packages: + * - @memclaw/bin-darwin-arm64 (macOS Apple Silicon) + * - @memclaw/bin-win-x64 (Windows x64) + * + * The correct package is installed automatically via optionalDependencies. + */ +type SupportedPlatform = "darwin-arm64" | "win-x64"; +export declare function getPlatform(): SupportedPlatform | null; +export declare function isPlatformSupported(): boolean; +export declare function getUnsupportedPlatformMessage(): string; +export declare function getBinaryPath(binary: string): string | null; +export declare function isBinaryAvailable(binary: string): boolean; +export declare function isPlatformPackageInstalled(): boolean; +export declare function getInstallInstructions(): string; +export interface ServiceStatus { + qdrant: boolean; + cortexMemService: boolean; +} +export declare function checkServiceStatus(): Promise; +export declare function startQdrant(log?: (msg: string) => void): Promise; +export declare function startCortexMemService(log?: (msg: string) => void): Promise; +export declare function stopAllServices(): void; +export declare function ensureAllServices(log?: (msg: string) => void): Promise; +export declare function getCliPath(): string | null; +export {}; +//# sourceMappingURL=binaries.d.ts.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/binaries.d.ts.map b/examples/@memclaw/plugin/dist/src/binaries.d.ts.map new file mode 100644 index 0000000..4d02861 --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/binaries.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"binaries.d.ts","sourceRoot":"","sources":["../../src/binaries.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,KAAK,iBAAiB,GAAG,cAAc,GAAG,SAAS,CAAC;AAGpD,wBAAgB,WAAW,IAAI,iBAAiB,GAAG,IAAI,CAWtD;AAGD,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAGD,wBAAgB,6BAA6B,IAAI,MAAM,CAWtD;AA0BD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAe3D;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAGD,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AAGD,wBAAgB,sBAAsB,IAAI,MAAM,CAgB/C;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,aAAa,CAAC,CAKjE;AA2BD,wBAAsB,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA2D5E;AAED,wBAAsB,qBAAqB,CACzC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgDf;AAED,wBAAgB,eAAe,IAAI,IAAI,CAUtC;AAED,wBAAsB,iBAAiB,CACrC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC1B,OAAO,CAAC,aAAa,CAAC,CAwBxB;AAGD,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAE1C"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/binaries.js b/examples/@memclaw/plugin/dist/src/binaries.js new file mode 100644 index 0000000..a535329 --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/binaries.js @@ -0,0 +1,292 @@ +"use strict"; +/** + * Binary management for MemClaw + * + * Binaries are bundled in platform-specific npm packages: + * - @memclaw/bin-darwin-arm64 (macOS Apple Silicon) + * - @memclaw/bin-win-x64 (Windows x64) + * + * The correct package is installed automatically via optionalDependencies. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getPlatform = getPlatform; +exports.isPlatformSupported = isPlatformSupported; +exports.getUnsupportedPlatformMessage = getUnsupportedPlatformMessage; +exports.getBinaryPath = getBinaryPath; +exports.isBinaryAvailable = isBinaryAvailable; +exports.isPlatformPackageInstalled = isPlatformPackageInstalled; +exports.getInstallInstructions = getInstallInstructions; +exports.checkServiceStatus = checkServiceStatus; +exports.startQdrant = startQdrant; +exports.startCortexMemService = startCortexMemService; +exports.stopAllServices = stopAllServices; +exports.ensureAllServices = ensureAllServices; +exports.getCliPath = getCliPath; +const fs = __importStar(require("fs")); +const path = __importStar(require("path")); +const child_process_1 = require("child_process"); +const config_js_1 = require("./config.js"); +// Platform detection +function getPlatform() { + const platform = process.platform; + const arch = process.arch; + if (platform === "darwin" && arch === "arm64") { + return "darwin-arm64"; + } + else if (platform === "win32" && arch === "x64") { + return "win-x64"; + } + return null; +} +// Check if current platform is supported +function isPlatformSupported() { + return getPlatform() !== null; +} +// Get unsupported platform message +function getUnsupportedPlatformMessage() { + const platform = process.platform; + const arch = process.arch; + return ` +MemClaw is only supported on: + - macOS Apple Silicon (darwin-arm64) + - Windows x64 (win-x64) + +Current platform: ${platform}-${arch} is not supported. +`; +} +// Get binary name with platform extension +function getBinaryFileName(binary) { + return process.platform === "win32" ? `${binary}.exe` : binary; +} +// Get the path to the platform-specific npm package +function getPlatformPackagePath() { + const platform = getPlatform(); + if (!platform) { + return null; + } + const packageName = `@memclaw/bin-${platform}`; + try { + // Try to resolve the package path + const packageJsonPath = require.resolve(`${packageName}/package.json`); + return path.dirname(packageJsonPath); + } + catch { + return null; + } +} +// Get binary path from npm package +function getBinaryPath(binary) { + const packagePath = getPlatformPackagePath(); + if (!packagePath) { + return null; + } + const binaryFileName = getBinaryFileName(binary); + const binaryPath = path.join(packagePath, "bin", binaryFileName); + if (fs.existsSync(binaryPath)) { + return binaryPath; + } + return null; +} +// Check if binary is available +function isBinaryAvailable(binary) { + return getBinaryPath(binary) !== null; +} +// Check if platform package is installed +function isPlatformPackageInstalled() { + return getPlatformPackagePath() !== null; +} +// Get installation instructions for missing platform package +function getInstallInstructions() { + const platform = getPlatform(); + if (!platform) { + return getUnsupportedPlatformMessage(); + } + const packageName = `@memclaw/bin-${platform}`; + return ` +Platform binaries not found for ${platform}. + +Try running: npm install ${packageName} + +Or reinstall memclaw: npm install memclaw +`; +} +async function checkServiceStatus() { + const qdrant = await isPortOpen(6333); + const cortexMemService = await isPortOpen(8085); + return { qdrant, cortexMemService }; +} +async function isPortOpen(port) { + try { + const response = await fetch(`http://127.0.0.1:${port}/health`, { + method: "GET", + signal: AbortSignal.timeout(2000), + }); + return response.ok; + } + catch { + // Try alternate endpoints for Qdrant + try { + if (port === 6333 || port === 6334) { + const response = await fetch(`http://127.0.0.1:${port}`, { + method: "GET", + signal: AbortSignal.timeout(2000), + }); + return response.ok; + } + } + catch { } + return false; + } +} +// Running processes +const runningProcesses = new Map(); +async function startQdrant(log) { + const status = await checkServiceStatus(); + if (status.qdrant) { + log?.("Qdrant is already running"); + return; + } + const binaryPath = getBinaryPath("qdrant"); + if (!binaryPath) { + throw new Error(`Qdrant binary not found. ${getInstallInstructions()}`); + } + const dataDir = (0, config_js_1.getDataDir)(); + const storagePath = path.join(dataDir, "qdrant-storage"); + if (!fs.existsSync(storagePath)) { + fs.mkdirSync(storagePath, { recursive: true }); + } + log?.(`Starting Qdrant with storage at ${storagePath}...`); + const proc = (0, child_process_1.spawn)(binaryPath, [ + "--storage-path", + storagePath, + "--http-port", + "6333", + "--grpc-port", + "6334", + ], { + stdio: ["ignore", "pipe", "pipe"], + detached: true, + }); + proc.on("error", (err) => { + log?.(`Qdrant error: ${err.message}`); + }); + proc.unref(); + runningProcesses.set("qdrant", proc); + // Wait for Qdrant to start + let retries = 30; + while (retries > 0) { + const status = await checkServiceStatus(); + if (status.qdrant) { + log?.("Qdrant started successfully"); + return; + } + await new Promise((resolve) => setTimeout(resolve, 500)); + retries--; + } + throw new Error("Qdrant failed to start within 15 seconds"); +} +async function startCortexMemService(log) { + const status = await checkServiceStatus(); + if (status.cortexMemService) { + log?.("cortex-mem-service is already running"); + return; + } + const binaryPath = getBinaryPath("cortex-mem-service"); + if (!binaryPath) { + throw new Error(`cortex-mem-service binary not found. ${getInstallInstructions()}`); + } + const configPath = (0, config_js_1.getConfigPath)(); + const dataDir = (0, config_js_1.getDataDir)(); + log?.(`Starting cortex-mem-service with config ${configPath}...`); + const proc = (0, child_process_1.spawn)(binaryPath, ["--config", configPath, "--data-dir", dataDir], { + stdio: ["ignore", "pipe", "pipe"], + detached: true, + }); + proc.on("error", (err) => { + log?.(`cortex-mem-service error: ${err.message}`); + }); + proc.unref(); + runningProcesses.set("cortex-mem-service", proc); + // Wait for service to start + let retries = 30; + while (retries > 0) { + const status = await checkServiceStatus(); + if (status.cortexMemService) { + log?.("cortex-mem-service started successfully"); + return; + } + await new Promise((resolve) => setTimeout(resolve, 500)); + retries--; + } + throw new Error("cortex-mem-service failed to start within 15 seconds"); +} +function stopAllServices() { + for (const [name, proc] of runningProcesses) { + try { + proc.kill(); + console.log(`Stopped ${name}`); + } + catch (err) { + console.error(`Failed to stop ${name}:`, err); + } + } + runningProcesses.clear(); +} +async function ensureAllServices(log) { + // Check if platform is supported + if (!isPlatformSupported()) { + log?.(getUnsupportedPlatformMessage()); + return { qdrant: false, cortexMemService: false }; + } + // Check if platform package is installed + if (!isPlatformPackageInstalled()) { + log?.(`Warning: Platform binaries not installed. ${getInstallInstructions()}`); + return { qdrant: false, cortexMemService: false }; + } + const status = await checkServiceStatus(); + if (!status.qdrant) { + await startQdrant(log); + } + if (!status.cortexMemService) { + await startCortexMemService(log); + } + return checkServiceStatus(); +} +// Get CLI binary path for external commands (like migration) +function getCliPath() { + return getBinaryPath("cortex-mem-cli"); +} +//# sourceMappingURL=binaries.js.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/binaries.js.map b/examples/@memclaw/plugin/dist/src/binaries.js.map new file mode 100644 index 0000000..62f649b --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/binaries.js.map @@ -0,0 +1 @@ +{"version":3,"file":"binaries.js","sourceRoot":"","sources":["../../src/binaries.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH,kCAWC;AAGD,kDAEC;AAGD,sEAWC;AA0BD,sCAeC;AAGD,8CAEC;AAGD,gEAEC;AAGD,wDAgBC;AAOD,gDAKC;AA2BD,kCA2DC;AAED,sDAkDC;AAED,0CAUC;AAED,8CA0BC;AAGD,gCAEC;AAnTD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAAoD;AACpD,2CAAwD;AAQxD,qBAAqB;AACrB,SAAgB,WAAW;IACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1B,IAAI,QAAQ,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QAC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ugin/dist/src/client.d.ts b/examples/@memclaw/plugin/dist/src/client.d.ts new file mode 100644 index 0000000..79f5397 --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/client.d.ts @@ -0,0 +1,88 @@ +/** + * Cortex Memory API Client + * + * HTTP client for cortex-mem-service REST API + */ +export interface SearchRequest { + query: string; + thread?: string; + limit?: number; + min_score?: number; +} +export interface SearchResult { + uri: string; + score: number; + snippet: string; + content?: string; + source: string; +} +export interface SessionResponse { + thread_id: string; + status: string; + message_count: number; + created_at: string; + updated_at: string; +} +export interface CreateSessionRequest { + thread_id?: string; + title?: string; + user_id?: string; + agent_id?: string; +} +export interface AddMessageRequest { + role: "user" | "assistant" | "system"; + content: string; +} +/** + * Cortex Memory API Client + */ +export declare class CortexMemClient { + private baseUrl; + constructor(baseUrl?: string); + /** + * Layered semantic search (L0 -> L1 -> L2 tiered retrieval) + */ + search(request: SearchRequest): Promise; + /** + * Quick search returning only L0 abstracts + */ + find(query: string, scope?: string, limit?: number): Promise; + /** + * Layered recall - uses L0/L1/L2 tiered search internally + * + * The search engine performs tiered retrieval (L0→L1→L2) internally, + * but returns unified results with snippet and content. + * + * @param query - Search query + * @param scope - Optional session/thread scope + * @param limit - Maximum results + */ + recall(query: string, scope?: string, limit?: number): Promise; + /** + * List all sessions + */ + listSessions(): Promise; + /** + * Create a new session + */ + createSession(request?: CreateSessionRequest): Promise; + /** + * Add a message to a session + */ + addMessage(threadId: string, message: AddMessageRequest): Promise; + /** + * Close a session + */ + closeSession(threadId: string): Promise; + /** + * Switch tenant + */ + switchTenant(tenantId: string): Promise; + /** + * Health check + */ + healthCheck(): Promise; + private get; + private post; +} +//# sourceMappingURL=client.d.ts.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/client.d.ts.map b/examples/@memclaw/plugin/dist/src/client.d.ts.map new file mode 100644 index 0000000..67d831f --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/client.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"client.d.ts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AAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,YAAY,EAAE,CAAC;IAS1B;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAKhD;;OAEG;IACG,aAAa,CACjB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,eAAe,CAAC;IAQ3B;;OAEG;IACG,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,CAAC;IAQlB;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAQ9D;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YAUvB,GAAG;YAYH,IAAI;CAoBnB"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/client.js b/examples/@memclaw/plugin/dist/src/client.js new file mode 100644 index 0000000..6cbdccf --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/client.js @@ -0,0 +1,131 @@ +"use strict"; +/** + * Cortex Memory API Client + * + * HTTP client for cortex-mem-service REST API + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CortexMemClient = void 0; +/** + * Cortex Memory API Client + */ +class CortexMemClient { + baseUrl; + constructor(baseUrl = "http://localhost:8085") { + this.baseUrl = baseUrl.replace(/\/$/, ""); + } + /** + * Layered semantic search (L0 -> L1 -> L2 tiered retrieval) + */ + async search(request) { + const response = await this.post("/api/v2/search", request); + return response; + } + /** + * Quick search returning only L0 abstracts + */ + async find(query, scope, limit = 5) { + return this.search({ + query, + thread: scope, + limit, + min_score: 0.5, + }); + } + /** + * Layered recall - uses L0/L1/L2 tiered search internally + * + * The search engine performs tiered retrieval (L0→L1→L2) internally, + * but returns unified results with snippet and content. + * + * @param query - Search query + * @param scope - Optional session/thread scope + * @param limit - Maximum results + */ + async recall(query, scope, limit = 10) { + return this.search({ + query, + thread: scope, + limit, + min_score: 0.5, + }); + } + /** + * List all sessions + */ + async listSessions() { + const response = await this.get("/api/v2/sessions"); + return response; + } + /** + * Create a new session + */ + async createSession(request = {}) { + const response = await this.post("/api/v2/sessions", request); + return response; + } + /** + * Add a message to a session + */ + async addMessage(threadId, message) { + const response = await this.post(`/api/v2/sessions/${threadId}/messages`, message); + return response; + } + /** + * Close a session + */ + async closeSession(threadId) { + const response = await this.post(`/api/v2/sessions/${threadId}/close`, {}); + return response; + } + /** + * Switch tenant + */ + async switchTenant(tenantId) { + await this.post("/api/v2/tenants/switch", { tenant_id: tenantId }); + } + /** + * Health check + */ + async healthCheck() { + try { + const response = await fetch(`${this.baseUrl}/health`); + return response.ok; + } + catch { + return false; + } + } + // Private helpers + async get(path) { + const response = await fetch(`${this.baseUrl}${path}`); + if (!response.ok) { + throw new Error(`API error: ${response.status} ${response.statusText}`); + } + const data = (await response.json()); + if (!data.success) { + throw new Error(data.error || "API request failed"); + } + return data.data; + } + async post(path, body) { + const response = await fetch(`${this.baseUrl}${path}`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(body), + }); + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`API error: ${response.status} ${response.statusText} - ${errorText}`); + } + const data = (await response.json()); + if (!data.success) { + throw new Error(data.error || "API request failed"); + } + return data.data; + } +} +exports.CortexMemClient = CortexMemClient; +//# sourceMappingURL=client.js.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/client.js.map b/examples/@memclaw/plugin/dist/src/client.js.map new file mode 100644 index 0000000..f370917 --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/client.js.map @@ -0,0 +1 @@ +{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA+CH;;GAEG;AACH,MAAa,eAAe;IAClB,OA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,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,EAAE;YACrD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CACb,cAAc,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,MAAM,SAAS,EAAE,CACtE,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAmB,CAAC;QACvD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,oBAAoB,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC,IAAK,CAAC;IACpB,CAAC;CACF;AAxJD,0CAwJC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/config.d.ts b/examples/@memclaw/plugin/dist/src/config.d.ts new file mode 100644 index 0000000..4da5aa4 --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/config.d.ts @@ -0,0 +1,50 @@ +/** + * Configuration management for MemClaw + * + * Handles platform-specific config paths, config file generation, + * and auto-opening config files for user editing. + */ +export declare function getConfigDir(): string; +export declare function getDataDir(): string; +export declare function getConfigPath(): string; +export interface MemClawConfig { + qdrant: { + url: string; + collection_name: string; + timeout_secs: number; + }; + llm: { + api_base_url: string; + api_key: string; + model_efficient: string; + temperature: number; + max_tokens: number; + }; + embedding: { + api_base_url: string; + api_key: string; + model_name: string; + batch_size: number; + timeout_secs: number; + }; + server: { + host: string; + port: number; + }; + cortex: { + data_dir: string; + enable_intent_analysis: boolean; + }; +} +export declare function generateConfigTemplate(): string; +export declare function ensureConfigExists(): { + created: boolean; + path: string; +}; +export declare function openConfigFile(configPath: string): Promise; +export declare function parseConfig(configPath: string): MemClawConfig; +export declare function validateConfig(config: MemClawConfig): { + valid: boolean; + errors: string[]; +}; +//# sourceMappingURL=config.d.ts.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/config.d.ts.map b/examples/@memclaw/plugin/dist/src/config.d.ts.map new file mode 100644 index 0000000..eb4004e --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/config.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,wBAAgB,YAAY,IAAI,MAAM,CAarC;AAED,wBAAgB,UAAU,IAAI,MAAM,CAoBnC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,GAAG,EAAE;QACH,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,SAAS,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;CACH;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CA6C/C;AAED,wBAAgB,kBAAkB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAevE;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhE;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CA8E7D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG;IACrD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAoBA"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/config.js b/examples/@memclaw/plugin/dist/src/config.js new file mode 100644 index 0000000..c8b3c79 --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/config.js @@ -0,0 +1,257 @@ +"use strict"; +/** + * Configuration management for MemClaw + * + * Handles platform-specific config paths, config file generation, + * and auto-opening config files for user editing. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getConfigDir = getConfigDir; +exports.getDataDir = getDataDir; +exports.getConfigPath = getConfigPath; +exports.generateConfigTemplate = generateConfigTemplate; +exports.ensureConfigExists = ensureConfigExists; +exports.openConfigFile = openConfigFile; +exports.parseConfig = parseConfig; +exports.validateConfig = validateConfig; +const fs = __importStar(require("fs")); +const path = __importStar(require("path")); +const os = __importStar(require("os")); +const child_process_1 = require("child_process"); +// Platform-specific paths +function getConfigDir() { + const platform = process.platform; + if (platform === "win32") { + return path.join(process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"), "memclaw"); + } + else if (platform === "darwin") { + return path.join(os.homedir(), "Library", "Application Support", "memclaw"); + } + else { + return path.join(os.homedir(), ".config", "memclaw"); + } +} +function getDataDir() { + const platform = process.platform; + if (platform === "win32") { + return path.join(process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local"), "memclaw", "data"); + } + else if (platform === "darwin") { + return path.join(os.homedir(), "Library", "Application Support", "memclaw", "data"); + } + else { + return path.join(os.homedir(), ".local", "share", "memclaw", "data"); + } +} +function getConfigPath() { + return path.join(getConfigDir(), "config.toml"); +} +function generateConfigTemplate() { + const dataDir = getDataDir().replace(/\\/g, "/"); + return `# MemClaw Configuration +# +# This file was auto-generated. Please fill in the required values below. +# Required fields are marked with [REQUIRED] + +# Qdrant Vector Database Configuration +[qdrant] +url = "http://localhost:6334" +collection_name = "memclaw" +timeout_secs = 30 + +# LLM Configuration [REQUIRED for memory processing] +[llm] +# Your LLM API endpoint (OpenAI-compatible) +api_base_url = "https://api.openai.com/v1" +# Your API key [REQUIRED] +api_key = "" +# Model for memory extraction and layer generation +model_efficient = "gpt-4o-mini" +temperature = 0.1 +max_tokens = 4096 + +# Embedding Configuration [REQUIRED for vector search] +[embedding] +# Your embedding API endpoint (OpenAI-compatible) +api_base_url = "https://api.openai.com/v1" +# Your API key [REQUIRED - can be same as llm.api_key] +api_key = "" +model_name = "text-embedding-3-small" +batch_size = 10 +timeout_secs = 30 + +# Service Configuration +[server] +host = "localhost" +port = 8085 + +# Cortex Memory Settings +[cortex] +data_dir = "${dataDir}" +enable_intent_analysis = false +`; +} +function ensureConfigExists() { + const configDir = getConfigDir(); + const configPath = getConfigPath(); + if (!fs.existsSync(configDir)) { + fs.mkdirSync(configDir, { recursive: true }); + } + if (!fs.existsSync(configPath)) { + const template = generateConfigTemplate(); + fs.writeFileSync(configPath, template, "utf-8"); + return { created: true, path: configPath }; + } + return { created: false, path: configPath }; +} +function openConfigFile(configPath) { + return new Promise((resolve, reject) => { + const platform = process.platform; + let command; + let args = []; + if (platform === "win32") { + command = "cmd"; + args = ["/c", "start", '""', configPath]; + } + else if (platform === "darwin") { + command = "open"; + args = [configPath]; + } + else { + command = "xdg-open"; + args = [configPath]; + } + const proc = (0, child_process_1.spawn)(command, args, { detached: true, stdio: "ignore" }); + proc.on("error", (err) => { + reject(err); + }); + proc.unref(); + resolve(); + }); +} +function parseConfig(configPath) { + const content = fs.readFileSync(configPath, "utf-8"); + const config = {}; + let currentSection = ""; + for (const line of content.split("\n")) { + const trimmed = line.trim(); + // Skip comments and empty lines + if (trimmed.startsWith("#") || trimmed === "") + continue; + // Section header + const sectionMatch = trimmed.match(/^\[(\w+)\]$/); + if (sectionMatch) { + currentSection = sectionMatch[1]; + config[currentSection] = {}; + continue; + } + // Key-value pair + const kvMatch = trimmed.match(/^(\w+)\s*=\s*"([^"]*)"(?:\s*$|\s*#)/) || + trimmed.match(/^(\w+)\s*=\s*(\d+(?:\.\d+)?)(?:\s*$|\s*#)/) || + trimmed.match(/^(\w+)\s*=\s*(true|false)(?:\s*$|\s*#)/); + if (kvMatch && currentSection) { + const key = kvMatch[1]; + let value = kvMatch[2]; + // Convert to appropriate type + if (value === "true") + value = true; + else if (value === "false") + value = false; + else if (/^\d+$/.test(value)) + value = parseInt(value, 10); + else if (/^\d+\.\d+$/.test(value)) + value = parseFloat(value); + config[currentSection] = config[currentSection] || {}; + config[currentSection][key] = value; + } + } + // Apply defaults + const dataDir = getDataDir(); + return { + qdrant: { + url: "http://localhost:6334", + collection_name: "memclaw", + timeout_secs: 30, + ...(config.qdrant || {}), + }, + llm: { + api_base_url: "https://api.openai.com/v1", + api_key: "", + model_efficient: "gpt-5-mini", + temperature: 0.1, + max_tokens: 4096, + ...(config.llm || {}), + }, + embedding: { + api_base_url: "https://api.openai.com/v1", + api_key: "", + model_name: "text-embedding-3-small", + batch_size: 10, + timeout_secs: 30, + ...(config.embedding || {}), + }, + server: { + host: "localhost", + port: 8085, + ...(config.server || {}), + }, + cortex: { + data_dir: dataDir, + enable_intent_analysis: false, + ...(config.cortex || {}), + }, + }; +} +function validateConfig(config) { + const errors = []; + if (!config.llm.api_key || config.llm.api_key === "") { + errors.push("llm.api_key is required"); + } + if (!config.embedding.api_key || config.embedding.api_key === "") { + // Allow using llm.api_key for embedding if not specified + if (config.llm.api_key && config.llm.api_key !== "") { + config.embedding.api_key = config.llm.api_key; + } + else { + errors.push("embedding.api_key is required"); + } + } + return { + valid: errors.length === 0, + errors, + }; +} +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/config.js.map b/examples/@memclaw/plugin/dist/src/config.js.map new file mode 100644 index 0000000..4b280cb --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQH,oCAaC;AAED,gCAoBC;AAED,sCAEC;AAgCD,wDA6CC;AAED,gDAeC;AAED,wCAwBC;AAED,kCA8EC;AAED,wCAuBC;AA9QD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB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AC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM;KACP,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/migrate.d.ts b/examples/@memclaw/plugin/dist/src/migrate.d.ts new file mode 100644 index 0000000..c4acd1f --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/migrate.d.ts @@ -0,0 +1,26 @@ +/** + * Migration script for OpenClaw native memory to MemClaw + * + * Migrates: + * - memory/YYYY-MM-DD.md → session timeline files + * - MEMORY.md → users/{tenant}/preferences.md + */ +interface MigrationResult { + dailyLogsMigrated: number; + memoryMdMigrated: boolean; + sessionsCreated: string[]; + errors: string[]; +} +/** + * Main migration function + */ +export declare function migrateFromOpenClaw(log?: (msg: string) => void): Promise; +/** + * Check if migration is possible + */ +export declare function canMigrate(): { + possible: boolean; + reason: string; +}; +export {}; +//# sourceMappingURL=migrate.d.ts.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/migrate.d.ts.map b/examples/@memclaw/plugin/dist/src/migrate.d.ts.map new file mode 100644 index 0000000..98f4f7d --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/migrate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiBH,UAAU,eAAe;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAgPD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC1B,OAAO,CAAC,eAAe,CAAC,CA8C1B;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAelE"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/migrate.js b/examples/@memclaw/plugin/dist/src/migrate.js new file mode 100644 index 0000000..6bc23e9 --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/migrate.js @@ -0,0 +1,287 @@ +"use strict"; +/** + * Migration script for OpenClaw native memory to MemClaw + * + * Migrates: + * - memory/YYYY-MM-DD.md → session timeline files + * - MEMORY.md → users/{tenant}/preferences.md + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.migrateFromOpenClaw = migrateFromOpenClaw; +exports.canMigrate = canMigrate; +const fs = __importStar(require("fs")); +const path = __importStar(require("path")); +const os = __importStar(require("os")); +const child_process_1 = require("child_process"); +const util_1 = require("util"); +const glob_1 = require("glob"); +const config_js_1 = require("./config.js"); +const binaries_js_1 = require("./binaries.js"); +const execAsync = (0, util_1.promisify)(child_process_1.exec); +// Migration configuration +const MIGRATION_TENANT = 'tenant_claw'; +const DEFAULT_ROLE = 'user'; +/** + * Detect OpenClaw workspace directory + */ +function findOpenClawWorkspace() { + const homeDir = os.homedir(); + const workspacePath = path.join(homeDir, '.openclaw', 'workspace'); + if (fs.existsSync(workspacePath)) { + return workspacePath; + } + return null; +} +/** + * Split content into paragraphs (not just lines) + */ +function splitIntoParagraphs(content) { + return content + .split(/\n\s*\n/) + .map(p => p.trim()) + .filter(p => p.length > 0 && !p.startsWith('#')); // Skip headers +} +/** + * Generate L2 content for a single paragraph + */ +function generateL2Content(paragraph, sessionId, date, index) { + // Generate a deterministic timestamp based on index + const hour = String(index % 24).padStart(2, '0'); + const minute = String((index * 7) % 60).padStart(2, '0'); + const second = String((index * 13) % 60).padStart(2, '0'); + const timestamp = `${date}T${hour}:${minute}:${second}Z`; + const msgId = `${date.replace(/-/g, '')}_${String(index).padStart(4, '0')}`; + return `--- +id: "${msgId}" +role: "${DEFAULT_ROLE}" +timestamp: "${timestamp}" +thread_id: "${sessionId}" +--- +${paragraph}`; +} +/** + * Migrate daily logs from OpenClaw native memory to MemClaw + */ +async function migrateDailyLogs(ocWorkspace, dataDir, log) { + const memoryDir = path.join(ocWorkspace, 'memory'); + const count = 0; + const sessions = []; + const errors = []; + if (!fs.existsSync(memoryDir)) { + log?.('No memory directory found in OpenClaw workspace'); + return { count: 0, sessions: [], errors: [] }; + } + // Find all daily log files + const dailyLogPattern = path.join(memoryDir, '*.md').replace(/\\/g, '/'); + const files = await (0, glob_1.glob)(dailyLogPattern); + const dailyLogs = files.filter(f => { + const basename = path.basename(f); + return /^\d{4}-\d{2}-\d{2}\.md$/.test(basename); + }); + log?.(`Found ${dailyLogs.length} daily log files to migrate`); + for (const logPath of dailyLogs) { + try { + const date = path.basename(logPath, '.md'); // 2026-03-13 + const [year, month, day] = date.split('-'); + const sessionId = `migrated-oc-${date}`; + const timelineDir = path.join(dataDir, 'sessions', MIGRATION_TENANT, sessionId, 'timeline', year, month, day); + // Create directory + fs.mkdirSync(timelineDir, { recursive: true }); + // Read and split content + const content = fs.readFileSync(logPath, 'utf-8'); + const paragraphs = splitIntoParagraphs(content); + // Write each paragraph as L2 file + for (let i = 0; i < paragraphs.length; i++) { + const para = paragraphs[i]; + const hour = String(i % 24).padStart(2, '0'); + const minute = String((i * 7) % 60).padStart(2, '0'); + const second = String((i * 13) % 60).padStart(2, '0'); + const msgId = `${date.replace(/-/g, '')}_${String(i).padStart(4, '0')}`; + const l2Content = generateL2Content(para, sessionId, date, i); + const filename = `${hour}_${minute}_${second}_${msgId}.md`; + fs.writeFileSync(path.join(timelineDir, filename), l2Content, 'utf-8'); + } + sessions.push(sessionId); + log?.(`Migrated ${date}: ${paragraphs.length} messages`); + } + catch (err) { + const errorMsg = `Failed to migrate ${logPath}: ${err}`; + errors.push(errorMsg); + log?.(`Error: ${errorMsg}`); + } + } + return { + count: dailyLogs.length, + sessions, + errors, + }; +} +/** + * Migrate MEMORY.md to user preferences + */ +async function migrateMemoryMd(ocWorkspace, dataDir, log) { + const memoryMdPath = path.join(ocWorkspace, 'MEMORY.md'); + if (!fs.existsSync(memoryMdPath)) { + log?.('No MEMORY.md found'); + return { migrated: false }; + } + try { + const userDir = path.join(dataDir, 'users', MIGRATION_TENANT); + fs.mkdirSync(userDir, { recursive: true }); + const content = fs.readFileSync(memoryMdPath, 'utf-8'); + const targetPath = path.join(userDir, 'preferences.md'); + // Add header to indicate migration source + const migratedContent = ` +${content}`; + fs.writeFileSync(targetPath, migratedContent, 'utf-8'); + log?.('Migrated MEMORY.md to user preferences'); + return { migrated: true }; + } + catch (err) { + const error = `Failed to migrate MEMORY.md: ${err}`; + log?.(`Error: ${error}`); + return { migrated: false, error }; + } +} +/** + * Generate L0/L1 layers using cortex-mem-cli + */ +async function generateLayers(configPath, tenant, log) { + log?.('Generating L0/L1 layers...'); + const cliPath = (0, binaries_js_1.getCliPath)(); + if (!cliPath) { + log?.('cortex-mem-cli not found, skipping layer generation'); + return; + } + try { + const { stdout, stderr } = await execAsync(`"${cliPath}" --config "${configPath}" --tenant ${tenant} layers ensure-all`, { timeout: 300000 } // 5 minutes + ); + if (stdout) + log?.(stdout); + if (stderr) + log?.(stderr); + log?.('Layer generation completed'); + } + catch (err) { + log?.(`Layer generation warning: ${err}`); + // Don't throw - this is not critical for migration + } +} +/** + * Generate vector index using cortex-mem-cli + */ +async function generateVectorIndex(configPath, tenant, log) { + log?.('Generating vector index...'); + const cliPath = (0, binaries_js_1.getCliPath)(); + if (!cliPath) { + log?.('cortex-mem-cli not found, skipping vector index generation'); + return; + } + try { + const { stdout, stderr } = await execAsync(`"${cliPath}" --config "${configPath}" --tenant ${tenant} vector reindex`, { timeout: 600000 } // 10 minutes + ); + if (stdout) + log?.(stdout); + if (stderr) + log?.(stderr); + log?.('Vector index generation completed'); + } + catch (err) { + log?.(`Vector index warning: ${err}`); + // Don't throw - this is not critical for migration + } +} +/** + * Main migration function + */ +async function migrateFromOpenClaw(log) { + const result = { + dailyLogsMigrated: 0, + memoryMdMigrated: false, + sessionsCreated: [], + errors: [], + }; + log?.('Starting OpenClaw memory migration...'); + // Find OpenClaw workspace + const ocWorkspace = findOpenClawWorkspace(); + if (!ocWorkspace) { + const error = 'OpenClaw workspace not found at ~/.openclaw/workspace'; + result.errors.push(error); + log?.(error); + return result; + } + log?.(`Found OpenClaw workspace: ${ocWorkspace}`); + const dataDir = (0, config_js_1.getDataDir)(); + const configPath = (0, config_js_1.getConfigPath)(); + // Migrate daily logs + const dailyResult = await migrateDailyLogs(ocWorkspace, dataDir, log); + result.dailyLogsMigrated = dailyResult.count; + result.sessionsCreated = dailyResult.sessions; + result.errors.push(...dailyResult.errors); + // Migrate MEMORY.md + const memoryMdResult = await migrateMemoryMd(ocWorkspace, dataDir, log); + result.memoryMdMigrated = memoryMdResult.migrated; + if (memoryMdResult.error) { + result.errors.push(memoryMdResult.error); + } + // Generate layers and index + if (result.dailyLogsMigrated > 0 || result.memoryMdMigrated) { + await generateLayers(configPath, MIGRATION_TENANT, log); + await generateVectorIndex(configPath, MIGRATION_TENANT, log); + } + log?.(`Migration completed: ${result.dailyLogsMigrated} daily logs, MEMORY.md: ${result.memoryMdMigrated}`); + return result; +} +/** + * Check if migration is possible + */ +function canMigrate() { + const ocWorkspace = findOpenClawWorkspace(); + if (!ocWorkspace) { + return { possible: false, reason: 'OpenClaw workspace not found' }; + } + const memoryDir = path.join(ocWorkspace, 'memory'); + const memoryMd = path.join(ocWorkspace, 'MEMORY.md'); + if (!fs.existsSync(memoryDir) && !fs.existsSync(memoryMd)) { + return { possible: false, reason: 'No memory files found in OpenClaw workspace' }; + } + return { possible: true, reason: 'OpenClaw memory found and ready for migration' }; +} +//# sourceMappingURL=migrate.js.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/migrate.js.map b/examples/@memclaw/plugin/dist/src/migrate.js.map new file mode 100644 index 0000000..eb4c58f --- /dev/null +++ b/examples/@memclaw/plugin/dist/src/migrate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/migrate.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyQH,kDAgDC;AAKD,gCAeC;AA3UD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,iDAAqC;AACrC,+BAAiC;AACjC,+BAA4B;AAC5B,2CAAwD;AACxD,+CAA2C;AAE3C,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAElC,0BAA0B;AAC1B,MAAM,gBAAgB,GAAG,aAAa,CAAC;AACvC,MAAM,YAAY,GAAG,MAAM,CAAC;AAS5B;;GAEG;AACH,SAAS,qBAAqB;IAC5B,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC7B,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,E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AAC,UAAU,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC;IAED,GAAG,EAAE,CAAC,wBAAwB,MAAM,CAAC,iBAAiB,2BAA2B,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAE5G,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU;IACxB,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAE5C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B,EAAE,CAAC;IACrE,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAErD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,6CAA6C,EAAE,CAAC;IACpF,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,+CAA+C,EAAE,CAAC;AACrF,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/index.ts b/examples/@memclaw/plugin/index.ts index afc1682..ed2662d 100644 --- a/examples/@memclaw/plugin/index.ts +++ b/examples/@memclaw/plugin/index.ts @@ -68,7 +68,7 @@ export default function memclawPlugin(api: PluginAPI) { export const plugin = { id: 'memclaw', name: 'MemClaw', - version: '0.9.1', + version: '0.9.2', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index 8933013..c215324 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,7 +1,7 @@ { "id": "memclaw", "name": "MemClaw", - "version": "0.9.1", + "version": "0.9.2", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", "skills": ["skill"], diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index b415f3e..d06fa0e 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@memclaw/plugin", - "version": "0.9.1", + "version": "0.9.2", "description": "MemClaw - The Cortex Memory' plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "publishConfig": { "access": "public" From 58ea88fb5d64e57a30a7171432c4edb8aaa2c110 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Sun, 15 Mar 2026 10:57:23 +0800 Subject: [PATCH 06/10] Bump version to 0.9.3 and update setup documentation Add platform support matrix, improve first-time setup checklist, and enhance troubleshooting section in the setup guide. Update config.example.toml with enable_intent_analysis setting. --- examples/@memclaw/plugin/dist/index.js | 2 +- examples/@memclaw/plugin/index.ts | 2 +- examples/@memclaw/plugin/openclaw.plugin.json | 2 +- examples/@memclaw/plugin/package.json | 4 +- examples/@memclaw/plugin/skill/SKILL.md | 24 +- .../@memclaw/plugin/skill/references/setup.md | 253 ++++++++++++++---- examples/cortex-mem-tars/config.example.toml | 1 + 7 files changed, 226 insertions(+), 62 deletions(-) diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index 696e5a3..bd4e5cc 100644 --- a/examples/@memclaw/plugin/dist/index.js +++ b/examples/@memclaw/plugin/dist/index.js @@ -38,7 +38,7 @@ function memclawPlugin(api) { exports.plugin = { id: 'memclaw', name: 'MemClaw', - version: '0.9.2', + version: '0.9.3', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/index.ts b/examples/@memclaw/plugin/index.ts index ed2662d..b273c52 100644 --- a/examples/@memclaw/plugin/index.ts +++ b/examples/@memclaw/plugin/index.ts @@ -68,7 +68,7 @@ export default function memclawPlugin(api: PluginAPI) { export const plugin = { id: 'memclaw', name: 'MemClaw', - version: '0.9.2', + version: '0.9.3', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index c215324..fc7e86c 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,7 +1,7 @@ { "id": "memclaw", "name": "MemClaw", - "version": "0.9.2", + "version": "0.9.3", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", "skills": ["skill"], diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index d06fa0e..06e1d72 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,7 +1,7 @@ { "name": "@memclaw/plugin", - "version": "0.9.2", - "description": "MemClaw - The Cortex Memory' plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", + "version": "0.9.3", + "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "publishConfig": { "access": "public" }, diff --git a/examples/@memclaw/plugin/skill/SKILL.md b/examples/@memclaw/plugin/skill/SKILL.md index f9182a3..b7b29d3 100644 --- a/examples/@memclaw/plugin/skill/SKILL.md +++ b/examples/@memclaw/plugin/skill/SKILL.md @@ -21,7 +21,22 @@ MemClaw provides **three-layer semantic memory** with tiered retrieval: The search engine queries all three layers internally and returns unified results with `snippet` and `content`. -## Quick Decision Flow +## Pre-Use Requirements + +**IMPORTANT**: Before using MemClaw for the first time, you MUST ensure: + +1. **Qdrant** is running on port 6333/6334 +2. **cortex-mem-service** is running on port 8085 with `--data-dir` and valid `config.toml` +3. **LLM/Embedding API keys** are configured in `config.toml` + +**Manual Configuration Required**: Users must manually configure the following in `config.toml`: +- `llm.api_key` — LLM API key for memory processing +- `embedding.api_key` — Embedding API key for vector search +- `llm.api_base_url` / `embedding.api_base_url` — API endpoints (if not using OpenAI default) + +> **See `references/setup.md`** for complete installation, service setup, and configuration instructions. + +## Decision Flow 1. **Need to find something** → `cortex_search` 2. **Need more context** → `cortex_recall` @@ -64,11 +79,14 @@ The search engine queries all three layers internally and returns unified result | Services won't start | Check ports 6333, 6334, 8085; verify `api_key` in config.toml | | Search returns no results | Run `cortex_list_sessions` to verify; lower `min_score` threshold | | Migration fails | Ensure OpenClaw workspace at `~/.openclaw/workspace` | +| cortex-mem-service fails | Ensure `--data-dir` is set and `config.toml` exists in that directory | +| LLM/Embedding errors | Verify `llm.api_key` and `embedding.api_key` are configured in `config.toml` | +| Platform not supported | MemClaw supports macOS Apple Silicon and Windows x64 only | ## References For detailed information, see: -- **`references/setup.md`** — Installation and configuration guide +- **`references/setup.md`** — Installation, service setup, and configuration guide - **`references/tools.md`** — Detailed tool parameters and examples -- **`references/maintenance.md`** — CLI commands for data maintenance and optimization \ No newline at end of file +- **`references/maintenance.md`** — CLI commands for data maintenance and optimization diff --git a/examples/@memclaw/plugin/skill/references/setup.md b/examples/@memclaw/plugin/skill/references/setup.md index df57561..470f59c 100644 --- a/examples/@memclaw/plugin/skill/references/setup.md +++ b/examples/@memclaw/plugin/skill/references/setup.md @@ -2,110 +2,255 @@ Installation and configuration guide for MemClaw. +## Supported Platforms + +| Platform | npm Package | +|----------|-------------| +| macOS Apple Silicon | `@memclaw/bin-darwin-arm64` | +| Windows x64 | `@memclaw/bin-win-x64` | + +> **Note**: MemClaw is only supported on the platforms listed above. + ## Requirements | Requirement | Details | |-------------|---------| -| **Platforms** | Windows x86, macOS Apple Silicon | | **Node.js** | ≥ 20.0.0 | | **OpenClaw** | Installed and configured | +| **Qdrant** | Vector database (port 6333/6334) | +| **cortex-mem-service** | Memory service (port 8085) | -## Installation +## Binary Installation -```bash -openclaw plugins install @memclaw/plugin -``` +MemClaw binaries (Qdrant, cortex-mem-service, cortex-mem-cli) are distributed via platform-specific npm packages: -## OpenClaw Configuration +- `@memclaw/bin-darwin-arm64` — macOS Apple Silicon +- `@memclaw/bin-win-x64` — Windows x64 -Edit your `openclaw.json`: +These packages are installed automatically as optional dependencies when installing `@memclaw/plugin`. -```json -{ - "plugins": { - "entries": { - "memclaw": { - "enabled": true, - "config": { - "serviceUrl": "http://127.0.0.1:8085", - "tenantId": "tenant_claw", - "autoStartServices": true - } - } - } - }, - "agents": { - "defaults": { - "memorySearch": { "enabled": false } - } - } -} +### Manual Binary Installation + +If binaries are not installed, run: + +``` +npm install @memclaw/bin-darwin-arm64 ``` -> **Important**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory search and use MemClaw instead. +or (for Windows): + +``` +npm install @memclaw/bin-win-x64 +``` -## LLM Configuration +## First-Time Setup Checklist -On first run, MemClaw creates a configuration file: +**Before using MemClaw, complete these steps:** -| Platform | Path | -|----------|------| -| Windows | `%APPDATA%\memclaw\config.toml` | -| macOS | `~/Library/Application Support/memclaw/config.toml` | +### Step 1: Verify Platform Support + +Ensure you are on a supported platform (macOS Apple Silicon or Windows x86/x64). + +### Step 2: Prepare Data Directory + +The `--data-dir` parameter specifies the root directory for MemClaw data. By default, use the system's application data directory: -Edit the configuration file and fill in required fields: +| Platform | Default `--data-dir` | +|----------|----------------------| +| macOS | `~/Library/Application Support/memclaw` | +| Windows | `%LOCALAPPDATA%\memclaw` | +| Linux | `~/.local/share/memclaw` | + +The `config.toml` file should be placed directly in this directory. + +### Step 3: Create Configuration File + +**CRITICAL**: The `config.toml` file MUST be placed in the data directory BEFORE starting cortex-mem-service. + +Create `config.toml` with the following content: ```toml +# MemClaw Configuration +# +# Fill in the required values marked with [REQUIRED] before starting the service. + +# ============================================================ +# Qdrant Vector Database Configuration +# ============================================================ +[qdrant] +# Qdrant gRPC API URL +url = "http://localhost:6334" +# Collection name for storing memory vectors +collection_name = "memclaw" +# Connection timeout in seconds +timeout_secs = 30 + +# ============================================================ # LLM Configuration [REQUIRED for memory processing] +# ============================================================ [llm] # Your LLM API endpoint (OpenAI-compatible) api_base_url = "https://api.openai.com/v1" # Your API key [REQUIRED] -api_key = "sk-xxx" +api_key = "your-api-key-here" # Model for memory extraction and layer generation -model_efficient = "gpt-4o-mini" +model_efficient = "gpt-5-mini" temperature = 0.1 -max_tokens = 4096 +max_tokens = 65535 +# ============================================================ # Embedding Configuration [REQUIRED for vector search] +# ============================================================ [embedding] # Your embedding API endpoint (OpenAI-compatible) api_base_url = "https://api.openai.com/v1" # Your API key [REQUIRED - can be same as llm.api_key] -api_key = "sk-xxx" +api_key = "your-api-key-here" model_name = "text-embedding-3-small" batch_size = 10 +timeout_secs = 30 + +# ============================================================ +# Service Configuration +# ============================================================ +[server] +host = "localhost" +port = 8085 + +# ============================================================ +# Cortex Memory Settings +# ============================================================ +[cortex] +# Data directory path - MUST match the --data-dir argument +# Default paths by platform: +# macOS: "~/Library/Application Support/memclaw" +# Windows: "%LOCALAPPDATA%\\memclaw" +# Linux: "~/.local/share/memclaw" +data_dir = "." +enable_intent_analysis = false +``` + +### Step 4: Verify Services + +Check that Qdrant and cortex-mem-service are accessible: + +| Service | Port | Health Check | +|---------|------|--------------| +| Qdrant | 6333 (HTTP), 6334 (gRPC) | HTTP GET to `http://localhost:6333` should return Qdrant version info | +| cortex-mem-service | 8085 | HTTP GET to `http://localhost:8085/health` should return `{"status":"ok"}` | + +### Step 5: Start Services (if not running) + +**Starting Qdrant:** + +If `autoStartServices` is `true` in plugin config, MemClaw will start Qdrant automatically. + +To start manually, run the Qdrant binary from the platform package with: +- `--storage-path` pointing to a storage directory +- `--http-port 6333` +- `--grpc-port 6334` + +**Starting cortex-mem-service:** + +**CRITICAL**: cortex-mem-service MUST be started with `--data-dir` flag pointing to the directory containing `config.toml`. + +Arguments: +- `--data-dir ` — Path to data directory containing `config.toml` (**REQUIRED**) +- `--config ` — Path to config file (optional, defaults to `config.toml` in data directory) + +Example: +``` +cortex-mem-service --data-dir ~/Library/Application\ Support/memclaw +``` + +Or on Windows: +``` +cortex-mem-service --data-dir %LOCALAPPDATA%\memclaw ``` -Then restart OpenClaw. +## Plugin Configuration -## Configuration Options +Edit your `openclaw.json`: + +```json +{ + "plugins": { + "entries": { + "memclaw": { + "enabled": true, + "config": { + "serviceUrl": "http://localhost:8085", + "tenantId": "tenant_claw", + "autoStartServices": true + } + } + } + }, + "agents": { + "defaults": { + "memorySearch": { "enabled": false } + } + } +} +``` + +> **Important**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory search and use MemClaw instead. + +### Configuration Options | Option | Type | Default | Description | |--------|------|---------|-------------| -| `serviceUrl` | string | `http://127.0.0.1:8085` | Cortex Memory service URL | +| `serviceUrl` | string | `http://localhost:8085` | Cortex Memory service URL | | `tenantId` | string | `tenant_claw` | Tenant ID for data isolation | -| `autoStartServices` | boolean | `true` | Auto-start Qdrant and service | +| `autoStartServices` | boolean | `true` | Auto-start Qdrant and cortex-mem-service | | `defaultSessionId` | string | `default` | Default session for memory operations | | `searchLimit` | number | `10` | Default number of search results | | `minScore` | number | `0.6` | Minimum relevance score (0-1) | ## Troubleshooting -### Services Won't Start +### Platform Not Supported + +If you see "Platform not supported" error: +- Verify you are on macOS Apple Silicon or Windows x64 +- Check that the correct `@memclaw/bin-*` package is installed + +### Binaries Not Found + +If binaries are missing: +1. Verify `@memclaw/bin-*` package is in `node_modules` +2. Try reinstalling: `npm install @memclaw/bin-darwin-arm64` (or `bin-win-x64`) + +### cortex-mem-service Won't Start + +1. Verify `--data-dir` flag is provided +2. Verify `config.toml` exists in the data directory +3. Verify required fields in `config.toml`: + - `llm.api_key` is non-empty + - `embedding.api_key` is non-empty + - `cortex.data_dir` matches `--data-dir` argument + +Default data directories: +| Platform | Path | +|----------|------| +| macOS | `~/Library/Application Support/memclaw` | +| Windows | `%LOCALAPPDATA%\memclaw` | +| Linux | `~/.local/share/memclaw` | + +### Services Not Accessible -1. Check that ports 6333, 6334, 8085 are available -2. Verify `api_key` fields are filled in config.toml -3. Run `openclaw skills` to check plugin status +1. Verify ports 6333, 6334, 8085 are not in use by other applications +2. Verify firewall allows connections on these ports +3. Check service logs for error messages -### Configuration File Not Created +### Configuration File Issues -1. Ensure OpenClaw has write permissions to the config directory -2. Check OpenClaw logs for error messages -3. Manually create the directory and restart OpenClaw +1. Ensure `config.toml` uses valid TOML syntax +2. Verify file encoding is UTF-8 +3. On Windows, use double backslashes in paths: `C:\\Users\\...` ### API Key Issues -1. Verify your API key is valid and has sufficient credits -2. Ensure `api_base_url` is correct for your provider -3. Check network connectivity to the API endpoint +1. Verify API key is valid and has sufficient credits +2. Verify `api_base_url` is correct for your provider +3. Verify network connectivity to the API endpoint diff --git a/examples/cortex-mem-tars/config.example.toml b/examples/cortex-mem-tars/config.example.toml index ff640d6..bbadfda 100644 --- a/examples/cortex-mem-tars/config.example.toml +++ b/examples/cortex-mem-tars/config.example.toml @@ -55,6 +55,7 @@ cors_origins = ["*"] # # 留空或注释此行将使用默认值(应用数据目录) # data_dir = "/path/to/custom/cortex/data" +enable_intent_analysis = false # 日志配置 [logging] From 0919b3e3dc2f4b53dc2b3d8ce2ca70039ae2fe98 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Mon, 16 Mar 2026 11:17:27 +0800 Subject: [PATCH 07/10] Bump version to 0.9.5 and update cortex-mem-service config handling Simplify configuration requirements and update setup documentation to reflect that only API keys are required while other settings use sensible defaults. Remove separate config directory and use data directory for both config.toml and data storage. --- examples/@memclaw/plugin/dist/index.js | 46 ++++++++-------- examples/@memclaw/plugin/index.ts | 2 +- examples/@memclaw/plugin/openclaw.plugin.json | 2 +- examples/@memclaw/plugin/package.json | 2 +- examples/@memclaw/plugin/skill/SKILL.md | 7 +-- .../@memclaw/plugin/skill/references/setup.md | 53 ++++++++----------- examples/@memclaw/plugin/src/binaries.ts | 8 +-- examples/@memclaw/plugin/src/config.ts | 33 ++---------- 8 files changed, 58 insertions(+), 95 deletions(-) diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index bd4e5cc..1f83e08 100644 --- a/examples/@memclaw/plugin/dist/index.js +++ b/examples/@memclaw/plugin/dist/index.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /** * MemClaw - Layered Semantic Memory for OpenClaw * @@ -26,33 +26,33 @@ * } * } */ -Object.defineProperty(exports, "__esModule", { value: true }); +Object.defineProperty(exports, '__esModule', { value: true }); exports.plugin = void 0; exports.default = memclawPlugin; -const plugin_impl_js_1 = require("./plugin-impl.js"); +const plugin_impl_js_1 = require('./plugin-impl.js'); // Default export - main plugin function function memclawPlugin(api) { - return (0, plugin_impl_js_1.createPlugin)(api); + return (0, plugin_impl_js_1.createPlugin)(api); } // Named export - object style registration exports.plugin = { - id: 'memclaw', - name: 'MemClaw', - version: '0.9.3', - configSchema: { - type: 'object', - properties: { - serviceUrl: { type: 'string', default: 'http://localhost:8085' }, - defaultSessionId: { type: 'string', default: 'default' }, - searchLimit: { type: 'integer', default: 10 }, - minScore: { type: 'number', default: 0.6 }, - tenantId: { type: 'string', default: 'tenant_claw' }, - autoStartServices: { type: 'boolean', default: true } - }, - required: [] - }, - register(api) { - return (0, plugin_impl_js_1.createPlugin)(api); - } + id: 'memclaw', + name: 'MemClaw', + version: '0.9.5', + configSchema: { + type: 'object', + properties: { + serviceUrl: { type: 'string', default: 'http://localhost:8085' }, + defaultSessionId: { type: 'string', default: 'default' }, + searchLimit: { type: 'integer', default: 10 }, + minScore: { type: 'number', default: 0.6 }, + tenantId: { type: 'string', default: 'tenant_claw' }, + autoStartServices: { type: 'boolean', default: true } + }, + required: [] + }, + register(api) { + return (0, plugin_impl_js_1.createPlugin)(api); + } }; -//# sourceMappingURL=index.js.map \ No newline at end of file +//# sourceMappingURL=index.js.map diff --git a/examples/@memclaw/plugin/index.ts b/examples/@memclaw/plugin/index.ts index b273c52..58ed203 100644 --- a/examples/@memclaw/plugin/index.ts +++ b/examples/@memclaw/plugin/index.ts @@ -68,7 +68,7 @@ export default function memclawPlugin(api: PluginAPI) { export const plugin = { id: 'memclaw', name: 'MemClaw', - version: '0.9.3', + version: '0.9.5', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index fc7e86c..ed8246a 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,7 +1,7 @@ { "id": "memclaw", "name": "MemClaw", - "version": "0.9.3", + "version": "0.9.5", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", "skills": ["skill"], diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index 06e1d72..57f1c3c 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@memclaw/plugin", - "version": "0.9.3", + "version": "0.9.5", "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "publishConfig": { "access": "public" diff --git a/examples/@memclaw/plugin/skill/SKILL.md b/examples/@memclaw/plugin/skill/SKILL.md index b7b29d3..12716e6 100644 --- a/examples/@memclaw/plugin/skill/SKILL.md +++ b/examples/@memclaw/plugin/skill/SKILL.md @@ -26,13 +26,10 @@ The search engine queries all three layers internally and returns unified result **IMPORTANT**: Before using MemClaw for the first time, you MUST ensure: 1. **Qdrant** is running on port 6333/6334 -2. **cortex-mem-service** is running on port 8085 with `--data-dir` and valid `config.toml` +2. **cortex-mem-service** is running on port 8085 with `--data-dir` 3. **LLM/Embedding API keys** are configured in `config.toml` -**Manual Configuration Required**: Users must manually configure the following in `config.toml`: -- `llm.api_key` — LLM API key for memory processing -- `embedding.api_key` — Embedding API key for vector search -- `llm.api_base_url` / `embedding.api_base_url` — API endpoints (if not using OpenAI default) +**User Configuration**: Only `llm.api_key` and `embedding.api_key` are required. All other settings use defaults. > **See `references/setup.md`** for complete installation, service setup, and configuration instructions. diff --git a/examples/@memclaw/plugin/skill/references/setup.md b/examples/@memclaw/plugin/skill/references/setup.md index 470f59c..72c2731 100644 --- a/examples/@memclaw/plugin/skill/references/setup.md +++ b/examples/@memclaw/plugin/skill/references/setup.md @@ -67,66 +67,57 @@ The `config.toml` file should be placed directly in this directory. **CRITICAL**: The `config.toml` file MUST be placed in the data directory BEFORE starting cortex-mem-service. -Create `config.toml` with the following content: +Users only need to configure LLM/Embedding API keys. All other settings use sensible defaults. + +Create `config.toml` with the following minimal content: ```toml # MemClaw Configuration -# -# Fill in the required values marked with [REQUIRED] before starting the service. +# Only llm.api_key and embedding.api_key are required. + +# LLM Configuration [REQUIRED] +[llm] +api_base_url = "https://api.openai.com/v1" +api_key = "your-api-key-here" + +# Embedding Configuration [REQUIRED] +[embedding] +api_base_url = "https://api.openai.com/v1" +api_key = "your-api-key-here" +``` + +**Full configuration with all defaults:** -# ============================================================ +```toml # Qdrant Vector Database Configuration -# ============================================================ [qdrant] -# Qdrant gRPC API URL url = "http://localhost:6334" -# Collection name for storing memory vectors collection_name = "memclaw" -# Connection timeout in seconds timeout_secs = 30 -# ============================================================ -# LLM Configuration [REQUIRED for memory processing] -# ============================================================ +# LLM Configuration [REQUIRED] [llm] -# Your LLM API endpoint (OpenAI-compatible) api_base_url = "https://api.openai.com/v1" -# Your API key [REQUIRED] api_key = "your-api-key-here" -# Model for memory extraction and layer generation model_efficient = "gpt-5-mini" temperature = 0.1 -max_tokens = 65535 +max_tokens = 4096 -# ============================================================ -# Embedding Configuration [REQUIRED for vector search] -# ============================================================ +# Embedding Configuration [REQUIRED] [embedding] -# Your embedding API endpoint (OpenAI-compatible) api_base_url = "https://api.openai.com/v1" -# Your API key [REQUIRED - can be same as llm.api_key] api_key = "your-api-key-here" model_name = "text-embedding-3-small" batch_size = 10 timeout_secs = 30 -# ============================================================ # Service Configuration -# ============================================================ [server] host = "localhost" port = 8085 -# ============================================================ # Cortex Memory Settings -# ============================================================ [cortex] -# Data directory path - MUST match the --data-dir argument -# Default paths by platform: -# macOS: "~/Library/Application Support/memclaw" -# Windows: "%LOCALAPPDATA%\\memclaw" -# Linux: "~/.local/share/memclaw" -data_dir = "." enable_intent_analysis = false ``` @@ -156,7 +147,6 @@ To start manually, run the Qdrant binary from the platform package with: Arguments: - `--data-dir ` — Path to data directory containing `config.toml` (**REQUIRED**) -- `--config ` — Path to config file (optional, defaults to `config.toml` in data directory) Example: ``` @@ -228,7 +218,6 @@ If binaries are missing: 3. Verify required fields in `config.toml`: - `llm.api_key` is non-empty - `embedding.api_key` is non-empty - - `cortex.data_dir` matches `--data-dir` argument Default data directories: | Platform | Path | diff --git a/examples/@memclaw/plugin/src/binaries.ts b/examples/@memclaw/plugin/src/binaries.ts index 084bcda..2a63265 100644 --- a/examples/@memclaw/plugin/src/binaries.ts +++ b/examples/@memclaw/plugin/src/binaries.ts @@ -11,7 +11,7 @@ import * as fs from "fs"; import * as path from "path"; import { spawn, ChildProcess } from "child_process"; -import { getDataDir, getConfigPath } from "./config.js"; +import { getDataDir } from "./config.js"; // Binary names type type BinaryName = "qdrant" | "cortex-mem-service" | "cortex-mem-cli"; @@ -236,14 +236,14 @@ export async function startCortexMemService( ); } - const configPath = getConfigPath(); const dataDir = getDataDir(); - log?.(`Starting cortex-mem-service with config ${configPath}...`); + log?.(`Starting cortex-mem-service with data-dir ${dataDir}...`); + // cortex-mem-service automatically reads config.toml from --data-dir const proc = spawn( binaryPath, - ["--config", configPath, "--data-dir", dataDir], + ["--data-dir", dataDir], { stdio: ["ignore", "pipe", "pipe"], detached: true, diff --git a/examples/@memclaw/plugin/src/config.ts b/examples/@memclaw/plugin/src/config.ts index f74eff8..83c2cf4 100644 --- a/examples/@memclaw/plugin/src/config.ts +++ b/examples/@memclaw/plugin/src/config.ts @@ -11,21 +11,6 @@ import * as os from "os"; import { spawn } from "child_process"; // Platform-specific paths -export function getConfigDir(): string { - const platform = process.platform; - - if (platform === "win32") { - return path.join( - process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"), - "memclaw", - ); - } else if (platform === "darwin") { - return path.join(os.homedir(), "Library", "Application Support", "memclaw"); - } else { - return path.join(os.homedir(), ".config", "memclaw"); - } -} - export function getDataDir(): string { const platform = process.platform; @@ -33,7 +18,6 @@ export function getDataDir(): string { return path.join( process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local"), "memclaw", - "data", ); } else if (platform === "darwin") { return path.join( @@ -41,15 +25,14 @@ export function getDataDir(): string { "Library", "Application Support", "memclaw", - "data", ); } else { - return path.join(os.homedir(), ".local", "share", "memclaw", "data"); + return path.join(os.homedir(), ".local", "share", "memclaw"); } } export function getConfigPath(): string { - return path.join(getConfigDir(), "config.toml"); + return path.join(getDataDir(), "config.toml"); } export interface MemClawConfig { @@ -77,14 +60,11 @@ export interface MemClawConfig { port: number; }; cortex: { - data_dir: string; enable_intent_analysis: boolean; }; } export function generateConfigTemplate(): string { - const dataDir = getDataDir().replace(/\\/g, "/"); - return `# MemClaw Configuration # # This file was auto-generated. Please fill in the required values below. @@ -124,17 +104,16 @@ port = 8085 # Cortex Memory Settings [cortex] -data_dir = "${dataDir}" enable_intent_analysis = false `; } export function ensureConfigExists(): { created: boolean; path: string } { - const configDir = getConfigDir(); + const dataDir = getDataDir(); const configPath = getConfigPath(); - if (!fs.existsSync(configDir)) { - fs.mkdirSync(configDir, { recursive: true }); + if (!fs.existsSync(dataDir)) { + fs.mkdirSync(dataDir, { recursive: true }); } if (!fs.existsSync(configPath)) { @@ -214,7 +193,6 @@ export function parseConfig(configPath: string): MemClawConfig { } // Apply defaults - const dataDir = getDataDir(); return { qdrant: { @@ -245,7 +223,6 @@ export function parseConfig(configPath: string): MemClawConfig { ...(config.server || {}), }, cortex: { - data_dir: dataDir, enable_intent_analysis: false, ...(config.cortex || {}), }, From fb735fe1ee943a507a949deebb9b09de86be1b89 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Mon, 16 Mar 2026 11:49:53 +0800 Subject: [PATCH 08/10] update memclaw's plugin dist --- examples/@memclaw/plugin/dist/index.js | 46 ++++++------- examples/@memclaw/plugin/dist/src/binaries.js | 6 +- .../@memclaw/plugin/dist/src/binaries.js.map | 2 +- examples/@memclaw/plugin/dist/src/config.d.ts | 7 +- .../@memclaw/plugin/dist/src/config.d.ts.map | 2 +- examples/@memclaw/plugin/dist/src/config.js | 52 ++++++--------- .../@memclaw/plugin/dist/src/config.js.map | 2 +- examples/@memclaw/plugin/skill/SKILL.md | 24 ++++++- .../@memclaw/plugin/skill/references/setup.md | 66 ++++++++++--------- examples/@memclaw/plugin/src/config.ts | 26 ++++++-- 10 files changed, 131 insertions(+), 102 deletions(-) diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index 1f83e08..047727f 100644 --- a/examples/@memclaw/plugin/dist/index.js +++ b/examples/@memclaw/plugin/dist/index.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; /** * MemClaw - Layered Semantic Memory for OpenClaw * @@ -26,33 +26,33 @@ * } * } */ -Object.defineProperty(exports, '__esModule', { value: true }); +Object.defineProperty(exports, "__esModule", { value: true }); exports.plugin = void 0; exports.default = memclawPlugin; -const plugin_impl_js_1 = require('./plugin-impl.js'); +const plugin_impl_js_1 = require("./plugin-impl.js"); // Default export - main plugin function function memclawPlugin(api) { - return (0, plugin_impl_js_1.createPlugin)(api); + return (0, plugin_impl_js_1.createPlugin)(api); } // Named export - object style registration exports.plugin = { - id: 'memclaw', - name: 'MemClaw', - version: '0.9.5', - configSchema: { - type: 'object', - properties: { - serviceUrl: { type: 'string', default: 'http://localhost:8085' }, - defaultSessionId: { type: 'string', default: 'default' }, - searchLimit: { type: 'integer', default: 10 }, - minScore: { type: 'number', default: 0.6 }, - tenantId: { type: 'string', default: 'tenant_claw' }, - autoStartServices: { type: 'boolean', default: true } - }, - required: [] - }, - register(api) { - return (0, plugin_impl_js_1.createPlugin)(api); - } + id: 'memclaw', + name: 'MemClaw', + version: '0.9.5', + configSchema: { + type: 'object', + properties: { + serviceUrl: { type: 'string', default: 'http://localhost:8085' }, + defaultSessionId: { type: 'string', default: 'default' }, + searchLimit: { type: 'integer', default: 10 }, + minScore: { type: 'number', default: 0.6 }, + tenantId: { type: 'string', default: 'tenant_claw' }, + autoStartServices: { type: 'boolean', default: true } + }, + required: [] + }, + register(api) { + return (0, plugin_impl_js_1.createPlugin)(api); + } }; -//# sourceMappingURL=index.js.map +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/binaries.js b/examples/@memclaw/plugin/dist/src/binaries.js index a535329..84b71da 100644 --- a/examples/@memclaw/plugin/dist/src/binaries.js +++ b/examples/@memclaw/plugin/dist/src/binaries.js @@ -228,10 +228,10 @@ async function startCortexMemService(log) { if (!binaryPath) { throw new Error(`cortex-mem-service binary not found. ${getInstallInstructions()}`); } - const configPath = (0, config_js_1.getConfigPath)(); const dataDir = (0, config_js_1.getDataDir)(); - log?.(`Starting cortex-mem-service with config ${configPath}...`); - const proc = (0, child_process_1.spawn)(binaryPath, ["--config", configPath, "--data-dir", dataDir], { + log?.(`Starting cortex-mem-service with data-dir ${dataDir}...`); + // cortex-mem-service automatically reads config.toml from --data-dir + const proc = (0, child_process_1.spawn)(binaryPath, ["--data-dir", dataDir], { stdio: ["ignore", "pipe", "pipe"], detached: true, }); diff --git a/examples/@memclaw/plugin/dist/src/binaries.js.map b/examples/@memclaw/plugin/dist/src/binaries.js.map index 62f649b..c583661 100644 --- a/examples/@memclaw/plugin/dist/src/binaries.js.map +++ b/examples/@memclaw/plugin/dist/src/binaries.js.map @@ -1 +1 @@ -{"version":3,"file":"binaries.js","sourceRoot":"","sources":["../../src/binaries.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH,kCAWC;AAGD,kDAEC;AAGD,sEAWC;AA0BD,sCAeC;AAGD,8CAEC;AAGD,gEAEC;AAGD,wDAgBC;AAOD,gDAKC;AA2BD,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jC,IAAI,CAAC,mBAAmB,EAAE,EAAE,CAAC;QAC3B,GAAG,EAAE,CAAC,6BAA6B,EAAE,CAAC,CAAC;QACvC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACpD,CAAC;IAED,yCAAyC;IACzC,IAAI,CAAC,0BAA0B,EAAE,EAAE,CAAC;QAClC,GAAG,EAAE,CAAC,6CAA6C,sBAAsB,EAAE,EAAE,CAAC,CAAC;QAC/E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACpD,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAE1C,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC7B,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,kBAAkB,EAAE,CAAC;AAC9B,CAAC;AAED,6DAA6D;AAC7D,SAAgB,UAAU;IACxB,OAAO,aAAa,CAAC,gBAAgB,CAAC,CAAC;AACzC,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/config.d.ts b/examples/@memclaw/plugin/dist/src/config.d.ts index 4da5aa4..b3c382c 100644 --- a/examples/@memclaw/plugin/dist/src/config.d.ts +++ b/examples/@memclaw/plugin/dist/src/config.d.ts @@ -4,7 +4,6 @@ * Handles platform-specific config paths, config file generation, * and auto-opening config files for user editing. */ -export declare function getConfigDir(): string; export declare function getDataDir(): string; export declare function getConfigPath(): string; export interface MemClawConfig { @@ -31,8 +30,12 @@ export interface MemClawConfig { host: string; port: number; }; + logging: { + enabled: boolean; + log_directory: string; + level: string; + }; cortex: { - data_dir: string; enable_intent_analysis: boolean; }; } diff --git a/examples/@memclaw/plugin/dist/src/config.d.ts.map b/examples/@memclaw/plugin/dist/src/config.d.ts.map index eb4004e..ad9ee8e 100644 --- a/examples/@memclaw/plugin/dist/src/config.d.ts.map +++ b/examples/@memclaw/plugin/dist/src/config.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,wBAAgB,YAAY,IAAI,MAAM,CAarC;AAED,wBAAgB,UAAU,IAAI,MAAM,CAoBnC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,GAAG,EAAE;QACH,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,SAAS,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;CACH;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CA6C/C;AAED,wBAAgB,kBAAkB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAevE;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhE;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CA8E7D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG;IACrD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAoBA"} \ No newline at end of file +{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,wBAAgB,UAAU,IAAI,MAAM,CAkBnC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,GAAG,EAAE;QACH,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,SAAS,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE;QACN,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;CACH;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CA2C/C;AAED,wBAAgB,kBAAkB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAevE;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhE;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAkF7D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG;IACrD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAoBA"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/src/config.js b/examples/@memclaw/plugin/dist/src/config.js index c8b3c79..6c6211f 100644 --- a/examples/@memclaw/plugin/dist/src/config.js +++ b/examples/@memclaw/plugin/dist/src/config.js @@ -39,7 +39,6 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -exports.getConfigDir = getConfigDir; exports.getDataDir = getDataDir; exports.getConfigPath = getConfigPath; exports.generateConfigTemplate = generateConfigTemplate; @@ -52,39 +51,26 @@ const path = __importStar(require("path")); const os = __importStar(require("os")); const child_process_1 = require("child_process"); // Platform-specific paths -function getConfigDir() { - const platform = process.platform; - if (platform === "win32") { - return path.join(process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"), "memclaw"); - } - else if (platform === "darwin") { - return path.join(os.homedir(), "Library", "Application Support", "memclaw"); - } - else { - return path.join(os.homedir(), ".config", "memclaw"); - } -} function getDataDir() { const platform = process.platform; if (platform === "win32") { - return path.join(process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local"), "memclaw", "data"); + return path.join(process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local"), "memclaw"); } else if (platform === "darwin") { - return path.join(os.homedir(), "Library", "Application Support", "memclaw", "data"); + return path.join(os.homedir(), "Library", "Application Support", "memclaw"); } else { - return path.join(os.homedir(), ".local", "share", "memclaw", "data"); + return path.join(os.homedir(), ".local", "share", "memclaw"); } } function getConfigPath() { - return path.join(getConfigDir(), "config.toml"); + return path.join(getDataDir(), "config.toml"); } function generateConfigTemplate() { - const dataDir = getDataDir().replace(/\\/g, "/"); return `# MemClaw Configuration # # This file was auto-generated. Please fill in the required values below. -# Required fields are marked with [REQUIRED] +# All sections are required - missing sections will cause config to be ignored. # Qdrant Vector Database Configuration [qdrant] @@ -94,20 +80,15 @@ timeout_secs = 30 # LLM Configuration [REQUIRED for memory processing] [llm] -# Your LLM API endpoint (OpenAI-compatible) api_base_url = "https://api.openai.com/v1" -# Your API key [REQUIRED] api_key = "" -# Model for memory extraction and layer generation -model_efficient = "gpt-4o-mini" +model_efficient = "gpt-5-mini" temperature = 0.1 max_tokens = 4096 # Embedding Configuration [REQUIRED for vector search] [embedding] -# Your embedding API endpoint (OpenAI-compatible) api_base_url = "https://api.openai.com/v1" -# Your API key [REQUIRED - can be same as llm.api_key] api_key = "" model_name = "text-embedding-3-small" batch_size = 10 @@ -118,17 +99,22 @@ timeout_secs = 30 host = "localhost" port = 8085 +# Logging Configuration +[logging] +enabled = false +log_directory = "logs" +level = "info" + # Cortex Memory Settings [cortex] -data_dir = "${dataDir}" enable_intent_analysis = false `; } function ensureConfigExists() { - const configDir = getConfigDir(); + const dataDir = getDataDir(); const configPath = getConfigPath(); - if (!fs.existsSync(configDir)) { - fs.mkdirSync(configDir, { recursive: true }); + if (!fs.existsSync(dataDir)) { + fs.mkdirSync(dataDir, { recursive: true }); } if (!fs.existsSync(configPath)) { const template = generateConfigTemplate(); @@ -199,7 +185,6 @@ function parseConfig(configPath) { } } // Apply defaults - const dataDir = getDataDir(); return { qdrant: { url: "http://localhost:6334", @@ -228,8 +213,13 @@ function parseConfig(configPath) { port: 8085, ...(config.server || {}), }, + logging: { + enabled: false, + log_directory: "logs", + level: "info", + ...(config.logging || {}), + }, cortex: { - data_dir: dataDir, enable_intent_analysis: false, ...(config.cortex || {}), }, diff --git a/examples/@memclaw/plugin/dist/src/config.js.map b/examples/@memclaw/plugin/dist/src/config.js.map index 4b280cb..7877982 100644 --- a/examples/@memclaw/plugin/dist/src/config.js.map +++ b/examples/@memclaw/plugin/dist/src/config.js.map @@ -1 +1 @@ -{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQH,oCAaC;AAED,gCAoBC;AAED,sCAEC;AAgCD,wDA6CC;AAED,gDAeC;AAED,wCAwBC;AAED,kCA8EC;AAED,wCAuBC;AA9QD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,iDAAsC;AAEtC,0BAA0B;AAC1B,SAAgB,YAAY;IAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAElC,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CACd,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,EACpE,SAAS,CACV,CAAC;IACJ,CAAC;SAAM,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;AACH,CAAC;AAED,SAAgB,UAAU;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAElC,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CACd,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EA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AAM,CAAC,GAAG,CAAC,OAAO,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM;KACP,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/skill/SKILL.md b/examples/@memclaw/plugin/skill/SKILL.md index 12716e6..920b884 100644 --- a/examples/@memclaw/plugin/skill/SKILL.md +++ b/examples/@memclaw/plugin/skill/SKILL.md @@ -27,11 +27,29 @@ The search engine queries all three layers internally and returns unified result 1. **Qdrant** is running on port 6333/6334 2. **cortex-mem-service** is running on port 8085 with `--data-dir` -3. **LLM/Embedding API keys** are configured in `config.toml` +3. **LLM/Embedding API** is configured in `config.toml` -**User Configuration**: Only `llm.api_key` and `embedding.api_key` are required. All other settings use defaults. +## First-Time Setup (Agent Action Required) -> **See `references/setup.md`** for complete installation, service setup, and configuration instructions. +When MemClaw is used for the first time, **YOU MUST**: + +1. **Ask the user for LLM/Embedding configuration**: + - `llm.api_base_url` — LLM API endpoint (e.g., OpenAI-compatible provider) + - `llm.api_key` — LLM API key + - `embedding.api_base_url` — Embedding API endpoint + - `embedding.api_key` — Embedding API key + +2. **Write the configuration file** to the platform-specific data directory: + + | Platform | config.toml Path | + |----------|------------------| + | macOS | `~/Library/Application Support/memclaw/config.toml` | + | Windows | `%LOCALAPPDATA%\memclaw\config.toml` | + | Linux | `~/.local/share/memclaw/config.toml` | + +3. **Use the full configuration template** from `references/setup.md` + +> **See `references/setup.md`** for the complete configuration file template and service setup details. ## Decision Flow diff --git a/examples/@memclaw/plugin/skill/references/setup.md b/examples/@memclaw/plugin/skill/references/setup.md index 72c2731..66515d1 100644 --- a/examples/@memclaw/plugin/skill/references/setup.md +++ b/examples/@memclaw/plugin/skill/references/setup.md @@ -51,42 +51,40 @@ npm install @memclaw/bin-win-x64 Ensure you are on a supported platform (macOS Apple Silicon or Windows x86/x64). -### Step 2: Prepare Data Directory +### Step 2: Create Data Directory -The `--data-dir` parameter specifies the root directory for MemClaw data. By default, use the system's application data directory: +Create the data directory if it does not exist: -| Platform | Default `--data-dir` | -|----------|----------------------| -| macOS | `~/Library/Application Support/memclaw` | -| Windows | `%LOCALAPPDATA%\memclaw` | -| Linux | `~/.local/share/memclaw` | +| Platform | Command | +|----------|---------| +| macOS | `mkdir -p ~/Library/Application\ Support/memclaw` | +| Windows | `mkdir %LOCALAPPDATA%\memclaw` | +| Linux | `mkdir -p ~/.local/share/memclaw` | -The `config.toml` file should be placed directly in this directory. +### Step 3: Ask User for Configuration -### Step 3: Create Configuration File +**Agent MUST ask the user for the following information:** -**CRITICAL**: The `config.toml` file MUST be placed in the data directory BEFORE starting cortex-mem-service. +1. **LLM Configuration**: + - API endpoint URL (OpenAI-compatible) + - API key -Users only need to configure LLM/Embedding API keys. All other settings use sensible defaults. +2. **Embedding Configuration**: + - API endpoint URL (OpenAI-compatible) + - API key + - Model name (default: `text-embedding-3-small`) -Create `config.toml` with the following minimal content: +### Step 4: Write Configuration File -```toml -# MemClaw Configuration -# Only llm.api_key and embedding.api_key are required. - -# LLM Configuration [REQUIRED] -[llm] -api_base_url = "https://api.openai.com/v1" -api_key = "your-api-key-here" +Write `config.toml` to the data directory with all required sections: -# Embedding Configuration [REQUIRED] -[embedding] -api_base_url = "https://api.openai.com/v1" -api_key = "your-api-key-here" -``` +| Platform | config.toml Path | +|----------|------------------| +| macOS | `~/Library/Application Support/memclaw/config.toml` | +| Windows | `%LOCALAPPDATA%\memclaw\config.toml` | +| Linux | `~/.local/share/memclaw/config.toml` | -**Full configuration with all defaults:** +**Full configuration template:** ```toml # Qdrant Vector Database Configuration @@ -97,7 +95,7 @@ timeout_secs = 30 # LLM Configuration [REQUIRED] [llm] -api_base_url = "https://api.openai.com/v1" +api_base_url = "https://your-llm-provider.com/v1" api_key = "your-api-key-here" model_efficient = "gpt-5-mini" temperature = 0.1 @@ -105,7 +103,7 @@ max_tokens = 4096 # Embedding Configuration [REQUIRED] [embedding] -api_base_url = "https://api.openai.com/v1" +api_base_url = "https://your-embedding-provider.com/v1" api_key = "your-api-key-here" model_name = "text-embedding-3-small" batch_size = 10 @@ -116,12 +114,20 @@ timeout_secs = 30 host = "localhost" port = 8085 +# Logging Configuration +[logging] +enabled = false +log_directory = "logs" +level = "info" + # Cortex Memory Settings [cortex] enable_intent_analysis = false ``` -### Step 4: Verify Services +> **CRITICAL**: All sections are required. If any section is missing, cortex-mem-service will silently fall back to environment variables and the configuration will be ignored. + +### Step 5: Verify Services Check that Qdrant and cortex-mem-service are accessible: @@ -130,7 +136,7 @@ Check that Qdrant and cortex-mem-service are accessible: | Qdrant | 6333 (HTTP), 6334 (gRPC) | HTTP GET to `http://localhost:6333` should return Qdrant version info | | cortex-mem-service | 8085 | HTTP GET to `http://localhost:8085/health` should return `{"status":"ok"}` | -### Step 5: Start Services (if not running) +### Step 6: Start Services (if not running) **Starting Qdrant:** diff --git a/examples/@memclaw/plugin/src/config.ts b/examples/@memclaw/plugin/src/config.ts index 83c2cf4..caf15c7 100644 --- a/examples/@memclaw/plugin/src/config.ts +++ b/examples/@memclaw/plugin/src/config.ts @@ -59,6 +59,11 @@ export interface MemClawConfig { host: string; port: number; }; + logging: { + enabled: boolean; + log_directory: string; + level: string; + }; cortex: { enable_intent_analysis: boolean; }; @@ -68,7 +73,7 @@ export function generateConfigTemplate(): string { return `# MemClaw Configuration # # This file was auto-generated. Please fill in the required values below. -# Required fields are marked with [REQUIRED] +# All sections are required - missing sections will cause config to be ignored. # Qdrant Vector Database Configuration [qdrant] @@ -78,20 +83,15 @@ timeout_secs = 30 # LLM Configuration [REQUIRED for memory processing] [llm] -# Your LLM API endpoint (OpenAI-compatible) api_base_url = "https://api.openai.com/v1" -# Your API key [REQUIRED] api_key = "" -# Model for memory extraction and layer generation -model_efficient = "gpt-4o-mini" +model_efficient = "gpt-5-mini" temperature = 0.1 max_tokens = 4096 # Embedding Configuration [REQUIRED for vector search] [embedding] -# Your embedding API endpoint (OpenAI-compatible) api_base_url = "https://api.openai.com/v1" -# Your API key [REQUIRED - can be same as llm.api_key] api_key = "" model_name = "text-embedding-3-small" batch_size = 10 @@ -102,6 +102,12 @@ timeout_secs = 30 host = "localhost" port = 8085 +# Logging Configuration +[logging] +enabled = false +log_directory = "logs" +level = "info" + # Cortex Memory Settings [cortex] enable_intent_analysis = false @@ -222,6 +228,12 @@ export function parseConfig(configPath: string): MemClawConfig { port: 8085, ...(config.server || {}), }, + logging: { + enabled: false, + log_directory: "logs", + level: "info", + ...(config.logging || {}), + }, cortex: { enable_intent_analysis: false, ...(config.cortex || {}), From 9a3627f2d566c0fdb329904bf27e49b527a5dd27 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Mon, 16 Mar 2026 13:02:54 +0800 Subject: [PATCH 09/10] Update setup.md --- .../@memclaw/plugin/skill/references/setup.md | 252 +----------------- 1 file changed, 1 insertion(+), 251 deletions(-) diff --git a/examples/@memclaw/plugin/skill/references/setup.md b/examples/@memclaw/plugin/skill/references/setup.md index 66515d1..c59d9b6 100644 --- a/examples/@memclaw/plugin/skill/references/setup.md +++ b/examples/@memclaw/plugin/skill/references/setup.md @@ -1,251 +1 @@ -# Setup Guide - -Installation and configuration guide for MemClaw. - -## Supported Platforms - -| Platform | npm Package | -|----------|-------------| -| macOS Apple Silicon | `@memclaw/bin-darwin-arm64` | -| Windows x64 | `@memclaw/bin-win-x64` | - -> **Note**: MemClaw is only supported on the platforms listed above. - -## Requirements - -| Requirement | Details | -|-------------|---------| -| **Node.js** | ≥ 20.0.0 | -| **OpenClaw** | Installed and configured | -| **Qdrant** | Vector database (port 6333/6334) | -| **cortex-mem-service** | Memory service (port 8085) | - -## Binary Installation - -MemClaw binaries (Qdrant, cortex-mem-service, cortex-mem-cli) are distributed via platform-specific npm packages: - -- `@memclaw/bin-darwin-arm64` — macOS Apple Silicon -- `@memclaw/bin-win-x64` — Windows x64 - -These packages are installed automatically as optional dependencies when installing `@memclaw/plugin`. - -### Manual Binary Installation - -If binaries are not installed, run: - -``` -npm install @memclaw/bin-darwin-arm64 -``` - -or (for Windows): - -``` -npm install @memclaw/bin-win-x64 -``` - -## First-Time Setup Checklist - -**Before using MemClaw, complete these steps:** - -### Step 1: Verify Platform Support - -Ensure you are on a supported platform (macOS Apple Silicon or Windows x86/x64). - -### Step 2: Create Data Directory - -Create the data directory if it does not exist: - -| Platform | Command | -|----------|---------| -| macOS | `mkdir -p ~/Library/Application\ Support/memclaw` | -| Windows | `mkdir %LOCALAPPDATA%\memclaw` | -| Linux | `mkdir -p ~/.local/share/memclaw` | - -### Step 3: Ask User for Configuration - -**Agent MUST ask the user for the following information:** - -1. **LLM Configuration**: - - API endpoint URL (OpenAI-compatible) - - API key - -2. **Embedding Configuration**: - - API endpoint URL (OpenAI-compatible) - - API key - - Model name (default: `text-embedding-3-small`) - -### Step 4: Write Configuration File - -Write `config.toml` to the data directory with all required sections: - -| Platform | config.toml Path | -|----------|------------------| -| macOS | `~/Library/Application Support/memclaw/config.toml` | -| Windows | `%LOCALAPPDATA%\memclaw\config.toml` | -| Linux | `~/.local/share/memclaw/config.toml` | - -**Full configuration template:** - -```toml -# Qdrant Vector Database Configuration -[qdrant] -url = "http://localhost:6334" -collection_name = "memclaw" -timeout_secs = 30 - -# LLM Configuration [REQUIRED] -[llm] -api_base_url = "https://your-llm-provider.com/v1" -api_key = "your-api-key-here" -model_efficient = "gpt-5-mini" -temperature = 0.1 -max_tokens = 4096 - -# Embedding Configuration [REQUIRED] -[embedding] -api_base_url = "https://your-embedding-provider.com/v1" -api_key = "your-api-key-here" -model_name = "text-embedding-3-small" -batch_size = 10 -timeout_secs = 30 - -# Service Configuration -[server] -host = "localhost" -port = 8085 - -# Logging Configuration -[logging] -enabled = false -log_directory = "logs" -level = "info" - -# Cortex Memory Settings -[cortex] -enable_intent_analysis = false -``` - -> **CRITICAL**: All sections are required. If any section is missing, cortex-mem-service will silently fall back to environment variables and the configuration will be ignored. - -### Step 5: Verify Services - -Check that Qdrant and cortex-mem-service are accessible: - -| Service | Port | Health Check | -|---------|------|--------------| -| Qdrant | 6333 (HTTP), 6334 (gRPC) | HTTP GET to `http://localhost:6333` should return Qdrant version info | -| cortex-mem-service | 8085 | HTTP GET to `http://localhost:8085/health` should return `{"status":"ok"}` | - -### Step 6: Start Services (if not running) - -**Starting Qdrant:** - -If `autoStartServices` is `true` in plugin config, MemClaw will start Qdrant automatically. - -To start manually, run the Qdrant binary from the platform package with: -- `--storage-path` pointing to a storage directory -- `--http-port 6333` -- `--grpc-port 6334` - -**Starting cortex-mem-service:** - -**CRITICAL**: cortex-mem-service MUST be started with `--data-dir` flag pointing to the directory containing `config.toml`. - -Arguments: -- `--data-dir ` — Path to data directory containing `config.toml` (**REQUIRED**) - -Example: -``` -cortex-mem-service --data-dir ~/Library/Application\ Support/memclaw -``` - -Or on Windows: -``` -cortex-mem-service --data-dir %LOCALAPPDATA%\memclaw -``` - -## Plugin Configuration - -Edit your `openclaw.json`: - -```json -{ - "plugins": { - "entries": { - "memclaw": { - "enabled": true, - "config": { - "serviceUrl": "http://localhost:8085", - "tenantId": "tenant_claw", - "autoStartServices": true - } - } - } - }, - "agents": { - "defaults": { - "memorySearch": { "enabled": false } - } - } -} -``` - -> **Important**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory search and use MemClaw instead. - -### Configuration Options - -| Option | Type | Default | Description | -|--------|------|---------|-------------| -| `serviceUrl` | string | `http://localhost:8085` | Cortex Memory service URL | -| `tenantId` | string | `tenant_claw` | Tenant ID for data isolation | -| `autoStartServices` | boolean | `true` | Auto-start Qdrant and cortex-mem-service | -| `defaultSessionId` | string | `default` | Default session for memory operations | -| `searchLimit` | number | `10` | Default number of search results | -| `minScore` | number | `0.6` | Minimum relevance score (0-1) | - -## Troubleshooting - -### Platform Not Supported - -If you see "Platform not supported" error: -- Verify you are on macOS Apple Silicon or Windows x64 -- Check that the correct `@memclaw/bin-*` package is installed - -### Binaries Not Found - -If binaries are missing: -1. Verify `@memclaw/bin-*` package is in `node_modules` -2. Try reinstalling: `npm install @memclaw/bin-darwin-arm64` (or `bin-win-x64`) - -### cortex-mem-service Won't Start - -1. Verify `--data-dir` flag is provided -2. Verify `config.toml` exists in the data directory -3. Verify required fields in `config.toml`: - - `llm.api_key` is non-empty - - `embedding.api_key` is non-empty - -Default data directories: -| Platform | Path | -|----------|------| -| macOS | `~/Library/Application Support/memclaw` | -| Windows | `%LOCALAPPDATA%\memclaw` | -| Linux | `~/.local/share/memclaw` | - -### Services Not Accessible - -1. Verify ports 6333, 6334, 8085 are not in use by other applications -2. Verify firewall allows connections on these ports -3. Check service logs for error messages - -### Configuration File Issues - -1. Ensure `config.toml` uses valid TOML syntax -2. Verify file encoding is UTF-8 -3. On Windows, use double backslashes in paths: `C:\\Users\\...` - -### API Key Issues - -1. Verify API key is valid and has sufficient credits -2. Verify `api_base_url` is correct for your provider -3. Verify network connectivity to the API endpoint +d \ No newline at end of file From a98e4d22977e27642f283de6600798006963204c Mon Sep 17 00:00:00 2001 From: Sopaco Date: Mon, 16 Mar 2026 13:10:34 +0800 Subject: [PATCH 10/10] Bump version to 0.9.6 and update setup documentation Updates the version number across all relevant files and replaces the minimal setup.md with comprehensive installation and configuration instructions for MemClaw. --- examples/@memclaw/plugin/dist/index.js | 46 ++-- examples/@memclaw/plugin/index.ts | 2 +- examples/@memclaw/plugin/openclaw.plugin.json | 2 +- examples/@memclaw/plugin/package.json | 2 +- .../@memclaw/plugin/skill/references/setup.md | 256 +++++++++++++++++- 5 files changed, 281 insertions(+), 27 deletions(-) diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index 047727f..646bd54 100644 --- a/examples/@memclaw/plugin/dist/index.js +++ b/examples/@memclaw/plugin/dist/index.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /** * MemClaw - Layered Semantic Memory for OpenClaw * @@ -26,33 +26,33 @@ * } * } */ -Object.defineProperty(exports, "__esModule", { value: true }); +Object.defineProperty(exports, '__esModule', { value: true }); exports.plugin = void 0; exports.default = memclawPlugin; -const plugin_impl_js_1 = require("./plugin-impl.js"); +const plugin_impl_js_1 = require('./plugin-impl.js'); // Default export - main plugin function function memclawPlugin(api) { - return (0, plugin_impl_js_1.createPlugin)(api); + return (0, plugin_impl_js_1.createPlugin)(api); } // Named export - object style registration exports.plugin = { - id: 'memclaw', - name: 'MemClaw', - version: '0.9.5', - configSchema: { - type: 'object', - properties: { - serviceUrl: { type: 'string', default: 'http://localhost:8085' }, - defaultSessionId: { type: 'string', default: 'default' }, - searchLimit: { type: 'integer', default: 10 }, - minScore: { type: 'number', default: 0.6 }, - tenantId: { type: 'string', default: 'tenant_claw' }, - autoStartServices: { type: 'boolean', default: true } - }, - required: [] - }, - register(api) { - return (0, plugin_impl_js_1.createPlugin)(api); - } + id: 'memclaw', + name: 'MemClaw', + version: '0.9.6', + configSchema: { + type: 'object', + properties: { + serviceUrl: { type: 'string', default: 'http://localhost:8085' }, + defaultSessionId: { type: 'string', default: 'default' }, + searchLimit: { type: 'integer', default: 10 }, + minScore: { type: 'number', default: 0.6 }, + tenantId: { type: 'string', default: 'tenant_claw' }, + autoStartServices: { type: 'boolean', default: true } + }, + required: [] + }, + register(api) { + return (0, plugin_impl_js_1.createPlugin)(api); + } }; -//# sourceMappingURL=index.js.map \ No newline at end of file +//# sourceMappingURL=index.js.map diff --git a/examples/@memclaw/plugin/index.ts b/examples/@memclaw/plugin/index.ts index 58ed203..ffe2c33 100644 --- a/examples/@memclaw/plugin/index.ts +++ b/examples/@memclaw/plugin/index.ts @@ -68,7 +68,7 @@ export default function memclawPlugin(api: PluginAPI) { export const plugin = { id: 'memclaw', name: 'MemClaw', - version: '0.9.5', + version: '0.9.6', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index ed8246a..aa50803 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,7 +1,7 @@ { "id": "memclaw", "name": "MemClaw", - "version": "0.9.5", + "version": "0.9.6", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", "skills": ["skill"], diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index 57f1c3c..c76d3ac 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@memclaw/plugin", - "version": "0.9.5", + "version": "0.9.6", "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "publishConfig": { "access": "public" diff --git a/examples/@memclaw/plugin/skill/references/setup.md b/examples/@memclaw/plugin/skill/references/setup.md index c59d9b6..f45ab9c 100644 --- a/examples/@memclaw/plugin/skill/references/setup.md +++ b/examples/@memclaw/plugin/skill/references/setup.md @@ -1 +1,255 @@ -d \ No newline at end of file +# Setup Guide + +Installation and configuration guide for MemClaw. + +## Supported Platforms + +| Platform | npm Package | +|----------|-------------| +| macOS Apple Silicon | `@memclaw/bin-darwin-arm64` | +| Windows x64 | `@memclaw/bin-win-x64` | + +> **Note**: MemClaw is only supported on the platforms listed above. + +## Requirements + +| Requirement | Details | +|-------------|---------| +| **Node.js** | ≥ 20.0.0 | +| **OpenClaw** | Installed and configured | +| **Qdrant** | Vector database (port 6333/6334) | +| **cortex-mem-service** | Memory service (port 8085) | + +## Binary Installation + +MemClaw binaries (Qdrant, cortex-mem-service, cortex-mem-cli) are distributed via platform-specific npm packages: + +- `@memclaw/bin-darwin-arm64` — macOS Apple Silicon +- `@memclaw/bin-win-x64` — Windows x64 + +These packages are installed automatically as optional dependencies when installing `@memclaw/plugin`. + +### Manual Binary Installation + +If binaries are not installed, run: + +``` +npm install @memclaw/bin-darwin-arm64 +or +bun install @memclaw/bin-darwin-arm64 +``` + +or (for Windows): + +``` +npm install @memclaw/bin-win-x64 +or +bun install @memclaw/bin-win-x64 +``` + +## First-Time Setup Checklist + +**Before using MemClaw, complete these steps:** + +### Step 1: Verify Platform Support + +Ensure you are on a supported platform (macOS Apple Silicon or Windows x86/x64). + +### Step 2: Create Data Directory + +Create the data directory if it does not exist: + +| Platform | Command | +|----------|---------| +| macOS | `mkdir -p ~/Library/Application\ Support/memclaw` | +| Windows | `mkdir %LOCALAPPDATA%\memclaw` | +| Linux | `mkdir -p ~/.local/share/memclaw` | + +### Step 3: Ask User for Configuration + +**Agent MUST ask the user for the following information:** + +1. **LLM Configuration**: + - API endpoint URL (OpenAI-compatible) + - API key + +2. **Embedding Configuration**: + - API endpoint URL (OpenAI-compatible) + - API key + - Model name (default: `text-embedding-3-small`) + +### Step 4: Write Configuration File + +Write `config.toml` to the data directory with all required sections: + +| Platform | config.toml Path | +|----------|------------------| +| macOS | `~/Library/Application Support/memclaw/config.toml` | +| Windows | `%LOCALAPPDATA%\memclaw\config.toml` | +| Linux | `~/.local/share/memclaw/config.toml` | + +**Full configuration template:** + +```toml +# Qdrant Vector Database Configuration +[qdrant] +url = "http://localhost:6334" +collection_name = "memclaw" +timeout_secs = 30 + +# LLM Configuration [REQUIRED] +[llm] +api_base_url = "https://your-llm-provider.com/v1" +api_key = "your-api-key-here" +model_efficient = "gpt-5-mini" +temperature = 0.1 +max_tokens = 4096 + +# Embedding Configuration [REQUIRED] +[embedding] +api_base_url = "https://your-embedding-provider.com/v1" +api_key = "your-api-key-here" +model_name = "text-embedding-3-small" +batch_size = 10 +timeout_secs = 30 + +# Service Configuration +[server] +host = "localhost" +port = 8085 + +# Logging Configuration +[logging] +enabled = false +log_directory = "logs" +level = "info" + +# Cortex Memory Settings +[cortex] +enable_intent_analysis = false +``` + +> **CRITICAL**: All sections are required. If any section is missing, cortex-mem-service will silently fall back to environment variables and the configuration will be ignored. + +### Step 5: Verify Services + +Check that Qdrant and cortex-mem-service are accessible: + +| Service | Port | Health Check | +|---------|------|--------------| +| Qdrant | 6333 (HTTP), 6334 (gRPC) | HTTP GET to `http://localhost:6333` should return Qdrant version info | +| cortex-mem-service | 8085 | HTTP GET to `http://localhost:8085/health` should return `{"status":"ok"}` | + +### Step 6: Start Services (if not running) + +**Starting Qdrant:** + +If `autoStartServices` is `true` in plugin config, MemClaw will start Qdrant automatically. + +To start manually, run the Qdrant binary from the platform package with: +- `--storage-path` pointing to a storage directory +- `--http-port 6333` +- `--grpc-port 6334` + +**Starting cortex-mem-service:** + +**CRITICAL**: cortex-mem-service MUST be started with `--data-dir` flag pointing to the directory containing `config.toml`. + +Arguments: +- `--data-dir ` — Path to data directory containing `config.toml` (**REQUIRED**) + +Example: +``` +cortex-mem-service --data-dir ~/Library/Application\ Support/memclaw +``` + +Or on Windows: +``` +cortex-mem-service --data-dir %LOCALAPPDATA%\memclaw +``` + +## Plugin Configuration + +Edit your `openclaw.json`: + +```json +{ + "plugins": { + "entries": { + "memclaw": { + "enabled": true, + "config": { + "serviceUrl": "http://localhost:8085", + "tenantId": "tenant_claw", + "autoStartServices": true + } + } + } + }, + "agents": { + "defaults": { + "memorySearch": { "enabled": false } + } + } +} +``` + +> **Important**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory search and use MemClaw instead. + +### Configuration Options + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `serviceUrl` | string | `http://localhost:8085` | Cortex Memory service URL | +| `tenantId` | string | `tenant_claw` | Tenant ID for data isolation | +| `autoStartServices` | boolean | `true` | Auto-start Qdrant and cortex-mem-service | +| `defaultSessionId` | string | `default` | Default session for memory operations | +| `searchLimit` | number | `10` | Default number of search results | +| `minScore` | number | `0.6` | Minimum relevance score (0-1) | + +## Troubleshooting + +### Platform Not Supported + +If you see "Platform not supported" error: +- Verify you are on macOS Apple Silicon or Windows x64 +- Check that the correct `@memclaw/bin-*` package is installed + +### Binaries Not Found + +If binaries are missing: +1. Verify `@memclaw/bin-*` package is in `node_modules` +2. Try npm/bun reinstalling: `npm install @memclaw/bin-darwin-arm64` (or `bin-win-x64`) + +### cortex-mem-service Won't Start + +1. Verify `--data-dir` flag is provided +2. Verify `config.toml` exists in the data directory +3. Verify required fields in `config.toml`: + - `llm.api_key` is non-empty + - `embedding.api_key` is non-empty + +Default data directories: +| Platform | Path | +|----------|------| +| macOS | `~/Library/Application Support/memclaw` | +| Windows | `%LOCALAPPDATA%\memclaw` | +| Linux | `~/.local/share/memclaw` | + +### Services Not Accessible + +1. Verify ports 6333, 6334, 8085 are not in use by other applications +2. Verify firewall allows connections on these ports +3. Check service logs for error messages + +### Configuration File Issues + +1. Ensure `config.toml` uses valid TOML syntax +2. Verify file encoding is UTF-8 +3. On Windows, use double backslashes in paths: `C:\\Users\\...` + +### API Key Issues + +1. Verify API key is valid and has sufficient credits +2. Verify `api_base_url` is correct for your provider +3. Verify network connectivity to the API endpoint