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
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions commands/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import * as path from "node:path"
import * as readline from "node:readline"
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"
import type { SupermemoryClient } from "../client.ts"
import type { SupermemoryConfig } from "../config.ts"
import { log } from "../logger.ts"

export function registerCliSetup(api: OpenClawPluginApi): void {
export function registerCli(
api: OpenClawPluginApi,
client?: SupermemoryClient,
): void {
api.registerCli(
// biome-ignore lint/suspicious/noExplicitAny: openclaw SDK does not ship types
({ program }: { program: any }) => {
Expand Down Expand Up @@ -60,6 +62,9 @@ export function registerCliSetup(api: OpenClawPluginApi): void {

entries["openclaw-supermemory"] = {
enabled: true,
hooks: {
allowConversationAccess: true,
},
config: {
apiKey: apiKey.trim(),
},
Expand Down Expand Up @@ -289,6 +294,9 @@ export function registerCliSetup(api: OpenClawPluginApi): void {

entries["openclaw-supermemory"] = {
enabled: true,
hooks: {
allowConversationAccess: true,
},
config: pluginConfig,
}

Expand Down Expand Up @@ -418,24 +426,8 @@ export function registerCliSetup(api: OpenClawPluginApi): void {
console.log(` Container count: ${customContainers.length}`)
console.log("")
})
},
{ commands: ["supermemory"] },
)
}

export function registerCli(
api: OpenClawPluginApi,
client: SupermemoryClient,
_cfg: SupermemoryConfig,
): void {
api.registerCli(
// biome-ignore lint/suspicious/noExplicitAny: openclaw SDK does not ship types
({ program }: { program: any }) => {
const cmd = program.commands.find(
// biome-ignore lint/suspicious/noExplicitAny: openclaw SDK does not ship types
(c: any) => c.name() === "supermemory",
)
if (!cmd) return
if (!client) return

cmd
.command("search")
Expand Down Expand Up @@ -512,6 +504,14 @@ export function registerCli(
console.log(`Wiped ${result.deletedCount} memories from "${tag}".`)
})
},
{ commands: ["supermemory"] },
{
descriptors: [
{
name: "supermemory",
description: "Supermemory long-term memory commands",
hasSubcommands: true,
},
],
},
)
}
7 changes: 3 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import os from "node:os"
import path from "node:path"
import type { OpenClawPluginApi } from "openclaw/plugin-sdk"
import { SupermemoryClient } from "./client.ts"
import { registerCli, registerCliSetup } from "./commands/cli.ts"
import { registerCli } from "./commands/cli.ts"
import { registerCommands, registerStubCommands } from "./commands/slash.ts"
import { parseConfig, supermemoryConfigSchema } from "./config.ts"
import { buildCaptureHandler } from "./hooks/capture.ts"
Expand Down Expand Up @@ -37,9 +37,8 @@ export default {

initLogger(api.logger, cfg.debug)

registerCliSetup(api)

if (!cfg.apiKey) {
registerCli(api)
api.logger.info(
"supermemory: not configured - run 'openclaw supermemory setup'",
)
Expand All @@ -48,6 +47,7 @@ export default {
}

const client = new SupermemoryClient(cfg.apiKey, cfg.containerTag)
registerCli(api, client)

const memoryRuntime = buildMemoryRuntime(client)
const noopFlushPlan = () => null
Expand Down Expand Up @@ -87,7 +87,6 @@ export default {
}

registerCommands(api, client, cfg, getSessionKey)
registerCli(api, client, cfg)

api.registerService({
id: "openclaw-supermemory",
Expand Down
8 changes: 8 additions & 0 deletions openclaw.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"id": "openclaw-supermemory",
"kind": "memory",
"contracts": {
"tools": [
"supermemory_search",
"supermemory_store",
"supermemory_forget",
"supermemory_profile"
]
},
"uiHints": {
"apiKey": {
"label": "Supermemory API Key",
Expand Down
38 changes: 34 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,56 @@
{
"name": "@supermemory/openclaw-supermemory",
"version": "2.1.11",
"version": "2.1.12",
"type": "module",
"description": "OpenClaw Supermemory memory plugin",
"license": "MIT",
"dependencies": {
"supermemory": "^4.0.0",
"@sinclair/typebox": "0.34.47"
},
"files": [
"README.md",
"openclaw.plugin.json",
"index.ts",
"client.ts",
"commands",
"hooks",
"tools",
"config.ts",
"logger.ts",
"memory.ts",
"runtime.ts",
"types",
"lib/validate.d.ts",
"lib/validate.js",
"dist"
],
"scripts": {
"build": "npm run build:runtime && npm run build:lib",
"build:runtime": "esbuild index.ts --bundle --format=esm --platform=node --target=es2022 --external:openclaw --external:openclaw/* --external:supermemory --outfile=dist/index.js",
"check-types": "tsc --noEmit",
"lint": "bunx @biomejs/biome ci .",
"lint:fix": "bunx @biomejs/biome check --write .",
"build:lib": "esbuild lib/validate.ts --bundle --minify --format=esm --platform=node --target=es2022 --external:node:crypto --outfile=lib/validate.js"
"build:lib": "esbuild lib/validate.ts --bundle --minify --format=esm --platform=node --target=es2022 --external:node:crypto --outfile=lib/validate.js",
"prepack": "npm run build"
},
"peerDependencies": {
"openclaw": ">=2026.2.17"
"openclaw": ">=2026.5.7"
},
"openclaw": {
"extensions": [
"./index.ts"
]
],
"runtimeExtensions": [
"./dist/index.js"
],
"compat": {
"pluginApi": ">=2026.5.7",
"minGatewayVersion": "2026.5.7"
},
"build": {
"openclawVersion": "2026.5.7"
}
},
"repository": {
"type": "git",
Expand Down
Loading