Skip to content

jgbrwn/execlaw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🦞 ExeClaw

Ephemeral AI agent sessions in secure Firecracker microVMs.

ExeClaw is a web application that launches isolated nullclaw AI coding agent sessions inside Firecracker micro-virtual-machines. Each session gets its own sandboxed Linux VM with full network access. Built to run on exe.dev.

ExeClaw About

✨ Features

  • πŸ”’ Sandboxed sessions β€” Each agent runs in its own Firecracker microVM with a fresh Ubuntu 24.04 rootfs. Full isolation from the host and other sessions.
  • ⚑ Fast boot β€” VMs start in ~3 seconds with copy-on-write rootfs overlays.
  • 🌐 Multi-provider β€” Connect to OpenRouter, Anthropic, or OpenAI. Bring your own API key.
  • πŸ“± Tabbed sessions β€” Run multiple agent sessions simultaneously in browser tabs.
  • πŸ“‘ Real-time streaming β€” Server-Sent Events (SSE) stream agent output as it’s produced.
  • 🧠 Agent working indicator β€” Shelley-inspired letter-by-letter animated text shows when the agent is thinking.
  • πŸ“Š System memory gauge β€” Live memory usage in the topbar. >90% pressure blocks new sessions.
  • βš™οΈ Configurable idle timeout β€” Sessions auto-terminate after inactivity (default 72h, configurable 5 min–7 days).
  • πŸ“§ Email transcripts β€” Send session conversations via email (on exe.dev).
  • 🐑 Send to exe.dev VM β€” Fork a session into a new exe.dev VM with the transcript as a Shelley prompt.
  • 🎨 Rich rendering β€” Markdown, JSON syntax highlighting, unified diff coloring, code blocks with copy buttons.
  • πŸŒ™ Dark/light theme β€” Toggle with one click.
  • πŸ’Ύ Download & save β€” Copy messages, download individual messages or full conversations as Markdown.

πŸ“Έ Screenshots

New Session
Session configuration
Chat Session
Agent chat session
Settings
Settings with idle timeout & exe.dev token
Send to VM
Send session to new exe.dev VM

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     SSE Stream      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Browser SPA   β”‚ ──────────────▢ β”‚  Go HTTP Server  β”‚
β”‚  (Vanilla JS)   β”‚     REST API     β”‚   (stdlib only)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                           β”‚
                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                              β”‚  Firecracker VMs     β”‚
                              β”‚                      β”‚
                              β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
                              β”‚ β”‚ Ubuntu 24.04 VM  β”‚ β”‚
                              β”‚ β”‚   nullclaw agent β”‚ β”‚
                              β”‚ β”‚   TAP networking β”‚ β”‚
                              β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                              β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
                              β”‚ β”‚  Session 2 ...   β”‚ β”‚
                              β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key design decisions:

  • Zero external Go dependencies β€” The entire backend is pure Go stdlib. No web frameworks, no ORMs, no dependency tree.
  • Single-file SPA β€” The frontend is one index.html with inline CSS and JS. No build step, no npm, no bundler.
  • Copy-on-write rootfs β€” Each VM gets a cp --reflink=auto copy of the base rootfs, so disk usage stays minimal.
  • Serial console parsing β€” Communication with VMs happens over the Firecracker serial console (no SSH, no extra network services).
  • TAP networking β€” Each VM gets its own TAP device with NAT for outbound internet access.

πŸ› οΈ Tech Stack

Component Technology
Backend Go (stdlib only, ~2400 lines)
Frontend Vanilla JS SPA (~2800 lines, single file)
VM Runtime Firecracker microVMs
Guest OS Ubuntu 24.04 (ext4 rootfs)
Guest Kernel Linux 6.1.128
AI Agent nullclaw
Streaming Server-Sent Events (SSE)
Networking TAP devices + iptables NAT
Markdown marked.js + DOMPurify
Platform exe.dev

πŸš€ Deployment

ExeClaw requires a Linux host with KVM support. It's designed to run on exe.dev VMs (which provide KVM, TAP networking, and email gateway), but works on any KVM-capable Linux server.

Automated Install (Recommended)

The install script handles everything β€” building the binary, downloading Firecracker, building the VM rootfs with nullclaw, configuring networking, and installing the systemd service:

