You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rtk init generates incompatible plugin format for OpenCode v2 #3898
Confirming still broken on rtk 0.48.0 + OpenCode v2.0.17 (stable, Windows).
rtk init -g --opencode generates the V1 shape (export const RtkOpenCodePlugin, @opencode-ai/plugin, $ helper, "tool.execute.before" as an object key). The v2 loader rejects it: Plugin must export a default definition with an id and an effect or setup function.
exportdefault{id: "rtk",asyncsetup(ctx: any){awaitctx.tool.hook("execute.before",async(event: any)=>{constcommand=event?.input?.command;if(typeofcommand!=="string"||!command)return;// read stdout even on non-zero exit (see below)event.input={ ...event.input,command: rewritten};});},};
Two things worth knowing for the fix:
No $ in v2 — use node:child_process.execFile("rtk", ["rewrite", command]) (also avoids shell interpolation).
rtk rewrite exits 3 on success with valid stdout (rtk rewrite "git status" → rtk git status, exit 3), so the hook must read stdout from the error object too, and pass through silently on real failure.
Suggest shipping one of the open PRs (#3899, #4187, #4197). Happy to test any of them against v2.0.17.
Small follow-up: I can confirm the windowsHide: true in #4187 is necessary, not cosmetic. Without it, every rtk rewrite spawn pops a visible console window on Windows (OpenCode runs as a console-less background service, and Node defaults windowsHide to false). Verified the same flag in my local v2 port on 2.0.17 - flash gone, rewrites still fire. Thanks for consolidating on #4187.
changed the title [-]rtk init generates incompatible plugin format for OpenCode 2.0[/-][+]rtk init generates incompatible plugin format for OpenCode v2[/+]on Sep 30, 2026
Closing as a duplicate of #3463, which tracks the same problem: rtk init --opencode writes the OpenCode 1.x plugin shape, which the OpenCode 2.x loader rejects. #3463 has the implementation sketch and the discussion, so please follow up there.
Activity
fix(ai-harness): harden the opencode 2 plugin setup after review
fix(ai-harness): load the rtk and herdr plugins on opencode 2 (#648)
Asura7170 commentedon Sep 26, 2026
Confirming still broken on rtk 0.48.0 + OpenCode v2.0.17 (stable, Windows).
rtk init -g --opencodegenerates the V1 shape (export const RtkOpenCodePlugin,@opencode-ai/plugin,$helper,"tool.execute.before"as an object key). The v2 loader rejects it:Plugin must export a default definition with an id and an effect or setup function.Locally verified fix — plain v2 module, loads cleanly and rewrites fire:
Two things worth knowing for the fix:
$in v2 — usenode:child_process.execFile("rtk", ["rewrite", command])(also avoids shell interpolation).rtk rewriteexits 3 on success with valid stdout (rtk rewrite "git status"→rtk git status, exit 3), so the hook must read stdout from the error object too, and pass through silently on real failure.Suggest shipping one of the open PRs (#3899, #4187, #4197). Happy to test any of them against v2.0.17.
jchuder commentedon Sep 27, 2026
Update: #4187 now provides a more complete fix for this issue than my original PR #3899.
I have closed #3899 in favor of #4187. Further work on this issue will be tracked there.
#4187 also covers the additional cases reported here, including OpenCode 2.x, rtk rewrite exit code 3, Windows support, and runtime tests.
Asura7170 commentedon Sep 27, 2026
Small follow-up: I can confirm the
windowsHide: truein #4187 is necessary, not cosmetic. Without it, everyrtk rewritespawn pops a visible console window on Windows (OpenCode runs as a console-less background service, and Node defaultswindowsHideto false). Verified the same flag in my local v2 port on 2.0.17 - flash gone, rewrites still fire. Thanks for consolidating on #4187.[-]rtk init generates incompatible plugin format for OpenCode 2.0[/-][+]rtk init generates incompatible plugin format for OpenCode v2[/+]rtk-wshm-sync-bot commentedon Sep 30, 2026
🔍 Automated Triage
bughighSummary
rtk init --opencode generates legacy OpenCode 1.0 plugin format that OpenCode 2.0 fails to load; fix already in progress via PR #4187.
📁 Relevant files
src/init/opencode.rsSuggested Actions
rtk init --opencodeplugin silently does nothing on Desktop ($ is not a function) and on Windows (whichnot found) #3326)Triaged automatically by wshm · This is an automated analysis, not a human review.
KuSh commentedon Oct 3, 2026
Closing as a duplicate of #3463, which tracks the same problem:
rtk init --opencodewrites the OpenCode 1.x plugin shape, which the OpenCode 2.x loader rejects. #3463 has the implementation sketch and the discussion, so please follow up there.