Skip to content

Templates

A VM's template is what it contains: distro, size, software, network policy, agents, credentials and repos. You build one with -t, by picking sections from category files:

catchpen up dev                                        # every category's default
catchpen up dev -t go-1.27,python-3.14                 # the defaults, plus Go and Python 3.14
catchpen up dev -t ubuntu-26.04,large,go-1.27,-docker  # another distro and size, Go, no Docker

Software is baked into a base image built from the template; VMs are thin copy-on-write overlays on it.

catchpen template ls [category]        # every section, with the defaults marked
catchpen template show -t go-1.27      # the settings a -t gives, and where they come from
catchpen template build -t go-1.27 [--rebuild]
catchpen template rebuild --all        # fresh cloud image and packages, as a new base

How -t works

Each category is a file of named sections, plus a default. For every category:

  • if -t names none of its sections, its default applies;
  • in most categories, the sections -t names are added to the default, and -name drops one of the default's sections (-t -docker,-codex);
  • in the one-choice categories (distros, resources, ssh, idle), the section -t names replaces the default, and naming two is an error. A size may set only some of cpus, memory and disk; the default size gives the rest.

Picks apply left to right: -t docker,-docker has no Docker, and picking a section again moves it last, so its settings win (-t open,allowlist is the allowlist). A pick named in -t wins over one from a profile (-t minimal,large is minimal at the large size, and -t docker,minimal has Docker), and a profile's -name of a section that isn't chosen does nothing (in a one-choice category, unless it leaves none). -name of a list in a category file removes each of its sections (-t -tools:default drops the default tools); a profile can't be removed.

-t is a comma-separated list of at most 160 characters (put longer ones in a profile). A name must be unique across categories; when it isn't (say you add a docker section to network.yaml), say which: -t runtimes:docker. category:default is that category's default, so -t runtimes:default is the same as no runtime picks.

Sections are merged in category order, below. Within a category, lists add up (packages, presets, cache, ...), settings like go: or egress: take the last section's value, agents merge field by field, env by name and mcp by server name. skills and plugins add up too, and entries for agents the VM doesn't have are dropped. A runtime picked with -t overrides the Node version the agents ask for (-t node-22).

A VM records its -t (catchpen ls shows it as TEMPLATE), and uses it again for catchpen reset --latest, rebase, template rebuild --all and creds push. So editing a section changes what those give for every VM that picked it.

Categories

