27 Nov 2026
Ergonomic agent isolation with smolvm
Containing the clankers
Software developers are very eager to share code in the form of open-source libraries, frameworks, runtimes etc. This is an incredibly positive aspect of this industry. Imagine a world where all products of intellectual work were as freely available as software is. Then people started targeting shared libraries for nefarious purposes. Now we have an industry that is used to installing and running free code liberally, but that code should not be trusted anymore. Ever since Shai-Hulud hit, it’s been on everyone’s mind. Yet everyone expects package managers and language tooling to take care of it, and there’s little real reflection among software engineers about changing their attitudes and workflows. I found myself in the same situation. My only reaction was to move sensitive credentials off disk into a password manager.
Then I started using AI agents extensively. I went through the usual rollercoaster: First, I hand-approved every command the LLM wanted to run. Then more experience brought more trust, and I started skimming commands. As models got better at long-horizon tasks, I wanted a more hands-off workflow. I briefly looked around and found a convenient and lightweight sandboxing mechanism in nono. It uses Seatbelt on macOS to restrict the agent process’s access to files and network. It proved annoying at times, so I stopped using it and never replaced it. The frontier models were dropping fewer and fewer production databases, so my vigilance lapsed.
That brings us to today: I’ve been rawdogging LLMs for months now, with my worries pushed to the back of my mind. But enough is enough, it’s time to jail the clankers. And to be clear, as the narrative around AI turns from utopia to dystopia, my concerns are changing. With models rapidly improving, I no longer worry much about accidental exposure or mistakes. Instead, I now expect malicious content to poison an agent or trick it into exfiltrating sensitive data from my machine.
Threats
When I think through the rogue agent scenario, I see a lot of overlap with traditional supply chain attacks. Ultimately I need an environment where untrusted code, be that an npm dependency or an agent harness driven by a clanker, can do its worst. To be clear, my threat model here is only about protecting my local machine. I don’t want my personal data leaking into an LLM’s context, or a subverted npm dependency exfiltrating my active browser sessions (via Firefox’s SQLite files on disk).
In this model, an npm runtime library could still mine Bitcoin on my users’ machines, or an agent could inject a deliberate auth backdoor for the NSA to exploit later. Those are separate problems that go beyond what I want to cover here. Similarly, I’m not considering build attestation, artifact signing etc.
Isolation mechanisms
First let me outline the mechanisms I looked into:
- OS process sandbox (Seatbelt, bubblewrap)
- Containers
- MicroVM
- VM
- Hardware boundary
As mentioned above, I’ve used nono before. It uses Seatbelt under the hood to
keep a process (say, an agent harness) from touching files you don’t want it to. It’s a neat idea
but has limitations: Seatbelt is a kernel feature, so it has a fairly large bug surface. Not to
mention that the API nono uses was deprecated in macOS 10.8 (the sandbox-exec CLI since 2016),
with no supported replacement for arbitrary processes. Overall it’s better than nothing but not good
enough. By the way, Claude Code has a built-in sandbox that is also based on Seatbelt on macOS, but
it feels more like an alibi when things go wrong than a serious attempt to improve the situation.
Containers are conceptually nicer. If you run an agent or a package manager inside a container you
get a cleanly separated filesystem (unless you start mounting things). And even though
devcontainers have been a thing for a while, the ergonomics still aren’t all the way there. It
feels more like a tool for reproducible dev environments than a security abstraction. Not to mention
that you share the host kernel (unless you’re on macOS), which gives it weaker isolation properties
than a real VM.
Then we get to the interesting part: MicroVMs and VMs. Here I think we’re in a nice spot, with
strong isolation and a lot of flexibility to integrate them into our workflows. The significant
downside is the resource requirements. We’ll get into that when I outline lima and smolvm below.
Lastly we get to an approach that’s probably the only workable one in an enterprise setting: just force users into a VM somewhere and don’t allow local development. I’ve worked like that before and absolutely hated it, but that’s because it was badly implemented. After experimenting with a bunch of things, I have a nagging feeling this is where we’ll all end up eventually.
Lima
The first approach I pursued was a Lima VM that I would work inside entirely. All my repos would be checked out inside, my terminals would autoconnect to the VM via SSH, and my editor would connect via SSH too while still allowing local viewing and editing of files.
That forced me into one VM for all my projects, since running a VM per project needed more memory than I wanted to give up. Lima statically allocates memory and can’t release unused memory back to the host on macOS. So I’d need a repo with setup scripts to provision this one VM with the toolchains for all my projects. I don’t really like that coupling; I’d much prefer each repo to bring its own dependencies and tooling along.
So this left me in a pickle: one combined, long-lived VM for all my projects, or keep looking for other solutions.
smolvm
Enter smolvm: unlike Lima, smolvm supports elastic memory via virtio balloon. Combined with faster
startup times, that makes per-project VMs viable. But unlike Lima VMs, smolvm boots from OCI images
and doesn’t ship an OpenSSH server. I skipped the traditional SSH workflow (smolvm has since added
machine ssh-config for ssh, scp and sftp) and rethought my approach, landing on a pretty nice
workflow.
In each repo, I now wrap common commands in a mise shell alias that runs
them inside the VM. Concretely, the repo’s mise.toml contains, among other things, this snippet:
[shell_alias]
m = "smolvm machine exec -it -w /workspace -- mise run"
So when I want to run a mise task on the host, say mise run dev to
start a dev server, I just run it as usual. To run it inside the VM, I type m dev instead.
Similarly, I set up a pi task so that m pi starts a pi chat inside the VM.
The workspace is mounted into the VM, which means I can keep editing files, running jj commands
etc. locally.
I have a couple of tasks like vm:up, vm:down etc. to manage the lifecycle of the VM. In general
I intend those machines to be semi-long-lived. When I’m working normally I can just keep them
running, or stop them temporarily to save some memory. When I need a new toolchain in the VM, I add
it to the init step in the Smolfile and recreate the machine from scratch. That wipes the app’s
build caches inside the VM, but that’s fine. For production builds I have a separate clean machine
that I only spin up briefly.
There are some annoyances with this setup:
- Agent session transcripts get wiped when I tear down a machine, so my VM management scripts copy them out and restore them. Just a preference of mine to have them around to resume etc.
- Pi settings need to be kept in the repo as well and copied into the VM when provisioning. That (among other things) makes this approach pretty unusable for development teams. This is very much a personal setup right now.
But overall I’m happy to have peace of mind: my agents can only mess up the VM and the mounted workspace (which jj restores), not the rest of the host.
If you want to see the whole setup in action, look at the repo of this website.
Outlook
I was hoping whatever I found in this exploration would apply to my professional work as well, but I have to admit the setup is too convoluted for a mixed team of developers to adopt. Or rather, I don’t feel like getting everybody onboard and then owning every issue that comes with it.
The more I think about it, the more convinced I am that the only way to have a secure setup in an enterprise environment is to go full remote. Every developer maintains provisioning scripts that set up a VM exactly to their liking, and a cloud-based hypervisor platform spins those VMs up as people need them. And then just forbid local development altogether. That would solve a whole bunch of security issues.
Maybe I should put another Linux box in my closet just for this, now that I think about it.