让 before_agent_start 的 systemPrompt 真正生效,减少上下文外泄
适用于“插件已返回 `systemPrompt` 但模型仍回显内部指令”场景:把策略指令放进系统提示而非用户前缀,降低小模型把路由信息输出给用户的概率。
GITHUBDiscovered 2026-02-12Author PauloLuan
Prerequisites
- You are using plugin hook `before_agent_start` and can inspect behavior with test prompts.
- Your stack can deploy a patch or upgrade once fix is merged upstream.
Steps
- Reproduce the issue by returning both `prependContext` and `systemPrompt`, then check which one affects final model behavior.
- Move sensitive routing directives from user-visible prepend text into system-level prompt path.
- Regression-test with smaller models (e.g., Haiku-class) for echo/leakage cases.
- Ship patch/upgrade and keep a fallback rule to strip accidental prompt echoes in output filters.
Commands
openclaw gateway statusopenclaw gateway restartopenclaw statusVerify
User-facing replies stop echoing internal intent-routing text while hook-driven behavior still takes effect.
Caveats
- Behavior differs across model families; every target model should be revalidated(需验证).
- Avoid storing secrets directly in system prompts; use scoped references where possible.
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