Skip to content

Commit daee63a

Browse files
authored
Merge pull request #56 from supermemoryai/onboarding
Fix OpenClaw Supermemory onboarding
2 parents 93fe36c + efb0bf4 commit daee63a

4 files changed

Lines changed: 59 additions & 5 deletions

File tree

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ Long-term memory for OpenClaw. Automatically remembers conversations, recalls re
1212
openclaw plugins install @supermemory/openclaw-supermemory
1313
```
1414

15-
Restart OpenClaw after installing.
16-
1715
## Setup
1816

1917
```bash
2018
openclaw supermemory setup
19+
openclaw gateway restart
2120
```
2221

2322
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
2625

2726
```bash
2827
openclaw supermemory setup-advanced
28+
openclaw gateway restart
2929
```
3030

3131
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`:
100100
```json
101101
{
102102
"plugins": {
103+
"slots": {
104+
"memory": "openclaw-supermemory"
105+
},
103106
"entries": {
104107
"openclaw-supermemory": {
105108
"enabled": true,
109+
"hooks": {
110+
"allowPromptInjection": true,
111+
"allowConversationAccess": true
112+
},
106113
"config": {
107114
"apiKey": "${SUPERMEMORY_OPENCLAW_API_KEY}",
108115
"containerTag": "my_memory",

commands/cli.ts

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,37 @@ import type { OpenClawPluginApi } from "openclaw/plugin-sdk"
66
import type { SupermemoryClient } from "../client.ts"
77
import { log } from "../logger.ts"
88

9+
const SUPERMEMORY_TOOL_NAMES = [
10+
"supermemory_store",
11+
"supermemory_search",
12+
"supermemory_forget",
13+
"supermemory_profile",
14+
]
15+
16+
function appendUniqueStrings(value: unknown, entries: string[]): string[] {
17+
const current = Array.isArray(value)
18+
? value.filter((item): item is string => typeof item === "string")
19+
: []
20+
return Array.from(new Set([...current, ...entries]))
21+
}
22+
23+
function ensureSupermemoryToolsAllowed(config: Record<string, unknown>): void {
24+
if (
25+
!config.tools ||
26+
typeof config.tools !== "object" ||
27+
Array.isArray(config.tools)
28+
) {
29+
config.tools = {}
30+
}
31+
32+
const tools = config.tools as Record<string, unknown>
33+
tools.alsoAllow = appendUniqueStrings(tools.alsoAllow, SUPERMEMORY_TOOL_NAMES)
34+
35+
if (Array.isArray(tools.allow)) {
36+
tools.allow = appendUniqueStrings(tools.allow, SUPERMEMORY_TOOL_NAMES)
37+
}
38+
}
39+
940
export function registerCli(
1041
api: OpenClawPluginApi,
1142
client?: SupermemoryClient,
@@ -58,11 +89,16 @@ export function registerCli(
5889
if (!config.plugins) config.plugins = {}
5990
const plugins = config.plugins as Record<string, unknown>
6091
if (!plugins.entries) plugins.entries = {}
92+
if (!plugins.slots) plugins.slots = {}
93+
ensureSupermemoryToolsAllowed(config)
6194
const entries = plugins.entries as Record<string, unknown>
95+
const slots = plugins.slots as Record<string, unknown>
96+
slots.memory = "openclaw-supermemory"
6297

6398
entries["openclaw-supermemory"] = {
6499
enabled: true,
65100
hooks: {
101+
allowPromptInjection: true,
66102
allowConversationAccess: true,
67103
},
68104
config: {
@@ -78,7 +114,7 @@ export function registerCli(
78114

79115
console.log("\n✓ API key saved to ~/.openclaw/openclaw.json")
80116
console.log(
81-
" Restart OpenClaw to apply changes: openclaw gateway --force\n",
117+
" Restart OpenClaw to apply changes: openclaw gateway restart\n",
82118
)
83119
})
84120

@@ -280,7 +316,11 @@ export function registerCli(
280316
if (!config.plugins) config.plugins = {}
281317
const plugins = config.plugins as Record<string, unknown>
282318
if (!plugins.entries) plugins.entries = {}
319+
if (!plugins.slots) plugins.slots = {}
320+
ensureSupermemoryToolsAllowed(config)
283321
const entries = plugins.entries as Record<string, unknown>
322+
const slots = plugins.slots as Record<string, unknown>
323+
slots.memory = "openclaw-supermemory"
284324

285325
const pluginConfig: Record<string, unknown> = {
286326
apiKey: apiKey.trim(),
@@ -314,6 +354,7 @@ export function registerCli(
314354
entries["openclaw-supermemory"] = {
315355
enabled: true,
316356
hooks: {
357+
allowPromptInjection: true,
317358
allowConversationAccess: true,
318359
},
319360
config: pluginConfig,
@@ -358,7 +399,7 @@ export function registerCli(
358399
` Routing instructions: "${customContainerInstructions.trim().slice(0, 50)}${customContainerInstructions.length > 50 ? "..." : ""}"`,
359400
)
360401
}
361-
console.log("\nRestart OpenClaw to apply: openclaw gateway --force\n")
402+
console.log("\nRestart OpenClaw to apply: openclaw gateway restart\n")
362403
})
363404

364405
cmd

openclaw.plugin.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{
22
"id": "openclaw-supermemory",
33
"kind": "memory",
4+
"commandAliases": [
5+
{
6+
"name": "supermemory",
7+
"cliCommand": "supermemory"
8+
}
9+
],
410
"contracts": {
511
"tools": [
612
"supermemory_search",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@supermemory/openclaw-supermemory",
3-
"version": "2.1.13",
3+
"version": "2.1.14",
44
"type": "module",
55
"description": "OpenClaw Supermemory memory plugin",
66
"license": "MIT",

0 commit comments

Comments
 (0)