Skip to content

Sync & Write-back

Your local Worktree is always the source of truth. offrig transfers only the files that changed since the last sync and protects local edits during Write-back.

Before each Run, offrig computes the changed paths in your Worktree (respecting .gitignore, .offrigignore, and [sync].remote_only) and streams the delta to the Worker (offrigd) inside your Sandbox.

Heavy build outputs and dependency trees belong on the remote Rig, not on your laptop’s SSD. Remote-only paths are:

  • Excluded from sync in both directions (never pushed from local, never pulled in Write-back)
  • Protected from sync deletion inside Deps Snapshots and Sandboxes

Common paths like node_modules, /target, .venv, and .turbo are configured automatically or via [sync].remote_only:

[sync]
remote_only = ["node_modules", "/target", ".venv", ".turbo"]

To explicitly sync a gitignored file from inside the Worktree (such as a generated fixture), list it under [sync].include. Paths in sync.include may never escape the Worktree root (.. or symlinks outside the root are rejected).

Control how much git metadata the Sandbox sees:

Mode Behavior
auto (default) Syncs .git metadata up to [sync].git_max_bytes (default 100 MiB / 104857600 bytes); falls back gracefully for oversized repos.
full Always syncs the full .git view needed for git-aware build tools.
off Omits .git from the Sandbox completely.

When a Run exits normally, the Worker reports every addition, edit, and deletion made on synced paths inside the Sandbox. Before writing them back to your laptop, offrig checks whether any affected file changed locally while the remote Run was executing.

Control conflict behavior with [sync].conflict or --conflict <policy>:

Policy Behavior on local edit during Run
fail (default) Aborts Write-back atomically, leaves your local Worktree untouched, and exits with code 124.
overwrite Applies remote changes over conflicting local edits.
keep-local Applies non-conflicting remote edits while preserving your local version of conflicting files.

When a Run exits 124, your remote changes are still safely intact inside the Sandbox. Inspect or pull them explicitly:

Terminal window
# Pull remote changes back with conflict protection
offrig sync pull
# Or inspect / override conflicts explicitly
offrig sync pull --conflict keep-local
offrig sync pull --conflict overwrite

Skip automatic Write-back completely with --ro, or pull only specific generated artifacts with --pull <GLOB> (repeatable):

Terminal window
offrig --ro cargo test
offrig --ro --pull 'dist/**' pnpm build