Files
agent-mkosi/README.md
T
Job79andClaude Opus 5.5 eb8e4b440a feat: boot a test VM with mkosi -f vm
The [Runtime] section of mkosi.conf sets up mkosi vm for testing: it
passes the setup credentials (mkosi.credentials/agent.ssh-key prints your
own ssh keys), forwards ssh to port 2222 and adds the serial console,
since systemd-stub ignores the console= mkosi passes under Secure Boot.

Untested: in a container without systemd, mkosi vm hangs before qemu
starts, because it can't create a systemd scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 21:02:43 +01:00

37 lines
1.8 KiB
Markdown

# agent-mkosi
A VM that runs [Claude Code](https://claude.com/claude-code) in the background. It is a minimal Fedora image built with [mkosi](https://github.com/systemd/mkosi). You control Claude from claude.ai/code or the Claude app (Remote Control), or log in with ssh.
- **Resets at reboot:** Claude's home, `/tmp` and all containers are wiped at every boot. Only the setup answers and Claude's login survive (`/var/lib/agent`).
- **Read-only OS:** the root filesystem is read-only, so Claude can't change the OS. All state lives on `/var`.
- **Tools in containers:** Claude runs as the user `claude`, without root, and runs its toolchains in containers with podman. The host has only git, ssh and basic command-line tools.
- **Self-updating:** the `os` rebuilds weekly and updates with systemd-sysupdate.
## Install
Download [the disk image](https://git.plabble.org/api/packages/Job79/generic/agent/latest/agent.qcow2), resize it to the disk size you want and boot it with UEFI in Secure Boot setup mode. The console asks for a root password, a hostname and an ssh public key for the user `claude`.
Then log Claude in once:
```sh
ssh claude@<vm>
claude # trust the folder, then /login with your Claude account
```
The VM then shows up in claude.ai/code and the Claude app under its hostname.
## Development
```sh
mkosi genkey # local test only, CI uses the SECUREBOOT_KEY secret
mkosi build
```
`mkosi.output/` then holds the disk image (`agent_<version>.raw`) and the UKI and root partitions that make up an update. To build and boot a test VM with Secure Boot (needs `qemu-kvm-core edk2-ovmf`):
```sh
mkosi -f vm
```
The `[Runtime]` section of `mkosi.conf` answers the setup, so it boots straight to a login (root, password `test`). Then `ssh -p 2222 claude@localhost` with your own key (`mkosi.credentials/agent.ssh-key`).