From e2bbd6491c50f2f444ac7e6984f42c7c258ddb15 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 09:38:28 +0800 Subject: [PATCH 01/14] Add SECURITY.md and update plugin version to 0.9.12 --- examples/@memclaw/plugin/SECURITY.md | 88 ++++++ examples/@memclaw/plugin/dist/index.js | 38 +-- examples/@memclaw/plugin/index.ts | 78 +++--- examples/@memclaw/plugin/openclaw.plugin.json | 260 +++++++++--------- examples/@memclaw/plugin/package.json | 121 ++++---- examples/@memclaw/plugin/skill/SKILL.md | 45 +-- 6 files changed, 370 insertions(+), 260 deletions(-) create mode 100644 examples/@memclaw/plugin/SECURITY.md diff --git a/examples/@memclaw/plugin/SECURITY.md b/examples/@memclaw/plugin/SECURITY.md new file mode 100644 index 0000000..5299c24 --- /dev/null +++ b/examples/@memclaw/plugin/SECURITY.md @@ -0,0 +1,88 @@ +# Security Information + +This document describes security considerations for the MemClaw plugin. + +## Data Flow + +``` +User Input → OpenClaw → MemClaw Plugin → cortex-mem-service (localhost:8085) + │ + ▼ + Qdrant (localhost:6334) + │ + ▼ + Local Storage +``` + +**Key Points:** +- All data processing happens **locally** on your machine +- No data is sent to external servers except your configured LLM/Embedding providers +- API keys are only transmitted to your configured API endpoints + +## Credentials + +### Required Credentials + +| Credential | Purpose | Storage Location | +|------------|---------|------------------| +| `llmApiKey` | Memory extraction and summarization | OpenClaw plugin config (marked `sensitive: true`) | +| `embeddingApiKey` | Vector embedding generation | OpenClaw plugin config (marked `sensitive: true`) | + +### Credential Security + +- API keys are stored in `openclaw.json` with the `sensitive` flag +- Keys are **never** logged or transmitted except to your configured API provider +- Keys are **never** sent to the MemClaw developers or any third party + +## Binary Packages + +### What's Included + +MemClaw uses platform-specific binary packages distributed via npm: + +| Package | Platform | Contents | +|---------|----------|----------| +| `@memclaw/bin-darwin-arm64` | macOS Apple Silicon | Qdrant, cortex-mem-service, cortex-mem-cli | +| `@memclaw/bin-win-x64` | Windows x64 | Qdrant, cortex-mem-service, cortex-mem-cli | + +### Verification + +To verify binary packages: + +```bash +# Check package integrity via npm +npm view @memclaw/bin-darwin-arm64 +npm view @memclaw/bin-win-x64 + +# Inspect package contents +npm pack @memclaw/bin-darwin-arm64 +tar -tzf memclaw-bin-darwin-arm64-*.tgz +``` + +### Source Code + +The source code for building these binaries is available in the main repository: +- Repository: https://github.com/sopaco/cortex-mem +- Build scripts: `cortex-mem-core/`, `cortex-mem-service/` + +## Network Security + +### Ports Used + +| Service | Port | Protocol | Purpose | +|---------|------|----------|---------| +| Qdrant HTTP | 6333 | TCP | REST API, health checks | +| Qdrant gRPC | 6334 | TCP | Vector operations | +| cortex-mem-service | 8085 | TCP | Memory service API | + +### Firewall Configuration + +If you use a firewall, ensure: +- Ports 6333, 6334, 8085 are allowed for **localhost only** +- External connections to these ports are blocked + +### Localhost Only + +All services bind to `localhost` (127.0.0.1) by default: +- No external network access is required +- Services are not accessible from other machines diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index 20a8087..a7cbc80 100644 --- a/examples/@memclaw/plugin/dist/index.js +++ b/examples/@memclaw/plugin/dist/index.js @@ -32,27 +32,27 @@ 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); + return (0, plugin_impl_js_1.createPlugin)(api); } // Named export - object style registration exports.plugin = { - id: 'memclaw', - name: 'MemClaw', - version: '0.9.11', - 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: [] + id: "memclaw", + name: "MemClaw", + version: "0.9.12", + 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 }, }, - register(api) { - return (0, plugin_impl_js_1.createPlugin)(api); - } + 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 6d12f03..a0d895d 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.11', - 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.12", + 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 21c7b01..74b6651 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,127 +1,137 @@ { - "id": "memclaw", - "name": "MemClaw", - "version": "0.9.11", - "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", - "kind": "memory", - "skills": ["skill"], - "platforms": ["darwin-arm64", "win32-x64"], - "configSchema": { - "type": "object", - "properties": { - "serviceUrl": { - "type": "string", - "description": "Cortex Memory service URL", - "default": "http://localhost: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 - }, - "llmApiBaseUrl": { - "type": "string", - "description": "LLM API endpoint URL (OpenAI-compatible)", - "default": "https://api.openai.com/v1" - }, - "llmApiKey": { - "type": "string", - "description": "LLM API key for memory extraction and summarization" - }, - "llmModel": { - "type": "string", - "description": "LLM model name for memory processing", - "default": "gpt-5-mini" - }, - "embeddingApiBaseUrl": { - "type": "string", - "description": "Embedding API endpoint URL (OpenAI-compatible)", - "default": "https://api.openai.com/v1" - }, - "embeddingApiKey": { - "type": "string", - "description": "Embedding API key for vector generation" - }, - "embeddingModel": { - "type": "string", - "description": "Embedding model name for vector search", - "default": "text-embedding-3-small" - } - }, - "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" - }, - "llmApiBaseUrl": { - "label": "LLM API URL", - "description": "OpenAI-compatible LLM endpoint (e.g., https://api.openai.com/v1)" - }, - "llmApiKey": { - "label": "LLM API Key", - "description": "API key for LLM service (required for memory processing)", - "sensitive": true - }, - "llmModel": { - "label": "LLM Model", - "description": "Model name for memory extraction and summarization" - }, - "embeddingApiBaseUrl": { - "label": "Embedding API URL", - "description": "OpenAI-compatible embedding endpoint" - }, - "embeddingApiKey": { - "label": "Embedding API Key", - "description": "API key for embedding service (required for vector search)", - "sensitive": true - }, - "embeddingModel": { - "label": "Embedding Model", - "description": "Model name for generating vector embeddings" - } - } + "id": "memclaw", + "name": "MemClaw", + "version": "0.9.12", + "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", + "kind": "memory", + "skills": ["skill"], + "platforms": ["darwin-arm64", "win32-x64"], + "osRestriction": ["darwin-arm64", "win32-x64"], + "configSchema": { + "type": "object", + "properties": { + "serviceUrl": { + "type": "string", + "description": "Cortex Memory service URL", + "default": "http://localhost: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 + }, + "llmApiBaseUrl": { + "type": "string", + "description": "LLM API endpoint URL (OpenAI-compatible)", + "default": "https://api.openai.com/v1" + }, + "llmApiKey": { + "type": "string", + "description": "LLM API key for memory extraction and summarization", + "sensitive": true + }, + "llmModel": { + "type": "string", + "description": "LLM model name for memory processing", + "default": "gpt-5-mini" + }, + "embeddingApiBaseUrl": { + "type": "string", + "description": "Embedding API endpoint URL (OpenAI-compatible)", + "default": "https://api.openai.com/v1" + }, + "embeddingApiKey": { + "type": "string", + "description": "Embedding API key for vector generation", + "sensitive": true + }, + "embeddingModel": { + "type": "string", + "description": "Embedding model name for vector search", + "default": "text-embedding-3-small" + } + }, + "required": [ + "llmApiKey", + "embeddingApiKey", + "llmApiBaseUrl", + "llmModel", + "embeddingApiBaseUrl", + "embeddingModel" + ] + }, + "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" + }, + "llmApiBaseUrl": { + "label": "LLM API URL", + "description": "OpenAI-compatible LLM endpoint (e.g., https://api.openai.com/v1)" + }, + "llmApiKey": { + "label": "LLM API Key", + "description": "API key for LLM service (required for memory processing)", + "sensitive": true + }, + "llmModel": { + "label": "LLM Model", + "description": "Model name for memory extraction and summarization" + }, + "embeddingApiBaseUrl": { + "label": "Embedding API URL", + "description": "OpenAI-compatible embedding endpoint" + }, + "embeddingApiKey": { + "label": "Embedding API Key", + "description": "API key for embedding service (required for vector search)", + "sensitive": true + }, + "embeddingModel": { + "label": "Embedding Model", + "description": "Model name for generating vector embeddings" + } + } } diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index a6b3cb2..9b5d4a6 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,62 +1,63 @@ { - "name": "@memclaw/memclaw", - "version": "0.9.11", - "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", - "homepage": "https://github.com/sopaco/cortex-mem", - "repository": { - "type": "git", - "url": "https://github.com/sopaco/cortex-mem.git", - "directory": "examples/@memclaw/plugin" - }, - "bugs": { - "url": "https://github.com/sopaco/cortex-mem/issues" - }, - "publishConfig": { - "access": "public" - }, - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc", - "dev": "tsc --watch" - }, - "keywords": [ - "openclaw", - "memory", - "semantic-search", - "vector-search", - "ai", - "agent", - "cortex-mem" - ], - "author": "Sopaco", - "license": "MIT", - "openclaw": { - "extensions": [ - "dist/index.js" - ], - "skills": [ - "skill" - ] - }, - "devDependencies": { - "@types/node": "^22.0.0", - "typescript": "^5.7.0" - }, - "dependencies": { - "glob": "^11.0.0" - }, - "optionalDependencies": { - "@memclaw/bin-darwin-arm64": "0.1.0", - "@memclaw/bin-win-x64": "0.1.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "files": [ - "dist/", - "skill/", - "openclaw.plugin.json", - "README.md" - ] + "name": "@memclaw/memclaw", + "version": "0.9.12", + "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", + "homepage": "https://github.com/sopaco/cortex-mem", + "repository": { + "type": "git", + "url": "https://github.com/sopaco/cortex-mem.git", + "directory": "examples/@memclaw/plugin" + }, + "bugs": { + "url": "https://github.com/sopaco/cortex-mem/issues" + }, + "publishConfig": { + "access": "public" + }, + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc", + "dev": "tsc --watch" + }, + "keywords": [ + "openclaw", + "memory", + "semantic-search", + "vector-search", + "ai", + "agent", + "cortex-mem" + ], + "author": "Sopaco", + "license": "MIT", + "openclaw": { + "extensions": [ + "dist/index.js" + ], + "skills": [ + "skill" + ] + }, + "devDependencies": { + "@types/node": "^22.0.0", + "typescript": "^5.7.0" + }, + "dependencies": { + "glob": "^11.0.0" + }, + "optionalDependencies": { + "@memclaw/bin-darwin-arm64": "0.1.0", + "@memclaw/bin-win-x64": "0.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "files": [ + "dist/", + "skill/", + "openclaw.plugin.json", + "README.md", + "SECURITY.md" + ] } diff --git a/examples/@memclaw/plugin/skill/SKILL.md b/examples/@memclaw/plugin/skill/SKILL.md index 434a77c..f8188e4 100644 --- a/examples/@memclaw/plugin/skill/SKILL.md +++ b/examples/@memclaw/plugin/skill/SKILL.md @@ -9,6 +9,20 @@ description: MemClaw — Advanced semantic memory for OpenClaw. This is a better Layered semantic memory system for OpenClaw with automatic service management. +## Security & Trust + +**What this plugin does:** +- Stores memory data locally in your user data directory +- Starts local services (Qdrant vector DB, cortex-mem-service) on localhost ports 6333/6334/8085 +- Requires LLM/Embedding API keys (stored in OpenClaw plugin config, marked as sensitive) +- Reads existing OpenClaw memory files only during migration + +**What this plugin does NOT do:** +- Does NOT send your data to external servers (all processing is local) +- Does NOT transmit your API keys anywhere except to your configured LLM/embedding provider + +**Binary packages:** Platform-specific binaries (`@memclaw/bin-darwin-arm64`, `@memclaw/bin-win-x64`) are distributed via npm registry and contain Qdrant, cortex-mem-service, and cortex-mem-cli. + ## How Memory Works MemClaw provides **three-layer semantic memory** with tiered retrieval: @@ -93,10 +107,17 @@ The platform-specific binaries (Qdrant, cortex-mem-service, cortex-mem-cli) are ## Configuration -### Recommended: Configure in OpenClaw Settings +### Configure API Keys (REQUIRED) -Configure LLM and Embedding API directly in OpenClaw plugin settings (`openclaw.json`): +1. Open OpenClaw Settings (`openclaw.json` or via UI) +2. Navigate to Plugins → MemClaw → Configuration +3. Enter your API keys in the secure fields: + - `llmApiKey` — Your LLM API key (marked as sensitive) + - `embeddingApiKey` — Your Embedding API key (marked as sensitive) +4. Optionally customize API endpoints and model names +5. Save and restart OpenClaw +**Example configuration in `openclaw.json`:** ```json { "plugins": { @@ -117,7 +138,7 @@ Configure LLM and Embedding API directly in OpenClaw plugin settings (`openclaw. } ``` -**Configuration will be automatically synced to the service config file on startup.** +> **Security Note**: API keys are stored in OpenClaw's configuration with the `sensitive` flag. Never share your `openclaw.json` file publicly. ### Advanced: Direct Config File @@ -131,23 +152,13 @@ For advanced users, you can also edit the config file directly: > **See `references/setup.md`** for the complete configuration file template and service setup details. -## First-Time Setup (Agent Action Required) - -**Before using MemClaw for the first time, you MUST verify the prerequisites are met:** - -### Step 1: Check Prerequisites (REQUIRED) +## First-Time Setup -Consult `references/setup.md` and verify: +**Before using MemClaw for the first time, complete these steps:** -1. **Platform support**: macOS Apple Silicon or Windows x64 only -2. **Binaries installed**: Check `@memclaw/bin-*` package is installed -3. **LLM/Embedding API configured**: API keys are set in OpenClaw plugin settings -4. **Services accessible**: Qdrant (ports 6333/6334) and cortex-mem-service (port 8085) can start +### Step 1: Verify Prerequisites -**If any prerequisite is missing:** -- Guide user through installation (see `references/setup.md`) -- Help configure API keys in OpenClaw plugin settings -- Do NOT proceed with memory operations until prerequisites are met +1. **Plugin installed**: `@memclaw/memclaw` is in your OpenClaw plugins list ### Step 2: Verify Configuration From e15ee8e14848106f0b33bc09e88883121bcb82ca Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 13:10:59 +0800 Subject: [PATCH 02/14] Fix binary service config loading and code style issues The cortex-mem-service now correctly reads config.toml by setting the working directory to dataDir. Updated quotes in type definitions and improved code formatting in the plugin index file. --- examples/@memclaw/plugin/dist/index.d.ts | 4 +- examples/@memclaw/plugin/dist/index.d.ts.map | 2 +- examples/@memclaw/plugin/dist/index.js | 38 +++++++++---------- examples/@memclaw/plugin/dist/index.js.map | 2 +- .../plugin/dist/src/binaries.d.ts.map | 2 +- examples/@memclaw/plugin/dist/src/binaries.js | 6 ++- .../@memclaw/plugin/dist/src/binaries.js.map | 2 +- examples/@memclaw/plugin/src/binaries.ts | 6 ++- 8 files changed, 33 insertions(+), 29 deletions(-) diff --git a/examples/@memclaw/plugin/dist/index.d.ts b/examples/@memclaw/plugin/dist/index.d.ts index d444215..2889add 100644 --- a/examples/@memclaw/plugin/dist/index.d.ts +++ b/examples/@memclaw/plugin/dist/index.d.ts @@ -25,8 +25,8 @@ * } * } */ -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"; interface PluginLogger { debug?: (msg: string, ...args: unknown[]) => void; info: (msg: string, ...args: unknown[]) => void; diff --git a/examples/@memclaw/plugin/dist/index.d.ts.map b/examples/@memclaw/plugin/dist/index.d.ts.map index b78986e..c98b93d 100644 --- a/examples/@memclaw/plugin/dist/index.d.ts.map +++ b/examples/@memclaw/plugin/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,YAAY,EAAE,eAAe,E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,CAAA;KAAE,GAAG,IAAI,CAAC;IACxE,eAAe,CAAC,OAAO,EAAE;QACvB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC3B,GAAG,IAAI,CAAC;IACT,MAAM,EAAE,YAAY,CAAC;CACtB;AAGD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,GAAG,EAAE,SAAS;;;;EAEnD;AAGD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgBH,SAAS;;;;;CAGxB,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index a7cbc80..4acd9c8 100644 --- a/examples/@memclaw/plugin/dist/index.js +++ b/examples/@memclaw/plugin/dist/index.js @@ -32,27 +32,27 @@ 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); + return (0, plugin_impl_js_1.createPlugin)(api); } // Named export - object style registration exports.plugin = { - id: "memclaw", - name: "MemClaw", - version: "0.9.12", - 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 }, + id: "memclaw", + name: "MemClaw", + version: "0.9.12", + 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); }, - 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/index.js.map b/examples/@memclaw/plugin/dist/index.js.map index a1beff1..4b274c4 100644 --- a/examples/@memclaw/plugin/dist/index.js.map +++ b/examples/@memclaw/plugin/dist/index.js.map @@ -1 +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,QAAQ;IACjB,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 +{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAoCH,gCAEC;AApCD,qDAAgD;AAiChD,wCAAwC;AACxC,SAAwB,aAAa,CAAC,GAAc;IAClD,OAAO,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED,2CAA2C;AAC9B,QAAA,MAAM,GAAG;IACpB,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,QAAQ;IACjB,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,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;SACtD;QACD,QAAQ,EAAE,EAAE;KACb;IACD,QAAQ,CAAC,GAAc;QACrB,OAAO,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC"} \ 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 index 6b6aecc..7d2d4c3 100644 --- a/examples/@memclaw/plugin/dist/src/binaries.d.ts.map +++ b/examples/@memclaw/plugin/dist/src/binaries.d.ts.map @@ -1 +1 @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AAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAwB3F;AAGD,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAE1C;AAGD,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,MAAM,EAAE,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,MAAe,GACtB,OAAO,CAAC,SAAS,CAAC,CA+DpB"} \ 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 9a068bf..86c34cd 100644 --- a/examples/@memclaw/plugin/dist/src/binaries.js +++ b/examples/@memclaw/plugin/dist/src/binaries.js @@ -283,10 +283,12 @@ async function startCortexMemService(log) { const dataDir = (0, config_js_1.getDataDir)(); log?.(`Starting cortex-mem-service with data-dir ${dataDir}...`); log?.(`Binary path: ${binaryPath}`); - // cortex-mem-service automatically reads config.toml from --data-dir + // cortex-mem-service reads config.toml from current working directory + // Set cwd to dataDir so it can find the config file const proc = (0, child_process_1.spawn)(binaryPath, ['--data-dir', dataDir], { stdio: ['ignore', 'pipe', 'pipe'], - detached: true + detached: true, + cwd: dataDir // Set working directory so config.toml can be found }); // Drain stdout/stderr to prevent buffer blocking proc.stdout?.on('data', (data) => { diff --git a/examples/@memclaw/plugin/dist/src/binaries.js.map b/examples/@memclaw/plugin/dist/src/binaries.js.map index 9156dc7..b686f69 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;;;;;;;;;;;;;;;;;;;;;;;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AAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAChC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,OAAO,CAAC;gBACP,OAAO,EAAE,KAAK;gBACd,MAAM;gBACN,MAAM,EAAE,MAAM,GAAG,qBAAqB;gBACtC,QAAQ,EAAE,IAAI;aACd,CAAC,CAAC;QACJ,CAAC,EAAE,OAAO,CAAC,CAAC;QAEZ,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC;gBACP,OAAO,EAAE,IAAI,KAAK,CAAC;gBACnB,MAAM;gBACN,MAAM;gBACN,QAAQ,EAAE,IAAI;aACd,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACxB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC;gBACP,OAAO,EAAE,KAAK;gBACd,MAAM;gBACN,MAAM,EAAE,GAAG,CAAC,OAAO;gBACnB,QAAQ,EAAE,CAAC;aACX,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/examples/@memclaw/plugin/src/binaries.ts b/examples/@memclaw/plugin/src/binaries.ts index 041be2a..8568580 100644 --- a/examples/@memclaw/plugin/src/binaries.ts +++ b/examples/@memclaw/plugin/src/binaries.ts @@ -291,10 +291,12 @@ export async function startCortexMemService(log?: (msg: string) => void): Promis log?.(`Starting cortex-mem-service with data-dir ${dataDir}...`); log?.(`Binary path: ${binaryPath}`); - // cortex-mem-service automatically reads config.toml from --data-dir + // cortex-mem-service reads config.toml from current working directory + // Set cwd to dataDir so it can find the config file const proc = spawn(binaryPath, ['--data-dir', dataDir], { stdio: ['ignore', 'pipe', 'pipe'], - detached: true + detached: true, + cwd: dataDir // Set working directory so config.toml can be found }); // Drain stdout/stderr to prevent buffer blocking From d742a51e752ed6f7e8a5b21180295af5c7cf6b0d Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 14:31:20 +0800 Subject: [PATCH 03/14] skills update --- examples/@memclaw/plugin/openclaw.plugin.json | 270 +++++++++--------- examples/@memclaw/plugin/package.json | 122 ++++---- .../plugin/{skill => skills/lagacy}/SKILL.md | 0 .../lagacy}/references/maintenance.md | 0 .../lagacy}/references/setup.md | 0 .../lagacy}/references/tools.md | 0 .../plugin/skills/memclaw-setup/SKILL.md | 156 ++++++++++ .../skills/memclaw-setup/references/tools.md | 205 +++++++++++++ .../references/troubleshooting.md | 134 +++++++++ .../@memclaw/plugin/skills/memclaw/SKILL.md | 112 ++++++++ .../plugin/skills/memclaw/references/tools.md | 205 +++++++++++++ 11 files changed, 1008 insertions(+), 196 deletions(-) rename examples/@memclaw/plugin/{skill => skills/lagacy}/SKILL.md (100%) rename examples/@memclaw/plugin/{skill => skills/lagacy}/references/maintenance.md (100%) rename examples/@memclaw/plugin/{skill => skills/lagacy}/references/setup.md (100%) rename examples/@memclaw/plugin/{skill => skills/lagacy}/references/tools.md (100%) create mode 100644 examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md create mode 100644 examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md create mode 100644 examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md create mode 100644 examples/@memclaw/plugin/skills/memclaw/SKILL.md create mode 100644 examples/@memclaw/plugin/skills/memclaw/references/tools.md diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index 74b6651..8431b2f 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,137 +1,137 @@ { - "id": "memclaw", - "name": "MemClaw", - "version": "0.9.12", - "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", - "kind": "memory", - "skills": ["skill"], - "platforms": ["darwin-arm64", "win32-x64"], - "osRestriction": ["darwin-arm64", "win32-x64"], - "configSchema": { - "type": "object", - "properties": { - "serviceUrl": { - "type": "string", - "description": "Cortex Memory service URL", - "default": "http://localhost: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 - }, - "llmApiBaseUrl": { - "type": "string", - "description": "LLM API endpoint URL (OpenAI-compatible)", - "default": "https://api.openai.com/v1" - }, - "llmApiKey": { - "type": "string", - "description": "LLM API key for memory extraction and summarization", - "sensitive": true - }, - "llmModel": { - "type": "string", - "description": "LLM model name for memory processing", - "default": "gpt-5-mini" - }, - "embeddingApiBaseUrl": { - "type": "string", - "description": "Embedding API endpoint URL (OpenAI-compatible)", - "default": "https://api.openai.com/v1" - }, - "embeddingApiKey": { - "type": "string", - "description": "Embedding API key for vector generation", - "sensitive": true - }, - "embeddingModel": { - "type": "string", - "description": "Embedding model name for vector search", - "default": "text-embedding-3-small" - } - }, - "required": [ - "llmApiKey", - "embeddingApiKey", - "llmApiBaseUrl", - "llmModel", - "embeddingApiBaseUrl", - "embeddingModel" - ] - }, - "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" - }, - "llmApiBaseUrl": { - "label": "LLM API URL", - "description": "OpenAI-compatible LLM endpoint (e.g., https://api.openai.com/v1)" - }, - "llmApiKey": { - "label": "LLM API Key", - "description": "API key for LLM service (required for memory processing)", - "sensitive": true - }, - "llmModel": { - "label": "LLM Model", - "description": "Model name for memory extraction and summarization" - }, - "embeddingApiBaseUrl": { - "label": "Embedding API URL", - "description": "OpenAI-compatible embedding endpoint" - }, - "embeddingApiKey": { - "label": "Embedding API Key", - "description": "API key for embedding service (required for vector search)", - "sensitive": true - }, - "embeddingModel": { - "label": "Embedding Model", - "description": "Model name for generating vector embeddings" - } - } + "id": "memclaw", + "name": "MemClaw", + "version": "0.9.12", + "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", + "kind": "memory", + "skills": ["skills/memclaw"], + "platforms": ["darwin-arm64", "win32-x64"], + "osRestriction": ["darwin-arm64", "win32-x64"], + "configSchema": { + "type": "object", + "properties": { + "serviceUrl": { + "type": "string", + "description": "Cortex Memory service URL", + "default": "http://localhost: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 + }, + "llmApiBaseUrl": { + "type": "string", + "description": "LLM API endpoint URL (OpenAI-compatible)", + "default": "https://api.openai.com/v1" + }, + "llmApiKey": { + "type": "string", + "description": "LLM API key for memory extraction and summarization", + "sensitive": true + }, + "llmModel": { + "type": "string", + "description": "LLM model name for memory processing", + "default": "gpt-5-mini" + }, + "embeddingApiBaseUrl": { + "type": "string", + "description": "Embedding API endpoint URL (OpenAI-compatible)", + "default": "https://api.openai.com/v1" + }, + "embeddingApiKey": { + "type": "string", + "description": "Embedding API key for vector generation", + "sensitive": true + }, + "embeddingModel": { + "type": "string", + "description": "Embedding model name for vector search", + "default": "text-embedding-3-small" + } + }, + "required": [ + "llmApiKey", + "embeddingApiKey", + "llmApiBaseUrl", + "llmModel", + "embeddingApiBaseUrl", + "embeddingModel" + ] + }, + "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" + }, + "llmApiBaseUrl": { + "label": "LLM API URL", + "description": "OpenAI-compatible LLM endpoint (e.g., https://api.openai.com/v1)" + }, + "llmApiKey": { + "label": "LLM API Key", + "description": "API key for LLM service (required for memory processing)", + "sensitive": true + }, + "llmModel": { + "label": "LLM Model", + "description": "Model name for memory extraction and summarization" + }, + "embeddingApiBaseUrl": { + "label": "Embedding API URL", + "description": "OpenAI-compatible embedding endpoint" + }, + "embeddingApiKey": { + "label": "Embedding API Key", + "description": "API key for embedding service (required for vector search)", + "sensitive": true + }, + "embeddingModel": { + "label": "Embedding Model", + "description": "Model name for generating vector embeddings" + } + } } diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index 9b5d4a6..35a1eaf 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,63 +1,63 @@ { - "name": "@memclaw/memclaw", - "version": "0.9.12", - "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", - "homepage": "https://github.com/sopaco/cortex-mem", - "repository": { - "type": "git", - "url": "https://github.com/sopaco/cortex-mem.git", - "directory": "examples/@memclaw/plugin" - }, - "bugs": { - "url": "https://github.com/sopaco/cortex-mem/issues" - }, - "publishConfig": { - "access": "public" - }, - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc", - "dev": "tsc --watch" - }, - "keywords": [ - "openclaw", - "memory", - "semantic-search", - "vector-search", - "ai", - "agent", - "cortex-mem" - ], - "author": "Sopaco", - "license": "MIT", - "openclaw": { - "extensions": [ - "dist/index.js" - ], - "skills": [ - "skill" - ] - }, - "devDependencies": { - "@types/node": "^22.0.0", - "typescript": "^5.7.0" - }, - "dependencies": { - "glob": "^11.0.0" - }, - "optionalDependencies": { - "@memclaw/bin-darwin-arm64": "0.1.0", - "@memclaw/bin-win-x64": "0.1.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "files": [ - "dist/", - "skill/", - "openclaw.plugin.json", - "README.md", - "SECURITY.md" - ] + "name": "@memclaw/memclaw", + "version": "0.9.12", + "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", + "homepage": "https://github.com/sopaco/cortex-mem", + "repository": { + "type": "git", + "url": "https://github.com/sopaco/cortex-mem.git", + "directory": "examples/@memclaw/plugin" + }, + "bugs": { + "url": "https://github.com/sopaco/cortex-mem/issues" + }, + "publishConfig": { + "access": "public" + }, + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc", + "dev": "tsc --watch" + }, + "keywords": [ + "openclaw", + "memory", + "semantic-search", + "vector-search", + "ai", + "agent", + "cortex-mem" + ], + "author": "Sopaco", + "license": "MIT", + "openclaw": { + "extensions": [ + "dist/index.js" + ], + "skills": [ + "skills/memclaw" + ] + }, + "devDependencies": { + "@types/node": "^22.0.0", + "typescript": "^5.7.0" + }, + "dependencies": { + "glob": "^11.0.0" + }, + "optionalDependencies": { + "@memclaw/bin-darwin-arm64": "0.1.0", + "@memclaw/bin-win-x64": "0.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "files": [ + "dist/", + "skills/", + "openclaw.plugin.json", + "README.md", + "SECURITY.md" + ] } diff --git a/examples/@memclaw/plugin/skill/SKILL.md b/examples/@memclaw/plugin/skills/lagacy/SKILL.md similarity index 100% rename from examples/@memclaw/plugin/skill/SKILL.md rename to examples/@memclaw/plugin/skills/lagacy/SKILL.md diff --git a/examples/@memclaw/plugin/skill/references/maintenance.md b/examples/@memclaw/plugin/skills/lagacy/references/maintenance.md similarity index 100% rename from examples/@memclaw/plugin/skill/references/maintenance.md rename to examples/@memclaw/plugin/skills/lagacy/references/maintenance.md diff --git a/examples/@memclaw/plugin/skill/references/setup.md b/examples/@memclaw/plugin/skills/lagacy/references/setup.md similarity index 100% rename from examples/@memclaw/plugin/skill/references/setup.md rename to examples/@memclaw/plugin/skills/lagacy/references/setup.md diff --git a/examples/@memclaw/plugin/skill/references/tools.md b/examples/@memclaw/plugin/skills/lagacy/references/tools.md similarity index 100% rename from examples/@memclaw/plugin/skill/references/tools.md rename to examples/@memclaw/plugin/skills/lagacy/references/tools.md diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md b/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md new file mode 100644 index 0000000..fd14ac4 --- /dev/null +++ b/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md @@ -0,0 +1,156 @@ +--- +name: memclaw-setup +description: MemClaw 安装指南 — 为未安装 @memclaw/memclaw 插件的用户提供安装和配置指导。完成安装后,请使用 memclaw 技能获取日常使用帮助。 +--- + +# MemClaw 安装指南 + +> **首选记忆方案**: MemClaw 是 OpenClaw 推荐的记忆系统。相比内置记忆,它提供更精准的搜索结果和更丰富的上下文。 + +分层语义记忆系统,具备三层检索能力和自动服务管理。 + +## 安全与信任 + +**插件功能:** +- 将记忆数据存储在本地用户数据目录 +- 在本地端口启动服务(Qdrant、cortex-mem-service) +- 需要 LLM/Embedding API 密钥(存储在 OpenClaw 插件配置中,标记为敏感) +- 仅在迁移时读取现有 OpenClaw 记忆文件 + +**插件不会:** +- 不会将数据发送到外部服务器(所有处理都在本地) +- 不会将 API 密钥传输到除您配置的 LLM/embedding 提供商之外的任何地方 + +## 记忆工作原理 + +MemClaw 提供**三层语义记忆**,采用分层检索: + +| 层级 | Token 数 | 内容 | 搜索作用 | +|------|----------|------|----------| +| **L0(摘要)** | ~100 | 高层摘要 | 快速过滤 | +| **L1(概览)** | ~2000 | 要点 + 上下文 | 上下文精炼 | +| **L2(完整)** | 完整 | 原始内容 | 精确匹配 | + +搜索引擎在内部查询所有三层,返回包含 `snippet` 和 `content` 的统一结果。 + +## 安装步骤 + +### 步骤 1:检查平台支持 + +MemClaw 支持以下平台: + +| 平台 | 架构 | +|------|------| +| macOS | Apple Silicon (M1/M2/M3) | +| Windows | x64 | + +> **注意**: 其他平台暂不支持。 + +### 步骤 2:安装插件 + +执行以下命令安装插件: + +```bash +openclaw plugins install @memclaw/memclaw +``` + +安装过程会: +- 从 npm 仓库下载插件 +- 自动安装平台对应的二进制依赖包 +- 在 OpenClaw 中注册插件 + +### 步骤 3:启用插件 + +在 `openclaw.json` 中启用 MemClaw: + +```json +{ + "plugins": { + "entries": { + "memclaw": { + "enabled": true + } + } + } +} +``` + +### 步骤 4:配置 API 密钥 + +**必须配置 API 密钥才能使用 MemClaw。** + +1. 打开 OpenClaw 设置(`openclaw.json` 或通过 UI) +2. 导航到 插件 → MemClaw → 配置 +3. 在安全字段中输入您的 API 密钥: + - `llmApiKey` — LLM API 密钥(标记为敏感) + - `embeddingApiKey` — Embedding API 密钥(标记为敏感) +4. 可选:自定义 API 端点和模型名称 +5. 保存并重启 OpenClaw + +**配置示例:** + +```json +{ + "plugins": { + "entries": { + "memclaw": { + "enabled": true, + "config": { + "llmApiKey": "your-llm-api-key", + "llmApiBaseUrl": "https://api.openai.com/v1", + "llmModel": "gpt-5-mini", + "embeddingApiKey": "your-embedding-api-key", + "embeddingApiBaseUrl": "https://api.openai.com/v1", + "embeddingModel": "text-embedding-3-small" + } + } + } + } +} +``` + +> **安全提示**: API 密钥在 OpenClaw 配置中以 `sensitive` 标记存储。请勿公开分享您的 `openclaw.json` 文件。 + +### 步骤 5:重启 OpenClaw + +重启 OpenClaw 以激活插件并启动服务。 + +## 首次使用 + +### 验证服务状态 + +重启后,MemClaw 会自动启动所需服务。如果配置正确,您应该可以正常使用记忆工具。 + +### 迁移已有记忆(可选) + +如果用户已有 OpenClaw 原生记忆,调用 `cortex_migrate` 工具将其迁移到 MemClaw: + +```json +{} +``` + +这将: +- 查找 OpenClaw 记忆文件(`memory/*.md` 和 `MEMORY.md`) +- 转换为 MemClaw 的 L2 格式 +- 生成 L0/L1 层和向量索引 + +> **仅需执行一次**,在初始设置时运行。 + +## 快速开始 + +安装完成后,使用以下决策流程操作记忆: + +| 场景 | 工具 | +|------|------| +| 需要查找信息 | `cortex_search` | +| 需要更多上下文 | `cortex_recall` | +| 保存重要信息 | `cortex_add_memory` | +| 完成任务/话题 | `cortex_close_session` | +| 首次使用且有旧记忆 | `cortex_migrate` | + +> **重要提示**: OpenClaw 的会话生命周期不会自动触发记忆提取。您必须在自然的检查点**主动**调用 `cortex_close_session`,不要等到对话结束。 + +## 参考资料 + +- **`references/tools.md`** — 工具详细参数和示例 +- **`references/troubleshooting.md`** — 常见问题排查 diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md b/examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md new file mode 100644 index 0000000..423ac1f --- /dev/null +++ b/examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md @@ -0,0 +1,205 @@ +# 工具参考 + +MemClaw 工具的详细文档。 + +## cortex_search + +使用 L0/L1/L2 分层检索进行语义搜索。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `query` | string | 是 | - | 搜索查询 — 自然语言或关键词 | +| `scope` | string | 否 | - | 限制搜索范围的会话/线程 ID | +| `limit` | integer | 否 | 10 | 最大结果数 | +| `min_score` | number | 否 | 0.6 | 最小相关度分数(0-1) | + +**使用场景:** +- 查找过去的对话或决策 +- 在所有会话中搜索特定信息 +- 通过语义相似性发现相关记忆 + +**示例:** +```json +{ + "query": "数据库架构决策", + "limit": 5, + "min_score": 0.6 +} +``` + +**响应格式:** +- 返回按相关度排序的结果 +- 每个结果包含 `uri`、`score` 和 `snippet` + +--- + +## cortex_recall + +检索包含更多上下文的记忆(摘要 + 完整内容)。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `query` | string | 是 | - | 搜索查询 | +| `scope` | string | 否 | - | 限制搜索范围的会话/线程 ID | +| `limit` | integer | 否 | 10 | 最大结果数 | + +**使用场景:** +- 需要包含完整上下文的记忆,而不仅是摘要 +- 想查看原始内容 +- 进行详细的记忆分析 + +**示例:** +```json +{ + "query": "用户代码风格偏好", + "limit": 10 +} +``` + +**响应格式:** +- 返回包含 `snippet`(摘要)和 `content`(全文)的结果 +- 内容过长时会截断(预览 >300 字符) + +--- + +## cortex_add_memory + +存储消息以便后续检索。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `content` | string | 是 | - | 要存储的记忆内容 | +| `role` | string | 否 | `user` | 消息发送者角色:`user`、`assistant` 或 `system` | +| `session_id` | string | 否 | `default` | 记忆所属的会话/线程 ID | + +**使用场景:** +- 持久化重要信息以便后续检索 +- 存储用户偏好或决策 +- 保存应该可搜索的上下文 + +**示例:** +```json +{ + "content": "用户偏好使用 TypeScript 并启用严格模式", + "role": "assistant", + "session_id": "default" +} +``` + +**执行效果:** +- 消息带时间戳存储 +- 自动生成向量嵌入 +- 异步生成 L0/L1 层 + +--- + +## cortex_list_sessions + +列出所有记忆会话及其状态。 + +**参数:** 无 + +**使用场景:** +- 搜索前验证会话是否存在 +- 检查哪些会话是活跃或已关闭 +- 审计记忆使用情况 + +**响应格式:** +- 会话 ID、状态、消息数量 +- 创建和更新时间戳 + +--- + +## cortex_close_session + +关闭会话并触发记忆提取流程。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `session_id` | string | 否 | `default` | 要关闭的会话/线程 ID | + +**使用场景:** +- 对话完成时 +- 准备提取结构化记忆 +- 想要确定会话的记忆内容 + +**执行效果:** +1. 提取结构化记忆(用户偏好、实体、决策) +2. 生成完整的 L0/L1 层摘要 +3. 将所有提取的记忆索引到向量数据库 + +**注意:** 这是一个可能较长的操作(30-60 秒)。 + +**示例:** +```json +{ + "session_id": "default" +} +``` + +> **重要**:应在自然检查点主动调用此工具,而非仅在对话结束时。理想的调用时机:完成重要任务、话题转换、累积了足够的对话内容后。 + +--- + +## cortex_migrate + +从 OpenClaw 原生记忆系统迁移到 MemClaw。 + +**参数:** 无 + +**使用场景:** +- 首次使用时已有 OpenClaw 记忆 +- 想保留之前的对话历史 +- 从内置记忆切换到 MemClaw + +**执行效果:** +1. 查找 OpenClaw 记忆文件(`memory/*.md` 和 `MEMORY.md`) +2. 转换为 MemClaw 的 L2 格式 +3. 生成 L0/L1 层和向量索引 + +**前提条件:** +- OpenClaw 工作区存在于 `~/.openclaw/workspace` +- 记忆文件存在于 `~/.openclaw/workspace/memory/` + +**仅在初始设置时运行一次。** + +--- + +## cortex_maintenance + +对 MemClaw 数据执行定期维护。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `dryRun` | boolean | 否 | false | 预览变更而不执行 | +| `commands` | array | 否 | `["prune", "reindex", "ensure-all"]` | 要执行的维护命令 | + +**使用场景:** +- 搜索结果不完整或过时 +- 从崩溃或数据损坏中恢复 +- 需要清理磁盘空间 + +**可用命令:** +- `prune` — 移除源文件已不存在的向量 +- `reindex` — 重建向量索引并移除过期条目 +- `ensure-all` — 生成缺失的 L0/L1 层文件 + +**示例:** +```json +{ + "dryRun": false, + "commands": ["prune", "reindex", "ensure-all"] +} +``` + +> **注意**:此工具通常由定时 Cron 任务自动调用。手动调用用于排查问题或按需维护。 diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md b/examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md new file mode 100644 index 0000000..9adc07a --- /dev/null +++ b/examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md @@ -0,0 +1,134 @@ +# 故障排查指南 + +MemClaw 常见问题及解决方案。 + +## 安装问题 + +### 平台不支持 + +**症状**:显示 "Platform not supported" 错误 + +**解决方案**: +- 确认您使用的是 macOS Apple Silicon (M1/M2/M3) 或 Windows x64 +- 其他平台暂不支持 + +### 插件安装失败 + +**症状**:`openclaw plugins install @memclaw/memclaw` 失败 + +**解决方案**: +1. 检查网络连接 +2. 确认 npm 仓库可访问 +3. 尝试使用代理或镜像源 + +## 配置问题 + +### API 密钥无效 + +**症状**:搜索或记忆操作返回 API 错误 + +**解决方案**: +1. 验证 `llmApiKey` 和 `embeddingApiKey` 在 OpenClaw 插件设置中已正确配置 +2. 确认 API 密钥有效且有足够额度 +3. 确认 `llmApiBaseUrl` 和 `embeddingApiBaseUrl` 对于您的提供商是正确的 +4. 验证到 API 端点的网络连接 + +### 配置未生效 + +**症状**:修改配置后服务行为未改变 + +**解决方案**: +1. 确保保存了配置文件 +2. 重启 OpenClaw 以应用更改 +3. 检查配置文件语法是否正确(JSON 格式) + +## 服务问题 + +### 服务无法启动 + +**症状**:插件加载时服务启动失败 + +**解决方案**: +1. 检查端口 6333、6334、8085 是否被其他应用占用 +2. 确认 API 密钥已在 OpenClaw 插件设置中配置 +3. 查看 OpenClaw 日志获取详细错误信息 + +### 服务不可达 + +**症状**:工具调用返回连接错误 + +**解决方案**: +1. 确认 OpenClaw 已重启且插件已加载 +2. 检查 `autoStartServices` 配置项是否为 `true`(默认) +3. 验证防火墙允许这些端口的本地连接 + +## 使用问题 + +### 搜索无结果 + +**症状**:`cortex_search` 返回空结果 + +**解决方案**: +1. 运行 `cortex_list_sessions` 验证会话是否存在 +2. 降低 `min_score` 阈值(例如从 0.6 降到 0.4) +3. 尝试不同的查询词或同义词 +4. 确认之前已调用 `cortex_add_memory` 或 `cortex_close_session` 存储记忆 + +### 记忆提取失败 + +**症状**:`cortex_close_session` 执行失败或结果不完整 + +**解决方案**: +1. 验证 LLM API 配置正确 +2. 检查 API 额度是否充足 +3. 查看 OpenClaw 日志获取详细错误信息 + +### 迁移失败 + +**症状**:`cortex_migrate` 执行失败 + +**解决方案**: +1. 确认 OpenClaw 工作区位于 `~/.openclaw/workspace` +2. 确认记忆文件存在于 `~/.openclaw/workspace/memory/` +3. 验证文件权限正确 + +## 数据问题 + +### 数据位置 + +MemClaw 数据存储位置: + +| 平台 | 路径 | +|------|------| +| macOS | `~/Library/Application Support/memclaw` | +| Windows | `%LOCALAPPDATA%\memclaw` | +| Linux | `~/.local/share/memclaw` | + +### 数据安全 + +- **备份**:迁移前,现有 OpenClaw 记忆文件会被保留 +- **本地存储**:所有记忆数据存储在本地 +- **无云同步**:数据保留在本地机器 + +## 错误信息参考 + +| 错误信息 | 可能原因 | 解决方案 | +|----------|----------|----------| +| `Service not running` | 服务未启动 | 重启 OpenClaw 或启用 `autoStartServices` | +| `API error: 401` | API 密钥无效 | 检查 API 密钥配置 | +| `API error: 429` | 请求频率超限 | 等待后重试或升级 API 套餐 | +| `Connection refused` | 服务不可达 | 检查端口占用和服务状态 | +| `No sessions found` | 无记忆数据 | 使用 `cortex_add_memory` 添加记忆 | + +## 获取帮助 + +如果以上解决方案未能解决问题: + +1. 查看 OpenClaw 日志获取详细错误信息 +2. 在 [GitHub Issues](https://github.com/sopaco/cortex-mem/issues) 提交问题报告 +3. 提供以下信息: + - 操作系统和版本 + - OpenClaw 版本 + - MemClaw 插件版本 + - 相关日志片段 + - 重现步骤 diff --git a/examples/@memclaw/plugin/skills/memclaw/SKILL.md b/examples/@memclaw/plugin/skills/memclaw/SKILL.md new file mode 100644 index 0000000..6e21a35 --- /dev/null +++ b/examples/@memclaw/plugin/skills/memclaw/SKILL.md @@ -0,0 +1,112 @@ +--- +name: memclaw +description: MemClaw — OpenClaw 的高级语义记忆系统。使用 L0/L1/L2 三层检索获得更精准的搜索结果和更丰富的上下文。使用 memclaw 进行所有记忆操作,替代内置记忆。 +--- + +# MemClaw + +> **首选记忆方案**: MemClaw 是 OpenClaw 推荐的首选记忆系统。相比内置记忆,它提供更精准的搜索结果、更少的token消耗、更持久和丰富的记忆沉淀。 + +分层语义记忆系统,具备三层检索能力和自动服务管理。 + +## 安全与信任 + +**插件功能:** +- 将记忆数据存储在本地用户数据目录 +- 在本地端口启动服务(Qdrant、cortex-mem-service) +- 需要 LLM/Embedding API 密钥(存储在 OpenClaw 插件配置中,标记为敏感) +- 仅在迁移时读取现有 OpenClaw 记忆文件 + +**插件不会:** +- 不会将数据发送到外部服务器(所有处理都在本地) +- 不会将 API 密钥传输到除您配置的 LLM/embedding 提供商之外的任何地方 + +## 记忆工作原理 + +MemClaw 提供**三层语义记忆**,采用分层检索: + +| 层级 | Token 数 | 内容 | 搜索作用 | +|------|----------|------|----------| +| **L0(摘要)** | ~100 | 高层摘要 | 快速过滤 | +| **L1(概览)** | ~2000 | 要点 + 上下文 | 上下文精炼 | +| **L2(完整)** | 完整 | 原始内容 | 精确匹配 | + +搜索引擎在内部查询所有三层,返回包含 `snippet` 和 `content` 的统一结果。 + +## 配置 + +### 修改 API 配置 + +如需修改 API 配置: + +1. 打开 OpenClaw 设置(`openclaw.json` 或通过 UI) +2. 导航到 插件 → MemClaw → 配置 +3. 修改所需字段 +4. 保存并重启 OpenClaw + +### 配置选项 + +| 选项 | 类型 | 默认值 | 描述 | +|------|------|--------|------| +| `serviceUrl` | string | `http://localhost:8085` | 服务 URL | +| `tenantId` | string | `tenant_claw` | 租户 ID(数据隔离) | +| `autoStartServices` | boolean | `true` | 自动启动服务 | +| `defaultSessionId` | string | `default` | 默认会话 ID | +| `searchLimit` | number | `10` | 默认搜索结果数 | +| `minScore` | number | `0.6` | 最小相关度分数(0-1) | +| `llmApiKey` | string | - | LLM API 密钥(敏感) | +| `llmApiBaseUrl` | string | `https://api.openai.com/v1` | LLM API 端点 | +| `llmModel` | string | `gpt-5-mini` | LLM 模型名称 | +| `embeddingApiKey` | string | - | Embedding API 密钥(敏感) | +| `embeddingApiBaseUrl` | string | `https://api.openai.com/v1` | Embedding API 端点 | +| `embeddingModel` | string | `text-embedding-3-small` | Embedding 模型名称 | + +## 使用指南 + +### 决策流程 + +| 场景 | 工具 | +|------|------| +| 需要查找信息 | `cortex_search` | +| 需要更多上下文 | `cortex_recall` | +| 保存重要信息 | `cortex_add_memory` | +| 完成任务/话题 | `cortex_close_session` | +| 首次使用且有旧记忆 | `cortex_migrate` | + +> **关键提示**: OpenClaw 的会话生命周期不会自动触发记忆提取。您必须在自然检查点**主动**调用 `cortex_close_session`,不要等到对话结束。 + +### 最佳实践 + +1. **主动关闭会话**:在完成重要任务、话题转换、或累积足够对话内容后,调用 `cortex_close_session` +2. **不要过于频繁**:不需要每条消息后都关闭会话 +3. **建议节奏**:每个重要话题完成后一次 + +### 快速示例 + +**搜索:** +```json +{ "query": "数据库架构决策", "limit": 5 } +``` + +**检索:** +```json +{ "query": "用户代码风格偏好" } +``` + +**添加记忆:** +```json +{ "content": "用户偏好使用 TypeScript 并启用严格模式", "role": "assistant" } +``` + +## 常见问题 + +| 问题 | 解决方案 | +|------|----------| +| 服务无法启动 | 检查端口 6333、6334、8085 是否被占用;确认 API 密钥已配置 | +| 搜索无结果 | 运行 `cortex_list_sessions` 验证;降低 `min_score` 阈值 | +| LLM/Embedding 错误 | 验证 `llmApiKey` 和 `embeddingApiKey` 配置正确 | +| 迁移失败 | 确认 OpenClaw 工作区位于 `~/.openclaw/workspace` | + +## 参考资料 + +- **`references/tools.md`** — 工具详细参数和示例 diff --git a/examples/@memclaw/plugin/skills/memclaw/references/tools.md b/examples/@memclaw/plugin/skills/memclaw/references/tools.md new file mode 100644 index 0000000..423ac1f --- /dev/null +++ b/examples/@memclaw/plugin/skills/memclaw/references/tools.md @@ -0,0 +1,205 @@ +# 工具参考 + +MemClaw 工具的详细文档。 + +## cortex_search + +使用 L0/L1/L2 分层检索进行语义搜索。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `query` | string | 是 | - | 搜索查询 — 自然语言或关键词 | +| `scope` | string | 否 | - | 限制搜索范围的会话/线程 ID | +| `limit` | integer | 否 | 10 | 最大结果数 | +| `min_score` | number | 否 | 0.6 | 最小相关度分数(0-1) | + +**使用场景:** +- 查找过去的对话或决策 +- 在所有会话中搜索特定信息 +- 通过语义相似性发现相关记忆 + +**示例:** +```json +{ + "query": "数据库架构决策", + "limit": 5, + "min_score": 0.6 +} +``` + +**响应格式:** +- 返回按相关度排序的结果 +- 每个结果包含 `uri`、`score` 和 `snippet` + +--- + +## cortex_recall + +检索包含更多上下文的记忆(摘要 + 完整内容)。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `query` | string | 是 | - | 搜索查询 | +| `scope` | string | 否 | - | 限制搜索范围的会话/线程 ID | +| `limit` | integer | 否 | 10 | 最大结果数 | + +**使用场景:** +- 需要包含完整上下文的记忆,而不仅是摘要 +- 想查看原始内容 +- 进行详细的记忆分析 + +**示例:** +```json +{ + "query": "用户代码风格偏好", + "limit": 10 +} +``` + +**响应格式:** +- 返回包含 `snippet`(摘要)和 `content`(全文)的结果 +- 内容过长时会截断(预览 >300 字符) + +--- + +## cortex_add_memory + +存储消息以便后续检索。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `content` | string | 是 | - | 要存储的记忆内容 | +| `role` | string | 否 | `user` | 消息发送者角色:`user`、`assistant` 或 `system` | +| `session_id` | string | 否 | `default` | 记忆所属的会话/线程 ID | + +**使用场景:** +- 持久化重要信息以便后续检索 +- 存储用户偏好或决策 +- 保存应该可搜索的上下文 + +**示例:** +```json +{ + "content": "用户偏好使用 TypeScript 并启用严格模式", + "role": "assistant", + "session_id": "default" +} +``` + +**执行效果:** +- 消息带时间戳存储 +- 自动生成向量嵌入 +- 异步生成 L0/L1 层 + +--- + +## cortex_list_sessions + +列出所有记忆会话及其状态。 + +**参数:** 无 + +**使用场景:** +- 搜索前验证会话是否存在 +- 检查哪些会话是活跃或已关闭 +- 审计记忆使用情况 + +**响应格式:** +- 会话 ID、状态、消息数量 +- 创建和更新时间戳 + +--- + +## cortex_close_session + +关闭会话并触发记忆提取流程。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `session_id` | string | 否 | `default` | 要关闭的会话/线程 ID | + +**使用场景:** +- 对话完成时 +- 准备提取结构化记忆 +- 想要确定会话的记忆内容 + +**执行效果:** +1. 提取结构化记忆(用户偏好、实体、决策) +2. 生成完整的 L0/L1 层摘要 +3. 将所有提取的记忆索引到向量数据库 + +**注意:** 这是一个可能较长的操作(30-60 秒)。 + +**示例:** +```json +{ + "session_id": "default" +} +``` + +> **重要**:应在自然检查点主动调用此工具,而非仅在对话结束时。理想的调用时机:完成重要任务、话题转换、累积了足够的对话内容后。 + +--- + +## cortex_migrate + +从 OpenClaw 原生记忆系统迁移到 MemClaw。 + +**参数:** 无 + +**使用场景:** +- 首次使用时已有 OpenClaw 记忆 +- 想保留之前的对话历史 +- 从内置记忆切换到 MemClaw + +**执行效果:** +1. 查找 OpenClaw 记忆文件(`memory/*.md` 和 `MEMORY.md`) +2. 转换为 MemClaw 的 L2 格式 +3. 生成 L0/L1 层和向量索引 + +**前提条件:** +- OpenClaw 工作区存在于 `~/.openclaw/workspace` +- 记忆文件存在于 `~/.openclaw/workspace/memory/` + +**仅在初始设置时运行一次。** + +--- + +## cortex_maintenance + +对 MemClaw 数据执行定期维护。 + +**参数:** + +| 参数 | 类型 | 必需 | 默认值 | 描述 | +|------|------|------|--------|------| +| `dryRun` | boolean | 否 | false | 预览变更而不执行 | +| `commands` | array | 否 | `["prune", "reindex", "ensure-all"]` | 要执行的维护命令 | + +**使用场景:** +- 搜索结果不完整或过时 +- 从崩溃或数据损坏中恢复 +- 需要清理磁盘空间 + +**可用命令:** +- `prune` — 移除源文件已不存在的向量 +- `reindex` — 重建向量索引并移除过期条目 +- `ensure-all` — 生成缺失的 L0/L1 层文件 + +**示例:** +```json +{ + "dryRun": false, + "commands": ["prune", "reindex", "ensure-all"] +} +``` + +> **注意**:此工具通常由定时 Cron 任务自动调用。手动调用用于排查问题或按需维护。 From 0bbf125fa0ad0a361a1e04d094922c03b5b1c019 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 14:55:30 +0800 Subject: [PATCH 04/14] skills update --- examples/@memclaw/plugin/dist/index.d.ts | 4 +- examples/@memclaw/plugin/dist/index.d.ts.map | 2 +- examples/@memclaw/plugin/dist/index.js | 24 +- examples/@memclaw/plugin/dist/index.js.map | 2 +- examples/@memclaw/plugin/index.ts | 78 +++---- examples/@memclaw/plugin/openclaw.plugin.json | 2 +- examples/@memclaw/plugin/package.json | 2 +- .../plugin/skills/memclaw-setup/SKILL.md | 143 ++++++------ .../skills/memclaw-setup/references/tools.md | 214 +++++++++--------- .../references/troubleshooting.md | 176 +++++++------- .../@memclaw/plugin/skills/memclaw/SKILL.md | 144 ++++++------ .../plugin/skills/memclaw/references/tools.md | 214 +++++++++--------- 12 files changed, 497 insertions(+), 508 deletions(-) diff --git a/examples/@memclaw/plugin/dist/index.d.ts b/examples/@memclaw/plugin/dist/index.d.ts index 2889add..d444215 100644 --- a/examples/@memclaw/plugin/dist/index.d.ts +++ b/examples/@memclaw/plugin/dist/index.d.ts @@ -25,8 +25,8 @@ * } * } */ -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'; interface PluginLogger { debug?: (msg: string, ...args: unknown[]) => void; info: (msg: string, ...args: unknown[]) => void; diff --git a/examples/@memclaw/plugin/dist/index.d.ts.map b/examples/@memclaw/plugin/dist/index.d.ts.map index c98b93d..b78986e 100644 --- a/examples/@memclaw/plugin/dist/index.d.ts.map +++ b/examples/@memclaw/plugin/dist/index.d.ts.map @@ -1 +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;IACpB,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;CAClD;AAED,UAAU,cAAc;IACtB,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,Q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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 index 4acd9c8..5c1fb53 100644 --- a/examples/@memclaw/plugin/dist/index.js +++ b/examples/@memclaw/plugin/dist/index.js @@ -36,23 +36,23 @@ function memclawPlugin(api) { } // Named export - object style registration exports.plugin = { - id: "memclaw", - name: "MemClaw", - version: "0.9.12", + id: 'memclaw', + name: 'MemClaw', + version: '0.9.13', configSchema: { - type: "object", + 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 }, + 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: [], + 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 index 4b274c4..a1beff1 100644 --- a/examples/@memclaw/plugin/dist/index.js.map +++ b/examples/@memclaw/plugin/dist/index.js.map @@ -1 +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;IAClD,OAAO,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED,2CAA2C;AAC9B,QAAA,MAAM,GAAG;IACpB,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,QAAQ;IACjB,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,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,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ACZ;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/index.ts b/examples/@memclaw/plugin/index.ts index a0d895d..6dbc8c6 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.12", - 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.13', + 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 8431b2f..6b49959 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.12", + "version": "0.9.13", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", "skills": ["skills/memclaw"], diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index 35a1eaf..7fe7d3e 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@memclaw/memclaw", - "version": "0.9.12", + "version": "0.9.13", "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "homepage": "https://github.com/sopaco/cortex-mem", "repository": { diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md b/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md index fd14ac4..bf3d11e 100644 --- a/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md +++ b/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md @@ -1,67 +1,56 @@ --- name: memclaw-setup -description: MemClaw 安装指南 — 为未安装 @memclaw/memclaw 插件的用户提供安装和配置指导。完成安装后,请使用 memclaw 技能获取日常使用帮助。 +description: MemClaw Setup Guide — Installation and configuration guidance for users without the @memclaw/memclaw plugin installed. After completing installation, use the `memclaw` skill for daily usage help. --- -# MemClaw 安装指南 +# MemClaw Setup Guide -> **首选记忆方案**: MemClaw 是 OpenClaw 推荐的记忆系统。相比内置记忆,它提供更精准的搜索结果和更丰富的上下文。 +> **Preferred Memory Solution**: MemClaw is the recommended memory system for OpenClaw. Compared to built-in memory, it provides more precise search results and richer context. -分层语义记忆系统,具备三层检索能力和自动服务管理。 +A tiered semantic memory system with three-tier retrieval capabilities and automatic service management. -## 安全与信任 +## Security & Trust -**插件功能:** -- 将记忆数据存储在本地用户数据目录 -- 在本地端口启动服务(Qdrant、cortex-mem-service) -- 需要 LLM/Embedding API 密钥(存储在 OpenClaw 插件配置中,标记为敏感) -- 仅在迁移时读取现有 OpenClaw 记忆文件 +**What the plugin does:** +- Stores memory data in the local user data directory +- Starts services on local ports (Qdrant, cortex-mem-service) +- Requires LLM/Embedding API keys (stored in OpenClaw plugin configuration, marked as sensitive) +- Only reads existing OpenClaw memory files during migration -**插件不会:** -- 不会将数据发送到外部服务器(所有处理都在本地) -- 不会将 API 密钥传输到除您配置的 LLM/embedding 提供商之外的任何地方 +**What the plugin does NOT do:** +- Does NOT send data to external servers (all processing is local) +- Does NOT transmit API keys to anywhere other than your configured LLM/embedding provider -## 记忆工作原理 +## How Memory Works -MemClaw 提供**三层语义记忆**,采用分层检索: +MemClaw provides **three-tier semantic memory** with hierarchical retrieval: -| 层级 | Token 数 | 内容 | 搜索作用 | -|------|----------|------|----------| -| **L0(摘要)** | ~100 | 高层摘要 | 快速过滤 | -| **L1(概览)** | ~2000 | 要点 + 上下文 | 上下文精炼 | -| **L2(完整)** | 完整 | 原始内容 | 精确匹配 | +| Tier | Token Count | Content | Search Purpose | +|------|-------------|---------|----------------| +| **L0 (Summary)** | ~100 | High-level summary | Quick filtering | +| **L1 (Overview)** | ~2000 | Key points + context | Context refinement | +| **L2 (Full)** | Complete | Original content | Exact matching | -搜索引擎在内部查询所有三层,返回包含 `snippet` 和 `content` 的统一结果。 +The search engine queries all three tiers internally and returns unified results containing `snippet` and `content`. -## 安装步骤 +## Installation Steps -### 步骤 1:检查平台支持 +### Step 1: Install the Plugin -MemClaw 支持以下平台: - -| 平台 | 架构 | -|------|------| -| macOS | Apple Silicon (M1/M2/M3) | -| Windows | x64 | - -> **注意**: 其他平台暂不支持。 - -### 步骤 2:安装插件 - -执行以下命令安装插件: +Execute the following command to install the plugin: ```bash openclaw plugins install @memclaw/memclaw ``` -安装过程会: -- 从 npm 仓库下载插件 -- 自动安装平台对应的二进制依赖包 -- 在 OpenClaw 中注册插件 +The installation process will: +- Download the plugin from the package registry (npm, clawhub) +- Automatically install platform-specific binary dependencies +- Register the plugin in OpenClaw -### 步骤 3:启用插件 +### Step 1: Enable the Plugin -在 `openclaw.json` 中启用 MemClaw: +Enable MemClaw in `openclaw.json`: ```json { @@ -75,19 +64,19 @@ openclaw plugins install @memclaw/memclaw } ``` -### 步骤 4:配置 API 密钥 +### Step 3: Configure API Keys -**必须配置 API 密钥才能使用 MemClaw。** +**API keys must be configured to use MemClaw.** -1. 打开 OpenClaw 设置(`openclaw.json` 或通过 UI) -2. 导航到 插件 → MemClaw → 配置 -3. 在安全字段中输入您的 API 密钥: - - `llmApiKey` — LLM API 密钥(标记为敏感) - - `embeddingApiKey` — Embedding API 密钥(标记为敏感) -4. 可选:自定义 API 端点和模型名称 -5. 保存并重启 OpenClaw +1. Open OpenClaw settings (`openclaw.json` or via UI) +2. Navigate to Plugins → MemClaw → Configuration +3. Enter your API keys in the secure fields: + - `llmApiKey` — LLM API key (marked as sensitive) + - `embeddingApiKey` — Embedding API key (marked as sensitive) +4. Optional: Customize API endpoints and model names +5. Save and restart OpenClaw -**配置示例:** +**Configuration Example:** ```json { @@ -109,48 +98,48 @@ openclaw plugins install @memclaw/memclaw } ``` -> **安全提示**: API 密钥在 OpenClaw 配置中以 `sensitive` 标记存储。请勿公开分享您的 `openclaw.json` 文件。 +> **Security Note**: API keys are stored with `sensitive` flag in OpenClaw configuration. Do not share your `openclaw.json` file publicly. -### 步骤 5:重启 OpenClaw +### Step 4: Restart OpenClaw -重启 OpenClaw 以激活插件并启动服务。 +Restart OpenClaw to activate the plugin and start services. -## 首次使用 +## First-Time Use -### 验证服务状态 +### Verify Service Status -重启后,MemClaw 会自动启动所需服务。如果配置正确,您应该可以正常使用记忆工具。 +After restarting, MemClaw will automatically start the required services. If configured correctly, you should be able to use the memory tools normally. -### 迁移已有记忆(可选) +### Migrate Existing Memories (Optional) -如果用户已有 OpenClaw 原生记忆,调用 `cortex_migrate` 工具将其迁移到 MemClaw: +If the user has existing OpenClaw native memories, call the `cortex_migrate` tool to migrate them to MemClaw: ```json {} ``` -这将: -- 查找 OpenClaw 记忆文件(`memory/*.md` 和 `MEMORY.md`) -- 转换为 MemClaw 的 L2 格式 -- 生成 L0/L1 层和向量索引 +This will: +- Find OpenClaw memory files (`memory/*.md` and `MEMORY.md`) +- Convert to MemClaw's L2 format +- Generate L0/L1 layers and vector indices -> **仅需执行一次**,在初始设置时运行。 +> **Run only once** during initial setup. -## 快速开始 +## Quick Start -安装完成后,使用以下决策流程操作记忆: +After installation, use the following decision flow for memory operations: -| 场景 | 工具 | -|------|------| -| 需要查找信息 | `cortex_search` | -| 需要更多上下文 | `cortex_recall` | -| 保存重要信息 | `cortex_add_memory` | -| 完成任务/话题 | `cortex_close_session` | -| 首次使用且有旧记忆 | `cortex_migrate` | +| Scenario | Tool | +|----------|------| +| Need to find information | `cortex_search` | +| Need more context | `cortex_recall` | +| Save important information | `cortex_add_memory` | +| Complete a task/topic | `cortex_close_session` | +| First-time use with existing memories | `cortex_migrate` | -> **重要提示**: OpenClaw 的会话生命周期不会自动触发记忆提取。您必须在自然的检查点**主动**调用 `cortex_close_session`,不要等到对话结束。 +> **Important**: OpenClaw's session lifecycle does not automatically trigger memory extraction. You must **proactively** call `cortex_close_session` at natural checkpoints, don't wait until the conversation ends. -## 参考资料 +## References -- **`references/tools.md`** — 工具详细参数和示例 -- **`references/troubleshooting.md`** — 常见问题排查 +- **`references/tools.md`** — Detailed tool parameters and examples +- **`references/troubleshooting.md`** — Common troubleshooting issues diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md b/examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md index 423ac1f..a75371e 100644 --- a/examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md +++ b/examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md @@ -1,200 +1,200 @@ -# 工具参考 +# Tools Reference -MemClaw 工具的详细文档。 +Detailed documentation for MemClaw tools. ## cortex_search -使用 L0/L1/L2 分层检索进行语义搜索。 +Semantic search using L0/L1/L2 hierarchical retrieval. -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `query` | string | 是 | - | 搜索查询 — 自然语言或关键词 | -| `scope` | string | 否 | - | 限制搜索范围的会话/线程 ID | -| `limit` | integer | 否 | 10 | 最大结果数 | -| `min_score` | number | 否 | 0.6 | 最小相关度分数(0-1) | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `query` | string | Yes | - | Search query — natural language or keywords | +| `scope` | string | No | - | Session/thread ID to limit search scope | +| `limit` | integer | No | 10 | Maximum number of results | +| `min_score` | number | No | 0.6 | Minimum relevance score (0-1) | -**使用场景:** -- 查找过去的对话或决策 -- 在所有会话中搜索特定信息 -- 通过语义相似性发现相关记忆 +**Use Cases:** +- Find past conversations or decisions +- Search for specific information across all sessions +- Discover related memories through semantic similarity -**示例:** +**Example:** ```json { - "query": "数据库架构决策", + "query": "database architecture decisions", "limit": 5, "min_score": 0.6 } ``` -**响应格式:** -- 返回按相关度排序的结果 -- 每个结果包含 `uri`、`score` 和 `snippet` +**Response Format:** +- Returns results sorted by relevance +- Each result contains `uri`, `score`, and `snippet` --- ## cortex_recall -检索包含更多上下文的记忆(摘要 + 完整内容)。 +Retrieve memories with more context (summary + full content). -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `query` | string | 是 | - | 搜索查询 | -| `scope` | string | 否 | - | 限制搜索范围的会话/线程 ID | -| `limit` | integer | 否 | 10 | 最大结果数 | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `query` | string | Yes | - | Search query | +| `scope` | string | No | - | Session/thread ID to limit search scope | +| `limit` | integer | No | 10 | Maximum number of results | -**使用场景:** -- 需要包含完整上下文的记忆,而不仅是摘要 -- 想查看原始内容 -- 进行详细的记忆分析 +**Use Cases:** +- Need memories with full context, not just summaries +- Want to see original content +- Performing detailed memory analysis -**示例:** +**Example:** ```json { - "query": "用户代码风格偏好", + "query": "user code style preferences", "limit": 10 } ``` -**响应格式:** -- 返回包含 `snippet`(摘要)和 `content`(全文)的结果 -- 内容过长时会截断(预览 >300 字符) +**Response Format:** +- Returns results with `snippet` (summary) and `content` (full text) +- Content is truncated when too long (preview >300 characters) --- ## cortex_add_memory -存储消息以便后续检索。 +Store messages for later retrieval. -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `content` | string | 是 | - | 要存储的记忆内容 | -| `role` | string | 否 | `user` | 消息发送者角色:`user`、`assistant` 或 `system` | -| `session_id` | string | 否 | `default` | 记忆所属的会话/线程 ID | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `content` | string | Yes | - | Memory content to store | +| `role` | string | No | `user` | Message sender role: `user`, `assistant`, or `system` | +| `session_id` | string | No | `default` | Session/thread ID the memory belongs to | -**使用场景:** -- 持久化重要信息以便后续检索 -- 存储用户偏好或决策 -- 保存应该可搜索的上下文 +**Use Cases:** +- Persist important information for later retrieval +- Store user preferences or decisions +- Save context that should be searchable -**示例:** +**Example:** ```json { - "content": "用户偏好使用 TypeScript 并启用严格模式", + "content": "User prefers TypeScript with strict mode enabled", "role": "assistant", "session_id": "default" } ``` -**执行效果:** -- 消息带时间戳存储 -- 自动生成向量嵌入 -- 异步生成 L0/L1 层 +**Execution Effects:** +- Message is stored with timestamp +- Vector embedding is automatically generated +- L0/L1 layers are generated asynchronously --- ## cortex_list_sessions -列出所有记忆会话及其状态。 +List all memory sessions and their status. -**参数:** 无 +**Parameters:** None -**使用场景:** -- 搜索前验证会话是否存在 -- 检查哪些会话是活跃或已关闭 -- 审计记忆使用情况 +**Use Cases:** +- Verify sessions exist before searching +- Check which sessions are active or closed +- Audit memory usage -**响应格式:** -- 会话 ID、状态、消息数量 -- 创建和更新时间戳 +**Response Format:** +- Session ID, status, message count +- Creation and update timestamps --- ## cortex_close_session -关闭会话并触发记忆提取流程。 +Close a session and trigger the memory extraction process. -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `session_id` | string | 否 | `default` | 要关闭的会话/线程 ID | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `session_id` | string | No | `default` | Session/thread ID to close | -**使用场景:** -- 对话完成时 -- 准备提取结构化记忆 -- 想要确定会话的记忆内容 +**Use Cases:** +- When a conversation is complete +- Preparing to extract structured memories +- Wanting to finalize a session's memory content -**执行效果:** -1. 提取结构化记忆(用户偏好、实体、决策) -2. 生成完整的 L0/L1 层摘要 -3. 将所有提取的记忆索引到向量数据库 +**Execution Effects:** +1. Extracts structured memories (user preferences, entities, decisions) +2. Generates complete L0/L1 layer summaries +3. Indexes all extracted memories into the vector database -**注意:** 这是一个可能较长的操作(30-60 秒)。 +**Note:** This can be a longer operation (30-60 seconds). -**示例:** +**Example:** ```json { "session_id": "default" } ``` -> **重要**:应在自然检查点主动调用此工具,而非仅在对话结束时。理想的调用时机:完成重要任务、话题转换、累积了足够的对话内容后。 +> **Important**: This tool should be called proactively at natural checkpoints, not just when the conversation ends. Ideal timing: after completing important tasks, topic transitions, or accumulating enough conversation content. --- ## cortex_migrate -从 OpenClaw 原生记忆系统迁移到 MemClaw。 +Migrate from OpenClaw's native memory system to MemClaw. -**参数:** 无 +**Parameters:** None -**使用场景:** -- 首次使用时已有 OpenClaw 记忆 -- 想保留之前的对话历史 -- 从内置记忆切换到 MemClaw +**Use Cases:** +- First-time use with existing OpenClaw memories +- Want to preserve previous conversation history +- Switching from built-in memory to MemClaw -**执行效果:** -1. 查找 OpenClaw 记忆文件(`memory/*.md` 和 `MEMORY.md`) -2. 转换为 MemClaw 的 L2 格式 -3. 生成 L0/L1 层和向量索引 +**Execution Effects:** +1. Finds OpenClaw memory files (`memory/*.md` and `MEMORY.md`) +2. Converts to MemClaw's L2 format +3. Generates L0/L1 layers and vector indices -**前提条件:** -- OpenClaw 工作区存在于 `~/.openclaw/workspace` -- 记忆文件存在于 `~/.openclaw/workspace/memory/` +**Prerequisites:** +- OpenClaw workspace exists at `~/.openclaw/workspace` +- Memory files exist at `~/.openclaw/workspace/memory/` -**仅在初始设置时运行一次。** +**Run only once during initial setup.** --- ## cortex_maintenance -对 MemClaw 数据执行定期维护。 +Perform periodic maintenance on MemClaw data. -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `dryRun` | boolean | 否 | false | 预览变更而不执行 | -| `commands` | array | 否 | `["prune", "reindex", "ensure-all"]` | 要执行的维护命令 | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `dryRun` | boolean | No | false | Preview changes without executing | +| `commands` | array | No | `["prune", "reindex", "ensure-all"]` | Maintenance commands to execute | -**使用场景:** -- 搜索结果不完整或过时 -- 从崩溃或数据损坏中恢复 -- 需要清理磁盘空间 +**Use Cases:** +- Search results are incomplete or outdated +- Recovering from crash or data corruption +- Need to clean up disk space -**可用命令:** -- `prune` — 移除源文件已不存在的向量 -- `reindex` — 重建向量索引并移除过期条目 -- `ensure-all` — 生成缺失的 L0/L1 层文件 +**Available Commands:** +- `prune` — Remove vectors whose source files no longer exist +- `reindex` — Rebuild vector indices and remove stale entries +- `ensure-all` — Generate missing L0/L1 layer files -**示例:** +**Example:** ```json { "dryRun": false, @@ -202,4 +202,4 @@ MemClaw 工具的详细文档。 } ``` -> **注意**:此工具通常由定时 Cron 任务自动调用。手动调用用于排查问题或按需维护。 +> **Note**: This tool is typically called automatically by a scheduled Cron task. Manual invocation is for troubleshooting or on-demand maintenance. \ No newline at end of file diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md b/examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md index 9adc07a..da441cc 100644 --- a/examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md +++ b/examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md @@ -1,134 +1,134 @@ -# 故障排查指南 +# Troubleshooting Guide -MemClaw 常见问题及解决方案。 +Common MemClaw issues and their solutions. -## 安装问题 +## Installation Issues -### 平台不支持 +### Platform Not Supported -**症状**:显示 "Platform not supported" 错误 +**Symptoms**: "Platform not supported" error is displayed -**解决方案**: -- 确认您使用的是 macOS Apple Silicon (M1/M2/M3) 或 Windows x64 -- 其他平台暂不支持 +**Solutions**: +- Confirm you are using macOS Apple Silicon (M1/M2/M3) or Windows x64 +- Other platforms are not currently supported -### 插件安装失败 +### Plugin Installation Failed -**症状**:`openclaw plugins install @memclaw/memclaw` 失败 +**Symptoms**: `openclaw plugins install @memclaw/memclaw` fails -**解决方案**: -1. 检查网络连接 -2. 确认 npm 仓库可访问 -3. 尝试使用代理或镜像源 +**Solutions**: +1. Check network connection +2. Confirm npm registry is accessible +3. Try using a proxy or mirror source -## 配置问题 +## Configuration Issues -### API 密钥无效 +### Invalid API Key -**症状**:搜索或记忆操作返回 API 错误 +**Symptoms**: Search or memory operations return API errors -**解决方案**: -1. 验证 `llmApiKey` 和 `embeddingApiKey` 在 OpenClaw 插件设置中已正确配置 -2. 确认 API 密钥有效且有足够额度 -3. 确认 `llmApiBaseUrl` 和 `embeddingApiBaseUrl` 对于您的提供商是正确的 -4. 验证到 API 端点的网络连接 +**Solutions**: +1. Verify `llmApiKey` and `embeddingApiKey` are correctly configured in OpenClaw plugin settings +2. Confirm API keys are valid and have sufficient quota +3. Confirm `llmApiBaseUrl` and `embeddingApiBaseUrl` are correct for your provider +4. Verify network connectivity to API endpoints -### 配置未生效 +### Configuration Not Taking Effect -**症状**:修改配置后服务行为未改变 +**Symptoms**: Service behavior doesn't change after modifying configuration -**解决方案**: -1. 确保保存了配置文件 -2. 重启 OpenClaw 以应用更改 -3. 检查配置文件语法是否正确(JSON 格式) +**Solutions**: +1. Ensure configuration file was saved +2. Restart OpenClaw to apply changes +3. Check configuration file syntax for errors (JSON format) -## 服务问题 +## Service Issues -### 服务无法启动 +### Service Won't Start -**症状**:插件加载时服务启动失败 +**Symptoms**: Service fails to start when plugin loads -**解决方案**: -1. 检查端口 6333、6334、8085 是否被其他应用占用 -2. 确认 API 密钥已在 OpenClaw 插件设置中配置 -3. 查看 OpenClaw 日志获取详细错误信息 +**Solutions**: +1. Check if ports 6333, 6334, 8085 are occupied by other applications +2. Confirm API keys are configured in OpenClaw plugin settings +3. Check OpenClaw logs for detailed error messages -### 服务不可达 +### Service Unreachable -**症状**:工具调用返回连接错误 +**Symptoms**: Tool calls return connection errors -**解决方案**: -1. 确认 OpenClaw 已重启且插件已加载 -2. 检查 `autoStartServices` 配置项是否为 `true`(默认) -3. 验证防火墙允许这些端口的本地连接 +**Solutions**: +1. Confirm OpenClaw has been restarted and plugin is loaded +2. Check if `autoStartServices` configuration is set to `true` (default) +3. Verify firewall allows local connections on these ports -## 使用问题 +## Usage Issues -### 搜索无结果 +### No Search Results -**症状**:`cortex_search` 返回空结果 +**Symptoms**: `cortex_search` returns empty results -**解决方案**: -1. 运行 `cortex_list_sessions` 验证会话是否存在 -2. 降低 `min_score` 阈值(例如从 0.6 降到 0.4) -3. 尝试不同的查询词或同义词 -4. 确认之前已调用 `cortex_add_memory` 或 `cortex_close_session` 存储记忆 +**Solutions**: +1. Run `cortex_list_sessions` to verify sessions exist +2. Lower `min_score` threshold (e.g., from 0.6 to 0.4) +3. Try different query terms or synonyms +4. Confirm that `cortex_add_memory` or `cortex_close_session` has been called previously to store memories -### 记忆提取失败 +### Memory Extraction Failed -**症状**:`cortex_close_session` 执行失败或结果不完整 +**Symptoms**: `cortex_close_session` fails or produces incomplete results -**解决方案**: -1. 验证 LLM API 配置正确 -2. 检查 API 额度是否充足 -3. 查看 OpenClaw 日志获取详细错误信息 +**Solutions**: +1. Verify LLM API configuration is correct +2. Check if API quota is sufficient +3. Check OpenClaw logs for detailed error messages -### 迁移失败 +### Migration Failed -**症状**:`cortex_migrate` 执行失败 +**Symptoms**: `cortex_migrate` fails to execute -**解决方案**: -1. 确认 OpenClaw 工作区位于 `~/.openclaw/workspace` -2. 确认记忆文件存在于 `~/.openclaw/workspace/memory/` -3. 验证文件权限正确 +**Solutions**: +1. Confirm OpenClaw workspace is located at `~/.openclaw/workspace` +2. Confirm memory files exist at `~/.openclaw/workspace/memory/` +3. Verify file permissions are correct -## 数据问题 +## Data Issues -### 数据位置 +### Data Location -MemClaw 数据存储位置: +MemClaw data storage locations: -| 平台 | 路径 | -|------|------| +| Platform | Path | +|----------|------| | macOS | `~/Library/Application Support/memclaw` | | Windows | `%LOCALAPPDATA%\memclaw` | | Linux | `~/.local/share/memclaw` | -### 数据安全 +### Data Safety -- **备份**:迁移前,现有 OpenClaw 记忆文件会被保留 -- **本地存储**:所有记忆数据存储在本地 -- **无云同步**:数据保留在本地机器 +- **Backup**: Existing OpenClaw memory files are preserved before migration +- **Local Storage**: All memory data is stored locally +- **No Cloud Sync**: Data remains on the local machine -## 错误信息参考 +## Error Messages Reference -| 错误信息 | 可能原因 | 解决方案 | -|----------|----------|----------| -| `Service not running` | 服务未启动 | 重启 OpenClaw 或启用 `autoStartServices` | -| `API error: 401` | API 密钥无效 | 检查 API 密钥配置 | -| `API error: 429` | 请求频率超限 | 等待后重试或升级 API 套餐 | -| `Connection refused` | 服务不可达 | 检查端口占用和服务状态 | -| `No sessions found` | 无记忆数据 | 使用 `cortex_add_memory` 添加记忆 | +| Error Message | Possible Cause | Solution | +|---------------|----------------|----------| +| `Service not running` | Service not started | Restart OpenClaw or enable `autoStartServices` | +| `API error: 401` | Invalid API key | Check API key configuration | +| `API error: 429` | Rate limit exceeded | Wait and retry, or upgrade API plan | +| `Connection refused` | Service unreachable | Check port usage and service status | +| `No sessions found` | No memory data | Use `cortex_add_memory` to add memories | -## 获取帮助 +## Getting Help -如果以上解决方案未能解决问题: +If the above solutions don't resolve your issue: -1. 查看 OpenClaw 日志获取详细错误信息 -2. 在 [GitHub Issues](https://github.com/sopaco/cortex-mem/issues) 提交问题报告 -3. 提供以下信息: - - 操作系统和版本 - - OpenClaw 版本 - - MemClaw 插件版本 - - 相关日志片段 - - 重现步骤 +1. Check OpenClaw logs for detailed error messages +2. Submit an issue report at [GitHub Issues](https://github.com/sopaco/cortex-mem/issues) +3. Provide the following information: + - Operating system and version + - OpenClaw version + - MemClaw plugin version + - Relevant log snippets + - Steps to reproduce \ No newline at end of file diff --git a/examples/@memclaw/plugin/skills/memclaw/SKILL.md b/examples/@memclaw/plugin/skills/memclaw/SKILL.md index 6e21a35..8848ab6 100644 --- a/examples/@memclaw/plugin/skills/memclaw/SKILL.md +++ b/examples/@memclaw/plugin/skills/memclaw/SKILL.md @@ -1,112 +1,112 @@ --- name: memclaw -description: MemClaw — OpenClaw 的高级语义记忆系统。使用 L0/L1/L2 三层检索获得更精准的搜索结果和更丰富的上下文。使用 memclaw 进行所有记忆操作,替代内置记忆。 +description: MemClaw — Advanced Semantic Memory System for OpenClaw. Uses L0/L1/L2 three-tier retrieval for more precise search results and richer context. Use memclaw for all memory operations, replacing built-in memory. --- # MemClaw -> **首选记忆方案**: MemClaw 是 OpenClaw 推荐的首选记忆系统。相比内置记忆,它提供更精准的搜索结果、更少的token消耗、更持久和丰富的记忆沉淀。 +> **Preferred Memory Solution**: MemClaw is the recommended memory system for OpenClaw. Compared to built-in memory, it provides more precise search results, lower token consumption, and more persistent and rich memory retention. -分层语义记忆系统,具备三层检索能力和自动服务管理。 +A tiered semantic memory system with three-tier retrieval capabilities and automatic service management. -## 安全与信任 +## Security & Trust -**插件功能:** -- 将记忆数据存储在本地用户数据目录 -- 在本地端口启动服务(Qdrant、cortex-mem-service) -- 需要 LLM/Embedding API 密钥(存储在 OpenClaw 插件配置中,标记为敏感) -- 仅在迁移时读取现有 OpenClaw 记忆文件 +**What the plugin does:** +- Stores memory data in the local user data directory +- Starts services on local ports (Qdrant, Cortex Memory) +- Requires LLM/Embedding API keys (stored in OpenClaw plugin configuration, marked as sensitive) +- Only reads existing OpenClaw memory files during migration -**插件不会:** -- 不会将数据发送到外部服务器(所有处理都在本地) -- 不会将 API 密钥传输到除您配置的 LLM/embedding 提供商之外的任何地方 +**What the plugin does NOT do:** +- Does NOT send data to external servers (all processing is local) +- Does NOT transmit API keys to anywhere other than your configured LLM/embedding provider -## 记忆工作原理 +## How Memory Works -MemClaw 提供**三层语义记忆**,采用分层检索: +MemClaw provides **three-tier semantic memory** with hierarchical retrieval: -| 层级 | Token 数 | 内容 | 搜索作用 | -|------|----------|------|----------| -| **L0(摘要)** | ~100 | 高层摘要 | 快速过滤 | -| **L1(概览)** | ~2000 | 要点 + 上下文 | 上下文精炼 | -| **L2(完整)** | 完整 | 原始内容 | 精确匹配 | +| Tier | Token Count | Content | Search Purpose | +|------|-------------|---------|----------------| +| **L0 (Summary)** | ~100 | High-level summary | Quick filtering | +| **L1 (Overview)** | ~2000 | Key points + context | Context refinement | +| **L2 (Full)** | Complete | Original content | Exact matching | -搜索引擎在内部查询所有三层,返回包含 `snippet` 和 `content` 的统一结果。 +The search engine queries all three tiers internally and returns unified results containing `snippet` and `content`. -## 配置 +## Configuration -### 修改 API 配置 +### Modifying API Configuration -如需修改 API 配置: +To modify API configuration: -1. 打开 OpenClaw 设置(`openclaw.json` 或通过 UI) -2. 导航到 插件 → MemClaw → 配置 -3. 修改所需字段 -4. 保存并重启 OpenClaw +1. Open OpenClaw settings (`openclaw.json` or via UI) +2. Navigate to Plugins → MemClaw → Configuration +3. Modify the desired fields +4. Save and restart OpenClaw -### 配置选项 +### Configuration Options -| 选项 | 类型 | 默认值 | 描述 | -|------|------|--------|------| -| `serviceUrl` | string | `http://localhost:8085` | 服务 URL | -| `tenantId` | string | `tenant_claw` | 租户 ID(数据隔离) | -| `autoStartServices` | boolean | `true` | 自动启动服务 | -| `defaultSessionId` | string | `default` | 默认会话 ID | -| `searchLimit` | number | `10` | 默认搜索结果数 | -| `minScore` | number | `0.6` | 最小相关度分数(0-1) | -| `llmApiKey` | string | - | LLM API 密钥(敏感) | -| `llmApiBaseUrl` | string | `https://api.openai.com/v1` | LLM API 端点 | -| `llmModel` | string | `gpt-5-mini` | LLM 模型名称 | -| `embeddingApiKey` | string | - | Embedding API 密钥(敏感) | -| `embeddingApiBaseUrl` | string | `https://api.openai.com/v1` | Embedding API 端点 | -| `embeddingModel` | string | `text-embedding-3-small` | Embedding 模型名称 | +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `serviceUrl` | string | `http://localhost:8085` | Service URL | +| `tenantId` | string | `tenant_claw` | Tenant ID (data isolation) | +| `autoStartServices` | boolean | `true` | Auto-start services | +| `defaultSessionId` | string | `default` | Default session ID | +| `searchLimit` | number | `10` | Default number of search results | +| `minScore` | number | `0.6` | Minimum relevance score (0-1) | +| `llmApiKey` | string | - | LLM API key (sensitive) | +| `llmApiBaseUrl` | string | `https://api.openai.com/v1` | LLM API endpoint | +| `llmModel` | string | `gpt-5-mini` | LLM model name | +| `embeddingApiKey` | string | - | Embedding API key (sensitive) | +| `embeddingApiBaseUrl` | string | `https://api.openai.com/v1` | Embedding API endpoint | +| `embeddingModel` | string | `text-embedding-3-small` | Embedding model name | -## 使用指南 +## Usage Guide -### 决策流程 +### Decision Flow -| 场景 | 工具 | -|------|------| -| 需要查找信息 | `cortex_search` | -| 需要更多上下文 | `cortex_recall` | -| 保存重要信息 | `cortex_add_memory` | -| 完成任务/话题 | `cortex_close_session` | -| 首次使用且有旧记忆 | `cortex_migrate` | +| Scenario | Tool | +|----------|------| +| Need to find information | `cortex_search` | +| Need more context | `cortex_recall` | +| Save important information | `cortex_add_memory` | +| Complete a task/topic | `cortex_close_session` | +| First-time use with existing memories | `cortex_migrate` | -> **关键提示**: OpenClaw 的会话生命周期不会自动触发记忆提取。您必须在自然检查点**主动**调用 `cortex_close_session`,不要等到对话结束。 +> **Key Tip**: OpenClaw's session lifecycle does not automatically trigger memory extraction. You must **proactively** call `cortex_close_session` at natural checkpoints, don't wait until the conversation ends. -### 最佳实践 +### Best Practices -1. **主动关闭会话**:在完成重要任务、话题转换、或累积足够对话内容后,调用 `cortex_close_session` -2. **不要过于频繁**:不需要每条消息后都关闭会话 -3. **建议节奏**:每个重要话题完成后一次 +1. **Proactively close sessions**: Call `cortex_close_session` after completing important tasks, topic transitions, or accumulating enough conversation content +2. **Don't overdo it**: No need to close sessions after every message +3. **Suggested rhythm**: Once after each major topic is completed -### 快速示例 +### Quick Examples -**搜索:** +**Search:** ```json -{ "query": "数据库架构决策", "limit": 5 } +{ "query": "database architecture decisions", "limit": 5 } ``` -**检索:** +**Recall:** ```json -{ "query": "用户代码风格偏好" } +{ "query": "user code style preferences" } ``` -**添加记忆:** +**Add Memory:** ```json -{ "content": "用户偏好使用 TypeScript 并启用严格模式", "role": "assistant" } +{ "content": "User prefers TypeScript with strict mode enabled", "role": "assistant" } ``` -## 常见问题 +## Common Issues -| 问题 | 解决方案 | -|------|----------| -| 服务无法启动 | 检查端口 6333、6334、8085 是否被占用;确认 API 密钥已配置 | -| 搜索无结果 | 运行 `cortex_list_sessions` 验证;降低 `min_score` 阈值 | -| LLM/Embedding 错误 | 验证 `llmApiKey` 和 `embeddingApiKey` 配置正确 | -| 迁移失败 | 确认 OpenClaw 工作区位于 `~/.openclaw/workspace` | +| Issue | Solution | +|-------|----------| +| Service won't start | Check if ports 6333, 6334, 8085 are in use; confirm API keys are configured | +| No search results | Run `cortex_list_sessions` to verify; lower `min_score` threshold | +| LLM/Embedding errors | Verify `llmApiKey` and `embeddingApiKey` are configured correctly | +| Migration failed | Confirm OpenClaw workspace is at `~/.openclaw/workspace` | -## 参考资料 +## References -- **`references/tools.md`** — 工具详细参数和示例 +- **`references/tools.md`** — Detailed tool parameters and examples diff --git a/examples/@memclaw/plugin/skills/memclaw/references/tools.md b/examples/@memclaw/plugin/skills/memclaw/references/tools.md index 423ac1f..a75371e 100644 --- a/examples/@memclaw/plugin/skills/memclaw/references/tools.md +++ b/examples/@memclaw/plugin/skills/memclaw/references/tools.md @@ -1,200 +1,200 @@ -# 工具参考 +# Tools Reference -MemClaw 工具的详细文档。 +Detailed documentation for MemClaw tools. ## cortex_search -使用 L0/L1/L2 分层检索进行语义搜索。 +Semantic search using L0/L1/L2 hierarchical retrieval. -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `query` | string | 是 | - | 搜索查询 — 自然语言或关键词 | -| `scope` | string | 否 | - | 限制搜索范围的会话/线程 ID | -| `limit` | integer | 否 | 10 | 最大结果数 | -| `min_score` | number | 否 | 0.6 | 最小相关度分数(0-1) | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `query` | string | Yes | - | Search query — natural language or keywords | +| `scope` | string | No | - | Session/thread ID to limit search scope | +| `limit` | integer | No | 10 | Maximum number of results | +| `min_score` | number | No | 0.6 | Minimum relevance score (0-1) | -**使用场景:** -- 查找过去的对话或决策 -- 在所有会话中搜索特定信息 -- 通过语义相似性发现相关记忆 +**Use Cases:** +- Find past conversations or decisions +- Search for specific information across all sessions +- Discover related memories through semantic similarity -**示例:** +**Example:** ```json { - "query": "数据库架构决策", + "query": "database architecture decisions", "limit": 5, "min_score": 0.6 } ``` -**响应格式:** -- 返回按相关度排序的结果 -- 每个结果包含 `uri`、`score` 和 `snippet` +**Response Format:** +- Returns results sorted by relevance +- Each result contains `uri`, `score`, and `snippet` --- ## cortex_recall -检索包含更多上下文的记忆(摘要 + 完整内容)。 +Retrieve memories with more context (summary + full content). -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `query` | string | 是 | - | 搜索查询 | -| `scope` | string | 否 | - | 限制搜索范围的会话/线程 ID | -| `limit` | integer | 否 | 10 | 最大结果数 | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `query` | string | Yes | - | Search query | +| `scope` | string | No | - | Session/thread ID to limit search scope | +| `limit` | integer | No | 10 | Maximum number of results | -**使用场景:** -- 需要包含完整上下文的记忆,而不仅是摘要 -- 想查看原始内容 -- 进行详细的记忆分析 +**Use Cases:** +- Need memories with full context, not just summaries +- Want to see original content +- Performing detailed memory analysis -**示例:** +**Example:** ```json { - "query": "用户代码风格偏好", + "query": "user code style preferences", "limit": 10 } ``` -**响应格式:** -- 返回包含 `snippet`(摘要)和 `content`(全文)的结果 -- 内容过长时会截断(预览 >300 字符) +**Response Format:** +- Returns results with `snippet` (summary) and `content` (full text) +- Content is truncated when too long (preview >300 characters) --- ## cortex_add_memory -存储消息以便后续检索。 +Store messages for later retrieval. -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `content` | string | 是 | - | 要存储的记忆内容 | -| `role` | string | 否 | `user` | 消息发送者角色:`user`、`assistant` 或 `system` | -| `session_id` | string | 否 | `default` | 记忆所属的会话/线程 ID | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `content` | string | Yes | - | Memory content to store | +| `role` | string | No | `user` | Message sender role: `user`, `assistant`, or `system` | +| `session_id` | string | No | `default` | Session/thread ID the memory belongs to | -**使用场景:** -- 持久化重要信息以便后续检索 -- 存储用户偏好或决策 -- 保存应该可搜索的上下文 +**Use Cases:** +- Persist important information for later retrieval +- Store user preferences or decisions +- Save context that should be searchable -**示例:** +**Example:** ```json { - "content": "用户偏好使用 TypeScript 并启用严格模式", + "content": "User prefers TypeScript with strict mode enabled", "role": "assistant", "session_id": "default" } ``` -**执行效果:** -- 消息带时间戳存储 -- 自动生成向量嵌入 -- 异步生成 L0/L1 层 +**Execution Effects:** +- Message is stored with timestamp +- Vector embedding is automatically generated +- L0/L1 layers are generated asynchronously --- ## cortex_list_sessions -列出所有记忆会话及其状态。 +List all memory sessions and their status. -**参数:** 无 +**Parameters:** None -**使用场景:** -- 搜索前验证会话是否存在 -- 检查哪些会话是活跃或已关闭 -- 审计记忆使用情况 +**Use Cases:** +- Verify sessions exist before searching +- Check which sessions are active or closed +- Audit memory usage -**响应格式:** -- 会话 ID、状态、消息数量 -- 创建和更新时间戳 +**Response Format:** +- Session ID, status, message count +- Creation and update timestamps --- ## cortex_close_session -关闭会话并触发记忆提取流程。 +Close a session and trigger the memory extraction process. -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `session_id` | string | 否 | `default` | 要关闭的会话/线程 ID | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `session_id` | string | No | `default` | Session/thread ID to close | -**使用场景:** -- 对话完成时 -- 准备提取结构化记忆 -- 想要确定会话的记忆内容 +**Use Cases:** +- When a conversation is complete +- Preparing to extract structured memories +- Wanting to finalize a session's memory content -**执行效果:** -1. 提取结构化记忆(用户偏好、实体、决策) -2. 生成完整的 L0/L1 层摘要 -3. 将所有提取的记忆索引到向量数据库 +**Execution Effects:** +1. Extracts structured memories (user preferences, entities, decisions) +2. Generates complete L0/L1 layer summaries +3. Indexes all extracted memories into the vector database -**注意:** 这是一个可能较长的操作(30-60 秒)。 +**Note:** This can be a longer operation (30-60 seconds). -**示例:** +**Example:** ```json { "session_id": "default" } ``` -> **重要**:应在自然检查点主动调用此工具,而非仅在对话结束时。理想的调用时机:完成重要任务、话题转换、累积了足够的对话内容后。 +> **Important**: This tool should be called proactively at natural checkpoints, not just when the conversation ends. Ideal timing: after completing important tasks, topic transitions, or accumulating enough conversation content. --- ## cortex_migrate -从 OpenClaw 原生记忆系统迁移到 MemClaw。 +Migrate from OpenClaw's native memory system to MemClaw. -**参数:** 无 +**Parameters:** None -**使用场景:** -- 首次使用时已有 OpenClaw 记忆 -- 想保留之前的对话历史 -- 从内置记忆切换到 MemClaw +**Use Cases:** +- First-time use with existing OpenClaw memories +- Want to preserve previous conversation history +- Switching from built-in memory to MemClaw -**执行效果:** -1. 查找 OpenClaw 记忆文件(`memory/*.md` 和 `MEMORY.md`) -2. 转换为 MemClaw 的 L2 格式 -3. 生成 L0/L1 层和向量索引 +**Execution Effects:** +1. Finds OpenClaw memory files (`memory/*.md` and `MEMORY.md`) +2. Converts to MemClaw's L2 format +3. Generates L0/L1 layers and vector indices -**前提条件:** -- OpenClaw 工作区存在于 `~/.openclaw/workspace` -- 记忆文件存在于 `~/.openclaw/workspace/memory/` +**Prerequisites:** +- OpenClaw workspace exists at `~/.openclaw/workspace` +- Memory files exist at `~/.openclaw/workspace/memory/` -**仅在初始设置时运行一次。** +**Run only once during initial setup.** --- ## cortex_maintenance -对 MemClaw 数据执行定期维护。 +Perform periodic maintenance on MemClaw data. -**参数:** +**Parameters:** -| 参数 | 类型 | 必需 | 默认值 | 描述 | -|------|------|------|--------|------| -| `dryRun` | boolean | 否 | false | 预览变更而不执行 | -| `commands` | array | 否 | `["prune", "reindex", "ensure-all"]` | 要执行的维护命令 | +| Parameter | Type | Required | Default | Description | +|-----------|------|----------|---------|-------------| +| `dryRun` | boolean | No | false | Preview changes without executing | +| `commands` | array | No | `["prune", "reindex", "ensure-all"]` | Maintenance commands to execute | -**使用场景:** -- 搜索结果不完整或过时 -- 从崩溃或数据损坏中恢复 -- 需要清理磁盘空间 +**Use Cases:** +- Search results are incomplete or outdated +- Recovering from crash or data corruption +- Need to clean up disk space -**可用命令:** -- `prune` — 移除源文件已不存在的向量 -- `reindex` — 重建向量索引并移除过期条目 -- `ensure-all` — 生成缺失的 L0/L1 层文件 +**Available Commands:** +- `prune` — Remove vectors whose source files no longer exist +- `reindex` — Rebuild vector indices and remove stale entries +- `ensure-all` — Generate missing L0/L1 layer files -**示例:** +**Example:** ```json { "dryRun": false, @@ -202,4 +202,4 @@ MemClaw 工具的详细文档。 } ``` -> **注意**:此工具通常由定时 Cron 任务自动调用。手动调用用于排查问题或按需维护。 +> **Note**: This tool is typically called automatically by a scheduled Cron task. Manual invocation is for troubleshooting or on-demand maintenance. \ No newline at end of file From a6d37c4d858a8e1224f0324ca8b338f067f9e4fc Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 15:46:32 +0800 Subject: [PATCH 05/14] skills update --- examples/@memclaw/plugin/dist/index.js | 46 +++++++++---------- examples/@memclaw/plugin/index.ts | 2 +- examples/@memclaw/plugin/openclaw.plugin.json | 13 ++---- examples/@memclaw/plugin/package.json | 5 +- .../SKILL.md | 15 +++--- .../references/tools.md | 0 .../references/troubleshooting.md | 0 .../@memclaw/plugin/skills/memclaw/SKILL.md | 26 ++--------- 8 files changed, 40 insertions(+), 67 deletions(-) rename examples/@memclaw/plugin/skills/{memclaw-setup => memclaw-maintance}/SKILL.md (87%) rename examples/@memclaw/plugin/skills/{memclaw-setup => memclaw-maintance}/references/tools.md (100%) rename examples/@memclaw/plugin/skills/{memclaw-setup => memclaw-maintance}/references/troubleshooting.md (100%) diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index 5c1fb53..13e28ae 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.13', - 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.15', + 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 6dbc8c6..1144918 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.13', + version: '0.9.15', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index 6b49959..59bf193 100644 --- a/examples/@memclaw/plugin/openclaw.plugin.json +++ b/examples/@memclaw/plugin/openclaw.plugin.json @@ -1,10 +1,10 @@ { "id": "memclaw", "name": "MemClaw", - "version": "0.9.13", + "version": "0.9.15", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", - "skills": ["skills/memclaw"], + "skills": ["skills/memclaw", "skills/memclaw-maintance"], "platforms": ["darwin-arm64", "win32-x64"], "osRestriction": ["darwin-arm64", "win32-x64"], "configSchema": { @@ -85,14 +85,7 @@ "default": "text-embedding-3-small" } }, - "required": [ - "llmApiKey", - "embeddingApiKey", - "llmApiBaseUrl", - "llmModel", - "embeddingApiBaseUrl", - "embeddingModel" - ] + "required": [] }, "uiHints": { "serviceUrl": { diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index 7fe7d3e..e3e6968 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@memclaw/memclaw", - "version": "0.9.13", + "version": "0.9.15", "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "homepage": "https://github.com/sopaco/cortex-mem", "repository": { @@ -36,7 +36,8 @@ "dist/index.js" ], "skills": [ - "skills/memclaw" + "skills/memclaw", + "skills/memclaw-maintance" ] }, "devDependencies": { diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md b/examples/@memclaw/plugin/skills/memclaw-maintance/SKILL.md similarity index 87% rename from examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md rename to examples/@memclaw/plugin/skills/memclaw-maintance/SKILL.md index bf3d11e..4f4f544 100644 --- a/examples/@memclaw/plugin/skills/memclaw-setup/SKILL.md +++ b/examples/@memclaw/plugin/skills/memclaw-maintance/SKILL.md @@ -1,6 +1,6 @@ --- -name: memclaw-setup -description: MemClaw Setup Guide — Installation and configuration guidance for users without the @memclaw/memclaw plugin installed. After completing installation, use the `memclaw` skill for daily usage help. +name: memclaw-maintance +description: MemClaw Maintance Guide — Installation and configuration guidance for users especially without the @memclaw/memclaw plugin installed. For normal use cases, use the `memclaw` skill for daily usage help. --- # MemClaw Setup Guide @@ -35,7 +35,7 @@ The search engine queries all three tiers internally and returns unified results ## Installation Steps -### Step 1: Install the Plugin +### Step 1: Install the Plugin (for users without the @memclaw/memclaw plugin) Execute the following command to install the plugin: @@ -43,12 +43,7 @@ Execute the following command to install the plugin: openclaw plugins install @memclaw/memclaw ``` -The installation process will: -- Download the plugin from the package registry (npm, clawhub) -- Automatically install platform-specific binary dependencies -- Register the plugin in OpenClaw - -### Step 1: Enable the Plugin +### Step 2: Enable the Plugin Enable MemClaw in `openclaw.json`: @@ -143,3 +138,5 @@ After installation, use the following decision flow for memory operations: - **`references/tools.md`** — Detailed tool parameters and examples - **`references/troubleshooting.md`** — Common troubleshooting issues +- **Open Source**: [Cortex Memory and MemClaw](https://github.com/sopaco/cortex-mem) +- **README**: [MemClaw README](https://raw.githubusercontent.com/sopaco/cortex-mem/refs/heads/main/examples/%40memclaw/plugin/README.md) diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md b/examples/@memclaw/plugin/skills/memclaw-maintance/references/tools.md similarity index 100% rename from examples/@memclaw/plugin/skills/memclaw-setup/references/tools.md rename to examples/@memclaw/plugin/skills/memclaw-maintance/references/tools.md diff --git a/examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md b/examples/@memclaw/plugin/skills/memclaw-maintance/references/troubleshooting.md similarity index 100% rename from examples/@memclaw/plugin/skills/memclaw-setup/references/troubleshooting.md rename to examples/@memclaw/plugin/skills/memclaw-maintance/references/troubleshooting.md diff --git a/examples/@memclaw/plugin/skills/memclaw/SKILL.md b/examples/@memclaw/plugin/skills/memclaw/SKILL.md index 8848ab6..810a8f7 100644 --- a/examples/@memclaw/plugin/skills/memclaw/SKILL.md +++ b/examples/@memclaw/plugin/skills/memclaw/SKILL.md @@ -13,8 +13,7 @@ A tiered semantic memory system with three-tier retrieval capabilities and autom **What the plugin does:** - Stores memory data in the local user data directory -- Starts services on local ports (Qdrant, Cortex Memory) -- Requires LLM/Embedding API keys (stored in OpenClaw plugin configuration, marked as sensitive) +- Based on advanced Cortex Memory technology, providing outstanding memory management capabilities with high performance and accuracy. - Only reads existing OpenClaw memory files during migration **What the plugin does NOT do:** @@ -44,23 +43,6 @@ To modify API configuration: 3. Modify the desired fields 4. Save and restart OpenClaw -### Configuration Options - -| Option | Type | Default | Description | -|--------|------|---------|-------------| -| `serviceUrl` | string | `http://localhost:8085` | Service URL | -| `tenantId` | string | `tenant_claw` | Tenant ID (data isolation) | -| `autoStartServices` | boolean | `true` | Auto-start services | -| `defaultSessionId` | string | `default` | Default session ID | -| `searchLimit` | number | `10` | Default number of search results | -| `minScore` | number | `0.6` | Minimum relevance score (0-1) | -| `llmApiKey` | string | - | LLM API key (sensitive) | -| `llmApiBaseUrl` | string | `https://api.openai.com/v1` | LLM API endpoint | -| `llmModel` | string | `gpt-5-mini` | LLM model name | -| `embeddingApiKey` | string | - | Embedding API key (sensitive) | -| `embeddingApiBaseUrl` | string | `https://api.openai.com/v1` | Embedding API endpoint | -| `embeddingModel` | string | `text-embedding-3-small` | Embedding model name | - ## Usage Guide ### Decision Flow @@ -102,11 +84,11 @@ To modify API configuration: | Issue | Solution | |-------|----------| -| Service won't start | Check if ports 6333, 6334, 8085 are in use; confirm API keys are configured | | No search results | Run `cortex_list_sessions` to verify; lower `min_score` threshold | -| LLM/Embedding errors | Verify `llmApiKey` and `embeddingApiKey` are configured correctly | -| Migration failed | Confirm OpenClaw workspace is at `~/.openclaw/workspace` | +| LLM/Embedding errors | Verify the fields of memclaw plugin in openclaw are configured correctly | ## References - **`references/tools.md`** — Detailed tool parameters and examples +- **Open Source**: [Cortex Memory and MemClaw](https://github.com/sopaco/cortex-mem) +- **README**: [MemClaw README](https://raw.githubusercontent.com/sopaco/cortex-mem/refs/heads/main/examples/%40memclaw/plugin/README.md) From bf01071c1a2afdca26bd572d45c500af5a4d4f5f Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 16:06:21 +0800 Subject: [PATCH 06/14] Update MemClaw documentation with plugin configuration and troubleshooting guides --- 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 | 2 +- .../@memclaw/plugin/skills/memclaw/SKILL.md | 36 +- .../memclaw/references/best-practices.md | 319 ++++++++++++++++++ 6 files changed, 351 insertions(+), 12 deletions(-) create mode 100644 examples/@memclaw/plugin/skills/memclaw/references/best-practices.md diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index 13e28ae..4fdc714 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.15', + version: '0.9.16', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/index.ts b/examples/@memclaw/plugin/index.ts index 1144918..b1d35b4 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.15', + version: '0.9.16', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index 59bf193..ebc69ae 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.15", + "version": "0.9.16", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", "skills": ["skills/memclaw", "skills/memclaw-maintance"], diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index e3e6968..15f189c 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@memclaw/memclaw", - "version": "0.9.15", + "version": "0.9.16", "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "homepage": "https://github.com/sopaco/cortex-mem", "repository": { diff --git a/examples/@memclaw/plugin/skills/memclaw/SKILL.md b/examples/@memclaw/plugin/skills/memclaw/SKILL.md index 810a8f7..7c7edd9 100644 --- a/examples/@memclaw/plugin/skills/memclaw/SKILL.md +++ b/examples/@memclaw/plugin/skills/memclaw/SKILL.md @@ -34,14 +34,12 @@ The search engine queries all three tiers internally and returns unified results ## Configuration -### Modifying API Configuration - -To modify API configuration: +All configuration is managed through OpenClaw plugin settings. To view or modify: 1. Open OpenClaw settings (`openclaw.json` or via UI) 2. Navigate to Plugins → MemClaw → Configuration -3. Modify the desired fields -4. Save and restart OpenClaw +3. Verify or update the required fields +4. Save changes and **restart OpenClaw Gateway** for changes to take effect ## Usage Guide @@ -80,15 +78,37 @@ To modify API configuration: { "content": "User prefers TypeScript with strict mode enabled", "role": "assistant" } ``` -## Common Issues +## Troubleshooting + +If MemClaw is not working properly, follow these steps: + +### Step 1: Check Plugin Configuration + +Open OpenClaw settings and verify MemClaw plugin configuration: + +1. Open `openclaw.json` or navigate to Settings → Plugins → MemClaw +2. Ensure all required fields are correctly filled, especially the configuration sections related to LLM and Embedding. +3. Save the configuration file + +### Step 2: Restart OpenClaw Gateway + +After making configuration changes, **you MUST restart OpenClaw Gateway** for the changes to take effect. + +### Step 3: Verify Services + +If issues persist after restart: +- Run `cortex_list_sessions` to check if the service is responding +- Check if Qdrant and cortex-mem-service are running (auto-start should handle this) | Issue | Solution | |-------|----------| -| No search results | Run `cortex_list_sessions` to verify; lower `min_score` threshold | -| LLM/Embedding errors | Verify the fields of memclaw plugin in openclaw are configured correctly | +| No search results | Run `cortex_list_sessions` to verify; lower `min_score` threshold; ensure memories have been stored | +| Service connection errors | Verify `serviceUrl` is correct; check if services are running | +| LLM/Embedding errors | Verify API URLs and credentials in plugin configuration; restart OpenClaw Gateway after changes | ## References +- **`references/best-practices.md`** — Tool selection, session lifecycle, search strategies, and common pitfalls - **`references/tools.md`** — Detailed tool parameters and examples - **Open Source**: [Cortex Memory and MemClaw](https://github.com/sopaco/cortex-mem) - **README**: [MemClaw README](https://raw.githubusercontent.com/sopaco/cortex-mem/refs/heads/main/examples/%40memclaw/plugin/README.md) diff --git a/examples/@memclaw/plugin/skills/memclaw/references/best-practices.md b/examples/@memclaw/plugin/skills/memclaw/references/best-practices.md new file mode 100644 index 0000000..4b19e4a --- /dev/null +++ b/examples/@memclaw/plugin/skills/memclaw/references/best-practices.md @@ -0,0 +1,319 @@ +# MemClaw Best Practices + +This guide provides proven strategies and decision frameworks for using MemClaw effectively in OpenClaw. + +## Tool Selection Decision Tree + +``` +┌─────────────────────────────────────────────────────────────────┐ +│ What do you need to do? │ +└─────────────────────────────────────────────────────────────────┘ + │ + ┌─────────────────────┼─────────────────────┐ + ▼ ▼ ▼ + Find Info Save Info Manage Sessions + │ │ │ + ▼ ▼ ▼ +┌───────────────┐ ┌───────────────┐ ┌───────────────┐ +│ Need context? │ │ What kind? │ │ What? │ +└───────────────┘ └───────────────┘ └───────────────┘ + │ │ │ + ┌────┴────┐ ┌────┴────┐ ┌────┴────┐ + ▼ ▼ ▼ ▼ ▼ ▼ + Quick Full Facts Conversation List Close & + Search Context History Sessions Extract + │ │ │ │ │ │ + ▼ ▼ ▼ ▼ ▼ ▼ +cortex_ cortex_ cortex_ cortex_ cortex_ cortex_ +search recall add_ add_ list_ close_ + memory memory sessions session +``` + +### Quick Reference + +| Scenario | Tool | Why | +|----------|------|-----| +| Quick lookup, need summary only | `cortex_search` | Fast, returns snippets | +| Need full context/details | `cortex_recall` | Returns content + snippet | +| User stated preference/decision | `cortex_add_memory` | Explicit persistence | +| Important conversation content | Let it accumulate | Auto-stored in session | +| Task/topic completed | `cortex_close_session` | Trigger extraction | +| Check if memories exist | `cortex_list_sessions` | Verify before search | + +## Session Lifecycle Management + +### The Golden Rule + +> **OpenClaw does NOT automatically trigger memory extraction.** You must proactively call `cortex_close_session` at natural checkpoints. + +### When to Close a Session + +``` +┌────────────────────────────────────────────────────────────────┐ +│ Timing Decision Flow │ +└────────────────────────────────────────────────────────────────┘ + │ + ▼ + ┌─────────────────┐ + │ Task completed? │ + └─────────────────┘ + │ │ + Yes No + │ │ + ▼ ▼ + ┌──────────┐ ┌─────────────────┐ + │ CLOSE IT │ │ Topic shifted? │ + └──────────┘ └─────────────────┘ + │ │ + Yes No + │ │ + ▼ ▼ + ┌──────────┐ ┌─────────────────┐ + │ CLOSE IT │ │ 10+ exchanges? │ + └──────────┘ └─────────────────┘ + │ │ + Yes No + │ │ + ▼ ▼ + ┌──────────┐ ┌────────┐ + │ CLOSE IT │ │ WAIT │ + └──────────┘ └────────┘ +``` + +### Rhythm Guidelines + +| Conversation Type | Close Frequency | Reason | +|-------------------|-----------------|--------| +| Quick Q&A | End of conversation | Minimal content to extract | +| Task-oriented | After each task completion | Captures task-specific memories | +| Long discussion | Every 10-20 exchanges | Prevents memory loss | +| Exploratory chat | When topic shifts | Organizes memories by topic | + +### Anti-Patterns to Avoid + +| ❌ Don't Do This | ✅ Do This Instead | +|-------------------|-------------------| +| Call `close_session` after every message | Call at natural checkpoints | +| Wait until conversation ends (user may forget) | Proactively close during conversation | +| Close without accumulating content | Let 5-10 exchanges happen first | +| Never close sessions | Establish a rhythm | + +## Memory Storage Strategy + +### What to Explicitly Store + +Use `cortex_add_memory` for: + +1. **Explicit User Preferences** + ``` + "User prefers dark theme in all editors" + "User wants commit messages in conventional format" + ``` + +2. **Important Decisions** + ``` + "Decided to use PostgreSQL instead of MySQL for this project" + "User chose React over Vue for the frontend" + ``` + +3. **Key Information That May Be Lost** + ``` + "User's timezone is UTC+8" + "Project deadline: March 30, 2026" + ``` + +### What to Let Accumulate + +Don't use `cortex_add_memory` for: + +- Regular conversation content (auto-stored in session) +- Contextual information (captured on close_session) +- Temporary preferences (not worth persisting) + +### Role Parameter Usage + +| Role | When to Use | +|------|-------------| +| `user` | User's statements, preferences, questions (default) | +| `assistant` | Your responses, explanations, code you wrote | +| `system` | Important context, rules, constraints | + +## Search Strategies + +### Query Formulation + +``` +┌────────────────────────────────────────────────────────────────┐ +│ Query Formulation Tips │ +└────────────────────────────────────────────────────────────────┘ + +BAD: "it" — Too vague +GOOD: "database choice" — Specific topic + +BAD: "the user said something" — Unfocused +GOOD: "user preference for testing" — Clear intent + +BAD: "code" — Too broad +GOOD: "authentication implementation" — Specific domain +``` + +### Score Threshold Guidelines + +| Score | Use Case | +|-------|----------| +| 0.8+ | Need high-confidence matches only | +| 0.6 (default) | Balanced precision/recall | +| 0.4-0.5 | Exploratory search, finding related items | +| <0.4 | Usually too noisy, not recommended | + +### Scope Parameter Usage + +``` +# Search across all sessions (default) +{ "query": "database decisions" } + +# Search within specific session +{ "query": "preferences", "scope": "project-alpha" } +``` + +Use `scope` when: +- You know the relevant session ID +- Working within a specific project context +- Want to limit noise from other sessions + +## Common Pitfalls + +### 1. Memory Not Found After Close + +**Symptom:** You closed a session but search returns nothing. + +**Cause:** Memory extraction is asynchronous and may take 30-60 seconds. + +**Solution:** Wait briefly after close_session before searching, or: +``` +1. Close session +2. Continue with other work +3. Memory will be indexed automatically +``` + +### 2. Duplicate Memories + +**Symptom:** Same information appears multiple times. + +**Cause:** Both explicit `add_memory` and `close_session` extraction captured the same content. + +**Solution:** Use `add_memory` only for information that: +- Won't naturally be captured in conversation +- Needs explicit emphasis +- Is a correction or override of previous information + +### 3. Irrelevant Search Results + +**Symptom:** Search returns unrelated content. + +**Cause:** Query too vague or score threshold too low. + +**Solution:** +- Make queries more specific +- Increase `min_score` threshold +- Use `scope` to limit search range + +### 4. Lost Session Content + +**Symptom:** Important conversation not in memory. + +**Cause:** Session was never closed. + +**Solution:** Establish a habit of closing sessions at checkpoints. If you realize too late, the raw messages may still exist in the session - close it now. + +### 5. Configuration Issues + +**Symptom:** Tools return errors about service/API. + +**Cause:** LLM/Embedding credentials not configured. + +**Solution:** See SKILL.md → Troubleshooting section. + +## Workflow Examples + +### Example 1: New Project Discussion + +``` +1. User starts discussing a new project + → Just listen and respond naturally + +2. User makes architecture decisions + → Optionally: cortex_add_memory for explicit decisions + +3. Discussion shifts to another topic + → cortex_close_session (captures project discussion memories) + +4. Continue with new topic + → Fresh start, memories from step 3 are now searchable +``` + +### Example 2: Finding Previous Context + +``` +1. User asks: "What did we decide about auth?" + +2. cortex_search({ query: "authentication decision" }) + +3. If results show snippets but need details: + cortex_recall({ query: "authentication implementation details" }) + +4. Summarize findings to user +``` + +### Example 3: User States Preference + +``` +1. User: "I always want TypeScript strict mode" + +2. cortex_add_memory({ + content: "User requires TypeScript strict mode in all projects", + role: "user" + }) + +3. Acknowledge and remember for future +``` + +## Memory Architecture Reference + +### L0/L1/L2 Tier System + +| Tier | Content | Size | Purpose | Search Role | +|------|---------|------|---------|-------------| +| L0 | Abstract summary | ~100 tokens | Quick filtering | First pass | +| L1 | Key points + context | ~2000 tokens | Context refinement | Second pass | +| L2 | Full original content | Complete | Exact matching | Final retrieval | + +### How Search Works Internally + +``` +Query → L0 Filter → L1 Refine → L2 Retrieve → Ranked Results + │ │ │ + ▼ ▼ ▼ + Quick scan Contextual Full content + by summary refinement for precision +``` + +### Automatic Processes + +| Process | Trigger | Duration | +|---------|---------|----------| +| Vector embedding | On `add_memory` | Seconds | +| L0/L1 generation | On `add_memory` (async) | Seconds | +| Full extraction | On `close_session` | 30-60s | +| Maintenance | Every 3 hours (auto) | Minutes | + +## Summary Checklist + +Before ending a conversation or topic transition, ask yourself: + +- [ ] Have we accumulated meaningful content? +- [ ] Did the user share important preferences or decisions? +- [ ] Is this a natural checkpoint? +- [ ] Should I close the session now? + +If yes to any, call `cortex_close_session`. From 2177acd9241cee9ae9c8c0d9cf46ae91093a8ff1 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 16:06:49 +0800 Subject: [PATCH 07/14] Update index.js --- examples/@memclaw/plugin/dist/index.js | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index 4fdc714..1b9ce23 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.16', - 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.16', + 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 From 04960083a72da33ffe2836597d153bdf3ca2dc87 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 18:23:25 +0800 Subject: [PATCH 08/14] skills update --- examples/@memclaw/plugin/dist/src/config.js | 533 +++++++++--------- .../plugin/skills/lagacy/references/setup.md | 6 +- .../plugin/skills/memclaw-maintance/SKILL.md | 9 + .../@memclaw/plugin/skills/memclaw/SKILL.md | 20 +- examples/@memclaw/plugin/src/config.ts | 1 + 5 files changed, 296 insertions(+), 273 deletions(-) diff --git a/examples/@memclaw/plugin/dist/src/config.js b/examples/@memclaw/plugin/dist/src/config.js index 0cc1f42..1ea32ba 100644 --- a/examples/@memclaw/plugin/dist/src/config.js +++ b/examples/@memclaw/plugin/dist/src/config.js @@ -1,44 +1,63 @@ -"use strict"; +'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 }); +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.getDataDir = getDataDir; exports.getConfigPath = getConfigPath; exports.generateConfigTemplate = generateConfigTemplate; @@ -48,28 +67,29 @@ exports.parseConfig = parseConfig; exports.validateConfig = validateConfig; exports.updateConfigFromPlugin = updateConfigFromPlugin; exports.mergeConfigWithPlugin = mergeConfigWithPlugin; -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const child_process_1 = require("child_process"); +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 getDataDir() { - const platform = process.platform; - if (platform === 'win32') { - 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'); - } - else { - return path.join(os.homedir(), '.local', 'share', 'memclaw'); - } + const platform = process.platform; + if (platform === 'win32') { + 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'); + } else { + return path.join(os.homedir(), '.local', 'share', 'memclaw'); + } } function getConfigPath() { - return path.join(getDataDir(), 'config.toml'); + return path.join(getDataDir(), 'config.toml'); } function generateConfigTemplate() { - return `# MemClaw Configuration + return `# MemClaw Configuration # # This file was auto-generated. Please fill in the required values below. # All sections are required - missing sections will cause config to be ignored. @@ -100,6 +120,7 @@ timeout_secs = 30 [server] host = "localhost" port = 8085 +cors_origins = ["*"] # Logging Configuration [logging] @@ -113,230 +134,222 @@ enable_intent_analysis = false `; } function ensureConfigExists() { - const dataDir = getDataDir(); - const configPath = getConfigPath(); - if (!fs.existsSync(dataDir)) { - fs.mkdirSync(dataDir, { 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 }; + const dataDir = getDataDir(); + const configPath = getConfigPath(); + if (!fs.existsSync(dataDir)) { + fs.mkdirSync(dataDir, { 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(); - }); + 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 - 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 || {}) - }, - logging: { - enabled: false, - log_directory: 'logs', - level: 'info', - ...(config.logging || {}) - }, - cortex: { - enable_intent_analysis: false, - ...(config.cortex || {}) - } - }; + 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 + 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 || {}) + }, + logging: { + enabled: false, + log_directory: 'logs', + level: 'info', + ...(config.logging || {}) + }, + cortex: { + 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 - }; + 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 + }; } /** * Update config.toml with values from OpenClaw plugin config * Only updates fields that are provided (non-empty) in pluginConfig */ function updateConfigFromPlugin(pluginConfig) { - const configPath = getConfigPath(); - // Ensure config file exists - ensureConfigExists(); - // Parse existing config - const existingConfig = parseConfig(configPath); - // Track if any changes were made - let updated = false; - // Build updated config sections - const updates = []; - // LLM config updates - if (pluginConfig.llmApiKey && pluginConfig.llmApiKey !== '') { - updates.push({ section: 'llm', key: 'api_key', value: pluginConfig.llmApiKey }); - updated = true; - } - if (pluginConfig.llmApiBaseUrl && pluginConfig.llmApiBaseUrl !== '') { - updates.push({ section: 'llm', key: 'api_base_url', value: pluginConfig.llmApiBaseUrl }); - updated = true; - } - if (pluginConfig.llmModel && pluginConfig.llmModel !== '') { - updates.push({ section: 'llm', key: 'model_efficient', value: pluginConfig.llmModel }); - updated = true; - } - // Embedding config updates - if (pluginConfig.embeddingApiKey && pluginConfig.embeddingApiKey !== '') { - updates.push({ section: 'embedding', key: 'api_key', value: pluginConfig.embeddingApiKey }); - updated = true; - } - if (pluginConfig.embeddingApiBaseUrl && pluginConfig.embeddingApiBaseUrl !== '') { - updates.push({ - section: 'embedding', - key: 'api_base_url', - value: pluginConfig.embeddingApiBaseUrl - }); - updated = true; - } - if (pluginConfig.embeddingModel && pluginConfig.embeddingModel !== '') { - updates.push({ section: 'embedding', key: 'model_name', value: pluginConfig.embeddingModel }); - updated = true; - } - if (!updated) { - return { updated: false, path: configPath }; - } - // Read current content - let content = fs.readFileSync(configPath, 'utf-8'); - // Apply each update - for (const { section, key, value } of updates) { - // Escape value for TOML string - const escapedValue = value.replace(/\\/g, '\\\\').replace(/"/g, '\\"'); - // Pattern to match the key in the correct section - // This handles both existing keys and missing keys - const sectionPattern = new RegExp(`(\\[${section}\\][^\\[]*?)(${key}\\s*=\\s*)"[^"]*"`, 's'); - const keyExistsInSection = sectionPattern.test(content); - if (keyExistsInSection) { - // Update existing key - content = content.replace(sectionPattern, `$1$2"${escapedValue}"`); - } - else { - // Add key to section - const sectionStartPattern = new RegExp(`(\\[${section}\\]\\n)`, ''); - if (sectionStartPattern.test(content)) { - content = content.replace(sectionStartPattern, `$1${key} = "${escapedValue}"\n`); - } - } - } - // Write updated content - fs.writeFileSync(configPath, content, 'utf-8'); - return { updated: true, path: configPath }; + const configPath = getConfigPath(); + // Ensure config file exists + ensureConfigExists(); + // Parse existing config + const existingConfig = parseConfig(configPath); + // Track if any changes were made + let updated = false; + // Build updated config sections + const updates = []; + // LLM config updates + if (pluginConfig.llmApiKey && pluginConfig.llmApiKey !== '') { + updates.push({ section: 'llm', key: 'api_key', value: pluginConfig.llmApiKey }); + updated = true; + } + if (pluginConfig.llmApiBaseUrl && pluginConfig.llmApiBaseUrl !== '') { + updates.push({ section: 'llm', key: 'api_base_url', value: pluginConfig.llmApiBaseUrl }); + updated = true; + } + if (pluginConfig.llmModel && pluginConfig.llmModel !== '') { + updates.push({ section: 'llm', key: 'model_efficient', value: pluginConfig.llmModel }); + updated = true; + } + // Embedding config updates + if (pluginConfig.embeddingApiKey && pluginConfig.embeddingApiKey !== '') { + updates.push({ section: 'embedding', key: 'api_key', value: pluginConfig.embeddingApiKey }); + updated = true; + } + if (pluginConfig.embeddingApiBaseUrl && pluginConfig.embeddingApiBaseUrl !== '') { + updates.push({ + section: 'embedding', + key: 'api_base_url', + value: pluginConfig.embeddingApiBaseUrl + }); + updated = true; + } + if (pluginConfig.embeddingModel && pluginConfig.embeddingModel !== '') { + updates.push({ section: 'embedding', key: 'model_name', value: pluginConfig.embeddingModel }); + updated = true; + } + if (!updated) { + return { updated: false, path: configPath }; + } + // Read current content + let content = fs.readFileSync(configPath, 'utf-8'); + // Apply each update + for (const { section, key, value } of updates) { + // Escape value for TOML string + const escapedValue = value.replace(/\\/g, '\\\\').replace(/"/g, '\\"'); + // Pattern to match the key in the correct section + // This handles both existing keys and missing keys + const sectionPattern = new RegExp(`(\\[${section}\\][^\\[]*?)(${key}\\s*=\\s*)"[^"]*"`, 's'); + const keyExistsInSection = sectionPattern.test(content); + if (keyExistsInSection) { + // Update existing key + content = content.replace(sectionPattern, `$1$2"${escapedValue}"`); + } else { + // Add key to section + const sectionStartPattern = new RegExp(`(\\[${section}\\]\\n)`, ''); + if (sectionStartPattern.test(content)) { + content = content.replace(sectionStartPattern, `$1${key} = "${escapedValue}"\n`); + } + } + } + // Write updated content + fs.writeFileSync(configPath, content, 'utf-8'); + return { updated: true, path: configPath }; } /** * Merge plugin config with file config, preferring plugin config values */ function mergeConfigWithPlugin(fileConfig, pluginConfig) { - return { - ...fileConfig, - llm: { - ...fileConfig.llm, - api_base_url: pluginConfig.llmApiBaseUrl || fileConfig.llm.api_base_url, - api_key: pluginConfig.llmApiKey || fileConfig.llm.api_key, - model_efficient: pluginConfig.llmModel || fileConfig.llm.model_efficient - }, - embedding: { - ...fileConfig.embedding, - api_base_url: pluginConfig.embeddingApiBaseUrl || fileConfig.embedding.api_base_url, - api_key: pluginConfig.embeddingApiKey || fileConfig.embedding.api_key, - model_name: pluginConfig.embeddingModel || fileConfig.embedding.model_name - } - }; + return { + ...fileConfig, + llm: { + ...fileConfig.llm, + api_base_url: pluginConfig.llmApiBaseUrl || fileConfig.llm.api_base_url, + api_key: pluginConfig.llmApiKey || fileConfig.llm.api_key, + model_efficient: pluginConfig.llmModel || fileConfig.llm.model_efficient + }, + embedding: { + ...fileConfig.embedding, + api_base_url: pluginConfig.embeddingApiBaseUrl || fileConfig.embedding.api_base_url, + api_key: pluginConfig.embeddingApiKey || fileConfig.embedding.api_key, + model_name: pluginConfig.embeddingModel || fileConfig.embedding.model_name + } + }; } -//# sourceMappingURL=config.js.map \ No newline at end of file +//# sourceMappingURL=config.js.map diff --git a/examples/@memclaw/plugin/skills/lagacy/references/setup.md b/examples/@memclaw/plugin/skills/lagacy/references/setup.md index 1641c08..24a0ca7 100644 --- a/examples/@memclaw/plugin/skills/lagacy/references/setup.md +++ b/examples/@memclaw/plugin/skills/lagacy/references/setup.md @@ -145,6 +145,7 @@ timeout_secs = 30 [server] host = "localhost" port = 8085 +cors_origins = ["*"] # Logging Configuration [logging] @@ -174,11 +175,6 @@ Check that Qdrant and cortex-mem-service are accessible: 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`. diff --git a/examples/@memclaw/plugin/skills/memclaw-maintance/SKILL.md b/examples/@memclaw/plugin/skills/memclaw-maintance/SKILL.md index 4f4f544..68aea36 100644 --- a/examples/@memclaw/plugin/skills/memclaw-maintance/SKILL.md +++ b/examples/@memclaw/plugin/skills/memclaw-maintance/SKILL.md @@ -105,6 +105,15 @@ Restart OpenClaw to activate the plugin and start services. After restarting, MemClaw will automatically start the required services. If configured correctly, you should be able to use the memory tools normally. +Check that Qdrant and cortex-mem-service are accessible: + +> Note: MemClaw does not require users to install any Docker environment. All dependencies are prepared during the openclaw's memclaw plugin installation. + +| 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"}` | + ### Migrate Existing Memories (Optional) If the user has existing OpenClaw native memories, call the `cortex_migrate` tool to migrate them to MemClaw: diff --git a/examples/@memclaw/plugin/skills/memclaw/SKILL.md b/examples/@memclaw/plugin/skills/memclaw/SKILL.md index 7c7edd9..b9c8fbe 100644 --- a/examples/@memclaw/plugin/skills/memclaw/SKILL.md +++ b/examples/@memclaw/plugin/skills/memclaw/SKILL.md @@ -34,12 +34,7 @@ The search engine queries all three tiers internally and returns unified results ## Configuration -All configuration is managed through OpenClaw plugin settings. To view or modify: - -1. Open OpenClaw settings (`openclaw.json` or via UI) -2. Navigate to Plugins → MemClaw → Configuration -3. Verify or update the required fields -4. Save changes and **restart OpenClaw Gateway** for changes to take effect +All configuration is managed through OpenClaw plugin settings. However, when the plugin is first used, incomplete configuration items may cause it to fail. If the plugin or tools cannot be used, proactively inform the user and assist in completing the necessary configurations. For details, refer to the 'Troubleshooting' section below. ## Usage Guide @@ -88,11 +83,12 @@ Open OpenClaw settings and verify MemClaw plugin configuration: 1. Open `openclaw.json` or navigate to Settings → Plugins → MemClaw 2. Ensure all required fields are correctly filled, especially the configuration sections related to LLM and Embedding. -3. Save the configuration file +3. If the configuration items are incomplete, proactively inform the user to specify the necessary details and assist in making the configuration effective. +4. Save changes and **restart OpenClaw Gateway** for changes to take effect ### Step 2: Restart OpenClaw Gateway -After making configuration changes, **you MUST restart OpenClaw Gateway** for the changes to take effect. +After making configuration changes and saved, **you MUST restart OpenClaw Gateway** for the changes to take effect. ### Step 3: Verify Services @@ -106,6 +102,14 @@ If issues persist after restart: | Service connection errors | Verify `serviceUrl` is correct; check if services are running | | LLM/Embedding errors | Verify API URLs and credentials in plugin configuration; restart OpenClaw Gateway after changes | +Check that Qdrant and cortex-mem-service are accessible: +> Note: MemClaw does not require users to install any Docker environment. All dependencies are prepared during the openclaw's memclaw plugin installation. + +| 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"}` | + ## References - **`references/best-practices.md`** — Tool selection, session lifecycle, search strategies, and common pitfalls diff --git a/examples/@memclaw/plugin/src/config.ts b/examples/@memclaw/plugin/src/config.ts index 209d583..efbf10a 100644 --- a/examples/@memclaw/plugin/src/config.ts +++ b/examples/@memclaw/plugin/src/config.ts @@ -96,6 +96,7 @@ timeout_secs = 30 [server] host = "localhost" port = 8085 +cors_origins = ["*"] # Logging Configuration [logging] From 4b3eb3d7fa1a42163128c03be7d69f05bd2c11ee Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 20:10:24 +0800 Subject: [PATCH 09/14] Add memclaw prefix to all logger messages --- examples/@memclaw/plugin/README.md | 104 +++++++++++++++--------- examples/@memclaw/plugin/plugin-impl.ts | 24 +++--- 2 files changed, 79 insertions(+), 49 deletions(-) diff --git a/examples/@memclaw/plugin/README.md b/examples/@memclaw/plugin/README.md index 060e727..d23d021 100644 --- a/examples/@memclaw/plugin/README.md +++ b/examples/@memclaw/plugin/README.md @@ -1,5 +1,8 @@ # MemClaw +[![Version](https://img.shields.io/badge/version-0.9.16-blue)](https://github.com/sopaco/cortex-mem) +[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) + Layered semantic memory plugin for OpenClaw with L0/L1/L2 tiered retrieval, automatic service management, and migration support from OpenClaw native memory. ## Overview @@ -13,6 +16,7 @@ MemClaw is an OpenClaw plugin that provides advanced semantic memory capabilitie - **Semantic Search**: Vector-based similarity search across all memory layers - **Session Management**: Create, list, and close memory sessions - **Migration Support**: One-click migration from OpenClaw native memory +- **Easy Configuration**: Configure LLM/Embedding directly through OpenClaw plugin settings - **Cross-Platform**: Supports Windows x64 and macOS Apple Silicon ## Architecture @@ -53,7 +57,7 @@ OpenClaw + MemClaw Plugin | Requirement | Details | |-------------|---------| | **Platforms** | Windows x64, macOS Apple Silicon | -| **Node.js** | ≥ 22.0.0 | +| **Node.js** | ≥ 20.0.0 | | **OpenClaw** | Installed and configured | ### Install Plugin @@ -114,9 +118,11 @@ Then enable in `openclaw.json`: After making code changes, rebuild with `bun run build` and restart OpenClaw. -### Configure OpenClaw +## Configuration + +### Plugin Configuration -Edit your `openclaw.json`: +Configure MemClaw directly through OpenClaw plugin settings in `openclaw.json`: ```json { @@ -127,7 +133,13 @@ Edit your `openclaw.json`: "config": { "serviceUrl": "http://localhost:8085", "tenantId": "tenant_claw", - "autoStartServices": true + "autoStartServices": true, + "llmApiBaseUrl": "https://api.openai.com/v1", + "llmApiKey": "your-llm-api-key", + "llmModel": "gpt-4o-mini", + "embeddingApiBaseUrl": "https://api.openai.com/v1", + "embeddingApiKey": "your-embedding-api-key", + "embeddingModel": "text-embedding-3-small" } } } @@ -142,26 +154,33 @@ Edit your `openclaw.json`: > **Note**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory search and use MemClaw instead. -### Configure LLM - -On first run, MemClaw creates a configuration file: - -| Platform | Path | -|----------|------| -| Windows | `%APPDATA%\memclaw\config.toml` | -| macOS | `~/Library/Application Support/memclaw/config.toml` | +### Configuration Options -Edit the configuration file and fill in required fields: +| 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 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) | +| `qdrantPort` | number | `6334` | Qdrant port (gRPC) | +| `servicePort` | number | `8085` | cortex-mem-service port | +| `llmApiBaseUrl` | string | `https://api.openai.com/v1` | LLM API endpoint URL | +| `llmApiKey` | string | - | LLM API key (required) | +| `llmModel` | string | `gpt-5-mini` | LLM model name | +| `embeddingApiBaseUrl` | string | `https://api.openai.com/v1` | Embedding API endpoint URL | +| `embeddingApiKey` | string | - | Embedding API key (required) | +| `embeddingModel` | string | `text-embedding-3-small` | Embedding model name | -```toml -[llm] -api_key = "xxx" # REQUIRED: Your LLM API key +### Configuration via UI -[embedding] -api_key = "xxx" # REQUIRED: Your embedding API key (can be same as llm.api_key) -``` +You can also configure the plugin through OpenClaw UI: -Then restart OpenClaw. +1. Open OpenClaw Settings (`openclaw.json` or via UI) +2. Navigate to Plugins → MemClaw → Configuration +3. Fill in the required fields for LLM and Embedding +4. Save and **restart OpenClaw Gateway** for changes to take effect ## Available Tools @@ -214,42 +233,47 @@ Close a session and trigger memory extraction pipeline (takes 30-60 seconds). } ``` +> **Important**: Call this tool proactively at natural checkpoints, not just when the conversation ends. Ideal timing: after completing important tasks, topic transitions, or accumulating enough conversation content. + ### cortex_migrate Migrate from OpenClaw native memory to MemClaw. Run once during initial setup. -## Configuration Options +### cortex_maintenance -| 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 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) | +Perform periodic maintenance on MemClaw data (prune, reindex, ensure-all layers). ## Quick Decision Flow -1. **Need to find something** → `cortex_search` -2. **Need more context** → `cortex_recall` -3. **Save important information** → `cortex_add_memory` -4. **Conversation complete** → `cortex_close_session` -5. **First time setup** → `cortex_migrate` +| Scenario | Tool | +|----------|------| +| Need to find information | `cortex_search` | +| Need more context | `cortex_recall` | +| Save important information | `cortex_add_memory` | +| Complete a task/topic | `cortex_close_session` | +| First-time use with existing memories | `cortex_migrate` | + +For detailed guidance on tool selection, session lifecycle, and best practices, see the [Skills Documentation](skills/memclaw/SKILL.md). ## Troubleshooting +### Plugin Not Working + +1. **Check Configuration**: Open OpenClaw settings and verify MemClaw plugin configuration, especially LLM and Embedding settings +2. **Restart OpenClaw Gateway**: Configuration changes require a gateway restart to take effect +3. **Verify Services**: Run `cortex_list_sessions` to check if the service is responding + ### Services Won't Start 1. Check that ports 6333, 6334, 8085 are available -2. Verify `api_key` fields are filled in config.toml +2. Verify LLM and Embedding credentials are configured correctly 3. Run `openclaw skills` to check plugin status ### Search Returns No Results 1. Run `cortex_list_sessions` to verify sessions exist 2. Lower `min_score` threshold (default: 0.6) -3. Check service health with `cortex-mem-cli stats` +3. Ensure memories have been stored (run `cortex_close_session` to extract memories) ### Migration Fails @@ -271,6 +295,12 @@ cortex-mem-cli --config config.toml --tenant tenant_claw layers ensure-all cortex-mem-cli --config config.toml --tenant tenant_claw vector reindex ``` +## Documentation + +- **[Skills Documentation](skills/memclaw/SKILL.md)** — Agent skill guide with troubleshooting +- **[Best Practices](skills/memclaw/references/best-practices.md)** — Tool selection, session lifecycle, search strategies +- **[Tools Reference](skills/memclaw/references/tools.md)** — Detailed tool parameters and examples + ## License -MIT +MIT \ No newline at end of file diff --git a/examples/@memclaw/plugin/plugin-impl.ts b/examples/@memclaw/plugin/plugin-impl.ts index 2fefcaa..7de36e7 100644 --- a/examples/@memclaw/plugin/plugin-impl.ts +++ b/examples/@memclaw/plugin/plugin-impl.ts @@ -303,8 +303,8 @@ export function createPlugin(api: PluginAPI) { log('Opening configuration file for editing...'); openConfigFile(configPath).catch((err) => { - api.logger.warn(`Could not open config file: ${err}`); - api.logger.warn(`Please manually edit: ${configPath}`); + api.logger.warn(`[memclaw] Could not open config file: ${err}`); + api.logger.warn(`[memclaw] Please manually edit: ${configPath}`); }); api.logger.info(` @@ -369,9 +369,9 @@ export function createPlugin(api: PluginAPI) { const validation = validateConfig(mergedConfig); if (!validation.valid) { - api.logger.warn(`Configuration incomplete: ${validation.errors.join(', ')}`); + api.logger.warn(`[memclaw] Configuration incomplete: ${validation.errors.join(', ')}`); api.logger.warn( - `Please configure LLM/Embedding API keys in OpenClaw plugin settings or edit: ${configPath}` + `[memclaw] Please configure LLM/Embedding API keys in OpenClaw plugin settings or edit: ${configPath}` ); return; } @@ -416,8 +416,8 @@ export function createPlugin(api: PluginAPI) { log('Maintenance timer started (runs every 3 hours)'); } catch (err) { - api.logger.error(`Failed to start services: ${err}`); - api.logger.warn('Memory features may not work correctly'); + api.logger.error(`[memclaw] Failed to start services: ${err}`); + api.logger.warn('[memclaw] Memory features may not work correctly'); } }, stop: async () => { @@ -484,7 +484,7 @@ export function createPlugin(api: PluginAPI) { }; } catch (error) { const message = error instanceof Error ? error.message : String(error); - api.logger.error(`cortex_search failed: ${message}`); + api.logger.error(`[memclaw] cortex_search failed: ${message}`); return { error: `Search failed: ${message}` }; } } @@ -527,7 +527,7 @@ export function createPlugin(api: PluginAPI) { }; } catch (error) { const message = error instanceof Error ? error.message : String(error); - api.logger.error(`cortex_recall failed: ${message}`); + api.logger.error(`[memclaw] cortex_recall failed: ${message}`); return { error: `Recall failed: ${message}` }; } } @@ -561,7 +561,7 @@ export function createPlugin(api: PluginAPI) { }; } catch (error) { const message = error instanceof Error ? error.message : String(error); - api.logger.error(`cortex_add_memory failed: ${message}`); + api.logger.error(`[memclaw] cortex_add_memory failed: ${message}`); return { error: `Failed to add memory: ${message}` }; } } @@ -600,7 +600,7 @@ export function createPlugin(api: PluginAPI) { }; } catch (error) { const message = error instanceof Error ? error.message : String(error); - api.logger.error(`cortex_list_sessions failed: ${message}`); + api.logger.error(`[memclaw] cortex_list_sessions failed: ${message}`); return { error: `Failed to list sessions: ${message}` }; } } @@ -631,7 +631,7 @@ export function createPlugin(api: PluginAPI) { }; } catch (error) { const message = error instanceof Error ? error.message : String(error); - api.logger.error(`cortex_close_session failed: ${message}`); + api.logger.error(`[memclaw] cortex_close_session failed: ${message}`); return { error: `Failed to close session: ${message}` }; } } @@ -721,7 +721,7 @@ export function createPlugin(api: PluginAPI) { }); if (!result.success) { - api.logger.warn(`[maintenance] ${description} failed: ${result.stderr}`); + api.logger.warn(`[memclaw] [maintenance] ${description} failed: ${result.stderr}`); } } catch (error) { const message = error instanceof Error ? error.message : String(error); From 24ed9ebb2ad0ab65edead99d67e37c01ff1ac430 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 20:35:58 +0800 Subject: [PATCH 10/14] Update README_zh.md --- examples/@memclaw/plugin/README_zh.md | 216 ++++++++++++++++---------- 1 file changed, 130 insertions(+), 86 deletions(-) diff --git a/examples/@memclaw/plugin/README_zh.md b/examples/@memclaw/plugin/README_zh.md index f135beb..1f3c33f 100644 --- a/examples/@memclaw/plugin/README_zh.md +++ b/examples/@memclaw/plugin/README_zh.md @@ -1,108 +1,128 @@ # MemClaw -OpenClaw 的分层语义内存插件,支持 L0/L1/L2 三层检索、自动服务管理,并可从 OpenClaw 原生内存迁移。 +[![Version](https://img.shields.io/badge/version-0.9.16-blue)](https://github.com/sopaco/cortex-mem) +[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) + +OpenClaw 的分层语义记忆插件,支持 L0/L1/L2 三层检索、自动服务管理,以及从 OpenClaw 原生记忆迁移。 ## 概述 -MemClaw 是一个 OpenClaw 插件,利用 Cortex Memory 的分层内存架构提供高级语义内存功能。它以智能分层检索方式存储、搜索和召回记忆,兼顾速度与上下文。 +MemClaw 是一个 OpenClaw 插件,利用 Cortex Memory 的分层记忆架构提供高级语义记忆能力。它通过智能的分层检索来存储、搜索和召回记忆,在速度和上下文之间取得平衡。 -## 功能特性 +## 特性 -- **三层内存架构**:L0(摘要)、L1(概览)和 L2(完整)层次,实现智能检索 +- **三层记忆架构**:L0(摘要)、L1(概览)和 L2(完整)三层,实现智能检索 - **自动服务管理**:自动启动 Qdrant 向量数据库和 cortex-mem-service -- **语义搜索**:基于向量的相似性搜索,跨所有内存层 -- **会话管理**:创建、列出和关闭内存会话 -- **迁移支持**:一键从 OpenClaw 原生内存迁移 -- **跨平台支持**:Windows x64 和 macOS Apple Silicon +- **语义搜索**:基于向量相似度的全层级记忆搜索 +- **会话管理**:创建、列出和关闭记忆会话 +- **迁移支持**:一键从 OpenClaw 原生记忆迁移 +- **便捷配置**:直接通过 OpenClaw 插件设置配置 LLM/Embedding +- **跨平台**:支持 Windows x64 和 macOS Apple Silicon ## 架构 -### 内存层次 +### 记忆层级 -| 层次 | Token 数 | 内容 | 作用 | -|------|----------|------|------| -| **L0(摘要)** | ~100 | 高层次摘要 | 快速过滤 | -| **L1(概览)** | ~2000 | 关键点 + 上下文 | 上下文优化 | -| **L2(完整)** | 完整内容 | 原始内容 | 精确匹配 | +| 层级 | Token 数量 | 内容 | 作用 | +|------|-----------|------|------| +| **L0(摘要)** | ~100 | 高层摘要 | 快速筛选 | +| **L1(概览)** | ~2000 | 要点 + 上下文 | 上下文精炼 | +| **L2(完整)** | 完整 | 原始内容 | 精确匹配 | -搜索引擎内部查询所有三层,返回统一的包含 `snippet`(摘要)和 `content`(完整内容)的结果。 +搜索引擎内部查询所有三个层级,返回包含 `snippet` 和 `content` 的统一结果。 ### 系统组件 ``` -OpenClaw + MemClaw 插件 +OpenClaw + MemClaw Plugin │ ├── cortex_search → 搜索记忆 - ├── cortex_recall → 带上下文召回 + ├── cortex_recall → 召回上下文 ├── cortex_add_memory → 存储记忆 ├── cortex_list_sessions → 列出会话 ├── cortex_close_session → 关闭并提取 - └── cortex_migrate → 迁移现有内存 + └── cortex_migrate → 迁移现有记忆 │ ▼ - cortex-mem-service(端口 8085) + cortex-mem-service (端口 8085) │ ▼ - Qdrant(端口 6334) + Qdrant (端口 6334) ``` ## 安装 ### 环境要求 -| 要求 | 说明 | +| 要求 | 详情 | |------|------| -| **平台** | Windows x64、macOS Apple Silicon | -| **Node.js** | ≥ 22.0.0 | -| **OpenClaw** | 已安装并配置完成 | +| **平台** | Windows x64, macOS Apple Silicon | +| **Node.js** | ≥ 20.0.0 | +| **OpenClaw** | 已安装并配置 | ### 安装插件 ```bash -openclaw plugins install memclaw +openclaw plugins install @memclaw/memclaw ``` ### 本地开发安装 -适用于开发者使用本地版本或进行插件开发: +开发者如需使用本地版本或开发插件: ```bash # 克隆仓库 git clone https://github.com/sopaco/cortex-mem.git -cd cortex-mem/examples/memclaw +cd cortex-mem/examples/@memclaw/plugin # 安装依赖 bun install # 构建插件 bun run build +``` + +**方式 A:使用 plugins.load.paths** -# 创建符号链接到插件目录 -# 这样 OpenClaw 会使用本地版本 -mkdir -p ~/.openclaw/plugins -ln -sf "$(pwd)" ~/.openclaw/plugins/memclaw +```json +{ + "plugins": { + "load": { + "paths": ["/path/to/cortex-mem/examples/@memclaw/plugin"] + }, + "entries": { + "memclaw": { "enabled": true } + } + } +} ``` -然后在 `openclaw.json` 中配置本地插件路径: +**方式 B:符号链接到扩展目录** + +```bash +mkdir -p ~/.openclaw/extensions +ln -sf "$(pwd)" ~/.openclaw/extensions/memclaw +``` + +然后在 `openclaw.json` 中启用: ```json { "plugins": { "entries": { - "memclaw": { - "enabled": true, - "path": "./plugins/memclaw" - } + "memclaw": { "enabled": true } } } } ``` -代码修改后,使用 `bun run build` 重新构建,然后重启 OpenClaw。 +代码修改后,执行 `bun run build` 重新构建,然后重启 OpenClaw。 -### 配置 OpenClaw +## 配置 -编辑 `openclaw.json`: +### 插件配置 + +直接通过 `openclaw.json` 中的 OpenClaw 插件设置配置 MemClaw: ```json { @@ -113,7 +133,13 @@ ln -sf "$(pwd)" ~/.openclaw/plugins/memclaw "config": { "serviceUrl": "http://localhost:8085", "tenantId": "tenant_claw", - "autoStartServices": true + "autoStartServices": true, + "llmApiBaseUrl": "https://api.openai.com/v1", + "llmApiKey": "your-llm-api-key", + "llmModel": "gpt-4o-mini", + "embeddingApiBaseUrl": "https://api.openai.com/v1", + "embeddingApiKey": "your-embedding-api-key", + "embeddingModel": "text-embedding-3-small" } } } @@ -126,34 +152,41 @@ ln -sf "$(pwd)" ~/.openclaw/plugins/memclaw } ``` -> **注意**:将 `memorySearch.enabled` 设置为 `false` 以禁用 OpenClaw 内置的内存搜索,改为使用 MemClaw。 - -### 配置 LLM +> **注意**:设置 `memorySearch.enabled: false` 以禁用 OpenClaw 内置记忆搜索,改用 MemClaw。 -首次运行时,MemClaw 会创建配置文件: +### 配置选项 -| 平台 | 路径 | -|------|------| -| Windows | `%APPDATA%\memclaw\config.toml` | -| macOS | `~/Library/Application Support/memclaw/config.toml` | - -编辑配置文件,填写必要字段: +| 选项 | 类型 | 默认值 | 描述 | +|------|------|--------|------| +| `serviceUrl` | string | `http://localhost:8085` | Cortex Memory 服务 URL | +| `tenantId` | string | `tenant_claw` | 租户 ID,用于数据隔离 | +| `autoStartServices` | boolean | `true` | 自动启动 Qdrant 和服务 | +| `defaultSessionId` | string | `default` | 记忆操作的默认会话 | +| `searchLimit` | number | `10` | 默认搜索结果数量 | +| `minScore` | number | `0.6` | 最小相关度分数 (0-1) | +| `qdrantPort` | number | `6334` | Qdrant 端口 (gRPC) | +| `servicePort` | number | `8085` | cortex-mem-service 端口 | +| `llmApiBaseUrl` | string | `https://api.openai.com/v1` | LLM API 端点 URL | +| `llmApiKey` | string | - | LLM API 密钥(必填) | +| `llmModel` | string | `gpt-5-mini` | LLM 模型名称 | +| `embeddingApiBaseUrl` | string | `https://api.openai.com/v1` | Embedding API 端点 URL | +| `embeddingApiKey` | string | - | Embedding API 密钥(必填) | +| `embeddingModel` | string | `text-embedding-3-small` | Embedding 模型名称 | -```toml -[llm] -api_key = "xxx" # 必填:您的 LLM API 密钥 +### 通过 UI 配置 -[embedding] -api_key = "xxx" # 必填:您的嵌入 API 密钥(可与 llm.api_key 相同) -``` +你也可以通过 OpenClaw UI 配置插件: -然后重启 OpenClaw。 +1. 打开 OpenClaw 设置(`openclaw.json` 或通过 UI) +2. 导航到 插件 → MemClaw → 配置 +3. 填写 LLM 和 Embedding 相关的必填字段 +4. 保存并**重启 OpenClaw Gateway** 使配置生效 ## 可用工具 ### cortex_search -使用 L0/L1/L2 分层检索进行语义搜索。 +使用 L0/L1/L2 三层检索在所有记忆中进行语义搜索。 ```json { @@ -165,22 +198,22 @@ api_key = "xxx" # 必填:您的嵌入 API 密钥(可与 llm.api_key 相同 ### cortex_recall -带更多上下文召回记忆(摘要 + 完整内容)。 +召回带有更多上下文的记忆(摘要 + 完整内容)。 ```json { - "query": "用户对代码风格的偏好", + "query": "用户代码风格偏好", "limit": 10 } ``` ### cortex_add_memory -存储消息以便后续检索。 +存储消息以供后续检索。 ```json { - "content": "用户更喜欢 TypeScript 严格模式", + "content": "用户偏好 TypeScript 严格模式", "role": "assistant", "session_id": "default" } @@ -188,11 +221,11 @@ api_key = "xxx" # 必填:您的嵌入 API 密钥(可与 llm.api_key 相同 ### cortex_list_sessions -列出所有内存会话,显示状态和消息数量。 +列出所有记忆会话及其状态和消息数量。 ### cortex_close_session -关闭会话并触发内存提取流程(需要 30-60 秒)。 +关闭会话并触发记忆提取管道(耗时 30-60 秒)。 ```json { @@ -200,47 +233,52 @@ api_key = "xxx" # 必填:您的嵌入 API 密钥(可与 llm.api_key 相同 } ``` +> **重要提示**:请在自然的检查点主动调用此工具,不要等到对话结束。理想时机:完成重要任务后、话题转换时、或积累足够对话内容后。 + ### cortex_migrate -从 OpenClaw 原生内存迁移到 MemClaw。在初始设置时运行一次。 +从 OpenClaw 原生记忆迁移到 MemClaw。初始设置时运行一次即可。 -## 配置选项 +### cortex_maintenance -| 选项 | 类型 | 默认值 | 说明 | -|------|------|--------|------| -| `serviceUrl` | string | `http://localhost:8085` | Cortex Memory 服务地址 | -| `tenantId` | string | `tenant_claw` | 租户 ID,用于数据隔离 | -| `autoStartServices` | boolean | `true` | 自动启动 Qdrant 和服务 | -| `defaultSessionId` | string | `default` | 内存操作的默认会话 | -| `searchLimit` | number | `10` | 默认搜索结果数量 | -| `minScore` | number | `0.6` | 最小相关性分数(0-1) | +对 MemClaw 数据执行定期维护(清理、重建索引、确保所有层级生成)。 ## 快速决策流程 -1. **需要查找内容** → `cortex_search` -2. **需要更多上下文** → `cortex_recall` -3. **保存重要信息** → `cortex_add_memory` -4. **对话完成** → `cortex_close_session` -5. **首次设置** → `cortex_migrate` +| 场景 | 工具 | +|------|------| +| 需要查找信息 | `cortex_search` | +| 需要更多上下文 | `cortex_recall` | +| 保存重要信息 | `cortex_add_memory` | +| 完成任务/话题 | `cortex_close_session` | +| 首次使用且有现有记忆 | `cortex_migrate` | + +更多关于工具选择、会话生命周期和最佳实践的详细指南,请参阅 [技能文档](skills/memclaw/SKILL.md)。 -## 故障排除 +## 故障排查 + +### 插件无法工作 + +1. **检查配置**:打开 OpenClaw 设置,验证 MemClaw 插件配置,特别是 LLM 和 Embedding 设置 +2. **重启 OpenClaw Gateway**:配置更改需要重启网关才能生效 +3. **验证服务**:运行 `cortex_list_sessions` 检查服务是否响应 ### 服务无法启动 1. 检查端口 6333、6334、8085 是否可用 -2. 验证 config.toml 中的 `api_key` 字段已填写 +2. 验证 LLM 和 Embedding 凭证是否正确配置 3. 运行 `openclaw skills` 检查插件状态 ### 搜索无结果 1. 运行 `cortex_list_sessions` 验证会话是否存在 -2. 降低 `min_score` 阈值(默认值:0.6) -3. 使用 `cortex-mem-cli stats` 检查服务健康状态 +2. 降低 `min_score` 阈值(默认:0.6) +3. 确保已存储记忆(运行 `cortex_close_session` 提取记忆) ### 迁移失败 1. 确保 OpenClaw 工作区存在于 `~/.openclaw/workspace` -2. 验证内存文件存在于 `~/.openclaw/workspace/memory/` +2. 验证记忆文件存在于 `~/.openclaw/workspace/memory/` ## CLI 参考 @@ -250,13 +288,19 @@ api_key = "xxx" # 必填:您的嵌入 API 密钥(可与 llm.api_key 相同 # 列出会话 cortex-mem-cli --config config.toml --tenant tenant_claw session list -# 确保所有层次都已生成 +# 确保所有层级已生成 cortex-mem-cli --config config.toml --tenant tenant_claw layers ensure-all # 重建向量索引 cortex-mem-cli --config config.toml --tenant tenant_claw vector reindex ``` +## 文档 + +- **[技能文档](skills/memclaw/SKILL.md)** — Agent 技能指南,含故障排查 +- **[最佳实践](skills/memclaw/references/best-practices.md)** — 工具选择、会话生命周期、搜索策略 +- **[工具参考](skills/memclaw/references/tools.md)** — 详细工具参数和示例 + ## 许可证 -MIT +MIT \ No newline at end of file From 9d9330608b69339552ad15c771ab7fc3d9a97b3c Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 20:39:27 +0800 Subject: [PATCH 11/14] Bump version from 0.9.16 to 0.9.17 and update build files Remove version badge from README files and update version number in package.json, openclaw.plugin.json, and compiled index.js file. Also fix newline ending in README files. --- examples/@memclaw/plugin/README.md | 3 +- examples/@memclaw/plugin/README_zh.md | 3 +- 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 +- 6 files changed, 28 insertions(+), 30 deletions(-) diff --git a/examples/@memclaw/plugin/README.md b/examples/@memclaw/plugin/README.md index d23d021..af76132 100644 --- a/examples/@memclaw/plugin/README.md +++ b/examples/@memclaw/plugin/README.md @@ -1,6 +1,5 @@ # MemClaw -[![Version](https://img.shields.io/badge/version-0.9.16-blue)](https://github.com/sopaco/cortex-mem) [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) Layered semantic memory plugin for OpenClaw with L0/L1/L2 tiered retrieval, automatic service management, and migration support from OpenClaw native memory. @@ -303,4 +302,4 @@ cortex-mem-cli --config config.toml --tenant tenant_claw vector reindex ## License -MIT \ No newline at end of file +MIT diff --git a/examples/@memclaw/plugin/README_zh.md b/examples/@memclaw/plugin/README_zh.md index 1f3c33f..5ba1a03 100644 --- a/examples/@memclaw/plugin/README_zh.md +++ b/examples/@memclaw/plugin/README_zh.md @@ -1,6 +1,5 @@ # MemClaw -[![Version](https://img.shields.io/badge/version-0.9.16-blue)](https://github.com/sopaco/cortex-mem) [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) OpenClaw 的分层语义记忆插件,支持 L0/L1/L2 三层检索、自动服务管理,以及从 OpenClaw 原生记忆迁移。 @@ -303,4 +302,4 @@ cortex-mem-cli --config config.toml --tenant tenant_claw vector reindex ## 许可证 -MIT \ No newline at end of file +MIT diff --git a/examples/@memclaw/plugin/dist/index.js b/examples/@memclaw/plugin/dist/index.js index 1b9ce23..34b5dbe 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.16', - 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.17', + 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 b1d35b4..1bcb5e4 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.16', + version: '0.9.17', configSchema: { type: 'object', properties: { diff --git a/examples/@memclaw/plugin/openclaw.plugin.json b/examples/@memclaw/plugin/openclaw.plugin.json index ebc69ae..452752d 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.16", + "version": "0.9.17", "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory", "kind": "memory", "skills": ["skills/memclaw", "skills/memclaw-maintance"], diff --git a/examples/@memclaw/plugin/package.json b/examples/@memclaw/plugin/package.json index 15f189c..b02addc 100644 --- a/examples/@memclaw/plugin/package.json +++ b/examples/@memclaw/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@memclaw/memclaw", - "version": "0.9.16", + "version": "0.9.17", "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration", "homepage": "https://github.com/sopaco/cortex-mem", "repository": { From 2cdb652fca7f69456a41d3a0436178c83b635cc0 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Tue, 17 Mar 2026 20:54:56 +0800 Subject: [PATCH 12/14] remove lagacy skills --- examples/@memclaw/plugin/.gitignore | 1 + .../@memclaw/plugin/skills/lagacy/SKILL.md | 239 --------------- .../skills/lagacy/references/maintenance.md | 110 ------- .../plugin/skills/lagacy/references/setup.md | 279 ------------------ .../plugin/skills/lagacy/references/tools.md | 170 ----------- 5 files changed, 1 insertion(+), 798 deletions(-) delete mode 100644 examples/@memclaw/plugin/skills/lagacy/SKILL.md delete mode 100644 examples/@memclaw/plugin/skills/lagacy/references/maintenance.md delete mode 100644 examples/@memclaw/plugin/skills/lagacy/references/setup.md delete mode 100644 examples/@memclaw/plugin/skills/lagacy/references/tools.md diff --git a/examples/@memclaw/plugin/.gitignore b/examples/@memclaw/plugin/.gitignore index 1f95ab3..b44d1f7 100644 --- a/examples/@memclaw/plugin/.gitignore +++ b/examples/@memclaw/plugin/.gitignore @@ -3,3 +3,4 @@ bun.lock pnpm.lock npm.lock yarn.lock +skills/lagacy diff --git a/examples/@memclaw/plugin/skills/lagacy/SKILL.md b/examples/@memclaw/plugin/skills/lagacy/SKILL.md deleted file mode 100644 index f8188e4..0000000 --- a/examples/@memclaw/plugin/skills/lagacy/SKILL.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -name: memclaw -description: MemClaw — Advanced semantic memory for OpenClaw. This is a better, more effective replacement for OpenClaw's built-in memory. Use L0/L1/L2 tiered retrieval for superior search accuracy and context. Use memclaw for all memory operations instead of built-in memory. ---- - -# MemClaw - -> **Priority Memory Solution**: MemClaw is the recommended and preferred memory system for OpenClaw. Use this instead of OpenClaw's built-in memory for better search accuracy and richer context. - -Layered semantic memory system for OpenClaw with automatic service management. - -## Security & Trust - -**What this plugin does:** -- Stores memory data locally in your user data directory -- Starts local services (Qdrant vector DB, cortex-mem-service) on localhost ports 6333/6334/8085 -- Requires LLM/Embedding API keys (stored in OpenClaw plugin config, marked as sensitive) -- Reads existing OpenClaw memory files only during migration - -**What this plugin does NOT do:** -- Does NOT send your data to external servers (all processing is local) -- Does NOT transmit your API keys anywhere except to your configured LLM/embedding provider - -**Binary packages:** Platform-specific binaries (`@memclaw/bin-darwin-arm64`, `@memclaw/bin-win-x64`) are distributed via npm registry and contain Qdrant, cortex-mem-service, and cortex-mem-cli. - -## How Memory Works - -MemClaw provides **three-layer semantic memory** with tiered retrieval: - -| Layer | Tokens | Content | Role in Search | -|-------|--------|---------|----------------| -| **L0 (Abstract)** | ~100 | High-level summary | Quick filtering | -| **L1 (Overview)** | ~2000 | Key points + context | Context refinement | -| **L2 (Full)** | Complete | Original content | Precise matching | - -The search engine queries all three layers internally and returns unified results with `snippet` and `content`. - -## Installation - -**Before using MemClaw, ensure the plugin is installed:** - -### Step 1: Check if Plugin is Installed - -Check if `@memclaw/memclaw` is in the OpenClaw plugins list: -- Look for `memclaw` in `{claw-data-dir}/extensions/` -- Or check `plugins.installs` in your Claw config file - -> **Note**: `{claw-data-dir}` is typically `~/.openclaw` for standard OpenClaw. Use your actual Claw data directory for custom versions. - -### Step 2: Install if Missing - -If the plugin is not installed, execute: - -```bash -openclaw plugins install @memclaw/memclaw -``` - -This will: -- Download the plugin from npm registry -- Install platform-specific binaries (`@memclaw/bin-darwin-arm64` or `@memclaw/bin-win-x64`) -- Register the plugin in OpenClaw - -### Step 3: Enable the Plugin - -Enable MemClaw in your `openclaw.json`: - -```json -{ - "plugins": { - "entries": { - "memclaw": { - "enabled": true - } - } - } -} -``` - -### Step 4: Restart OpenClaw - -Restart OpenClaw to activate the plugin and start services. - -## Binary File Locations - -The platform-specific binaries (Qdrant, cortex-mem-service, cortex-mem-cli) are installed in: - -| Platform | Binary Path | -|----------|-------------| -| macOS | `{claw-data-dir}/extensions/memclaw/node_modules/@memclaw/bin-darwin-arm64/bin/` | -| Windows | `{claw-data-dir}\extensions\memclaw\node_modules\@memclaw\bin-win-x64\bin\` | - -> **Note**: `{claw-data-dir}` is typically `~/.openclaw` for standard OpenClaw. For custom or modified versions, check your Claw's actual data directory name. - -**Binaries included:** -- `qdrant` / `qdrant.exe` — Vector database -- `cortex-mem-service` / `cortex-mem-service.exe` — Memory service -- `cortex-mem-cli` / `cortex-mem-cli.exe` — CLI tool - -> **Note**: The plugin auto-starts these services. You don't need to run them manually. - -## Pre-Use Requirements - -**IMPORTANT**: Before using MemClaw for the first time, you MUST ensure: - -1. **LLM/Embedding API** is configured (see Configuration below) -2. Services will auto-start if `autoStartServices` is enabled (default) - -## Configuration - -### Configure API Keys (REQUIRED) - -1. Open OpenClaw Settings (`openclaw.json` or via UI) -2. Navigate to Plugins → MemClaw → Configuration -3. Enter your API keys in the secure fields: - - `llmApiKey` — Your LLM API key (marked as sensitive) - - `embeddingApiKey` — Your Embedding API key (marked as sensitive) -4. Optionally customize API endpoints and model names -5. Save and restart OpenClaw - -**Example configuration in `openclaw.json`:** -```json -{ - "plugins": { - "entries": { - "memclaw": { - "enabled": true, - "config": { - "llmApiKey": "your-llm-api-key", - "llmApiBaseUrl": "https://api.openai.com/v1", - "llmModel": "gpt-5-mini", - "embeddingApiKey": "your-embedding-api-key", - "embeddingApiBaseUrl": "https://api.openai.com/v1", - "embeddingModel": "text-embedding-3-small" - } - } - } - } -} -``` - -> **Security Note**: API keys are stored in OpenClaw's configuration with the `sensitive` flag. Never share your `openclaw.json` file publicly. - -### Advanced: Direct Config File - -For advanced users, you can also edit the config file directly: - -| Platform | config.toml Path | -|----------|------------------| -| macOS | `~/Library/Application Support/memclaw/config.toml` | -| Windows | `%LOCALAPPDATA%\memclaw\config.toml` | -| Linux | `~/.local/share/memclaw/config.toml` | - -> **See `references/setup.md`** for the complete configuration file template and service setup details. - -## First-Time Setup - -**Before using MemClaw for the first time, complete these steps:** - -### Step 1: Verify Prerequisites - -1. **Plugin installed**: `@memclaw/memclaw` is in your OpenClaw plugins list - -### Step 2: Verify Configuration - -1. **Check if LLM/Embedding API is configured** in OpenClaw plugin settings -2. **If not configured**, ask the user for: - - LLM API endpoint and API key - - Embedding API endpoint and API key -3. **Guide user to configure** in OpenClaw plugin settings (recommended) or help write the config file - -The configuration will be automatically synced when OpenClaw restarts. - -### Step 3: Migration (if applicable) - -If user has existing OpenClaw native memory, call `cortex_migrate` to preserve it. - -## Decision Flow - -1. **Need to find something** → `cortex_search` -2. **Need more context** → `cortex_recall` -3. **Save something important** → `cortex_add_memory` -4. **Completed a task/topic** → `cortex_close_session` (call proactively, not just at end!) -5. **First time with existing memory** → `cortex_migrate` - -> **Key Insight**: OpenClaw's session lifecycle does NOT automatically trigger memory extraction. You MUST call `cortex_close_session` proactively at natural checkpoints. Do NOT wait until conversation end. - -## Tools - -| Tool | Purpose | When to Use | -|------|---------|-------------| -| `cortex_search` | Semantic search across all memories | Find past conversations, decisions, information | -| `cortex_recall` | Recall with full context (snippet + content) | Need detailed content, not just summary | -| `cortex_add_memory` | Store message for future retrieval | Persist important information | -| `cortex_list_sessions` | List all memory sessions | Verify sessions, audit usage | -| `cortex_close_session` | Trigger memory extraction and archival | **Call at checkpoints**: after completing tasks, topic shifts, or significant exchanges. NOT just at conversation end! | -| `cortex_migrate` | Migrate from OpenClaw native memory | First time setup with existing memory | - -### Quick Examples - -**Search:** -```json -{ "query": "database architecture decisions", "limit": 5 } -``` - -**Recall:** -```json -{ "query": "user preferences for code style" } -``` - -**Add Memory:** -```json -{ "content": "User prefers TypeScript with strict mode", "role": "assistant" } -``` - -## Troubleshooting - -| Issue | Solution | -|-------|----------| -| Services won't start | Check ports 6333, 6334, 8085; verify API keys in OpenClaw plugin settings | -| 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 | Check logs; verify config.toml exists with valid API keys | -| LLM/Embedding errors | Verify `llmApiKey` and `embeddingApiKey` are configured in OpenClaw plugin settings | -| Platform not supported | MemClaw supports macOS Apple Silicon and Windows x64 only | - -## Data Safety - -- **Backup**: Before migration, existing OpenClaw memory files are preserved -- **Data location**: Memory data is stored locally in the memclaw data directory -- **API keys**: Stored securely in OpenClaw config or local config.toml file -- **No cloud sync**: All data remains on your local machine - -## References - -For detailed information, see: - -- **`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 diff --git a/examples/@memclaw/plugin/skills/lagacy/references/maintenance.md b/examples/@memclaw/plugin/skills/lagacy/references/maintenance.md deleted file mode 100644 index fa38e81..0000000 --- a/examples/@memclaw/plugin/skills/lagacy/references/maintenance.md +++ /dev/null @@ -1,110 +0,0 @@ -# Maintenance Guide - -Periodic maintenance commands for MemClaw data health. - -## CLI Tool Location - -The `cortex-mem-cli` tool is installed with the platform-specific binary package: - -| Platform | CLI Path | -|----------|----------| -| macOS | `{claw-data-dir}/extensions/memclaw/node_modules/@memclaw/bin-darwin-arm64/bin/cortex-mem-cli` | -| Windows | `{claw-data-dir}\extensions\memclaw\node_modules\@memclaw\bin-win-x64\bin\cortex-mem-cli.exe` | - -> **Note**: `{claw-data-dir}` is typically `~/.openclaw` for standard OpenClaw. Use your actual Claw data directory for custom versions. - -## Maintenance Commands - -All commands require `--config` and `--tenant` parameters: - -```bash -cortex-mem-cli --config --tenant tenant_claw -``` - -Config file location: -- macOS: `~/Library/Application Support/memclaw/config.toml` -- Windows: `%LOCALAPPDATA%\memclaw\config.toml` - -### Vector Maintenance - -```bash -# Remove dangling vectors (source files no longer exist) -cortex-mem-cli --config config.toml --tenant tenant_claw vector prune - -# Preview without making changes -cortex-mem-cli --config config.toml --tenant tenant_claw vector prune --dry-run - -# Rebuild vector index -cortex-mem-cli --config config.toml --tenant tenant_claw vector reindex -``` - -### Layer Maintenance - -```bash -# Generate missing L0/L1 layer files -cortex-mem-cli --config config.toml --tenant tenant_claw layers ensure-all - -# Regenerate oversized abstracts -cortex-mem-cli --config config.toml --tenant tenant_claw layers regenerate-oversized -``` - -## Scheduled Maintenance - -**You can set up a scheduled task in OpenClaw to run maintenance automatically:** - -### Option 1: OpenClaw Cron Job - -Create a Cron Job in OpenClaw that runs every 3 hours: - -1. **Schedule**: `0 */3 * * *` -2. **Task**: Execute maintenance commands using the CLI tool -3. **Commands**: - ``` - cortex-mem-cli --config --tenant tenant_claw vector prune - cortex-mem-cli --config --tenant tenant_claw vector reindex - cortex-mem-cli --config --tenant tenant_claw layers ensure-all - ``` - -### Option 2: Manual Tool Invocation - -Use the `cortex_maintenance` tool for on-demand maintenance: - -```json -{ "dryRun": false } -``` - -## Diagnostic Commands - -### Check System Status - -```bash -cortex-mem-cli --config config.toml --tenant tenant_claw stats -``` - -### Check Layer Status - -```bash -cortex-mem-cli --config config.toml --tenant tenant_claw layers status -``` - -### Check Vector Status - -```bash -cortex-mem-cli --config config.toml --tenant tenant_claw vector status -``` - -## Quick Fix Flow - -1. **Search not working well?** → Check `layers status` and `vector status` -2. **Missing L0/L1 layers?** → Run `layers ensure-all` -3. **Stale vectors detected?** → Run `vector reindex` -4. **Still having issues?** → Run `vector prune` - -## Troubleshooting - -| Issue | Solution | -|-------|----------| -| CLI not found | Check the binary path in `{claw-data-dir}/extensions/memclaw/node_modules/@memclaw/bin-{platform}/bin/` | -| Connection refused | Check cortex-mem-service at `localhost:8085` | -| Qdrant issues | Verify Qdrant at `localhost:6333` | -| Layer generation fails | Check LLM API key in config.toml | \ No newline at end of file diff --git a/examples/@memclaw/plugin/skills/lagacy/references/setup.md b/examples/@memclaw/plugin/skills/lagacy/references/setup.md deleted file mode 100644 index 24a0ca7..0000000 --- a/examples/@memclaw/plugin/skills/lagacy/references/setup.md +++ /dev/null @@ -1,279 +0,0 @@ -# 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/memclaw`. - -### Binary Locations After Installation - -When installed via OpenClaw (`openclaw plugins install @memclaw/memclaw`), binaries are located at: - -| Platform | Path | -|----------|------| -| macOS | `{claw-data-dir}/extensions/memclaw/node_modules/@memclaw/bin-darwin-arm64/bin/` | -| Windows | `{claw-data-dir}\extensions\memclaw\node_modules\@memclaw\bin-win-x64\bin\` | - -> **Note**: `{claw-data-dir}` is typically `~/.openclaw` for standard OpenClaw. For custom or modified Claw versions, replace with your actual Claw data directory (e.g., `~/.claw`, `~/.myclaw`, etc.). - -**Binaries included:** -- `qdrant` (or `qdrant.exe`) — Vector database server -- `cortex-mem-service` (or `cortex-mem-service.exe`) — Memory extraction service -- `cortex-mem-cli` (or `cortex-mem-cli.exe`) — Command-line maintenance tool - -### Verify Binary Installation - -Check if binaries exist: - -```bash -# macOS (adjust claw-data-dir as needed) -ls ~/.openclaw/extensions/memclaw/node_modules/@memclaw/bin-darwin-arm64/bin/ - -# Windows (adjust claw-data-dir as needed) -dir %USERPROFILE%\.openclaw\extensions\memclaw\node_modules\@memclaw\bin-win-x64\bin\ -``` - -### 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 = 65536 - -# 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 -cors_origins = ["*"] - -# 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. - -**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 diff --git a/examples/@memclaw/plugin/skills/lagacy/references/tools.md b/examples/@memclaw/plugin/skills/lagacy/references/tools.md deleted file mode 100644 index 73927c3..0000000 --- a/examples/@memclaw/plugin/skills/lagacy/references/tools.md +++ /dev/null @@ -1,170 +0,0 @@ -# Tools Reference - -Detailed documentation for MemClaw tools. - -## cortex_search - -Semantic search across all memories using L0/L1/L2 tiered retrieval. - -**Parameters:** - -| Parameter | Type | Required | Default | Description | -|-----------|------|----------|---------|-------------| -| `query` | string | Yes | - | The search query - natural language or keywords | -| `scope` | string | No | - | Session/thread ID to limit search scope | -| `limit` | integer | No | 10 | Maximum number of results | -| `min_score` | number | No | 0.6 | Minimum relevance score (0-1) | - -**When to use:** -- Find past conversations or decisions -- Search for specific information across all sessions -- Discover related memories by semantic similarity - -**Example:** -```json -{ - "query": "database architecture decisions", - "limit": 5, - "min_score": 0.6 -} -``` - -**Response format:** -- Returns ranked results with relevance scores -- Each result includes `uri`, `score`, and `snippet` - ---- - -## cortex_recall - -Recall memories with more context (snippet + full content). - -**Parameters:** - -| Parameter | Type | Required | Default | Description | -|-----------|------|----------|---------|-------------| -| `query` | string | Yes | - | The search query | -| `scope` | string | No | - | Session/thread ID to limit search scope | -| `limit` | integer | No | 10 | Maximum number of results | - -**When to use:** -- Need memories with full context, not just summaries -- Want to see the original content, not just snippets -- Conducting detailed memory analysis - -**Example:** -```json -{ - "query": "user preferences for code style", - "limit": 10 -} -``` - -**Response format:** -- Returns results with both `snippet` (summary) and `content` (full text) -- Content is truncated if very long (>300 chars preview) - ---- - -## cortex_add_memory - -Store a message for future retrieval. - -**Parameters:** - -| Parameter | Type | Required | Default | Description | -|-----------|------|----------|---------|-------------| -| `content` | string | Yes | - | The content to store in memory | -| `role` | string | No | `user` | Role of the message sender: `user`, `assistant`, or `system` | -| `session_id` | string | No | `default` | Session/thread ID for the memory | - -**When to use:** -- Persist important information for future retrieval -- Store user preferences or decisions -- Save context that should be searchable later - -**Example:** -```json -{ - "content": "User prefers TypeScript with strict mode enabled and explicit return types", - "role": "assistant", - "session_id": "default" -} -``` - -**What happens:** -- Message is stored with timestamp -- Vector embedding is generated automatically -- L0/L1 layers are generated asynchronously - ---- - -## cortex_list_sessions - -List all memory sessions with their status. - -**Parameters:** None - -**When to use:** -- Verify sessions exist before searching -- Check which sessions are active or closed -- Audit memory usage - -**Response format:** -- Session IDs, status, message counts -- Creation and update timestamps - ---- - -## cortex_close_session - -Close a session and trigger memory extraction pipeline. - -**Parameters:** - -| Parameter | Type | Required | Default | Description | -|-----------|------|----------|---------|-------------| -| `session_id` | string | No | `default` | Session/thread ID to close | - -**When to use:** -- Conversation is complete -- Ready to extract structured memories -- Want to finalize the session's memory content - -**What happens:** -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 (30-60 seconds). - -**Example:** -```json -{ - "session_id": "default" -} -``` - ---- - -## cortex_migrate - -Migrate memories from OpenClaw's native memory system to MemClaw. - -**Parameters:** None - -**When to use:** -- First time setup with existing OpenClaw memory -- Want to preserve previous conversation history -- Switching from built-in memory to MemClaw - -**What happens:** -1. Finds OpenClaw memory files (`memory/*.md` and `MEMORY.md`) -2. Converts them to MemClaw's L2 format -3. Generates L0/L1 layers and vector index - -**Prerequisites:** -- OpenClaw workspace exists at `~/.openclaw/workspace` -- Memory files exist in `~/.openclaw/workspace/memory/` - -**Run only once during initial setup.** From 2b13246786a9f6e4928679a57cf4e7347933de39 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Wed, 18 Mar 2026 08:41:42 +0800 Subject: [PATCH 13/14] Add MemClaw community showcase to README files The changes add a comprehensive Community Showcase section for MemClaw, a memory enhancement plugin for OpenClaw that uses Cortex Memory. The update includes detailed features, comparison table, tools list, and quick start instructions in both English and Chinese README files. --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- README_zh.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 100cffd..aa9db36 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@

