Repository navigation
Description
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::OpenCodevariant inappa-runtime-api(appa-runtime-api/src/lib.rs:25) with the usualas_str/prefix/review_channelarms.appa-adapter-opencode/crate, modeled onappa-adapter-amp/. Identity table: bare names →host/opencode/<name>, MCP names →mcp/<server>/<tool>,task→agent/opencode/taskwithSpawnKind::Single, plus the control tool aliasexecute_remedy_plan→appa/execute_remedy_plan. Proptestlawsmodule copied from the kagent adapter.integrations/opencode/opencode-appa.ts— a host plugin that posts OpenCode plugin events toPOST /hook. Modeled onintegrations/amp/amppa.ts.integrations/opencode/appa.toml— starter policy, modeled onintegrations/amp/appa.toml.- Replay tests in
integrations/opencode/tests/covering the same scenarios asamppa.test.ts: bash blocked from sending a private file to a public URL, read+webfetch admitted,tasksubagent binding, sanitizer triggered viaexecute_remedy_plan, runtime unreachable → fail closed. - README + a section under your existing adapters page on the website.
Where I'd need your help
- 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,skillas bare names mapping tohost/opencode/<id>. Does that match how you'd want the namespace organized, or do you have a preference (e.g.host/<id>directly, noopencode/infix)? - 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? taskas a spawn. OpenCode'stasktool runs a sub-agent in-process. I'd register it asSpawnKind::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?- Naming collision guard. The bare-name branch would map
execute_remedy_plan(if a user happens to have a tool by that name) tohost/opencode/execute_remedy_plan, and reserve the literalexecute_remedy_planfor the control tool. Same trick the kagent adapter uses (appa-adapter-kagent/src/lib.rs:104-111). Sound right? - MCP path. Your runtime already serves
execute_remedy_planover streamable HTTP; OpenCode speaks MCP natively. I'd document the user adding"mcp": { "appa": { "type": "remote", "url": "http://127.0.0.1:8789/mcp" } }toopencode.jsonrather than having the plugin advertise the control tool. OK to recommend that, or do you want it routed through the plugin instead? - 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
joeskeen commentedon Oct 2, 2026
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.arsenyinfo commentedon Oct 5, 2026
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?