From d4d7bc3c071dbb902dd18abb262882ad17d8c5c9 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 11 Sep 2026 03:04:02 +0200 Subject: [PATCH] Give a world its brief: authored once, guidance on every lane world_create.v3 carries a required brief, trimmed at ingress, stored on the state and its snapshot, and projected as the guidance of the Projector, Persona, Interpreter, operational, and grouped lanes and both authoring prompts. The two narrative stages that rebuild prompts on resume carry it (controller_work.v13). The smoke titles its world by the seed root label and hands its brief to the world rather than to each seed session, so a vow can no longer name a test fixture. Co-Authored-By: Claude Fable 5.1 --- crates/ghostlight-dungeon/src/eve.rs | 9 +-- crates/ghostlight-dungeon/src/runtime.rs | 66 ++++++++++++++----- .../src/world/controllers.rs | 48 +++++++++++--- .../src/world/elaboration.rs | 14 +++- .../ghostlight-dungeon/src/world/journal.rs | 9 +++ .../ghostlight-dungeon/src/world/mailbox.rs | 3 + crates/ghostlight-dungeon/src/world/mod.rs | 39 +++++++++++ .../architecture/ghostlight-world-ontology.md | 13 ++-- notes/fresh-workspace-handoff.md | 9 ++- notes/ghostlight-implementation-plan.md | 9 ++- notes/local-live-smoke.md | 4 +- state/map.yaml | 9 ++- 12 files changed, 185 insertions(+), 47 deletions(-) diff --git a/crates/ghostlight-dungeon/src/eve.rs b/crates/ghostlight-dungeon/src/eve.rs index 737ebd3..7f6ddd4 100644 --- a/crates/ghostlight-dungeon/src/eve.rs +++ b/crates/ghostlight-dungeon/src/eve.rs @@ -46,10 +46,11 @@ pub(crate) struct EveRouteHint { pub(crate) transport: Option, } -/// The `world_create.v2` payload, in one place, so the button that captures it +/// The `world_create.v3` payload, in one place, so the button that captures it /// and the descriptor that advertises it cannot drift. -const CREATE_BINDINGS: [&str; 6] = [ +const CREATE_BINDINGS: [&str; 7] = [ "title", + "brief", "subject_label", "narrative_persona_label", "operational_agent_label", @@ -310,7 +311,7 @@ pub(crate) fn authenticated_surface( ]); commands.push(command_descriptor( "world.create", - "ghostlight.world_create.v2", + "ghostlight.world_create.v3", &CREATE_BINDINGS, "WorldMailbox", )); @@ -612,7 +613,7 @@ pub(crate) fn operation_schema(operation: &str) -> Option<&'static str> { "heimdall.auth.begin" => "heimdall.auth_begin_command.v1", "heimdall.auth.complete" => "heimdall.auth_complete_command.v1", "app.auth.logout" => "ghostlight.app_logout.v2", - "world.create" => "ghostlight.world_create.v2", + "world.create" => "ghostlight.world_create.v3", "world.approve" => "ghostlight.world_approve.v0", "world.activate" => "ghostlight.world_activate.v0", "world.advance_time" => "ghostlight.world_advance_time.v0", diff --git a/crates/ghostlight-dungeon/src/runtime.rs b/crates/ghostlight-dungeon/src/runtime.rs index 46e9ccb..bbefa29 100644 --- a/crates/ghostlight-dungeon/src/runtime.rs +++ b/crates/ghostlight-dungeon/src/runtime.rs @@ -143,6 +143,10 @@ struct ProductionAdmission { #[serde(deny_unknown_fields)] struct CreatePayload { title: String, + /// The world's premise in the owner's words, projected to every lane as + /// guidance. Required, may be empty; a payload that omits it is refused, + /// which is what `world_create.v3` means. + brief: String, subject_label: String, #[serde(default)] narrative_persona_label: Option, @@ -151,7 +155,7 @@ struct CreatePayload { /// World-wide target of goal-bearing subjects per kind. Required, and may /// be empty: a world with no target is a deliberate choice, not a default /// that arrives because nobody said anything. A payload that omits it is - /// refused, which is what `world_create.v2` means. + /// refused, which is what `world_create.v3` means. targets: BTreeMap, /// The jurisdiction roots, declared by genesis beside the commons because /// `resolve_patch` only resolves roots the same patch declares. A duplicate @@ -1435,6 +1439,7 @@ async fn execute_world( CreateWorldIntent { id: command_id, title: payload.title, + brief: payload.brief, human_subject_label: payload.subject_label, narrative_persona_label: payload.narrative_persona_label, operational_agent_label: payload.operational_agent_label, @@ -2827,10 +2832,11 @@ mod tests { &fixture.cookie, invocation( "world.create", - "ghostlight.world_create.v2", + "ghostlight.world_create.v3", 0, json!({ "title":"Cutover World", + "brief":"", "subject_label":"Operator", "targets":{}, "jurisdictions":[] @@ -2907,10 +2913,11 @@ mod tests { let id = uuid::Uuid::new_v4().to_string(); let command = invocation( "world.create", - "ghostlight.world_create.v2", + "ghostlight.world_create.v3", 0, json!({ "title":"Retry World", + "brief":"", "subject_label":"Operator", "targets":{}, "jurisdictions":[] @@ -3048,6 +3055,27 @@ mod tests { targets: BTreeMap, jurisdictions: Vec, activate: bool, + ) { + titled_two_cell_world( + state, + cookie, + "Cover Tick Fixture", + "", + targets, + jurisdictions, + activate, + ) + .await; + } + + async fn titled_two_cell_world( + state: &AppState, + cookie: &str, + title: &str, + brief: &str, + targets: BTreeMap, + jurisdictions: Vec, + activate: bool, ) { let principal = state .sessions @@ -3061,7 +3089,8 @@ mod tests { .create( CreateWorldIntent { id: CommandId::new(), - title: "Cover Tick Fixture".into(), + title: title.into(), + brief: brief.into(), human_subject_label: "Operator".into(), narrative_persona_label: Some("Persona".into()), operational_agent_label: Some("Operational Agent".into()), @@ -3656,20 +3685,24 @@ mod tests { let seed_sessions: usize = env("GHOSTLIGHT_SMOKE_SEED_SESSIONS").parse().unwrap(); let seed_target: u32 = env("GHOSTLIGHT_SMOKE_SEED_TARGET").parse().unwrap(); let vault_scope = std::env::var("GHOSTLIGHT_SMOKE_VAULT_SCOPE").unwrap_or_default(); - let brief = std::env::var("GHOSTLIGHT_SMOKE_SEED_BRIEF").ok(); + let brief = std::env::var("GHOSTLIGHT_SMOKE_SEED_BRIEF").unwrap_or_default(); + let root_label = env("GHOSTLIGHT_SMOKE_SEED_ROOT_LABEL"); + let title = std::env::var("GHOSTLIGHT_SMOKE_WORLD_TITLE").unwrap_or_else(|_| root_label.clone()); // Read here rather than only inside `seed_once`, so a misconfigured run // fails at the top instead of after the first paid session. let _ = env(SEED_VAULT_ROOT_ENVIRONMENT); let fixture = fixture_with(Some(live)).await; let state = &fixture.state; - two_cell_world( + titled_two_cell_world( state, &fixture.cookie, + &title, + &brief, BTreeMap::from([(SubjectKind::Person, seed_target)]), vec![CreateJurisdictionIntent { handle: "seed_root".into(), - label: env("GHOSTLIGHT_SMOKE_SEED_ROOT_LABEL"), + label: root_label, permille: 1000, }], false, @@ -3703,9 +3736,10 @@ mod tests { state, &principal, &before, + // The brief is the world's now; the session adds nothing. SeedPayload { vault_scope: vault_scope.clone(), - brief: brief.clone(), + brief: None, }, ) .await; @@ -3857,21 +3891,21 @@ mod tests { // ---- The seed command ------------------------------------------------ - /// Spec test 1. `world_create.v1` is not kept alive beside v2: an + /// Spec test 1. `world_create.v2` is not kept alive beside v3: an /// invocation announcing it dies at validation before any handler runs, and - /// a payload that announces v2 but omits the scale target is a payload - /// error rather than a defaulted empty intent. Neither creates a world. + /// a payload that announces v3 but omits the brief or the scale target is a + /// payload error rather than a defaulted intent. Neither creates a world. #[tokio::test] - async fn a_v1_create_payload_is_refused() { + async fn a_stale_create_payload_is_refused() { let fixture = fixture().await; let stale = post( &fixture.state, &fixture.cookie, invocation( "world.create", - "ghostlight.world_create.v1", + "ghostlight.world_create.v2", 0, - json!({"title":"Stale World","subject_label":"Operator"}), + json!({"title":"Stale World","subject_label":"Operator","targets":{},"jurisdictions":[]}), &uuid::Uuid::new_v4().to_string(), ), ) @@ -3884,9 +3918,9 @@ mod tests { &fixture.cookie, invocation( "world.create", - "ghostlight.world_create.v2", + "ghostlight.world_create.v3", 0, - json!({"title":"Half World","subject_label":"Operator"}), + json!({"title":"Half World","subject_label":"Operator","targets":{},"jurisdictions":[]}), &uuid::Uuid::new_v4().to_string(), ), ) diff --git a/crates/ghostlight-dungeon/src/world/controllers.rs b/crates/ghostlight-dungeon/src/world/controllers.rs index c4186de..16a1af6 100644 --- a/crates/ghostlight-dungeon/src/world/controllers.rs +++ b/crates/ghostlight-dungeon/src/world/controllers.rs @@ -72,8 +72,8 @@ pub(super) const CELL_TOOL_STEP_BUDGET: usize = 2; /// carried by tool identity, never by a model-written argument. const HANDLE_SEPARATOR: &str = "__"; const PERSONA_WORD_BUDGET: usize = 180; -const CONTROLLER_WORK_ROW: &str = "controller_work.v12"; -const CONTROLLER_WORK_SCHEMA: &str = "ghostlight.controller_work.v12"; +const CONTROLLER_WORK_ROW: &str = "controller_work.v13"; +const CONTROLLER_WORK_SCHEMA: &str = "ghostlight.controller_work.v13"; /// The Interpreter's byte-span capture tool. It is not the generated `speak` /// affordance tool: one captures an utterance out of preserved prose, the other @@ -673,6 +673,9 @@ enum NarrativeCheckpoint { command_id: CommandId, identity: String, typed_view: String, + /// The world's brief, carried so a resumed stage rebuilds the same + /// prompt from the row alone. + guidance: String, /// The acting subject's own components at turn time, frozen for the /// life of the row exactly as `opportunity` is. Not a cache of the /// digest: it is the only copy of a value the digest hashes and @@ -691,6 +694,7 @@ enum NarrativeCheckpoint { command_id: CommandId, identity: String, typed_view: String, + guidance: String, components: ScopeComponents, interpreter_model: String, opportunity: DecisionOpportunity, @@ -859,6 +863,7 @@ impl NarrativeCheckpoint { command_id, identity, typed_view, + guidance: _, components: _, persona_model, interpreter_model, @@ -886,6 +891,7 @@ impl NarrativeCheckpoint { command_id, identity, typed_view, + guidance, components: _, interpreter_model, opportunity, @@ -902,7 +908,7 @@ impl NarrativeCheckpoint { let prompt = build_persona_prompt(&PersonaPrompt { identity, lived_stream: &lived_stream, - domain_guidance: "", + domain_guidance: guidance, word_budget: PERSONA_WORD_BUDGET, }); base_checkpoint_is_valid( @@ -1847,6 +1853,7 @@ fn valid_narrative_progression(existing: &NarrativeCheckpoint, next: &NarrativeC command_id, identity, typed_view, + guidance, components, persona_model, interpreter_model, @@ -1858,6 +1865,7 @@ fn valid_narrative_progression(existing: &NarrativeCheckpoint, next: &NarrativeC command_id: next_command_id, identity: next_identity, typed_view: next_typed_view, + guidance: next_guidance, components: next_components, interpreter_model: next_interpreter_model, opportunity: next_opportunity, @@ -1869,6 +1877,7 @@ fn valid_narrative_progression(existing: &NarrativeCheckpoint, next: &NarrativeC command_id == next_command_id && identity == next_identity && typed_view == next_typed_view + && guidance == next_guidance && components == next_components && interpreter_model == next_interpreter_model && opportunity == next_opportunity @@ -1882,6 +1891,7 @@ fn valid_narrative_progression(existing: &NarrativeCheckpoint, next: &NarrativeC command_id, identity, typed_view, + guidance, components, interpreter_model, opportunity, @@ -1913,7 +1923,7 @@ fn valid_narrative_progression(existing: &NarrativeCheckpoint, next: &NarrativeC lived_stream: &lived_stream, persona_output: turn.source_prose(), output_schema: None, - domain_guidance: "", + domain_guidance: guidance, }); command_id == next_command_id && components == next_components @@ -2720,17 +2730,19 @@ impl ControllerRunner { let typed_view = selected.typed_view()?; let projector_context = selected.projector_context()?; let visible_stimulus = selected.visible_stimulus()?; + let guidance = selected.snapshot.brief.clone(); let projector_prompt = build_projector_prompt(&ProjectorPrompt { identity: &identity, typed_context: &projector_context, visible_stimulus: &visible_stimulus, - domain_guidance: "", + domain_guidance: &guidance, word_budget: PERSONA_WORD_BUDGET, }); let checkpoint = NarrativeCheckpoint::Projector { command_id, identity, typed_view, + guidance, components: selected.subject.components.clone(), persona_model: self.models.persona.clone(), interpreter_model: self.models.interpreter.clone(), @@ -2811,7 +2823,7 @@ impl ControllerRunner { typed_view: &typed_view, available_tools: &catalog_signatures("", &selected.granted), decision_pressure: "Choose whether this decision owner should speak now.", - domain_guidance: "", + domain_guidance: &selected.snapshot.brief, step_budget: TOOL_STEP_BUDGET, }); let initial_conversation = @@ -3115,7 +3127,9 @@ impl ControllerRunner { let agent_prompt = build_grouped_agent_prompt(&GroupedAgentPrompt { views: &labeled, decision_pressure: "Choose whether each decision owner should act now.", - domain_guidance: "", + domain_guidance: selected + .first() + .map_or("", |first| first.snapshot.brief.as_str()), step_budget: CELL_TOOL_STEP_BUDGET, }); let initial_conversation = match evaluate_grouped_loop(&agent_prompt, &constituents, &[])? { @@ -3432,6 +3446,7 @@ impl ControllerRunner { command_id, identity, typed_view, + guidance, components, persona_model, interpreter_model, @@ -3464,13 +3479,14 @@ impl ControllerRunner { let persona_prompt = build_persona_prompt(&PersonaPrompt { identity: &identity, lived_stream: &lived_stream, - domain_guidance: "", + domain_guidance: &guidance, word_budget: PERSONA_WORD_BUDGET, }); let next = NarrativeCheckpoint::Persona { command_id, identity, typed_view, + guidance, components, interpreter_model, opportunity, @@ -3504,6 +3520,7 @@ impl ControllerRunner { command_id, identity, typed_view, + guidance, components, interpreter_model, opportunity, @@ -3549,7 +3566,7 @@ impl ControllerRunner { lived_stream: &lived_stream, persona_output: turn.source_prose(), output_schema: None, - domain_guidance: "", + domain_guidance: &guidance, }); let initial_conversation = match evaluate_interpreter_loop(&turn, &interpreter_prompt, &[])? { @@ -6521,6 +6538,7 @@ mod tests { phase: WorldPhase::Active, owner: PrincipalId::new("projector-fixture-owner"), title: "The Rain Gate".into(), + brief: String::new(), draft_approvals: BTreeSet::new(), required_approvers: BTreeSet::new(), subjects: vec![actor.clone(), speaker], @@ -6771,6 +6789,7 @@ mod tests { affordances: vec![speak_snapshot(opportunity.affordance_ids[0])], owner: PrincipalId::new("scope-fixture-owner"), title: "Kharad".into(), + brief: String::new(), draft_approvals: BTreeSet::new(), required_approvers: BTreeSet::new(), subjects: vec![actor.clone(), other], @@ -7264,6 +7283,7 @@ mod tests { phase: WorldPhase::Active, owner: PrincipalId::new("projector-fixture-owner"), title: "Low Sere".into(), + brief: String::new(), draft_approvals: BTreeSet::new(), required_approvers: BTreeSet::new(), subjects: vec![actor.clone(), creditor, bystander], @@ -8180,6 +8200,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Controller Fixture".into(), + brief: String::new(), patch: WorldPatch { declarations: vec![ Declaration::Entity(EntityDeclaration { @@ -8774,6 +8795,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Midnight Roll Call".into(), + brief: String::new(), patch: WorldPatch { declarations: vec![ Declaration::Subject(SubjectDeclaration { @@ -9175,6 +9197,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Elaboration Fixture".into(), + brief: String::new(), patch: WorldPatch { declarations: vec![ Declaration::Entity(EntityDeclaration { @@ -9464,6 +9487,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Cover Fixture".into(), + brief: String::new(), patch: WorldPatch { declarations, operations: Vec::new(), @@ -10010,6 +10034,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Apart Fixture".into(), + brief: String::new(), patch: WorldPatch { declarations, operations: Vec::new(), @@ -10454,6 +10479,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Seed Fixture".into(), + brief: String::new(), patch: WorldPatch { declarations: vec![ Declaration::Entity(EntityDeclaration { @@ -11204,6 +11230,7 @@ mod tests { CreateWorldIntent { id: CommandId::new(), title: "The Whole Road".into(), + brief: String::new(), human_subject_label: "The Owner".into(), narrative_persona_label: None, operational_agent_label: None, @@ -11364,6 +11391,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Two Roots".into(), + brief: String::new(), patch: WorldPatch { declarations: std::iter::once(Declaration::Entity(EntityDeclaration { handle: DraftHandle::new("commons"), @@ -12789,6 +12817,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Witness Fixture".into(), + brief: String::new(), patch: WorldPatch { declarations, // Genesis is Draft phase, exempt from the post-genesis @@ -13287,6 +13316,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Interruption Fixture".into(), + brief: String::new(), patch: WorldPatch { declarations: vec![ place("commons", "The Commons", None), diff --git a/crates/ghostlight-dungeon/src/world/elaboration.rs b/crates/ghostlight-dungeon/src/world/elaboration.rs index 0689413..ab37bac 100644 --- a/crates/ghostlight-dungeon/src/world/elaboration.rs +++ b/crates/ghostlight-dungeon/src/world/elaboration.rs @@ -792,6 +792,7 @@ fn build_prompt( let mut prompt = String::new(); prompt.push_str("You are elaborating one jurisdiction of a world.\n\n"); prompt.push_str(&format!("World: {}\n", snapshot.title)); + prompt.push_str(&render_brief(snapshot)); prompt.push_str(&format!( "Jurisdiction: {}\n", render_jurisdiction(snapshot, session.jurisdiction) @@ -844,6 +845,16 @@ fn render_refusal(mismatches: &[Mismatch]) -> String { text } +/// The world's own premise, when it has one. The seed session's optional +/// sentence rides beside it; the two are not the same thing. +fn render_brief(snapshot: &WorldSnapshot) -> String { + if snapshot.brief.is_empty() { + String::new() + } else { + format!("Brief: {}\n", snapshot.brief) + } +} + /// The clock reading every `due` is measured against. On the first SDK road /// run the model wrote twelve commitments due at or before a clock it was /// never shown, and the kernel refused all twelve. @@ -1874,6 +1885,7 @@ fn build_seed_prompt( let mut prompt = String::new(); prompt.push_str("You are seeding a world before it opens. Nothing here is running yet.\n\n"); prompt.push_str(&format!("World: {}\n", snapshot.title)); + prompt.push_str(&render_brief(snapshot)); prompt.push_str(&format!( "Jurisdiction: {}\n", render_jurisdiction(snapshot, session.jurisdiction) @@ -1902,7 +1914,7 @@ fn build_seed_prompt( } prompt.push_str(&render_clock(snapshot)); prompt.push_str( - "\nA subject qualifies only when it has a controller, at least one affordance grant, and holds a goal commitment. Declare people, institutions, and populations who want something; give each a controller, grants, a position, and a goal. Give them the rest of a life: routines and obligations that recur, counterparties, channels they speak on and who controls them, authority and the offices that lend it, holdings and the dependencies those holdings serve, routes between the places they move through. A subject with no counterparty who can command or litigate its goal leaves a boundary for the elaborator; that is allowed and expected, not an error.\nEvery promise states what is promised, in the promisor's own words. Every person carries material (set_persona_material): a voice, two or three values, a few memories, and a read of each counterparty, all distinct from every other person's; without it the person has no inner life to speak from.\nYou may not declare a human-controlled subject: only the world's first person is human, and that was genesis.\n\n", + "\nA subject qualifies only when it has a controller, at least one affordance grant, and holds a goal commitment. Declare people, institutions, and populations who want something; give each a controller, grants, a position, and a goal. Give them the rest of a life: routines and obligations that recur, counterparties, channels they speak on and who controls them, authority and the offices that lend it, holdings and the dependencies those holdings serve, routes between the places they move through. A goal that nobody can hold the subject to is allowed and expected; the world's elaborator answers that gap later, so do not write it into a promise.\nEvery promise states what is promised, in the promisor's own words. Every person carries material (set_persona_material): a voice, two or three values, a few memories, and a read of each counterparty, all distinct from every other person's; without it the person has no inner life to speak from.\nYou may not declare a human-controlled subject: only the world's first person is human, and that was genesis.\n\n", ); prompt.push_str(&render_world_structure(snapshot)); prompt.push('\n'); diff --git a/crates/ghostlight-dungeon/src/world/journal.rs b/crates/ghostlight-dungeon/src/world/journal.rs index cedcf8e..70992df 100644 --- a/crates/ghostlight-dungeon/src/world/journal.rs +++ b/crates/ghostlight-dungeon/src/world/journal.rs @@ -478,6 +478,12 @@ pub(super) fn verify_state_shape(state: &WorldState) -> Result<(), JournalError> "world title is empty or noncanonical".into(), )); } + if state.brief.trim() != state.brief { + return Err(JournalError::Corrupt("world brief is noncanonical".into())); + } + if state.brief.trim() != state.brief { + return Err(JournalError::Corrupt("world brief is noncanonical".into())); + } super::validate_principal(&state.owner).map_err(kernel_error)?; if state.subjects.is_empty() || state.controller_assignments.len() != state.subjects.len() @@ -1048,6 +1054,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Before".into(), + brief: String::new(), patch: owner_patch(SubjectDeclaration { handle: DraftHandle::new("owner"), label: "Owner".into(), @@ -1129,6 +1136,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Kharad".into(), + brief: String::new(), patch: owner_patch(SubjectDeclaration { handle: DraftHandle::new("owner"), label: "Owner".into(), @@ -1478,6 +1486,7 @@ mod tests { id: creation_id, owner: owner.clone(), title: "Admitted".into(), + brief: String::new(), patch: owner_patch(SubjectDeclaration { handle: DraftHandle::new("owner"), label: "Owner".into(), diff --git a/crates/ghostlight-dungeon/src/world/mailbox.rs b/crates/ghostlight-dungeon/src/world/mailbox.rs index 02e7c28..82f42f6 100644 --- a/crates/ghostlight-dungeon/src/world/mailbox.rs +++ b/crates/ghostlight-dungeon/src/world/mailbox.rs @@ -181,6 +181,7 @@ impl WorldMailbox { id: input.id, owner: principal_id.clone(), title: input.title, + brief: input.brief, patch: WorldPatch { declarations, operations: Vec::new(), @@ -935,6 +936,7 @@ mod tests { id, owner: PrincipalId::new("owner"), title: title.into(), + brief: String::new(), patch: WorldPatch { declarations: vec![ Declaration::Entity(EntityDeclaration { @@ -1355,6 +1357,7 @@ mod tests { id: CommandId::new(), owner: owner.clone(), title: "Soul Stamping".into(), + brief: String::new(), patch: WorldPatch { declarations: vec![ room("witness"), diff --git a/crates/ghostlight-dungeon/src/world/mod.rs b/crates/ghostlight-dungeon/src/world/mod.rs index 7d0176d..293b5f7 100644 --- a/crates/ghostlight-dungeon/src/world/mod.rs +++ b/crates/ghostlight-dungeon/src/world/mod.rs @@ -307,6 +307,9 @@ struct CreateWorld { id: CommandId, owner: PrincipalId, title: String, + /// The world's authored premise, in the owner's words. Every lane reads it + /// as its guidance; nothing derives it and nothing writes it later. + brief: String, patch: WorldPatch, /// Authored once, here, and never mutated: `CommandBody::AdmitPatch` carries /// no intent, so write-once is the command shape rather than a check. @@ -319,6 +322,9 @@ struct CreateWorld { pub(crate) struct CreateWorldIntent { pub(crate) id: CommandId, pub(crate) title: String, + /// The premise, verbatim from the owner. May be empty: a world with no + /// brief is a deliberate choice, and its lanes then get no guidance. + pub(crate) brief: String, pub(crate) human_subject_label: String, pub(crate) narrative_persona_label: Option, pub(crate) operational_agent_label: Option, @@ -705,6 +711,9 @@ struct WorldState { phase: WorldPhase, owner: PrincipalId, title: String, + /// Authored at creation and never mutated; the one prose the world says + /// about itself, projected as guidance to every lane. + brief: String, draft_approvals: BTreeSet, subjects: BTreeMap, entities: BTreeMap, @@ -779,6 +788,7 @@ enum WorldEffect { WorldCreated { owner: PrincipalId, title: String, + brief: String, resolved: ResolvedPatch, }, PatchAdmitted { @@ -1008,6 +1018,7 @@ pub(crate) struct WorldSnapshot { pub(crate) phase: WorldPhase, pub(crate) owner: PrincipalId, pub(crate) title: String, + pub(crate) brief: String, pub(crate) draft_approvals: BTreeSet, pub(crate) required_approvers: BTreeSet, pub(crate) subjects: Vec, @@ -1205,6 +1216,7 @@ struct PreparedCreation { world_id: WorldId, owner: PrincipalId, title: String, + brief: String, resolved: ResolvedPatch, } @@ -1220,6 +1232,7 @@ fn prepare_creation( return Err(KernelError::AuthenticationMismatch); } let title = normalize_title(&input.title)?; + let brief = input.brief.trim().to_owned(); // The world's own identity is not world structure, and it feeds every // derived ID, so it is minted before resolution rather than by it. let world_id = WorldId::issue(); @@ -1234,6 +1247,7 @@ fn prepare_creation( world_id, owner: input.owner.clone(), title, + brief, resolved, command: input, }) @@ -1248,6 +1262,7 @@ impl WorldKernel { let effect = WorldEffect::WorldCreated { owner: prepared.owner, title: prepared.title, + brief: prepared.brief, resolved: prepared.resolved, }; let mut state = WorldState::genesis(world_id, &prepared.command, &effect)?; @@ -1657,6 +1672,7 @@ impl WorldState { phase: WorldPhase::Draft, owner, title, + brief: String::new(), draft_approvals: BTreeSet::new(), subjects: BTreeMap::new(), entities: BTreeMap::new(), @@ -1693,6 +1709,7 @@ impl WorldState { let WorldEffect::WorldCreated { owner, title, + brief, resolved, } = effect else { @@ -1711,6 +1728,7 @@ impl WorldState { // every other command. Deterministic allocation is what lets one // equality replace a field-by-field binding zip. let mut state = Self::empty(world_id, owner.clone(), title.clone()); + state.brief = brief.clone(); let expected = patch::resolve_patch( &state, command.id, @@ -3565,6 +3583,7 @@ fn snapshot(state: &WorldState) -> Result { phase: state.phase, owner: state.owner.clone(), title: state.title.clone(), + brief: state.brief.clone(), draft_approvals: state.draft_approvals.clone(), required_approvers: required_approvers(state), subjects, @@ -4864,6 +4883,7 @@ mod tests { id, owner: owner(), title: title.into(), + brief: String::new(), patch: WorldPatch { operations: Vec::new(), evidence: Vec::new(), @@ -11721,6 +11741,25 @@ mod witness_tests { ); } + /// The brief is the world's authored premise: trimmed at ingress, carried + /// on the state and its snapshot, and identical after replay. + #[test] + fn the_world_brief_is_authored_once_trimmed_and_replayed() { + let directory = tempfile::tempdir().unwrap(); + let path = directory.path().join("world.cc"); + let mut creation = creation(CommandId::new(), "Low Sere"); + creation.brief = " A dry basin town that owes its water to the gate above it. ".into(); + let (kernel, _) = WorldKernel::create(&path, creation, &auth_principal(owner())).unwrap(); + let created = kernel.snapshot().unwrap(); + assert_eq!( + created.brief, + "A dry basin town that owes its water to the gate above it." + ); + drop(kernel); + let reopened = WorldKernel::open(&path, created.world_id).unwrap(); + assert_eq!(reopened.snapshot().unwrap(), created); + } + /// Persona material is set whole, refused when any text is non-canonical /// or a read names a subject twice, refused when identical to what the /// subject holds, and outside the scope digest: setting it moves no diff --git a/docs/architecture/ghostlight-world-ontology.md b/docs/architecture/ghostlight-world-ontology.md index 1a73117..ce85424 100644 --- a/docs/architecture/ghostlight-world-ontology.md +++ b/docs/architecture/ghostlight-world-ontology.md @@ -242,10 +242,13 @@ travels over two wire schema constants, `CONSUMER_PATCH_SCHEMA` and is refused, not migrated. `WorldScaleIntent` now arrives at creation, not as a later admission: -`world_create.v2` declares targets and jurisdiction roots top-level in the -genesis patch beside `commons`; a v1-announcing invocation is refused before -any handler runs, and the intent is write-once, set once at genesis and -resolved nowhere else. `qualifies` is phase-free — a controller, a non-empty +`world_create.v3` declares the title, the brief, targets, and jurisdiction +roots top-level in the genesis patch beside `commons`; an invocation +announcing an earlier schema is refused before any handler runs, and the +intent is write-once, set once at genesis and resolved nowhere else. The +brief is the world's authored premise, trimmed at ingress and never +mutated; every lane reads it as its guidance, and a world with an empty +brief gives its lanes none. `qualifies` is phase-free — a controller, a non-empty grant set, and a held `Goal`, checked the same way in Draft and Active — and the Draft-answer refusal lives only in `require_answer`, which refuses every Draft answer regardless of what `qualifies` says; so a Draft world's deficit @@ -287,7 +290,7 @@ knowledge row, and never another subject's snapshot. The re-lowering's provider request is a distinct round (`interpreter_round`) with its own content-addressed request id, so it cannot collide with the first lowering's request. State schema is `ghostlight.world_state.consumer.v3`, commit schema -`ghostlight.world_commit.consumer.v3`, controller work `controller_work.v12`, +`ghostlight.world_commit.consumer.v3`, controller work `controller_work.v13`, Persona turn receipt `ghostlight.persona_turn_receipt.v3`; earlier stores and earlier rows are refused. Ghostlight owns a conserved narrative ledger; Delvehold owns the economy (`delvehold-forced-ontology-integration.md`). diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 2351a3b..4643df1 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -252,11 +252,10 @@ unplaced; retire it or place its subjects. ### In order -1. The world title and brief as authored world facts (`world_create.v3`): the - smoke still titles its world "Cover Tick Fixture", the guidance slot is - empty on every lane, and run 8 put the fixture's name into a vow. Then a - longer SDK run that shows the first live interrupted cell, with the log - line the runbook's "Interrupted cell" section names. +1. A longer SDK run that shows the first live interrupted cell, with the + log line the runbook's "Interrupted cell" section names. The world brief + (`world_create.v3`, plan step 13) is landed, so the run's people have a + world named and described to them. 2. The outbound half of the consumer contract: the response batch with a non-loopback CultMesh lease. 3. The deployment gate below. diff --git a/notes/ghostlight-implementation-plan.md b/notes/ghostlight-implementation-plan.md index 331a3f7..66806be 100644 --- a/notes/ghostlight-implementation-plan.md +++ b/notes/ghostlight-implementation-plan.md @@ -657,7 +657,14 @@ by label, each promise's statement, and `present`, the labels of the subjects standing in the same place; the Persona's "Who you are" is the label, the voice, and the values; the typed view carries material and statements by id. Material is not in `ScopeComponents`, pinned by a test that sets it and -watches the scope digest stay. The map that led here follows. Objective: a seeded person speaks from authored +watches the scope digest stay. The map that led here follows. Objective: +(Step 13, the world brief, landed the same day: `world_create.v3` carries a +required `brief`, trimmed at ingress, stored on `WorldState`, projected as +the guidance of every lane and printed in both authoring prompts; the two +narrative stages that rebuild prompts on resume carry it as `guidance`, +`controller_work.v13`. The smoke titles its world by the seed root label +unless `GHOSTLIGHT_SMOKE_WORLD_TITLE` says otherwise, and the seed brief +becomes the world's brief rather than a per-session sentence.) a seeded person speaks from authored meaning rather than the model's default voice, which is the hard boundary "character intelligence is modeled state, not a default model capability". diff --git a/notes/local-live-smoke.md b/notes/local-live-smoke.md index 092bb7f..179b679 100644 --- a/notes/local-live-smoke.md +++ b/notes/local-live-smoke.md @@ -66,7 +66,9 @@ cargo test -p ghostlight-dungeon --bin ghostlight-dungeon live_smoke_seeds_then_ `GHOSTLIGHT_SEED_VAULT_ROOT` is required; the runner refuses to seed with it unset. `GHOSTLIGHT_SMOKE_VAULT_SCOPE` and `GHOSTLIGHT_SMOKE_SEED_BRIEF` are -optional. The scope is a directory under the root; Kalsa's spoiler split is +optional; the brief is the world's brief, set at creation and projected to +every lane as guidance, and the world is titled by the seed root label unless +`GHOSTLIGHT_SMOKE_WORLD_TITLE` names it. The scope is a directory under the root; Kalsa's spoiler split is that scope, so a world that must not see `Spoilers` is seeded from `Public`. The root label must name a place the Vault knows; Low Sere has a Public note. The caller runtime id must equal the one the connector config admits. diff --git a/state/map.yaml b/state/map.yaml index 129a7b2..ab78eeb 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -374,11 +374,10 @@ current_status: ledger and its archive, and the docs; do not rebuild them here or in the handoff, and plan step 12 (PersonaMaterial, commitment statements, co-presence; run 8 is the first run whose people speak in - their own voices). Next, in the operator's order: (a) the world title - and brief as authored world facts (world_create.v3; the smoke's world is - still "Cover Tick Fixture" and run 8 put that name into a vow), then the - longer SDK run that shows the first live interrupted cell and its log - line (runbook "Interrupted cell"); + their own voices) and step 13 (the world brief, world_create.v3, + guidance on every lane). Next, in the operator's order: (a) the longer + SDK run that shows the first live interrupted cell and its log line + (runbook "Interrupted cell"); (b) the outbound consumer response batch with a non-loopback CultMesh lease; (c) the deployment gate (world-v3, Idunn/Odin as recorded in the handoff); (d) decision on Eve world.run_tick authority and the Eve