2026-01-30 03:15:10 +01:00
|
|
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
|
|
|
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
|
2026-01-18 02:12:01 +00:00
|
|
|
|
|
|
|
|
const memoryCorePlugin = {
|
|
|
|
|
id: "memory-core",
|
|
|
|
|
name: "Memory (Core)",
|
|
|
|
|
description: "File-backed memory search tools and CLI",
|
|
|
|
|
kind: "memory",
|
2026-01-19 03:38:51 +00:00
|
|
|
configSchema: emptyPluginConfigSchema(),
|
2026-01-30 03:15:10 +01:00
|
|
|
register(api: OpenClawPluginApi) {
|
2026-01-18 02:12:01 +00:00
|
|
|
api.registerTool(
|
|
|
|
|
(ctx) => {
|
2026-01-18 11:00:19 +00:00
|
|
|
const memorySearchTool = api.runtime.tools.createMemorySearchTool({
|
2026-01-18 02:12:01 +00:00
|
|
|
config: ctx.config,
|
|
|
|
|
agentSessionKey: ctx.sessionKey,
|
|
|
|
|
});
|
2026-01-18 11:00:19 +00:00
|
|
|
const memoryGetTool = api.runtime.tools.createMemoryGetTool({
|
2026-01-18 02:12:01 +00:00
|
|
|
config: ctx.config,
|
|
|
|
|
agentSessionKey: ctx.sessionKey,
|
|
|
|
|
});
|
2026-01-31 22:13:48 +09:00
|
|
|
if (!memorySearchTool || !memoryGetTool) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2026-01-18 02:12:01 +00:00
|
|
|
return [memorySearchTool, memoryGetTool];
|
|
|
|
|
},
|
|
|
|
|
{ names: ["memory_search", "memory_get"] },
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
api.registerCli(
|
|
|
|
|
({ program }) => {
|
2026-01-18 11:00:19 +00:00
|
|
|
api.runtime.tools.registerMemoryCli(program);
|
2026-01-18 02:12:01 +00:00
|
|
|
},
|
|
|
|
|
{ commands: ["memory"] },
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default memoryCorePlugin;
|