跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    codeg-dev

    0 Injection

    v0.1.0其他
    opencode-0-injection

    OpenCode plugin that prepends a priority-zero operational prompt before the agent prompt via the experimental.chat.system.transform hook.

    GitHub 星标

    1

    月装机量

    9

    近 7 天 4

    综合评分SCORE

    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"]
    }

    opencode 启动时会通过内嵌运行时自动加载 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