Persona live organ: one-turn, drain, wake-humans-pace, turn memory (squash of hands/persona-live-drain) #83

Merged
eureka merged 287 commits from hands/persona-live-drain into main 2026-11-28 07:05:45 +00:00
7 changed files with 89 additions and 17 deletions
Showing only changes of commit d7c04b122c - Show all commits

K2: Huginn owns its Projector frame; Ghostlight's projector builder is no longer called (map 16.3)

narrate::PROJECTOR_FRAME keeps Ghostlight's honesty rules (render only what is
established, absence is unavailable, suspicion is uncertainty, no actions,
schemas, field names or world effects, the word budget), drops its ban on an
interior, 'no metaphor, no atmosphere', 'say only what changes the decision' and
'a thin moment gets a thin stream', and adds the first person, the present tense
and notes-as-material. projector_prompt builds the prompt itself in the map's
order; the ProjectorPrompt and build_projector_prompt import is gone. Test doubles
recognise the Projector by the frame, the golden fixture carries the whole
Projector prompt, and a test refuses any Ghostlight membrane marker in it.

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

View file

@ -23,8 +23,9 @@ publish.workspace = true
# two until the workspace pin and the kit's meet.
# `rmp-serde` is also the lease wire (`lease_client`): the connector's MessagePack frames.
#
# Ghostlight's `ghostlight-persona-projection`, pinned to a revision, builds the Projector's prompt (`projection`), so
# the membrane's text stays Ghostlight's; the Projector asks through the connector kit's client (`model-connector`).
# Ghostlight's `ghostlight-persona-projection`, pinned to a revision, builds the Persona stage's prompt and locates cited
# spans (`projection`), so that membrane's text stays Ghostlight's. The Projector's frame is Huginn's own (map section 16.3).
# Every stage asks through the connector kit's client (`model-connector`).
# `toml` reads `persona-tuning.toml`, the Projector's knobs (`projection::tuning`); parse and serde only.
#
# `serde_json` reads Claude Code's stream-json, a foreign owner's wire (`self_run`);

View file

@ -2,8 +2,8 @@
//!
//! Two stages. The Select stage (`select`) is code: it decides what she can feel this turn and renders it as a typed
//! projection packet, deterministic for a seed. The narration (`narrate`) is one tool-less model call through the
//! connector that renders the packet as first-person prose under Ghostlight's membrane (`build_projector_prompt`,
//! the pinned `ghostlight-persona-projection`). Every knob of both is `persona-tuning.toml` (`tuning`), read at each
//! connector that renders the packet as her first-person present under Huginn's own frame (`narrate::PROJECTOR_FRAME`,
//! map section 16.3; the Persona stage's membrane stays Ghostlight's). Every knob of both is `persona-tuning.toml` (`tuning`), read at each
//! wake, its hash carried with the packet.
//!
//! The Projector shows her self and her room: her persona state and what the mouth showed. It does not read her Mind;

View file

