Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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",
Expand Down
45 changes: 43 additions & 2 deletions commands/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>): void {
if (
!config.tools ||
typeof config.tools !== "object" ||
Array.isArray(config.tools)
) {
config.tools = {}
}

const tools = config.tools as Record<string, unknown>
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,
Expand Down Expand Up @@ -58,11 +89,16 @@ export function registerCli(
if (!config.plugins) config.plugins = {}
const plugins = config.plugins as Record<string, unknown>
if (!plugins.entries) plugins.entries = {}
if (!plugins.slots) plugins.slots = {}
ensureSupermemoryToolsAllowed(config)
const entries = plugins.entries as Record<string, unknown>
const slots = plugins.slots as Record<string, unknown>
slots.memory = "openclaw-supermemory"

entries["openclaw-supermemory"] = {
enabled: true,
hooks: {
allowPromptInjection: true,
allowConversationAccess: true,
},
config: {
Expand All @@ -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",
)
})

Expand Down Expand Up @@ -280,7 +316,11 @@ export function registerCli(
if (!config.plugins) config.plugins = {}
const plugins = config.plugins as Record<string, unknown>
if (!plugins.entries) plugins.entries = {}
if (!plugins.slots) plugins.slots = {}
ensureSupermemoryToolsAllowed(config)
const entries = plugins.entries as Record<string, unknown>
const slots = plugins.slots as Record<string, unknown>
slots.memory = "openclaw-supermemory"

const pluginConfig: Record<string, unknown> = {
apiKey: apiKey.trim(),
Expand Down Expand Up @@ -314,6 +354,7 @@ export function registerCli(
entries["openclaw-supermemory"] = {
enabled: true,
hooks: {
allowPromptInjection: true,
allowConversationAccess: true,
},
config: pluginConfig,
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions openclaw.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"id": "openclaw-supermemory",
"kind": "memory",
"commandAliases": [
{
"name": "supermemory",
"cliCommand": "supermemory"
}
],
"contracts": {
"tools": [
"supermemory_search",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Loading