HarnessVM lets you quickly launch secure AI sandbox machines with graphical and terminal interfaces.
Learn about HarnessVM with this one-minute YouTube video.
A full desktop lets agents control an entire sandboxed OS. They can run end-to-end tests and operate installed programs through MCP.
HarnessVM is designed as a thin layer with minimal code and overhead: one Bash script plus ready-made Lima, Docker Compose, and desktop configs.
The included setup runs an Ubuntu desktop in Lima and is tested on Apple Silicon macOS. The host and guest can both be changed.
harnessvm: launchervm/: Lima, Compose, and firewalldesktop/: browser desktop imageharnesses/: optional coding agents
Install Lima 2.1.2 or newer, then:
./harnessvm doctor
./harnessvm /path/to/projectThe first run creates the VM and builds the image. HarnessVM then opens a private 127.0.0.1 URL.
Optional shell alias:
alias harnessvm='/absolute/path/to/HarnessVM/harnessvm'harnessvm . --read-only
harnessvm . --mount ../other-project
harnessvm . --mount-ro ../docs
harnessvm . --harness codex --harness opencode
harnessvm . --persist .local
harnessvm . --allow 192.168.1.50:8080
harnessvm . --allow host.lima.internal:11434
harnessvm . --no-browserCodex and Claude are loaded by default. The first --harness replaces that default; repeat it to load more. Available names are codex, claude, opencode, pi, hermes, and qwen.
--no-browser opens a shell at /workspace instead. Exiting the shell leaves the session running. Adding a new host path may restart Lima; HarnessVM asks first if another session is running.
Add harnesses/name.sh and install the tool under ~/.name. Selecting --harness name runs the script and keeps that directory between sessions.
Use --persist .local for anything installed directly into ~/.local. Packages installed with apt are temporary; add them to desktop/Dockerfile.
Defaults can be changed in config.env:
HARNESSVM_HARNESSES=codex,claude
HARNESSVM_PERSIST_DIRS=.localharnessvm list
harnessvm shell SESSION
harnessvm logs SESSION
harnessvm stop SESSION
harnessvm stop --allA unique session prefix is enough. delete is an alias for stop.
Stopping a session removes its desktop home, packages, Docker data, and logs. Writable host mounts, selected harness data, and cached images remain.
- The desktop sees
/workspace, explicit/sharesmounts, and selected persistent directories. - Changes inside writable mounts also change the host files.
- The browser listens only on
127.0.0.1. - Public internet works. Private addresses require an exact
--allow HOST:PORT. sudoand Docker stay inside Lima. The host's Docker socket is not shared.
All sessions share one VM. Keep untrusted projects in a separate VM.
HarnessVM is useful for testing agentic harnesses with on-device models such as Qwen and Gemma. Run them on the host with LM Studio, llama.cpp, or another OpenAI-compatible inference engine.
For example, you can allow the host's LM Studio port, then point Pi at PrismML's loaded bonsai-27b model:
harnessvm . --harness pi --allow host.lima.internal:1234 --no-browser
mkdir -p ~/.pi/agent
cp /opt/harnessvm/harnesses/pi-lm-studio.json ~/.pi/agent/models.json
pi --provider lmstudio --model bonsai-27bFor llama.cpp or another OpenAI-compatible engine, change baseUrl and the model ID in the example config.
cp config.env.example config.envThe file covers VM resources, harnesses, persistent directories, display settings, browser launch, and private-network exceptions. VM type, architecture, and disk size apply when the VM is created.
- Linux: set
HARNESSVM_VM_TYPE=qemu, the nativeHARNESSVM_ARCH, andHARNESSVM_MOUNT_TYPE=9p. - Windows: use Bash with QEMU, then adjust path handling and the macOS
opencommand. Lima's WSL2 driver is experimental. - Other guests: change
vm/lima.yamland the base image indesktop/Dockerfile.
See Lima's VM and mount guides.
harnessvm vm status
harnessvm vm logs
harnessvm vm stop
harnessvm prune
harnessvm vm deletevm delete removes the VM, cached images, logins, and other persistent data.
HarnessVM is a proof of concept developed with AI assistance, including agentic coding tools. It may contain errors or unexpected behavior.
The software is provided as-is, without warranties or guarantees. Review it and use it at your own risk. The authors and contributors accept no liability for data loss, security incidents, damage, or other consequences.
Created by Mohammad Tomaraei