File Sections set Built-in default Built-in sections
distros.yaml distro ubuntu-24.04 ubuntu-24.04, ubuntu-26.04, debian-13
resources.yaml resources medium small (2 CPUs, 4G, 20G), medium (4, 8G, 40G), large (8, 16G, 80G), xlarge (16, 32G, 160G)
tools.yaml packages, tools, scripts, files core, build, gh core (git, curl, jq, tmux, ripgrep, ...), build (build-essential, make, python3, ...), gh, tea
agents.yaml agents, the runtimes they need, and their skills and plugins claude, opencode, pi, codex claude (with Anthropic's skill-creator, mcp-builder and frontend-design skills), claude-vanilla (no skills; pick it with -t -claude,claude-vanilla), claude-api-key, claude-yolo, opencode, pi, omp, codex, codex-api-key, codex-chatgpt
runtimes.yaml runtimes, docker docker, uv docker, uv, node-22, node-24, go-1.26, go-1.27, python-3.12, python-3.13, python-3.14
network.yaml network allowlist and the presets below allowlist, open, offline, prompt; anthropic, github, npm, pypi, go, apt-ubuntu, apt-debian, docker-apt, docker-hub, ghcr (one per preset)
caches.yaml cache all five apt-cache, go-cache, npm-cache, pypi-cache, docker-cache
canaries.yaml canaries all three aws-canary, env-canary, git-canary
env.yaml env none none
mcp.yaml mcp none none
ssh.yaml ssh ssh-off ssh-off, ssh-host
sync.yaml sync none (git identity is copied) claude-config, no-git-identity, claude-ai-sync, opencode-claude-skills
repos.yaml repos none none
ports.yaml ports none none
idle.yaml idle_stop none (config.yaml idle_stop) idle-30m, idle-1h, idle-2h, idle-off
profiles.yaml lists of picks none minimal

catchpen template ls prints the full list with descriptions. A section may set only its category's settings, and a description.

Your sections

catchpen init writes every category file to ~/.config/catchpen/templates/. Each one explains itself, shows catchpen's built-in sections commented out, and most have examples. To use one, uncomment it with all the lines under it:

# ~/.config/catchpen/templates/ssh.yaml
github-ssh:
  description: Sign git over SSH with my key
  ssh: { agent: restricted, agent_keys: [~/.ssh/id_ed25519], confirm: false }
# ~/.config/catchpen/templates/env.yaml
gh-token: { env: { GH_TOKEN: "secret:GH_TOKEN" } }
catchpen up dev -t github-ssh,gh-token --repo github:acme/api

Your file is read on top of catchpen's: a section with a built-in name replaces it, and default: replaces the built-in default. Sections you don't redefine keep tracking catchpen's, so new built-in sections (a new Go version, say) reach you on upgrade.

Section names are lower case letters, digits, ., _ and -, start with a letter or digit, are at most 48 characters, and are defined once per file. Any other *.yaml in that folder, such as an old-style template, is refused until you move or rename it. Relative paths in scripts and files[].src resolve inside ~/.config/catchpen/templates/ (symlinks there are followed); absolute paths and .. are rejected. Unknown settings are errors.

Profiles

A section can also be a list of picks, used like one section. profiles.yaml holds lists that span categories:

# ~/.config/catchpen/templates/profiles.yaml
acme-api: [github-ssh, gh-token, api, go-1.27, large]
catchpen up dev -t acme-api

Lists may include -name and other lists. In a category file other than profiles.yaml, a list names sections of that category: runtimes.yaml could hold web: [node-24, python-3.14].

The built-in minimal profile is the defaults minus everything optional: small, the core tools, the allowlist with only the anthropic preset, and no agents, runtimes, caches or canaries. It removes catchpen's built-in default sections by name, so sections you add to a default stay: with default: [claude, omp] in agents.yaml, -t minimal has omp.

Defaults

default: is a section name, a list of names, or settings of its own:

# ~/.config/catchpen/templates/resources.yaml
default: large                     # every VM gets 8 CPUs unless -t says otherwise
# ~/.config/catchpen/templates/agents.yaml
default: [claude, omp]             # no opencode, pi or codex by default

Settings

Setting Values
distro ubuntu-24.04, ubuntu-26.04, debian-13, or a name from images: in config.yaml.
resources cpus (1 to 256), memory, disk: sizes like 512M, 8G, 1T. --cpus, --mem and --disk on catchpen up override them.
packages apt package names, optionally name=version.
docker true installs Docker and configures it for the proxy and caches.
runtimes node: "24" (a major version, quoted), go: "1.27" or "1.27.1", python: uv or a version like "3.14" (installed with uv, as python3.14 and python).
scripts Scripts run as root at base build, in order.
files {src, dst, mode}: copied in at base build. dst is absolute or ~/; mode like "0644".
tools gh, tea.
ports "guest" or "host:guest", bound to 127.0.0.1. Host port 0 or omitted picks a free port at start.
network egress (allowlist, open, none), presets, allow, on_deny (log, prompt), prompt_timeout (default 30s), allow_private. See egress.md.
agents claude, opencode, pi, omp, codex. See agents.md.
env Environment for every ssh session: literal values or secret:NAME. Names are upper case letters, digits and _, not starting with a digit, at most 64 characters; HOME, USER, PATH, SHELL and LOGNAME are refused, and so is ANTHROPIC_API_KEY with Claude whose auth isn't api-key.
mcp MCP servers for all agents. See agents.md.
skills {agent, git, ref, path, name}: a folder with a SKILL.md from an https git repo at a full 40-character commit ref; path is the folder (. for the repo's root), name its name in the guest (default: the last element of path, or the repo's name for .): lower case letters, digits, ., _ and -, starting with a letter or digit, at most 64 characters, not starting with catchpen; two skills, or two plugins, of one agent can't share a name. Without agent, every agent the VM has gets it. See agents.md.
plugins {agent, git, ref, path, name} as for skills, but agent is required; for pi also {agent: pi, bundled, name}, a path in pi's installed package, named by default after its file without .ts or .js. See agents.md.
sync git_identity (default true), claude_config (default false), claude_ai (default false), opencode_claude_skills (default false).
ssh agent (off, restricted, host), agent_keys, confirm (default true). See forges.md.
repos Repos cloned into /workspace/<repo> at start. See forges.md.
idle_stop off, daily, weekly or a duration of at least 1m; overrides config.yaml.
cache Any of apt, go, npm, pypi, docker. See package-caches.md.
canaries Any of aws, env, git. See canaries.md.

Bases and rebuilds

The first catchpen up of a template downloads and verifies the cloud image and builds the base, which takes a few minutes. Later VMs of the template boot in seconds. On a terminal, the build shows its current step with a spinner and how long it has run.

Bases are named after the distro and a hash of what they contain (ubuntu-24.04-<hash>.qcow2), so -t lists that give the same software share one base: -t large or -t ssh-host don't build another.

Changing the software in a template (packages, runtimes, scripts, files, agents' versions and the like) means a new base, built on the next up of a new VM. Existing VMs keep their base and software; only reset --latest (a fresh disk on the new base) gives them the new software, while rebase moves a disk onto the new base without changing its files. See snapshots.md. catchpen template build -t <picks> --rebuild forces a build, re-checking the cloud image upstream, and catchpen template rebuild --all refreshes every base. Over the API, POST /v1/templates/build (template, rebuild) and POST /v1/templates/rebuild (templates, at most 64, or all) do the same, as jobs.

Base builds run with the same isolation as VMs, through a proxy that allows any public host but no private address, and use the template's package caches (Docker's excepted). Build logs are in ~/.local/share/catchpen/bases/; see troubleshooting.md.

Over the API

For a client enrolled with --scope config:write (403 otherwise; over the unix socket, every call is allowed), catchpen daemon's API reads and writes your category files in ~/.config/catchpen/templates/ and shows what a -t spec gives. Sections can hold literal values (env, MCP headers), so reading them needs the scope too; GET /v1/templates lists every category's sections, without their settings, to any client.

Call What it does
GET /v1/templates/files/<category> Your file's text, its SHA-256 (hash, "" with no file), whether it exists, and builtin: the built-in file's text.
POST /v1/templates/files/<category> text and base_hash, as for config.yaml: written, or created with a base_hash of "" (0600, or the file's mode).
POST /v1/templates/files/<category>/delete base_hash and "confirm": true: removes your file, so the built-in sections apply again.
GET /v1/templates/show?t=<spec> What catchpen template show prints: the spec, normalized, the sections each category gave (parts), the base image's path and the settings, as YAML.

<category> is one of the categories (404 otherwise). A write or a delete may not break what worked: it is refused (400), nothing changed, if the category files loaded before it and wouldn't after, or if the default template, a profile or a pool: entry's template passed before it and wouldn't after, checked as catchpen up checks a template (its sections, distro, cloud-init, and an allowlist's presets and entries; not its repos, which need their forge, nor open egress or ssh.agent: restricted, which need --allow-open or a repo). A pool: entry the write adds must pass. The error names the template, such as -t default, -t profiles:<name> or pool template <spec>. What didn't work may stay so, and other sections are checked when a VM picks them, as after a hand edit, since a section or a profile may be meant only with other picks; nor are the templates existing VMs were made from checked (a rebuild of one says so). As with config.yaml, a stale base_hash or a file that is a symbolic link, has other hard links, belongs to another user, is read-only or isn't a regular file is refused (409), writes wait for each other (one lock with config.yaml's), and each is audited as config.write, its file templates/<category>.yaml (a delete's new_hash is ""). The scripts and files sources a section names aren't written over the API: put them in the templates directory by hand first.