feat(memory): add per-agent auto-recall control#535
feat(memory): add per-agent auto-recall control#535itsmiso-ai wants to merge 1 commit intoCortexReach:masterfrom
Conversation
Implement per-agent auto-recall control as suggested in CortexReach#474: - Add autoRecallIncludeAgents config option (whitelist mode): when set, ONLY these agents receive auto-recall injection - autoRecallExcludeAgents was already implemented in logic but missing from the plugin schema — add it to configSchema so users can configure it - autoRecallIncludeAgents takes precedence over autoRecallExcludeAgents when both are set - Include schema definitions for both fields - Add unit tests covering parsing, filtering, and mixed-agent runtime logic - Tests: 19 passing
9079d96 to
6da96df
Compare
|
I'll analyze this and get back to you. |
Review SummaryVerdict: REQUEST-CHANGES | Value: 63% | Size: LARGE What This PR DoesAdds per-agent auto-recall control ( Must Fix
Nice to Have
Bottom LineGood feature — solves a real need. Please wire the new tests into Automated review — 6 rounds | Primary: claude | Adversarial: codex |
AliceLJY
left a comment
There was a problem hiding this comment.
Review: feat(memory): add per-agent auto-recall control
Verdict: Approve
What I checked
-
Backward compatibility — Neither
autoRecallIncludeAgentsnorautoRecallExcludeAgentsis required; when both are absent, all agents receive auto-recall as before. No breaking change. -
Schema alignment —
autoRecallExcludeAgentswas already implemented in TypeScript logic but missing fromopenclaw.plugin.jsonconfigSchema. This PR fixes that gap and adds the newautoRecallIncludeAgentsalongside it. Both schema entries use{ type: "array", items: { type: "string" }, default: [] }, consistent with the rest of the schema. -
Precedence logic — The
before_prompt_buildhook correctly implements: include list (if non-empty) takes precedence over exclude list. WhenagentIdis undefined, the filter block is skipped entirely, which is the right default (no agent context = allow recall). This is well-documented in code comments. -
Config parsing —
parsePluginConfigfilters both arrays to reject non-string and whitespace-only entries, matching the existingautoRecallExcludeAgentspattern. The empty-array-stays-as-empty-array behavior is correct and the runtime checkslength > 0before activating. -
Tests — 19 tests covering:
- Parsing edge cases (undefined, valid array, non-string filtering, whitespace, empty array, single ID)
- Runtime logic simulation via a faithful
shouldInjectMemoryhelper (whitelist mode, blacklist mode, precedence, no config, undefined agentId, empty include fallthrough) - Uses real
parsePluginConfigvia jiti, not mocks
-
CI — cli-smoke pass, version-sync pass.
Minor note (non-blocking)
The description says "Cannot be used together with autoRecallExcludeAgents" but the parser accepts both and the runtime silently picks include over exclude. This is fine for UX (no crash), but consider adding a startup warning log when both are configured, to help users catch misconfiguration. Not a blocker.
Closes #474. LGTM.

Implements per-agent auto-recall control as discussed in #474.
What was done
Problem
The memory-lancedb-pro plugin only supported a global
autoRecall: true/falsesetting. Some agents (e.g. background cron workers, memory-distiller) should not have their output contaminated by auto-injected memories. Meanwhile, some agents work better with auto-recall while others don't (e.g. agents whose local LLM backend emits reasoning content to a separate field).Solution
1.
autoRecallExcludeAgents(blacklist mode)openclaw.plugin.jsonconfigSchema so it's now configurable via plugin settings2.
autoRecallIncludeAgents(whitelist mode) (new)autoRecallExcludeAgentswhen both are setBehavior
autoRecallIncludeAgents: ["saffron", "maple"]autoRecallExcludeAgents: ["cron-worker"]autoRecallIncludeAgentswins (whitelist takes precedence)Files changed
index.ts— interface,before_prompt_buildlogic, config parsingopenclaw.plugin.json— addedautoRecallExcludeAgentsandautoRecallIncludeAgentsto configSchematest/per-agent-auto-recall.test.mjs— 19 unit tests covering parsing and runtime logicTests
All 19 tests pass.
Closes #474