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:
parent
4499254f6d
commit
fb7be3eced
2 changed files with 14 additions and 0 deletions
|
|
@ -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}`);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue