cd /news/ai-agents/show-hn-bunshin-a-custom-microvm-eng… · home › topics › ai-agents › article
[ARTICLE · art-178550] src=github.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Show HN: Bunshin – A custom MicroVM engine giving AI agents desktops in ~100ms

Developer JustVugg released Bunshin version 0.1, an open-source MicroVM engine that creates sandboxed Linux desktops for AI agents in about 0.1 seconds by forking a single pre-booted template VM that shares memory and disk with each copy. Bunshin exposes 15 MCP tools (create, screenshot, click, type, press keys, scroll, drag, run commands) and a live browser console for watching and taking over desktops, with paused desktops resumable from a saved file in 0.4 seconds. The engine is roughly 2,000 lines of C with the rest in Go's standard library, requires Linux x86-64 with KVM, and has been tested only on one Intel x86-64 machine running WSL2 on kernel 6.18.

key takeaway

Bunshin forks a single booted template VM so each agent desktop starts in about 0.1 seconds while sharing memory and disk with the template, and exposes 15 MCP tools for screenshot, click, type and command control.

read15 min views8 publishedNov 30, 2026
Show HN: Bunshin – A custom MicroVM engine giving AI agents desktops in ~100ms
Image: Michielbdejong (auto-discovered)

Linux desktops for AI agents, on the computer you already own.

A new desktop in a tenth of a second. Tools over MCP. A console to watch and take over.

Italiano · Quick start · How it works · Numbers · Design notes

bunshin runs many sandboxed Linux desktops on one ordinary computer, gives any agent the tools to use them, and lets you watch every one of them live. Each desktop is a virtual machine with a browser at 1280x800. It is infrastructure only: bring your own agent.

Plain C where it matters, no dependencies, hardware you already have. The engine, the agent inside the machines and everything around them are written for this project, from the first line.

A desktop is never booted. One template boots once, with its windows open, and every desktop is a live copy of it: the engine forks the running machine. The copy shares memory and disk with the template and pays only for what it changes.

Status: early. Version 0.1, developed and tested on one computer (Intel x86-64, WSL2, kernel 6.18). It works end to end there, with an integration test that proves it, but it has not met other machines yet. See what is missing.

| Desktops in a blink | about 0.1 s to create one with Firefox open; a d one wakes at once | | Fifteen MCP tools | create, screenshot, click, type, press keys, scroll, drag, run commands | | A live console | every desktop on one page; amber while an agent acts; take control with your own mouse and keyboard | | One click to open an agent | Claude Code, Codex, pi, Hermes and others start in a terminal with the tools already given | | Stop and keep | a desktop saved to a file comes back in 0.4 s with every window where it was, even after a reboot | | Memory given back | what a desktop frees returns to the computer at once; idle desktops are d | | Network by name | you choose the sites desktops may reach; your computer and local network stay closed | | Images without root | the desktop image is built from inside a machine: no Docker, no administrator rights | | No dependencies | the engine is about 2,000 lines of C; the rest is Go with its standard library |

  • Linux on x86-64 with KVM: bare metal, a cloud machine with nested virtualization, or WSL2 on Windows 11. Your user must be able to open /dev/kvm (sudo usermod -aG kvm $USER , then a new session).
  • gcc ,make , Go 1.24 or newer, andmke2fs (packagee2fsprogs ).
  • A guest kernel. On WSL2 the kernel that ships with WSL is found and used by itself. Anywhere else see docs/kernel.md .
git clone https://github.com/JustVugg/bunshin
cd bunshin
make                       # build/bunshin-vmm (the engine) and build/bunshin
make install               # copies both to ~/.local/bin

bunshin doctor          # checks KVM, the kernel, the engine and the image
bunshin init            # builds the desktop image once, then starts the template
bunshin create a b      # two running desktops
bunshin key a ctrl+l && bunshin type a "example.com" && bunshin key a Return
bunshin screenshot a    # writes a.png
bunshin console         # watch them live in your browser
bunshin rm a b

Nothing is downloaded to build. init builds the desktop image the first time: it downloads the Debian base system and the desktop packages (Xvfb, openbox, tint2, Firefox ESR), a few hundred MB, in about ten minutes.

Without building: each release has an archive with both programs, statically linked for x86-64 Linux. Unpack it, copy bunshin and bunshin-vmm into the same directory on your PATH, and start from bunshin doctor.

From the console. At the bottom of the console there is a dock with the logo of each agent installed on the computer: Claude Code, Codex, pi, Hermes, OpenClaw, OpenCode, Gemini CLI. Click one and a terminal opens with that agent running, already given the bunshin tools. Under WSL the terminal is a Windows Terminal tab.

From a terminal.

bunshin connect                 # the agents found here and their state
bunshin connect codex pi skill  # connect these
bunshin disconnect codex

connect writes the entry each agent expects in its own configuration file, after keeping a copy of it. It knows Claude Code, Codex (the CLI, the app and the IDE extension share one file), pi, OpenCode, Claude Desktop, Cursor, Gemini CLI and Windsurf. Under WSL it also finds Claude Desktop and the Codex and Cursor apps installed on Windows and connects them through wsl.exe.

By hand, for any MCP client:

{ "mcpServers": { "bunshin": { "command": "/absolute/path/to/bunshin", "args": ["mcp"] } } }

bunshin mcp serves fifteen tools: create_desktop, list_desktops, delete_desktop, start_desktop, _desktop, fleet_status, screenshot, click, move_mouse, drag, scroll, type_text, press_key, cursor_position and run_command. Actions return a screenshot of the result, and an action on a d or stopped desktop wakes it.