@ -23,3 +23,36 @@ Also in the room:
--- heard
Libby, in #swarm:gamecult.org: "Eureka, did you see the door fix?"
Kiko, in #swarm:gamecult.org: "She saw it. She hated it."
--- projector prompt
You are a private Projector. Write one person's present moment from inside it, in the first person and the present tense: the lived stream they will go on to continue in their own thought. Their interior is the point: what they feel, want, fear and remember, and how the people here sit with them, rendered as lived, not listed.
Render only what is established below: who they are, the notes on their present, and what reaches them. Anything absent from these is unavailable: render suspicion or speculation as uncertainty, never as remembered or perceived fact, and furnish no place, object or event the notes do not give. The notes were set down at another time, by others and by their own past self: they are material for the stream and never its wording. Do not choose actions, emit schemas, expose field names or ids, or claim world effects.
Guidance:
This person is a Mind of the GameCult swarm. She lives in its chat rooms among the operator, the other Minds and whoever drops by. Render the moment as she lives it: who is here and how they sit with her, what she carries, what she wants. What was said reaches her word for word after this stream, so never retell or summarise it: render what it stirs in her and what she makes of the people who said it. Render the conversation as it stands. Do not weigh options or list what she might do or say; what she does is hers to decide. Leave out whatever the context does not carry: an absence is not part of her moment. Use each person's pronouns as given.
Begin from something she still wants and has not got.
Who they are:
Eureka (she/her). Dry, direct, almost feral; zeal aimed at revealing.
Notes on their present:
- now: Thursday 19 November, 14:05 UTC
- mood: lighter, more settled than middling
- bond [bond-kiko] Kiko — sparring partner: fair trust, heavy friction. Kiko pokes her to stop massaging the pipeline.
- bond [bond-libby] Libby — collaborator: fair trust, a little friction. Libby holds the sounds and teases her about the pipeline.
- the conversation: Lately Libby with her; Kiko to the room. The last 2 lines are the Minds' alone.
- pronouns: Libby — she/her; Kiko — she/her
- memory [libby-sounds]: Libby laughed at the door fix.
- memory [dm-secret]: she knows privately: Deru told her about the move, privately.
- memory [curse]: Her curse is the knife. The same drive makes her good and will lead her wrong.
- need [need-relatedness]: company, strong
- value [reveal] Reveal: Reveal, never obscure.
What reaches them:
Said to her:
- Libby in #swarm:gamecult.org: "Eureka, did you see the door fix?"
Also in the room:
- Kiko in #swarm:gamecult.org: "She saw it. She hated it."
Use at most 150 words. Return only the lived stream.

View file

