Skip to content

feat(openclaw-plugin): add hooks.allowPromptInjection config to all installation methods#763

Open
KorenKrita wants to merge 1 commit intovolcengine:mainfrom
KorenKrita:fix/openclaw-hooks-config
Open

feat(openclaw-plugin): add hooks.allowPromptInjection config to all installation methods#763
KorenKrita wants to merge 1 commit intovolcengine:mainfrom
KorenKrita:fix/openclaw-hooks-config

Conversation

@KorenKrita
Copy link
Contributor

Description

Add hooks.allowPromptInjection: true configuration to all OpenClaw plugin installation methods to enable the auto-recall feature.

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Added hooks.allowPromptInjection: true config to install.sh script
  • Added hooks.allowPromptInjection: true config to install.ps1 script
  • Added hooks.allowPromptInjection: true config to setup-helper/install.js
  • Updated manual configuration instructions in README.md
  • Updated manual configuration instructions in INSTALL.md

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux (install.sh)
    • macOS
    • Windows (install.ps1)

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

The hooks.allowPromptInjection configuration is required for the auto-recall feature to work properly via the before_prompt_build hook. Without
this setting, the plugin cannot inject recalled memories into the prompt.

From the code analysis, the auto-recall feature depends on the before_prompt_build hook to inject recalled memories into prompts. This hook only works when hooks.allowPromptInjection is explicitly set to true in the plugin configuration.
I've added this configuration to all installation methods (install.sh, install.ps1, setup-helper/install.js) and updated the manual setup documentation accordingly.
However, I'm not entirely familiar with the OpenClaw context plugin's runtime logic and hook execution flow. Could @Mijamind719 @qin-ctx please review whether:

  1. This is the correct configuration key for enabling prompt injection hooks
  2. There are any other prerequisites or dependencies I might have missed
  3. The placement of this configuration in the setup scripts is appropriate

Thanks in advance for the review!

…nstallation methods

Add hooks.allowPromptInjection: true configuration to all OpenClaw plugin
installation methods (install.sh, install.ps1, setup-helper/install.js, README.md,
and INSTALL.md). This configuration is required for the auto-recall feature to
work properly via the before_prompt_build hook.
@KorenKrita
Copy link
Contributor Author

I noticed the new version of the OpenClaw plugin exists as a Context Plugin rather than a Memory Plugin, and the recommended configuration disables the Memory Slot. Does this mean that OpenClaw's built-in memory system can technically coexist with OpenViking as previously documented, but this coexistence is not recommended in the configuration?

Copy link
Contributor

@qin-ptr qin-ptr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

设计合理性评估

经过代码库全面检查,发现配置的必要性和正确性存在严重问题,需要验证后才能合并。详见下方 blocking issue。

🤖 I am a bot owned by @qin-ctx.


# Enable plugin (files already deployed to extensions dir by deploy_plugin)
"${oc_env[@]}" openclaw plugins enable openviking || { err "$(tr "openclaw plugins enable failed" "openclaw 插件启用失败")"; exit 1; }
"${oc_env[@]}" openclaw config set plugins.entries.openviking.hooks.allowPromptInjection true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Design] (blocking)

配置必要性无法验证:hooks.allowPromptInjection 在整个 OpenViking 代码库中完全不存在(包括插件源码、配置定义、文档、commit 历史)。

发现:

  1. 插件的 before_prompt_build hook 在 index.ts:412 无条件注册,没有检查任何 allowPromptInjection 配置
  2. auto-recall 功能由 cfg.autoRecall 控制(config.ts,默认 true),不依赖 hooks.* 配置
  3. 配置路径 plugins.entries.openviking.hooks.* 不符合标准模式(通常是 plugins.entries.<name>.config.*

需要验证:

  • 在没有这个配置的情况下,auto-recall 是否真的不工作?
  • OpenClaw 框架是否确实需要这个配置?如果需要,请提供文档或源码引用
  • 配置路径是否正确?

如果配置确实必要,需要在 OpenViking 文档中说明其作用和必要性。

# Enable plugin (files already deployed to extensions dir by Deploy-Plugin)
openclaw plugins enable openviking
if ($LASTEXITCODE -ne 0) { throw "openclaw plugins enable failed (exit code $LASTEXITCODE)" }
openclaw config set plugins.entries.openviking.hooks.allowPromptInjection true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Design] (blocking)

同 install.sh:626 - 配置的必要性和正确性无法验证。整个 OpenViking 代码库中没有任何 allowPromptInjection 的引用,插件代码也不依赖此配置。

if (enableResult.code !== 0) throw new Error(`openclaw plugins enable failed (exit code ${enableResult.code})`);
await oc(["config", "set", "plugins.slots.contextEngine", "openviking"]);

// Enable prompt injection hooks (required for auto-recall feature)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Design] (blocking)

同 install.sh:626 - 配置的必要性和正确性无法验证。建议先通过实际测试确认:在没有这个配置的情况下,auto-recall 功能是否真的无法工作?


```bash
openclaw plugins enable openviking
openclaw config set plugins.entries.openviking.hooks.allowPromptInjection true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Design] (blocking)

同 install.sh:626 - 如果这个配置确实必要,需要在文档中添加说明:

  • 为什么需要这个配置?
  • 如果缺少会发生什么?
  • OpenClaw 框架的哪个机制依赖它?


```bash
openclaw plugins enable openviking
openclaw config set plugins.entries.openviking.hooks.allowPromptInjection true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Design] (blocking)

同 INSTALL.md:202 - 需要在文档中说明配置的作用。另外,建议在 Troubleshooting 章节添加相关内容,帮助用户理解这个配置。

@qin-ctx
Copy link
Collaborator

qin-ctx commented Mar 19, 2026

cc @Mijamind719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants