Skip to content
Closed
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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ Everything runs in the cloud. Supermemory handles extraction, deduplication, and

## Slash Commands

| Command | Description |
| ------------------ | --------------------------------------- |
| `/remember <text>` | Manually save something to memory. |
| `/recall <query>` | Search memories with similarity scores. |
| Command | Description |
| --------------------- | --------------------------------------- |
| `/remember <text>` | Manually save something to memory. |
| `/recall <query>` | Search memories with similarity scores. |
| `/supermemory-status` | Show Supermemory configuration status. |

## AI Tools

Expand Down
65 changes: 64 additions & 1 deletion commands/slash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,60 @@ import type { SupermemoryConfig } from "../config.ts"
import { log } from "../logger.ts"
import { buildDocumentId, detectCategory } from "../memory.ts"

export function registerStubCommands(api: OpenClawPluginApi): void {
function maskApiKey(apiKey: string | undefined): string {
if (!apiKey) return "not configured"
if (apiKey.length <= 12) return "configured"
return `${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`
}

function formatSupermemoryStatus(
cfg: SupermemoryConfig,
authenticated: boolean,
): string {
const apiKeySource =
cfg.apiKey && process.env.SUPERMEMORY_OPENCLAW_API_KEY === cfg.apiKey
? "environment"
: "plugin config"
const customContainerState = cfg.enableCustomContainerTags
? "enabled"
: "disabled"
const lines = [
"Supermemory Status",
"",
`Authenticated: ${authenticated ? "yes" : "no"}`,
`API key: ${maskApiKey(cfg.apiKey)}${cfg.apiKey ? ` (${apiKeySource})` : ""}`,
`Container tag: ${cfg.containerTag}`,
`Auto-recall: ${cfg.autoRecall}`,
`Auto-capture: ${cfg.autoCapture}`,
`Max recall results: ${cfg.maxRecallResults}`,
`Profile frequency: ${cfg.profileFrequency}`,
`Capture mode: ${cfg.captureMode}`,
`Memory usage display: ${cfg.showMemoryUsage}`,
`Custom container tags: ${customContainerState}`,
`Custom container count: ${cfg.customContainers.length}`,
]

if (!authenticated) {
lines.push("", "Run `openclaw supermemory setup` to connect Supermemory.")
}

return lines.join("\n")
}

export function registerStubCommands(
api: OpenClawPluginApi,
cfg: SupermemoryConfig,
): void {
api.registerCommand({
name: "supermemory-status",
description: "Show Supermemory configuration status",
acceptsArgs: false,
requireAuth: false,
handler: async () => {
return { text: formatSupermemoryStatus(cfg, false) }
},
})

api.registerCommand({
name: "remember",
description: "Save something to memory",
Expand Down Expand Up @@ -70,6 +123,16 @@ export function registerCommands(
},
})

api.registerCommand({
name: "supermemory-status",
description: "Show Supermemory configuration status",
acceptsArgs: false,
requireAuth: false,
handler: async () => {
return { text: formatSupermemoryStatus(cfg, true) }
},
})

api.registerCommand({
name: "remember",
description: "Save something to memory",
Expand Down
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
api.logger.info(
"supermemory: not configured - run 'openclaw supermemory setup'",
)
registerStubCommands(api)
registerStubCommands(api, cfg)
return
}

Expand Down
Loading