All posts

Traces Now Supports OpenCode 2

Traces Team
3 min read

Traces now reads OpenCode 1.x and 2.x sessions, installs the right plugin for the OpenCode version you run, and tells you when your setup needs a refresh. You can now upgrade to OpenCode 2.x without worrying about losing your traces.

What gets captured

OpenCode 1.x and 2.x share the same opencode command, but OpenCode 2 changed two things Traces depends on:

  • New session format. OpenCode 2 stores sessions in a new SQLite format. Traces now reads it directly, so your 2.x sessions show up with your 1.x sessions.

  • New plugin API. OpenCode 2 only loads plugins built for its new API. Traces now includes plugins for both versions. Once you run traces setup, session tracking and sharing both work.

Old and new sessions in one list

Traces reads your 1.x and 2.x sessions directly from your machine and sessions appear together in the Traces TUI and in traces list.

If you used the OpenCode 2 beta, Traces now follows the stable release instead. Beta sessions no longer appear in the list, but any traces you already published from then still open. traces setup --agent opencode now covers OpenCode 2. You no longer need the separate opencode2 option.

Your OpenCode 2 traces also include:

  • Code Mode. In Code Mode, the agent writes one script that runs several tools at once. Traces keeps the script and shows each tool call inside it as its own step, with its own result.
  • Compaction. When OpenCode summarizes a long conversation to free up context, the trace shows where that happened.
  • Errors and retries. Failed calls and retries stay in the trace, so you can see where a session failed.
  • Subagents. Each subagent gets its own trace, linked to the parent. Subagents stay tracked between turns, because OpenCode can resume them.

You're ready for the next OpenCode update

Each major OpenCode version needs its own plugin. Traces makes sure you have the right one:

  • Setup picks the right plugin. traces setup checks which OpenCode version you have and installs the plugin built for it. If it doesn't recognize the version, it changes nothing and tells you why.
  • Doctor catches a mismatch. After you upgrade OpenCode, run traces doctor. If your plugin no longer matches, it tells you the command to fix it.

How we tested it

We tested against real OpenCode sessions:

  • On a copy of real OpenCode storage, Traces found all 153 sessions, from both OpenCode 1.x and 2.x, and validated all 18,076 message parts. For 1.x sessions, the output matched the previous reader exactly.
  • We ran the new plugins inside real OpenCode 1.19.3 and 2.0.32 and replayed 108 scenarios including resume sessions, workstream moves, several sessions at once, retries, and uninstalling. All 108 passed.

Get the update

OpenCode 2 support is in Traces CLI v0.6.42. To update, run:

bash
traces upgradetraces setup --agent opencodetraces doctor

Keep opencode on your PATH when you run setup, so Traces can check your version.

See Supported Agents for the full list of agents Traces works with.