Developer Documentation

Kiln User Guide & Architecture Reference

Everything you need to run fast, isolated macOS & Linux ARM64 GitHub Actions runners, Peer-Mesh NVMe caches, Docker mirrors, and symmetric Mac fleets.

The Kiln Approach: Author Mutable, Execute Immutable

Traditional self-hosted CI falls into two traps: either you maintain brittle long-lived bare-metal runners that accumulate stale caches and Keychain certs over time, or you constantly rebuild and pull 45 GB pre-canned VM images on every small dependency tweak.

Kiln separates image authoring from job execution cleanly into two distinct phases—for both macOS and Ubuntu ARM64 + Docker guests:

  • Phase A — Mutable Authoring (Template Studio): Spin up a hands-free Ubuntu 24.04 ARM64 + Docker template in ~90 seconds, or start from Apple’s official .ipsw restore image, customize visually or via a kiln.yml Toolchain Recipe, inspect the verified SBOM, and click Seal Template.
  • Phase B — Immutable Ephemeral Execution: Sealing locks Disk.img read-only. Every CI job gets a sub-50 ms APFS copy-on-write clone wired automatically to your host’s NVMe actions/cache and Docker mirror, runs with a single-use RAM-only GitHub token, and vanishes when finished.
Why Kiln Runs Linux ARM64 Beside macOS: Apple Silicon Virtualization.framework caps concurrent macOS VMs at 2 per physical Mac host. Linux VMs have no OS cap—so Kiln packs elastic Ubuntu ARM64 + Docker runners into your remaining RAM headroom to run full-stack CI on the exact same hardware.

Runtime Lifecycle (Step-by-Step Packet Flow)

Step 01Job DetectionGitHub App polls via conditional ETag (304 = 0 quota) or keeps Always-Warm VMs idling.
Step 02APFS Clone (<50 ms)Darwin clonefile(2) forks sealed .vmtemplate with fresh ECID & MAC.
Step 03Vsock + Cache BridgeGuest connects over AF_VSOCK and receives NVMe ACTIONS_CACHE_URL + Docker mirror endpoints.
Step 04RAM-Only JITHost mints single-use --jitconfig + optional pre-job hotfix in VM memory.
Step 05Telemetry & TeardownJob exits → Peak RAM/CPU recorded → VM stops and ephemeral clone deletes from APFS.

Terminology Glossary

Filter any term used inside Kiln’s interface, configuration files, or architecture:

Golden Template.vmtemplate

A self-contained macOS or Linux ARM64 VM bundle holding the sparse Disk.img, AuxiliaryStorage, HardwareModel.bin, MachineIdentifier.bin, and Manifest.json.

Why it matters: Acts as your immutable read-only gold master for instant copy-on-write cloning.

Template StudioWindow

Kiln’s live customization window where a Golden Template boots in mutable mode with a 7-step progress accordion, expand-up live log stream, and direct host-to-guest provisioning.

Why it matters: Lets you install, test, and inspect the exact OS & Xcode or Docker environment before freezing it.

Fleet-Local actions/cache AcceleratorPeer Mesh

Kiln automatically injects ACTIONS_CACHE_URL and Twirp v2 endpoints into every macOS and Linux VM before jobs start—backed by up to 200 GB of local NVMe LRU storage per Mac and encrypted KLN1 pull-through from paired Macs.

Why it matters: Standard actions/cache@v3/v4, setup-node, rust-cache, and Buildx steps work unmodified without hitting GitHub’s 10 GB repo limit.

Docker / OCI Registry MirrorLinux ARM64

Transparent pull-through container mirror wired automatically into every Ubuntu ARM64 + Docker guest VM via KILN_DOCKER_MIRROR_URL, with optional peer pull-through across Macs.

Why it matters: Eliminates Docker Hub rate-limit failures and avoids re-downloading base container layers across ephemeral builds.

