Skip to content
PermutationResearchPublic

About

Self-hosted persistent dev machines with a durable agent

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Hearth

Self-hosted dev machines: persistent Firecracker microVMs with host lifecycle management and a journal-backed built-in agent. The design is in docs/DESIGN.md; current qualification limits are below.

Warfare provides per-Mac Secure Enclave SSH identities and public-key sync across devices, with optional GitHub registration. Private keys stay on their originating Macs. Local macOS use needs no Apple Developer account, paid membership, or provisioning profile; see the linked setup and verification instructions.

Prototype repair candidate, not production-verified. Host lifecycle, the PostgreSQL control plane, built-in agent threads, CLI and web console exist. Gateway components exist, but gateway/native construction by hearth-control serve is not implemented and native providers remain disabled. Current changes, executed checks and external gates are recorded in the architecture status; historical slice passes do not qualify the current jailer/appliance or physical host.

People sign in through their OIDC provider and connect with a short-lived certificate bound to their person and machine. Team administration grants no implicit machine role. Guest sudo is removed: both human and agent logins are unprivileged, and root authority is limited to fixed host helpers. Migration 51 quarantines all previously written legacy rosters and historical sudo changes. After stopping a quarantined guest, its explicit owner uses hearth machine reprovision-accounts <team>/<name> (or the console Accounts action) to rewrite the roster and start it; ordinary start/wake cannot clear quarantine. Existing sessions are not retroactively killed by a database migration.

What works in slice 1

hearth-host (Rust, deps: serde, serde_json) runs as root on a Linux host with KVM, ZFS and firecracker.

Command What it does
image import Turns a rootfs into a sparse ext4 zvol with an @base snapshot. Takes either a squashfs tree (--rootfs-squashfs, e.g. Ubuntu) or a bare ext4 image (--rootfs-ext4, e.g. the NixOS flake). Baked-in SSH host keys are never used.
machine create Makes a ZFS clone of the image, gives it a fixed /30 address (encoded in the guest MAC), new SSH host keys, a new machine-id and an operator key forced to the pinned poweroff helper
machine start / stop Starts: TAP device, Firecracker, waits until SSH answers. Stops: guest poweroff over SSH, then SIGKILL after a timeout (recorded as forced)
machine resize Stopped machines only. vCPU and memory apply on the next boot. Disks grow only (volsize + e2fsck + resize2fs).
machine clone Copy-on-write clone of a stopped machine, with its own name, address and identity
machine delete Stopped machines only. Clones of the machine are promoted first so they keep their data.
machine list / show Inspect; arbitrary operator machine ssh is removed
rpc One JSON request on stdin, one JSON response on stdout. This is the control plane's interface (slice 2), run as an SSH forced command. Unknown operations and fields are refused.

Certificate access. machine create and machine clone take --user-ca <ca.pub>. Account reconciliation at start installs <machine>.<login> principals for the complete explicitly authorized roster; root certificate principals and --principal are removed. A clone never inherits its source's account principals. Legacy on-disk root-principal records are narrowed under the host lock with a durable incomplete-account marker before publication; stop/show remain available, but starting requires a complete account rewrite.

A VMM that dies on its own shows up as stopped with last_stop: crashed, and its TAP device is removed.

Identity files are written into a guest-controlled disk. Directories that are symlinks become real directories, files are recreated rather than written through links, and the disk is mounted nosuid,nodev,noexec, so a disk cannot redirect writes onto the host.

Not in slice 1:

  • memory snapshots;
  • the jailer (added later, and now required to start a machine; it has not run on a real host yet, see docs/releases/readiness.md);
  • outbound network (guests have no default route);
  • clones of running machines.

Workspace contracts and reusable tools

The console's Changes panel includes retained project specs and line-anchored review feedback. Comments can link existing tasks and become an unsent message draft. Refreshing workspace observations and sending a message are explicit actions.

The local integration factory lets an existing coding agent inspect public read-only sites, mint a parameterized browser tool, and serve an explicitly approved artifact through MCP without model calls during execution. With an operator-configured factory, the built-in agent can call approved tools through integration_run, requiring approval and never replaying automatically. See the operator guide for scope and client configuration.

Develop

On a Linux host: cargo test. Every host side effect goes through the Sys trait, and FakeSys simulates it, so the unit tests need no root, KVM or ZFS.

For a local ra-jit edit loop, use bash scripts/ra-jit.sh test -p hearth-optchat --lib. bash scripts/ra-jit.sh gc --dry-run inspects its function store; gc collects old packs while retaining Cargo artifacts and the running daemon. See the ra-jit and disk GC guide for cache scope, budgets, maintenance output and warm-cache limits.

From a Mac, build and test inside a Lima VM, which is also where the smoke test runs:

scripts/lima-dev.sh cargo test          # sync the working tree into the VM, then cargo there
scripts/lima-dev.sh cargo clippy --all-targets -- -D warnings
scripts/lima-dev.sh install             # release build, installs hearth-host in the VM

A static Linux binary for another host, built on the Mac without a cross toolchain:

scripts/build-linux.sh aarch64

Real lifecycle test, as root on a Linux KVM host (or a Lima VM with --nested-virt on Apple Silicon M3+). It uses its own state root and a file-backed pool:

sudo scripts/smoke-slice1.sh --hearth-host ./hearth-host --kernel vmlinux --rootfs-squashfs ubuntu-24.04.squashfs \
  --nixos-kernel result-1 --nixos-rootfs-ext4 result

NixOS guests

images/nixos is a flake. #rootfs is a bare ext4 filesystem holding a NixOS 26.05 system (no initrd, no partition table), and #kernel is Firecracker's CI kernel, pinned by hash. Outputs are declared for aarch64-linux and x86_64-linux; only aarch64 has been built and booted. The guest module (guest.nix) sets eth0 from the MAC, runs sshd, and leaves hostname, machine-id and SSH host keys to hearth-host.

nix build ./images/nixos#rootfs ./images/nixos#kernel
hearth-host image import nixos --os nixos --kernel result-1 --rootfs-ext4 result --size-gib 4

The guest module specifies Git, Python, Rust (compiler, Cargo and rust-analyzer), Node, the TypeScript compiler and the TypeScript language server. This toolchain change has not yet been built or boot-qualified. Guest outbound networking is disabled, so repositories and dependencies cannot be fetched directly.

The in-guest firewall is off. Its unit failed to start under the CI kernel, most likely for lack of netfilter support (not investigated further), and filtering belongs on the host's TAP device anyway. To change the guest, import nixosModules.guest into your own configuration.

The kernel and Ubuntu rootfs used so far are Firecracker's CI artifacts (s3://spec.ccfc.min/firecracker-ci/<build>/<arch>/). Images are per-architecture: an aarch64 image does not boot on an x86_64 host.

License

Hearth's own code is licensed under the MIT License with an OpenAI/Anthropic rider. It grants the MIT permissions to everyone except OpenAI, Anthropic, their affiliates, and anyone acting for them, who get no rights. This is not an OSI-approved open-source license.

Third-party code keeps its own license, and the rider covers only Hearth's changes to it:

  • files derived from nanocodex in crates/agent/ (MIT OR Apache-2.0; see crates/agent/PROVENANCE.md);
  • the vendored gitleaks rules and d3, under the license files beside them.

About

Self-hosted persistent dev machines with a durable agent

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages