Claude Code vs OpenCode: seven ways developers split the work, and which of your Claude Code rules OpenCode enforces
OpenCode allows by default and lets the last matching rule win; Claude Code asks first and checks denies first. In every split developers use, from a second CI reviewer to a local fallback, that gap decides what still protects the repository, and the fixes are porting by hand, a hook adapter, a config converter, or a policy source neither tool owns.
Contents
OpenCode’s pitch is the reverse of Claude Code’s: any provider, any model, local ones included. That makes model choice look like the axis to compare them on. But OpenCode 2 also reads your CLAUDE.md, loads skills from .claude/skills, and since October 30, 2026 can send every model call through a logged-in copy of Claude Code. Run that way, the model is Claude and the binary is Claude Code, and OpenCode still loads none of your hooks, settings or permission rules. The instructions travel. Stock OpenCode loads nothing that enforces a rule: you rewrite those rules in OpenCode’s terms, pass them through an adapter or converter, or keep them somewhere both tools read.
This is the fifth piece in a series, after Codex, Cursor, Gemini CLI and GitHub Copilot. OpenCode differs from those four in one way that shapes most of the cases below: it changed major versions in autumn 2026. The current docs describe OpenCode 2. The OpenCode 1 docs still sit under /v1/, and some of what older comparisons rely on, such as language server diagnostics, the GitHub app and asking by default before touching files outside the project, is OpenCode 1 only.
Same labels as before. Documented means a vendor’s docs, or a project’s own committed files, show the mechanism. Reported means a named person published their setup or results and I am relaying them without having reproduced them. Five of the seven cases are documented and two are reported. Two short sections on what OpenCode reads and how it decides permissions come first, because most of the cases depend on them.
What does OpenCode read from a Claude Code setup?
Your instructions and your skills. Nothing in its docs says it reads anything that enforces a rule. OpenCode’s instructions page: “In any directory without an AGENTS.md, OpenCode reads CLAUDE.md instead. Without a global ~/.config/opencode/AGENTS.md, it reads ~/.claude/CLAUDE.md.” That per-directory fallback came back in v2.3.1 on November 18. The skills page lists .claude/skills and ~/.claude/skills as compatibility sources. OPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1 stops the CLAUDE.md fallback, and OPENCODE_DISABLE_CLAUDE_CODE=1 also stops the .claude skills.
Neither the V2 nor the V1 docs mention .claude/agents, .claude/commands, or the hooks and permission rules in .claude/settings.json. OpenCode has its own version of each: Markdown agents in .opencode/agents, commands in .opencode/commands, and TypeScript plugins that hook tool calls. Plugins written against the V1 API need porting, because, per the migration guide, “V1 plugin implementations do not run in V2.” Running Claude Code hooks inside OpenCode takes an adapter. oh-my-openagent had one, a “Claude Code settings.json compatibility layer,” but its current README says it “runs on senpi, our fork of pi,” and treats the OpenCode edition as something to migrate from. A one-star plugin, opencode-hooks-plugin, reads .claude/settings.json and runs SessionStart hooks; letting a PreToolUse hook block a call is opt-in, with preToolDecisions defaulting to false, and needs OpenCode 2.0.29 or later.
How does OpenCode decide what an agent may do, compared with Claude Code?
From the opposite default, and in the opposite order. OpenCode’s permissions page gives every agent this base policy:
“The last matching rule wins,” and agent rules “are appended after global rules.” Claude Code’s permissions docs work the other way. Its default mode “Prompts before most edits, shell commands, and network requests,” and its rules are evaluated “deny, then ask, then allow,” so “An allow rule can’t carve an exception out of a deny rule.” Moving a Claude Code rule set into OpenCode’s format means rewriting it. Overlapping rules have to run from broad to narrow, and anything an agent appends later can still reopen what a global deny closed.
The plan agent is where this bites. Its source at v2.4.5 adds three rules: allow questions, deny edits, allow edits under ~/.opencode/plan. Shell isn’t mentioned, so it inherits the base allow and runs without a prompt, although the repository README still says plan “Asks permission before running bash commands.” Subagents that plan starts run under their own permissions, and per the tools page the worktree utilities other than worktree_remove “do not request a built-in permission action.” So plan mode is a prompt plus an edit rule, not a read-only boundary. If a planning session must not change anything, deny its shell and its delegation, and give it a read-only checkout.
Two more defaults. “The default policy allows external_directory,” so reads and edits outside the project don’t prompt; V1 asked. And “shell runs with the host user’s filesystem, process, and network authority.” The docs describe no sandbox. Claude Code’s sandbox is off by default too, so the comparison is opt-in OS isolation on one side and none described on the other. Claude Code’s docs also say a Bash rule “isn’t a security boundary around the program,” which I went through in ten permission-rule bypasses. Neither rule list is a wall.
How do Claude Code and OpenCode share one instruction file?
Through AGENTS.md, with a one-line CLAUDE.md that imports it (documented). The reverse order is the trap, because the two tools resolve the files in opposite directions. OpenCode: “A directory’s AGENTS.md always wins over its CLAUDE.md.” Claude Code, per its memory docs: a repository with both gets “Your CLAUDE.md files only” by default. A ~/.claude/CLAUDE.md doesn’t count for that check, and a setting can load both; I covered the details in when Claude Code reads AGENTS.md.
SAP’s sailing-analytics shows the gap. Its opencode.jsonc is one line of configuration:
The repository commits both an AGENTS.md and a CLAUDE.md, and the CLAUDE.md doesn’t import the other file. OpenCode discovers AGENTS.md and loads CLAUDE.md through instructions, so it gets both. Claude Code, on default settings, gets only CLAUDE.md. The two files overlap on the main Java rules (final wherever possible, no early returns), so most of it reaches both tools anyway. The rule to annotate literal arguments with the parameter name sits only in AGENTS.md, and Claude Code doesn’t load it on default settings.
GWToolboxpp uses that order, with one detail to avoid copying. Its CLAUDE.md is the single line Agent instructions for this repo live in @AGENTS.md., so Claude Code is meant to pull the shared file in by import while OpenCode reads it directly. Watch the punctuation. An open Claude Code issue reports that an import followed by a colon or comma is silently skipped, and a comment there reports the same with a trailing period. Anthropic’s memory docs show @AGENTS.md alone on its own line, which avoids the question. A root import also doesn’t discover nested AGENTS.md files, which OpenCode reads per directory, so a nested AGENTS.md needs a CLAUDE.md beside it with its own import.
Can OpenCode be a second reviewer next to claude-code-action?
Yes. Three repositories document this split, and two still configure an integration OpenCode has withdrawn (documented). quantumssh records the whole arc in its decision records. In June, ADR-0025 added OpenCode on DeepSeek as a second pull request reviewer beside Claude, because “different models catch different classes of issues,” at a stated cost: it “Doubles the per-PR inference API cost.” In September, ADR-0032 made the model a repository variable, because a provider can retire a model id, and required proof that a review was posted. The trigger was the Claude reviewer: two green runs on one pull request and no report. “A green check has not meant a review,” and the OpenCode job had the same gap.
In October the DeepSeek account ran out of credit. Runs failed from October 13, and on October 28 ADR-0045 took OpenCode off automatic review: “reviews come from Claude and Codex, and opencode runs only when someone asks for it.” The reviewer itself also had to be rebuilt. OpenCode’s v2.2.0 release on October 27 says: “The OpenCode GitHub Action is no longer published. Remove it from your workflows.” ADR-0049, accepted October 30, adds that “The OpenCode 2 CLI has no github command.” Since then the project downloads a pinned OpenCode 2 build and checks its SHA-256, runs on OpenCode Go (OpenCode’s own subscription for open-weight models), and posts the report from a separate job that holds the write-scoped token but no provider key and runs no model.
Among ADR-0049’s other controls, these are worth copying. The permission configuration “denies everything except reading, searching and starting subagents,” and subagents inherit it. The run has no --auto, so anything not granted is rejected. OpenCode ignores any opencode.json or .opencode/ in the checkout, because a contributor’s config “could otherwise grant permissions, load plugins or start local MCP servers.” Only an owner, member or collaborator can trigger a run. The job checks out the head commit resolved during its fork check and builds the diff from that same read’s base and head, so a later push can’t swap the code under review. It refuses fork heads, deletes every symlink in the checkout, and lets the agent read outside the checkout only in /etc and the prepared pull request files. It is the same defence claude-code-action uses when it restores Claude’s config from the default branch for an untrusted author.
The other two reference the withdrawn action. ankarhem/nix-config configures three parallel review jobs for eligible pull requests: two OpenCode jobs, one on a GLM coding plan and one on a free model route that OpenCode serves, plus claude-code-action on a Claude subscription token running Anthropic’s code-review plugin. The workflow’s comment on the free route says prompts “may be used to train” future models. In Algoshred/vibecontrols-plugin-sdk, the pr-check.yml workflow schedules a Claude Opus review for every pull request to main that passes its gate, and three OpenCode reviewers only when a repository variable switches them on. If you copy either, copy quantumssh’s later version instead.
Can Claude Code plan while an OpenCode model writes the code?
Two small plugins do it, and their default write mode skips OpenCode’s asks (documented). claudelegate describes itself as a Claude Code plugin where “Claude plans and reviews while a cheaper model writes the code,” with the worker in OpenCode on Ollama, llama.cpp, a LiteLLM proxy or a hosted provider. claude-opencode-delegate has the same split: “Claude stays the orchestrator. It plans the work, briefs the other model, reviews the diff, and runs the tests.” It “shells out to the opencode CLI,” so the worker runs under OpenCode’s auth, config and permissions.
Read their permission sections before installing either. claudelegate’s write mode runs opencode run with --agent build --auto, and its README warns that “--auto approves every ask rule.” claude-opencode-delegate’s write mode keeps “the existing default auto: true.” In those default write configurations only a deny stops the worker, whatever Claude Code’s settings say. claude-opencode-delegate also accepts mode: "write" with auto: false, in which case a non-interactive OpenCode rejects anything that would ask. Claude reviews the diff after the fact. What crosses between the tools is an artifact, as in the Codex split, and the approval does not cross with it.
Can you use a Claude subscription in OpenCode?
Yes, through a local Claude Code since October 30, after a direct route that ended in March (documented). OpenCode 1 bundled a plugin that signed in with a Claude Pro or Max account. On January 9, 2026, users reported (issue #7410) that Claude Max had stopped working in OpenCode, with the API answering, per #7471:
This credential is only authorized for use with Claude Code and cannot be used for other API requests
On March 19, pull request #18186, titled “anthropic legal requests,” removed the built-in plugin, and v1.3.0 shipped without it on March 22. The V1 provider docs now say “Anthropic explicitly prohibits this.” OpenCode 2.2.3 added a different route, the Claude Agent provider: “Claude Agent runs Claude Code on your machine,” signed in with claude auth login, and “Claude Code calls the model, and OpenCode does everything else.” For a subscription login, the cost OpenCode displays is “None, your plan covers it.”
Anthropic’s legal and compliance page draws the line this design sits next to. Anthropic “does not permit third-party developers to offer Claude.ai login into their own applications, or to route requests through Free, Pro, Max, or Ultra plan credentials on behalf of their users.” It also says this doesn’t prevent “an end user from signing in to the unmodified Claude Code binary with their own Claude subscription.” That page doesn’t name OpenCode’s Claude Agent provider. The provider also documents rotating between several Claude logins when one hits its usage limit; that is the feature to read Anthropic’s terms against before you turn it on.
What reaches the model is the limiting case of this article. Per OpenCode’s page, “Claude uses OpenCode’s tools and permissions instead of Claude Code’s built-in tools,” and “Your Claude Code settings, CLAUDE.md files, hooks, MCP servers, skills, and memory are not loaded.” That sentence is about Claude Code’s own loader. OpenCode’s loader still runs, so the contents of AGENTS.md or the CLAUDE.md fallback arrive as OpenCode instructions, and OpenCode lists eligible skills by ID, name and description, loading the body when a skill is invoked. Claude Code’s built-in base instructions stay in front of them. Your hooks and your permission rules do not arrive. Balázs Csorba tested the route on OpenCode 2.2.4 and Claude Code 2.1.314 (reported): a small bug fix with Haiku 5.5 took three steps and about five seconds, “roughly $0.003 at list prices.” By his account it works, and what runs is Claude’s model under OpenCode’s permission policy.
Can OpenCode with a local model stand in when Claude Code is unavailable?
For some tasks, if the model can make tool calls (reported). Viktor Gamov wrote up his fallback for when Claude is offline in May, on OpenCode 1.14.48 and Pi, driving Ollama models on a laptop with 64 GB of RAM. With qwen2.5-coder:7b, neither agent wrote a file in a FizzBuzz test, because the model “only replies in plain text, so neither agent can use tool calls with it.” Only qwen3-coder:30b produced usable tool calls on his machine. His summary: “A local agent which mostly works is better than a great one you can’t access.”
In OpenCode 2 the setup is short. Per the providers page, it “probes http://127.0.0.1:11434” and adds the completion models Ollama serves; LM Studio and vLLM have local discovery too, though discovered vLLM models “start with tools disabled,” which is exactly the capability Gamov’s test turned on. Local inference keeps the model traffic on the machine, not every tool call: Gamov added Tavily as a remote MCP server for web search.
Claude Code can reach local models too, just not with Anthropic’s support. Ollama’s Claude Code integration connects it “to local and cloud models through its Anthropic-compatible API.” Anthropic’s LLM gateway page says it “doesn’t support routing Claude Code to non-Claude models through any gateway.” OpenCode treats local and non-Claude models as first-class; Claude Code treats them as your problem.
Does the same model do better in OpenCode or in Claude Code?
On one published refactor, OpenCode finished in half the time, with one attempt per tool (reported). Chizaram Ken, writing for LogRocket in May, gave Claude Opus 4.6 the same Next.js refactor in both tools. Claude Code took 14 minutes and logged two code mistakes; OpenCode took 7 and logged none, with two environment problems on each side. Both builds passed with zero TypeScript errors. His suggestion: “run OpenCode in planning mode to map the refactor, then use Claude Code or OpenCode for execution.” That was before OpenCode 2, and, as above, plan mode today still lets shell commands through.
Read it as a reason to measure, not as a result. The HarnessTax study held the model fixed across Claude Code, Codex and Pi and found cost gaps far more often than success gaps. For your own repository, run the same task several times in each tool and count tokens and corrections.
Can one policy source cover both Claude Code and OpenCode?
For hooks and permission rules, yes, if you author them outside both tools (documented). Stock OpenCode imports none of Claude Code’s settings, but two projects generate or enforce controls for both. rulesync lists rules, skills, hooks and permissions as targets for Claude Code and for OpenCode, with “OpenCode V1” as a separate target. Its pull request #3605, merged October 22, let generated OpenCode hooks “deny the call,” the job a PreToolUse hook does in Claude Code; that was the OpenCode 1 hook, and v41.0.0 two days later moved the opencode target to OpenCode 2, where hooks become a plugin. ruler covers instructions, MCP servers and skills for both.
OpenCode’s own Console goes the other way and reaches into Claude Code. Its harnesses page sets up Claude Code with npx @opencode/console setup claude-code, after which Claude Code gets “the workspace’s policies, checked before every tool call,” plus its MCP servers, skills and instructions. The integration page adds the limits: “Policies are checked by hooks in your Claude Code settings, so they hold only while those settings are in place,” and provider rules don’t apply in Claude Code. With --keep-provider, Claude Code keeps its own sign-in, a Claude subscription included, and still gets the policies. Without it, the Claude Code harness page says Claude Code can use “any paid or Go model, including GPT, Gemini, and open models” through Console’s gateway, billed to the workspace. So OpenCode’s company can sit in Claude Code’s tool-policy path without touching inference, or in both. Whether a generated hook behaves the same in both tools is still something to test per rule.
Which Claude Code and OpenCode split should you start with?
This is my read of the sources, not a measurement. Start with the instruction file, because it costs one line: AGENTS.md as the shared source, a CLAUDE.md that imports it, and an import for every nested AGENTS.md.
Then try the review lane the way quantumssh ended up running it: on request from trusted authors only, a pinned OpenCode 2 CLI, a read-only policy that subagents inherit, project config ignored, a different provider from your Claude reviewer, and posting done by a separate job without the provider key. Read its findings for a few weeks. If they repeat what Claude’s review already said, you have your answer. Either way, a second provider now receives each diff you submit. quantumssh’s ADR-0032 calls OpenCode Go “a new party in the path,” and ankarhem’s free route may train on what it receives.
Before OpenCode writes anything in a repository where Claude Code’s hooks or deny rules do the protecting, write its policy yourself: shell set to ask or deny with a short list of allowed commands after it, and an external_directory rule. If plan must not change anything, deny its shell and its delegation and give it a read-only checkout. If you’d rather keep a hook you already trust, opencode-hooks-plugin can run a supported PreToolUse hook from .claude/settings.json with preToolDecisions on; test that it blocks before relying on it. For the delegation plugins in their default write configurations, only deny holds.
Skip the second tool if the draw is your Claude plan in a different interface. The Claude Agent provider gives you Claude’s model and your instructions, without your hooks, settings or permission rules, on a route Anthropic’s terms don’t name. Add OpenCode when you want a model Anthropic won’t support in Claude Code, or one policy layer over both, and plan to rebuild the guardrails: rewritten, run through an adapter, converted, or moved somewhere both tools read.
01 / Discussion
No comment section here — all discussions happen on X.