google/capsem/build-images

Claude Code and agent skill by google/capsem

Trust tier 4
  • vendor
Source check pending

Checking that the SKILL.md file is still in the repository.

Building the Capsem VM runtime (kernel, initrd, rootfs). Use when working on the runtime package set, Dockerfile templates, kernel or rootfs builds, or the capsem-builder backend.

Install

npx vskill@latest install google/capsem/build-images

SKILL.md

The same SKILL.md was published earlier as google/capsem/build-images.

Building the Capsem VM runtime

Overview

Capsem builds one VM runtime: a kernel, initrd and rootfs per architecture. Applications come from OCI images (images/, resolved through images/catalog.toml), never from the runtime rootfs, so every build of a commit produces the same asset set.

  • config/docker/image/ is the runtime's source: build.toml (package set,

EROFS settings, size budgets, kernel pin, base images), manifest.toml, and the kernel/, security/ and vm/ inputs.

  • guest/artifacts/ holds the core guest payloads: capsem-init, doctor,

diagnostics, bench, the container launcher.

  • capsem-admin image build copies those two inputs into a generated backend

workspace under cache/target/build/image-workspace/<arch|all>/ and runs the build there.

  • The Python builder backend renders Docker templates and emits assets, build

ledgers, and OBOMs only when invoked by the admin build rail. Do not add product truth directly to the backend image-spec path.

Source Layout

config/
docker/ Dockerfile templates (*.j2)
docker/image/
build.toml Runtime package set, EROFS, rootfs budgets, kernel pin
manifest.toml Image manifest metadata and changelog
kernel/ defconfig.<arch> and ordered kernel patches
security/ Built-in web security inputs
vm/ Guest shell environment
guest/artifacts/ Core guest payloads: init, doctor, diagnostics, bench
images/ OCI application images and their catalog
cache/target/assets/ Generated VM assets
cache/target/packages/ Generated native packages

The materialized backend workspace is an implementation detail, not an authoring surface. It is never a config root.

capsem-admin is a tool, not a config authority. It validates, materializes, builds, and checks contracts; it must not grow scaffolding commands that invent MCP, AI provider, package, or rule truth. Do not add admin config roots, guest config roots, settings metadata, provider registries, or backend-owned catalogs as product truth.

CLI commands

bash
just build-assets [arch] # The runtime for one arch, or every one
just _build-assets [arch] # Same rebuild, CI-facing name
just _build-kernel arm64 # Kernel slice
just _build-rootfs arm64 # Rootfs slice
uv run --project build_system --frozen capsem-builder audit # Parse trivy/grype vulnerability output

Underneath, the gate runs capsem-admin image build [--config-root config] [--guest-dir guest] [--output assets] [--arch arm64|x86_64] [--template all|kernel|rootfs] [--clean] [--json].

Use admin/just recipes for all runtime image work. capsem-builder is a backend helper only; it must not expose or document public build, validate, inspect, mcp, render-only, or dry-run rails for image authoring. capsem-admin image build may call private Python modules such as capsem_builder.image.image_build_backend; agents must not make those modules public CLI contracts.

Per-arch asset layout

cache/target/assets/
manifest.json Version, checksums, asset list
B3SUMS BLAKE3 checksums
arm64/
vmlinuz Kernel
rootfs.erofs Root filesystem
initrd.img Initial ramdisk (repacked by just exec)

The approved release default is EROFS with lz4hc compression level 12 (config/docker/image/build.toml [build.erofs]).

config/docker/image/build.toml [build.rootfs] also owns two independent release budgets: the exported tar ceiling and the final EROFS ceiling. The builder checks the first before compression and the second before writing the artifact ledger. Never raise a size ceiling to accommodate an unexplained image jump; inspect the rootfs composition first.

Build Ledger

Each per-arch build emits build-ledger.log JSONL. The rootfs.config_inputs record captures the rendered rootfs package list and the EROFS config. Installed-package/component truth belongs in the CycloneDX OBOM, not the build ledger.

Adding a guest tool

The runtime package set is config/docker/image/build.toml [build.rootfs].runtime_apt_packages. Add a package there only when Capsem's own guest machinery needs it: the container launcher (runc, umoci, iptables, iproute2), capsem-init (auditd, e2fsprogs), the trust store the Capsem CA lands in, or what capsem-doctor, capsem-bench and the network diagnostics run with.

Anything a user or an agent works with -- an AI CLI, a language toolchain, a vendor binary -- belongs in an OCI image under images/, not in the runtime.

  1. Add the package to runtime_apt_packages (no duplicates; the model refuses

an empty or duplicated list).

  1. Rebuild with just build-assets (or just _build-rootfs <arch>).
  2. Verify with capsem-doctor inside a booted VM.

Do not edit generated Dockerfiles. Docker templates live under config/docker/.

Dockerfile templates

Templates live in config/docker/:

  • Dockerfile.rootfs-dependencies.j2 -- snapshot-selected Debian packages;
  • Dockerfile.kernel-dependencies.j2 -- snapshot-selected kernel toolchain and

the SHA-256-verified kernel archive;

  • Dockerfile.rootfs.j2 -- network-denied first-party rootfs assembly;
  • Dockerfile.kernel.j2 -- network-denied kernel compilation, initrd assembly,

and vmlinuz extraction.

