Skip to main content

One post tagged with "OpenCode"

View All Tags

Claude Code vs OpenCode

· 10 min read
Guster
Principal Engineer

image

Introduction​

For the past year I have done most of my coding inside a terminal agent. I started with Claude Code because it was the first one that felt like it understood a whole repository, then I moved to OpenCode, now on version 2, for the model freedom. Today I keep both installed and reach for each one depending on the job.

This is not a benchmark post. I am not going to compare task completion scores or token throughput. This is what each tool feels like after living with it, the features I now depend on, and the parts that still annoy me.

The short version​

Claude CodeOpenCode
Made byAnthropicSST, open source
ModelsClaude onlyAny provider, switch mid-session
InterfaceTerminal, IDE, web, mobileTerminal, desktop, server and SDK
Auto modeAuto-accept edits, plan mode, bypassPermission rules per tool and agent
Subagents.claude/agents.opencode/agent
HooksLifecycle hooksPlugins in JS or TS
CostSubscription or APIFree tool, you pay the model
Best forDeep work on large codebasesModel flexibility and scripting

What both get right​

Both tools are terminal first. They read files, run commands, edit code, and keep going until the task is done or they get stuck. Both support MCP servers, project memory files, custom slash commands, and subagents. If you have used one, the mental model transfers to the other almost completely.

The difference is in the details and the philosophy behind them.

Claude Code: the polished default​

Auto mode, plan mode, and permissions​

The feature I miss most when I am not using Claude Code is the permission cycle. Shift+Tab moves between normal mode, auto-accept edits, and plan mode. In auto-accept, the agent edits files without asking, but still asks before running commands. Plan mode flips it around: the agent reads, explores, and writes a plan, but cannot touch anything.

I use plan mode at the start of every unfamiliar task. It is much cheaper to correct a plan than to correct 300 lines of code.

For containers and throwaway branches there is --dangerously-skip-permissions, which removes the prompts entirely. I only run that inside a sandbox with no credentials.

The nice thing is that these modes are visible. I always know which one I am in, and switching is one keystroke.

Subagents​

Claude Code lets me define subagents as markdown files. Each one gets its own context window, its own tool list, and optionally its own model.

---
name: code-reviewer
description: Reviews a diff for bugs, regressions, and missing tests. Use after a feature is implemented.
tools: Read, Grep, Glob, Bash
model: sonnet
---

You are a strict code reviewer. Read the diff, list findings by severity, and do not edit files.

The main agent delegates through the Task tool. I use this for reviews, for exploring a new codebase, and for running the same investigation in parallel. The isolation is the point: a subagent can read fifty files without polluting the main conversation.

Hooks​

Hooks are the feature that makes Claude Code feel like a real tool rather than a chat window. You can run a command before or after a tool call, when the agent stops, when a session starts, and so on. If the hook exits with code 2, the agent is blocked and sees the error.

{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
}
]
}
]
}
}

That one snippet removes an entire class of "the agent forgot to format" problems. I also use a hook to run the linter after edits, and another to append a line to a log whenever a session ends. Hooks are deterministic, and determinism is what agents usually lack.

Memory and commands​

CLAUDE.md is loaded into every session. I keep a short one at the repo root with build commands, conventions, and things the agent should never touch, plus a longer one in ~/.claude/CLAUDE.md with my personal preferences. Custom commands in .claude/commands/ turn repeated prompts into /review, /ship, and /explain.

The ecosystem is the strongest part. The same agent runs in the terminal, in VS Code and JetBrains, in the browser, and on my phone. I can start a task on my laptop, close it, and check on it later. There is also an SDK if I want to build my own automation on top.

Claude Code: what I don't like​

The biggest one is the lock-in. You can switch between Claude models with /model, and you can run through Bedrock or Vertex, but you cannot ask for GPT or Gemini in the middle of a session. If Anthropic has a bad week, so do I.

The second is cost and limits. The subscription is great value until you hit the usage window, and then you are either waiting or paying API rates. I have learned to watch context size and to use subagents partly for cost reasons, not just for isolation.

Third, it is closed source. When a hook misfires or the TUI does something strange, I can report it, but I cannot read the code or patch it. For a tool I use every day, that bothers me more than I expected.

Finally, configuration is JSON heavy. Hooks, permissions, and settings all live in nested JSON, and a typo fails quietly. It works, but it is not pleasant to maintain.

OpenCode: the open one​

Model switching, done properly​

This is the reason I installed OpenCode in the first place. You can switch models mid-session with /models, and more importantly you can assign different models to different agents. Planning runs on a strong model, implementation runs on a cheaper one, and the title generator runs on something tiny.

