diff --git a/index.ts b/index.ts index 52f1962..ca4a154 100644 --- a/index.ts +++ b/index.ts @@ -108,6 +108,8 @@ interface PluginConfig { autoRecallPerItemMaxChars?: number; /** Hard per-turn injection cap (safety valve). Overrides autoRecallMaxItems if lower. Default: 10. */ maxRecallPerTurn?: number; + /** Maximum character length of the auto-recall query before truncation. Default: 2000. */ + autoRecallMaxQueryLength?: number; recallMode?: "full" | "summary" | "adaptive" | "off"; captureAssistant?: boolean; retrieval?: { @@ -2278,7 +2280,7 @@ const memoryLanceDBProPlugin = { // FR-04: Truncate long prompts (e.g. file attachments) before embedding. // Auto-recall only needs the user's intent, not full attachment text. - const MAX_RECALL_QUERY_LENGTH = 1_000; + const MAX_RECALL_QUERY_LENGTH = config.autoRecallMaxQueryLength ?? 2_000; let recallQuery = event.prompt; if (recallQuery.length > MAX_RECALL_QUERY_LENGTH) { const originalLength = recallQuery.length; @@ -2305,8 +2307,6 @@ const memoryLanceDBProPlugin = { } const results = filterUserMdExclusiveRecallResults(await retrieveWithRetry({ - query: recallQuery, - limit: retrieveLimit, scopeFilter: accessibleScopes, source: "auto-recall", }), config.workspaceBoundary); @@ -3818,6 +3818,7 @@ export function parsePluginConfig(value: unknown): PluginConfig { autoRecallMaxChars: parsePositiveInt(cfg.autoRecallMaxChars) ?? 600, autoRecallPerItemMaxChars: parsePositiveInt(cfg.autoRecallPerItemMaxChars) ?? 180, maxRecallPerTurn: parsePositiveInt(cfg.maxRecallPerTurn) ?? 10, + autoRecallMaxQueryLength: parsePositiveInt(cfg.autoRecallMaxQueryLength) ?? 2_000, captureAssistant: cfg.captureAssistant === true, retrieval: typeof cfg.retrieval === "object" && cfg.retrieval !== null ? cfg.retrieval as any : undefined, decay: typeof cfg.decay === "object" && cfg.decay !== null ? cfg.decay as any : undefined, diff --git a/openclaw.plugin.json b/openclaw.plugin.json index a2cfb1f..8e3fdc6 100644 --- a/openclaw.plugin.json +++ b/openclaw.plugin.json @@ -137,6 +137,13 @@ "default": 180, "description": "Maximum character budget per auto-injected memory summary." }, + "autoRecallMaxQueryLength": { + "type": "integer", + "minimum": 100, + "maximum": 10000, + "default": 2000, + "description": "Maximum character length of the auto-recall query before truncation. Default: 2000." + }, "maxRecallPerTurn": { "type": "integer", "minimum": 1, @@ -1019,6 +1026,11 @@ "help": "Maximum characters per injected memory summary.", "advanced": true }, + "autoRecallMaxQueryLength": { + "label": "Auto-Recall Max Query Length", + "help": "Maximum character length of the auto-recall query before truncation. Default: 2000.", + "advanced": true + }, "recallMode": { "label": "Recall Mode", "help": "Auto-recall depth: full (default), summary (L0 only), adaptive (intent-based category routing), off.",