Run opencode as a subagent inside Claude Code.
Get a second opinion on your diff, or hand off a long task to a different model — without leaving Claude Code.
A community port of
openai/codex-plugin-ccthat drives your localopencodeCLI instead of Codex. Not affiliated with OpenAI, Anthropic, or the opencode project.
Claude Code is good at writing code, and less good at grading its own homework. This plugin puts a second, independent model in the loop:
- Review — a fresh agent reads your diff with no memory of why you wrote it that way.
- Delegate — long or grindy tasks run in the background on a cheaper model while Claude stays responsive.
- Second opinion — different provider, different failure modes. Any provider
opencodesupports works, including the OpenCode Go plan (opencode-go/*).
| Command | What it does |
|---|---|
/opencode:review |
Read-only review of your working tree or branch diff |
/opencode:adversarial-review |
Same, but the prompt attacks the design: tradeoffs, assumptions, failure modes |
/opencode:rescue |
Hand a task to opencode (write-capable by default) |
/opencode:status |
List background jobs |
/opencode:result |
Print a finished job's output |
/opencode:cancel |
Kill a running job |
/opencode:setup |
Readiness check + toggle the optional stop-time review gate |
Plus the opencode-rescue subagent, so plain English works too: "Ask opencode to redesign the DB connection to be more resilient."
- Claude Code
opencodeCLI onPATH, signed in (opencode providers login)- Node.js ≥ 18.18
No other dependencies. The plugin is ~400 lines of Node stdlib.
From this marketplace:
/plugin marketplace add hieuvu7/opencode-plugin-cc/plugin install opencode@opencode-cc/reload-pluginsThen verify your setup:
/opencode:setupOr from a local clone — point the marketplace at the checkout, and edits to the plugin apply without reinstalling:
git clone https://github.com/hieuvu7/opencode-plugin-cc.git/plugin marketplace add /absolute/path/to/opencode-plugin-cc/opencode:review # uncommitted working tree
/opencode:review --base main # everything on this branch
/opencode:review --background # returns a job id immediatelyopencode's read-only plan agent inspects the diff with git itself, so nothing gets edited. Multi-file reviews take a while — prefer --background, then /opencode:status and /opencode:result.
Adversarial mode takes optional focus text after the flags:
/opencode:adversarial-review --base main challenge the caching and retry design
/opencode:adversarial-review --background look for race conditions/opencode:rescue investigate why the tests started failing
/opencode:rescue --read-only dig into the regression
/opencode:rescue --model opencode-go/kimi-k3 --variant high fix the flaky integration test
/opencode:rescue --resume apply the top fix from the last run- write-capable by default (opencode
buildagent);--read-onlyfor investigation only - omit
--model/--variantand your own opencode config defaults apply - models are
provider/model— runopencode modelsto list them --resumecontinues the newest opencode thread from this repo;--freshforces a new one- a job is killed as stalled if opencode emits no output for 2 minutes after start or 10 minutes mid-run;
--timeout-ms <n>overrides both windows
/opencode:status
/opencode:result task-abc123
/opencode:cancel/opencode:result prints the stored output plus an opencode --session <id> command, so you can pick up the same thread in the opencode TUI.
/opencode:setup --enable-review-gate
/opencode:setup --disable-review-gateWith the gate on, a Stop hook runs a working-tree review whenever Claude tries to finish. A verdict of FIX FIRST blocks the stop and feeds the findings back so Claude addresses them.
Warning
The gate can create a long Claude↔opencode loop and burn quota. Only enable it while you are watching the session. It is off by default.
Claude Code
└─ commands / opencode-rescue subagent
└─ scripts/opencode-companion.mjs
└─ opencode run --format json --auto --agent <plan|build> …
The companion spawns the CLI, folds its NDJSON event stream into a single result, and stores jobs (id, status, session id, output) under a per-workspace state directory. --background re-execs the companion detached and returns a job id right away. Your own opencode.json and agent config are used as-is.
Two details that matter for headless opencode, learned the hard way:
- stdin is closed —
opencode runhangs forever on an inherited non-TTY stdin. --autois passed — otherwise permission prompts block a run with nobody there to answer.
- No
/transferequivalent — opencode'simportconsumes its own export format, not Claude's.jsonl. - One companion script over the plain CLI, instead of the Codex app-server JSON-RPC broker (~400 lines vs ~6k).
npm testPure node:test, no framework. Contributions welcome — issues and PRs are the right place for bugs, new commands, and provider quirks. Keep the dependency count at zero.
Layout:
.claude-plugin/marketplace.json
plugins/opencode/
.claude-plugin/plugin.json
commands/ # 7 slash commands
agents/ # opencode-rescue subagent
hooks/ # optional Stop review gate
scripts/ # opencode-companion.mjs + hook
tests/
Apache-2.0.