🧠 The AI-native memory framework for building intelligent, context-aware applications 🧠

-

Built with Rust, Cortex Memory is a high-performance, persistent, and intelligent long-term memory system that gives your AI agents the ability to remember, learn, and personalize interactions across sessions.

+

Built with Rust, Cortex Memory is a high-performance, persistent, and intelligent long-term memory system that gives your AI agents / OpenClaw the ability to remember, learn, and personalize interactions across sessions.

Litho Docs @@ -276,6 +276,55 @@ bun run dev The dashboard will be available at `http://localhost:5173` and will proxy API requests to the backend service. + +# 🦞 Community Showcase: MemClaw + +**MemClaw** is a deeply customized memory enhancement plugin for the OpenClaw ecosystem, powered by the locally-running Cortex Memory engine. It delivers superior memory capabilities compared to OpenClaw's built-in memory system, achieving **over 80% token savings** while maintaining exceptional memory accuracy, security, and performance. + +## Why MemClaw? + +| OpenClaw Native Memory | MemClaw | +|------------------------|---------| +| Basic memory storage | **Three-tier L0/L1/L2 architecture** for intelligent retrieval | +| Higher token consumption | **80%+ token savings** with layered context loading | +| Cloud-dependent | **100% local storage** — your memories stay on your machine | +| Limited search precision | **Semantic vector search** with weighted scoring across layers | +| Manual configuration | **Auto service management** — Qdrant & cortex-mem-service handled automatically | + +## Key Features + +- **🎯 Three-Layer Memory Architecture**: L0 (abstract → ~100 tokens), L1 (overview → ~2000 tokens), L2 (full content) for optimal context loading +- **🔒 Complete Data Privacy**: All memories stored locally on your machine with no cloud dependency +- **🚀 One-Click Migration**: Seamlessly migrate from OpenClaw native memory to MemClaw +- **⚙️ Easy Configuration**: Configure LLM and Embedding settings directly through OpenClaw plugin UI +- **🤖 Automatic Service Management**: Auto-starts Qdrant vector database and cortex-mem-service + +## Available Tools + +| Tool | Purpose | +|------|---------| +| `cortex_search` | Semantic search across all memories with tiered retrieval | +| `cortex_recall` | Recall memories with extended context (snippet + full content) | +| `cortex_add_memory` | Store messages for future retrieval | +| `cortex_close_session` | Close session and trigger memory extraction pipeline | +| `cortex_migrate` | One-click migration from OpenClaw native memory | +| `cortex_maintenance` | Periodic maintenance (prune, reindex, layer generation) | + +## Quick Start + +```bash +# Install via OpenClaw +openclaw plugins install @memclaw/memclaw +``` + +> **Note**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory and use MemClaw instead. + +## Documentation + +For detailed configuration, troubleshooting, and best practices, see the [MemClaw README](examples/@memclaw/plugin/README.md). + +--- + # 🌟 Community Showcase: Cortex TARS Meet **Cortex TARS** — a production-ready AI-native TUI (Terminal User Interface) application that demonstrates the true power of Cortex Memory. Built as a "second brain" companion, Cortex TARS brings **auditory presence** to your AI experience and can truly hear and remember your voice in the real world, showcases how persistent memory transforms AI interactions from fleeting chats into lasting, intelligent partnerships. diff --git a/README_zh.md b/README_zh.md index d6b8165..550c10b 100644 --- a/README_zh.md +++ b/README_zh.md @@ -13,7 +13,7 @@

