Skip to content

Worktrees & Sandboxes

offrig separates where you edit (your local Worktree) from where heavy compute runs (a Sandbox on a Rig).

Each local git Worktree (or standalone non-git directory) maps deterministically to one persistent Layer-2 Sandbox per Rig:

  • Running two coding agents simultaneously in two linked git Worktrees (git worktree add ../feat-a and git worktree add ../feat-b) automatically gives each Worktree its own isolated Sandbox forked via Copy-on-Write from the same shared Base Snapshot and Deps Snapshot.
  • Build caches and Remote-only paths (target/, node_modules/, .venv/) never collide between branches.
  • offrig --isolated <cmd>: Forks a fresh ephemeral Sandbox from the current Deps Snapshot (or Base Snapshot), executes the Run, applies Write-back, and deletes the ephemeral Sandbox on exit. Ideal for one-off release checks or parallel test shards inside a single Worktree.
  • offrig --recreate <cmd>: Discards the Worktree’s persistent Sandbox and re-forks cleanly from the current Base / Deps Snapshot before running. (You can also run offrig sandbox reset explicitly.)

To keep remote compute costs predictable without slowing down back-to-back commands:

  • Idle timeout (idle_minutes): After a Sandbox finishes its last active Run or shell, the Rig stops it once idle for idle_minutes. Defaults vary by Provider (30 min for local, 15 min for remote ssh/daytona/boat/e2b, 5 min for modal, 2 min for cloudflare, automatic scale-to-zero sleep with a 15s daemon pool TTL on sprites).
  • Hold cap (hold_cap_minutes): Active port forwards (offrig sandbox forward) or background holds keep a Sandbox alive at most hold_cap_minutes (default 60 minutes) without an active Run or shell before idle shutdown triggers.

Manage persistent Sandboxes directly with offrig sandbox:

Terminal window
offrig sandbox ls --all
offrig sandbox status
offrig sandbox stop
offrig sandbox resize --cpu 8 --memory 16384
offrig sandbox rm

offrig daemon is a lazily auto-started per-user background process on your laptop. It holds warm connections to active Rigs, watches active Worktrees, and coordinates -p/-R TCP port forwards over yamux.

  • You never need to start it manually; the first Run starts it automatically.
  • Pass --no-daemon on any Run, shell, or sandbox forward to execute in-process.
  • Inspect or stop it anytime with offrig daemon status or offrig daemon stop.