{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-5-5",
"small_model": "deepseek/deepseek-v4.1-flash-1017",
"agent": {
"review": {
"description": "Reviews changes for bugs and missing tests",
"mode": "subagent",
"model": "openai/gpt-5",
"tools": { "write": false, "edit": false }
}
}
}

The exact model ids change every few months, so run opencode models and use whatever is current.

Provider setup is one command, and keys live in one place. If a new model drops, I add the provider and use it the same day. If I want to keep sensitive code local, I point it at Ollama and nothing leaves the machine. That flexibility is worth a lot to me.

Agents and subagents​

OpenCode ships with two primary agents, build and plan, and you switch with Tab. Custom agents are markdown files with frontmatter, just like Claude Code, but the config surface is broader: model, temperature, prompt, tools, and permissions can all be set per agent.

---
description: Reviews changes for bugs and missing tests
mode: subagent
model: anthropic/claude-sonnet-4-5
tools:
write: false
edit: false
---

You review diffs. Report findings by severity. Do not edit files.

Subagents run in their own session. In OpenCode I can launch several in parallel, and recent versions can run them in the background while I keep working. This is where the multi-model design pays off: I can have three reviewers on three different models and compare what each one catches.

Permissions as configuration​

Instead of a mode toggle, OpenCode asks you to declare rules. You can allow, ask, or deny per tool, and bash rules can match command patterns.

{
"permission": {
"edit": "allow",
"bash": {
"*": "ask",
"git status": "allow",
"git diff*": "allow",
"rm *": "deny"
}
}
}

It is more work to set up than Shift+Tab, but it is also more precise. I can let the agent edit freely while still stopping it from force pushing.

Session tabs​

The feature that surprised me most in OpenCode 2 is session tabs. I can keep several sessions open at once and switch with Ctrl+Tab and Ctrl+Shift+Tab, jump straight to a numbered tab with Ctrl+1 through Ctrl+0, close one with Ctrl+X then W, and reopen it with Ctrl+Shift+T. The tab strip can sit horizontally or vertically, and the labels can show a status dot or a number.

I use this more than I expected. One tab runs the main task, another is a second feature I am poking at, and a third is a scratch session for a question I do not want to pollute the main context with. Before tabs I was either opening another terminal or losing the thread. It is a small feature, but it changes how I work.

The rest of the toolbox​

OpenCode runs a server and a client, which means the TUI, the desktop app, and any script share the same session. I can start a session in the terminal, then attach from the desktop app. There is an SDK, a headless opencode run mode, and a share link for handing a session to a teammate.

It also wires up your language server. Diagnostics come back to the agent automatically, so it sees type errors without running a full build. Plugins are plain JS or TS, so I can hook into tool execution without learning a new config language. And each session can be moved into its own git worktree, which is the cleanest way I have found to run two agents on the same repo without them stepping on each other.

OpenCode: what I don't like​

OpenCode moves fast, and fast means churn. Config keys get renamed, behaviour changes between releases, and occasionally a provider integration breaks for a day. I pin versions on machines where I care about stability.

The configuration surface is large. Claude Code has a handful of concepts, while OpenCode has a config file with dozens of options. That is power, but it is also a weekend of reading docs before it feels right.

Quality depends heavily on the model you plug in. Claude Code is tuned around Claude, and the prompts, tools, and defaults all assume it. OpenCode has to work with everything, so a weak model produces a weak agent. The tool will not save you from a bad model choice.

Finally, there is no single throat to choke. When something breaks, it might be the tool, the provider, the model, or the MCP server. Debugging that chain takes longer than filing a ticket with one vendor.

How I split the work​

  • Claude Code for long, autonomous tasks on a large codebase. Plan mode, hooks, and a model trained alongside the harness still give me the best results when I want to hand over a whole feature.
  • OpenCode for everything else. Quick fixes, model comparisons, local models, scripted runs in CI, and any task where I want a specific model or provider.
  • Both for reviews. I like running a second agent on a different model and diffing the findings.

Which one should you use​

  • If you want the most polished experience and you are happy to pay for Claude, use Claude Code. It is the easiest recommendation for a team that just wants results.
  • If you care about model choice, local inference, open source, or scripting, use OpenCode. It is the better tool for people who like to own their setup.
  • If you are unsure, start with Claude Code to learn the workflow, then try OpenCode for a week. The concepts transfer, and you will know quickly which trade-off you prefer.

Closing thoughts​

I do not think one tool wins. Claude Code is the better product, in the sense that it is more coherent and more polished. OpenCode is the better platform, in the sense that it lets me decide which model runs, where it runs, and how it is wired into my workflow.

The gap between them is closing in both directions. Claude Code keeps adding flexibility, and OpenCode keeps smoothing its rough edges. That is good for all of us. The real winner is the developer who can switch tools without relearning how to think.