Skip to content

feat: add native opencode plugin (server + TUI)#195

Open
sdeonvacation wants to merge 2 commits intoJuliusBrussee:mainfrom
sdeonvacation:feat/opencode-plugin
Open

feat: add native opencode plugin (server + TUI)#195
sdeonvacation wants to merge 2 commits intoJuliusBrussee:mainfrom
sdeonvacation:feat/opencode-plugin

Conversation

@sdeonvacation
Copy link
Copy Markdown

What

Adds a native opencode plugin under plugins/caveman/.opencode-plugin/:

  • server.ts β€” injects caveman system prompt on every turn via experimental.chat.system.transform. Reads per-session state (disabled list + level) from XDG_STATE_HOME/opencode/caveman.json. Tracks subagent sessions via bus events and auto-applies ultra for them.
  • tui.ts β€” registers three TUI commands in the / command palette: enable, disable, set-level (lite/full/ultra) with a dialog picker.
  • package.json β€” manifest with exports map pointing ./server β†’ server.ts and ./tui β†’ tui.ts.

Also updates README.md to surface opencode as a first-class supported agent (install table row, feature matrix column, dedicated details section, footnote).

Before / After

Before: opencode listed only in "Any other agent" section with generic npx skills install (skill only, no auto-activation).

After: opencode has its own plugin with auto-activation every session, per-session enable/disable/level switching via TUI commands, and auto-ultra for subagent sessions.

Structure

Mirrors the existing .codex-plugin/ convention:

plugins/caveman/
  .codex-plugin/       ← existing
  .opencode-plugin/    ← new
    package.json
    server.ts
    tui.ts

Notes

  • experimental.chat.system.transform hook is marked experimental in opencode's API β€” same as other plugin authors use it today
  • compress and caveman-help not included (compress requires local skill files; help is skill-based)
  • Tested against the real opencode plugin loader (packages/opencode/src/plugin/shared.ts) β€” server/tui must be separate exports per loader constraint

Adds plugins/caveman/.opencode-plugin/ with:
- server.ts: system prompt injection (lite/full/ultra), auto-ultra for subagent sessions
- tui.ts: TUI commands (enable/disable/set-level) with dialogs
- package.json: exports map pointing server.ts and tui.ts

State persisted to XDG_STATE_HOME/opencode/caveman.json β€” TUI writes, server reads per turn.
Mirrors .codex-plugin/ structure convention.
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.

1 participant