Skip to content

Plan OpenCode V2 plugin adapter #718

Description

@DanRioDev

Context

OpenCode V2 is currently beta and intentionally does not load V1 plugin implementations: https://opencode.ai/v2/docs/migrate-v1

Ponytail already has a strong cross-host boundary: shared instruction/config builders, AGENTS.md, skills, and commands. Only the OpenCode runtime adapter in .opencode/plugins/ponytail.mjs is V1-specific. It currently uses an async plugin export with config, experimental.chat.system.transform, and command.execute.before.

Suggested port plan

  • Keep shared instruction generation and persisted mode handling unchanged.
  • Add a separate V2 adapter using a unique id + setup contract.
  • Register packaged skills and commands through V2 setup transforms, or rely on native disk discovery where possible.
  • Inject active Ponytail instructions through the V2 session context hook.
  • Handle /ponytail <mode> through the V2 command transform.
  • Keep AGENTS.md / skills as the no-plugin fallback for users who do not need runtime mode switching.
  • Preserve V1 adapter until V2 stabilizes rather than forcing one file to support both contracts.

Compatibility checks

  • Plugin appears in opencode2 api get /api/plugin.
  • Default mode is injected once with no duplicate rules.
  • /ponytail lite|full|ultra|off changes later turns and persists as documented.
  • Packaged commands and skills remain discoverable.
  • Missing or malformed state files fall back safely.
  • Installation from npm works in standalone and managed service modes.
  • Existing multi-agent tests and V1 OpenCode behavior remain unchanged.

Would a thin V2 adapter be welcome once the API settles? I can help test it against current opencode2 previews.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions