Skip to content

Commit 783db51

Browse files
committed
feat: add autoRecallExcludeAgents config + recallMode + idempotent guard + openclaw.plugin.json schema
1 parent 65d9cbe commit 783db51

5 files changed

Lines changed: 454 additions & 19 deletions

File tree

index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ interface PluginConfig {
100100
autoRecallMaxItems?: number;
101101
autoRecallMaxChars?: number;
102102
autoRecallPerItemMaxChars?: number;
103+
autoRecallExcludeAgents?: string[];
103104
recallMode?: "full" | "summary" | "adaptive" | "off";
104105
captureAssistant?: boolean;
105106
retrieval?: {
@@ -1586,6 +1587,9 @@ const memoryLanceDBProPlugin = {
15861587
"Enhanced LanceDB-backed long-term memory with hybrid retrieval, multi-scope isolation, and management CLI",
15871588
kind: "memory" as const,
15881589

1590+
// PR #365: Reset idempotent guard for testing
1591+
_resetInitialized() { _initialized = false; },
1592+
15891593
register(api: OpenClawPluginApi) {
15901594

15911595
// Idempotent guard: skip re-init on repeated register() calls
@@ -2253,6 +2257,12 @@ const memoryLanceDBProPlugin = {
22532257
const agentId = resolveHookAgentId(ctx?.agentId, (event as any).sessionKey);
22542258
const accessibleScopes = resolveScopeFilter(scopeManager, agentId);
22552259

2260+
// PR #365: autoRecallExcludeAgents
2261+
if (config.autoRecallExcludeAgents?.includes(agentId)) {
2262+
api.logger.info(`memory-lancedb-pro: auto-recall skipped for excluded agent=${agentId}`);
2263+
return undefined;
2264+
}
2265+
22562266
// FR-04: Truncate long prompts (e.g. file attachments) before embedding.
22572267
// Auto-recall only needs the user's intent, not full attachment text.
22582268
const MAX_RECALL_QUERY_LENGTH = 1_000;
@@ -3778,6 +3788,8 @@ export function parsePluginConfig(value: unknown): PluginConfig {
37783788
autoRecallMaxItems: parsePositiveInt(cfg.autoRecallMaxItems) ?? 3,
37793789
autoRecallMaxChars: parsePositiveInt(cfg.autoRecallMaxChars) ?? 600,
37803790
autoRecallPerItemMaxChars: parsePositiveInt(cfg.autoRecallPerItemMaxChars) ?? 180,
3791+
autoRecallExcludeAgents: Array.isArray(cfg.autoRecallExcludeAgents) ? cfg.autoRecallExcludeAgents : undefined,
3792+
recallMode: (cfg.recallMode === "full" || cfg.recallMode === "summary" || cfg.recallMode === "adaptive" || cfg.recallMode === "off") ? cfg.recallMode : "full",
37813793
captureAssistant: cfg.captureAssistant === true,
37823794
retrieval: typeof cfg.retrieval === "object" && cfg.retrieval !== null ? cfg.retrieval as any : undefined,
37833795
decay: typeof cfg.decay === "object" && cfg.decay !== null ? cfg.decay as any : undefined,

openclaw.plugin.json

Lines changed: 88 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,22 @@
137137
"default": 180,
138138
"description": "Maximum character budget per auto-injected memory summary."
139139
},
140+
"autoRecallExcludeAgents": {
141+
"type": "array",
142+
"items": {
143+
"type": "string"
144+
},
145+
"default": [],
146+
"description": "List of agent IDs that should be excluded from auto-recall memory injection."
147+
},
140148
"recallMode": {
141149
"type": "string",
142-
"enum": ["full", "summary", "adaptive", "off"],
150+
"enum": [
151+
"full",
152+
"summary",
153+
"adaptive",
154+
"off"
155+
],
143156
"default": "full",
144157
"description": "Auto-recall depth mode. 'full': inject with configured per-item budget. 'summary': L0 abstracts only (compact). 'adaptive': analyze query intent to auto-select category and depth. 'off': disable auto-recall injection."
145158
},
@@ -238,23 +251,78 @@
238251
"type": "object",
239252
"additionalProperties": false,
240253
"properties": {
241-
"utility": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 },
242-
"confidence": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 },
243-
"novelty": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 },
244-
"recency": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.1 },
245-
"typePrior": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.6 }
254+
"utility": {
255+
"type": "number",
256+
"minimum": 0,
257+
"maximum": 1,
258+
"default": 0.1
259+
},
260+
"confidence": {
261+
"type": "number",
262+
"minimum": 0,
263+
"maximum": 1,
264+
"default": 0.1
265+
},
266+
"novelty": {
267+
"type": "number",
268+
"minimum": 0,
269+
"maximum": 1,
270+
"default": 0.1
271+
},
272+
"recency": {
273+
"type": "number",
274+
"minimum": 0,
275+
"maximum": 1,
276+
"default": 0.1
277+
},
278+
"typePrior": {
279+
"type": "number",
280+
"minimum": 0,
281+
"maximum": 1,
282+
"default": 0.6
283+
}
246284
}
247285
},
248286
"typePriors": {
249287
"type": "object",
250288
"additionalProperties": false,
251289
"properties": {
252-
"profile": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.95 },
253-
"preferences": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.9 },
254-
"entities": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.75 },
255-
"events": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.45 },
256-
"cases": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.8 },
257-
"patterns": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.85 }
290+
"profile": {
291+
"type": "number",
292+
"minimum": 0,
293+
"maximum": 1,
294+
"default": 0.95
295+
},
296+
"preferences": {
297+
"type": "number",
298+
"minimum": 0,
299+
"maximum": 1,
300+
"default": 0.9
301+
},
302+
"entities": {
303+
"type": "number",
304+
"minimum": 0,
305+
"maximum": 1,
306+
"default": 0.75
307+
},
308+
"events": {
309+
"type": "number",
310+
"minimum": 0,
311+
"maximum": 1,
312+
"default": 0.45
313+
},
314+
"cases": {
315+
"type": "number",
316+
"minimum": 0,
317+
"maximum": 1,
318+
"default": 0.8
319+
},
320+
"patterns": {
321+
"type": "number",
322+
"minimum": 0,
323+
"maximum": 1,
324+
"default": 0.85
325+
}
258326
}
259327
}
260328
}
@@ -1014,8 +1082,8 @@
10141082
},
10151083
"recallMode": {
10161084
"label": "Recall Mode",
1017-
"help": "Auto-recall depth: full (default), summary (L0 only), adaptive (intent-based category routing), off.",
1018-
"advanced": false
1085+
"help": "full = full text injection; summary = count hint only; adaptive = intent-driven; off = disabled.",
1086+
"advanced": true
10191087
},
10201088
"captureAssistant": {
10211089
"label": "Capture Assistant Messages",
@@ -1335,6 +1403,11 @@
13351403
"label": "Max Extractions Per Hour",
13361404
"help": "Rate limit for auto-capture extractions. Prevents excessive LLM calls during rapid-fire sessions.",
13371405
"advanced": true
1406+
},
1407+
"autoRecallExcludeAgents": {
1408+
"label": "Auto-Recall Exclude Agents",
1409+
"help": "Agent IDs to exclude from auto-recall memory injection. Background/cron agents should be listed here.",
1410+
"advanced": true
13381411
}
13391412
}
1340-
}
1413+
}

package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"devDependencies": {
4646
"commander": "^14.0.0",
47-
"jiti": "^2.6.0",
47+
"jiti": "^2.6.1",
4848
"typescript": "^5.9.3"
4949
}
5050
}

0 commit comments

Comments
 (0)