Guide

OpenCode multiple sessions: how to run them safely

OpenCode is useful because it runs where developers already work: the terminal. The hard part starts when you want more than one OpenCode session working on the same repository at the same time.

Can OpenCode run multiple sessions?

Yes. You can open several terminals and start OpenCode in each one. The real question is whether those sessions share the same checkout. If they do, branches, files, and generated changes can collide.

A safer OpenCode multi-session workflow gives every session a separate working directory and branch. That lets one session fix a bug while another explores a refactor or updates tests.

The problem with raw terminals

A better workflow for OpenCode parallel sessions

  1. Create a separate git worktree and branch for each task.
  2. Start one OpenCode session inside each worktree.
  3. Track which sessions are working, waiting, done, or errored.
  4. Review each branch diff before pushing or opening a pull request.
  5. Archive or delete the worktree after the task is merged or abandoned.

Where Baton helps

Baton automates the worktree setup, starts OpenCode from the right directory, shows each session as a Baton workspace, tracks notifications, and gives you a diff viewer for final review.

When this is worth doing

Parallel OpenCode sessions are most useful when the tasks are independent: one bug fix, one UI polish pass, one test cleanup, one experiment. If two sessions need to edit the same file in different ways, run them sequentially or review conflicts carefully.

Related Baton pages

See the OpenCode GUI page, git worktrees guide, or the broader multiple AI coding agents workflow.

To run OpenCode sessions this way, download Baton or compare all supported CLI coding agents.