Elastic Memory Pool & Runner Profiles2 GB – 16 GB

Instead of fixed rigid slots for Linux, Kiln packs concurrent Linux ARM64 + Docker runners dynamically inside a configured Elastic RAM Ceiling using matching runner size profiles (e.g., 2 GB small lint jobs vs. 8 GB Docker suites).

Why it matters: Fits maximum parallel Linux throughput around active macOS Xcode slots without OOM thrashing.

Storage Hygiene & External NVMeAuto-Evict

Tracks exact APFS physical disk consumption across templates, Xcodes, IPSWs, and caches, supports 1-click relocation onto external Thunderbolt NVMe drives (locally or remotely), and enforces automated retention & minimum free-space headroom policies.

Why it matters: Prevents unattended 24/7 Mac minis from stalling due to full disks.

Guest Peak RAM Right-Sizing AdvisorFinOps Telemetry

Automatically records guest Peak RAM, CPU usage, OOM detection, and avoided GitHub runner spend per job with zero template rebuilds required.

Why it matters: Shows you when a runner size profile is starving on memory or over-allocated.

Sealing & UnsealingState Lock

Sealing marks Disk.img read-only (0444) on macOS so no background edit can drift the image. Unsealing unlocks a template so you can reopen it in Template Studio.

Why it matters: Guarantees concurrent slots always boot byte-identical clean environments.

Ephemeral SlotmacOS / Linux

An isolated execution lane backed by its own temporary APFS clone folder (EphemeralSlots/), unique VM ECID hardware identifier, and randomized NAT MAC address.

Why it matters: Eliminates DHCP IP collisions and cross-build contamination across concurrent jobs.

APFS Copy-on-Write (clonefile)<50 ms

Kiln invokes Darwin’s native clonefile(2) syscall rather than copying gigabytes on disk. A cloned 80 GB sparse disk allocates 0 additional data blocks until the VM writes changes.

Why it matters: Near-instant job startup even with full multi-version Xcode installations inside.

Toolchain Recipekiln.yml

A declarative YAML specification (import/exportable with standard Brewfiles or synced from a shared GitHub repo) listing Xcode versions, Simulator runtimes, Homebrew packages, gems, npm/pipx/cargo globals, env vars, and post-install checks.

Why it matters: Keeps CI tooling version-controlled across all engineering teams.

Host Toolchain Cache0-Dup Staging

Managed directory containing staged Xcode*.app bundles (APFS-cloned from Host /Applications in <1s or downloaded in-app via xcodes).

Why it matters: Avoids downloading 15 GB .xip files repeatedly inside virtual machines.

Hypervisor AF_VSOCKPorts 5000 / 5001

Apple VZVirtioSocketDevice memory-bus channels between Host Kiln and Guest KilnGuestHelper. Port 5000 carries JSON lifecycle events, provisioning commands, and JIT tokens; port 5001 streams cached Xcode bundles over tar.

Why it matters: Bypasses guest SSH/firewall complexity and avoids VirtioFS symlink traversal errors.

JIT Runner Config (--jitconfig)Zero Disk Secrets

A single-use GitHub Actions self-hosted runner registration payload minted on-demand by Kiln’s GitHub App just before handing off to a cloned VM, passed strictly in memory over vsock.

Why it matters: A VM cannot linger as a persistent registered runner—one job, one token, one clean wipe.

Always-Warm vs. Scale-to-ZeroExecution Modes

Always-Warm keeps cloned VMs already booted and waiting in RAM for 0-second job pickup. Scale-to-Zero keeps 0 VMs running while idle, booting clones only when GitHub signals a queued matching job.

Why it matters: Tune dedicated Mac Minis for instant speed or shared developer Macs for zero idle RAM.

Conditional ETag Polling304 Not Modified

GitHub API polling with If-None-Match headers. When no workflow status has changed, GitHub returns HTTP 304 Not Modified—which does not deduct from your API rate limit and needs zero inbound webhooks.

