Huginn/crates/mind-body/src/lib.rs
Meta Vens 8d69d3bded mind-persona project: the persona seed harness (--room, --through persona, --batch, --simulate)
The harness judges candidate persona states before any Mind holds them, through the
same `project` the live turn will use: every case is one `project` call.

- `--room <fixture.toml>`: a mocked room in place of the mouth and the room tail:
  her id, rooms, messages (sender, display name, room, ago, body; new, tag,
  mentions, dm, follow_up, reply_to), a mocked now and a "last heard from" table.
  The fixture is a MouthReader, so addressing is still `address::is_for`. The live
  room filter that `--room` used to name is now `--in`.
- `--state` is checked as a put checks content: huginn-mind's P1 to P3 now live in
  one owner, `persona::validate_document`, which the put calls.
- `--through persona`: the Persona stage (C3b's first piece). One tool-less
  connector call under Ghostlight's persona membrane over identity, narration and
  the heard lines; prose capped at 180 words; would-say lines are the double-quoted
  spans; usage per call. Tuning gains `[persona]` (model, guidance, words).
- `--batch <plan> --out <md>`: states x scenarios x samples, one Markdown report
  with packets, narration, prose, would-say lines, word counts, distinct-2 and
  cross-state word similarity, and a total-usage footer.
- `--simulate <plan> --out <md>`: up to eight personas taking turns in one room.
  Wake is is_for plus the ruled set (addressed, any human in her rooms, the beat);
  `wake = "all_messages"` is the old loop as a control. Woken personas run in a
  seeded order; quoted lines join the room as from her id. State does not evolve
  (`state_after_turn` is the seam for C3b/C3c). Metrics: messages, silence,
  who addresses whom, Mind-to-Mind chains, lexical convergence, a work-talk
  heuristic, usage.
- With a state file and a fixture no daemon and no mouth is needed (bin test).
- Request ids take the wall clock, so a fixture's fixed now cannot replay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 01:13:51 +01:00

54 lines
2.6 KiB
Rust

//! `mind-body`: the organs of one Mind's body that live in Huginn's workspace.
//!
//! Today that is `control`, the operator's brakes, and `cli`, the operator's
//! hand on them. The brakes are the operator's consent, not her body: the store
//! is root-owned and no organ of hers writes it.
//!
//! `launch` holds her units under systemd and the reads of the runs a Self run
//! holds; `queue` is her port to her mind and what an open question holds.
//!
//! `heartbeat` runs the swarm's shared heartbeat: the one process, the
//! `mind-heartbeat` binary, that decides which Persona wakes and when, on the
//! configured beat by the pick in `tempo`. It starts her unit and writes no mind.
//!
//! `persona` is the Persona organ: one start of `mind-persona@<instance>` reads the brakes, and
//! until the three-stage turn lands it carries no turn. It keeps what a turn's input is made of
//! (`chat_client` is the chat wire and port and `chat_rudp` its RUDP transport to Bifrost's mouth).
//!
//! `projection` is the Projector of the Persona-only turn: the Select stage chooses what she can feel and the
//! Projector narrates it as her lived stream, under `persona-tuning.toml`; the Persona stage continues it in her prose.
//! `mind-persona project` runs them and writes nothing; `projection::harness` runs it over mocked rooms, batches of
//! candidate states and a simulated swarm.
//!
//! `lease_client` asks the Claude connector for a session's credential and the
//! plan's usage windows. `self_run` carries one Self run inside `mind-self@<instance>`: the
//! `mind-self-run` binary runs `claude` over stream-json for her one open Self
//! run, asks for the flush at the context ceiling and stops a child that outlives it.
// The control root is a constant, so the library reads no part of the process
// environment (clippy.toml lists the readers); `forbid` keeps an `allow` from
// putting one back. `forbid(unsafe_code)` closes the readers the list cannot
// name: a foreign `getenv` or any other FFI call needs `unsafe`. The rest of the
// Grant rule is ruling `eureka-body:ruling:mind-launch-forge-scanner-bound`.
#![forbid(clippy::disallowed_methods)]
#![forbid(unsafe_code)]
mod address;
pub mod chat_client;
#[allow(dead_code, reason = "the loader is kept for the three-stage turn's perception (map C3): its first caller removes this allow; `Image` is live through `self_run::session`")]
mod chat_image;
pub mod chat_rudp;
pub mod cli;
pub mod connector;
pub mod control;
pub mod heartbeat;
pub mod launch;
pub mod lease_client;
pub mod persona;
pub mod projection;
pub mod queue;
pub mod self_run;
pub mod tempo;
#[cfg(test)]
mod testkit;