Skip to content

Opencode v2 plugin support #3554

Closed
Closed

Description

@johannespfrang-h-d

Summary

The graphify opencode plugin uses the v1 plugin API. Opencode v2 has a new API and a migration guide available.

Implementation

Both v1 and v2 plugins can be installed side-by-side. The v2 plugin must be installed in the .opencode/plugins (plural) folder (only read by v2), whereas v1 stays in .opencode/plugin. Alternatively, opencode 1.18.29+ / v2 also support dual-entrypoint plugins.

Activity

  1. CBEPX commented on Sep 16, 2026

    @CBEPX

    Hit the same on opencode 2.0.4 (macOS, graphifyy 0.9.61 installed via uv).

    Repro: after graphify opencode install, the generated .opencode/plugins/graphify.js fails at every startup, the hook never fires:

    failed to load plugin target=.../graphify.js cause="...PluginModule.LoadError: Plugin must export a default definition with an id and an effect or setup function..."

    So for v2 users the opencode integration is currently dead on arrival.

    What works for me — same reminder behavior rewritten for the v2 API:

    export default {
      id: "graphify-hook",
      setup: async ({ tool }) => {
        tool.hook("execute.before", async (event) => {
          // same reminder logic as the v1 plugin
        });
      },
    };

    Loads clean, shows up in plugin list with its id. One caveat I could not fully verify: inside the 2.0.4 binary I only found tool.hook("execute.after") in use, so I am not 100% sure "execute.before" actually fires at runtime — registration does not error, but I have no observable proof the reminder gets injected. Would be great if the official v2 plugin could confirm this.

    Happy to test a preview build.

  2. Svashtar commented on Sep 17, 2026

    @Svashtar

    Have same problem here.

  3. yukoba commented on Sep 20, 2026

    @yukoba

    Since the Graphify plugin for OpenCode merely outputs [graphify] knowledge graph at graphify-out/. For focused questions, run graphify query with your question (scoped subgraph, usually much smaller than GRAPH_REPORT.md) instead of grepping raw files. Read GRAPH_REPORT.md only for broad architecture context., it seems to work without any issues as long as you have AGENTS.md and skills, even without the plugin.

  4. safishamsi commented on Oct 10, 2026

    @safishamsi
    Member

    Fixed in 0.9.84 (now on PyPI). The OpenCode plugin now ships as a default export with a setup() hook so it loads on OpenCode 2, while keeping the v1 server() hook for older OpenCode. graphify install also refreshes an already-installed v1-only copy. Landed via #4039 (thanks @bercedev). Thanks for raising it, @johannespfrang-h-d.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions