From baa37eba07905b2594f4b1106cbe9168fe95bdb7 Mon Sep 17 00:00:00 2001 From: Alex Newman Date: Sat, 7 Feb 2026 18:37:49 -0500 Subject: [PATCH] MAESTRO: Add OpenClaw plugin entry point with service and command registration Creates openclaw/src/index.ts with: - Inline OpenClawPluginApi interface definition - registerService for claude-mem-observation-feed (stub start/stop for Phase 2) - registerCommand for /claude-mem-feed status command - Plugin initialization logging Co-Authored-By: Claude Opus 4.6 --- openclaw/src/index.ts | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 openclaw/src/index.ts diff --git a/openclaw/src/index.ts b/openclaw/src/index.ts new file mode 100644 index 00000000..544fdad3 --- /dev/null +++ b/openclaw/src/index.ts @@ -0,0 +1,52 @@ +interface OpenClawPluginApi { + getConfig: () => Record; + log: (message: string) => void; + registerService: (service: { + id: string; + start: (ctx: any) => Promise; + stop: (ctx: any) => Promise; + }) => void; + registerCommand: (command: { + name: string; + description: string; + handler: (args: string[], ctx: any) => Promise; + }) => void; + runtime: { + channel: Record Promise>>; + }; +} + +export default function claudeMemPlugin(api: OpenClawPluginApi): void { + api.registerService({ + id: "claude-mem-observation-feed", + start: async (ctx) => { + const config = api.getConfig(); + const feedConfig = config.observationFeed as any; + if (!feedConfig?.enabled) { + api.log("[claude-mem] Observation feed disabled"); + return; + } + api.log(`[claude-mem] Observation feed starting — channel: ${feedConfig.channel}, target: ${feedConfig.to}`); + // SSE connection logic added in Phase 2 + }, + stop: async (ctx) => { + api.log("[claude-mem] Observation feed stopping"); + // SSE disconnect logic added in Phase 2 + } + }); + + api.registerCommand({ + name: "claude-mem-feed", + description: "Show or toggle Claude-Mem observation feed status", + handler: async (args, ctx) => { + const config = api.getConfig(); + const feedConfig = config.observationFeed as any; + if (!feedConfig) { + return "Observation feed not configured. Add observationFeed to your plugin config."; + } + return `Claude-Mem Observation Feed\nEnabled: ${feedConfig.enabled ? "yes" : "no"}\nChannel: ${feedConfig.channel || "not set"}\nTarget: ${feedConfig.to || "not set"}`; + } + }); + + api.log("[claude-mem] OpenClaw plugin loaded — v1.0.0"); +}