opencode-verify-subagent-plugin
v1.0.0
Published
OpenCode plugin that appends verification reminders after subagent results
Maintainers
Readme
opencode-verify-subagent-plugin
一个 OpenCode 插件,在 subagent(task 工具)返回结果后追加验证提示词,提醒父 agent 主动验证 subagent 的输出。
工作原理
当 subagent 完成任务并返回结果时,此插件会在工具输出末尾追加一段 <system-reminder>。该提示词指示父 agent 不要轻信 subagent 的结论,应主动验证关键或可疑的内容。
安装
在项目的 opencode.json 中添加插件路径:
{
"plugin": ["~/opencode-verify-subagent-plugin"]
}或作为 npm 包安装:
{
"plugin": ["opencode-verify-subagent-plugin"]
}配置
默认提示词
默认提示词定义在 reminder.ts 中:
不要轻信 subagent 的输出,主动验证关键或可疑的结论。按 Subagent 类型自定义
你可以通过编辑 reminder.ts 为不同的 subagent_type 设置不同的提示词:
export const DEFAULT_REMINDER =
"不要轻信 subagent 的输出,主动验证关键或可疑的结论。"
export const REMINDERS: Record<string, string> = {
explore: "验证文件路径和代码引用是否存在。",
general: "交叉检查 subagent 的关键结论。",
}当 task 使用的 subagent_type 在 REMINDERS 中有对应条目时,将使用该自定义文本,否则使用默认提示词。
文件结构
├── package.json # 插件元数据,exports["./server"]
├── index.ts # 插件入口,返回包含 tool.execute.after 的 Hooks
├── reminder.ts # 提示词文本配置
├── README.md # 英文文档
└── README.zh.md # 中文文档开发
- 运行时:Bun(非 Node)
- 模块格式:仅 ESM(
"type": "module") - 无构建步骤 — 插件入口为原始 TypeScript,通过
package.json的exports["./server"]加载 - 通过在加载了此插件的 OpenCode 会话中运行来验证更改
