From 947d8f7a40d4dbab713d775c2ac17976c620a363 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 05:34:11 +0100 Subject: [PATCH] Scoped privacy: only a bond or memory marked private is framed or left out; unmarked renders as written Self's decision: the blanket framing smothered relationship texture in public rooms. A bond or memory is private only when marked (`extensions.privacy = "private"`, or a memory's `private` tag); the schema is unchanged. A marked item renders as written in a direct message with the person it is about, is left out about someone present in any other room, and is framed "she knows privately" about someone absent. Unmarked items render as written everywhere. The Interpreter's rule about private knowledge stays. The convention is documented in the Persona State Standard (gamecult-ops `docs/persona-state-standard.md`, GameCult/gamecult-ops#129). Co-Authored-By: Claude Opus 5.5 --- .../src/projection/fixtures/golden-chat.txt | 6 +- crates/mind-body/src/projection/select.rs | 62 ++++++++++++++----- crates/mind-body/src/projection/tests.rs | 38 +++++++++--- 3 files changed, 79 insertions(+), 27 deletions(-) diff --git a/crates/mind-body/src/projection/fixtures/golden-chat.txt b/crates/mind-body/src/projection/fixtures/golden-chat.txt index 2f07796..b86387b 100644 --- a/crates/mind-body/src/projection/fixtures/golden-chat.txt +++ b/crates/mind-body/src/projection/fixtures/golden-chat.txt @@ -6,11 +6,11 @@ Eureka (she/her). Dry, direct, almost feral; zeal aimed at revealing. --- context - now: Thursday 19 November, 14:05 UTC - mood: lighter, more settled than middling -- bond [bond-kiko] Kiko — sparring partner: fair trust, heavy friction. She knows privately: Kiko pokes her to stop massaging the pipeline. -- bond [bond-libby] Libby — collaborator: fair trust, a little friction. She knows privately: Libby holds the sounds and teases her about the pipeline. +- 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]: she knows privately: Libby laughed at the door fix. +- memory [libby-sounds]: Libby laughed at the door fix. - memory [t1-m0]: The heartbeat stalled at noon. - memory [curse]: Her curse is the knife. The same drive makes her good and will lead her wrong. - need [need-relatedness]: company, strong diff --git a/crates/mind-body/src/projection/select.rs b/crates/mind-body/src/projection/select.rs index 6578a95..ca6b929 100644 --- a/crates/mind-body/src/projection/select.rs +++ b/crates/mind-body/src/projection/select.rs @@ -507,11 +507,11 @@ fn candidates(inputs: &Inputs, tuning: &Tuning, present: &BTreeSet, touc if body.is_empty() { continue; } - let person = text(memory, &["target", "id"]).to_lowercase(); - let about_someone = text(memory, &["target", "kind"]) == "person" && !person.is_empty(); - let body = match privately(inputs, &person) { - Some(forms) if about_someone => format!("{} knows privately: {body}", forms.subj), - _ => body, + let person = if text(memory, &["target", "kind"]) == "person" { text(memory, &["target", "id"]).to_lowercase() } else { String::new() }; + let body = match scope(inputs, memory, &person, present) { + Scope::Framed(forms) => format!("{} knows privately: {body}", forms.subj), + Scope::Omitted => continue, + Scope::Plain => body, }; let line = format!("- memory [{}]: {}", text(memory, &["id"]), clip(&one_line(&body), item_bytes)); let salience = number(memory, &["intensity"]).unwrap_or(SALIENCE_UNSTATED); @@ -845,7 +845,7 @@ fn present_people(inputs: &Inputs, tuning: &Tuning) -> Vec<(String, String)> { /// A bond line: the person, the kind of bond after a dash (a label may hold a comma: "Meta, the operator"), trust and /// friction as words when the bond carries them, and its summary. What the bond does not carry is left out. -fn bond_line(bond: &Value, name: &str, tuning: &Tuning, private: Option) -> String { +fn bond_line(bond: &Value, name: &str, tuning: &Tuning, scope: Scope) -> String { let feel: Vec<&str> = [number(bond, &["trust"]).map(trust_words), number(bond, &["tension"]).map(friction_words)].into_iter().flatten().collect(); let custom = text(bond, &["customRelationshipKind"]); let kind = clip(&one_line(if custom.is_empty() { text(bond, &["relationshipKind"]) } else { custom }), NAME_BYTES); @@ -854,8 +854,9 @@ fn bond_line(bond: &Value, name: &str, tuning: &Tuning, private: Option) let _ = write!(line, " \u{2014} {kind}"); } let summary = clip(&one_line(text(bond, &["summary"])), tuning.select.bond_summary_bytes); - let summary = match private { - Some(forms) if !summary.is_empty() => format!("{} knows privately: {summary}", forms.cap_subj), + let summary = match scope { + Scope::Framed(forms) if !summary.is_empty() => format!("{} knows privately: {summary}", forms.cap_subj), + Scope::Omitted => String::new(), _ => summary, }; match (feel.is_empty(), summary.is_empty()) { @@ -1060,13 +1061,42 @@ fn pronoun_line(inputs: &Inputs, tuning: &Tuning) -> Option { (!parts.is_empty()).then(|| clip(&format!("- pronouns: {}", parts.join("; ")), ALSO_HERE_BYTES)) } -/// Whether what she knows of `person` (a bond's or memory's id) is framed as known privately here: everywhere but a -/// direct message with that person. Structural, never a reading of the fact: whether a line fits its audience stays the -/// Interpreter's judgement. Her pronouns when it is. -fn privately(inputs: &Inputs, person: &str) -> Option { - let room = turn_room(inputs)?; - let partner = room_kind(inputs, room) == RoomKind::Direct && inputs.room.messages.iter().chain(&inputs.room.tail).any(|line| line.room == room && inputs.people.person_of(&line.sender) == person); - (!partner).then(|| forms(inputs.state)) +/// How a bond's or memory's content reaches the packet. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum Scope { + /// As it is: unmarked, or marked private in a direct message with the person it is about. + Plain, + /// "She knows privately: …": marked private, about someone who is not here. + Framed(Forms), + /// Left out: marked private, about someone present in a room that is not a direct message with them. Nothing private + /// about a person is hinted at to their face in public. + Omitted, +} + +/// Whether an item is marked private: `extensions.privacy` is "private" (a bond or a memory), or a memory's tags hold +/// "private". Unmarked is shared. The convention is the Persona State Standard's, read without a schema change. +fn marked_private(item: &Value) -> bool { + text(item, &["extensions", "privacy"]) == "private" || items(item, &["tags"]).iter().any(|tag| tag.as_str() == Some("private")) +} + +/// The scope of an item about `person` (a bond's or memory's id) here. Structural: whether a line fits its audience +/// stays the Interpreter's judgement. +fn scope(inputs: &Inputs, item: &Value, person: &str, present: &BTreeSet) -> Scope { + if !marked_private(item) || person.is_empty() { + return Scope::Plain; + } + let Some(room) = turn_room(inputs) else { + return Scope::Framed(forms(inputs.state)); + }; + let direct = room_kind(inputs, room) == RoomKind::Direct; + let with_them = direct && inputs.room.messages.iter().chain(&inputs.room.tail).any(|line| line.room == room && inputs.people.person_of(&line.sender) == person); + if with_them { + Scope::Plain + } else if present.contains(person) { + Scope::Omitted + } else { + Scope::Framed(forms(inputs.state)) + } } /// A part as a sentence: its first letter upper-cased, a full stop after it. @@ -1112,7 +1142,7 @@ pub(crate) fn select(inputs: &Inputs, tuning: &Tuning) -> Packet { for (id, name) in &present { match bonds.iter().find(|bond| live(bond) && text(bond, &["object", "id"]).to_lowercase() == *id) { Some(bond) if full < tuning.select.people_full => { - let line = bond_line(bond, name, tuning, privately(inputs, id)); + let line = bond_line(bond, name, tuning, scope(inputs, bond, id, &present_ids)); if used + line.len() < budget { full += 1; used += line.len() + 1; diff --git a/crates/mind-body/src/projection/tests.rs b/crates/mind-body/src/projection/tests.rs index c89b823..ad4ba2b 100644 --- a/crates/mind-body/src/projection/tests.rs +++ b/crates/mind-body/src/projection/tests.rs @@ -1413,12 +1413,34 @@ fn a_room_is_named_by_the_key_the_tail_carries_and_a_public_rooms_id_is_reported assert!(by_id["room"]["why"].as_str().unwrap().contains("named by its alias"), "{}", by_id["room"]); } -#[test] -fn what_she_knows_of_someone_is_known_privately_except_in_a_direct_message_with_them() { - let public = Room { messages: vec![message("#minds:gamecult.org", OPERATOR, "Meta", "how is everyone?", 2, false)], here: Some("#minds:gamecult.org".into()), ..Room::default() }; - let packet = packet_of(TurnKind::Chat, &state(), &public, &History::default(), 1); - assert!(packet.context.contains("She knows privately: The operator rules on what the work is for."), "{}", packet.context); - let dm = Room { messages: vec![message("!dm-meta:gamecult.org", OPERATOR, "Meta", "how are you?", 2, true)], here: Some("!dm-meta:gamecult.org".into()), direct: vec!["!dm-meta:gamecult.org".into()], ..Room::default() }; - let packet = packet_of(TurnKind::Chat, &state(), &dm, &History::default(), 1); - assert!(packet.context.contains("The operator rules on what the work is for.") && !packet.context.contains("knows privately: The operator"), "{}", packet.context); +/// The test state with Kiko's bond and the memory about Libby marked private, and the operator's bond not. +fn marked() -> Value { + let mut marked = state(); + marked["affect"]["socialBonds"][1]["extensions"] = json!({ "privacy": "private" }); + marked["thoughtMemory"]["memories"][1]["tags"] = json!(["private"]); + marked +} + +#[test] +fn a_private_marking_frames_a_fact_about_someone_absent_and_an_unmarked_one_renders_plainly() { + // Libby is not here; Kiko and the operator are not either: only Meta speaks in #minds. + let public = Room { messages: vec![message("#minds:gamecult.org", OPERATOR, "Meta", "how is everyone?", 2, false)], here: Some("#minds:gamecult.org".into()), ..Room::default() }; + let shown = |seed| packet_of(TurnKind::Chat, &marked(), &public, &History::default(), seed).context; + let memory = (1..=40).map(shown).find(|context| context.contains("[libby-sounds]")).expect("the memory about Libby is selected on some seed"); + assert!(memory.contains("- memory [libby-sounds]: she knows privately: Libby laughed at the door fix."), "{memory}"); + let context = shown(1); + assert!(context.contains("The operator rules on what the work is for.") && !context.contains("knows privately: The operator"), "an unmarked bond is plain: {context}"); +} + +#[test] +fn a_private_fact_about_someone_present_in_public_is_left_out_and_plain_in_a_direct_message_with_them() { + // Kiko is here, in #minds: her marked bond's summary is left out, and no hint of it remains. + let public = Room { messages: vec![message("#minds:gamecult.org", "@kiko:gamecult.org", "Kiko", "afternoon", 2, false)], here: Some("#minds:gamecult.org".into()), ..Room::default() }; + let packet = packet_of(TurnKind::Chat, &marked(), &public, &History::default(), 1); + let line = packet.context.lines().find(|line| line.starts_with("- bond [bond-kiko]")).unwrap_or_else(|| panic!("{}", packet.context)).to_owned(); + assert!(!line.contains("massaging the pipeline") && !line.contains("privately"), "{line}"); + // In a direct message with Kiko it is plain. + let dm = Room { messages: vec![message("!dm-kiko:gamecult.org", "@kiko:gamecult.org", "Kiko", "hey", 2, true)], here: Some("!dm-kiko:gamecult.org".into()), direct: vec!["!dm-kiko:gamecult.org".into()], ..Room::default() }; + let packet = packet_of(TurnKind::Chat, &marked(), &dm, &History::default(), 1); + assert!(packet.context.contains("Kiko pokes her to stop massaging the pipeline.") && !packet.context.contains("privately"), "{}", packet.context); }