ClavueClavue
CLI · TUI · models

Worktree Isolation for Safe Agents

Keep experimental agent edits off main with git worktrees and clear pane ownership.

AdvancedAgent Workflows
worktreeisolationsafetygit

Parallel agents are powerful and dangerous on a shared dirty tree.

Worktrees (or explicit branches per pane) give each agent a filesystem boundary. imux does not replace git discipline—it hosts the panes where that discipline happens.

Prerequisites

  • git repo
  • Comfort with git worktree or feature branches

Steps

  1. 01

    Create an isolated worktree

    git fetch origin
    git worktree add ../myapp-agent-a -b agent/a origin/main

    Open that path as its own imux workspace or pane cwd so the agent cannot touch your main checkout by accident.

  2. 02

    One writer per tree

    Assign a single implementer agent per worktree. Use other panes for tests/logs only. Two writers on one tree is the usual merge disaster.

  3. 03

    Review before merge

    When the agent finishes, review diffs, run tests in a neighbor pane, then merge via PR—not by copying files blindly into main.

  4. 04

    Clean up worktrees

    git worktree remove ../myapp-agent-a
    git branch -d agent/a

    Remove finished worktrees so disk and branch list stay sane.

FAQ

Does imux auto-create worktrees?

Some agent flows may offer isolation options depending on build and policy. Treat explicit git worktrees as the portable, reviewable default.

Is this the same as Docker isolation?

No. Worktrees isolate git working copies, not full OS sandboxes.