Back Original

OpenCode 2.0

The Service

opencodepid 48213Running

Sessions

The API

SessionNew session

YOU

Start rate limiting uploads in a new worktree.

execute{ code }

opencode.worktree_create[name=rate-limit]

opencode.session_rename[title=Rate limit uploads]

opencode.session_move[directory=~/worktrees/rate-limit]

YOU

The flaky test session is stuck. Stop it, have it quarantine the test, and close my finished tabs.

execute{ code }

opencode.session_list

opencode.session_context[sessionID=ses_7c41e09a]

└ "Retrying uploads.test.ts again…"

execute{ code }

opencode.session_interrupt[sessionID=ses_7c41e09a]

opencode.session_prompt[sessionID=ses_7c41e09a, text=Quarantine uploads.test.ts]

opencode.tab_close[sessionID=ses_2f9d61b4]

Stopped it, told it to quarantine the test, closed the config tab.

OpenCode

Fix flaky upload testinterrupted

Migrate config loadertab closed

review.ts
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",
})

Code Mode

Session

YOU

File GitHub bugs in Linear.

execute{ code }

tools.github.list_issues

tools.linear.save_issue

execute{ code }

["OC-412", "OC-413", "OC-414"]

Code Mode

return [search({ query: "list github issues" }),

search({ query: "create linear issue" })]

const { issues } = await tools.github.list_issues({

owner: "anomalyco", repo: "opencode",

labels: ["bug"], state: "OPEN",

})

const filed = await Promise.all(issues.map(({ title }) =>

tools.linear.save_issue({ team: "OC", title })))

return filed.map(issue => issue.identifier)

MCP servers

Background Tasks

Session

YOU

Spawn a background fable subagent to review this code.

subagentreview this codefablebackground2 comments

shellbun testbackground148 passed

editsrc/retry.ts+12

shellbun run buildbackgrounddone

Press

ctrlb

to move running work to the background

YOU

Update the changelog too.

editCHANGELOG.md+3

All done. The review left 2 comments, 148 tests passed, the build succeeded and the changelog is updated.

Background

Plugins

We also spent quite a lot of time ensuring everything in OpenCode 2.0 can be hot-reloaded. So it can write a plugin for itself mid-session and use it right away - we covered the design of this in a previous blogpost.

You can ask OpenCode to build whatever plugin you want and it knows how to. But if you do want to read the docs, they are available here.

The SDK

This one is still in development as things are shifting but you can already use it.

Upgrading

To upgrade your desktop app, download the latest here.

1.0 plugins will not work in 2.0

Server API is completely different

tui.json config is moved to json

There are a lot of other changes but they are backwards compatible. It is worth pointing OpenCode at this doc so it can migrate things for you.