feat(plugins): add memory slot plugin
This commit is contained in:
37
extensions/memory-core/index.ts
Normal file
37
extensions/memory-core/index.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import type { ClawdbotPluginApi } from "../../src/plugins/types.js";
|
||||
|
||||
import { createMemoryGetTool, createMemorySearchTool } from "../../src/agents/tools/memory-tool.js";
|
||||
import { registerMemoryCli } from "../../src/cli/memory-cli.js";
|
||||
|
||||
const memoryCorePlugin = {
|
||||
id: "memory-core",
|
||||
name: "Memory (Core)",
|
||||
description: "File-backed memory search tools and CLI",
|
||||
kind: "memory",
|
||||
register(api: ClawdbotPluginApi) {
|
||||
api.registerTool(
|
||||
(ctx) => {
|
||||
const memorySearchTool = createMemorySearchTool({
|
||||
config: ctx.config,
|
||||
agentSessionKey: ctx.sessionKey,
|
||||
});
|
||||
const memoryGetTool = createMemoryGetTool({
|
||||
config: ctx.config,
|
||||
agentSessionKey: ctx.sessionKey,
|
||||
});
|
||||
if (!memorySearchTool || !memoryGetTool) return null;
|
||||
return [memorySearchTool, memoryGetTool];
|
||||
},
|
||||
{ names: ["memory_search", "memory_get"] },
|
||||
);
|
||||
|
||||
api.registerCli(
|
||||
({ program }) => {
|
||||
registerMemoryCli(program);
|
||||
},
|
||||
{ commands: ["memory"] },
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export default memoryCorePlugin;
|
||||
Reference in New Issue
Block a user