Skip to content

Load-Aware Shims

offrig shim installs opt-in wrapper executables ahead of your normal PATH. Inside configured Worktrees, matching commands run locally while your laptop has headroom and spill transparently onto a remote Rig when local concurrency, CPU load, or free RAM cross [shim.routing] thresholds. Outside configured Worktrees (or when no remote Rig is configured), Shims pass straight through to the real local binary with negligible overhead.

Terminal window
# Install managed # offrig-shim wrappers
offrig shim install cargo pnpm pytest
# Activate in your current shell (or add to ~/.zshrc / ~/.bashrc / config.fish)
eval "$(offrig shim env)"

Supported shell dialects for offrig shim env --shell: sh, bash, zsh, and fish (auto-detected from $SHELL when omitted).

Inspect active Shims, PATH ordering, routing thresholds, and resolved local fallback binaries:

Terminal window
offrig shim ls
offrig shim ls --json

Remove one or all managed Shims:

Terminal window
offrig shim remove pytest
offrig shim remove --all

Configure routing thresholds in ~/.config/offrig/config.toml (or per-repo offrig.local.toml):

[shim.routing]
# Spill to remote Rig once more than 2 shimmed commands run locally (default: 2, max: 256)
max_local_concurrent = 2
# Spill when 1-minute load average / CPU cores exceeds 0.75 (default: 0.75)
max_load_ratio = 0.75
# Spill when available laptop memory drops below 20% (default: 20, max: 99)
min_free_memory_percent = 20
  • Automatic pre-start local fallback: If a shimmed command decides to spill remotely but the target Rig is unreachable before execution begins (for example, when working offline on a flight), the Shim automatically falls back to your local binary instead of failing your workflow.
  • Forbidden system commands: offrig shim install refuses to shadow offrig, offrigd, sh, ssh, and git.
  • Non-destructive removal: offrig shim remove only deletes files bearing the managed # offrig-shim header and never touches unrelated binaries.