Why it matters: Works behind home/office NAT without exposing webhooks or relays.

Blue-Green Patch & SwapvN → vN+1

Clones an active sealed template (vN), boots vN+1 headlessly, updates Homebrew, GitHub’s actions-runner, recipe tools, Ubuntu packages, and optional macOS security updates, verifies its SBOM, seals vN+1, and swaps active traffic atomically—keeping vN ready for 1-click rollback.

Why it matters: Real-time maintenance with zero dropped or blocked CI builds.

Emergency Pre-Job HotfixBoot Injection

An optional shell snippet attached on Live Runners that Kiln streams via AF_VSOCK to execute immediately before a slot starts actions-runner/run.sh.

Why it matters: Mitigate broken CI environments in <1 second while waiting on a full template rebuild.

Live Peek & View-Only ShieldVisual Debug

Opens a live VZVirtualMachineView window into any running Ephemeral Slot with mouse and keyboard input locked by default until explicitly unlocked.

Why it matters: Safely watch iOS Simulator UI tests or Xcode modals during a live run without interfering.

Symmetric Fleet Mesh (KLN1 & 6-Digit PIN)Multi-Node

Discovers Kiln peers via Bonjour and Tailscale with zero primary/worker lock-in. Ephemeral 6-digit PINs derive TLS 1.3 PSK credentials via HKDF-SHA256 to sync keys, remote pools, storage drives, Peer Cache archives, and 4 MiB LZFSE delta templates.

Why it matters: Scale across a rack and control every node from any Mac in the cluster.

Offline Ed25519 Lease Token (kln1)7-Day Grace

Stateless Ed25519-signed lease token refreshed every 12 hours via /api/v1/licenses/heartbeat and verified offline inside Kiln.app against pinned CryptoKit public keys.

Why it matters: Guarantees customer CI runners continue building cleanly through ISP or cloud outages.

End-to-End Setup Walkthrough

1. Install Kiln & Activate Your Workspace License

Download the latest notarized Kiln-v*-arm64.dmg from the Downloads page, drag Kiln.app into /Applications, and paste your kiln_live_... license key from Workspace Keys (free forever for 1 Mac on Hobbyist). Review any host checks in the built-in Host Readiness Doctor (sleep prevention, auto-restart after power loss, and FileVault status).

2. Connect GitHub (2-Click Manifest or Fleet PIN)

On your first Mac Mini, open System Settings (or the Guided Onboarding screen):

  1. Choose GitHub Organization (recommended) or Single Repository.
  2. Click Create GitHub App—Kiln registers a least-privilege GitHub App in Safari and saves its RSA private key straight into macOS Keychain.
  3. Install the App on your chosen repositories in Safari; Kiln auto-detects the installation ID within seconds. (Paired Macs can skip this completely via 6-digit PIN!)
Security Rule: Always assign self-hosted Kiln runners to an Organization Runner Group restricted to Private repositories only, and inject signing certificates (.p12 / App Store Connect API keys) at job time via temporary workflow Keychains—never bake production signing secrets into Golden Templates.

3. Stage Xcode & Customize Your Recipe

Open Xcode & Toolchains in Kiln’s sidebar before building your macOS template:

  • Stage Xcode on the Host: Click Stage into Kiln Cache beside an installed /Applications/Xcode*.app (<1s APFS clone), import an .app/.xip, or download from Apple directly inside the UI.
  • Pick Tools & Simulators: Toggle iOS/visionOS/tvOS/watchOS Simulator runtimes, choose presets (xcbeautify, swiftlint, fastlane, cocoapods, tuist, gh, node, ruby), or sync a shared team kiln.yml / Brewfile directly from a private GitHub repository.

4. Create & Seal Templates (macOS + Ubuntu ARM64)

