Skip to content

Parallel Coding Agents

When three or four coding agents run cargo test, pnpm build, or pytest concurrently on one laptop, CPU thermal throttling and RAM exhaustion stall every agent at once. offrig keeps each agent’s local git Worktree authoritative while dispatching heavy build/test runs onto isolated remote Sandboxes.

Every linked git Worktree automatically gets its own persistent Layer-2 Sandbox forked from the shared Base Snapshot and Deps Snapshot:

Terminal window
git worktree add ../feat-auth -b feat/auth
git worktree add ../feat-billing -b feat/billing

Agent A running offrig cargo test inside ../feat-auth and Agent B running offrig cargo test inside ../feat-billing never share a mutable filesystem or fight over target/ locks.

For completely ephemeral one-shot isolation inside the same Worktree, pass --isolated:

Terminal window
offrig --isolated --ro cargo test --workspace

Separating offrig flags from command flags

Section titled “Separating offrig flags from command flags”

Every flag before the command (or before --) belongs to offrig; every token from the command onward passes verbatim to the remote Sandbox:

Terminal window
offrig --rig box --json --report-file /tmp/run.json -- cargo test -- --nocapture

Use -- whenever the target command starts with a reserved subcommand name (run, shell, snap, sandbox, sync, rig, daemon, init, status, doctor, shim, mcp, skill, version).

Machine-readable telemetry (--json and --report-file)

Section titled “Machine-readable telemetry (--json and --report-file)”

Agent harnesses can consume structured telemetry (schema_version: 1) without scraping terminal output:

Flag Behavior
--json or --json=summary Emits one JSON summary envelope on stdout at Run completion (exit code, rig, sandbox, sync bytes, resource peaks, write-back summary).
--json=stream Emits newline-delimited JSON (NDJSON) events in real time as stdout/stderr chunks and lifecycle stages stream.
--report-file <PATH> Streams normal human output to stdout/stderr while writing the JSON summary envelope to <PATH>.

offrig preserves exact command exit codes (0–123, 128+N for signals) and reserves 124–127 for unambiguous harness handling:

Exit code Meaning
0–123 Remote command exit status (parity with local execution).
124 Guarded Write-back aborted due to a local-edit conflict ([sync].conflict = "fail"). Local Worktree left untouched; recover with offrig sync pull.
125 offrig CLI parse, configuration, trust-boundary, or Provider infrastructure error.
126 Remote executable found but could not be invoked (permission / exec format error).
127 Remote command not found inside the Sandbox.

offrig ships a built-in stdio MCP server (offrig mcp [--cwd <PATH>] [--rig <NAME>] [--no-daemon] [--read-only]) exposing 19 structured offrig_* tools directly over offrig’s core library and Local daemon:

{
"mcpServers": {
"offrig": {
"command": "offrig",
"args": ["mcp"]
}
}
}
  • Execution & Write-back recovery: offrig_run, offrig_sync_pull (reusing daemon.sock, bounded UTF-8-safe head+tail output capture via OFFRIG_MCP_MAX_OUTPUT_BYTES, raw + base64 secret redaction, and notifications/progress + notifications/cancelled support).
  • Read-only inspection (the exact --read-only set): offrig_status, offrig_doctor, offrig_rig_list, offrig_rig_status, offrig_sandbox_list, offrig_sandbox_status, offrig_snap_list, offrig_snap_inspect.
  • Sandbox & Snapshot management: offrig_sandbox_resize, offrig_sandbox_reset, offrig_sandbox_stop, offrig_sandbox_rm, offrig_snap_build, offrig_snap_save, offrig_snap_rollback, offrig_snap_prune, offrig_snap_rm.

Install the bundled offrig coding-agent skill (teaching agents when to offload, how to recover from exit 124 Write-back conflicts and OOM events, and how to respect the local trust boundary) with either the bundled CLI or npx skills:

Terminal window
# Offline install directly from the offrig binary (defaults to ~/.agents/skills/offrig)
offrig skill install
offrig skill install --agent claude --agent codex --project
# Or directly from GitHub via the Agent Skills CLI
npx skills add spiritledsoftware/offrig

If you want coding agents to call cargo, pnpm, or pytest directly without changing their prompts, see Load-Aware Shims.