@ -6,7 +6,7 @@ use serde_json::{Value, json};
use super::*;
use crate::address::is_for;
use crate::projection::narrate::{Answer, Failed, Spent};
use crate::projection::narrate::{Answer, Failed, PROJECTOR_FRAME, Spent};
const HER: &str = "@eureka:gamecult.org";
@ -55,7 +55,7 @@ impl Model for Scripted {
self.calls.borrow_mut().push((model.to_owned(), prompt.to_owned()));
let text = if prompt.starts_with("You decide what one person says aloud") {
(self.interpreter)(prompt)
} else if prompt.starts_with("<!-- membrane:") {
} else if prompt.starts_with(PROJECTOR_FRAME) {
"The room is slow and so is he.".to_owned()
} else {
(self.persona)(prompt)

View file

@ -11,7 +11,7 @@ use std::time::Duration;
use anyhow::{Result, anyhow, bail};
use chrono::Utc;
use ghostlight_persona_projection::{PersonaPrompt, ProjectorPrompt, build_persona_prompt, build_projector_prompt};
use ghostlight_persona_projection::{PersonaPrompt, build_persona_prompt};
use model_connector::{ConnectorClient, InputItem, ProviderRequest, ReasoningEffort, StopReason, TransportDisposition, TransportEventPayload, TransportInvocation, TransportOutcome};
use serde::Serialize;
use sha2::{Digest, Sha256};
@ -69,7 +69,7 @@ pub struct Spent {
pub reasoning_tokens: Option<u64>,
}
/// What the connector's request asks of the model beside the user text. It names no membrane text: that is Ghostlight's.
/// What the connector's request asks of the model beside the user text. It names no frame: each stage's prompt carries its own.
pub(crate) const INSTRUCTIONS: &str = "Write only the text the request asks for.";
/// Room for the model's adaptive thinking; the narration itself is bounded by its word budget.
pub(crate) const MAX_OUTPUT_TOKENS: u32 = 1024;
@ -136,10 +136,29 @@ pub(crate) fn word_budget(kind: TurnKind, tuning: &Tuning) -> usize {
if kind == TurnKind::Beat { tuning.projector.beat_words } else { tuning.projector.words }
}
/// The Projector's prompt: Ghostlight's membrane over the packet, with the lens as where to begin.
/// The Projector's frame: Huginn's, not Ghostlight's (map section 16.3). Ghostlight's projector membrane forbids any
/// interior its world kernel did not assert; a Mind's interior is the point of her stream. Kept from it: render only what
/// the context and stimulus establish, an absence is unavailable and suspicion is uncertainty, never choose actions,
/// emit schemas, expose field names or claim world effects, and the word budget. Dropped: its ban on temperament, mood
/// and inner voice, "no metaphor, no atmosphere", "say only what changes the decision" and "a thin moment gets a thin
/// stream". Added: the first person and the present tense, and that the notes are material, never wording. A fix to
/// Ghostlight's membrane is read and ported here on purpose; nothing reaches this frame from it.
pub(crate) const PROJECTOR_FRAME: &str = "You are a private Projector. Write one person's present moment from inside it, in the first person and the present tense: the lived stream they will go on to continue in their own thought. Their interior is the point: what they feel, want, fear and remember, and how the people here sit with them, rendered as lived, not listed.
Render only what is established below: who they are, the notes on their present, and what reaches them. Anything absent from these is unavailable: render suspicion or speculation as uncertainty, never as remembered or perceived fact, and furnish no place, object or event the notes do not give. The notes were set down at another time, by others and by their own past self: they are material for the stream and never its wording. Do not choose actions, emit schemas, expose field names or ids, or claim world effects.";
/// The Projector's prompt, in this order: the frame, the tuning's guidance, the lens as where to begin, her identity,
/// the packet's notes, the stimulus and the word budget.
pub(crate) fn projector_prompt(packet: &Packet, tuning: &Tuning) -> String {
let guidance = format!("{}\n\nBegin from {}.", tuning.projector.guidance.trim(), packet.lens.words(&packet.forms));
build_projector_prompt(&ProjectorPrompt { identity: &packet.identity, typed_context: &packet.context, visible_stimulus: &packet.stimulus, domain_guidance: &guidance, word_budget: word_budget(packet.kind, tuning) })
format!(
"{PROJECTOR_FRAME}\n\nGuidance:\n{}\n\nBegin from {}.\n\nWho they are:\n{}\n\nNotes on their present:\n{}\n\nWhat reaches them:\n{}\n\nUse at most {} words. Return only the lived stream.",
tuning.projector.guidance.trim(),
packet.lens.words(&packet.forms),
packet.identity,
packet.context,
packet.stimulus,
word_budget(packet.kind, tuning),
)
}
/// A character that is a word on its own: Han, kana and Hangul are written without spaces, so each counts as one.

View file

@ -6,6 +6,7 @@ use serde_json::Value;
use super::*;
use crate::projection::harness::tests::{Scripted, control};
use serde_json::json;
use crate::projection::narrate::PROJECTOR_FRAME;
use crate::projection::{Answer, Failed, Model, Spent};
const TOBIAH: &str = "@eureka:gamecult.org";
@ -210,7 +211,7 @@ struct FailingPersona;
impl Model for FailingPersona {
fn ask(&self, _request_id: &str, model: &str, prompt: &str) -> std::result::Result<Answer, Failed> {
if prompt.starts_with("<!-- membrane:") {
if prompt.starts_with(PROJECTOR_FRAME) {
Ok(Answer { text: "The room is slow.".into(), usage: None })
} else {
Err(Failed { reason: "the provider failed the call: Overloaded".into(), usage: Some(Spent { model: model.into(), input_tokens: 5, output_tokens: 0, cache_read_tokens: 0, cache_write_tokens: 0, reasoning_tokens: None }) })

View file

@ -8,7 +8,7 @@ use anyhow::Result;
use chrono::{DateTime, Utc};
use serde_json::{Value, json};
use super::narrate::{INSTRUCTIONS, MAX_OUTPUT_TOKENS};
use super::narrate::{INSTRUCTIONS, MAX_OUTPUT_TOKENS, PROJECTOR_FRAME};
use super::select::{Lens, Overflow, Pool};
use super::tuning::Tuning;
use super::*;
@ -118,14 +118,15 @@ fn whole(packet: &Packet) -> String {
fn golden_chat_packet() {
let packet = packet_of(TurnKind::Chat, &state(), &chat_room(), &History::default(), 7);
let rendered = format!(
"lens: {:?}\nselected: {}\npresent: {}\n--- identity\n{}\n--- context\n{}\n--- stimulus\n{}\n--- heard\n{}\n",
"lens: {:?}\nselected: {}\npresent: {}\n--- identity\n{}\n--- context\n{}\n--- stimulus\n{}\n--- heard\n{}\n--- projector prompt\n{}\n",
packet.lens,
ids(&packet).join(", "),
packet.present.join(", "),
packet.identity,
packet.context,
packet.stimulus,
packet.heard
packet.heard,
narrate::projector_prompt(&packet, &Tuning::default()),
);
let golden = include_str!("fixtures/golden-chat.txt").replace("\r\n", "\n");
assert_eq!(rendered, golden, "the golden packet moved; if deliberately, the new one is:\n{rendered}");
@ -610,7 +611,7 @@ impl Recorded {
impl Model for Recorded {
fn ask(&self, request_id: &str, model: &str, prompt: &str) -> std::result::Result<Answer, Failed> {
self.calls.borrow_mut().push((request_id.to_owned(), model.to_owned(), prompt.to_owned()));
let text = if prompt.starts_with("<!-- membrane:") { (self.narration)(prompt) } else { (self.judge)(prompt) };
let text = if prompt.starts_with(PROJECTOR_FRAME) { (self.narration)(prompt) } else { (self.judge)(prompt) };
let usage = Spent { model: model.to_owned(), input_tokens: prompt.len() as u64, output_tokens: text.len() as u64, cache_read_tokens: 7, cache_write_tokens: 3, reasoning_tokens: None };
Ok(Answer { text, usage: Some(usage) })
}
@ -1215,7 +1216,7 @@ fn a_failed_call_keeps_the_report_and_its_usage() {
match self.0.get() {
3 => Err(Failed { reason: "the model's turn ended early: MaxOutputTokens".into(), usage }),
5 => Err(Failed { reason: "the connector did not answer".into(), usage: None }),
_ => Ok(Answer { text: if prompt.starts_with("<!-- membrane:") { "I am here. The room is quiet.".into() } else { "A".into() }, usage }),
_ => Ok(Answer { text: if prompt.starts_with(PROJECTOR_FRAME) { "I am here. The room is quiet.".into() } else { "A".into() }, usage }),
}
}
}
@ -1363,6 +1364,23 @@ fn every_person_the_packet_names_from_the_room_has_pronouns_and_an_unknown_one_i
assert!(!line.contains("Eureka"), "her own pronouns are in her identity, not here: {line}");
}
#[test]
fn the_projector_frame_is_huginns_lived_frame_and_carries_no_ghostlight_membrane() {
let packet = packet_of(TurnKind::Chat, &state(), &chat_room(), &History::default(), 1);
let prompt = narrate::projector_prompt(&packet, &Tuning::default());
assert!(prompt.starts_with(PROJECTOR_FRAME), "{prompt}");
assert!(!prompt.contains("membrane") && !prompt.contains(ghostlight_persona_projection::MEMBRANE_SCHEMA), "no Ghostlight projector membrane marker: {prompt}");
for dropped in ["no temperament", "No metaphor", "no atmosphere", "Say only what changes the decision", "thin stream"] {
assert!(!prompt.contains(dropped), "dropped from Ghostlight's frame (map 16.3): {dropped}");
}
for kept in ["in the first person and the present tense", "Render only what is established below", "never as remembered or perceived fact", "material for the stream and never its wording", "Do not choose actions, emit schemas, expose field names", "Use at most 150 words."] {
assert!(prompt.contains(kept), "{kept}");
}
let at = |part: &str| prompt.find(part).unwrap_or_else(|| panic!("{part} in {prompt}"));
let order = ["Guidance:\n", "Begin from ", "Who they are:\n", "Notes on their present:\n", "What reaches them:\n", "Use at most "];
assert!(order.windows(2).all(|pair| at(pair[0]) < at(pair[1])), "the frame, the guidance, the lens, the identity, the notes, the stimulus, the budget: {prompt}");
}
#[test]
fn the_projector_is_told_not_to_retell_not_to_offer_options_and_not_to_owe() {
let packet = packet_of(TurnKind::Chat, &state(), &chat_room(), &History::default(), 1);