Skip to content

feat: add OpenCode adapter#16

Merged
DietrichGebert merged 1 commit into
mainfrom
feat/opencode-adapter
Jun 13, 2026
Merged

feat: add OpenCode adapter#16
DietrichGebert merged 1 commit into
mainfrom
feat/opencode-adapter

Conversation

@DietrichGebert

@DietrichGebert DietrichGebert commented Jun 13, 2026

Copy link
Copy Markdown
Owner

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 the experimental.chat.system.transform hook at the active intensity, and persists /ponytail <level> switches via command.execute.before.
  • Reuses the shared instruction builder (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 in docs/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).
  • Example opencode.json, plus README / agent-portability / help-card docs.

Verified against OpenCode 1.17.4

  • Plugin loads cleanly (opencode debug config, no errors).
  • Commands load into resolved config.
  • The experimental.chat.system.transform hook fires and the injected system prompt reaches the model: Claude Sonnet 4.6 quoted the injected PONYTAIL MODE ACTIVE header; with mode off it 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-existent output.systemPrompt, so it would silently no-op. The real injection point is experimental.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

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>
@DietrichGebert DietrichGebert merged commit 46c5c28 into main Jun 13, 2026
@DietrichGebert DietrichGebert deleted the feat/opencode-adapter branch June 13, 2026 01:29
@vasilvestre

Copy link
Copy Markdown

I'm not sure about how to install this, I should download the repo locally ? Add it to my .config/opencode/ ?
Sorry 😓

@JulienBernard

JulienBernard commented Jun 17, 2026

Copy link
Copy Markdown

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 ~/.config/opencode/tools/ponytail
2 - Take ponytail.mjs from it and copy it to ~/.config/opencode/plugins/ponytail.mjs
3 - Update ~/.config/opencode/opencode.json to add it:

  "plugin": [
    "./plugins/ponytail.mjs"
  ]

4 - Start opencode
5 - No commands /ponytail available, no Ponytail skills visibles when I list them with /skills

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants