From efb0bf46db1fa6b96de317ec8288ea42b5e29fb7 Mon Sep 17 00:00:00 2001 From: ved015 Date: Fri, 5 Jun 2026 20:28:13 +0530 Subject: [PATCH] Fix OpenClaw Supermemory onboarding --- README.md | 11 +++++++++-- commands/cli.ts | 45 ++++++++++++++++++++++++++++++++++++++++++-- openclaw.plugin.json | 6 ++++++ package.json | 2 +- 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1ea38e6..13c33ac 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,11 @@ Long-term memory for OpenClaw. Automatically remembers conversations, recalls re openclaw plugins install @supermemory/openclaw-supermemory ``` -Restart OpenClaw after installing. - ## Setup ```bash openclaw supermemory setup +openclaw gateway restart ``` Enter your API key from [app.supermemory.ai](https://app.supermemory.ai/?view=integrations). That's it. @@ -26,6 +25,7 @@ Enter your API key from [app.supermemory.ai](https://app.supermemory.ai/?view=in ```bash openclaw supermemory setup-advanced +openclaw gateway restart ``` Configure all options interactively: container tag, auto-recall, auto-capture, capture mode, custom container tags, and more. @@ -100,9 +100,16 @@ Or configure in `~/.openclaw/openclaw.json`: ```json { "plugins": { + "slots": { + "memory": "openclaw-supermemory" + }, "entries": { "openclaw-supermemory": { "enabled": true, + "hooks": { + "allowPromptInjection": true, + "allowConversationAccess": true + }, "config": { "apiKey": "${SUPERMEMORY_OPENCLAW_API_KEY}", "containerTag": "my_memory", diff --git a/commands/cli.ts b/commands/cli.ts index 67e9b3e..d98db1c 100644 --- a/commands/cli.ts +++ b/commands/cli.ts @@ -6,6 +6,37 @@ import type { OpenClawPluginApi } from "openclaw/plugin-sdk" import type { SupermemoryClient } from "../client.ts" import { log } from "../logger.ts" +const SUPERMEMORY_TOOL_NAMES = [ + "supermemory_store", + "supermemory_search", + "supermemory_forget", + "supermemory_profile", +] + +function appendUniqueStrings(value: unknown, entries: string[]): string[] { + const current = Array.isArray(value) + ? value.filter((item): item is string => typeof item === "string") + : [] + return Array.from(new Set([...current, ...entries])) +} + +function ensureSupermemoryToolsAllowed(config: Record): void { + if ( + !config.tools || + typeof config.tools !== "object" || + Array.isArray(config.tools) + ) { + config.tools = {} + } + + const tools = config.tools as Record + tools.alsoAllow = appendUniqueStrings(tools.alsoAllow, SUPERMEMORY_TOOL_NAMES) + + if (Array.isArray(tools.allow)) { + tools.allow = appendUniqueStrings(tools.allow, SUPERMEMORY_TOOL_NAMES) + } +} + export function registerCli( api: OpenClawPluginApi, client?: SupermemoryClient, @@ -58,11 +89,16 @@ export function registerCli( if (!config.plugins) config.plugins = {} const plugins = config.plugins as Record if (!plugins.entries) plugins.entries = {} + if (!plugins.slots) plugins.slots = {} + ensureSupermemoryToolsAllowed(config) const entries = plugins.entries as Record + const slots = plugins.slots as Record + slots.memory = "openclaw-supermemory" entries["openclaw-supermemory"] = { enabled: true, hooks: { + allowPromptInjection: true, allowConversationAccess: true, }, config: { @@ -78,7 +114,7 @@ export function registerCli( console.log("\n✓ API key saved to ~/.openclaw/openclaw.json") console.log( - " Restart OpenClaw to apply changes: openclaw gateway --force\n", + " Restart OpenClaw to apply changes: openclaw gateway restart\n", ) }) @@ -280,7 +316,11 @@ export function registerCli( if (!config.plugins) config.plugins = {} const plugins = config.plugins as Record if (!plugins.entries) plugins.entries = {} + if (!plugins.slots) plugins.slots = {} + ensureSupermemoryToolsAllowed(config) const entries = plugins.entries as Record + const slots = plugins.slots as Record + slots.memory = "openclaw-supermemory" const pluginConfig: Record = { apiKey: apiKey.trim(), @@ -314,6 +354,7 @@ export function registerCli( entries["openclaw-supermemory"] = { enabled: true, hooks: { + allowPromptInjection: true, allowConversationAccess: true, }, config: pluginConfig, @@ -358,7 +399,7 @@ export function registerCli( ` Routing instructions: "${customContainerInstructions.trim().slice(0, 50)}${customContainerInstructions.length > 50 ? "..." : ""}"`, ) } - console.log("\nRestart OpenClaw to apply: openclaw gateway --force\n") + console.log("\nRestart OpenClaw to apply: openclaw gateway restart\n") }) cmd diff --git a/openclaw.plugin.json b/openclaw.plugin.json index 87a568b..9884def 100644 --- a/openclaw.plugin.json +++ b/openclaw.plugin.json @@ -1,6 +1,12 @@ { "id": "openclaw-supermemory", "kind": "memory", + "commandAliases": [ + { + "name": "supermemory", + "cliCommand": "supermemory" + } + ], "contracts": { "tools": [ "supermemory_search", diff --git a/package.json b/package.json index 615a715..5d20eb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@supermemory/openclaw-supermemory", - "version": "2.1.13", + "version": "2.1.14", "type": "module", "description": "OpenClaw Supermemory memory plugin", "license": "MIT",