agent-setup takes its answers from the credentials agent.password, agent.hostname and agent.ssh-key when they are given, so a test VM boots without typing. The README is shorter, explains the mkosi layout and shows how to boot a test VM with these credentials. Also uploads the manifest in the os workflow and ignores the test VM files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
2.4 KiB
Markdown
43 lines
2.4 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 boot it with Secure Boot (needs `qemu-kvm-core edk2-ovmf`):
|
|
|
|
```sh
|
|
qemu-img create -f qcow2 -F raw -b $PWD/mkosi.output/agent_<version>.raw test.qcow2 40G
|
|
cp /usr/share/edk2/ovmf/OVMF_VARS.fd vars.fd
|
|
qemu-kvm -m 8G -cpu host -nographic -nic user,model=virtio-net-pci,hostfwd=tcp::2222-:22 -drive file=test.qcow2,if=virtio \
|
|
-machine q35,smm=on -global driver=cfi.pflash01,property=secure,value=on \
|
|
-drive if=pflash,format=raw,readonly=on,file=/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd -drive if=pflash,format=raw,file=vars.fd \
|
|
-smbios type=11,value=io.systemd.credential:agent.password=test \
|
|
-smbios type=11,value=io.systemd.credential.binary:agent.ssh-key=$(base64 -w0 ~/.ssh/id_ed25519.pub)
|
|
```
|
|
|
|
The credentials answer the setup, so it boots straight to a login (root, password `test`) on the serial console. Ctrl-a x quits. Then `ssh -p 2222 claude@localhost`.
|