docs: append Cut 2 persistent-persona-map addendum (agy probe, chat gate, Cut 2a/2b split)

This commit is contained in:
Meta Vens 2026-12-06 08:09:16 +01:00
commit b6a1dbee8c

View file

@ -1,88 +1,157 @@
# Persistent Sandboxed Persona Session — Architecture & Authority Map
Status: **Imagination architecture map (`eureka-body`, base `f6fc66b`)**
Campaign rulings: `eureka-body:ruling:persistent-persona-session-public-matrix`, `eureka-body:ruling:dual-mode-cli-turn-boundary`, `eureka-body:ruling:identity-write-all-visible`, `eureka-body:ruling:cli-over-mcp-agent-surface`, `eureka-body:ruling:live-mind-sessions`, `eureka-substrate:ruling:recall-lives-in-huginn-no-cli-json`.
---
## 1. Live Body Facts & Mechanism Probes (`2026-12-06`)
### 1.1 `agy` / Hydrogen CLI Substrate
- **Starfire (`localhost`):** `agy` is **not installed** (`Get-Command agy` empty). Desktop Antigravity `2.38.0` (`C:\Users\Meta\AppData\Local\Programs\antigravity\Antigravity.exe` + `resources\bin\language_server.exe`) and `claude` `2.1.312` (`C:\Users\Meta\AppData\Roaming\npm\claude.ps1`) are present. `C:\Users\Meta\.gemini\antigravity\bin\agentapi.bat` invokes `language_server.exe agentapi`, whose `--help` exposes only `get-conversation-metadata`, `new-conversation`, and `send-message` — desktop agent RPC rather than a headless streaming runner with token telemetry.
- **Yggdrasil (`ssh yggdrasil`):** Neither `agy`, `antigravity`, `gemini`, nor a global `claude` exists on `PATH`. `/opt/` holds `actions-runner`, `claude-code/2.1.312`, `commons`, `containerd`, `gamecult`, `node-v24.14.1-linux-x64`, `rust`, and `venvs`; `/usr/local/bin/huginn` points to `/opt/gamecult/huginn/current` (`f6fc66b7e876b70a0be9c0e0d6b8e894b5df5138`).
- **Antigravity CLI docs (`antigravity.google`, unprobed locally):** Document an `agy` installer (`install.sh`), `-p`, `-c`/`--continue`, `--conversation <id>`, `--output-format text|json|stream-json`, `/compact`, and `hooks.json` (`PreToolUse`, `SessionStart`). Exact headless auth under `mind-<m>`, `stream-json` token-usage payload keys, and auto-compaction suppression hooks remain **unverified until `agy` is installed and probed on Yggdrasil** (first prerequisite step in `eureka-body:follow_up:persistent-persona-hydrogen-prototype`).
### 1.2 Huginn `persona` CAS & Door Path (`GameCult/Huginn` @ `f6fc66b`)
- `crates/huginn-mind/src/wire.rs:439-453`: `PersonaGet` and `PersonaPut` return `true` from `reaches_persona_door()`, so `--bind` (`10.77.0.1:17872..17879`) and `--persona-bind` (`10.77.0.1:18872..18879`) serve them identically, while `Admit` refuses with `NotThisDoor`.
- `crates/eureka-state/src/lib.rs:120-140`: `HuginnClient::persona_get` and `HuginnClient::persona_put(provenance, state, expected_updated_at)` already exist over CultNet RUDP.
- `crates/huginn-mind/src/persona.rs:122-131`: public `validate_document(instance, state)` enforces schema compliance (`gamecult.persona_state.v0.schema.json`, P1), `personaId == instance` (P2), and `provenance.authority == "canonical"` (P3). Daemon admission (`crates/huginn-mind/src/admission.rs:257-310`) enforces P4 (`expected_updated_at == stored_updated_at`) and P5 (`new updatedAt > stored updatedAt`).
- **Live `eureka` store probe (`10.77.0.1:17872`):** `huginn whoami` reports `documents 26077 receipts 12838`, `persona stored updatedAt=2026-12-02T13:45:15.457852052+00:00`. Live `eureka` `persona_state.v0` holds 5 `values`, 19 `memories` (including 4 legacy privacy-marked entries carrying `extensions.privacy = "private"` and `"private"` tags), 5 `shortTerm` (with `room:#swarm:gamecult.org`), 4 `incubation`, 2 `agencyPressure`, 22 `candidateActions` (`actionType: "custom"`, `customActionType: "intention"`), 9 `socialBonds`, 14 `moodDimensions`, 4 `needs`, 3 `doctrineStances`, `embodiment`, and `privateNotes`.
- **CLI gap:** `crates/eureka-state/src/bin/huginn/main.rs:244-264` implements only `persona get` and whole-doc `persona put` (`eureka-body:follow_up:huginn-cli-persona-verbs` predates `get|put` having landed). No surgical delta verbs (`memory`, `bond`, `mood`, `intention`) or public-Matrix `seed` renderer exist yet. Pre-existing `eureka-body:follow_up:persona-put-records-door` tracks daemon door attribution independently.
### 1.3 Matrix Mouth & Live Yggdrasil Sandbox/Brake State
- **Matrix mouth CLI surface:** No standalone Matrix CLI (`mind-chat` or `huginn chat send`) exists yet. `huginn chat search|window` (`crates/eureka-state/src/bin/huginn/main.rs:168-171`) queries Huginn's Qdrant chat index only. Live Matrix `/sync`, `pending`, `ack`, `read`, `send` (`v1..v3`), `open_direct`, and attachment fetch exist only behind Bifrost's `persona-matrix-mouth.mjs` RUDP server (`127.0.0.1:17884`, `BIFROST_CHAT_KEY_FILE`) spoken by `crates/mind-body/src/chat_rudp.rs`.
- **Live brakes (`2026-12-06` Yggdrasil read):** `/etc/gamecult/minds/swarm.cc` is **HELD** (`released = false`, `2026-12-02T13:49:10Z`), whereas all eight `/etc/gamecult/minds/<m>/control.cc` stores are **RELEASED** (`released = true`: `eureka` at `2026-10-31T10:01:08Z`, seven peers at `2026-12-02T05:12:30Z`).
- **Consequence in Bifrost mouth:** `Bifrost/tools/persona-matrix-mouth.mjs:1276` builds its `brake` reader solely from `<m>/control.cc` and does **not** read `swarm.cc`. Today all eight Matrix accounts stay synced as `unavailable` and buffer deliveries while `swarm.cc` keeps `mind-heartbeat.service` (`heartbeat.rs:21`) and `mind-persona@.service` (`ExecCondition=mind-control --instance %i check`) inert.
- **UID & network fence (`mind-fence.service`, `/etc/gamecult/minds/fence.nft`):**
- `persona` chain (`mind-<m>` UIDs): permits `10.77.0.1` UDP only to that Mind's `--persona-bind` port (`18872..18879`), `127.0.0.1:17884` UDP (Bifrost mouth), `127.0.0.1:4110` TCP (connector), `127.0.0.1:3310` TCP (forge proxy), TCP `80,443`, and public internet; rejects other loopback, RFC1918, Tailscale (`100.64.0.0/10`), link-local, and peer full Huginn doors.
- `box` chain (`mind-%i-box` UIDs behind `mind-box-%i.socket`): permits public internet only; rejects all loopback (`127.0.0.1`), local addresses, Huginn doors, and Bifrost mouth. `crates/mind-body/src/sandbox.rs:35-59` configures `bwrap` (`--ro-bind / /`, private `/tmp` and `/run`, `/etc/gamecult` and `/var/lib` masked by tmpfs, `--unshare-pid`).
---
## 2. Identity / Lifecycle / Authority Table (Persistent Kinds)
| Persistent Kind & Store | Authoritative Owner | Writers | Lifecycle & Pruning / Rotation |
|---|---|---|---|
| **Canonical Persona State** (`gamecult.persona_state.v0` in Huginn `HuginnPersonaEntry` keyed by `<instance>`) | `huginn-mind` (`admission.rs` P1-P5 CAS) | Cut 1: `huginn persona` (`put`, `memory add/retire`, `bond update`, `mood set`, `intention add/drop`), Self/Life puts, legacy `mind-persona` close until retired. | Survives forever across sessions. Every write runs `validate_document` (`P1-P3`) and stamps `updatedAt > stored_updated_at` (`P4-P5`). Delta verbs never mutate identity fields or purge legacy private notes; `huginn persona seed` filters legacy `private`/`room:!` entries read-only at bootstrap. |
| **Persona Session Transcript & Conversation ID** (Prototype: `agy` conversation store + host metadata in `STATE_DIRECTORY`; Legacy: `agent-session.cc`) | Persona host wrapper (`mind-persona-hydrogen@<m>` once built) | Host wrapper on session open, `--conversation` resume, and flush-and-clear rotation; sandboxed `agy` child appends turns. | **Derived cache, never memory.** Reused across incoming messages while cumulative tokens remain below host ceiling (~150k-160k tokens) and idle < sweep bound. At trigger: host asks Persona to commit desired deltas via `huginn persona`, verifies commit, clears/rotates session id, and rebootstraps via `huginn persona seed`. |
| **Matrix Mouth Cursor & In-Flight State** (`state` under `/var/lib/gamecult/bifrost/persona-matrix-mouth`) | `persona-matrix-mouth.service` (`bifrost` user) | Solely `persona-matrix-mouth.mjs` on `/sync`, `ack`, `send`, `openDirect`. | `nextBatch`, `seq`, and pending delivery list persist across restarts. In-memory follow rings/caps reset on restart (fail-safe shortening). Cursor advances only after `ack`. |
| **Driver Chat Backstops & Trace** (`STATE_DIRECTORY`: per-room consecutive Mind-line count, UTC daily turn count, delivered/acked ids) | Persona host wrapper | Host wrapper before turn dispatch and after `mind-chat` send/ack receipts. | Persists per-UTC-day turn count and per-room consecutive Mind-line count across restarts. Kept strictly out of `persona_state.v0` so transport counters never churn `updatedAt`. |
| **Identity-Diff Audit Events** (`identity-write-all-visible`, review room `#operator:gamecult.org`) | Persona host / `mind-persona` ledger + Matrix mouth | Cut 1: **Forbidden** on delta verbs (`memory`, `bond`, `mood`, `intention` never modify identity/values). Legacy: `persona.rs:945-988` `identity_diff` rows in `persona-trace.cc`. | Any future CLI/driver identity delta verb must record a pending diff (`publicName`, `publicDescription`, `presentation`, `values`) and post through the mouth (`MIND_PERSONA_REVIEW_ROOM`) on the same commit path. |
| **Operator Brakes & UID Fence** (`/etc/gamecult/minds/swarm.cc`, `<m>/control.cc`, `fence.nft`) | Operator / `mind-control` + `mind-fence.service` | Root admin only (`UnsafeStore` on non-root/group-writable). | Fail-closed snapshot reads (`control::read_effective`). `swarm.cc` gates legacy fleet (`mind-heartbeat`, `mind-persona@*`); `<m>/control.cc` also gates `persona-matrix-mouth`. |
---
## 3. Coexistence & Future Deletion Line
### 3.1 Safe 1-Mind Hydrogen Coexistence Under Held `swarm.cc`
1. **Per-Mind mutual exclusion:** `mind-persona@<m>.service` and the future `mind-persona-hydrogen@<m>.service` must never run concurrently on the same `<m>` (they would race on `persona-matrix-mouth` `pending`/`ack` and `persona_state.v0` CAS). While `swarm.cc` stays HELD (`false`), `mind-heartbeat.service` and all eight `mind-persona@*` units remain stopped by `control::read_effective`.
2. **Single-Mind prototype isolation:** Because `persona-matrix-mouth.mjs:1276` checks `<m>/control.cc` (currently `true`) rather than `swarm.cc`, `mind-persona-hydrogen@<m>` can run solely for the selected prototype Mind (`eureka-body:question:persistent-persona-prototype-mind`) under her own `mind-<m>` UID + `mind-fence.service` (with `bwrap` masking `/etc/gamecult` credentials and Matrix mouth access mediated so sandboxed children never read raw credential seeds), reading/writing `persona_state.v0` over her `--persona-bind` port (`18872..18879`) and talking to Matrix over `127.0.0.1:17884`.
3. **Operational note on the 7 peers:** Until `persona-matrix-mouth` also respects `swarm.cc` or the operator holds `<other>/control.cc`, the 7 unattended peers show `unavailable` rather than `offline` on Matrix. Holding the 7 non-prototype `<m>/control.cc` files keeps peers cleanly `offline` during live public-Matrix testing.
4. **Fleet-release safety interlock:** `mind-persona-hydrogen@.service` must declare `Conflicts=mind-persona@%i.service` (and vice versa) before any `swarm.cc` release.
### 3.2 Retirement Deletion Line (After 1-Mind Prototype Proof)
Tracked by `eureka-body:follow_up:retire-four-stage-persona-pipeline`. Once the 1-Mind Hydrogen session clears live voice and memory-curation checks:
- **Delete:** `crates/mind-body/src/projection.rs` and `crates/mind-body/src/projection/` (`select.rs` including `Scope`/`concerns` privacy-framing, `narrate.rs`, `interpret.rs`, `commit.rs`, `agent/`, `wake.rs`, `harness.rs`, `simulate.rs`, `tuning.rs`, `domain.rs`, `read.rs`, `turn.rs`), `crates/mind-body/src/persona/live.rs`, the 4-stage drain in `crates/mind-body/src/persona.rs`, `mind-persona@.service` (4-stage unit), `mind-heartbeat`'s per-wake `mind-persona@` launcher, and `ghostlight-persona-projection` (plus `toml` if unused) in `crates/mind-body/Cargo.toml`.
- **Keep:** `control.rs`, `sandbox.rs`, `chat_client.rs` & `chat_rudp.rs` (backing `mind-chat`), `cli.rs`, `self_run.rs` / `launch.rs` / `queue.rs`.
---
## 4. Authority Map — Cut 1: `persona-delta-verbs`
Target spec: `eureka-body:cut_spec:cut-persona-delta-verbs.r1` (`GameCult/Huginn`, base `f6fc66b7e876b70a0be9c0e0d6b8e894b5df5138`, branch `hands/persona-delta-verbs`).
- **Owner:** `crates/eureka-state/src/bin/huginn/persona.rs` (surgical read-modify-validate-CAS-put client and privacy-stripped `seed` renderer) backed by `crates/huginn-mind/src/admission.rs` (P1-P5 CAS owner).
- **Inputs:** Environment `EUREKA_INSTANCE` + `HUGINN_ENDPOINT`, `--faculty` / `--agent` / `--session` (or `HUGINN_SESSION`), verb CLI flags, and current `gamecult.persona_state.v0` via `HuginnClient::persona_get()`.
- **Outputs:**
- Delta verbs (`memory add`, `memory retire`, `bond update`, `mood set`, `intention add`, `intention drop`): updated canonical `gamecult.persona_state.v0` committed via `HuginnClient::persona_put(..., Some(expected_updated_at))`; stdout `Committed <receipt_id>` (plus `id <id>` when an entry is created/updated) or `Refused ...` / `absent` (exit 1) / `InvalidInput` (exit 2).
- `huginn persona seed`: deterministic, privacy-stripped plain-text session bootstrap on stdout (exit 0), or `absent` (exit 1).
- **Derived state:** Monotonic `updatedAt` via `stamp_after(Utc::now(), Some(&view.updated_at))` (`P5`), generated item ids (`m-...`/`w-...`/`i-...`/`b-...`), normalized trimmed strings, and rendered `seed` text (derived on read, never stored).
- **Forbidden writers:**
- Cut 1 delta verbs must never modify `publicName`, `publicDescription`, `presentation`, `values`, `privateNotes`, `embodiment`, `voidbotProjection`, or `provenance.authority` (`identity-write-all-visible` holds structurally without mouth coupling).
- Delta verbs forbid explicit `"private"` or `"room:!"` tags on created entries so public-Matrix state stays public by construction.
- `huginn persona seed` writes no state (`PersonaPut` never called), exposes no `--json` flag (`eureka-substrate:ruling:recall-lives-in-huginn-no-cli-json`), and must never emit `privateNotes`, items carrying `extensions.privacy == "private"`, `"private"` tags, or `room:!<...>` tags.
- `crates/eureka-state/src/main.rs` (deprecated MCP server) gains zero delta tools.
- **Shared paths:**
- One CAS helper `mutate_persona(...)` owns `persona_get -> mutate -> stamp_after -> validate_document -> persona_put`, with bounded retry (up to 3 total attempts) solely on `MindRefusal::PersonaStale` (`Unavailable` is never retried, preserving `main.rs:9-10`).
- One predicate `is_private_entry(&Value)` shared across every array filter in `seed` (and nested `lastEvidence` / `evidence`), matching `persona-state-standard.md` and `projection::select::concerns`.
- **Deletion line:** None in Cut 1 (`crates/eureka-state` holds only `persona get|put`). Pipeline teardown waits for `eureka-body:follow_up:retire-four-stage-persona-pipeline`.
---
## 5. Cut Sequence & Citations
1. **Cut 1 (Ready for Hands now):** `eureka-body:cut_spec:cut-persona-delta-verbs.r1` (`questions: []`).
2. **Operator fork (parallel, does not block Cut 1):** `eureka-body:question:persistent-persona-prototype-mind`.
3. **Cut 2 (Follow-up):** `eureka-body:follow_up:persistent-persona-hydrogen-prototype`.
4. **Cut 3 (Follow-up):** `eureka-body:follow_up:retire-four-stage-persona-pipeline`.
5. **Considered alternatives recorded as `idea`s (`Recorded`):** `eureka-body:idea:persistent-persona-map.seed-strips-stored-private`, `eureka-body:idea:persistent-persona-map.identity-delta-verbs-in-cut1`, `eureka-body:idea:persistent-persona-map.whole-doc-cas-wrapper-script`, `eureka-body:idea:persistent-persona-map.persona-seed-json-flag`.
# Persistent Sandboxed Persona Session — Architecture & Authority Map
Status: **Imagination architecture map (`eureka-body`, base `f6fc66b`)**
Campaign rulings: `eureka-body:ruling:persistent-persona-session-public-matrix`, `eureka-body:ruling:dual-mode-cli-turn-boundary`, `eureka-body:ruling:identity-write-all-visible`, `eureka-body:ruling:cli-over-mcp-agent-surface`, `eureka-body:ruling:live-mind-sessions`, `eureka-substrate:ruling:recall-lives-in-huginn-no-cli-json`.
---
## 1. Live Body Facts & Mechanism Probes (`2026-12-06`)
### 1.1 `agy` / Hydrogen CLI Substrate
- **Starfire (`localhost`):** `agy` is **not installed** (`Get-Command agy` empty). Desktop Antigravity `2.38.0` (`C:\Users\Meta\AppData\Local\Programs\antigravity\Antigravity.exe` + `resources\bin\language_server.exe`) and `claude` `2.1.312` (`C:\Users\Meta\AppData\Roaming\npm\claude.ps1`) are present. `C:\Users\Meta\.gemini\antigravity\bin\agentapi.bat` invokes `language_server.exe agentapi`, whose `--help` exposes only `get-conversation-metadata`, `new-conversation`, and `send-message` — desktop agent RPC rather than a headless streaming runner with token telemetry.
- **Yggdrasil (`ssh yggdrasil`):** Neither `agy`, `antigravity`, `gemini`, nor a global `claude` exists on `PATH`. `/opt/` holds `actions-runner`, `claude-code/2.1.312`, `commons`, `containerd`, `gamecult`, `node-v24.14.1-linux-x64`, `rust`, and `venvs`; `/usr/local/bin/huginn` points to `/opt/gamecult/huginn/current` (`f6fc66b7e876b70a0be9c0e0d6b8e894b5df5138`).
- **Antigravity CLI docs (`antigravity.google`, unprobed locally):** Document an `agy` installer (`install.sh`), `-p`, `-c`/`--continue`, `--conversation <id>`, `--output-format text|json|stream-json`, `/compact`, and `hooks.json` (`PreToolUse`, `SessionStart`). Exact headless auth under `mind-<m>`, `stream-json` token-usage payload keys, and auto-compaction suppression hooks remain **unverified until `agy` is installed and probed on Yggdrasil** (first prerequisite step in `eureka-body:follow_up:persistent-persona-hydrogen-prototype`).
### 1.2 Huginn `persona` CAS & Door Path (`GameCult/Huginn` @ `f6fc66b`)
- `crates/huginn-mind/src/wire.rs:439-453`: `PersonaGet` and `PersonaPut` return `true` from `reaches_persona_door()`, so `--bind` (`10.77.0.1:17872..17879`) and `--persona-bind` (`10.77.0.1:18872..18879`) serve them identically, while `Admit` refuses with `NotThisDoor`.
- `crates/eureka-state/src/lib.rs:120-140`: `HuginnClient::persona_get` and `HuginnClient::persona_put(provenance, state, expected_updated_at)` already exist over CultNet RUDP.
- `crates/huginn-mind/src/persona.rs:122-131`: public `validate_document(instance, state)` enforces schema compliance (`gamecult.persona_state.v0.schema.json`, P1), `personaId == instance` (P2), and `provenance.authority == "canonical"` (P3). Daemon admission (`crates/huginn-mind/src/admission.rs:257-310`) enforces P4 (`expected_updated_at == stored_updated_at`) and P5 (`new updatedAt > stored updatedAt`).
- **Live `eureka` store probe (`10.77.0.1:17872`):** `huginn whoami` reports `documents 26077 receipts 12838`, `persona stored updatedAt=2026-12-02T13:45:15.457852052+00:00`. Live `eureka` `persona_state.v0` holds 5 `values`, 19 `memories` (including 4 legacy privacy-marked entries carrying `extensions.privacy = "private"` and `"private"` tags), 5 `shortTerm` (with `room:#swarm:gamecult.org`), 4 `incubation`, 2 `agencyPressure`, 22 `candidateActions` (`actionType: "custom"`, `customActionType: "intention"`), 9 `socialBonds`, 14 `moodDimensions`, 4 `needs`, 3 `doctrineStances`, `embodiment`, and `privateNotes`.
- **CLI gap:** `crates/eureka-state/src/bin/huginn/main.rs:244-264` implements only `persona get` and whole-doc `persona put` (`eureka-body:follow_up:huginn-cli-persona-verbs` predates `get|put` having landed). No surgical delta verbs (`memory`, `bond`, `mood`, `intention`) or public-Matrix `seed` renderer exist yet. Pre-existing `eureka-body:follow_up:persona-put-records-door` tracks daemon door attribution independently.
### 1.3 Matrix Mouth & Live Yggdrasil Sandbox/Brake State
- **Matrix mouth CLI surface:** No standalone Matrix CLI (`mind-chat` or `huginn chat send`) exists yet. `huginn chat search|window` (`crates/eureka-state/src/bin/huginn/main.rs:168-171`) queries Huginn's Qdrant chat index only. Live Matrix `/sync`, `pending`, `ack`, `read`, `send` (`v1..v3`), `open_direct`, and attachment fetch exist only behind Bifrost's `persona-matrix-mouth.mjs` RUDP server (`127.0.0.1:17884`, `BIFROST_CHAT_KEY_FILE`) spoken by `crates/mind-body/src/chat_rudp.rs`.
- **Live brakes (`2026-12-06` Yggdrasil read):** `/etc/gamecult/minds/swarm.cc` is **HELD** (`released = false`, `2026-12-02T13:49:10Z`), whereas all eight `/etc/gamecult/minds/<m>/control.cc` stores are **RELEASED** (`released = true`: `eureka` at `2026-10-31T10:01:08Z`, seven peers at `2026-12-02T05:12:30Z`).
- **Consequence in Bifrost mouth:** `Bifrost/tools/persona-matrix-mouth.mjs:1276` builds its `brake` reader solely from `<m>/control.cc` and does **not** read `swarm.cc`. Today all eight Matrix accounts stay synced as `unavailable` and buffer deliveries while `swarm.cc` keeps `mind-heartbeat.service` (`heartbeat.rs:21`) and `mind-persona@.service` (`ExecCondition=mind-control --instance %i check`) inert.
- **UID & network fence (`mind-fence.service`, `/etc/gamecult/minds/fence.nft`):**
- `persona` chain (`mind-<m>` UIDs): permits `10.77.0.1` UDP only to that Mind's `--persona-bind` port (`18872..18879`), `127.0.0.1:17884` UDP (Bifrost mouth), `127.0.0.1:4110` TCP (connector), `127.0.0.1:3310` TCP (forge proxy), TCP `80,443`, and public internet; rejects other loopback, RFC1918, Tailscale (`100.64.0.0/10`), link-local, and peer full Huginn doors.
- `box` chain (`mind-%i-box` UIDs behind `mind-box-%i.socket`): permits public internet only; rejects all loopback (`127.0.0.1`), local addresses, Huginn doors, and Bifrost mouth. `crates/mind-body/src/sandbox.rs:35-59` configures `bwrap` (`--ro-bind / /`, private `/tmp` and `/run`, `/etc/gamecult` and `/var/lib` masked by tmpfs, `--unshare-pid`).
---
## 2. Identity / Lifecycle / Authority Table (Persistent Kinds)
| Persistent Kind & Store | Authoritative Owner | Writers | Lifecycle & Pruning / Rotation |
|---|---|---|---|
| **Canonical Persona State** (`gamecult.persona_state.v0` in Huginn `HuginnPersonaEntry` keyed by `<instance>`) | `huginn-mind` (`admission.rs` P1-P5 CAS) | Cut 1: `huginn persona` (`put`, `memory add/retire`, `bond update`, `mood set`, `intention add/drop`), Self/Life puts, legacy `mind-persona` close until retired. | Survives forever across sessions. Every write runs `validate_document` (`P1-P3`) and stamps `updatedAt > stored_updated_at` (`P4-P5`). Delta verbs never mutate identity fields or purge legacy private notes; `huginn persona seed` filters legacy `private`/`room:!` entries read-only at bootstrap. |
| **Persona Session Transcript & Conversation ID** (Prototype: `agy` conversation store + host metadata in `STATE_DIRECTORY`; Legacy: `agent-session.cc`) | Persona host wrapper (`mind-persona-hydrogen@<m>` once built) | Host wrapper on session open, `--conversation` resume, and flush-and-clear rotation; sandboxed `agy` child appends turns. | **Derived cache, never memory.** Reused across incoming messages while cumulative tokens remain below host ceiling (~150k-160k tokens) and idle < sweep bound. At trigger: host asks Persona to commit desired deltas via `huginn persona`, verifies commit, clears/rotates session id, and rebootstraps via `huginn persona seed`. |
| **Matrix Mouth Cursor & In-Flight State** (`state` under `/var/lib/gamecult/bifrost/persona-matrix-mouth`) | `persona-matrix-mouth.service` (`bifrost` user) | Solely `persona-matrix-mouth.mjs` on `/sync`, `ack`, `send`, `openDirect`. | `nextBatch`, `seq`, and pending delivery list persist across restarts. In-memory follow rings/caps reset on restart (fail-safe shortening). Cursor advances only after `ack`. |
| **Driver Chat Backstops & Trace** (`STATE_DIRECTORY`: per-room consecutive Mind-line count, UTC daily turn count, delivered/acked ids) | Persona host wrapper | Host wrapper before turn dispatch and after `mind-chat` send/ack receipts. | Persists per-UTC-day turn count and per-room consecutive Mind-line count across restarts. Kept strictly out of `persona_state.v0` so transport counters never churn `updatedAt`. |
| **Identity-Diff Audit Events** (`identity-write-all-visible`, review room `#operator:gamecult.org`) | Persona host / `mind-persona` ledger + Matrix mouth | Cut 1: **Forbidden** on delta verbs (`memory`, `bond`, `mood`, `intention` never modify identity/values). Legacy: `persona.rs:945-988` `identity_diff` rows in `persona-trace.cc`. | Any future CLI/driver identity delta verb must record a pending diff (`publicName`, `publicDescription`, `presentation`, `values`) and post through the mouth (`MIND_PERSONA_REVIEW_ROOM`) on the same commit path. |
| **Operator Brakes & UID Fence** (`/etc/gamecult/minds/swarm.cc`, `<m>/control.cc`, `fence.nft`) | Operator / `mind-control` + `mind-fence.service` | Root admin only (`UnsafeStore` on non-root/group-writable). | Fail-closed snapshot reads (`control::read_effective`). `swarm.cc` gates legacy fleet (`mind-heartbeat`, `mind-persona@*`); `<m>/control.cc` also gates `persona-matrix-mouth`. |
---
## 3. Coexistence & Future Deletion Line
### 3.1 Safe 1-Mind Hydrogen Coexistence Under Held `swarm.cc`
1. **Per-Mind mutual exclusion:** `mind-persona@<m>.service` and the future `mind-persona-hydrogen@<m>.service` must never run concurrently on the same `<m>` (they would race on `persona-matrix-mouth` `pending`/`ack` and `persona_state.v0` CAS). While `swarm.cc` stays HELD (`false`), `mind-heartbeat.service` and all eight `mind-persona@*` units remain stopped by `control::read_effective`.
2. **Single-Mind prototype isolation:** Because `persona-matrix-mouth.mjs:1276` checks `<m>/control.cc` (currently `true`) rather than `swarm.cc`, `mind-persona-hydrogen@<m>` can run solely for the selected prototype Mind (`eureka-body:question:persistent-persona-prototype-mind`) under her own `mind-<m>` UID + `mind-fence.service` (with `bwrap` masking `/etc/gamecult` credentials and Matrix mouth access mediated so sandboxed children never read raw credential seeds), reading/writing `persona_state.v0` over her `--persona-bind` port (`18872..18879`) and talking to Matrix over `127.0.0.1:17884`.
3. **Operational note on the 7 peers:** Until `persona-matrix-mouth` also respects `swarm.cc` or the operator holds `<other>/control.cc`, the 7 unattended peers show `unavailable` rather than `offline` on Matrix. Holding the 7 non-prototype `<m>/control.cc` files keeps peers cleanly `offline` during live public-Matrix testing.
4. **Fleet-release safety interlock:** `mind-persona-hydrogen@.service` must declare `Conflicts=mind-persona@%i.service` (and vice versa) before any `swarm.cc` release.
### 3.2 Retirement Deletion Line (After 1-Mind Prototype Proof)
Tracked by `eureka-body:follow_up:retire-four-stage-persona-pipeline`. Once the 1-Mind Hydrogen session clears live voice and memory-curation checks:
- **Delete:** `crates/mind-body/src/projection.rs` and `crates/mind-body/src/projection/` (`select.rs` including `Scope`/`concerns` privacy-framing, `narrate.rs`, `interpret.rs`, `commit.rs`, `agent/`, `wake.rs`, `harness.rs`, `simulate.rs`, `tuning.rs`, `domain.rs`, `read.rs`, `turn.rs`), `crates/mind-body/src/persona/live.rs`, the 4-stage drain in `crates/mind-body/src/persona.rs`, `mind-persona@.service` (4-stage unit), `mind-heartbeat`'s per-wake `mind-persona@` launcher, and `ghostlight-persona-projection` (plus `toml` if unused) in `crates/mind-body/Cargo.toml`.
- **Keep:** `control.rs`, `sandbox.rs`, `chat_client.rs` & `chat_rudp.rs` (backing `mind-chat`), `cli.rs`, `self_run.rs` / `launch.rs` / `queue.rs`.
---
## 4. Authority Map — Cut 1: `persona-delta-verbs`
Target spec: `eureka-body:cut_spec:cut-persona-delta-verbs.r1` (`GameCult/Huginn`, base `f6fc66b7e876b70a0be9c0e0d6b8e894b5df5138`, branch `hands/persona-delta-verbs`).
- **Owner:** `crates/eureka-state/src/bin/huginn/persona.rs` (surgical read-modify-validate-CAS-put client and privacy-stripped `seed` renderer) backed by `crates/huginn-mind/src/admission.rs` (P1-P5 CAS owner).
- **Inputs:** Environment `EUREKA_INSTANCE` + `HUGINN_ENDPOINT`, `--faculty` / `--agent` / `--session` (or `HUGINN_SESSION`), verb CLI flags, and current `gamecult.persona_state.v0` via `HuginnClient::persona_get()`.
- **Outputs:**
- Delta verbs (`memory add`, `memory retire`, `bond update`, `mood set`, `intention add`, `intention drop`): updated canonical `gamecult.persona_state.v0` committed via `HuginnClient::persona_put(..., Some(expected_updated_at))`; stdout `Committed <receipt_id>` (plus `id <id>` when an entry is created/updated) or `Refused ...` / `absent` (exit 1) / `InvalidInput` (exit 2).
- `huginn persona seed`: deterministic, privacy-stripped plain-text session bootstrap on stdout (exit 0), or `absent` (exit 1).
- **Derived state:** Monotonic `updatedAt` via `stamp_after(Utc::now(), Some(&view.updated_at))` (`P5`), generated item ids (`m-...`/`w-...`/`i-...`/`b-...`), normalized trimmed strings, and rendered `seed` text (derived on read, never stored).
- **Forbidden writers:**
- Cut 1 delta verbs must never modify `publicName`, `publicDescription`, `presentation`, `values`, `privateNotes`, `embodiment`, `voidbotProjection`, or `provenance.authority` (`identity-write-all-visible` holds structurally without mouth coupling).
- Delta verbs forbid explicit `"private"` or `"room:!"` tags on created entries so public-Matrix state stays public by construction.
- `huginn persona seed` writes no state (`PersonaPut` never called), exposes no `--json` flag (`eureka-substrate:ruling:recall-lives-in-huginn-no-cli-json`), and must never emit `privateNotes`, items carrying `extensions.privacy == "private"`, `"private"` tags, or `room:!<...>` tags.
- `crates/eureka-state/src/main.rs` (deprecated MCP server) gains zero delta tools.
- **Shared paths:**
- One CAS helper `mutate_persona(...)` owns `persona_get -> mutate -> stamp_after -> validate_document -> persona_put`, with bounded retry (up to 3 total attempts) solely on `MindRefusal::PersonaStale` (`Unavailable` is never retried, preserving `main.rs:9-10`).
- One predicate `is_private_entry(&Value)` shared across every array filter in `seed` (and nested `lastEvidence` / `evidence`), matching `persona-state-standard.md` and `projection::select::concerns`.
- **Deletion line:** None in Cut 1 (`crates/eureka-state` holds only `persona get|put`). Pipeline teardown waits for `eureka-body:follow_up:retire-four-stage-persona-pipeline`.
---
## 5. Cut Sequence & Citations
1. **Cut 1 (Ready for Hands now):** `eureka-body:cut_spec:cut-persona-delta-verbs.r1` (`questions: []`).
2. **Operator fork (parallel, does not block Cut 1):** `eureka-body:question:persistent-persona-prototype-mind`.
3. **Cut 2 (Follow-up):** `eureka-body:follow_up:persistent-persona-hydrogen-prototype`.
4. **Cut 3 (Follow-up):** `eureka-body:follow_up:retire-four-stage-persona-pipeline`.
5. **Considered alternatives recorded as `idea`s (`Recorded`):** `eureka-body:idea:persistent-persona-map.seed-strips-stored-private`, `eureka-body:idea:persistent-persona-map.identity-delta-verbs-in-cut1`, `eureka-body:idea:persistent-persona-map.whole-doc-cas-wrapper-script`, `eureka-body:idea:persistent-persona-map.persona-seed-json-flag`.
---
# Cut 2 Addendum: Persistent Hydrogen Persona (`nibu`) — Real Substrate & CLI Split
Addendum to [`docs/persistent-persona-map.md`](F:/Projects/Huginn/docs/persistent-persona-map.md) grounded against `GameCult/Huginn` `main` (`70079777a8dcf1d5c2160745a5f827f09057fb5f`, after Cut 1 `cut-persona-delta-verbs.r1`), live `yggdrasil`, `Bifrost/tools/persona-matrix-mouth.mjs`, and official Antigravity CLI docs.
## 1. Verified Antigravity CLI (`agy`) Findings & Cut 2b Probe Plan
Source docs verified from `antigravity.google/docs`: `getting-started.md`, `install.md`, `install.sh`, `cli/headless.md`, `cli/reference.md`, `cli/conversations.md`, `commands/compact.md`, `models.md`, `sandbox.md`, `cli/modes.md`, `cli/troubleshooting.md`, `hooks.md`, `settings.md`.
- **Install mechanism:** `curl -fsSL https://antigravity.google/cli/install.sh | bash` (supports `-d <dir>`) installs `~/.local/bin/agy` by fetching SHA-512 verified `linux_amd64.json` from `https://antigravity-cli-auto-updater-974169037036.us-central1.run.app/manifests/linux_amd64.json`.
- **Live Yggdrasil status:** Neither `agy`, `antigravity`, nor `claude` is installed on `yggdrasil`; `/usr/bin/bwrap` and `/usr/bin/node` exist. `mind-nibu` (`uid=963`) has `homedir=/nonexistent`, `nologin`, no user D-Bus session, and `fence.nft` permits `80/443`, `127.0.0.1:17884` (chat RUDP), `127.0.0.1:3310` (Forgejo), `10.77.0.1:18878` (`huginn` persona door), while dropping `17878` (`huginn_full`).
- **Auto-updater vs `ProtectSystem=strict`:** `agy` normally checks/updates itself in the background (`update.lock`); `AGY_CLI_DISABLE_AUTO_UPDATE=true` disables background auto-updating and must be set in the systemd/sandbox environment.
- **Auth & Keyring Constraint (`mind-nibu` headless service):** `install.md` documents Remote SSH manual URL/code OAuth (`agy auth login`) and `cli-troubleshooting.md` explicitly states Linux stores OAuth tokens using **`Linux secret-service through D-Bus`** (`dbus-launch`). Because `mind-nibu` is a headless systemd unit with `homedir=/nonexistent` and no user D-Bus session (unlike interactive login users), Cut 2b Step 0 must empirically test how `agy` reads/persists credentials under `mind-nibu` inside a private runtime/state home + D-Bus keyring (or `GEMINI_API_KEY` + `modelProvider: gemini` if Meta elects API key mode). Meta performs a one-time interactive `agy auth login` during Cut 2b deploy.
- **Model slugs (`models.md`):** Gemini 4 Hydrogen slugs are `gemini-4-hydrogen-low`, `gemini-4-hydrogen-medium`, `gemini-4-hydrogen-high`, and `gemini-4-hydrogen-xhigh` (available across plans).
- **Persistent streaming CLI contract (`cli-headless.md`, `cli-reference.md`):**
- Persistent session flags: `--conversation <id>` (or `-c`/`--continue`), `--model <slug>`, `--output-format stream-json`, `--input-format stream-json`, `--dangerously-skip-permissions` / `--mode agent` / `--sandbox`.
- **CRITICAL:** `cli-headless.md` warns **not to pass `-p` with `--input-format stream-json`**. Bidirectional host-driven streaming uses `agy --input-format stream-json --output-format stream-json --conversation <id> ...` without `-p`.
- **Token-tracking discrepancy requiring Cut 2b Step 0 empirical probe:**
- `result.usage` in `agy` is **cumulative across the whole session**, never current context window occupancy.
- `step_update.usage` is per-step, but `cli-headless.md` contains an internal ambiguity between examples: its single-turn example shows `input_tokens: 10302, cache_read_tokens: 8113` while its multi-turn example shows `input_tokens: 278, cache_read_tokens: 30214` (uncached suffix vs inclusive total). Therefore Cut 2b Step 0 must run a real 2-turn `stream-json` probe comparing `step_update.usage` against `/context` before locking the host flush-and-clear ceiling formula (~150k-160k tokens).
- Native hooks (`hooks.md`: `PreInvocation` / `PostInvocation` / `Stop`) and slash commands (`/clear`, `/compact`, `/context`, `/usage`) exist as backup controls.
## 2. Live Matrix Mouth & Security Findings
- **Single shared secret hazard (`persona-matrix-mouth.mjs:1256`):** `/etc/gamecult/swarm/chat-key` is one swarm-wide key for all 8 Personas (`RudpChat` derives a single `connection_id` from it and passes `persona` inside each MessagePack payload).
- **Existing isolation (`sandbox.rs:43`):** Inside `bwrap`, `--tmpfs /run` hides systemd credentials (`/run/credentials/.../chat-key`). Putting `chat-key` inside `bwrap` would let a sandboxed tool impersonate `eureka` or any peer Mind.
- **Consequence:** A host-side gate (`mind-chat gate`) must sit outside `bwrap` holding `BIFROST_CHAT_KEY_FILE` and `BIFROST_CHAT_ENDPOINT`, pin `persona = --instance` on every request, enforce `MIND_RUN_BACKSTOP` + UTC daily outbound say cap + unsettled `SEND_REQUEST_V3` resend safety (`1800s`), and expose a `0600` Unix socket (`MIND_CHAT_SOCKET`) for `bwrap` clients.
- **Door isolation & Persona -> Self escalation:** `huginn@nibu` serves `Door::Persona` on `10.77.0.1:18878` (`17705` docs, `nibu:instance:self` and `nibu-body:campaign:self` in force). `Door::Persona` rejects arbitrary `HuginnMindRequest::Admit(_)` (`wire.rs:451`, `daemon.rs:195`) with `NotThisDoor`. Meanwhile `self_run::inbox::open_briefs` (`inbox.rs:61`) already reads `PipelineKind::FollowUp` where `owner == "self-run"` and `summary.admission.provenance.agent == "mind-persona"`. Adding narrow `HuginnMindRequest::EscalateGoal` (`reaches_persona_door() => true`) lets `huginn-daemon` force `owner = "self-run"`, `provenance.agent = "mind-persona"`, `locations = []`, and `source = "<campaign>:campaign:self"` and feed `self_run::inbox` with zero duplicate queue and zero widening of `fence.nft` or `Door::Persona` (`Admit` remains refused).
- **Forge activity gap (`main.rs:772`):** `HuginnMindRequest::StewardedActivity` already passes `reaches_persona_door()` and queries `huginn-daemon --forge-url` (`http://127.0.0.1:3310` on Yggdrasil), filtering the Mind's own login out of `RepoActivity`, but the `huginn` CLI had no subcommand calling it. Exposing `huginn activity` fixes work/forge visibility without raw shell `curl` scraping.
## 3. Cut 2 Split: Cut 2a (Dispatchable Now) vs Cut 2b (`follow_up`)
Because `agy` is not yet installed on `yggdrasil` and requires live Step 0 telemetry/keyring/sandbox verification plus Meta's interactive SSH OAuth login, Cut 2 splits cleanly into two non-blocked cuts:
- **Cut 2a (`eureka-body:cut_spec:cut-persistent-persona-cli-tools.r1` — branch `hands/persistent-persona-cli-tools`):**
1. `HuginnMindRequest::EscalateGoal` (`huginn-mind`, `schemas/cultnet/huginn.mind_request.v1.schema.json`) + server-enforced admission & indexing in `huginn-daemon`.
2. `huginn escalate` and `huginn activity` plain-text CLI commands in `crates/eureka-state/src/bin/huginn/{main.rs,render.rs}` (no `--json`, reuses `read_back` and `Stewardship` selection).
3. `mind_body::chat_gate` + `mind-chat` binary (`crates/mind-body/src/bin/mind-chat.rs`, clap-free per `dependency_graph.rs`) implementing host `gate` (`0600` Unix socket, key outside sandbox, persona pinning) and shared `Engine` (`pending`, `tail`, `say` with `SendBasis` + `RoomMoved` + unsettled `1800s` `resend`, `ack`, `mark-read`, `open-direct`, `status`), reusing `heartbeat::{line_facts, MIND_RUN_BACKSTOP, EXCHANGE_MINUTES}` and persisting cursors/UTC daily cap in `chat-gate.json`.
- **Cut 2b (`eureka-body:follow_up:persistent-persona-hydrogen-driver`):**
1. Install `agy` on `yggdrasil` (`AGY_CLI_DISABLE_AUTO_UPDATE=true`) and probe live keyring auth under `mind-nibu` (with Meta's one-time interactive `agy auth login`), nested `--sandbox` inside `bwrap`, and 2-turn `step_update.usage` vs `/context` token counter.
2. Build host `mind-persona-hydrogen` driver managing `mind-chat gate`, `bwrap` workspace + `MIND_CHAT_SOCKET` bind-mount, persistent `--conversation` Hydrogen session seeded via `huginn persona seed`, host-triggered flush-and-clear at ~150k-160k tokens + long-idle sweep + UTC daily turn cap.
3. Add `mind-persona-hydrogen@.service` (`Conflicts=mind-persona@%i`), update `huginn@nibu` binary for `EscalateGoal`, and run live `#minds`/`#swarm` voice + memory curation verification for Nibu (`nibu`).
## 4. Cut 2a Authority Map & Pre-Implementation Statement
- **Objective:** Deliver shared, dual-mode, self-validating Matrix mouth (`mind-chat`), Forge work visibility (`huginn activity`), and constrained Persona -> Self escalation (`huginn escalate` over `EscalateGoal`) that work identically under both `agy` subscription sandboxes and API tool loops, with zero OAuth dependency.
- **Current mechanism:** Today a sandboxed agent has no CLI for Matrix RUDP (`127.0.0.1:17884` requires the shared `/etc/gamecult/swarm/chat-key`), `huginn` leaves `StewardedActivity` unexposed (`main.rs:772`), and `Door::Persona` rejects all admissions so a Persona session cannot escalate a brief to `self_run::inbox`.
- **Invariants:**
- `BIFROST_CHAT_KEY_FILE` stays outside `bwrap`; `mind-chat gate` pins `persona = instance` so sandboxed clients cannot impersonate peers.
- Only `pending`/`tail` updates `seen_event_id`; `RoomMoved` refuses `say` and returns `newer` IDs without blindly advancing `seen_event_id`; unsettled sends block same-room follow-on sends (`1800s`) unless explicitly retried with `resend: true`.
- `MIND_RUN_BACKSTOP = 4` (`heartbeat::line_facts` + per-room outbound count, `EXCHANGE_MINUTES = 30`) and UTC daily outbound cap hold at the host gate.
- `Door::Persona` continues rejecting `HuginnMindRequest::Admit(_)` (`NotThisDoor`); `EscalateGoal` enforces `owner = "self-run"`, `provenance.agent = "mind-persona"`, `locations = []`, `source = <campaign>:campaign:self`, and rejects `imported_from`.
- No `clap` in `mind-body` (`dependency_graph.rs`); no `--json` flags on new `huginn` CLI verbs (`recall-lives-in-huginn-no-cli-json`); no writes to `gamecult.persona_state.v0` by `mind-chat`.
- **Intended change:** Consolidate chat cursor, backstop, unsettled-send tracking, and daily cap in one `chat_gate::Engine` shared between `mind-chat gate` socket mode and direct mode; expose `EscalateGoal` through `huginn-daemon`'s existing `self.mind.admit` + `self.index.committed` pipeline; wire `huginn activity` directly to `StewardedActivity`.
- **Cut line:** Live 4-stage `mind-persona` (`projection/`, `persona.rs`, `persona/live.rs`, `mind-persona@.service`) remains untouched under held `swarm.cc` during Cut 2a/2b and is scheduled for deletion in `eureka-body:follow_up:retire-four-stage-persona-pipeline`. `crates/eureka-state/src/main.rs` (deprecated MCP) receives nothing.
- **Subtraction budget:** Zero new external crate dependencies (`0` added); zero new wire response structs (reuses `HuginnMindResponse::Admit`, `HuginnMindResponse::Activity`, and `PipelineFollowUp`); zero new queue readers (`self_run::inbox::derive` consumes `EscalateGoal` directly); zero duplicate backstop rules (`chat_gate` reuses `heartbeat::{line_facts, MIND_RUN_BACKSTOP, EXCHANGE_MINUTES}` directly). Net additive surface (`[[bin]] name = "mind-chat"`, `HuginnMindRequest::EscalateGoal`, `huginn escalate`/`activity`) is the minimum surface required by `cli-over-mcp-agent-surface` and `dual-mode-cli-turn-boundary`.
| Component | Decision | Reason |
|---|---|---|
| `RudpChat`, `Chat` (`chat_rudp.rs`, `chat_client.rs`) | **Keep** | Verified RUDP/MessagePack v3 mouth transport and `SendBasis`/`RoomMoved`/`resend` semantics. |
| `heartbeat::line_facts`, `MIND_RUN_BACKSTOP` | **Keep (Reuse)** | Single source of truth for consecutive Mind-line backstop and 30m exchange window. |
| `self_run::inbox::open_briefs` | **Keep (Reuse)** | Already reads `owner="self-run"` + `provenance.agent="mind-persona"` `FollowUp` briefs. |
| `HuginnMindRequest::StewardedActivity` | **Keep (Expose)** | Daemon already implements Forge query; `huginn activity` exposes it via CLI. |
| Opening `HuginnMindRequest::Admit` on `Door::Persona` | **Cut (Rejected)** | Replaced by narrow server-enforced `EscalateGoal`. |
| Mounting `chat-key` into `bwrap` | **Cut (Rejected)** | Replaced by `mind-chat gate` `0600` Unix socket + host persona pinning. |
| Raw Forge HTTP `curl` from Persona prompt | **Cut (Rejected)** | Replaced by `huginn activity` over `StewardedActivity`. |
| 4-stage `projection/` + `persona/live.rs` | **Defer (Cut 3)** | Held until Cut 2b prototype validates Hydrogen voice & curation on Nibu. |