anomalyco / anomalyco/opencode

[FEATURE]: Add --worktree / -w startup flag to V2

Open
#48,272 0 comments 1 reaction 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 10, 2026.

2.0
Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Feature hasn't been suggested before.
  • I verified that no active issue requests this exact feature. This renews #21680 and #35471, which were automatically closed after 60 days of inactivity.
Describe the enhancement you want to request

Add a --worktree / -w startup flag to OpenCode V2. The flag must create or select an isolated git worktree before it starts the TUI session.

opencode2 -w feature-a
opencode2 --worktree feature-b
opencode2 --worktree

Expected behavior:

  • Create or select a named worktree when the user supplies a name.
  • Generate a worktree name when the user omits the value.
  • Start the session with that worktree as its working directory.
  • Keep session history, file state, tools, and MCP state isolated from sessions in other worktrees.
  • Reuse the existing V2 worktree and workspace infrastructure.

This supports parallel tasks without manual worktree setup or extra terminal tabs. It also gives Claude Code users an equivalent to its -w workflow.

This request differs from #36048. That issue requests worktree subcommands and in-session switching with stash-based state management. This issue requests a startup flag for a one-command isolated session.

Related issues:

  • #21680 — original request, closed after inactivity
  • #35471 — detailed CLI flag request, closed after inactivity
  • #36048 — in-session worktree commands and switching
  • #33332 — configurable worktree creation

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.