A skill that teaches an agent to use the fleet well (split work across desktops, stay within the computer's limits, hand logins and payments to you, clean up) is in skills/bunshin-desktops; bunshin skill prints it.

Remote clients can use streamable HTTP with a bearer token:

BUNSHIN_MCP_TOKEN=change-me bunshin mcp --http 127.0.0.1:7400   # endpoint: http://127.0.0.1:7400/mcp
bunshin console

Prints a link to a local page with every desktop live, its CPU and memory, and the latest agent action. A desktop's border turns amber while an agent acts on it. Click a desktop to watch it closely and follow its activity, or press Take control to use your own mouse and keyboard on it; while you are in control, agents can look but their input is refused. That is how logins, captchas and payments are meant to be done.

The page is served on 127.0.0.1 only, the link carries a token, and requests from other sites open in the same browser are refused.

The engine, bunshin-vmm, is a small virtual machine monitor on KVM: about 2,000 lines of C, one process per machine. Four decisions do most of the work.

A copy is a fork(). Guest memory is a private mapping of the engine process. To copy a running machine the engine stops its virtual CPUs for two or three milliseconds, reads their state from KVM, and forks. The child process is the new machine: it inherits memory and device state as they are, rebuilds only what lives in the host kernel, and resumes from the same instruction. Pages are shared until one side writes them. Every machine can be copied at any time, and a copy of a copy is just another fork: no snapshot files, no chain to compact.

The disk is shared memory. The disk image is mapped into the guest as persistent memory (virtio-pmem) and mounted with DAX. Program files are read straight from the host page cache, once for the whole fleet, with no second copy inside each guest. What a desktop writes lands in its own private pages. Copies get this for free from the same fork.

No network card. Programs inside a desktop use an HTTP proxy on its loopback; the agent carries each connection to the host, where the daemon serves it. Every request names its destination, so the policy is by site name, checked again on the address the name resolves to. This computer and its local network are closed to desktops unless you open them.

The agent speaks X11. The first process of every machine is a static agent built into the engine, so its version always matches. It runs commands, moves files, and takes screenshots and sends input by talking to the X server directly, in one process: nothing to install in the image, nothing to start for every click.

More in docs/design.md and docs/protocol.md.

Measured on a laptop (Intel i7-1355U, 12 threads, 25 GB, WSL2, kernel 6.18).

The Firefox desktop (the default image; template with 2 GB and 2 CPUs):

Measured
Create a desktop, as seen by the caller 60 to 110 ms; up to 330 ms each when several are made in a row
Memory of its own, right after creation 16 to 38 MB
Memory of its own, after a minute of sitting idle 110 to 150 MB (Firefox keeps working in the background)
Its share of the memory common to the fleet about 220 MB
a desktop, wake it and run a command 137 ms, three command line starts included
Stop a desktop to disk 3.3 s (2.5 s of it waiting for the desktop to hand back free memory); a file of 530 to 620 MB
Start it again from disk and run a command 0.4 s
Boot the template, to a settled screen (once) 17 s
Build the image (once; mostly down and unpacking packages) about 11 minutes

The minimal test image (an X server and one window, 512 MB, 2 CPUs), which shows what the engine itself costs:

Measured
Create a desktop 32 to 39 ms
Running machine stopped during a copy 2 to 3 ms
Memory of a fresh copy about 1 MB of its own
Wake a d desktop and run a command 13 to 16 ms
Save a machine to a file, and start it again 45 ms and 37 ms

bunshin status shows free memory, desktops by state, the limits and how many more desktops fit. Agents get the same from fleet_status. A new or waking desktop is refused, with advice, when it would leave the computer short of memory. A fresh copy uses almost nothing and grows as it works, so the room is computed from what desktops may still grow into, not only from what they use today.

Desktops with no activity for 10 minutes are d; the next action resumes them. Watching a desktop in the console is not activity.

Memory comes back. Each machine tells the engine which blocks of its memory are free, and the engine returns them to the host at once. Before an idle desktop is d it also drops its file cache and gathers its free memory. In the test, a desktop that filled 119 MB and deleted the file went back to 9 MB.

Stop keeps everything on disk. bunshin stop NAME saves a desktop to a file and turns it off: no memory, no CPU, and it survives a restart of the computer. start, or simply the next action, brings it back with every window where it was. Set BUNSHIN_IDLE_STOP to have idle desktops stopped by themselves. One thing to know: a desktop started from disk no longer shares memory with the template, so it costs its full size in memory (about 600 MB for the Firefox desktop) until it is deleted.

Variable Default Meaning
BUNSHIN_RESERVE_MB 2048 memory always kept free for the computer itself
BUNSHIN_DESKTOP_MB 512 memory budgeted per desktop
BUNSHIN_MAX_DESKTOPS none hard cap on running desktops
BUNSHIN_IDLE_ 10m desktops idle this long; 0 turns it off
BUNSHIN_IDLE_STOP off save to disk and stop desktops idle this long, for example 2h
BUNSHIN_ALLOW everything comma-separated sites desktops may reach (subdomains included)
BUNSHIN_DENY nothing sites that are always refused
BUNSHIN_PRIVATE unset 1 lets desktops reach this computer and private networks
BUNSHIN_OFFLINE unset 1 refuses every connection
BUNSHIN_PORTS 80,443 ports tunnels may reach; * for any
BUNSHIN_NET open ask : a site not on the allow list is refused and waits for your approval in the console (orbunshin allow SITE )
BUNSHIN_SAVE_KEY none passphrase: stopped desktops are encrypted on disk
BUNSHIN_ALLOW_SECRETS unset 1 lets agents type things shaped like API keys into desktops
BUNSHIN_KERNEL found guest kernel (a Linux bzImage)
BUNSHIN_HOME ~/.local/state/bunshin where machines, images and logs live
BUNSHIN_MCP_TOKEN none bearer token for mcp --http
BUNSHIN_CUA_TOKEN made up token for cua-server (required on an address other than 127.0.0.1)
BUNSHIN_SANDBOX on off runs the engine unconfined, to find out whether a problem comes from the confinement;partial accepts a kernel without Landlock

The variables are read by the daemon when it starts. To change them: bunshin daemon stop, then run any command with the new values. Machines keep running across a daemon restart.

The desktop image is an ext4 file. bunshin image build makes it with no root, no Docker and no loop devices: it formats an empty file with mke2fs, boots a builder machine with that file as its writable disk, sends the base system into it file by file (the agent inside creates them as root), then runs a setup script there.

bunshin image build                       # Debian trixie with the desktop, the default
bunshin image build --tar rootfs.tar.gz   # start from your own root filesystem archive
bunshin image build --tar rootfs.tar --setup my-setup.sh -o my.ext4
bunshin init --image my.ext4

An image only has to do one thing: start an X server on display :1 from /etc/bunshin/boot, a shell script the agent runs at boot. The built-in script and setup are in internal/image/files.

bunshin cua-server serves the desktops through the API of Cua's computer-server, so code written for Cua Cloud runs after changing environment variables:

bunshin cua-server      # serves http://127.0.0.1:8000 and prints a token and the variables to set

Served: POST /cmd (screenshots as PNG or JPEG, clicks, mouse down and up, drags, scrolling, typing, keys and hotkeys, run_command with a timeout, the file commands) and /v1/vms to create, list, start, stop, suspend, restart and delete. Requests name their desktop with X-Container-Name or a /d/NAME/ base URL. Not served: the WebSocket API, clipboard, window management, terminals and /playwright_exec.

A desktop is a hardware virtual machine: what runs in it, including a browser on a hostile page, stays in it. The short version of how:

  • The engine confines itself before the machine starts. A system call filter leaves it unable to start a program, connect to anything or open a network socket; Landlock leaves it able to open only the directory of running machines and/dev/kvm . A flaw in the engine would leave a guest with that, not with your account.
  • The network leaves only through the proxy, to web ports, never to this computer or to private and overlay networks. WithBUNSHIN_NET=ask , a site you have not approved is refused and waits for you in the console.
  • The console is for this computer only; its links work once.
  • Every desktop is sealed into its own directory, and gets cores and randomness of its own. Nobody acts on the template.
  • Secrets stay out: agents cannot type things shaped like keys into a desktop, typed text is never logged, and stopped desktops can be encrypted (BUNSHIN_SAVE_KEY ).
  • The fleet s the largest desktop before the computer runs short of memory.

What the virtual machine does not solve is the agent itself reading a page that tells it what to do. Every screenshot comes with a reminder that the screen is not an instruction, but the firm limits are yours to set: BUNSHIN_NET=ask or BUNSHIN_ALLOW for the sites, and Take control for logins and payments.

The full review, with what is still open, is in docs/security.md. The engine's code is new and has been read by its author and by machines (make fuzz), not yet by an outside reviewer.

Honest list, most important first.

  • Other computers. Only one host has run this. Other CPUs (AMD in particular), other kernels and bare-metal Linux are untested.
  • Things not tried for real. The Cua server was checked with plain HTTP requests, not with the cua-computer and cua-sandbox packages. Of the agent connections, the tests cover Codex, pi and the skill; the others follow each agent's documented format and have not been tried against the program itself.
  • macOS and arm64. The engine is KVM on x86-64 only.
  • Memory of a working browser. Free memory goes back to the host, but an idle Firefox desktop still holds 110 to 150 MB of its own.
  • Sharing after a start from disk. A desktop started again from its file is a machine of its own: it no longer shares memory with the template.
  • Non-HTTP network. Only programs that use an HTTP proxy reach the outside. That covers browsers,curl ,apt and most tools, not raw TCP or UDP.
  • Prebuilt images to download. The image is built on your computer the first time.
  • Boot time of the template is dominated by the kernel unpacking itself (about 0.8 s); an uncompressed kernel would remove it. Copies are unaffected.
make test                 # unit tests
make test-integration     # boots real machines: needs KVM, a guest kernel and Xvfb
make fuzz                 # hostile input against the device code and the agent port, under sanitizers

The integration test downloads nothing. It builds a small image out of programs already on the computer, starts a template, copies it, and checks copies, input, screenshots, , the network policy, memory given back, stop and start from disk, MCP, the Cua server, connecting agents and the console.

  • vmm/ : the engine (bunshin-vmm ): KVM, boot, ACPI, virtio devices, live copy, save to file, confinement
  • guest/ : the agent that runs inside every machine, and its X11 client
  • cmd/bunshin ,internal/ : the command line tool, daemon, fleet, MCP server, proxy, image builder, console, Cua-compatible server and agent connections
  • skills/ : the skill for agents
  • site/ : the project page (one self-contained file);web/ : the sources of the site, the console page and the logo (make pages rebuilds them;web/trace-logo.py turns the artwork into outlines)
  • assets/ : logo and icon;docs/ : design notes, wire protocol, kernel requirements
  • tests/ : the integration test and its helpers

Apache-2.0 (see LICENSE). The agents' logos shown in the console belong to their owners: see THIRD_PARTY_NOTICES.md.

── more in #ai-agents 4 stories · sorted by recency
── more on @bunshin 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/show-hn-bunshin-a-cu…] indexed:0 read:15min 2026-11-30 · —