opencode-0-injectionOpenCode plugin that prepends a priority-zero operational prompt before the agent prompt via the experimental.chat.system.transform hook.
1
9
近 7 天 4
24.8
生态多维模型
2 个月前
2026-06-06
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-0-injection@0.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-0-injection@0.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-0-injectionopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
English | العربية | বাংলা | Português (Brasil) | Bosanski | Dansk | Deutsch | Español | Français | Ελληνικά | Italiano | 日本語 | 한국어 | Norsk | Polski | Русский | ไทย | Türkçe | Українська | Tiếng Việt | 简体中文 | 繁體中文
opencode-0-injection
Local OpenCode server plugin that prepends a priority-zero operational prompt before the agent prompt.
Purpose
OpenCode builds its final system prompt in this broad order:
agent prompt → environment → Instructions from AGENTS.md
This plugin keeps OpenCode core behavior intact, but prepends one operator-controlled prompt file at the very front:
0-injection-prompt → agent prompt → environment → instruction
The default prompt file is 0-injection-prompt.md.
OpenCode config
{
"plugin": [
[
"./plugins/opencode-0-injection",
{
"file": "0-injection-prompt.md"
}
]
]
}
When this repository is checked out separately, either copy it into ~/.config/opencode/plugins/opencode-0-injection or point the plugin entry at the absolute checkout path.
Behavior
The plugin uses OpenCode's experimental.chat.system.transform hook. It wraps the injected prompt with markers so retries or repeated transforms do not accumulate duplicate blocks:
<opencode-0-injection-prompt>
...
</opencode-0-injection-prompt>
Smoke test
npm test
The smoke test imports the plugin, runs the transform against a synthetic system prompt, and verifies this ordering:
0-injection < agent prompt < environment < instruction