Skip to content

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

Open

Description

@oliver-mee

Issue Origin

Observed or reproduced in a real environment

Problem Statement

This tracks OpenViking's OpenCode V2 integration parity. The original September proposal targeted OpenCode 2.0.20. This update checks the remaining work against OpenCode 2.2.5 and OpenViking main at 012e1f0c83405664c07d371c4f4d77a013015253.

The integration already does more than the original issue described. This checklist separates existing behaviour, pending fixes and planned workstreams. Some features will be optional to enable, but remain within the project scope. Source review is not an end-to-end runtime test.

Proposed Solution

Keep changes small and independently reviewable, reuse the shared plugin modules, and preserve the V1 integration where the package still supports it.

Already implemented in current source

  • V2 prompt/context hooks, execution-boundary capture, compaction hooks and plugin cleanup.
  • Capture of assistant text and tool results, with session-local cursors in plugin storage.
  • Child-session identity and configurable exclusion handling. Remaining edge cases need reconciliation with fix(opencode): exclude subagent sessions from capture and commit #4988 rather than assuming this feature is absent.
  • Direct model-callable server MCP tools under openviking_*, with codemode: false.
  • Profile, memory index and server-stored skill catalog injection.
  • Archive preservation work in fix(plugins): archive every message on session commit #5459, merged on October 9.

Existing PRs, not new implementations

Keep idle auto-commit with the server's memory.session_auto_commit scheduler. The plugin-side timer was deliberately removed from #5497 during review.

1. Working skill integration

Existing implementation to review: #5915 replaces the unsupported skill editor method, but its current diff retains the MCP-callback-dependent registration gate and eager callback tests. Check deferred-transform behaviour before treating registration as resolved; extend the existing contribution rather than duplicate it.

  • Fix bundled skill registration. The package contains openviking-memory, openviking-skills and ov-experience-memory, but they were absent from the runtime skill catalog with the npm plugin 2026.10.28-1 on OpenCode 2.2.5. startV2Plugin gates skill registration on a variable set inside a deferred MCP transform, and then calls draft.source(), which is not in the 2.2.5 SkillEditor API. The test mock executes callbacks eagerly and supplies that unsupported method. Validate the fix against actual runtime discovery, including disabled-MCP cases.
  • Audit shared skill guidance and packaging. The memory skill still names search_experience / read_experience, while the Experience skill uses generic search/read tools. Review whether the portable package's useful ov-resources and ov-memory-troubleshoot guidance should also ship to dedicated integrations.
  • Evaluate native registration of server-stored skills through OpenCode's skill system, beyond the existing injected catalog and MCP reads. Resolve refresh, local-name precedence, permissions and supporting reference/script access before implementation.

2. Diagnostics and visibility

Related installation fix: #6744 removes duplicate V2 discovery while preserving V1 installation. Include its installation contract in diagnostics and verification rather than rebuilding that fix.

  • Add an OpenCode adapter for the existing shared memory doctor. Check effective configuration, plugin/MCP/skill registration, authenticated access and capture activity. Keep it distinct from extraction-content troubleshooting.
  • Add /ov status, doctor and explicit commit controls using native command registration.
  • Add an optional TUI companion for status and recall inspection. The server component has no toast API; a V2 TUI component does have notifications, dialogs and status slots.

3. Experience-aware skill use

Shared attribution work: #5475 recognises injected experience envelopes. Review compatibility with the OpenCode hook; it does not implement skill-load triggering in OpenCode.

  • Port the optional skill-experience hint workflow through tool.hook("execute.after"), including native skill loads. General Experience retrieval through the bundled skill already exists and is a separate capability.

The hook retrieves prior skill-usage experiences when a skill is loaded. It does not itself rewrite skills or train a model. Verify configuration, deduplication, native skill loads and direct SKILL.md reads. Capturing outcomes and extracting new experiences are separate server/capture responsibilities.

4. Context management

Shared compression work: #5727 preserves complete citations in fresh and cached digests. Reuse that correctness work; native OpenCode compression and assisted compaction remain separate implementation needs.

  • Evaluate keyed session instruction entries for durable profile/archive/task context. Preserve per-turn recall replay and prompt-cache stability.
  • Implement and validate controlled native compression through ctx.experimental.generate.text, with explicit model selection and measured cost/latency. Server-side compression already exists.
  • Implement and validate controlled OpenViking-assisted compaction through session.hook("compaction") and its replacement result, with native fallback and verified archive coverage.

Compression and assisted compaction are in scope, not deferred outside the plan. Confirm the design with maintainers before implementation, keep enablement explicit and preserve native fallback.

Delivery and verification

Existing fixes to reconcile before new implementation:

These overlap assessments come from current PR source diffs, not runtime validation or acceptance of the proposed fixes.

These four workstreams are proposed coherent review units, not a fixed PR count. Split only where each change is independently useful and reviewable. Diagnostics/commands and the TUI may need separate PRs if the combined diff grows too large. The two existing PRs remain separate.

Maintainer feedback requested: does this grouping fit the integration direction, and which boundaries would make review practical?

Alternatives Considered

Keep MCP as the tool transport. Functional tool parity does not require replacing it with custom tools. #3048 was closed without merging; an in-process adapter would need a concrete benefit and compatibility evidence before revisiting it.

Prefer the dedicated hook-based plugin over installing the portable Agent Plugins package alongside it. Individual portable skills can be reused without duplicating MCP registration or adopting the hook-free memory instructions.

Feature Area

Other

Use Case

Use OpenCode alongside Claude Code and Codex against one OpenViking server, with dependable recall, capture, diagnostics and visible execution state. The terminal TUI should expose useful status without making UI components a prerequisite for headless use.

Example API (Optional)

Relevant V2 surfaces: ctx.skill.transform(editor => editor.add(skill)), ctx.command.transform, ctx.tool.hook, ctx.session.hook, ctx.session.instructions, filtered ctx.event.subscribe, plugin storage and an optional ./tui export.

Additional Context

Checked against the OpenCode v2.2.5 tag under packages/plugin/src/promise/ and the current V2 server/TUI documentation. The skill-loading absence was observed in a live runtime; the transform timing issue was isolated with deferred versus eager callbacks. No plugin repair is claimed complete here.

Related work: #5148 remains open; #5496 addresses its V2 path. #4062 and #3691 remain open and concern overlapping lifecycle work. #4988 and #4989 remain open, but current source must determine their surviving delta. #5459 is merged. Track implementation, merge, publication and installed-runtime verification as separate milestones.

This issue is the public progress checklist. Detailed execution records can live in an OV Kanban board; private deployment details do not belong in this thread.

Contribution

  • I am willing to contribute to implementing this feature

Activity

  1. added
    agent-plugins
    on Oct 1, 2026
  2. oliver-mee commented on Nov 18, 2026

    @oliver-mee
    Author

    The OpenCode V2 follow-up is split into reviewable changes:

    Native server-stored skills remain a separate design decision. The existing catalog and explicit reads work without assuming that a local skill copy can safely preserve permissions, refresh, name precedence and helper access. The current profile, archive and per-message recall paths also do not require a new keyed-instructions layer. Concrete gaps there can be reviewed separately.

    The open drafts are for review. The native tests used OpenCode 2.3.0 with isolated fixtures.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-plugins

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions