Use OpenCode from inside Claude Code for code reviews or to delegate tasks to OpenCode.
This plugin is for Claude Code users who want an easy way to start using OpenCode from the workflow they already have.
Note
This is an independent community project. It is not affiliated with or endorsed by the OpenCode project, Anthropic, or OpenAI.
/opencode:reviewfor a normal read-only OpenCode review/opencode:adversarial-reviewfor a steerable challenge review/opencode:rescue,/opencode:transfer,/opencode:status,/opencode:result, and/opencode:cancelto delegate work, hand off sessions, and manage background jobs
- A working local OpenCode install and provider configuration.
- Usage is billed by whichever OpenCode provider/model you select.
- Node.js 18.18 or later
The plugin starts its own local opencode serve on demand, bound to 127.0.0.1 and protected with a per-server random password (HTTP Basic auth), so other local processes cannot reach its API. If you point the plugin at your own server via OPENCODE_COMPANION_SERVER_URL and that server is password-protected, also export OPENCODE_SERVER_PASSWORD (and OPENCODE_SERVER_USERNAME if you customized it).
Add the marketplace in Claude Code:
/plugin marketplace add TheRealDinghyDog/opencode-plugin-ccInstall the plugin:
/plugin install opencode@opencodeReload plugins:
/reload-pluginsThen run:
/opencode:setup/opencode:setup will tell you whether OpenCode is ready. If OpenCode is missing and npm is available, it can offer to install OpenCode for you.
If you prefer to install OpenCode yourself, use:
npm install -g opencode-aiIf OpenCode is installed but no provider is configured yet, follow your OpenCode provider setup flow and rerun /opencode:setup.
After install, you should see:
- the slash commands listed below
- the
opencode:opencode-rescuesubagent in/agents
One simple first run is:
/opencode:review --background
/opencode:status
/opencode:resultRuns a normal OpenCode review on your current work. It gives you the same quality of code review as running /review inside OpenCode directly.
Note
Code review especially for multi-file changes might take a while. It's generally recommended to run it in the background.
Use it when you want:
- a review of your current uncommitted changes
- a review of your branch compared to a base branch like
main
Use --base <ref> for branch review. It also supports --wait and --background. It is not steerable and does not take custom focus text. Use /opencode:adversarial-review when you want to challenge a specific decision or risk area.
Examples:
/opencode:review
/opencode:review --base main
/opencode:review --backgroundThis command is read-only and will not perform any changes. When run in the background you can use /opencode:status to check on the progress and /opencode:cancel to cancel the ongoing task.
Runs a steerable review that questions the chosen implementation and design.
It can be used to pressure-test assumptions, tradeoffs, failure modes, and whether a different approach would have been safer or simpler.
It uses the same review target selection as /opencode:review, including --base <ref> for branch review.
It also supports --wait and --background. Unlike /opencode:review, it can take extra focus text after the flags.
Use it when you want:
- a review before shipping that challenges the direction, not just the code details
- review focused on design choices, tradeoffs, hidden assumptions, and alternative approaches
- pressure-testing around specific risk areas like auth, data loss, rollback, race conditions, or reliability
Examples:
/opencode:adversarial-review
/opencode:adversarial-review --base main challenge whether this was the right caching and retry design
/opencode:adversarial-review --background look for race conditions and question the chosen approachThis command is read-only. It does not fix code.
Hands a task to OpenCode through the opencode:opencode-rescue subagent.
Use it when you want OpenCode to:
- investigate a bug
- try a fix
- continue a previous OpenCode task
- take a faster or cheaper pass with a smaller model
Note
Depending on the task and the model you choose these tasks might take a long time and it's generally recommended to force the task to be in the background or move the agent to the background.
Important
Rescue tasks default to a write-capable run using OpenCode's stock build agent under your own OpenCode permission configuration. Permission categories OpenCode gates behind an approval prompt (external-directory access, .env reads, doom-loop protection) are automatically denied in these headless runs — the plugin never approves a gated request on your behalf. Note that OpenCode permissions are approval-level controls, not an operating-system sandbox; run the OpenCode server in a container or as a restricted user if you need a hard filesystem boundary.
It supports --background, --wait, --resume, and --fresh. If you omit --resume and --fresh, the plugin can offer to continue the latest rescue thread for this repo.
Examples:
/opencode:rescue investigate why the tests started failing
/opencode:rescue fix the failing test with the smallest safe patch
/opencode:rescue --resume apply the top fix from the last run
/opencode:rescue --model openai/gpt-5.4-mini --effort high investigate the flaky integration test
/opencode:rescue --model spark fix the issue quickly
/opencode:rescue --background investigate the regressionYou can also just ask for a task to be delegated to OpenCode:
Ask OpenCode to redesign the database connection to be more resilient.
Notes:
- if you do not pass
--modelor--effort, OpenCode chooses its own defaults. - if you say
spark, the plugin maps that toopenai/gpt-5.3-codex-spark - follow-up rescue requests can continue the latest OpenCode task in the repo
Transfer imports the current Claude Code JSONL transcript into a resumable OpenCode session with visible user and assistant turn history. Use it when you started a debugging or implementation conversation in Claude Code and want to continue that same context directly in OpenCode.
Examples:
/opencode:transfer
/opencode:transfer --source ~/.claude/projects/-Users-me-repo/<session-id>.jsonlThe plugin's existing SessionStart hook supplies the current transcript path automatically; --source is available as a manual override.
Shows running and recent OpenCode jobs for the current repository.
Examples:
/opencode:status
/opencode:status task-abc123Use it to:
- check progress on background work
- see the latest completed job
- confirm whether a task is still running
Shows the final stored OpenCode output for a finished job.
When available, it also includes the OpenCode session ID so you can reopen that run directly in OpenCode with opencode --session <session-id>.
Examples:
/opencode:result
/opencode:result task-abc123Cancels an active background OpenCode job.
Examples:
/opencode:cancel
/opencode:cancel task-abc123Checks whether OpenCode is installed and authenticated. If OpenCode is missing and npm is available, it can offer to install OpenCode for you.
You can also use /opencode:setup to manage the optional review gate.
/opencode:setup --enable-review-gate
/opencode:setup --disable-review-gateWhen the review gate is enabled, the plugin uses a Stop hook to run a targeted OpenCode review based on Claude's response. If that review finds issues, the stop is blocked so Claude can address them first. The gate also blocks stopping when the OpenCode reviewer is unavailable; restore OpenCode and rerun /opencode:setup, or disable the gate with /opencode:setup --disable-review-gate.
Warning
The review gate can create a long-running Claude/OpenCode loop and may drain usage limits quickly. Only enable it when you plan to actively monitor the session.
/opencode:review/opencode:rescue investigate why the build is failing in CI/opencode:adversarial-review --background
/opencode:rescue --background investigate the flaky testThen check in with:
/opencode:status
/opencode:resultThe OpenCode plugin wraps a local opencode serve process. It uses the global opencode binary installed in your environment and OpenCode's normal provider/configuration state.
If you want to change the default model used by the plugin, configure it in OpenCode. You can also pass a provider/model pair explicitly:
/opencode:rescue --model openai/gpt-5.4-mini --effort high investigate the flaky integration test--effort is forwarded to OpenCode as the provider-specific message variant.
Delegated tasks and any stop gate run can also be directly resumed inside OpenCode by running opencode --session <session-id> with the specific session ID you received from /opencode:result or /opencode:status, or by selecting it from the list.
This way you can review the OpenCode work or continue the work there.
If you are already signed into OpenCode on this machine, that account should work immediately here too. This plugin uses your local OpenCode CLI authentication.
If you only use Claude Code today and have not used OpenCode yet, configure an OpenCode provider first. Run /opencode:setup to check whether OpenCode is ready.
No. This plugin delegates through your local OpenCode CLI and a headless opencode serve process on the same machine.
That means:
- it uses the same OpenCode install you would use directly
- it uses the same local authentication state
- it uses the same repository checkout and machine-local environment
Yes. If you already use OpenCode, the plugin picks up the same configuration.
Yes. Because the plugin uses your local OpenCode CLI, your existing sign-in method and config still apply.
If you need to point a provider at a different endpoint, configure that in OpenCode and rerun /opencode:setup.
The plugin runs entirely locally and collects nothing. Your prompts and code go only to the AI providers you configured in your own OpenCode install. See PRIVACY.md for details.
This project began as a conversion of OpenAI's codex-plugin-cc (Apache-2.0) — the Codex companion plugin for Claude Code — into an OpenCode companion. The plugin surface (commands, background jobs, session transfer) descends from that work; the OpenCode server integration, security model, and test contract were built for this project. The complete pre-conversion history is preserved in this repository; the fork point is tagged codex-fork-point. See NOTICE for license attribution and docs/history/ for the original conversion plan.