Skip to content

Commit fb7be3e

Browse files
GodsBoyclaude
andauthored
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>
1 parent 4499254 commit fb7be3e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

hindsight-integrations/openclaw/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ function getPluginConfig(api: MoltbotPluginAPI): PluginConfig {
270270
// Dynamic bank ID options (default: enabled)
271271
dynamicBankId: config.dynamicBankId !== false,
272272
bankIdPrefix: config.bankIdPrefix,
273+
excludeProviders: Array.isArray(config.excludeProviders) ? config.excludeProviders : [],
273274
};
274275
}
275276

@@ -549,6 +550,12 @@ export default function (api: MoltbotPluginAPI) {
549550
}
550551
currentAgentContext = ctx;
551552

553+
// Check if this provider is excluded
554+
if (ctx?.messageProvider && pluginConfig.excludeProviders?.includes(ctx.messageProvider)) {
555+
console.log(`[Hindsight] Skipping recall for excluded provider: ${ctx.messageProvider}`);
556+
return;
557+
}
558+
552559
// Derive bank ID from context
553560
const bankId = deriveBankId(ctx, pluginConfig);
554561
console.log(`[Hindsight] before_agent_start - bank: ${bankId}, channel: ${ctx?.messageProvider}/${ctx?.channelId}`);
@@ -647,6 +654,12 @@ User message: ${prompt}
647654
// Use context from this hook, or fall back to context captured in before_agent_start
648655
const effectiveCtx = ctx || currentAgentContext;
649656

657+
// Check if this provider is excluded
658+
if (effectiveCtx?.messageProvider && pluginConfig.excludeProviders?.includes(effectiveCtx.messageProvider)) {
659+
console.log(`[Hindsight] Skipping retain for excluded provider: ${effectiveCtx.messageProvider}`);
660+
return;
661+
}
662+
650663
// Derive bank ID from context
651664
const bankId = deriveBankId(effectiveCtx, pluginConfig);
652665
console.log(`[Hindsight Hook] agent_end triggered - bank: ${bankId}`);

hindsight-integrations/openclaw/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface PluginConfig {
4242
hindsightApiToken?: string; // API token for external Hindsight API authentication
4343
dynamicBankId?: boolean; // Enable per-channel memory banks (default: true)
4444
bankIdPrefix?: string; // Prefix for bank IDs (e.g. 'prod' -> 'prod-slack-C123')
45+
excludeProviders?: string[]; // Message providers to exclude from recall/retain (e.g. ['telegram', 'discord'])
4546
}
4647

4748
export interface ServiceConfig {

0 commit comments

Comments
 (0)