OpenCode vs Claude Code 2026: Memory, Cost, Which to Pick

OpenCode vs Claude Code 2026: Memory, Cost, Which to Pick

Say Priya keeps a CLAUDE.md in her repository. On Wednesday she tells Claude Code to "remember that the API tests require a local Redis instance," and it saves the note to auto memory under ~/.claude/projects/<project>/memory/. On Friday she tries OpenCode in the same repository. It finds no AGENTS.md, so it reads her CLAUDE.md. Her written rules come along. Wednesday's Redis note stays behind.

If you search OpenCode vs Claude Code, you have felt a new tool start from zero. Here is the short answer. Both are terminal coding agents. Claude Code comes from Anthropic and is included in paid Claude plans. OpenCode is an MIT-licensed open source agent: you bring a model provider, pay per token, or take OpenCode Go. Both start each session from files a person writes. Neither tool's docs describe memory that one tool shares with the other.

That last point is the one the ranking pages skip. They cover speed, user experience and price. One of the pages I read for this term compares CLAUDE.md with AGENTS.md. None describes what each tool keeps between sessions. This page does. It is an AI agent memory question, and I build Hindsight, the memory layer that plugs into both tools. Every fact below comes from each tool's own docs, read in November 2026.

Below: a side-by-side table, cost, how each tool loads instructions, what each one remembers, skills and plugins, which to pick by task, and how to give both the same memory. If you want the memory part first, see how one install gives OpenCode and Claude Code the same memory.

OpenCode vs Claude Code at a glance

Claude Code is Anthropic's coding agent, documented at code.claude.com. It also has a VS Code extension that, in Anthropic's words, provides "a native graphical interface for Claude Code, integrated directly into your IDE."

OpenCode describes itself as "The open source coding agent" on its GitHub repository. The licence is MIT and the repository shows 228.0k stars as of November 2026. It ships in two release lines, 1.x and 2.x, and the docs home installs 2.x.

PointClaude CodeOpenCode
Who makes itAnthropicOpen source project, MIT licence
How you payA Claude plan, or the Anthropic APIA provider account, Zen per token, or OpenCode Go
Model choiceOpus, Sonnet and Haiku aliasesCatalog from models.dev, /connect and /models
Instruction fileCLAUDE.mdAGENTS.md, with CLAUDE.md as the fallback
Notes the agent writesAuto memory (MEMORY.md plus topic files)None described in the docs
Resumeclaude --continue, claude --resume1.x: opencode --continue. 2.x: /sessions
Config file~/.claude/settings.jsonopencode.json or opencode.jsonc

Models. The Claude Code docs list Opus 5.5 as the default model on Pro, Max, Ultra, Team, Enterprise and the Anthropic API, and list their own defaults for Amazon Bedrock, Google Cloud and Microsoft Foundry (model configuration). OpenCode takes its catalog from models.dev and has sections for local models through Ollama, LM Studio and vLLM, for ChatGPT sign-in, for GitHub Copilot and for OpenRouter. Anthropic is in its native provider list.

Install. OpenCode's docs home gives these lines. The first one installs the 2.x line, because its path is /v2/:

curl -fsSL https://opencode.ai/v2/install | bash
brew install anomalyco/tap/opencode-v2
npm install -g @opencode/cli

The docs home does not say which line the npm command installs. It says the mise use -g opencode command needs mise 2026.10.9 or later, and that older mise versions install OpenCode 1. Claude Code's setup steps are in the Claude Code docs.

The differences matter most in three places: how you pay, how instructions load, and what survives a session. The next three sections take them in that order. If you weigh a third tool, I compare Codex vs Claude Code and Claude Code vs Cursor on the same facts.

OpenCode vs Claude Code cost, as of November 2026

The two tools charge in different ways, so a price table needs two blocks.

Claude Code planPriceClaude Code included
Free$0No
Pro$20 a month, or $17 a month billed annually ($200 up front)Yes
Max$100 a monthYes
Ultra$200 a monthYes
Team standard seat$25 a month, or $20 billed annuallyYes
Team premium seat$125 a month, or $100 billed annuallyYes
Enterprise$20 a seat a month billed annually, plus usage at API rates, 20 seat minimumYes

Source: claude.com/pricing.

OpenCode optionPrice
OpenCode Go$10 a month (OpenCode Go)
Go Plus$40 a month
Zen, Claude Opus 5.5$4.00 input, $20.00 output per 1M tokens (Zen)
Zen, Claude Sonnet 5.5$2.00 input, $10.00 output per 1M tokens
Zen, Claude Haiku 5.5$0.10 input, $0.50 output per 1M tokens

Claude Code runs on a plan with limits. Pro and Max have a five-hour session limit and a weekly limit, and Anthropic states that these limits "are shared across Claude and Claude Code" (Claude Code with your plan). Claude Code also reads an ANTHROPIC_API_KEY variable if you set one. The same article says that key makes Claude Code bill API usage instead of your subscription.

OpenCode lets you bring the account. You can pay per token through Zen, subscribe to Go, or use a provider you already pay for. The Go page also lists models with a daily request limit. The providers page says ChatGPT sign-in usage "counts against your plan, so these models show no cost."

For a sense of scale on the Claude Code side, the Claude Code costs page states an average of "around $13 per developer per active day" across enterprise deployments. That is a deployment average, not a plan price.

AGENTS.md vs CLAUDE.md: how each tool loads its instructions

Start simple. Each tool reads a markdown file a person writes, at the start of a session.

Claude Code loads CLAUDE.md and CLAUDE.local.md from your working directory and every directory above it, ordered from the filesystem root down. Your user file is ~/.claude/CLAUDE.md. Files in subdirectories load on demand. The memory docs advise staying under 200 lines a file and skip a file over 4 MiB. An @path/to/import line pulls in another file, up to four hops deep. That table of locations lists no AGENTS.md. For the full picture, read my guide to the CLAUDE.md file and the Claude Code memory overview.

OpenCode's rules page opens with one sentence: "Add an AGENTS.md file to give OpenCode persistent project guidance." The global file is ~/.config/opencode/AGENTS.md. Project AGENTS.md files load from the workspace directory toward home. Extra files go in an instructions array in opencode.jsonc. Then comes the line that matters here: "In any directory without an AGENTS.md, OpenCode reads CLAUDE.md instead." Without a global AGENTS.md, it reads ~/.claude/CLAUDE.md. In a directory that has both files, AGENTS.md wins.

So OpenCode can run on a repository that only has CLAUDE.md. Instructions cross from Claude Code to OpenCode with no work. If a team runs both tools, you have two clean options.

  1. Keep only CLAUDE.md. OpenCode falls back to it.
  2. Keep one AGENTS.md and make CLAUDE.md a pointer to it:
@AGENTS.md

The common mistake is a directory with both files and different text. OpenCode reads AGENTS.md there and ignores CLAUDE.md, so the two tools follow different rules.

Both files are memory a developer writes by hand. They hold what you remembered to write down. They do not learn from what happened in a session. That is the gap the next section looks at.

OpenCode vs Claude Code memory: what each remembers between sessions

The OpenCode docs and the OpenCode server API reference describe no memory that the agent writes. They describe one persistent file, AGENTS.md, that a person writes. That is a statement about the docs. Third-party plugins exist, and Hindsight ships one.

Claude Code goes one step further. Auto memory is on by default in local sessions, and Claude writes notes of four types (user, feedback, project and reference) into ~/.claude/projects/<project>/memory/. You turn it off with autoMemoryEnabled: false.

