refactor: update OpenClaw plugin config, hook logic, and documentation (#4764)
This commit is contained in:
@@ -149,9 +149,6 @@ openclaw mem0 dream --dry-run
|
|||||||
| Key | Type | Default | Description |
|
| Key | Type | Default | Description |
|
||||||
| --- | ---- | ------- | ----------- |
|
| --- | ---- | ------- | ----------- |
|
||||||
| `apiKey` | `string` | — | **Required.** Mem0 API key (supports `${MEM0_API_KEY}`) |
|
| `apiKey` | `string` | — | **Required.** Mem0 API key (supports `${MEM0_API_KEY}`) |
|
||||||
| `orgId` | `string` | — | Organization ID |
|
|
||||||
| `projectId` | `string` | — | Project ID |
|
|
||||||
| `enableGraph` | `boolean` | `false` | Entity graph for relationship tracking |
|
|
||||||
| `customInstructions` | `string` | *(built-in)* | Custom extraction rules |
|
| `customInstructions` | `string` | *(built-in)* | Custom extraction rules |
|
||||||
| `customCategories` | `object` | *(12 defaults)* | Category name to description map |
|
| `customCategories` | `object` | *(12 defaults)* | Category name to description map |
|
||||||
|
|
||||||
@@ -169,7 +166,6 @@ All fields optional. Defaults: `text-embedding-3-small` embeddings, local SQLite
|
|||||||
| `oss.llm.provider` | `string` | `"openai"` | LLM provider |
|
| `oss.llm.provider` | `string` | `"openai"` | LLM provider |
|
||||||
| `oss.llm.config` | `object` | — | Provider config (`apiKey`, `model`, `baseURL`) |
|
| `oss.llm.config` | `object` | — | Provider config (`apiKey`, `model`, `baseURL`) |
|
||||||
| `oss.historyDbPath` | `string` | — | SQLite path for edit history |
|
| `oss.historyDbPath` | `string` | — | SQLite path for edit history |
|
||||||
| `oss.disableHistory` | `boolean` | `false` | Skip history DB |
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
+10
-19
@@ -367,16 +367,11 @@ function registerHooks(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const promptLower = event.prompt.toLowerCase();
|
const promptLower = event.prompt.toLowerCase();
|
||||||
const isChannelSystemEvent = /^system(?:\s*\(untrusted\))?:\s*\[/i.test(
|
|
||||||
event.prompt,
|
|
||||||
);
|
|
||||||
const isSystemPrompt =
|
const isSystemPrompt =
|
||||||
!isChannelSystemEvent &&
|
promptLower.includes("a new session was started") ||
|
||||||
(promptLower.includes("a new session was started") ||
|
promptLower.includes("session startup sequence") ||
|
||||||
promptLower.includes("session startup sequence") ||
|
promptLower.includes("/new or /reset") ||
|
||||||
promptLower.includes("/new or /reset") ||
|
promptLower.startsWith("run your session");
|
||||||
promptLower.startsWith("system:") ||
|
|
||||||
promptLower.startsWith("run your session"));
|
|
||||||
if (isSystemPrompt) {
|
if (isSystemPrompt) {
|
||||||
api.logger.info(
|
api.logger.info(
|
||||||
"openclaw-mem0: skills-mode skipping recall for system/bootstrap prompt",
|
"openclaw-mem0: skills-mode skipping recall for system/bootstrap prompt",
|
||||||
@@ -618,16 +613,11 @@ function registerHooks(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const promptLower = event.prompt.toLowerCase();
|
const promptLower = event.prompt.toLowerCase();
|
||||||
const isChannelSystemEvent = /^system(?:\s*\(untrusted\))?:\s*\[/i.test(
|
|
||||||
event.prompt,
|
|
||||||
);
|
|
||||||
const isSystemPrompt =
|
const isSystemPrompt =
|
||||||
!isChannelSystemEvent &&
|
promptLower.includes("a new session was started") ||
|
||||||
(promptLower.includes("a new session was started") ||
|
promptLower.includes("session startup sequence") ||
|
||||||
promptLower.includes("session startup sequence") ||
|
promptLower.includes("/new or /reset") ||
|
||||||
promptLower.includes("/new or /reset") ||
|
promptLower.startsWith("run your session");
|
||||||
promptLower.startsWith("system:") ||
|
|
||||||
promptLower.startsWith("run your session"));
|
|
||||||
if (isSystemPrompt) {
|
if (isSystemPrompt) {
|
||||||
api.logger.info(
|
api.logger.info(
|
||||||
"openclaw-mem0: skipping recall for system/bootstrap prompt",
|
"openclaw-mem0: skipping recall for system/bootstrap prompt",
|
||||||
@@ -806,7 +796,8 @@ function registerHooks(
|
|||||||
return false;
|
return false;
|
||||||
return msg.content.some(
|
return msg.content.some(
|
||||||
(block: any) =>
|
(block: any) =>
|
||||||
block?.type === "tool_use" && MEMORY_MUTATE_TOOLS.has(block.name),
|
(block?.type === "tool_use" || block?.type === "toolCall") &&
|
||||||
|
MEMORY_MUTATE_TOOLS.has(block.name),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (agentUsedMemoryTool) {
|
if (agentUsedMemoryTool) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "openclaw-mem0",
|
"id": "openclaw-mem0",
|
||||||
"name": "Memory (Mem0)",
|
"name": "Memory (Mem0)",
|
||||||
"description": "Mem0 memory backend for OpenClaw — platform or self-hosted open-source",
|
"description": "Mem0 memory backend for OpenClaw — platform or self-hosted open-source. Injects recalled memories into agent context (auto-recall) and extracts facts after each turn (auto-capture). Both configurable via autoRecall/autoCapture settings.",
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"kind": "memory",
|
"kind": "memory",
|
||||||
"skills": ["skills"],
|
"skills": ["skills"],
|
||||||
@@ -13,9 +13,23 @@
|
|||||||
},
|
},
|
||||||
"providerAuthEnvVars": {
|
"providerAuthEnvVars": {
|
||||||
"mem0": ["MEM0_API_KEY"],
|
"mem0": ["MEM0_API_KEY"],
|
||||||
"mem0-oss-openai": ["OPENAI_API_KEY"],
|
"openclaw-mem0-oss": ["OPENAI_API_KEY"]
|
||||||
"mem0-oss-anthropic": ["ANTHROPIC_API_KEY"]
|
|
||||||
},
|
},
|
||||||
|
"providerAuthChoices": [
|
||||||
|
{
|
||||||
|
"provider": "mem0",
|
||||||
|
"method": "api-key",
|
||||||
|
"choiceId": "mem0-api-key",
|
||||||
|
"choiceLabel": "Mem0 API key",
|
||||||
|
"choiceHint": "Required for platform mode. Get your key at https://app.mem0.ai/dashboard/api-keys",
|
||||||
|
"groupId": "mem0",
|
||||||
|
"groupLabel": "Mem0",
|
||||||
|
"optionKey": "apiKey",
|
||||||
|
"cliFlag": "--mem0-api-key",
|
||||||
|
"cliOption": "--mem0-api-key <key>",
|
||||||
|
"cliDescription": "Mem0 platform API key"
|
||||||
|
}
|
||||||
|
],
|
||||||
"uiHints": {
|
"uiHints": {
|
||||||
"mode": {
|
"mode": {
|
||||||
"label": "Mode",
|
"label": "Mode",
|
||||||
@@ -32,16 +46,6 @@
|
|||||||
"placeholder": "default",
|
"placeholder": "default",
|
||||||
"help": "User ID for scoping memories"
|
"help": "User ID for scoping memories"
|
||||||
},
|
},
|
||||||
"orgId": {
|
|
||||||
"label": "Organization ID",
|
|
||||||
"placeholder": "org-...",
|
|
||||||
"advanced": true
|
|
||||||
},
|
|
||||||
"projectId": {
|
|
||||||
"label": "Project ID",
|
|
||||||
"placeholder": "proj-...",
|
|
||||||
"advanced": true
|
|
||||||
},
|
|
||||||
"autoCapture": {
|
"autoCapture": {
|
||||||
"label": "Auto-Capture",
|
"label": "Auto-Capture",
|
||||||
"help": "Automatically store conversation context after each agent turn"
|
"help": "Automatically store conversation context after each agent turn"
|
||||||
@@ -65,10 +69,6 @@
|
|||||||
"advanced": true,
|
"advanced": true,
|
||||||
"help": "Custom prompt for open-source mode memory extraction."
|
"help": "Custom prompt for open-source mode memory extraction."
|
||||||
},
|
},
|
||||||
"enableGraph": {
|
|
||||||
"label": "Enable Graph Memory",
|
|
||||||
"help": "Enable Mem0 graph memory for entity relationships (platform mode only)"
|
|
||||||
},
|
|
||||||
"searchThreshold": {
|
"searchThreshold": {
|
||||||
"label": "Search Threshold",
|
"label": "Search Threshold",
|
||||||
"placeholder": "0.5",
|
"placeholder": "0.5",
|
||||||
@@ -110,12 +110,6 @@
|
|||||||
"userEmail": {
|
"userEmail": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"orgId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"projectId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"autoCapture": {
|
"autoCapture": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
@@ -134,9 +128,6 @@
|
|||||||
"customPrompt": {
|
"customPrompt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"enableGraph": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"searchThreshold": {
|
"searchThreshold": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
@@ -192,7 +183,6 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"enabled": { "type": "boolean" },
|
"enabled": { "type": "boolean" },
|
||||||
"importanceThreshold": { "type": "number" },
|
"importanceThreshold": { "type": "number" },
|
||||||
"enableGraph": { "type": "boolean" },
|
|
||||||
"credentialPatterns": { "type": "array", "items": { "type": "string" } }
|
"credentialPatterns": { "type": "array", "items": { "type": "string" } }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -42,8 +42,8 @@
|
|||||||
"./dist/index.js"
|
"./dist/index.js"
|
||||||
],
|
],
|
||||||
"compat": {
|
"compat": {
|
||||||
"pluginApi": ">=2026.3.28 <=2026.4.2",
|
"pluginApi": ">=2026.3.28",
|
||||||
"minGatewayVersion": "2026.3.28"
|
"minGatewayVersion": ">=2026.3.28"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"openclawVersion": "2026.4.1",
|
"openclawVersion": "2026.4.1",
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
---
|
---
|
||||||
name: memory-triage
|
name: memory-triage
|
||||||
description: >
|
description: >
|
||||||
ALWAYS USE THIS SKILL. Persistent long-term memory protocol powered by mem0.
|
Persistent long-term memory protocol powered by mem0.
|
||||||
After EVERY response, evaluate the conversation for durable facts worth storing
|
Evaluate conversations for durable facts worth storing via memory_add.
|
||||||
via memory_add. Handles identity, preferences, decisions, configurations, rules,
|
Handles identity, preferences, decisions, configurations, rules,
|
||||||
projects, and relationships. Use memory_add (NOT workspace files) for all user facts.
|
projects, and relationships. Loaded by the openclaw-mem0 plugin when skills mode is active.
|
||||||
Read this skill at the start of every session.
|
|
||||||
user-invocable: false
|
user-invocable: false
|
||||||
metadata:
|
metadata:
|
||||||
{"openclaw": {"always": true, "emoji": "🧠", "requires": {"env": ["MEM0_API_KEY"], "bins": []}}}
|
{"openclaw": {"always": false, "emoji": "🧠", "requires": {"env": ["MEM0_API_KEY"], "bins": []}}}
|
||||||
---
|
---
|
||||||
|
|
||||||
# Memory Protocol
|
# Memory Protocol
|
||||||
|
|||||||
Reference in New Issue
Block a user