agentvm

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

agent-vm

Run AI coding agents in a disposable Linux VM per project, with permissions bypassed. The VM gets your project directory and nothing else of yours: no SSH keys, no browser sessions, no rest of your disk.

One binary with Lima built in. Ships dev tools, Docker, headless Chromium with Chrome DevTools MCP, and Claude Code, OpenCode, Codex CLI, Mistral Vibe and, opt-in, Pi. macOS and Linux; Windows is experimental.

Documentation: www.agent-vm.org · Chat: #agent-vm:matrix.org

Install

curl -fsSL https://www.agent-vm.org/install.sh | sh

Or brew install sylvinus/tap/agent-vm; on Linux, the .deb or .rpm of the latest release, or nix run github:sylvinus/agent-vm (QEMU included). From a clone, with Go (and on macOS the Xcode command line tools): ./agent-vm.sh install builds it and links it onto your PATH; after a git pull, run it again. See Install for prerequisites.

Use

agent-vm setup                 # build the base template, once
cd your-project
agent-vm claude                # or opencode, codex, vibe, pi
agent-vm shell                 # a shell in this project's VM
agent-vm run npm test          # one command in it
agent-vm code                  # VS Code in the browser (setup --preinstall=default,code-claude)
agent-vm --readonly shell      # nothing on the host writable from the VM
agent-vm --scratch claude      # nothing of yours mounted, VM deleted on exit
agent-vm stop                  # or rm; list for all VMs
agent-vm doctor                # what is wrong, and what to run

Everyday use: Usage. Every command, option, file and variable: Reference.

Security

The agent is root in its VM and has the network. What it can reach on your machine is what crosses the shares:

  • Every .git and .hg, and the folder of a core.hooksPath inside the project, are read-only for the VM: the file server built into agent-vm enforces it on your machine. Before a VM boots, agent-vm stops on what it cannot protect and asks whether to go on: Protecting .git.
  • Files your machine runs without asking (.envrc, .vscode/tasks.json, .pre-commit-config.yaml...) are guarded: when the VM writes one, a dialog asks you first, and the write is refused where none can be shown. Add or remove paths in ~/.agent-vm/guarded.
  • The agent writes the project folder: on your machine, open it in your editor and use git there, and run everything else in the VM. Open agent-vm projects in VS Code's Restricted Mode, and never connect an editor to the VM over SSH (Remote-SSH trusts the VM with your machine: SSH from your machine). Editors, agents, commit hooks and commands you run on the host can run code the agent wrote: What else reads the project.
  • The VM reaches the internet, not your machine nor your local network: what it may reach there, or the only domains it may reach, go in ~/.agent-vm/network. A port the VM listens on is forwarded to your machine's loopback, unless something there uses it already or it is in 32768-60999, the range the guest picks random ports from.

Development

make                                       # _output/bin/agent-vm
make test-go                               # no VM; 0.2's recorded behavior where it is compared
go test -tags e2e ./internal/vm/ ./internal/cli/   # real VMs
make check-third-party test-third-party    # Lima, sshocker, pkg/sftp, gvisor-tap-vsock: upstream + patches/
make fuzz FUZZTIME=5m                      # each fuzzer; their seeds run with the tests

Releases: RELEASING.md. The website is in www/. Changes: CHANGELOG.md.

License

MIT

Documentation

Overview

Package agentvm holds the files of this repository the binary embeds.

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed LICENSE
	License string
	//go:embed NOTICE
	Notice string
	//go:embed THIRD_PARTY_LICENSES
	ThirdPartyLicenses string
)

The license of agent-vm, the notice about third_party/, and the licenses of what the binary is built from (scripts/licenses): `agent-vm licenses`.

View Source
var SetupScript string

