Skip to content

catchpen

catchpen runs coding agents (Claude Code, opencode, pi, omp and Codex) inside QEMU/KVM virtual machines on your Linux machine. An agent gets a full computer it can do anything in: install packages, run code, use Docker and sudo. Your host, your credentials and your network stay out of its reach.

Why

Coding agents work best when they can act without asking: run the tests, install a tool, try a fix. Letting them do that on your own machine gives them your SSH keys, cloud credentials, browser sessions and local network. Containers share your kernel and are usually given your files. catchpen gives each agent its own VM instead, and treats everything inside it as untrusted:

  • The VM is the boundary. No host directory is mounted, SSH is key-only with a pinned host key, and QEMU runs under its seccomp sandbox.
  • Nothing leaves without a rule. By default the VM's only way out is an allowlist proxy on the host, plus package caches. Requests are logged, and a request to a host that isn't allowed is refused, or held until you allow or deny it.
  • Credentials are scoped. An agent gets its own token, and each VM gets its own deploy key per repository or a token (its own where the forge can mint one), pushed at start and never baked into an image.
  • Work comes out through you. Commits leave the VM as git bundles that the host checks before fetching them or opening a pull request, so the VM needs no push access.
  • Misuse is noticed. Decoy credentials planted in the VM pause it the moment anything uses them.

How it works

flowchart LR
  subgraph host[Your Linux host]
    cli[catchpen CLI and daemon]
    proxy[Egress proxy<br/>allowlist and log]
    cache[Package caches]
    repo[(Host git repos)]
  end
  subgraph vm[VM: QEMU/KVM]
    agent[Agent in tmux<br/>/workspace/repo]
  end
  cli -- SSH: credentials, sessions --> agent
  agent -- HTTP proxy --> proxy --> internet((Internet))
  agent -- apt, npm, pypi, go, docker --> cache
  agent -- git bundle --> cli --> repo
  1. A template says what a VM contains: distro, CPUs and memory, packages, runtimes, agents, network policy and repositories. You pick it with -t, from sections in category files; by default a VM gets Docker, Node, uv, gh and the agents. You can add your own sections.
  2. A base is built once per template: a cloud image with the template's software installed. Each VM is a copy-on-write overlay on its base, so creating one takes seconds.
  3. At each start catchpen pushes the VM's credentials over SSH: agent tokens, forge keys or tokens, and settings. They live only in the running VM.
  4. While the agent works, its network traffic goes through the proxy and caches on the host, which enforce the VM's allowlist and log every request.
  5. To get work out, catchpen pull and catchpen pr fetch the agent's commits from the VM as a bundle, check it, and bring it into your repository or open a pull request.

An optional daemon handles the background work: stopping idle VMs, keeping a warm pool of ready VMs, rebuilding bases on a schedule and relaying network prompts.

Using catchpen

Set up

Install catchpen and its dependencies, then store a token for your agent. The quick start takes you from nothing to Claude Code in a VM; Installation covers signed release binaries, building from source, optional packages and upgrades.

Work with an agent interactively

catchpen up dev                 # create and start a VM with the default template
catchpen run dev claude         # start Claude Code in the VM's tmux session
                              # detach with Ctrl-a d; run it again to reattach
catchpen ssh dev                # a shell in the VM
catchpen cp ./notes.md dev:/tmp/
catchpen forward dev -L 3000    # reach a dev server in the VM from the host
catchpen stop dev               # shut it down, keeping its disk; catchpen start dev boots it again
catchpen destroy dev

catchpen herdr puts every running VM's agent in herdr, which shows whether each is working, blocked or idle. catchpen up dev -t go-1.27,large adds Go to the default template and picks a larger size, and --cpus, --mem and --disk size the VM. catchpen up --ephemeral dev gives you a VM that is destroyed when you leave it. See Sessions for recordings and the audit log.

Work on a repository

Register a forge once, then clone repositories into new VMs. The VM gets a deploy key or token for that repository only.

catchpen forge add github --type github --host github.com --mode deploy-key --token-secret GH_ADMIN_TOKEN
catchpen up api --repo github:acme/api        # cloned into /workspace/api
catchpen run api claude
catchpen pull api --into ~/src/api            # fetch the agent's branch into your clone
catchpen pr api --into ~/src/api              # or push it and open a pull request

See the GitHub tutorial to clone and push with your SSH key and use gh in the VM, and Forges for Gitea, read-only keys and SSH agents.

Control the network

A VM reaches only the hosts on its allowlist. The template sets it, and you can change it on a running VM:

catchpen egress log dev -f                    # what the VM is reaching, live
catchpen egress allow dev pypi.org            # let it through
catchpen egress watch                         # answer prompts for unknown hosts

See Egress and Package caches.

Hand off a task

A headless task runs an agent on a prompt in a throwaway VM and brings back a pull request, a bundle or a patch:

catchpen task run --repo github:acme/api --prompt "fix issue #42" --into ~/src/api
catchpen task ls
catchpen task logs <id> -f

See Headless tasks for batches, limits and notifications.

Keep a safety net

catchpen snapshot dev before-upgrade          # memory and disk
catchpen restore dev before-upgrade
catchpen audit dev                            # what was done to the VM, and when

If a canary fires, the VM is paused (and you're notified, if you set up notifications); inspect it, then catchpen resume or catchpen destroy it. See Canaries and Snapshots.

Run it for the long term

catchpen daemon install                       # a systemd user service
catchpen pool ls                              # warm VMs ready for tasks

See Deployment for sizing, idle stop, scheduled rebuilds and headless hosts.

Documentation

Getting started

  • Installation: requirements, install, release verification, first VM, upgrading, building from source
  • CLI reference: every command and flag

Using catchpen

Security

Operating catchpen

  • Deployment: host sizing, the daemon, warm pool, idle stop, scheduled rebuilds, headless hosts, backups
  • The API: turning it on, enrolling clients, scopes, routes, streams and limits
  • Troubleshooting: logs, error messages and recovery

Contributing