Memory featureClaude CodeOpenCode
Instruction fileCLAUDE.mdAGENTS.md, CLAUDE.md fallback
Notes the agent writesAuto memory: MEMORY.md plus topic filesNone in the docs or the server API reference
Where notes live~/.claude/projects/<project>/memory/Not applicable
Loaded at startFirst 200 lines or 25 KB of MEMORY.mdGlobal AGENTS.md and project AGENTS.md files
Session store~/.claude/projects/<project>/<session-id>.jsonl~/.local/share/opencode/opencode.db (OPENCODE_DB overrides it)
Resumeclaude --continue, claude --resume, /resume1.x: --continue, --session, --fork. 2.x: Ctrl+X then L, or /sessions
Transcripts kept30 days by default (cleanupPeriodDays, minimum 1)The CLI page says "Session data, configuration, and state are never removed."
Scope"Auto memory is machine-local."One database file on one machine

The Claude Code resume commands are in the sessions docs. The OpenCode 1.x flags are in the 1.x CLI docs. The 2.x CLI page lists no continue flag, and the TUI page says to press Ctrl+X, then L, or run /sessions.

Picture Marco. He moved from OpenCode 1.x to 2.x last month. On 1.x he typed opencode --continue each morning. On 2.x he opens /sessions and picks Tuesday's session, and the whole transcript is there. Then a new bug needs a new session, and the agent asks again which test runner the repository uses. A resumed session brings back one conversation. A new session starts from AGENTS.md alone.

Two more facts sit inside a session. OpenCode's compaction docs say "Held summaries live in memory and are lost on restart." Its agents page says subagents "run with fresh context in their own child sessions." On the Claude Code side, subagents do not get the main conversation's auto memory, except forks. Neither tool's docs describe reading the other's notes or session store.

If you want to read about persistent memory for OpenCode in particular, my team wrote a post on persistent memory for OpenCode. For the wider field, see agent memory systems compared.

Skills, plugins and subagents in OpenCode and Claude Code

Both tools let you package reusable instructions, and in both a person writes the file.

A Claude Code skill is a folder with a SKILL.md file, at ~/.claude/skills/<name>/SKILL.md for you or .claude/skills/<name>/SKILL.md for a project. Only skill names and descriptions load at launch. The body loads when Claude or you invoke the skill. Plugins ship skills under a namespace, as /plugin-name:skill-name. I cover the details in Claude Code skills explained.

OpenCode's skills page says: "Create a skill to give an agent reusable instructions for a specific task." A person writes each SKILL.md. OpenCode loads plugins from .opencode/plugins/ and ~/.config/opencode/plugins/, keeps commands and agents in their own folders, and documents MCP servers on its own page. If you want a memory server on either tool, read my comparison of memory MCP servers.

The Claude Code docs describe no skill that changes from use. A skill is a file you maintain, the same as CLAUDE.md.

Claude Code vs OpenCode: which one fits your work

Pick on how you want to pay for models and on the work in front of you. Then give both tools the same memory. I would not pick on a benchmark that changes next month.

If you...Start with
Already pay for Claude Pro, Max, Ultra, Team or EnterpriseClaude Code
Want to choose the model per task, or run a local modelOpenCode
Want the agent to take its own notes with no extra installClaude Code, which has auto memory on by default
Want an MIT-licensed agent you can read and forkOpenCode
Work in VS Code and want a graphical panelClaude Code's VS Code extension
Pay for ChatGPT and want to use that planOpenCode's ChatGPT sign-in
Run both on one repositoryOne AGENTS.md, a CLAUDE.md that holds @AGENTS.md, and one Hindsight bank

You don't need to choose one forever. Instructions already cross between the tools through CLAUDE.md. Memory is the part that does not cross without a memory layer. Claude Code keeps auto memory notes, and neither tool's docs describe sharing what a session taught the agent with the other. Claude Code vs OpenCode then comes down to which interface and billing you prefer.

OpenCode vs Claude Code with memory that learns: one install for both

My view is simple. An instruction file you write by hand is not memory that learns. It holds what you remembered. It does not hold what the last session taught the agent. Hindsight's Coding Agents plugin covers both tools with one package. The commands are on the Coding Agents page:

