Skip to main content
Fork clones a running machine — memory, processes, and filesystem — into an independent child. This example writes shared state, forks, then changes each side to show they no longer affect each other.

Setup

Python

fork_example.py

Expected output

The child starts as an exact copy (it sees common), then each side’s write lands only in its own filesystem. Fork children are full machines: fork them again, hibernate them, or expose ports — anything a created machine can do.

Where this is useful

  • Parallel exploration — set up a repo or environment once, fork per hypothesis, keep the winner.
  • Cheap retries — fork before a risky step; on failure, kill the child and fork again instead of rebuilding state.
  • Evaluation — run N candidate patches against identical warm state.
Related: Fork concept · Machine fork guide