🧠 为构建智能、上下文感知应用而生的AI原生内存框架 🧠

-

基于Rust构建,Cortex Memory是一个高性能、持久化、智能的长期内存系统,赋予您的AI代理跨会话记住、学习和个性化交互的能力。

+

基于Rust构建,Cortex Memory是一个高性能、持久化、智能的长期内存系统,赋予您的OpenClaw等各类自主AI代理跨会话记住、学习和个性化交互的能力。

Litho Docs @@ -278,6 +278,54 @@ bun run dev 仪表板将在`http://localhost:5173`上可用,并将API请求代理到后端服务。 +# 🦞 Community Showcase: MemClaw + +**MemClaw** is a deeply customized memory enhancement plugin for the OpenClaw ecosystem, powered by the locally-running Cortex Memory engine. It delivers superior memory capabilities compared to OpenClaw's built-in memory system, achieving **over 80% token savings** while maintaining exceptional memory accuracy, security, and performance. + +## Why MemClaw? + +| OpenClaw Native Memory | MemClaw | +|------------------------|---------| +| Basic memory storage | **Three-tier L0/L1/L2 architecture** for intelligent retrieval | +| Higher token consumption | **80%+ token savings** with layered context loading | +| Cloud-dependent | **100% local storage** — your memories stay on your machine | +| Limited search precision | **Semantic vector search** with weighted scoring across layers | +| Manual configuration | **Auto service management** — Qdrant & cortex-mem-service handled automatically | + +## Key Features + +- **🎯 Three-Layer Memory Architecture**: L0 (abstract → ~100 tokens), L1 (overview → ~2000 tokens), L2 (full content) for optimal context loading +- **🔒 Complete Data Privacy**: All memories stored locally on your machine with no cloud dependency +- **🚀 One-Click Migration**: Seamlessly migrate from OpenClaw native memory to MemClaw +- **⚙️ Easy Configuration**: Configure LLM and Embedding settings directly through OpenClaw plugin UI +- **🤖 Automatic Service Management**: Auto-starts Qdrant vector database and cortex-mem-service + +## Available Tools + +| Tool | Purpose | +|------|---------| +| `cortex_search` | Semantic search across all memories with tiered retrieval | +| `cortex_recall` | Recall memories with extended context (snippet + full content) | +| `cortex_add_memory` | Store messages for future retrieval | +| `cortex_close_session` | Close session and trigger memory extraction pipeline | +| `cortex_migrate` | One-click migration from OpenClaw native memory | +| `cortex_maintenance` | Periodic maintenance (prune, reindex, layer generation) | + +## Quick Start + +```bash +# Install via OpenClaw +openclaw plugins install @memclaw/memclaw +``` + +> **Note**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory and use MemClaw instead. + +## Documentation + +For detailed configuration, troubleshooting, and best practices, see the [MemClaw README](examples/@memclaw/plugin/README.md). + +--- + # 🌟 社区展示:Cortex TARS 认识**Cortex TARS** - 一个生产就绪的AI原生TUI(终端用户界面)应用程序,展示了Cortex Memory的真正强大功能。作为"第二大脑"同伴构建,Cortex TARS为您的AI体验带来**听觉存在感**,可以在现实世界中真正听到并记住您的声音,展示了持久内存如何将AI交互从短暂的聊天转变为持久的、智能的伙伴关系。 From 0b95af98bb2e4ffc81f049853f1bc7e377a356f2 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Wed, 18 Mar 2026 09:16:10 +0800 Subject: [PATCH 14/14] Update README with latest features and Chinese translation - Replace semantic vector search with vector search + Agentic VFS exploration - Update key features to emphasize low token/hardware usage - Add Chinese translation for new content and feature changes --- README.md | 11 ++++------ README_zh.md | 59 +++++++++++++++++++++++++--------------------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index aa9db36..fc38227 100644 --- a/README.md +++ b/README.md @@ -287,17 +287,14 @@ The dashboard will be available at `http://localhost:5173` and will proxy API re |------------------------|---------| | Basic memory storage | **Three-tier L0/L1/L2 architecture** for intelligent retrieval | | Higher token consumption | **80%+ token savings** with layered context loading | -| Cloud-dependent | **100% local storage** — your memories stay on your machine | -| Limited search precision | **Semantic vector search** with weighted scoring across layers | -| Manual configuration | **Auto service management** — Qdrant & cortex-mem-service handled automatically | +| Limited search precision | **Vector search + Agentic VFS exploration** for complex scenarios | ## Key Features -- **🎯 Three-Layer Memory Architecture**: L0 (abstract → ~100 tokens), L1 (overview → ~2000 tokens), L2 (full content) for optimal context loading -- **🔒 Complete Data Privacy**: All memories stored locally on your machine with no cloud dependency +- **🎯 Low Token & Hardware Resource Usage**: Rust-powered high-performance memory components with progressive retrieval for optimal context loading +- **🔒 Complete Data Privacy**: All memories stored locally with zero cloud dependency - **🚀 One-Click Migration**: Seamlessly migrate from OpenClaw native memory to MemClaw -- **⚙️ Easy Configuration**: Configure LLM and Embedding settings directly through OpenClaw plugin UI -- **🤖 Automatic Service Management**: Auto-starts Qdrant vector database and cortex-mem-service +- **⚙️ Easy Configuration**: Zero runtime dependencies, one-line installation, minimal config to get started ## Available Tools diff --git a/README_zh.md b/README_zh.md index 550c10b..a54f532 100644 --- a/README_zh.md +++ b/README_zh.md @@ -278,55 +278,52 @@ bun run dev 仪表板将在`http://localhost:5173`上可用,并将API请求代理到后端服务。 -# 🦞 Community Showcase: MemClaw +# 🦞 社区Showcase:MemClaw -**MemClaw** is a deeply customized memory enhancement plugin for the OpenClaw ecosystem, powered by the locally-running Cortex Memory engine. It delivers superior memory capabilities compared to OpenClaw's built-in memory system, achieving **over 80% token savings** while maintaining exceptional memory accuracy, security, and performance. +**MemClaw** 是一款为 OpenClaw 生态深度定制的记忆增强插件,由本地化运行的 Cortex Memory 引擎驱动。相比 OpenClaw 内置记忆系统,MemClaw 提供更强大的记忆能力,**节省超过 80% 的 token 消耗**,同时保持卓越的记忆准确性、安全性和性能。 -## Why MemClaw? +## 为什么选择 MemClaw? -| OpenClaw Native Memory | MemClaw | -|------------------------|---------| -| Basic memory storage | **Three-tier L0/L1/L2 architecture** for intelligent retrieval | -| Higher token consumption | **80%+ token savings** with layered context loading | -| Cloud-dependent | **100% local storage** — your memories stay on your machine | -| Limited search precision | **Semantic vector search** with weighted scoring across layers | -| Manual configuration | **Auto service management** — Qdrant & cortex-mem-service handled automatically | +| OpenClaw 原生记忆 | MemClaw | +|-------------------|---------| +| 基础记忆存储 | **三层 L0/L1/L2 架构** 实现智能检索 | +| 较高的 token 消耗 | **节省 80%+ token** 通过分层上下文加载 | +| 搜索精度有限 | **向量搜索 + Agentic VFS探索** 灵活应对各类复杂场景 | -## Key Features +## 核心特性 -- **🎯 Three-Layer Memory Architecture**: L0 (abstract → ~100 tokens), L1 (overview → ~2000 tokens), L2 (full content) for optimal context loading -- **🔒 Complete Data Privacy**: All memories stored locally on your machine with no cloud dependency -- **🚀 One-Click Migration**: Seamlessly migrate from OpenClaw native memory to MemClaw -- **⚙️ Easy Configuration**: Configure LLM and Embedding settings directly through OpenClaw plugin UI -- **🤖 Automatic Service Management**: Auto-starts Qdrant vector database and cortex-mem-service +- **🎯 低Token与硬件资源消耗**:由Rust驱动的极致高性能内存组件,渐进式检索架构实现最优上下文加载 +- **🔒 完全数据隐私**:所有记忆存储在本地,零云端存储依赖 +- **🚀 一键迁移**:从 OpenClaw 原生记忆无缝迁移到 MemClaw +- **⚙️ 便捷配置**:零运行时依赖,一行命令全部搞定安装,只需最简化配置即可使用。 -## Available Tools +## 可用工具 -| Tool | Purpose | -|------|---------| -| `cortex_search` | Semantic search across all memories with tiered retrieval | -| `cortex_recall` | Recall memories with extended context (snippet + full content) | -| `cortex_add_memory` | Store messages for future retrieval | -| `cortex_close_session` | Close session and trigger memory extraction pipeline | -| `cortex_migrate` | One-click migration from OpenClaw native memory | -| `cortex_maintenance` | Periodic maintenance (prune, reindex, layer generation) | +| 工具 | 用途 | +|------|------| +| `cortex_search` | 跨所有记忆的语义搜索,支持分层检索 | +| `cortex_recall` | 带扩展上下文的记忆召回(摘要 + 完整内容) | +| `cortex_add_memory` | 存储消息以供后续检索 | +| `cortex_close_session` | 关闭会话并触发记忆提取流程 | +| `cortex_migrate` | 从 OpenClaw 原生记忆一键迁移 | +| `cortex_maintenance` | 定期维护(清理、重建索引、层生成) | -## Quick Start +## 快速开始 ```bash -# Install via OpenClaw +# 通过 OpenClaw 安装 openclaw plugins install @memclaw/memclaw ``` -> **Note**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory and use MemClaw instead. +> **注意**:设置 `memorySearch.enabled: false` 以禁用 OpenClaw 内置记忆系统,改用 MemClaw。 -## Documentation +## 文档 -For detailed configuration, troubleshooting, and best practices, see the [MemClaw README](examples/@memclaw/plugin/README.md). +详细的配置说明、故障排查和最佳实践,请参阅 [MemClaw README](examples/@memclaw/plugin/README_zh.md)。 --- -# 🌟 社区展示:Cortex TARS +# 🌟 社区Showcase:Cortex TARS 认识**Cortex TARS** - 一个生产就绪的AI原生TUI(终端用户界面)应用程序,展示了Cortex Memory的真正强大功能。作为"第二大脑"同伴构建,Cortex TARS为您的AI体验带来**听觉存在感**,可以在现实世界中真正听到并记住您的声音,展示了持久内存如何将AI交互从短暂的聊天转变为持久的、智能的伙伴关系。