feat: Hermes confined to act only as an Endo guest
A NixOS module (nix/hermes-guest.nix) layers confinement on upstream's services.hermes-agent: no network (PrivateNetwork), an empty /run with two Unix sockets bound back in, and no user manager. Hermes reaches the world through host.sock, the guest's Endo methods (listMessages, request, lookup, reply, ...) as MCP, and llm.sock, an inference proxy that holds the API key. The same unit runs on a Linux host (nix/linux-host.nix) and in a vfkit microVM on macOS (nix/vfkit-vm.nix), where systemd relays the two sockets over vsock to launchd on the host (nix/darwin-host.nix). test/demo.py runs unmodified Hermes against a fake host and a scripted model, and checks what the host received. Generated-by: Claude Opus 5.5
This commit is contained in:
commit
e38d681a9e
13 files changed
+1379
No files matched your search
@@ -0,0 +1,57 @@
|
||||
# hermes-guest
|
||||
|
||||
[Hermes Agent](https://github.com/NousResearch/hermes-agent), confined so that it can act only as one Endo guest (of toybox, or of an Endo daemon). Its systemd unit ([nix/hermes-guest.nix](nix/hermes-guest.nix)) has no network and sees two Unix sockets, and nothing else:
|
||||
|
||||
- `/run/hermes-guest/host.sock`: the guest's methods (`listMessages`, `request`, `resolve`, `lookup`, ...) as an MCP server, bound to one guest agent. Hermes reaches it as the MCP server `host`.
|
||||
- `/run/hermes-guest/llm.sock`: model inference, through [llm-proxy.py](llm-proxy.py), which holds the API key and forwards to one upstream.
|
||||
|
||||
The connection designates the guest: each socket is mode 0600, owned by Hermes's user, so no secret designates it.
|
||||
|
||||
The same unit runs on both platforms; what differs is who serves its sockets.
|
||||
|
||||
```
|
||||
Linux: hermes-agent.service ──► the host's socket unit (host systemd)
|
||||
──► hermes-llm.socket (host systemd)
|
||||
|
||||
macOS: [NixOS microVM (vfkit) ]
|
||||
hermes-agent.service ──► relay socket ──vsock──► vfkit ──► hostDir/host.sock (the host)
|
||||
──► relay socket ──vsock──► vfkit ──► hostDir/llm.sock (launchd)
|
||||
```
|
||||
|
||||
## On Linux (NixOS)
|
||||
|
||||
```nix
|
||||
imports = [ hermes-guest.nixosModules.linux-host ];
|
||||
services.hermes-guest = {
|
||||
enable = true;
|
||||
model = "anthropic/claude-sonnet-4";
|
||||
hostSocketUnit = "endo-guest-hermes.socket";
|
||||
};
|
||||
services.hermes-llm-proxy = {
|
||||
upstream = "https://openrouter.ai/api/v1";
|
||||
keyFile = "/run/secrets/llm-key"; # a runtime path, not a nix path
|
||||
};
|
||||
```
|
||||
|
||||
## On macOS
|
||||
|
||||
Building the VM needs a Linux builder (for example nix-darwin's `nix.linux-builder`).
|
||||
|
||||
```sh
|
||||
nix build --impure --expr '(builtins.getFlake (toString ./.)).lib.mkDarwin {
|
||||
hostDir = "/Users/me/.local/state/hermes-guest";
|
||||
model = "anthropic/claude-sonnet-4";
|
||||
upstream = "https://openrouter.ai/api/v1";
|
||||
keyFile = "/Users/me/.config/hermes-guest/llm-key";
|
||||
}.host'
|
||||
mkdir -p ~/.local/state/hermes-guest
|
||||
cp result/share/LaunchAgents/*.plist ~/Library/LaunchAgents/
|
||||
launchctl bootstrap gui/$UID ~/Library/LaunchAgents/net.madmode.hermes-llm-proxy.plist
|
||||
launchctl bootstrap gui/$UID ~/Library/LaunchAgents/net.madmode.hermes-vm.plist
|
||||
```
|
||||
|
||||
## Not yet done
|
||||
|
||||
- Toybox doesn't serve a guest's methods over MCP on a socket of its own yet. On macOS, something on the host must also listen on `hostDir/host.sock`.
|
||||
- Hermes's cron jobs fail closed: they need a systemd user manager, which would start units outside the sandbox.
|
||||
- How you talk to Hermes: its gateway platforms (Telegram, Discord, ...) have no network here. The intent is messages through toybox, which Hermes would need to poll or follow.
|
||||
Reference in new issue
Block a user