From f648aae44010b2fad1f75149881dae38c095816c Mon Sep 17 00:00:00 2001 From: Glucksberg Date: Fri, 23 Jan 2026 12:43:39 +0000 Subject: [PATCH] fix: clear plugin commands on reload to prevent duplicates Add clearPluginCommands() call in loadClawdbotPlugins() to ensure previously registered commands are cleaned up before reloading plugins. This prevents command conflicts during hot-reload scenarios. Co-Authored-By: Claude Opus 4.5 --- src/plugins/loader.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/loader.ts b/src/plugins/loader.ts index 14ba1740a..931c15d59 100644 --- a/src/plugins/loader.ts +++ b/src/plugins/loader.ts @@ -16,6 +16,7 @@ import { type NormalizedPluginsConfig, } from "./config-state.js"; import { initializeGlobalHookRunner } from "./hook-runner-global.js"; +import { clearPluginCommands } from "./commands.js"; import { createPluginRegistry, type PluginRecord, type PluginRegistry } from "./registry.js"; import { createPluginRuntime } from "./runtime/index.js"; import { setActivePluginRegistry } from "./runtime.js"; @@ -178,6 +179,9 @@ export function loadClawdbotPlugins(options: PluginLoadOptions = {}): PluginRegi } } + // Clear previously registered plugin commands before reloading + clearPluginCommands(); + const runtime = createPluginRuntime(); const { registry, createApi } = createPluginRegistry({ logger,