Skip to content

Three-Layer Snapshots

offrig eliminates cold container rebuilds by splitting filesystem state into three copy-on-write layers.

A content-addressed Snapshot of your Environment:

  • Base OS image (curated Ubuntu 24.04 by default, or [env].image / [env].dockerfile on Docker-backed Providers)
  • System packages ([env].packages)
  • mise toolchains detected from mise.toml / .tool-versions
  • One-time setup commands ([env].setup)

Base Snapshots are keyed by (environment_hash, target_arch) and shared across every repository that resolves to the same Environment.

A content-addressed Snapshot forked from the Base Snapshot and keyed by repository lockfiles (Cargo.lock, pnpm-lock.yaml, package-lock.json, uv.lock, go.sum, etc.):

  • Populates Remote-only paths (node_modules/, /target, .venv/, .turbo/) and warm off-repo package caches inside the Rig.
  • Shared across every Worktree of the repository—opening a new git Worktree skips dependency installation completely when lockfiles match.
  • Configure lockfile tracking or custom install commands under [deps] in offrig.toml (enabled, auto_update, lockfiles, command).

Layer 2: Persistent Sandbox & Saved Snapshots

Section titled “Layer 2: Persistent Sandbox & Saved Snapshots”

Your Worktree’s writable Sandbox forks from the Deps Snapshot (or Base Snapshot if [deps].enabled = false).

At any time you can capture an immutable user-named Saved Snapshot of the current Sandbox:

Terminal window
offrig snap save golden-db

Before committing a Deps Snapshot, Saved Snapshot, or Cloudflare Layer-2 Snapshot, the Worker runs a pre-snapshot ctime secret scan against the injected secrets and ephemeral git tokens tracked in RAM (raw and alignment-invariant Base64 forms) and aborts capture if any value was written to disk. Deps Snapshots cannot skip the scan; only offrig snap save --allow-secrets bypasses it with an explicit warning.

Terminal window
# List Snapshots for the current repo (or --all across repos)
offrig snap ls
offrig snap ls --kind saved --all
# Explicitly build Base and/or Deps layers ahead of time
offrig snap build base
offrig snap build deps
offrig snap build all --force
# Inspect metadata or roll back a Worktree's Sandbox
offrig snap inspect golden-db
offrig snap rollback golden-db
# Reclaim storage while protecting active Sandboxes and Saved Snapshots
offrig snap prune --keep 2 --older-than 7d --dry-run
offrig snap prune --keep 2