Skip to content

Commit a49169e

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 06d73e7 commit a49169e

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
@@ -323,8 +323,12 @@ const memosLocalPlugin = {
323323
// ─── Check allowPromptInjection policy ───
324324
// When allowPromptInjection=false, the prompt mutation fields (such as prependContext) in the hook return value
325325
// will be stripped by the framework. Skip auto-recall to avoid unnecessary LLM/embedding calls.
326+
// Reads from both the framework hook config (plugins.entries.<id>.hooks.allowPromptInjection)
327+
// and the plugin's own config (allowPromptInjection), so users can set it in either place.
326328
const pluginEntry = (api.config as any)?.plugins?.entries?.[api.id];
327-
const allowPromptInjection = pluginEntry?.hooks?.allowPromptInjection !== false;
329+
const allowPromptInjection =
330+
pluginEntry?.hooks?.allowPromptInjection !== false &&
331+
ctx.config.allowPromptInjection !== false;
328332
if (!allowPromptInjection) {
329333
api.logger.info("memos-local: allowPromptInjection=false, auto-recall disabled");
330334
}

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
@@ -322,6 +322,8 @@ export interface MemosLocalConfig {
322322
skillEvolution?: SkillEvolutionConfig;
323323
telemetry?: TelemetryConfig;
324324
sharing?: SharingConfig;
325+
/** Set to false to disable automatic memory recall injection into prompts (default true). */
326+
allowPromptInjection?: boolean;
325327
}
326328

327329
// ─── Defaults ───

0 commit comments

Comments
 (0)