feat: add OpenCode adapter#16
Conversation
Thin OpenCode plugin that injects the ponytail ruleset via the
experimental.chat.system.transform hook and persists /ponytail level
switches via command.execute.before. Reuses the shared instruction builder
(hooks/ponytail-instructions.js) — no copied SKILL.md, no duplicated logic,
no edits to the shared hooks.
Adds .opencode/command/{ponytail,ponytail-review}.md, an example
opencode.json, a smoke test, and README / agent-portability / help-card docs.
Verified against OpenCode 1.17.4: plugin loads, the transform hook fires, the
injected system prompt reaches the model, and mode gating (off/full) works.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
I'm not sure about how to install this, I should download the repo locally ? Add it to my .config/opencode/ ? |
|
Same difficulty than @vasilvestre , i try everything but I do not understand how to setup Ponytail under my Opencode configuration. 1 - Clone this repo inside 4 - Start The only working way is to clone the repo and start Opencode from it, but what the point if it's no available under our projects folders? Edit: tried with the full path of ponytail.mjs into plugin, same issues, nothing happens. Final Edit: fix PR incoming => #143 |
Adds OpenCode (sst/opencode) as a host adapter, in keeping with the repo's agent-portability model.
What it does
.opencode/plugins/ponytail.mjs: server plugin. Injects the ponytail ruleset into every chat via theexperimental.chat.system.transformhook at the active intensity, and persists/ponytail <level>switches viacommand.execute.before.hooks/ponytail-instructions.js): no copied SKILL.md, no duplicated filter/fallback logic, no edits to the shared hooks. Stays within the "keep adapters thin" rule indocs/agent-portability.md..opencode/command/{ponytail,ponytail-review}.md: slash commands.tests/opencode-plugin.test.js: smoke test (inject-at-mode, switch-follows, off-suppresses, ignore-other-commands).opencode.json, plus README / agent-portability / help-card docs.Verified against OpenCode 1.17.4
opencode debug config, no errors).experimental.chat.system.transformhook fires and the injected system prompt reaches the model: Claude Sonnet 4.6 quoted the injectedPONYTAIL MODE ACTIVEheader; with modeoffit correctly saw nothing.Relationship to #15
Supersedes #15. That PR's plugin is built on OpenCode hooks that don't exist in the current API (
session.created,tui.prompt.append) and mutates a non-existentoutput.systemPrompt, so it would silently no-op. The real injection point isexperimental.chat.system.transform. This is rebuilt on the verified API and slimmed to reuse the shared builder (71 LOC of adapter vs 319). Thanks to @gailingmic for raising OpenCode support.🤖 Generated with Claude Code