CDX-301d · Module 1
Boot Sequences & Initialization
3 min read
A Codex microVM boot sequence has four phases: hypervisor allocation (KVM resources, memory pages, vCPUs), kernel boot (minimal Linux kernel, initramfs), userspace initialization (mount overlay, configure networking, load environment), and task preparation (clone repo, install dependencies, load AGENTS.md). The first two phases complete in under 200 milliseconds. The third adds 50-100 milliseconds. The fourth — cloning and dependency installation — dominates total startup time and can take 10-60 seconds depending on repository size and dependency count.
The boot sequence is why repository size and dependency count directly impact cloud task latency. A 50 MB repository with a 200 MB node_modules tree takes 15 seconds to prepare. A 2 GB monorepo with 1.5 GB of dependencies might take over a minute. Optimizing for cloud execution means keeping your repository lean, your lock files clean, and your dependency tree pruned. Every megabyte you remove from the dependency tree saves boot time across every cloud task.
# MicroVM boot timeline (typical)
0 ms — Hypervisor allocation (KVM fd, memory region)
50 ms — Kernel loaded, initramfs mounted
125 ms — Kernel boot complete, init process starts
200 ms — Overlay filesystem mounted, networking configured
300 ms — Userspace ready, task preparation begins
3 s — Repository cloned (small repo, shallow clone)
15 s — Dependencies installed (npm ci, cached layers)
18 s — AGENTS.md loaded, task execution begins
# Optimization levers
- Repository size: shallow clone depth, .gitignore, LFS
- Dependencies: lockfile hygiene, minimal dev dependencies
- Snapshots: pre-warmed images skip clone + install entirely
- Measure your boot time Submit a no-op cloud task and measure the time from submission to first execution log entry. This is your baseline boot time.
- Audit your dependency tree Run `du -sh node_modules` (or equivalent) locally. If it exceeds 500 MB, prune unused packages — every megabyte is boot time.
- Check clone depth If your repository has deep history or large binary assets, ensure shallow cloning is configured. Cloud tasks do not need full git history.