Skip to content

Commit 4ecfba4

Browse files
committed
fix(openclaw-plugin): read allowPromptInjection from plugin config (fixes #1383 bug 3)
Previously, allowPromptInjection was only read from the framework's hooks config (plugins.entries.<id>.hooks.allowPromptInjection). Users who set it in the plugin's own config block had no effect. Now reads from both locations — setting allowPromptInjection: false in either the plugin config or the hooks config will disable auto-recall. Also adds the property to the MemosLocalConfig type and configSchema.
1 parent 45f4c1b commit 4ecfba4

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

apps/memos-local-openclaw/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,12 @@ const memosLocalPlugin = {
351351
// ─── Check allowPromptInjection policy ───
352352
// When allowPromptInjection=false, the prompt mutation fields (such as prependContext) in the hook return value
353353
// will be stripped by the framework. Skip auto-recall to avoid unnecessary LLM/embedding calls.
354+
// Reads from both the framework hook config (plugins.entries.<id>.hooks.allowPromptInjection)
355+
// and the plugin's own config (allowPromptInjection), so users can set it in either place.
354356
const pluginEntry = (api.config as any)?.plugins?.entries?.[api.id];
355-
const allowPromptInjection = pluginEntry?.hooks?.allowPromptInjection !== false;
357+
const allowPromptInjection =
358+
pluginEntry?.hooks?.allowPromptInjection !== false &&
359+
ctx.config.allowPromptInjection !== false;
356360
if (!allowPromptInjection) {
357361
api.logger.info("memos-local: allowPromptInjection=false, auto-recall disabled");
358362
}

apps/memos-local-openclaw/openclaw.plugin.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"viewerPort": {
1717
"type": "number",
1818
"description": "Memory Viewer HTTP port (default 18799)"
19+
},
20+
"allowPromptInjection": {
21+
"type": "boolean",
22+
"description": "Set to false to disable automatic memory recall injection into prompts (default true)"
1923
}
2024
}
2125
},

apps/memos-local-openclaw/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ export interface MemosLocalConfig {
324324
sharing?: SharingConfig;
325325
/** Hours of inactivity after which an active task is automatically finalized. 0 = disabled. Default 4. */
326326
taskAutoFinalizeHours?: number;
327+
/** Set to false to disable automatic memory recall injection into prompts (default true). */
328+
allowPromptInjection?: boolean;
327329
}
328330

329331
// ─── Defaults ───

0 commit comments

Comments
 (0)