Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(plugin): sanitize prompt fallback in before_prompt_build to prevent query pollution (#1472)

AutoCoderedad6ea65952
diff --git a/examples/openclaw-plugin/index.ts b/examples/openclaw-plugin/index.ts
index bc8435eba..2fca3a0ca 100644
--- a/examples/openclaw-plugin/index.ts
+++ b/examples/openclaw-plugin/index.ts
@@ -1443,7 +1443,7 @@ const mergeFindResults = (results: FindResult[]): FindResult => {
const latestUserText = extractLatestUserText(eventObj.messages);
const rawRecallQuery =
latestUserText ||
- (typeof eventObj.prompt === "string" ? eventObj.prompt.trim() : "");
+ (typeof eventObj.prompt === "string" ? sanitizeUserTextForCapture(eventObj.prompt) : "");
const recallQuery = prepareRecallQuery(rawRecallQuery);
const queryText = recallQuery.query;
if (!queryText) {