All articles
ArticlesOctober 14, 20265 min read

OpenCode 2.0: background service, Code Mode and subagents

OpenCode 2.0 adds one background service for every client, Code Mode for MCP tools, and background subagents. What changed, what breaks, and how to upgrade.

opencodeopencode 2.0coding agentsmcpcode modeopen sourcedeveloper tools
OpenCode 2.0: background service, Code Mode and subagents

OpenCode 2.0 came out on October 12, 2026. Anomaly, the team behind the open-source coding agent, calls it a major overhaul, and for once that is accurate. The agent now runs as one background service on your machine, the server API was rebuilt from scratch, MCP tools are called through generated code by default, and subagents and shell commands can run in the background.

I use several coding agents side by side, so the interesting question for me is not "is it better" but "what changed in how a harness should work". OpenCode 2.0 answers that pretty clearly.

OpenCode 2.0 runs one background service for every client

OpenCode always had a client and server split, but it was mostly a power-user feature. In 2.0 the server starts automatically as a single background process. The TUI, the browser interface and the desktop app all talk to that same process.

In practice that means you can start a session in the terminal and pick it up in the desktop app. Scripts that use the new @opencode/client package find the local service on their own, which Anomaly points out is handy for scheduled tasks. You can also expose the service to other machines and pair it with other apps through opencode pair.

This is the same shape I keep arriving at in my own agent work: the agent is a long-running service, and the UI is just one of its clients. OpenClaw went the same way with its Gateway, which I covered in the OpenClaw 2.0 post. Two big open-source harnesses landing on the same architecture within six weeks is a signal.

A rebuilt API the agent can call on itself

Anomaly is blunt about the old API in the release notes: it "grew haphazardly" and "it was bad". The new one was designed from how millions of daily users actually use OpenCode.

The nice twist is that OpenCode knows its own API and calls it. It can create a git worktree when you start new work and move the current session into it. It can find a stuck session and interrupt it. The agent manages its own workspace instead of waiting for you to do it.

A minimal script with the new client looks like this, per the release notes:

import { OpenCode } from "@opencode/client"
import { Service } from "@opencode/client/service"

const endpoint = await Service.ensure()
const client = OpenCode.make({
  baseUrl: endpoint.url,
  headers: Service.headers(endpoint),
})

const session = await client.session.create({
  location: { directory: process.cwd() },
})

await client.session.prompt({
  sessionID: session.id,
  text: "Review the current changes",
})

Wire that into a cron job or a CI step and you have a reviewer that runs against the same service as your interactive sessions.

Code Mode: why one script beats ten tool calls

This is the change I'd pay the most attention to. OpenCode 2.0 ships a small JavaScript interpreter in @opencode/codemode. It takes MCP servers or OpenAPI endpoints and turns them into functions. The agent writes a script that calls a tool, maps over the results, and calls another tool, all in one round trip instead of one model turn per call.

Every MCP server is opted into Code Mode by default in 2.0. Anomaly's claim is that you can add a thousand MCP servers with minimal context bloat, because the agent discovers and composes them in code rather than loading every tool schema up front.

The idea is not new. Cloudflare described the same approach, also under the name Code Mode, in a September 2025 post. And two weeks ago the Cloudflare cf CLI made a similar bet: give agents structured output and a search command instead of a huge menu. What's new is a popular open-source harness making it the default for every MCP server.

My expectation is that this becomes standard. Models write code better than they juggle long chains of tool calls, and each skipped round trip saves tokens and latency.

Background subagents and shell commands

The other big change is concurrency. The primary agent can hand work to a background subagent and keep going, and you can trigger one by hand, even on a different model. The release notes give the example of spawning a background subagent to review code while you keep prompting.

Shell commands can run asynchronously too, so a long test suite or build doesn't block the conversation, and the agent gets notified when it finishes. If a foreground command or subagent runs longer than you expected, a hotkey moves it to the background.

This is the review loop I want. As I argued in Code has become cheap, review is the bottleneck now. A second model reviewing in the background while the first one keeps building is a practical way to buy more review without more of my time.

Plugins, the SDK, and what breaks

Anomaly built nearly every 2.0 feature as an internal plugin, more than 80 of them, to force the plugin API to stay healthy. TUI plugins moved from experimental to stable. Everything is hot-reloadable, so OpenCode can write a plugin for itself mid-session and use it right away.

There is also @opencode/sdk, the same code that powers the CLI, usable as a library. You can strip it down and run your own flavor on a server or in places like Cloudflare Durable Objects, and any OpenCode client can still connect. The SDK is marked as still in development.

Breaking changes to plan for:

  • 1.0 plugins do not work in 2.0.
  • The server API is completely different, so integrations built on it need rewriting.
  • The TUI config file moved.

The upgrade itself: get on the latest 1.x release, then run opencode upgrade --major. Anomaly suggests pointing OpenCode at the upgrade doc and letting it migrate your setup.

FAQ

Is OpenCode 2.0 free and open source?

Yes. OpenCode is open source. You bring your own model provider or subscription.

What is Code Mode in OpenCode 2.0?

A built-in JavaScript interpreter that turns MCP servers and OpenAPI endpoints into functions. The agent writes one script that calls several tools, instead of making one model round trip per tool call. It is on by default for all MCP servers.

Will my OpenCode 1.0 plugins work?

No. 1.0 plugins are not compatible with 2.0, and the server API changed completely. Other config changes are backwards compatible.


Sources

Cover image: Anomaly / OpenCode

Related articles