Kagex/Guides
~0.8 s ForkSpeed & Workflows · 4 min read

Parallel MicroVM Forking: Race Multiple AI Code Fixes Side-by-Side

Instead of sequentially undoing failed edits, branch an active sandbox into parallel clones, test rival patches simultaneously, and apply only the winner.

Fork speed
~0.8 s per parallel clone
CLI command
sandboxctl fork <id> [count]
MCP tool
sandbox_snapshot (action=fork)
Fork a sandbox and race competing fixes
sandboxctl checkpoint "$ID" --name pre-upgrade
sandboxctl fork "$ID" 2   # Creates two independent CoW child sandboxes

Key Engineering Points · One-Way Workspace Sync, 3-Way Apply & Undo

All 10 key points →
  • 1Host folders are never shared or mounted into guest microVMs — virtio-fs and 9p mounts are intentionally disabled.
  • 2Workspace synchronization moves strictly one way (host -> VM) over explicit AF_VSOCK tar streams checked by guest/files.
  • 3Running rm -rf /workspace inside a sandbox has zero effect on the developer's repository on disk.
  • 4Before every sandbox_exec, incremental host file changes delta-sync automatically into guest /workspace.
  • 5Diff previews compare VM edits cleanly against repository git HEAD without mutating host git refs, index, or checked-out branches.
  • 6Applying approved patches uses temporary git merge-file 3-way merges rather than blind file overwrites.

Best-of-N Agent Search & Evaluation

Harnesses like docs/examples/go-harness illustrate spinning up N forks after reproducing a failing test, letting distinct model prompts mutate each fork independently and diffs returning strictly from passing runs.

Isolated Storage & Independent Egress

Each forked sandbox preserves separate CoW layers and execution logs while sharing common immutable ancestor blocks.

Inspect this architecture live in 3D

Step through MCP ingress, Ghost Secrets, CoW blades, and run sandboxctl commands interactively in your browser.

Frequently Asked Questions

No. CoW disk isolation guarantees every fork has an independent write layer.