git clone https://github.com/jgbrwn/execlaw.git
cd execlaw
sudo ./install.sh

The script is idempotent β€” it skips steps that are already done. Re-run it safely at any time.

Prerequisites

  • Linux with KVM support (/dev/kvm accessible)
  • Go 1.21+
  • Ubuntu 22.04+ / Debian 12+ (for package management)
  • ~3GB disk space for VM assets

Manual Install

If you prefer to do things manually:

# Clone and build
git clone https://github.com/jgbrwn/execlaw.git
cd execlaw
go build -o execlaw .

# Set up VM assets (kernel + rootfs)
# See docs/rootfs-setup.md for detailed instructions
mkdir -p vm-assets
# Place vmlinux kernel and rootfs.ext4 in vm-assets/

# Configure networking
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -s 10.200.0.0/16 -j MASQUERADE

# Run directly
./execlaw

# Or install as a systemd service
sudo cp execlaw.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now execlaw

The server listens on :8000 by default. On exe.dev, it's accessible at https://VMNAME.exe.xyz (assuming that the default exe proxy port has not been changed for that VM).

Configuration

All configuration is via constants in main.go:

Constant Default Description
maxSessions 10 Maximum concurrent VM sessions
defaultSessionTimeoutMin 4320 (72h) Default idle timeout in minutes
listenAddr :8000 HTTP listen address
vcpuCount 2 vCPUs per VM
memSizeMiB 1024 RAM per VM in MiB

VM Assets

The vm-assets/ directory needs:

  • vmlinux β€” Uncompressed Linux kernel (6.1.x recommended)
  • rootfs.ext4 β€” ext4 filesystem image with Ubuntu 24.04 and nullclaw installed

The rootfs is not included in this repository due to size (~2GB). See the rootfs setup guide for instructions on building your own.

πŸ“ Project Structure

execlaw/
β”œβ”€β”€ main.go              # Go backend (~2400 lines, pure stdlib)
β”œβ”€β”€ go.mod               # Go module (zero dependencies)
β”œβ”€β”€ install.sh           # Automated install script
β”œβ”€β”€ static/
β”‚   └── index.html       # Single-file SPA (~2800 lines)
β”œβ”€β”€ vm-assets/
β”‚   β”œβ”€β”€ vmlinux          # Linux kernel (not in repo)
β”‚   └── rootfs.ext4      # Root filesystem (not in repo)
β”œβ”€β”€ execlaw.service      # systemd unit file
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ rootfs-setup.md  # Manual rootfs build guide
β”‚   └── screenshots/     # UI screenshots
β”œβ”€β”€ LICENSE              # MIT
β”œβ”€β”€ NOTICE               # Third-party attributions
└── README.md

πŸ”Œ API Endpoints

Method Path Description
GET /api/health Health check
GET /api/system System memory, load, session count
GET /api/platform exe.dev platform detection
GET /api/userinfo Current user info (from proxy headers)
GET /api/models/:provider List available models
POST /api/sessions Create a new VM session
GET /api/sessions/:id/status Session status
GET /api/sessions/:id/stream SSE event stream
POST /api/sessions/:id/input Send user message
POST /api/sessions/:id/email Email conversation
DELETE /api/sessions/:id Terminate session
POST /api/exedev/new Create new exe.dev VM with session

SSE Events

Event Description
message Agent text output
tool_call Agent invoked a tool
tool_result Tool execution result
thinking Agent thinking/reasoning block
status Session state change
agent_busy Agent started working
agent_idle Agent finished (3s idle timeout)
exit Session ended
error_event Error occurred

πŸ’‘ Inspiration

  • Shelley β€” exe.dev’s coding agent. ExeClaw’s agent-working animation (letter-by-letter bold cycling) is directly inspired by Shelley’s AnimatedWorkingStatus component.
  • exe.dev β€” The VM platform. ExeClaw leverages exe.dev’s proxy authentication, email gateway, and HTTPS API for the β€œSend to VM” feature.
  • Firecracker β€” Amazon’s lightweight VMM. Provides the sub-second boot times and strong isolation that make ephemeral sessions practical.

πŸ“œ License

MIT β€” see NOTICE for third-party attributions.

About

🦞 Ephemeral AI agent sessions in secure Firecracker microVMs. Designed for exe.dev.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors