feat: root adds the ssh keys, mkosi ssh for the test VM

The setup no longer asks for an ssh key. Root logs in on the console and
adds keys for claude and root to /var/lib/agent. Root may log in with
ssh, and its home is a tmpfs that is wiped at every boot. The test VM
uses mkosi ssh instead of a forwarded port, so the agent.ssh-key
credential is gone.

Also mount /var with noatime, move STYLE.md into AGENTS.md and rewrite
comments to start with the name of what they describe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-19 19:10:54 +01:00
1 parent 8aeb448936
commit db8fb0d5a4
15 files changed
+218 -180

No files matched your search

+25 -21
View File
@@ -1,24 +1,28 @@
# 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.
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.
- **Resets at reboot:** the homes of Claude and root, `/tmp` and all containers
are wiped at every boot. Only the setup answers, the ssh keys 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.
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. At first boot, the
console asks for a root password and a hostname. Then log in as root, add an
ssh key for the user `claude` and run Claude once to sign in. The VM then shows
up in claude.ai/code and the Claude app under its hostname.
## Development
@@ -27,13 +31,13 @@ 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.
`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 (needs `qemu-kvm-core edk2-ovmf`):
To build and boot a test VM (needs `qemu-kvm-core edk2-ovmf openssh-clients
socat`):
```sh
mkosi -f vm # log in as root, password test
ssh -p 2222 claude@localhost # with your own key
mkosi -f vm # opens its console: log in as root, password root
mkosi ssh # in another terminal: ssh in as root
```
[AGENTS.md](AGENTS.md) has the details, such as testing from a dev container.