From b2a700571fd6b3b685b3c7d63f8721d13e3fafda Mon Sep 17 00:00:00 2001 From: Erik Simon Date: Fri, 2 Oct 2026 18:23:51 +0200 Subject: [PATCH] feat(mars): switch luna's memory provider to Honcho - prepare-dirs pins memory.provider = honcho in Hermes's config.yaml and merges the local server into honcho.json (workspace/aiPeer luna, user peer darman). Only those keys are asserted; Hermes's own additions stay. - The SDK installs itself into the image's durable lazy-install target (/opt/data/lazy-packages), so nothing to package here. - Hermes starts after Honcho but doesn't require it. Co-Authored-By: Claude Opus 5.5 --- hosts/mars/hermes-agent.nix | 18 +++++++++++++++++- hosts/mars/honcho.nix | 9 +++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/hosts/mars/hermes-agent.nix b/hosts/mars/hermes-agent.nix index 6fffeb8..a335a2a 100644 --- a/hosts/mars/hermes-agent.nix +++ b/hosts/mars/hermes-agent.nix @@ -259,8 +259,10 @@ in # tts.provider is seeded, not pinned: `=` would stomp luna's own choice on # every restart, and the engine is hers to change (KittenTTS stays as the # offline fallback). `//` only fills it in when unset. + # memory.provider IS pinned: switching back is a repo change (honcho.nix). yq '.dashboard.trusted_proxies = ["${neptunTailnetIp}"] - | .tts.provider = (.tts.provider // "elevenlabs")' "$conf" > "$conf.new" + | .tts.provider = (.tts.provider // "elevenlabs") + | .memory.provider = "honcho"' "$conf" > "$conf.new" chown ${hermesUid}:${hermesGid} "$conf.new" chmod --reference="$conf" "$conf.new" mv -f "$conf.new" "$conf" @@ -296,6 +298,20 @@ in # `hermes setup` overrides it — that is how a rotated key kept 401ing. write_env_key OPENCODE_GO_API_KEY < ${config.sops.secrets.opencode_go_api_key.path} write_env_key ELEVENLABS_API_KEY < ${config.sops.secrets.elevenlabs_api_key.path} + + # Only these keys are asserted; anything Hermes adds to honcho.json stays. + # No apiKey: the plugin uses a placeholder for a loopback base URL. + setpriv --reuid=${hermesUid} --regid=${hermesGid} --clear-groups \ + ${pkgs.runtimeShell} -c ' + set -eu + f=$1 + [ -s "$f" ] || echo "{}" > "$f" + ${pkgs.jq}/bin/jq ".baseUrl = \"http://127.0.0.1:8000\" + | .hosts.hermes = ((.hosts.hermes // {}) + { + enabled: true, workspace: \"luna\", aiPeer: \"luna\", + peerName: \"darman\", pinUserPeer: true })" "$f" > "$f.new" + mv -f "$f.new" "$f" + ' _ ${hermesHome}/honcho.json write_env_key API_SERVER_KEY < ${config.sops.secrets.hermes_api_server_key.path} if [ -d ${hermesHome}/.config ]; then diff --git a/hosts/mars/honcho.nix b/hosts/mars/honcho.nix index fab87a8..4bf65e4 100644 --- a/hosts/mars/honcho.nix +++ b/hosts/mars/honcho.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: -# Honcho memory server for luna (Hermes's memory provider, once switched in -# Hermes's own config). API + deriver from the official image; Postgres and +# Honcho memory server: luna's memory provider (wired up in hermes-agent.nix +# prepare-dirs). API + deriver from the official image; Postgres and # Ollama (embeddings) run natively. Everything binds loopback only. let honchoImage = "ghcr.io/plastic-labs/honcho@sha256:c74955d6dbea6dda42c2dd9dd13dea726fcba36ba5c0b6bae4867f7ed762896d"; # v3.2.2 @@ -125,4 +125,9 @@ in after = [ "podman-honcho-api.service" ]; requires = [ "podman-honcho-api.service" ]; }; + # wants, not requires: Telegram must survive Honcho being down. + systemd.services.podman-hermes-agent = { + after = [ "podman-honcho-api.service" ]; + wants = [ "podman-honcho-api.service" ]; + }; }