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 <noreply@anthropic.com>
This commit is contained in:
Dewaldt Huysamen 2026-02-09 22:28:29 +02:00 committed by GitHub
parent 4499254f6d
commit fb7be3eced
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -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}`);

View file

@ -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 {