Open Golden Templates in the sidebar:

  • macOS (Xcode): Download macOS from Apple once into IPSW cache, set vCPU/Memory/Sparse Disk, keep Hands-Free Setup checked, and click Build & Seal Template Automatically.
  • Linux ARM64 (Ubuntu + Docker): Switch to the Linux ARM64 tab and create a hands-free Ubuntu 24.04 + Docker + Buildx template in ~90 seconds with zero manual prompts.

5. Arm Runners & Trigger Your Workflow

Open Pools & Sizing or Live Runners, choose your Elastic RAM ceiling and warm/scale-to-zero targets, and click Start Runners:

Workflow runs-on labels
# macOS (Xcode) jobs:
runs-on: [self-hosted, macos, arm64]

# Linux ARM64 + Docker jobs:
runs-on: [self-hosted, linux, arm64, kiln-linux]

Fleet Scaling & Day-2 Operations

Peer-Mesh actions/cache & Docker Registry Mirror

Open Cache & Registry in Kiln’s sidebar to inspect hit rates, peer pull-through traffic, and LRU storage quotas (5 GB–200 GB per Mac):

  • Zero-YAML Interception: Every guest VM automatically receives ACTIONS_CACHE_URL and Twirp v2 endpoints. Standard actions/cache@v3/v4, setup-node, rust-cache, and Docker Buildx steps use local NVMe without workflow changes or GitHub’s 10 GB eviction limit.
  • KLN1 Mesh Pull-Through (Team+): When a cache key misses locally on Mac #2, Kiln queries paired Macs over encrypted KLN1 before falling back to a clean cache miss.
  • Docker / OCI Mirror: Linux ARM64 VMs pull Docker Hub & GHCR layers through Kiln’s pull-through registry mirror to prevent upstream rate limits.

Elastic Pools, Remote Tuning & Peak RAM Right-Sizing

In Pools & Sizing, switch the target picker between This Mac and any paired remote peer to configure its Elastic RAM ceiling, warm VM targets, and Linux size profiles (2 GB, 4 GB, 8 GB). Visit Insights & Savings to track avoided cloud spend alongside real guest Peak RAM / CPU utilization and right-sizing tips.

Zero-Downtime Blue-Green Patch & Swap

Under Golden Templates, click Patch & Swap (vN+1) on any sealed template (optionally check macOS Security Updates on Patch). Kiln clones the disk, runs your latest recipe + brew upgrade + runner update headlessly without touching live builds, diffs the SBOM, and swaps traffic once clean. Need to revert? Click Roll Back / Activate beside any prior sealed revision.

Emergency Boot-Time Hotfixes

Expand Emergency Boot-Time Hotfix (pre-job) on Live Runners to inject a quick command right as ephemeral clones boot over AF_VSOCK—useful when a workflow needs an immediate env var or missing formula before your next scheduled patch.

Multi-Mac Symmetric Fleet Setup (LAN & Tailscale)

  • 1-Click Remote Mac Mini Deploy: In Fleet Macs, pick any Bonjour or Tailscale peer with Remote Login (SSH) enabled, click Deploy Kiln…, and Kiln ships Kiln.app, your license key, GitHub/Fleet credentials, unattended host defaults, and your sealed Golden Template over sparse delta sync.
  • PIN Pairing Across Macs: Click Generate 6-Digit PIN on Mac #1, then click Join with PIN… on Mac #2 to transfer Keychain secrets, Peer Cache keys, and workspace licensing over TLS 1.3 PSK.
  • Rolling Cluster Updates: Push one-click Kiln.app self-updates across every paired Mac from any node in the cluster.

External NVMe Relocation & Automated Disk Hygiene

Open Storage & Hygiene to view exact physical APFS disk usage per template, Xcode, and cache item on This Mac or any online peer. Click Relocate Drive… to migrate VM stores or caches onto high-capacity Thunderbolt NVMe drives, and configure retention & minimum free-space headroom policies so builds never hit a full disk.