From 6266bf33b82484d6535f8fbd2ad0ce59bb0afe9d Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Wed, 4 Nov 2026 00:44:49 +0100 Subject: [PATCH] Enable guarded memory-only Dreaming across the Hermes bot fleet --- docs/ATHENA_HANDOFF.md | 22 + .../hermes-dreaming-2026-11-03/README.md | 214 +++++++ .../acceptance.json | 588 ++++++++++++++++++ .../athena-dreaming-package.json | 78 +++ .../athena-dreaming-precheck.py | 62 ++ .../hermes-dreaming-2026-11-03/privacy.patch | 16 + .../profile_setup.py | 215 +++++++ .../test_admission.py | 67 ++ .../test_privacy.py | 47 ++ 9 files changed, 1309 insertions(+) create mode 100644 docs/maintenance/hermes-dreaming-2026-11-03/README.md create mode 100644 docs/maintenance/hermes-dreaming-2026-11-03/acceptance.json create mode 100644 docs/maintenance/hermes-dreaming-2026-11-03/athena-dreaming-package.json create mode 100644 docs/maintenance/hermes-dreaming-2026-11-03/athena-dreaming-precheck.py create mode 100644 docs/maintenance/hermes-dreaming-2026-11-03/privacy.patch create mode 100644 docs/maintenance/hermes-dreaming-2026-11-03/profile_setup.py create mode 100644 docs/maintenance/hermes-dreaming-2026-11-03/test_admission.py create mode 100644 docs/maintenance/hermes-dreaming-2026-11-03/test_privacy.py diff --git a/docs/ATHENA_HANDOFF.md b/docs/ATHENA_HANDOFF.md index 586cce1..85b5dd6 100644 --- a/docs/ATHENA_HANDOFF.md +++ b/docs/ATHENA_HANDOFF.md @@ -5,6 +5,28 @@ curated project handoff, not imported chat history. Read applicable `AGENTS.md`, then the current source and relevant linked documentation; verify live state again before changing anything. Historical notes do not override current facts. +## Dreaming enabled for all 21 profiles · 4 November 2026 + +Michael explicitly requested installation/activation for all 21 existing bots. +Catalog `hermes-dreaming` 3.8.3, pinned at +`b89b733433641ba68cc5d90fe0ca977deeb61bfe`, is installed and enabled in each; +one memory-only job per profile runs daily, staggered 03:00–03:40 Europe/Berlin. +No Holographic/fact store, history ingestion, cloud judge or extra service. +The local privacy overlay prevents even the initial transcript read when no +chat is authorized; a frozen-source admission gate blocks drift before import. +Night jobs have only the memory toolset, inherited model selection and local +result/failure delivery. The ordinary model/MCP/tool/speech/SSH policies remain +unchanged; no service/model restart or native Mac patch was performed. + +All 21 real prechecks passed without calling a model; the Athena-Deck job also +ran successfully through the native scheduler with its wake gate closed. +428/428 fleet checks and 784 Deck tests pass; the patched upstream suite ran +927 tests with 3 skipped, plus seven local privacy/admission regressions passed. +The first scheduled night and actual LLM memory consolidation remain untested; +this is not automatic extraction of new facts from chat history. No blind plugin +update: preserve/rebase the overlay and refresh admission only after review. +See [source pins, exact schedule, checks and native restore/update boundaries](maintenance/hermes-dreaming-2026-11-03/README.md). + ## Hermes fleet repair · 3 November 2026 Michael's requested settings repair is applied and independently checked across diff --git a/docs/maintenance/hermes-dreaming-2026-11-03/README.md b/docs/maintenance/hermes-dreaming-2026-11-03/README.md new file mode 100644 index 0000000..00fefed --- /dev/null +++ b/docs/maintenance/hermes-dreaming-2026-11-03/README.md @@ -0,0 +1,214 @@ +# Dreaming: Aktivierung für die 21 Hermes-Bots + +## Erledigter Auftrag und genaue Funktionsgrenze + +Michael beauftragte Installation und Aktivierung und bestätigte ausdrücklich +**alle 21 Bot-Profile**. Das Katalogpaket `hermes-dreaming` 3.8.3 ist in allen +21 Profilen installiert und freigegeben. Je Profil existiert genau ein aktiver +Nachtjob: täglich von **03:00 bis 03:40 Europe/Berlin**, im Abstand von zwei +Minuten. Erste geplante Ausführung: 4. November 2026. Sichere Metadaten stehen +in [`acceptance.json`](acceptance.json); private Laufdaten bleiben außerhalb Git. + +**Aktiviert ist Memory-only-Dreaming:** Füllstand, Konsolidierung bei Platzdruck +und Verlustwache für bestehende `MEMORY.md`/`USER.md`. Alle Profile verwenden +bereits das eingebaute Hermes-Gedächtnis, keinen separaten Faktenanbieter. +Deshalb wurde weder Holographic installiert noch ein neuer Anbieter aktiviert. +Es gibt keine Faktenextraktion aus alten Chats, keine chatgestützten +Relevanz-/Vergessensfragen und keine automatische Übernahme neuer Chat-Fakten. +Das ist bewusst nicht die vollständige faktengestützte Variante des Plugins. +Chat-Kontextkompression ist davon weiterhin unabhängig. + +Ergebnisse und Fehler bleiben **lokal**. Bestehende Modelle, MCPs, Werkzeuge, +Sprachanschlüsse, Terminalziele, Freigabeabsichten und alte Zeitpläne wurden +nicht vereinheitlicht. Kein Host-/Container-/Gateway-/Modellneustart, keine +Modellumschaltung, kein Mac-Patch und keine Testbenachrichtigung. + +## Geprüfte Quelle und kleine lokale Datenschutzergänzung + +- Offizieller Hermes-Katalogeintrag `hermes-dreaming`, Community-Paket. +- Version 3.8.3; fester Ursprung + `b89b733433641ba68cc5d90fe0ca977deeb61bfe` aus + `https://github.com/itpartypattaya/hermes-dreaming`. +- Installation über den Katalog mit `--ref`, `--no-deps`, `--no-enable`; + keine unversionierte HEAD-Installation, kein `--force`, kein Root-Aufruf. +- Anschließend gezielte Freigabe über `hermes plugins enable + hermes-dreaming --no-allow-tool-override`. + +**Der Betrieb ist nicht unverändert upstream.** Die Prüfung fand einen +konkreten Unterschied zwischen Auswahl und Datenzugriff: selbst bei drei +abgeschalteten Chat-Vertrauensklassen lud `load_messages` zunächst Text aus +`state.db` und filterte erst danach. Auch `fact_source=none` verhinderte diesen +Zugriff allein nicht. Der neue Regressionstest war mit unverändertem Paket rot: +`History access is forbidden` am SQLite-Zugriff. + +[`privacy.patch`](privacy.patch) ergänzt deshalb ausschließlich: + +1. Kein Datenbankzugriff, wenn keine Chatklasse freigegeben ist. +2. Keine Relevanzbehauptung/Decay-Frage aus absichtlich ungelesenen Chats. + +Alle Chatklassen sind hier aus, ebenso Gruppenfreigaben, Chat-Stores und der +Cloud-Judge. `state.seen` und Vorschlagszustand sind leer, damit auch keine +Bestätigungsnachsuche in Sitzungen nötig wird. Das absolute VPN-Verbot wurde +nicht aufgehoben. Keine ausgeschlossenen Dateien/Pfade/Container wurden dafür +geöffnet oder untersucht. Im Test wird nicht etwa eine VPN-Datei angelegt: +eine gewöhnliche synthetische SQLite-Datei plus eine verweigernde Verbindung +beweist, dass der Reader gar nicht aufgerufen wird. + +## Drift-Schutz vor jedem Nachtlauf + +Der zusätzliche lokale Startpunkt +[`athena-dreaming-precheck.py`](athena-dreaming-precheck.py) prüft **vor dem +Import des Pluginprogramms**: + +- die vollständige explizite Memory-only-Konfiguration; +- die eingefrorenen Prüfsummen der vierzehn öffentlichen Paketdateien + (Manifest, Skill und alle vorhandenen Python-Scripte); +- die unveränderte kopierte native Prüfstufe; +- keine `DREAM_*`-Umleitung aus der Umgebung und keine unerwarteten Symlinks. + +Die erwarteten Werte stehen in +[`athena-dreaming-package.json`](athena-dreaming-package.json), nicht in einer +Credential-Datei. Ein Plugin-Update, eine geänderte Policy oder eine +abweichende Prüfstufe blockiert den Lauf **vor** einem Zugriff auf Chatdaten. +Ein blockierter Lauf liefert `wakeAgent:false` und weckt kein Modell. Sein +Zustand steht ausdrücklich als `allowed:false` mit Grund in +`cache/dreaming-admission.json`. Ein generischer Cron-Status `ok` allein ist +dann **kein** Nachweis funktionierenden Dreamings; der Admission-Zustand ist +mitzuprüfen. Dies ist eine Schutzmaßnahme gegen versehentliche Änderungen, +keine Sandbox gegen einen böswilligen Administrator desselben Dienstkontos. + +Nach erlaubtem Start läuft die echte kopierte Plugin-Prüfstufe. Sie schreibt +ihren normalen privaten Zustand/ihre Tagebuchdaten und liefert bei Ruhe +`wakeAgent:false`. Nur Handlungsbedarf lässt den regulären Cron-Agenten mit +seinem vorhandenen Modell starten. Der Job hat ausschließlich das Toolset +`memory`: keine Terminal-, Datei-, MCP-, Administrations- oder Model-Lifecycle- +rechte. Ein bestehender Memory-Freigabeschalter bleibt wirksam. + +## Installation und echte Nachprüfung + +Alle Schritte liefen als Datenbesitzer UID 99/GID 100 auf dem NAS, mit dem +installierten Hermes-Python 3.14.9 und `PYTHONPATH=/opt/hermes`. Keine Pakete +wurden in Hermes' Python installiert. Das Plugin benutzt die Standardbibliothek. + +Die verwendeten Schritte sind in [`profile_setup.py`](profile_setup.py) +reproduzierbar: vorbereiten, planen und unabhängig lesen/verifizieren. Der +Helfer nutzt für Jobs die vorhandene öffentliche `cron.jobs`-API statt +`jobs.json` zu überschreiben. Er liest das Ziel nach jeder Neuanlage zurück, +verhindert Duplikate, erhält vorhandene Jobs und pinnt kein neues Modell. +`catch_up=false`, `grace_minutes=0`, `timezone=Europe/Berlin`, lokale Ergebnis- +und Fehlerzustellung sowie `enabled_toolsets=[memory]` werden ausdrücklich +gesetzt. Die erzeugten qualifizierten Skills heißen in dieser Installation +`hermes-dreaming:dreaming` – aus dem realen Loader ermittelt, nicht aus einem +älteren README-Namensbeispiel abgeleitet. + +Für die Namespace-/Paketprüfung wird **nur dieses portable Paket** durch den +echten Hermes-Loader geladen: null Werkzeuge, Hooks, Middleware, Kommandos und +MCP-Server. Die vollständige native Plugin-Discovery wird nicht zu +Diagnosezwecken gestartet, weil andere installierte Plugins dabei Bridges +starten könnten. Das ist auch der Grund für den schmalen Helfer anstelle des +ungeändert aufgerufenen Upstream-Cron-Installers. + +Tatsächlich ausgeführt: + +- Upstream-Suite nach lokaler Ergänzung: **927 Tests durchlaufen, 3 übersprungen, + Ergebnis OK**. Die Judge-Tests verwenden lokale HTTP-Testserver und erfundene + Daten/Schlüssel, keine echten Entscheidungssysteme oder Gebühren. +- Datenschutzregression: **1 bestanden**, zuvor am Original reproduzierbar rot. +- Startschutz: **6 synthetische Regressionstests bestanden**, unter anderem für + veränderten Quelltext, zusätzliche Dateien, Policy, kopiertes Gate und + Umgebungsumleitung. +- Echte lokale Prüfstufe **aller 21 Profile** ausgeführt und erlaubten Start + sowie null ausgewählte History-Nachrichten in den Ergebnissen bestätigt. + Die Zugriffsunterbindung ist zusätzlich durch Policy, gleiche geprüfte + Quellen und die verweigernde Datenbank-Regression belegt. Fünf Ergebnisse hätten wegen + Handlungsbedarfs einen Agenten geweckt; hier wurde nur das Prüfsystem + ausgeführt, kein solcher Modelllauf ausgelöst. +- Neuer Athena-Deck-Nachtjob `9c1d952a1978` einmal über den echten Hermes- + Scheduler ausgeführt: **succeeded**, gespeicherter Status `ok`, Failure-Streak + 0, nächster regulärer Termin weiterhin 03:02 CET. Die ruhende Prüfstufe hielt + den Modelllauf geschlossen; keine Chat-Zustellung. +- Vollständiger unabhängiger Flotten-Audit danach: **428/428 Prüfungen bei + 21/21 Profilen bestanden**. Modell-, MCP-, Tool-, Sprach-, Terminal-, + Approval- und Voice-Projektionen stimmen mit dem geprüften Vorzustand überein. +- Unveränderte synthetische Deck-Rootsuite: **784 Tests bestanden**. +- Gateway weiterhin PID 404, laufend; kein von dieser Arbeit ausgelöster Neustart. + +Die erste reguläre Nacht und ein tatsächlicher konsolidierender Modelllauf +sind damit **noch nicht** erfolgreich nachgewiesen. Insbesondere bedeutet +`would_wake_agent=true` nicht, dass bereits Memory geändert wurde. + +## Wiederholbares NAS-Rezept + +Zuerst Rolle und aktuelle Identität prüfen; keine gelöschten Profile aus einer +alten Liste wiederherstellen. Das folgende Beispiel gilt für `athena-deck`. +Der Helfer ist bewusst auf den vorhandenen NAS-Datenpfad `/opt/data` gebunden. + +```sh +hermes -p athena-deck plugins install hermes-dreaming \ + --ref b89b733433641ba68cc5d90fe0ca977deeb61bfe --no-deps --no-enable + +# Nur auf die gerade installierte unveränderte Revision anwenden; +# bei schon angewandtem Overlay nicht erneut patchen. +git -C /opt/data/profiles/athena-deck/plugins/hermes-dreaming apply --check --unidiff-zero \ + /ABSOLUTER/REPOPFAD/docs/maintenance/hermes-dreaming-2026-11-03/privacy.patch +git -C /opt/data/profiles/athena-deck/plugins/hermes-dreaming apply --unidiff-zero \ + /ABSOLUTER/REPOPFAD/docs/maintenance/hermes-dreaming-2026-11-03/privacy.patch + +PYTHONPATH=/opt/hermes PYTHONDONTWRITEBYTECODE=1 python3 -B \ + docs/maintenance/hermes-dreaming-2026-11-03/profile_setup.py prepare athena-deck +PYTHONPATH=/opt/hermes PYTHONDONTWRITEBYTECODE=1 python3 -B \ + docs/maintenance/hermes-dreaming-2026-11-03/profile_setup.py schedule athena-deck \ + --schedule '2 3 * * *' +PYTHONPATH=/opt/hermes PYTHONDONTWRITEBYTECODE=1 python3 -B \ + docs/maintenance/hermes-dreaming-2026-11-03/profile_setup.py verify athena-deck \ + --schedule '2 3 * * *' +``` + +Die übrigen Profile und ihre gespeicherten Termine stehen in `acceptance.json`. +Ein teilweise abgebrochener Lauf ist nicht fertig. Bei default lief die +CLI-Freigabe zunächst in einen Timeout; das anschließende Lesen bestätigte die +bereits gespeicherte Aktivierung. Die idempotente Vorbereitung wurde ohne +unnötige erneute Aktivierung vervollständigt und unabhängig abgenommen. + +## Update, Rückfall und vollständiges Restore + +Ein blindes `hermes plugins update` ist für diesen lokalen Overlay-Stand keine +Abnahme: der Startschutz blockiert geänderten Code absichtlich. Ein neues +Katalog-Pin zuerst getrennt prüfen, Overlay/API-Kompatibilität und Tests +wiederholen, dann eingefrorene Werte und installierte Schutzdateien gemeinsam +aktualisieren. Vor Wartung ausschließlich die **konkret betroffenen neuen +Job-IDs** pausieren; bereits laufende/queued Arbeiten nicht abbrechen oder +fehlende Zähler für Leerlauf halten. Bestehende fremde Jobs nicht verändern. + +Zum Rückfall neue Job-IDs gezielt pausieren, nicht deren private Daten löschen +und keine alten Werkzeugrechte lockern. Deaktivierung des Plugins allein ist +kein Ersatz für eine bewusst behandelte Jobplanung. Kein automatischer +Gateway-/Hostneustart gehört zu dieser Wartung. + +Für Restore gehören pro Profil ins bestehende verschlüsselte private Paket: +Plugin-Checkout einschließlich Overlay, `dreaming.json`, die Gate-/Schutzdateien +unter `scripts`, die genauen Cron-Datensätze, `cache/dream*.json` einschließlich +Admission/Snapshot sowie `memories/DREAMS.md` und bereits gesicherte +`MEMORY.md`/`USER.md`. Die bestehenden Auth-/Managed-/Rollen-Daten müssen nach dem +normalen Gesamt-Restore ebenfalls korrekt vorhanden sein; keine zusätzlichen +Credential-Kopien wurden angelegt. Vor jedem Backup die dauerhaft verbotenen +Dateien, privaten VPN-Konfigurationen und Pfade ausschließen. Kein globales +Verzeichnisarchiv wird durch dieses Rezept angefordert. + +Für einen nativen Hermes sind dessen eigene unterstützte Python-/Git- +Installation und Modul-/Datenpfade nötig, nicht Docker oder ein anderer +Container. Dieser NAS-Helfer ist keine neue Voraussetzung des nativen Athena +Decks und kein fertig getesteter universeller Debian-Installer. Ein frischer +Host mit entschlüsseltem vollständigem Restore wurde hier nicht aufgebaut; +diese Ende-zu-Ende-Abnahme bleibt offen. + +## Quellen und private Ausgaben + +- [Offizieller Hermes-Katalogeintrag](https://hermes-agent.nousresearch.com/docs/plugins/hermes-dreaming) +- [Gepinntes Upstream-README](https://github.com/itpartypattaya/hermes-dreaming/blob/b89b733433641ba68cc5d90fe0ca977deeb61bfe/README.md) +- [Hermes-Cron-Dokumentation](https://hermes-agent.nousresearch.com/docs/user-guide/features/cron) + +Private, auf reine Betriebsmetadaten reduzierte Prüfausgaben und vollständige +synthetische Testlogs liegen im eigenen Workspace unter +`workspace/reports/hermes-dreaming-2026-11-03/`. Private Memory-Inhalte, +Tagebücher, History, Provider-Schlüssel oder Credential-Hashes sind nicht in Git. diff --git a/docs/maintenance/hermes-dreaming-2026-11-03/acceptance.json b/docs/maintenance/hermes-dreaming-2026-11-03/acceptance.json new file mode 100644 index 0000000..942fa0d --- /dev/null +++ b/docs/maintenance/hermes-dreaming-2026-11-03/acceptance.json @@ -0,0 +1,588 @@ +{ + "scope": "Installed, enabled and scheduled memory-only Dreaming; real no-model prechecks, not an executed consolidating LLM night", + "package_version": "3.8.3", + "upstream_pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "local_overlay": "no-transcript-v1", + "profiles_expected": 21, + "profiles_verified": 21, + "active_night_jobs": 21, + "timezone": "Europe/Berlin", + "first_scheduled_window": [ + "2026-11-04T03:00:00+01:00", + "2026-11-04T03:40:00+01:00" + ], + "delivery": "local", + "history_access_enabled": false, + "fact_source": "none", + "cloud_judge": "off", + "prechecks_exercised": 21, + "prechecks_would_wake_agent": 5, + "model_runs_triggered_by_checks": 0, + "privacy_regression_passed": 1, + "admission_regressions_passed": 6, + "upstream_suite": { + "run": 927, + "skipped": 3, + "result": "OK" + }, + "deck_suite_passed": 784, + "fleet_settings_checks_passed": 428, + "native_scheduler_test": { + "profile": "athena-deck", + "job_id": "9c1d952a1978", + "last_status": "ok", + "model_wake_gate_closed": true + }, + "model_mcp_tool_speech_terminal_approval_voice_preserved": true, + "gateway_pid_unchanged": 404, + "consolidating_agent_run_tested": false, + "native_full_restore_tested": false, + "profiles": [ + { + "profile": "default", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "cd1da4c3e55e", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "0 3 * * *", + "display": "0 3 * * *" + }, + "next_run_at": "2026-11-04T03:00:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "athena-deck", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "9c1d952a1978", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "2 3 * * *", + "display": "2 3 * * *" + }, + "next_run_at": "2026-11-04T03:02:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "belanna-storres", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "abefcf648d14", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "4 3 * * *", + "display": "4 3 * * *" + }, + "next_run_at": "2026-11-04T03:04:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": true + }, + { + "profile": "dns-netbot", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "77e41fd8d452", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "6 3 * * *", + "display": "6 3 * * *" + }, + "next_run_at": "2026-11-04T03:06:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "horizon-dev", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "4916e2c1f41f", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "8 3 * * *", + "display": "8 3 * * *" + }, + "next_run_at": "2026-11-04T03:08:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "idoit-bot", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "b2cf07b3c80d", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "10 3 * * *", + "display": "10 3 * * *" + }, + "next_run_at": "2026-11-04T03:10:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "jean-luc-picode", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "94d353c109e2", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "12 3 * * *", + "display": "12 3 * * *" + }, + "next_run_at": "2026-11-04T03:12:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "jonathan-arrcher", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "885dc603a696", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "14 3 * * *", + "display": "14 3 * * *" + }, + "next_run_at": "2026-11-04T03:14:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": true + }, + { + "profile": "midas-phalanx", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "78070ddbb810", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "16 3 * * *", + "display": "16 3 * * *" + }, + "next_run_at": "2026-11-04T03:16:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "netvs-bot", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "77430dc9182f", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "18 3 * * *", + "display": "18 3 * * *" + }, + "next_run_at": "2026-11-04T03:18:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "pruefungs-vdi-dev", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "f289a6da7e83", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "20 3 * * *", + "display": "20 3 * * *" + }, + "next_run_at": "2026-11-04T03:20:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "retro-la-forge", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "13d65695116a", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "22 3 * * *", + "display": "22 3 * * *" + }, + "next_run_at": "2026-11-04T03:22:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "seven-of-heim", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "54e86455e8c2", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "24 3 * * *", + "display": "24 3 * * *" + }, + "next_run_at": "2026-11-04T03:24:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "solid-crafter", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "08e6972f68a3", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "26 3 * * *", + "display": "26 3 * * *" + }, + "next_run_at": "2026-11-04T03:26:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "ssh-horizon-ecc7d706", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "29b430dcb9c4", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "28 3 * * *", + "display": "28 3 * * *" + }, + "next_run_at": "2026-11-04T03:28:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "ssh-infvhost-1-5b1589d3", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "b5ae3d2c3619", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "30 3 * * *", + "display": "30 3 * * *" + }, + "next_run_at": "2026-11-04T03:30:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": true + }, + { + "profile": "ssh-infvhost-2-731791df", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "490c294741b6", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "32 3 * * *", + "display": "32 3 * * *" + }, + "next_run_at": "2026-11-04T03:32:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "ssh-mikesmacbookprom4-1cdce964", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "18eb434e4276", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "34 3 * * *", + "display": "34 3 * * *" + }, + "next_run_at": "2026-11-04T03:34:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + }, + { + "profile": "ssh-pool-vdi-ff978f02", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "1cbe3117d12f", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "36 3 * * *", + "display": "36 3 * * *" + }, + "next_run_at": "2026-11-04T03:36:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": true + }, + { + "profile": "ssh-scc-gg3653-01-76dcf38d", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "3e3965c34a1e", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "38 3 * * *", + "display": "38 3 * * *" + }, + "next_run_at": "2026-11-04T03:38:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": true + }, + { + "profile": "william-t-time", + "plugin_version": "3.8.3", + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "skill": "hermes-dreaming:dreaming", + "job_id": "5ca246e11696", + "state": "scheduled", + "schedule": { + "kind": "cron", + "expr": "40 3 * * *", + "display": "40 3 * * *" + }, + "next_run_at": "2026-11-04T03:40:00+01:00", + "timezone": "Europe/Berlin", + "delivery": "local", + "toolsets": [ + "memory" + ], + "history_access": false, + "fact_source": "none", + "judge": "off", + "privacy_overlay": "no-transcript-v1", + "gate": "athena-dreaming-precheck.py", + "precheck_passed": true, + "would_wake_agent": false + } + ] +} diff --git a/docs/maintenance/hermes-dreaming-2026-11-03/athena-dreaming-package.json b/docs/maintenance/hermes-dreaming-2026-11-03/athena-dreaming-package.json new file mode 100644 index 0000000..4ddb4a6 --- /dev/null +++ b/docs/maintenance/hermes-dreaming-2026-11-03/athena-dreaming-package.json @@ -0,0 +1,78 @@ +{ + "pin": "b89b733433641ba68cc5d90fe0ca977deeb61bfe", + "privacy_overlay": "no-transcript-v1", + "settings": { + "timezone": "Europe/Berlin", + "fact_source": "none", + "cron": { + "expected_roles": [ + "night" + ] + }, + "trusted_chat_ids": [], + "trust_private_chats": false, + "trust_sessions_without_chat": false, + "untrusted_sources": [ + "cron", + "subagent", + "tool" + ], + "durable_memory_paths": [ + "memories/MEMORY.md", + "memories/USER.md" + ], + "memory_char_limits": { + "memories/MEMORY.md": 2200, + "memories/USER.md": 1375 + }, + "chat_stores": { + "read": false, + "promote_from": [] + }, + "judge": { + "mode": "off" + }, + "keywords": { + "enabled": false + }, + "duplicates": { + "enabled": false + }, + "task_outcomes": false, + "state": { + "asked": "cache/dream-asked.json", + "rejected": "cache/dream-rejected.json", + "seen": "", + "snapshot": "cache/dream-snapshot.json", + "proposals": "" + }, + "diary": { + "heading": "## Gedächtnispflege", + "keep_sections": 90 + }, + "precheck": { + "max_content": 300, + "memory_full_pct": 85, + "timeout_sec": 120, + "actionable_keys": [ + "alerts" + ] + } + }, + "files": { + "plugin.json": "c7e30587b7ba1974987d191d8d0efe7448153ba452483cfeebca7716cd0effb2", + "skills/dreaming/SKILL.md": "0e112e2bf27cf100c5a64a31a0e2926797523f6d615869a72c480a7b08c1085f", + "skills/dreaming/scripts/dream-extract-precheck.py": "8539dc30f125dafc5329dea04d8426b6241e20d1ab9e9ad2aa8075b33ceffd40", + "skills/dreaming/scripts/dream-forget-sweep.py": "8e87a75b929126563375bb82c6ca1e80965d2f1c2b5927be0ca99f1ef6c34a61", + "skills/dreaming/scripts/dream-precheck.py": "bdee5d078b33913e60bcba1fb75d9b3ca2ff5127de292326da6f0459472b3448", + "skills/dreaming/scripts/dream-reject.py": "bf02f70f9f9584e3ffc2294ea27be7a3f9218ab567d08acb93b20ffa8fccd325", + "skills/dreaming/scripts/dream.py": "a72e9ee991baefee5894800b4e3b9335b1c2ab6db03c568fc95cf09c6ba4c7d2", + "skills/dreaming/scripts/dream_experience.py": "b629fe3de6727f2b2beb92893590b15954aeae4bbfd457b5a29e849270b4ad67", + "skills/dreaming/scripts/dream_judge.py": "1b302865a87948b2f4928030140709b841493298eafa62cd00a9174f5e15db12", + "skills/dreaming/scripts/dream_lang.py": "e64894c6fe9e558d38afb3f657936ccd43cdbbdc3e7b818fec4a2e0fc3066ce8", + "skills/dreaming/scripts/dream_yaml.py": "2a6c30d61e7680a67cade33628d846cc186a8fd8d9118a4b7230acbe0a9ebb2f", + "skills/dreaming/scripts/holo_screen.py": "807d348bf882d71410f5ccf6915930daa30c276d6379c2366b8068727f12394d", + "skills/dreaming/scripts/install.py": "72ef78fc631e94d606a39834626a6e03e44f6c7c32f4e8ed0ee4864a3a8e2cac", + "skills/dreaming/scripts/install_cron.py": "0a31ec56110e2028a857c67c7bdf2366761966fdd7d00ece1ba01040f25cdd9a" + } +} diff --git a/docs/maintenance/hermes-dreaming-2026-11-03/athena-dreaming-precheck.py b/docs/maintenance/hermes-dreaming-2026-11-03/athena-dreaming-precheck.py new file mode 100644 index 0000000..9a8716f --- /dev/null +++ b/docs/maintenance/hermes-dreaming-2026-11-03/athena-dreaming-precheck.py @@ -0,0 +1,62 @@ +"""Fail-closed admission for the catalog-pinned, memory-only Dreaming job. + +No plugin module or session database is opened before the frozen public source +and explicit privacy settings have passed admission. Blocked runs stay local +and do not wake a model; admission status remains inspectable in the cache. +""" +from __future__ import annotations + +import hashlib +import json +import os +from pathlib import Path +import sys + + +def admit(home: Path, manifest: dict) -> None: + if any(key.startswith("DREAM_") for key in os.environ): + raise ValueError("unexpected_environment_override") + if json.loads((home / "dreaming.json").read_text()) != manifest["settings"]: + raise ValueError("privacy_settings_changed") + package = home / "plugins/hermes-dreaming" + expected = manifest["files"] + actual_python = {str(path.relative_to(package)) for path in (package / "skills/dreaming/scripts").glob("*.py")} + if actual_python != {name for name in expected if name.endswith(".py")}: + raise ValueError("package_file_set_changed") + for relative, digest in expected.items(): + path = package / relative + if path.is_symlink() or path.name == "vpn.auth" or not path.resolve().is_relative_to(package.resolve()): + raise ValueError("unexpected_package_path") + if hashlib.sha256(path.read_bytes()).hexdigest() != digest: + raise ValueError("package_source_changed") + gate = home / "scripts/dream-precheck.py" + if gate.is_symlink() or hashlib.sha256(gate.read_bytes()).hexdigest() != expected["skills/dreaming/scripts/dream-precheck.py"]: + raise ValueError("installed_gate_changed") + + +def main() -> int: + home = Path(__file__).resolve().parent.parent + cache = home / "cache" + cache.mkdir(exist_ok=True) + os.umask(0o077) + allowed, reason = False, "admission_failed" + try: + manifest = json.loads(Path(__file__).with_name("athena-dreaming-package.json").read_text()) + admit(home, manifest) + allowed, reason = True, "ok" + except (OSError, ValueError, KeyError, TypeError) as exc: + reason = str(exc) if isinstance(exc, ValueError) else type(exc).__name__ + target = cache / "dreaming-admission.json" + staging = target.with_name(target.name + "." + str(os.getpid()) + ".tmp") + staging.write_text(json.dumps({"allowed": allowed, "reason": reason}) + "\n") + staging.replace(target) + if not allowed: + print(json.dumps({"wakeAgent": False, "dreamingBlocked": reason})) + return 0 + os.environ["HERMES_HOME"] = str(home) + os.execv(sys.executable, [sys.executable, "-B", str(home / "scripts/dream-precheck.py")]) + return 1 # execv never returns on success + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/docs/maintenance/hermes-dreaming-2026-11-03/privacy.patch b/docs/maintenance/hermes-dreaming-2026-11-03/privacy.patch new file mode 100644 index 0000000..52e4167 --- /dev/null +++ b/docs/maintenance/hermes-dreaming-2026-11-03/privacy.patch @@ -0,0 +1,16 @@ +diff --git a/skills/dreaming/scripts/dream.py b/skills/dreaming/scripts/dream.py +index a4a9eba..fad696c 100644 +--- a/skills/dreaming/scripts/dream.py ++++ b/skills/dreaming/scripts/dream.py +@@ -1530,0 +1531,5 @@ def _table_columns(conn, table): ++def _history_access_enabled(): ++ """Admit transcript reads only when at least one chat class is trusted.""" ++ return bool(SETTINGS.TRUST_PRIVATE or SETTINGS.TRUST_NO_CHAT or SETTINGS.TRUSTED_CHAT_IDS) ++ ++ +@@ -1563,0 +1569,2 @@ def load_messages(db, days): ++ if not _history_access_enabled(): ++ return [] +@@ -5940 +5947 @@ def run(window_days, corr_days, md_decay_days, mem_md, asked_state_path=None, +- md_dec = [] if inputs.messages_unavailable else md_decays( ++ md_dec = [] if inputs.messages_unavailable or not _history_access_enabled() else md_decays( diff --git a/docs/maintenance/hermes-dreaming-2026-11-03/profile_setup.py b/docs/maintenance/hermes-dreaming-2026-11-03/profile_setup.py new file mode 100644 index 0000000..93f7855 --- /dev/null +++ b/docs/maintenance/hermes-dreaming-2026-11-03/profile_setup.py @@ -0,0 +1,215 @@ +"""Install/check one NAS Hermes Dreaming profile without native plugin discovery. + +Use the reviewed catalog package plus the adjacent documented privacy overlay. +No inference, gateway reload, service lifecycle or credential access occurs here. +""" +from __future__ import annotations + +import argparse +import contextlib +import copy +import importlib.util +import io +import json +import os +from pathlib import Path +import subprocess +import sys + +PIN = "b89b733433641ba68cc5d90fe0ca977deeb61bfe" +NAME = "hermes-dreaming" +GATE = "athena-dreaming-precheck.py" +HERE = Path(__file__).resolve().parent + + +def settings() -> dict: + return { + "timezone": "Europe/Berlin", "fact_source": "none", + "cron": {"expected_roles": ["night"]}, + "trusted_chat_ids": [], "trust_private_chats": False, + "trust_sessions_without_chat": False, + "untrusted_sources": ["cron", "subagent", "tool"], + "durable_memory_paths": ["memories/MEMORY.md", "memories/USER.md"], + "memory_char_limits": {"memories/MEMORY.md": 2200, "memories/USER.md": 1375}, + "chat_stores": {"read": False, "promote_from": []}, + "judge": {"mode": "off"}, "keywords": {"enabled": False}, + "duplicates": {"enabled": False}, "task_outcomes": False, + "state": {"asked": "cache/dream-asked.json", "rejected": "cache/dream-rejected.json", + "seen": "", "snapshot": "cache/dream-snapshot.json", "proposals": ""}, + "diary": {"heading": "## Gedächtnispflege", "keep_sections": 90}, + "precheck": {"max_content": 300, "memory_full_pct": 85, "timeout_sec": 120, + "actionable_keys": ["alerts"]}, + } + + +def load_module(path: Path, name: str): + spec = importlib.util.spec_from_file_location(name, path) + assert spec is not None and spec.loader is not None + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +def check_package(home: Path) -> Path: + package = home / "plugins" / NAME + head = subprocess.check_output(["git", "-C", str(package), "rev-parse", "HEAD"], text=True).strip() + assert head == PIN, "Unexpected package revision" + manifest = json.loads((package / "plugin.json").read_text()) + assert manifest["name"] == NAME and manifest["version"] == "3.8.3" + script = package / "skills/dreaming/scripts/dream.py" + source = script.read_text() + assert "def _history_access_enabled():" in source, "Required privacy overlay is absent" + assert "if not _history_access_enabled():\n return []" in source + assert "inputs.messages_unavailable or not _history_access_enabled() else md_decays(" in source + return package + + +def target_skill(home: Path) -> str: + """Use the real loader for this portable package only; no native bridges.""" + from hermes_cli.plugins import PluginManager + from hermes_cli.plugins_discovery import scan_directory + + manifest = next(item for item in scan_directory(home / "plugins", "user") if item.name == NAME) + assert manifest.portable + manager = PluginManager() + manager._load_plugin(manifest) + info = manager.list_plugins() + assert len(info) == 1 and info[0]["enabled"] and not info[0]["error"] + assert not any(info[0][key] for key in ("tools", "hooks", "middleware", "commands")) + metadata = manager.list_plugin_skill_metadata() + assert len(metadata) == 1 + qualified = metadata[0]["name"] + resolved_skill = manager.find_plugin_skill(qualified) + assert resolved_skill is not None + assert resolved_skill.resolve() == (home / "plugins" / NAME / "skills/dreaming/SKILL.md").resolve() + return qualified + + +def read_jobs(home: Path) -> list[dict]: + path = home / "cron/jobs.json" + return json.loads(path.read_text()).get("jobs", []) if path.is_file() else [] + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("action", choices=("prepare", "schedule", "verify")) + parser.add_argument("profile") + parser.add_argument("--schedule") + args = parser.parse_args() + root = Path("/opt/data") + home = root if args.profile == "default" else root / "profiles" / args.profile + assert home.parent == root / "profiles" or home == root + assert not any(key.startswith("DREAM_") for key in os.environ), "Unexpected Dreaming environment override" + os.environ["HERMES_HOME"] = str(home) + os.environ["HERMES_PROFILE"] = args.profile + os.environ["PYTHONDONTWRITEBYTECODE"] = "1" + os.umask(0o077) + from hermes_constants import set_hermes_home_override + set_hermes_home_override(home) + import hermes_yaml as yaml + + package = check_package(home) + config = home / "dreaming.json" + original = yaml.safe_load((home / "config.yaml").read_text()) or {} + desired = settings() + if args.action == "prepare": + if config.exists(): + assert json.loads(config.read_text()) == desired, "Preserve existing nonmatching Dreaming config" + else: + with config.open("x") as stream: + json.dump(desired, stream, ensure_ascii=False, indent=2) + stream.write("\n") + os.chmod(config, 0o600) + before_selection = original.get("plugins") or {} + if NAME not in before_selection.get("enabled", []) or NAME in before_selection.get("disabled", []): + result = subprocess.run(["hermes", "-p", args.profile, "plugins", "enable", NAME, + "--no-allow-tool-override"], capture_output=True, text=True, timeout=90) + assert result.returncode == 0, "Official plugin enable failed" + current = yaml.safe_load((home / "config.yaml").read_text()) or {} + before_other = {key: value for key, value in original.items() if key not in ("plugins", "config_version")} + after_other = {key: value for key, value in current.items() if key not in ("plugins", "config_version")} + assert before_other == after_other, "Unexpected unrelated profile change" + installer = load_module(package / "skills/dreaming/scripts/install.py", "dream_gate_installer") + report = installer.Report() + with contextlib.redirect_stdout(io.StringIO()): + installer.check_gates(home, False, report) + assert report.bad_n == 0 + for filename in (GATE, "athena-dreaming-package.json"): + target = home / "scripts" / filename + data = (HERE / filename).read_bytes() + if target.exists(): + assert target.read_bytes() == data, "Preserve an unexpected existing admission file" + else: + with target.open("xb") as stream: + stream.write(data) + assert json.loads(config.read_text()) == desired + current = yaml.safe_load((home / "config.yaml").read_text()) or {} + selection = current.get("plugins") or {} + assert NAME in selection.get("enabled", []) and NAME not in selection.get("disabled", []) + skill = target_skill(home) + for filename in ("dream-precheck.py", "dream-extract-precheck.py", "dream-forget-sweep.py"): + assert (home / "scripts" / filename).read_bytes() == (package / "skills/dreaming/scripts" / filename).read_bytes() + + if args.action == "prepare": + result = subprocess.run([sys.executable, "-B", str(package / "skills/dreaming/scripts/dream.py"), + "--dry-run", "--config", str(config)], capture_output=True, text=True, timeout=60) + assert result.returncode == 0, "Deterministic dry run failed" + assert "fact source: none" in result.stdout + print(json.dumps({"profile": args.profile, "prepared": True, "skill": skill, + "dry_run_passed": True, "history_access": False, "model_called": False})) + return 0 + + for filename in (GATE, "athena-dreaming-package.json"): + assert (home / "scripts" / filename).read_bytes() == (HERE / filename).read_bytes() + existing = [job for job in read_jobs(home) if job.get("script") in (GATE, "dream-precheck.py")] + if args.action == "schedule" and len(existing) == 1 and existing[0]["script"] != GATE: + assert existing[0]["skills"] == [skill] and existing[0]["name"] == "Dreaming: nächtliche Gedächtnispflege" + from cron.jobs import update_job + update_job(existing[0]["id"], {"script": GATE}) + existing = [job for job in read_jobs(home) if job["id"] == existing[0]["id"]] + if args.action == "schedule" and not existing: + assert args.schedule, "A schedule is required" + stock = load_module(package / "skills/dreaming/scripts/install_cron.py", "dream_stock_prompt") + from cron.jobs import create_job + old = copy.deepcopy(read_jobs(home)) + job = create_job( + prompt=stock.DREAM_PROMPT, schedule=args.schedule, + name="Dreaming: nächtliche Gedächtnispflege", repeat=None, + deliver="local", failure_deliver="local", origin=None, + skill=skill, skills=[skill], model=None, provider=None, base_url=None, + script=GATE, context_from=None, + enabled_toolsets=["memory"], workdir=None, no_agent=False, + attach_to_session=False, monitor_script=None, monitor_url=None, + reasoning_effort=None, catch_up=False, paused=False, paused_reason=None, + pinned=False, interpreter=None, timezone="Europe/Berlin", grace_minutes=0, + ) + exact = next(row for row in read_jobs(home) if row["id"] == job["id"]) + existing = [exact] + after_by_id = {row["id"]: row for row in read_jobs(home)} + for previous in old: + stored = after_by_id[previous["id"]] + for key in ("prompt", "schedule", "skills", "model", "provider", "deliver", "script", "enabled_toolsets"): + assert stored.get(key) == previous.get(key), "An existing job changed" + assert len(existing) == 1, "Expected exactly one Dreaming night job" + job = existing[0] + assert job["script"] == GATE + if args.schedule: + assert job["schedule"]["expr"] == args.schedule + assert job["state"] == "scheduled" and not job.get("paused_at") + assert job["skills"] == [skill] and job["enabled_toolsets"] == ["memory"] + assert not job["no_agent"] and job["deliver"] == job["failure_deliver"] == "local" + assert job.get("model") is None and job.get("provider") is None + assert job["timezone"] == "Europe/Berlin" and job["catch_up"] is False + assert job["next_run_at"] + print(json.dumps({"profile": args.profile, "plugin_version": "3.8.3", "pin": PIN, + "skill": skill, "job_id": job["id"], "state": job["state"], + "schedule": job["schedule"], "next_run_at": job["next_run_at"], + "timezone": job["timezone"], "delivery": "local", "toolsets": ["memory"], + "history_access": False, "fact_source": "none", "judge": "off", + "privacy_overlay": "no-transcript-v1", "gate": GATE})) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/docs/maintenance/hermes-dreaming-2026-11-03/test_admission.py b/docs/maintenance/hermes-dreaming-2026-11-03/test_admission.py new file mode 100644 index 0000000..c1b73c8 --- /dev/null +++ b/docs/maintenance/hermes-dreaming-2026-11-03/test_admission.py @@ -0,0 +1,67 @@ +"""Synthetic admission tests; never load a real profile or call a model.""" +import hashlib +import importlib.util +import json +import os +from pathlib import Path +import tempfile +import unittest +from unittest import mock + +SPEC = importlib.util.spec_from_file_location("dream_admission", Path(__file__).with_name("athena-dreaming-precheck.py")) +assert SPEC is not None and SPEC.loader is not None +GUARD = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(GUARD) + + +class AdmissionTests(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory() + self.addCleanup(self.temp.cleanup) + self.home = Path(self.temp.name) + self.package = self.home / "plugins/hermes-dreaming" + script = self.package / "skills/dreaming/scripts/dream-precheck.py" + script.parent.mkdir(parents=True) + script.write_text("# synthetic admission fixture\n") + (self.home / "scripts").mkdir() + (self.home / "scripts/dream-precheck.py").write_bytes(script.read_bytes()) + settings = {"fact_source": "none", "trust_private_chats": False} + (self.home / "dreaming.json").write_text(json.dumps(settings)) + self.manifest = {"settings": settings, "files": { + "skills/dreaming/scripts/dream-precheck.py": hashlib.sha256(script.read_bytes()).hexdigest(), + }} + self.environment = mock.patch.dict(os.environ, {}, clear=True) + self.environment.start() + self.addCleanup(self.environment.stop) + + def test_exact_reviewed_inputs_are_admitted(self): + GUARD.admit(self.home, self.manifest) + + def test_changed_package_fails_closed(self): + (self.package / "skills/dreaming/scripts/dream-precheck.py").write_text("# changed\n") + with self.assertRaisesRegex(ValueError, "package_source_changed"): + GUARD.admit(self.home, self.manifest) + + def test_changed_privacy_fails_closed(self): + (self.home / "dreaming.json").write_text('{"trust_private_chats":true}') + with self.assertRaisesRegex(ValueError, "privacy_settings_changed"): + GUARD.admit(self.home, self.manifest) + + def test_added_package_code_fails_closed(self): + (self.package / "skills/dreaming/scripts/added.py").write_text("# new\n") + with self.assertRaisesRegex(ValueError, "package_file_set_changed"): + GUARD.admit(self.home, self.manifest) + + def test_environment_redirect_fails_closed(self): + os.environ["DREAM_CONFIG"] = "unapproved.json" + with self.assertRaisesRegex(ValueError, "unexpected_environment_override"): + GUARD.admit(self.home, self.manifest) + + def test_changed_installed_gate_fails_closed(self): + (self.home / "scripts/dream-precheck.py").write_text("# other\n") + with self.assertRaisesRegex(ValueError, "installed_gate_changed"): + GUARD.admit(self.home, self.manifest) + + +if __name__ == "__main__": + unittest.main() diff --git a/docs/maintenance/hermes-dreaming-2026-11-03/test_privacy.py b/docs/maintenance/hermes-dreaming-2026-11-03/test_privacy.py new file mode 100644 index 0000000..c23cef1 --- /dev/null +++ b/docs/maintenance/hermes-dreaming-2026-11-03/test_privacy.py @@ -0,0 +1,47 @@ +"""Regression for a disabled-history policy; all inputs are synthetic. + +Run with DREAM_PLUGIN_ROOT pointing at the reviewed installed package. These +checks must not open a real profile database or call a model. +""" +import importlib.util +import json +import os +from pathlib import Path +import sqlite3 +import sys +import tempfile +import unittest +from unittest import mock + + +class DisabledHistoryTests(unittest.TestCase): + def test_no_chat_trust_reads_no_database_and_makes_no_decay_claim(self): + root = Path(os.environ["DREAM_PLUGIN_ROOT"]) + with tempfile.TemporaryDirectory() as directory: + home = Path(directory) + (home / "memories").mkdir() + memory = home / "memories/MEMORY.md" + memory.write_text("User prefers concise technical answers.\n") + with sqlite3.connect(home / "state.db") as db: + db.execute("CREATE TABLE messages (id INTEGER, content TEXT)") + config = home / "dreaming.json" + config.write_text(json.dumps({ + "fact_source": "none", "trusted_chat_ids": [], + "trust_private_chats": False, "trust_sessions_without_chat": False, + "judge": {"mode": "off"}, "state": {"seen": ""}, + })) + spec = importlib.util.spec_from_file_location("dream_privacy_test", root / "skills/dreaming/scripts/dream.py") + assert spec is not None and spec.loader is not None + module = importlib.util.module_from_spec(spec) + sys.modules[spec.name] = module + spec.loader.exec_module(module) + module.load_for_home(str(home), str(config)) + with mock.patch.object(module, "_conn", side_effect=AssertionError("History access is forbidden")) as connect: + result = module.run(14, 60, 0, str(memory)) + self.assertEqual(connect.call_count, 0) + self.assertEqual(result["md_decays"], []) + self.assertEqual(result["stats"]["messages_window"], 0) + + +if __name__ == "__main__": + unittest.main()