SetupScript provisions the base VM: `agent-vm setup` runs it in the guest, after the choices as export lines.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
agent-vm command
Command agent-vm runs AI coding agents in a disposable Linux VM per project, with Lima built in.
Command agent-vm runs AI coding agents in a disposable Linux VM per project, with Lima built in.
internal
bashref
Package bashref gives the results of the bash implementation (0.2's agent-vm.sh and lib/), for tests that compare the Go code with it.
Package bashref gives the results of the bash implementation (0.2's agent-vm.sh and lib/), for tests that compare the Go code with it.
cli
Package cli is agent-vm's command line.
Package cli is agent-vm's command line.
desktop
Package desktop reaches the user out of any terminal: notifications and yes/no dialogs, where the desktop has a way (osascript on macOS; notify-send, zenity or kdialog on Linux).
Package desktop reaches the user out of any terminal: notifications and yes/no dialogs, where the desktop has a way (osascript on macOS; notify-send, zenity or kdialog on Linux).
env
Package env reads and writes agent-vm's env files, ~/.agent-vm/env and a project's .agent-vm.env, which the VM's shell sources: without ever running a shell on the host, since the VM can write the project's.
Package env reads and writes agent-vm's env files, ~/.agent-vm/env and a project's .agent-vm.env, which the VM's shell sources: without ever running a shell on the host, since the VM can write the project's.
gitguard
Package gitguard finds what git on this machine runs, or reads, from the folders a VM can write: hooks, and commands its config names.
Package gitguard finds what git on this machine runs, or reads, from the folders a VM can write: hooks, and commands its config names.
gitx
Package gitx runs git on this machine in folders the VM can write.
Package gitx runs git on this machine in folders the VM can write.
guard
Package guard asks the user before the VM changes a file their machine runs on its own (direnv's .envrc when they enter the folder, the editor's tasks, git hooks' config): the shares' SFTP server calls Allow before each write (sshocker's Guard), in the hostagent.
Package guard asks the user before the VM changes a file their machine runs on its own (direnv's .envrc when they enter the folder, the editor's tasks, git hooks' config): the shares' SFTP server calls Allow before each write (sshocker's Guard), in the hostagent.
host
Package host is what this machine can give a VM.
Package host is what this machine can give a VM.
limaembed
Package limaembed runs what Lima's libraries expect of limactl: they start the current executable again for some commands (`hostagent`, from instance.Start), and look for the guest agent and the templates next to it.
Package limaembed runs what Lima's libraries expect of limactl: they start the current executable again for some commands (`hostagent`, from instance.Start), and look for the guest agent and the templates next to it.
mounts
Package mounts is what a project's VM is given of this machine: the project, and the entries of ~/.agent-vm/volumes, each checked first.
Package mounts is what a project's VM is given of this machine: the project, and the entries of ~/.agent-vm/volumes, each checked first.
netguard
Package netguard decides what a VM may reach on the network: the internet, never this machine, its local networks or the other VMs (through this machine's loopback, where their ports are forwarded), unless the user allows it in ~/.agent-vm/network.
Package netguard decides what a VM may reach on the network: the internet, never this machine, its local networks or the other VMs (through this machine's loopback, where their ports are forwarded), unless the user allows it in ~/.agent-vm/network.
paths
Package paths compares and joins host paths as agent-vm's checks need: textually, as `cd` does, and whatever the case where the file system ignores it.
Package paths compares and joins host paths as agent-vm's checks need: textually, as `cd` does, and whatever the case where the file system ignores it.
runscript
Package runscript is the runtime scripts: ~/.agent-vm/runtime.sh and a project's .agent-vm.runtime.sh, run in the VM on every command that enters it, under the shell their shebang names.
Package runscript is the runtime scripts: ~/.agent-vm/runtime.sh and a project's .agent-vm.runtime.sh, run in the VM on every command that enters it, under the shell their shebang names.
state
Package state is agent-vm's folder, ~/.agent-vm (AGENT_VM_STATE_DIR): the user's files (env, volumes, runtime.sh, setup.sh) and agent-vm's markers, one file per VM and fact, named as 0.2 named them.
Package state is agent-vm's folder, ~/.agent-vm (AGENT_VM_STATE_DIR): the user's files (env, volumes, runtime.sh, setup.sh) and agent-vm's markers, one file per VM and fact, named as 0.2 named them.
ui
Package ui asks questions on the terminal and prints agent-vm's boxed notices, as 0.2's lib/ui.sh did.
Package ui asks questions on the terminal and prints agent-vm's boxed notices, as 0.2's lib/ui.sh did.
version
Package version is agent-vm's semantic version.
Package version is agent-vm's semantic version.
vm
Copied from third_party/lima/cmd/limactl: the drivers limactl has.
Copied from third_party/lima/cmd/limactl: the drivers limactl has.
vm/vmtest
Package vmtest is a vm.Backend for tests: VMs in memory, every call recorded.
Package vmtest is a vm.Backend for tests: VMs in memory, every call recorded.
vmname
Package vmname names the VM of a project directory, as 0.2 did but for its prefix: the VMs it made are moved under those names (FromOld).
Package vmname names the VM of a project directory, as 0.2 did but for its prefix: the VMs it made are moved under those names (FromOld).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL