#5494·OpenViking

[Feature]: opencode plugin: use the OpenCode v2 plugin API for parity with the Claude Code and Codex plugins

Author: oliver-meeCreated Sep 30, 2026Updated Sep 30, 2026

Issue Origin

Observed or reproduced in a real environment

Problem Statement

Since #5341 the opencode plugin runs on OpenCode v2, which is great. It ports the v1 behaviour onto the v2 entry point, and uses a small slice of what the v2 plugin API (v2.0.20) offers: mcp.transform, tool.hook, session.hook (prompt, context, compaction), event.subscribe, session.get / session.context and storage.

Running it next to the Claude Code and Codex plugins on the same server, a few things the other integrations do are missing on opencode:

  • No commit when a session ends. Extraction only happens at the token threshold, on compaction, on deletion or when the server stops, so short sessions often never get extracted.
  • Recall is awaited before the message is sent (#5148, 1.5 to 2.5 s per send).
  • No experience memory (Claude captures it on PostToolUse).
  • None of the bundled skills ship (openviking-memory, ov-experience-memory, ov-memory-doctor, openviking-skills).
  • No /ov status or doctor command.
  • No statusline, and no way to see what recall injected.
  • Tools go through a spawned Node MCP proxy rather than being registered in process.

Proposed Solution

Most of these map directly onto v2 plugin surfaces that did not exist in v1:

Gap v2 surface
Commit at session end session.execution.succeeded / session.idle events, plus the setup() cleanup function
Recall without blocking send prefetch on the prompt hook, inject on the context hook with a time budget
Native tools, no MCP proxy ctx.tool.transform
Bundled skills, and skills stored in OpenViking as real opencode skills ctx.skill.transform and ctx.skill.reload()
/ov status, doctor, forget ctx.command.transform
Experience memory tool.hook("execute.after")
Recall compression without spawning a CLI ctx.generate on the user's configured model
OpenViking owned compaction (like the Pi extension's takeover) the compaction hook can set result and skip the model call
Statusline and a recall trace panel a companion TUI plugin using the prompt.footer.status and sidebar.content slots, fed over ctx.rpc

Several open PRs already cover part of this, and I'd rather build on them than duplicate them: #4062 (session idle auto commit across harnesses), #3691 (decouple threshold commit from session.idle), #3048 (native tools, written against v1), #4988 (subagent exclusion), #4989 (capture filters) and #5459 (archive on commit, recent tail at assembly).

A suggested order, one PR each:

  1. Session end commit on v2 lifecycle events (building on #4062 if that is still the intended direction).
  2. Non blocking recall (fixes #5148).
  3. Native tools via tool.transform.
  4. Bundled and OpenViking skills via skill.transform.
  5. /ov command.
  6. Experience memory.
  7. Later, and only if wanted: recall compression via ctx.generate, OpenViking owned compaction, and the TUI companion plugin.

Happy to split or reorder this however suits you. Is this a direction you'd take PRs for, and should the session end commit go through #4062 or a separate opencode PR?

Alternatives Considered

Keeping v1 parity only and closing the gaps inside the existing prompt/context hooks. That works for recall but cannot provide native tools, skills, commands or a statusline, and the session end commit stays tied to the event stream.

Feature Area

Other

Use Case

Using opencode alongside Claude Code and Codex against one OpenViking server, and wanting the same memory behaviour in all three. The main pain today is short opencode sessions that never get extracted, and the send delay from recall.

Example API (Optional)

No response

Additional Context

The v2 plugin types referenced above are in packages/plugin/src/promise/* and packages/plugin/src/tui/* at the v2.0.20 tag of the opencode repo.

Contribution

  • I am willing to contribute to implementing this feature