npx @vectorize-io/hindsight-coding-agents install claude-code
npx @vectorize-io/hindsight-coding-agents install opencode    # OpenCode 1.x
npx @vectorize-io/hindsight-coding-agents install opencode2   # OpenCode 2.x

For Claude Code, the install writes 3 hooks into ~/.claude/settings.json, adds an MCP server at user scope, and installs a skill at ~/.claude/skills/hindsight-coding-agent. For OpenCode, it writes a plugin entry into ~/.config/opencode/opencode.json, with native tools and no MCP server. There is no ingest command: a repository's history and your conversations flow into its memory bank in the background as you work.

Two columns showing what Claude Code and OpenCode load at session start: CLAUDE.md files and MEMORY.md for Claude Code, AGENTS.md files with a CLAUDE.md fallback for OpenCode, a dashed fallback arrow between them, and one Hindsight bank band under both

The bank is per repository, named coding-agent::{gitProject}, and every agent on that repository shares it. The config file is ~/.hindsight/coding-agent.json. Server modes are cloud (the default), self-hosted and daemon. For Claude Code, recall runs on the first prompt of a session and retain runs when the session stops. The OpenCode plugin reads and writes the same repository bank.

Hindsight states the result on its sdebench: a coding agent over 61 real repository tasks, mean of 3 runs, with and without memory. For Claude Code, corrections per task fall from 0.85 to 0.36, and cost per task falls from $0.445 to $0.338. Hindsight also states that "every run solves 60–61 of the 61 either way." So these figures measure corrections and cost, not accuracy. See the rest on the Hindsight benchmark results page.

View Hindsight on GitHub. It is open source under MIT.

Picture Priya again. She runs install claude-code and install opencode2 in cloud mode. Wednesday's Claude Code session is retained to the repository bank when it stops. On Friday OpenCode works against that same bank, so the Redis note she gave Claude Code sits in the memory both tools use. Her CLAUDE.md still carries the rules. The bank carries what the sessions taught.

What to do next

  1. Pick by how you pay for models: a Claude plan for Claude Code, or a provider, Zen or Go for OpenCode.
  2. Keep one instruction file. Let the other tool import it or fall back to it.
  3. Check cleanupPeriodDays for Claude Code, and know that OpenCode keeps sessions in ~/.local/share/opencode/opencode.db.
  4. Install one memory layer for both tools, with the commands above.

Try it on one repository first. Sign up for Hindsight Cloud and run the two install commands. There is no setup command for ingest, and the self-hosted and daemon modes let you run it on your own machine.

Frequently Asked Questions

Is OpenCode free?

The software is MIT-licensed, so the agent costs nothing. You pay for models: a provider account, Zen per token, or OpenCode Go at $10 a month, as of November 2026. The Go page states that free models have a daily request limit.

Is Claude Code free?

The Claude Free plan does not include Claude Code. It starts with Pro at $20 a month, as of November 2026. You can also run Claude Code on an Anthropic API key, which bills API usage instead of your subscription.

Can I use Claude models inside OpenCode?

Yes. Anthropic is in OpenCode's native provider list, and Zen sells Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5 per token. Opus 5.5 costs $4.00 input and $20.00 output per 1M tokens, as of November 2026. Connect a provider with /connect, then pick a Claude model with /models.

Can I run a local model with OpenCode?

Yes. The providers page has sections for Ollama, LM Studio and vLLM, so OpenCode can use a model that runs on your own machine. Connect a provider with /connect, then pick a model with /models. The docs say the model catalog comes from models.dev.

Does Hindsight work with other coding agents?

Yes. The Coding Agents install command takes other targets, among them codex, cursor-cli, copilot-cli and kilo. Hindsight keeps one memory bank per repository, named coding-agent::{gitProject}, and every agent that works in that repository shares it, Claude Code and OpenCode included.