Machinen
 ____   ___   ___ _____    ___  _   _  ____ _____
| __ ) / _ \ / _ \_   _|  / _ \| \ | |/ ___| ____|
|  _ \| | | | | | || |   | | | |  \| | |   |  _|
| |_) | |_| | |_| || |   | |_| | |\  | |___| |___
|____/ \___/ \___/ |_|    \___/|_| \_|\____|_____|

 ____  _   _ _   _      _______     _______ ______ __   __ _    _ _   _ _____ ____  _____
|  _ \| | | | \ | |    | ____\ \   / / ____|  _ \\ \ / /| |  | | | | | ____|  _ \| ____|
| |_) | | | |  \| |    |  _|  \ \ / /|  _| | |_) |\ V / | |/\| | |_| |  _| | |_) |  _|
|  _ <| |_| | |\  |    | |___  \ V / | |___|  _ <  | |  |  /\  |  _  | |___|  _ <| |___
|_| \_\\___/|_| \_|    |_____|  \_/  |_____|_| \_\ |_|  |_/  \_|_| |_|_____|_| \_\_____|

Boot Once, Run Everywhere.

A MicroVM that runs on hardware you already own.
Close your laptop and it hands off to another host.
Works across macOS, Linux, and Raspberry Pi.

# Start here
View README.md
-- COMPATIBILITY --
[x] Apple Silicon Macs
[x] arm64 Linux machines
[x] Raspberry Pi
[x] Graviton .metal
* /dev/kvm on Linux, Hypervisor.framework on macOS
=== PAUSE HERE. RESUME THERE. ============================================================================

Your agent is mid-task on your laptop, but you need to leave. Machinen freezes the whole VM — the running process, memory, open files, and timers — into a snapshot. Move that snapshot to your desktop and restore it. The agent picks up from the same moment, without rebuilding context or starting over. Send it back later the same way.

$machinen snapshot agent ./agent.snap
# ship snapshot to another host
$machinen restore ./agent.snap
ok: agent resumed from saved state
=== USE IT FROM TYPESCRIPT OR THE SHELL. ============================================================================

The workflow is the same either way: bake an image, boot the VM, run commands inside it, snapshot it, and restore it on another machine. Use the TypeScript API when you're building automation, or the CLI when you're working from a terminal.

> handoff.ts
01import { provision, boot, restore } from "@machinen/runtime";0203// 1. Bake the VM. Install the agent's toolchain, write its entrypoint.04await provision({05  install: async (vm) => {06    await vm.exec("apt-get install -y nodejs git");07    await vm.writeFile("/opt/agent.mjs", code);08  },09  cmd: ["node", "/opt/agent.mjs"],10  out: "./agent.tar.gz",11});1213// 2. Boot it on your laptop. Mount the workspace, forward the agent's port.14const vm = await boot({15  image: "./agent.tar.gz",16  name: "agent",17  liveMounts: [{ host: "./workspace", guest: "/mnt/workspace" }],18  portForward: [{ hostPort: 3000, guestPort: 3000 }],19});2021// 3. Drive the VM from your Node process — exec commands, write files.22await vm.exec("apt-get install -y python3");23await vm.writeFile("/etc/agent.conf", config);2425// 4. Battery's dying. Snapshot the whole VM to disk, ship the bundle.26await vm.snapshot({ outDir: "./agent.snap" });2728// 5. On your desktop: restore. Same heap, same open files, same timers.29const resumed = await restore({ snapDir: "./agent.snap" });
> terminal.sh
01# 1. Bake the VM.02$ node bake.ts03# → ./agent.tar.gz0405# 2. Boot it on your laptop.06$ machinen boot ./agent.tar.gz --name agent --detached \07    --mount-live ./workspace:/mnt/workspace \08    -p 3000:30000910# 3. Drive the VM.11$ machinen exec agent -- apt-get install -y python312$ machinen exec agent -- ls /opt1314# 4. Battery's dying. Snapshot and ship.15$ machinen snapshot agent ./agent.snap16$ scp ./agent.tar.gz ./agent.snap desktop:1718# 5. On your desktop: restore.19$ ssh desktop machinen restore ./agent.snap
=== FREEZE, MOVE, OR COPY A RUNNING VM. ============================================================================

Once Machinen can pause a VM without losing its state, you get three useful operations.

> 01: SNAPSHOT

Save the VM exactly as it is right now: memory, open files, timers, and running processes.

> 02: RESTORE

Start that snapshot on another machine. The agent continues from the same moment instead of booting from scratch.

> 03: FORK

Make a copy of the running VM and let both continue. Spin up several agents from the same warm state, let them try different approaches, and keep the result that works.

> fork.ts
01const child = await vm.fork({ name: "agent-b" });02// agent-b starts from the same running state, then goes its own way.0304$ machinen fork agent --new-name agent-b --detach
=== DEEP DIVES ============================================================================
> A REAL LINUX VM, DEFINED IN TYPESCRIPT.

Machinen runs microVMs, not containers. Snapshot and restore happen at the VM boundary, so the guest moves as one unit: kernel, processes, memory, files, and timers. Build the image in TypeScript: install packages, write files, choose the command. No Dockerfile.

> MOUNT FILES AND FORWARD PORTS.

Mount a host directory into the VM under /mnt/, and the guest sees your edits as you make them. Forward guest ports to your host with one option. No networking setup, no NAT rules.

> RUNS ON MACS AND ARM64 LINUX.

Machinen runs on Apple Silicon Macs, arm64 Linux machines, Raspberry Pi, and Graviton .metal instances. On Linux it uses/dev/kvm; on macOS it uses Hypervisor.framework.