From fb7be3ecedcd60f0738dccff5969b0822cab19d8 Mon Sep 17 00:00:00 2001 From: Dewaldt Huysamen Date: Mon, 9 Feb 2026 22:28:29 +0200 Subject: [PATCH] feat(openclaw): add excludeProviders config to skip recall/retain for specific providers (#332) Adds an `excludeProviders` option to the OpenClaw plugin config that allows users to specify message providers (e.g. 'telegram', 'discord') to exclude from Hindsight memory recall and retention. Closes #331 Co-authored-by: Claude Opus 4.6 --- hindsight-integrations/openclaw/src/index.ts | 13 +++++++++++++ hindsight-integrations/openclaw/src/types.ts | 1 + 2 files changed, 14 insertions(+) diff --git a/hindsight-integrations/openclaw/src/index.ts b/hindsight-integrations/openclaw/src/index.ts index a05a0730..a72d19c8 100644 --- a/hindsight-integrations/openclaw/src/index.ts +++ b/hindsight-integrations/openclaw/src/index.ts @@ -270,6 +270,7 @@ function getPluginConfig(api: MoltbotPluginAPI): PluginConfig { // Dynamic bank ID options (default: enabled) dynamicBankId: config.dynamicBankId !== false, bankIdPrefix: config.bankIdPrefix, + excludeProviders: Array.isArray(config.excludeProviders) ? config.excludeProviders : [], }; } @@ -549,6 +550,12 @@ export default function (api: MoltbotPluginAPI) { } currentAgentContext = ctx; + // Check if this provider is excluded + if (ctx?.messageProvider && pluginConfig.excludeProviders?.includes(ctx.messageProvider)) { + console.log(`[Hindsight] Skipping recall for excluded provider: ${ctx.messageProvider}`); + return; + } + // Derive bank ID from context const bankId = deriveBankId(ctx, pluginConfig); console.log(`[Hindsight] before_agent_start - bank: ${bankId}, channel: ${ctx?.messageProvider}/${ctx?.channelId}`); @@ -647,6 +654,12 @@ User message: ${prompt} // Use context from this hook, or fall back to context captured in before_agent_start const effectiveCtx = ctx || currentAgentContext; + // Check if this provider is excluded + if (effectiveCtx?.messageProvider && pluginConfig.excludeProviders?.includes(effectiveCtx.messageProvider)) { + console.log(`[Hindsight] Skipping retain for excluded provider: ${effectiveCtx.messageProvider}`); + return; + } + // Derive bank ID from context const bankId = deriveBankId(effectiveCtx, pluginConfig); console.log(`[Hindsight Hook] agent_end triggered - bank: ${bankId}`); diff --git a/hindsight-integrations/openclaw/src/types.ts b/hindsight-integrations/openclaw/src/types.ts index ed914361..d8d34b48 100644 --- a/hindsight-integrations/openclaw/src/types.ts +++ b/hindsight-integrations/openclaw/src/types.ts @@ -42,6 +42,7 @@ export interface PluginConfig { hindsightApiToken?: string; // API token for external Hindsight API authentication dynamicBankId?: boolean; // Enable per-channel memory banks (default: true) bankIdPrefix?: string; // Prefix for bank IDs (e.g. 'prod' -> 'prod-slack-C123') + excludeProviders?: string[]; // Message providers to exclude from recall/retain (e.g. ['telegram', 'discord']) } export interface ServiceConfig {