asset-dependencies is the visible resumable frontier between those pairs. The gate materializes one input-keyed helper for every selected architecture/template, validates its platform and identity label, and passes only its exact image ID to the source build. Source builds always use BuildKit network none and never use the remote CI cache. A carried frontier must revalidate every helper; it must not silently rebuild inside the sealed lane. The dependency helpers reuse the one checked-in Debian snapshot authority rather than the mutable sources inherited from the base image.

Private build-helper generations

Local qualification and hosted qualification use one materialization path. Whenever an exact input-keyed helper is absent locally, its owning materializer first tries the platform-scoped generation under ghcr.io/google/capsem-ci. It validates the pulled image's platform, input-key label, and org.opencontainers.image.source label before retagging it locally. An unavailable, unauthenticated, or invalid remote generation falls through to the same deterministic network-open local build; there is no cache-only build path and no opt-in environment switch.

The private inventory contains the host builder, Linux parity base, install builder, both package builders, both guest Rust builders, the host asset-tools builder, and the host architecture's kernel and rootfs dependency builders. capsem-gate private-images --publish materializes that inventory before it publishes immutable generation tags. .github/workflows/private-images.yaml runs it weekly and on defining-input changes, independently of the release and official OCI image workflows, and retains the latest three tagged generations per helper and platform.

Developers who can read the repository's private packages may authenticate Docker to GHCR for warm local qualification. Missing credentials only select the local fallback; they do not change the resulting helper identity. Keep all helper Dockerfiles under build_system/docker/ and dependency templates under config/docker/; add any new network-open helper to the single inventory and the repository-source-label guard.

Keep the verified registry alias when retagging an imported helper. BuildKit can fetch inherited lazy layers from that origin; a local-only FROM name can redirect those fetches to Docker Hub. Resolve the registry digest through the shared Docker boundary and retain exact image-ID/platform checks. Cache retirement removes all owned aliases and accounts for the image bytes once. Every child build includes the Linux parity base and source lane: use the shared exact-reference check before building and verify the identity afterward. Without a qualified registry origin, keep the verified local tag even if Docker records local RepoDigests. BuildKit can resolve those digests through Docker Hub instead of the local image store, breaking sealed source builds.

Templates use Jinja2 with variables from the admin-materialized image workspace. Do not add a second preview rail for product truth; if a build input needs validation, add it to the normal admin validation path.

Every architecture's base_image is required to be its immutable repository@sha256:<child-manifest> identity. Do not use a mutable tag or the multi-platform index. capsem-gate materializes a missing exact child through the Docker daemon before the cross-execution probe and build lanes; keep this on the ordinary guarded Docker runner, not the host-process egress broker.


Builder Internals (for modifying the builder itself)

Architecture: config/docker/image -> admin workspace -> Pydantic -> context dict -> Jinja2 -> Dockerfile

  1. Runtime source (config/docker/image/ and guest/artifacts/).
  2. capsem-admin copies both into a backend build workspace.
  3. Pydantic models (build_system/builder/image/models.py) parse that workspace.
  4. Context dict (build_system/builder/image/docker.py) feeds Jinja2 templates.
  5. Jinja2 templates (config/docker/) produce Dockerfiles.
Key files
FileRole
build_system/builder/image/models.pyAll Pydantic models (enums, configs, top-level GuestImageConfig)
build_system/builder/image/config.pyBackend loader for admin-materialized build workspaces
build_system/builder/image/docker.pyContext builders (_rootfs_context, _kernel_context), rendering, build execution
build_system/builder/image/image_build_backend.pyPrivate admin-invoked image build backend; not a public CLI
crates/capsem-admin/src/image_build.rsimage build / image workspace: workspace materialization and the build plan
config/docker/Dockerfile.rootfs.j2Rootfs Dockerfile template
config/docker/Dockerfile.kernel.j2Kernel Dockerfile template
build_system/builder/image/validate.pyValidation rules (E001-E302, W001-W012)
build_system/builder/image/cli.pyClick CLI entry points
Context dict (rootfs template variables)

_rootfs_context() in docker.py builds the dict passed to Dockerfile.rootfs.j2 (plus the Debian snapshot keys):

python
{
"arch": ArchConfig, # Per-arch settings (docker_platform, rust_target, etc.)
"arch_name": str, # "arm64" or "x86_64"
"apt_packages": list[str], # build.toml [build.rootfs].runtime_apt_packages
"guest_binaries": list[str], # GUEST_BINARIES in docker.py
}
Kernel context dict
python
{
"arch": ArchConfig,
"arch_name": str,
"kernel_version": str, # exact checked-in release, e.g. "6.18.44"
"kernel_sha256": str, # verified before the source archive is extracted
"kernel_patches": list, # applied in order with --fuzz=0
}

How to: Add a new guest binary

Guest binaries are compiled from crates/capsem-agent/. Every architecture on every host goes through container_compile_agent(); native Linux has no second ambient Cargo/rustup rail. The asset preflight first materializes the host platform's config-selected exact Rust child image plus the checked-in Rust toolchain and Cargo.lock; a foreign target also materializes its exact config-pinned C compiler package and both the foreign-target and host-target Cargo dependency sets. The host set covers target-gated build-script and proc-macro dependencies that cargo fetch --target <foreign> does not select. The actual container build runs with --network none and Cargo --locked --offline.

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 31 Oct 2026.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
58
Repository forks
8
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill CERTIFIED badge
[![vskill CERTIFIED](https://verified-skill.com/api/v1/skills/google/capsem/build-images/badge)](https://verified-skill.com/skills/google/capsem/build-images)

Something wrong with this skill or its page? Tell us.