Summary
Write-capable /opencode:rescue tasks currently operate directly in the user's current working tree. This can interleave OpenCode edits with the user's own uncommitted changes or with concurrent Claude Code edits.
There is an existing local issue about a worktree cleanup hang when a Claude subagent is itself isolated in a worktree (#16). This issue is separate: it tracks plugin-managed worktree isolation as a feature for safer write-capable OpenCode tasks.
Motivation
A plugin-managed worktree would help with:
- protecting user WIP from OpenCode edits
- allowing Claude and OpenCode to work concurrently without racing on the same files
- reviewing OpenCode's diff before applying it to the main tree
- discarding unwanted OpenCode changes cheaply
Proposed UX
Examples:
/opencode:rescue --worktree fix the failing parser tests
/opencode:rescue --background --worktree implement the migration script
Potential default: use worktree isolation automatically for background write-capable tasks.
Implementation sketch
- Create a temporary branch/worktree under a plugin-owned directory.
- Run
opencode-companion task --write with cwd set to that worktree.
- On completion, store the worktree path, branch name, and diff in job data.
- Add follow-up commands or result guidance to apply, merge, or discard the changes.
- Ensure background workers do not run in Claude-managed worktrees that can be deleted before OpenCode finishes.
Upstream reference
Derived from openai/codex-plugin-cc#135.
Summary
Write-capable
/opencode:rescuetasks currently operate directly in the user's current working tree. This can interleave OpenCode edits with the user's own uncommitted changes or with concurrent Claude Code edits.There is an existing local issue about a worktree cleanup hang when a Claude subagent is itself isolated in a worktree (#16). This issue is separate: it tracks plugin-managed worktree isolation as a feature for safer write-capable OpenCode tasks.
Motivation
A plugin-managed worktree would help with:
Proposed UX
Examples:
Potential default: use worktree isolation automatically for background write-capable tasks.
Implementation sketch
opencode-companion task --writewithcwdset to that worktree.Upstream reference
Derived from openai/codex-plugin-cc#135.