Harness Notes

Worktrees

Updated 2026-11-22,

On this page

How each harness creates an isolated checkout, what it starts from, and what happens to the changes afterward. Worktrees isolate files; conversation forks and subagent context are separate. Unknown answers mark gaps in the recorded evidence, not proof that a capability is absent.

Forking: conversation history and file isolation

Subagents: delegation and workspace isolation

QuestionOpenCodechecked at v2-docs-2026-10-27
Create or enter

In Code Mode, call opencode.worktree_create with a name; it returns a directory. worktree_list lists project worktrees. Project configuration chooses the destination and strategy.

Starting state

Not documented

The tools reference delegates worktree strategy to project configuration; this audit does not establish the base revision or dirty-file carryover for every strategy.

Session isolation

After creating a checkout, use session_move to move the session into its directory. The move takes effect at a safe boundary, so directory-dependent work belongs in a later call.

Subagent isolation

Subagents run in the parent session's directory and edit your checkout directly; there is no automatic per-subagent worktree or sandbox, so there is nothing to merge. Worktrees exist as separate session tools (worktree_create, session_move), which an agent can use to move a whole session into a new worktree.

Retained from the Subagents audit checked 2026-10-15; not re-probed for this page.

Setup and environment files

Not documented

Project worktree configuration selects the strategy. Automatic dependency installation, environment-file copying and custom strategy setup semantics have not been traced for this page.

Review and integrate changes

Not documented

The tools reference describes creation, movement and removal; this audit does not establish an automatic merge or apply-back contract. Review and integrate the resulting checkout according to the configured strategy.

Exit and cleanup

Partly

worktree_remove removes a checkout recorded for the project. force allows discarding uncommitted changes; removal requests the edit permission on the checkout directory. Protection for unpushed commits and automatic sweeping remain unverified.

CLI, tools and APIs

Code Mode exposes worktree_create, worktree_list, worktree_remove and session_move. Creating a worktree and moving the session are separate operations. These V2 utilities do not establish equivalent V1 commands or an identical external protocol.

Commands

No commands recorded.

Notes and sources

OpenCode, 4 sources
  • Documentation reviewed 2026-10-27; retained subagent answers keep their original source/version boundaries. No lifecycle runtime probe.
Create or enter, 1
Starting state, 1
Session isolation, 1
Subagent isolation, 3
Setup and environment files, 1
Review and integrate changes, 1
Exit and cleanup, 1
CLI, tools and APIs, 1