Skip to content

Add an OpenCode adapter to OpenAPPA #590

Closed

Description

@joeskeen

Hi — I'm working on getting OpenCode users the same information-flow guarantees OpenAPPA already gives Claude Code, Amp, and Kagent users. This is a question + a proposal. Before I open a PR I want to check the framing matches how you'd want a fourth adapter to land.

Related issue on the OpenCode side, asking for a one-line primitive that makes plugin-driven pre-execution gating possible (the integration's only upstream dependency): anomalyco/opencode#52837. The two conversations can play out in parallel — this issue is about the APPA-side design, the other is about a 30-line hook change.

What's already there

The runtime, the wire (POST /hook), the Adapter trait, and the policy engine are all adapter-agnostic. Adding AdapterName::OpenCode fits the pattern of appa-adapter-claude-code, appa-adapter-amp, and appa-adapter-kagent. The MCP server APPA runs from process start (appa-runtime/src/mcp.rs) covers execute_remedy_plan and the appa_* management tools natively, so the integration only needs to observe OpenCode's native tool calls — it does not need to advertise or route the control tool itself.

What I'd add on your side

Roughly:

  • AdapterName::OpenCode variant in appa-runtime-api (appa-runtime-api/src/lib.rs:25) with the usual as_str / prefix / review_channel arms.
  • appa-adapter-opencode/ crate, modeled on appa-adapter-amp/. Identity table: bare names → host/opencode/<name>, MCP names → mcp/<server>/<tool>, task → agent/opencode/task with SpawnKind::Single, plus the control tool alias execute_remedy_plan → appa/execute_remedy_plan. Proptest laws module copied from the kagent adapter.
  • integrations/opencode/opencode-appa.ts — a host plugin that posts OpenCode plugin events to POST /hook. Modeled on integrations/amp/amppa.ts.
  • integrations/opencode/appa.toml — starter policy, modeled on integrations/amp/appa.toml.
  • Replay tests in integrations/opencode/tests/ covering the same scenarios as amppa.test.ts: bash blocked from sending a private file to a public URL, read+webfetch admitted, task subagent binding, sanitizer triggered via execute_remedy_plan, runtime unreachable → fail closed.
  • README + a section under your existing adapters page on the website.

Where I'd need your help

  1. Tool-id spelling. I'd like the adapter to recognize OpenCode's bash, read, write, edit, webfetch, websearch, glob, grep, todowrite, task, apply_patch, lsptool, code-mode, plan, question, invalid, skill as bare names mapping to host/opencode/<id>. Does that match how you'd want the namespace organized, or do you have a preference (e.g. host/<id> directly, no opencode/ infix)?
  2. Review channel. I'd set it to ReviewChannel::Runtime (same as Amp and Claude Code) because OpenCode has no in-agent review surface today. OK?
  3. task as a spawn. OpenCode's task tool runs a sub-agent in-process. I'd register it as SpawnKind::Single. The plugin wouldn't emit child lifecycle events in V1 (OpenCode plugins don't see them); the runtime still records the spawn. Acceptable for V1?
  4. Naming collision guard. The bare-name branch would map execute_remedy_plan (if a user happens to have a tool by that name) to host/opencode/execute_remedy_plan, and reserve the literal execute_remedy_plan for the control tool. Same trick the kagent adapter uses (appa-adapter-kagent/src/lib.rs:104-111). Sound right?
  5. MCP path. Your runtime already serves execute_remedy_plan over streamable HTTP; OpenCode speaks MCP natively. I'd document the user adding "mcp": { "appa": { "type": "remote", "url": "http://127.0.0.1:8789/mcp" } } to opencode.json rather than having the plugin advertise the control tool. OK to recommend that, or do you want it routed through the plugin instead?
  6. Bench coverage. Would you want OpenCode added to bench/ alongside Claude Code and Kagent? Happy to wire it up.

I have a detailed plan (work items, file layouts, test scenarios, catastrophic blockers) ready to share if it's useful. Happy to scope it tighter before I start, or to just open a draft PR and iterate.

Thanks!

Activity

  1. joeskeen commented on Oct 2, 2026

    @joeskeen
    Author

    FYI for anyone finding this issue first: the OpenCode-side companion issue is anomalyco/opencode#52837. That issue is the integration's only upstream dependency — it's a small plugin-contract change (pre-execution gating on tool.execute.before). All the rest of the work — adapter crate, host plugin, policy, replay tests — lives in this repo regardless of how that conversation resolves.

  2. arsenyinfo commented on Oct 5, 2026

    @arsenyinfo
    Contributor

    hi @joeskeen, thanks for driving this initiative! I agree OpenCode would be a valuable contribution here. I'll suggest my design bits later, i need to explore some areas first. Before i dive in, one question: is your suggestion aimed at Opencode v2.x?

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