refactor: update OpenClaw plugin config, hook logic, and documentation (#4764)

This commit is contained in:
Kartik
2026-04-09 17:36:05 +05:30
committed by GitHub
parent 88f696a60a
commit 78ca85a260
5 changed files with 34 additions and 58 deletions
-4
View File
@@ -149,9 +149,6 @@ openclaw mem0 dream --dry-run
| Key | Type | Default | Description |
| --- | ---- | ------- | ----------- |
| `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 |
| `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.config` | `object` | — | Provider config (`apiKey`, `model`, `baseURL`) |
| `oss.historyDbPath` | `string` | — | SQLite path for edit history |
| `oss.disableHistory` | `boolean` | `false` | Skip history DB |
## License
+10 -19
View File
@@ -367,16 +367,11 @@ function registerHooks(
}
const promptLower = event.prompt.toLowerCase();
const isChannelSystemEvent = /^system(?:\s*\(untrusted\))?:\s*\[/i.test(
event.prompt,
);
const isSystemPrompt =
!isChannelSystemEvent &&
(promptLower.includes("a new session was started") ||
promptLower.includes("session startup sequence") ||
promptLower.includes("/new or /reset") ||
promptLower.startsWith("system:") ||
promptLower.startsWith("run your session"));
promptLower.includes("a new session was started") ||
promptLower.includes("session startup sequence") ||
promptLower.includes("/new or /reset") ||
promptLower.startsWith("run your session");
if (isSystemPrompt) {
api.logger.info(
"openclaw-mem0: skills-mode skipping recall for system/bootstrap prompt",
@@ -618,16 +613,11 @@ function registerHooks(
}
const promptLower = event.prompt.toLowerCase();
const isChannelSystemEvent = /^system(?:\s*\(untrusted\))?:\s*\[/i.test(
event.prompt,
);
const isSystemPrompt =
!isChannelSystemEvent &&
(promptLower.includes("a new session was started") ||
promptLower.includes("session startup sequence") ||
promptLower.includes("/new or /reset") ||
promptLower.startsWith("system:") ||
promptLower.startsWith("run your session"));
promptLower.includes("a new session was started") ||
promptLower.includes("session startup sequence") ||
promptLower.includes("/new or /reset") ||
promptLower.startsWith("run your session");
if (isSystemPrompt) {
api.logger.info(
"openclaw-mem0: skipping recall for system/bootstrap prompt",
@@ -806,7 +796,8 @@ function registerHooks(
return false;
return msg.content.some(
(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) {
+17 -27
View File
@@ -1,7 +1,7 @@
{
"id": "openclaw-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",
"kind": "memory",
"skills": ["skills"],
@@ -13,9 +13,23 @@
},
"providerAuthEnvVars": {
"mem0": ["MEM0_API_KEY"],
"mem0-oss-openai": ["OPENAI_API_KEY"],
"mem0-oss-anthropic": ["ANTHROPIC_API_KEY"]
"openclaw-mem0-oss": ["OPENAI_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": {
"mode": {
"label": "Mode",
@@ -32,16 +46,6 @@
"placeholder": "default",
"help": "User ID for scoping memories"
},
"orgId": {
"label": "Organization ID",
"placeholder": "org-...",
"advanced": true
},
"projectId": {
"label": "Project ID",
"placeholder": "proj-...",
"advanced": true
},
"autoCapture": {
"label": "Auto-Capture",
"help": "Automatically store conversation context after each agent turn"
@@ -65,10 +69,6 @@
"advanced": true,
"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": {
"label": "Search Threshold",
"placeholder": "0.5",
@@ -110,12 +110,6 @@
"userEmail": {
"type": "string"
},
"orgId": {
"type": "string"
},
"projectId": {
"type": "string"
},
"autoCapture": {
"type": "boolean"
},
@@ -134,9 +128,6 @@
"customPrompt": {
"type": "string"
},
"enableGraph": {
"type": "boolean"
},
"searchThreshold": {
"type": "number"
},
@@ -192,7 +183,6 @@
"properties": {
"enabled": { "type": "boolean" },
"importanceThreshold": { "type": "number" },
"enableGraph": { "type": "boolean" },
"credentialPatterns": { "type": "array", "items": { "type": "string" } }
}
},
+2 -2
View File
@@ -42,8 +42,8 @@
"./dist/index.js"
],
"compat": {
"pluginApi": ">=2026.3.28 <=2026.4.2",
"minGatewayVersion": "2026.3.28"
"pluginApi": ">=2026.3.28",
"minGatewayVersion": ">=2026.3.28"
},
"build": {
"openclawVersion": "2026.4.1",
+5 -6
View File
@@ -1,14 +1,13 @@
---
name: memory-triage
description: >
ALWAYS USE THIS SKILL. Persistent long-term memory protocol powered by mem0.
After EVERY response, evaluate the conversation for durable facts worth storing
via memory_add. Handles identity, preferences, decisions, configurations, rules,
projects, and relationships. Use memory_add (NOT workspace files) for all user facts.
Read this skill at the start of every session.
Persistent long-term memory protocol powered by mem0.
Evaluate conversations for durable facts worth storing via memory_add.
Handles identity, preferences, decisions, configurations, rules,
projects, and relationships. Loaded by the openclaw-mem0 plugin when skills mode is active.
user-invocable: false
metadata:
{"openclaw": {"always": true, "emoji": "🧠", "requires": {"env": ["MEM0_API_KEY"], "bins": []}}}
{"openclaw": {"always": false, "emoji": "🧠", "requires": {"env": ["MEM0_API_KEY"], "bins": []}}}
---
# Memory Protocol