From 1028139d410c07ce9212ae8d8e5ce45e41a3d73f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 24 Aug 2026 06:46:36 +0200 Subject: [PATCH] Project exact committed story turns --- .../src/bin/ghostlight-action-smoke.rs | 19 +- .../src/bin/ghostlight-narrator-smoke.rs | 68 ---- crates/ghostlight-dungeon/src/domain.rs | 12 - crates/ghostlight-dungeon/src/lib.rs | 1 - crates/ghostlight-dungeon/src/main.rs | 149 +------ crates/ghostlight-dungeon/src/mesh.rs | 20 +- crates/ghostlight-dungeon/src/narrator.rs | 377 ------------------ crates/ghostlight-dungeon/src/surface.rs | 71 +--- docs/architecture/ghostlight-dungeon-mvp.md | 61 ++- .../ghostlight-transition-algebra.md | 9 +- notes/fresh-workspace-handoff.md | 20 +- notes/ghostlight-current-system-map.md | 17 +- notes/ghostlight-implementation-plan.md | 5 +- state/map.yaml | 1 + 14 files changed, 109 insertions(+), 721 deletions(-) delete mode 100644 crates/ghostlight-dungeon/src/bin/ghostlight-narrator-smoke.rs delete mode 100644 crates/ghostlight-dungeon/src/narrator.rs diff --git a/crates/ghostlight-dungeon/src/bin/ghostlight-action-smoke.rs b/crates/ghostlight-dungeon/src/bin/ghostlight-action-smoke.rs index df0fb79..cfc8222 100644 --- a/crates/ghostlight-dungeon/src/bin/ghostlight-action-smoke.rs +++ b/crates/ghostlight-dungeon/src/bin/ghostlight-action-smoke.rs @@ -12,7 +12,6 @@ async fn main() -> anyhow::Result<()> { domain::{ActionIntent, Campaign, WorldCommand}, kernel::{CommandResult, KernelError, WorldKernel}, model::{DeepSeekPort, ModelPort}, - narrator::Narrator, persistence::CampaignStore, }; use std::{path::PathBuf, sync::Arc, time::Instant}; @@ -137,22 +136,7 @@ async fn main() -> anyhow::Result<()> { receipt, )?; } - let narrator = Narrator { - model, - model_name: "deepseek-v4-pro".into(), - verifier_model_name: "deepseek-v4-flash".into(), - }; - let (narration, narration_receipts) = narrator.project(&store, &post).await?; - for receipt in &narration_receipts { - store.insert( - "persona_stage_receipt.v1", - "ghostlight.persona_stage_receipt.v1", - receipt.storage_key(), - receipt, - )?; - } - let mut model_stage_receipts = vec![impossible_receipt, feasible_receipt]; - model_stage_receipts.extend(narration_receipts); + let model_stage_receipts = vec![impossible_receipt, feasible_receipt]; let result = serde_json::json!({ "schema":"ghostlight.action_smoke.v1", @@ -162,7 +146,6 @@ async fn main() -> anyhow::Result<()> { "impossible_attempt_error":impossible_error.to_string(), "feasible_assessment":feasible, "attempt":attempt, - "narration":narration, "model_stage_receipts":model_stage_receipts, "campaign_revision":post.revision, "store":root.join("campaign.cc"), diff --git a/crates/ghostlight-dungeon/src/bin/ghostlight-narrator-smoke.rs b/crates/ghostlight-dungeon/src/bin/ghostlight-narrator-smoke.rs deleted file mode 100644 index 9c11cc8..0000000 --- a/crates/ghostlight-dungeon/src/bin/ghostlight-narrator-smoke.rs +++ /dev/null @@ -1,68 +0,0 @@ -#[cfg(not(windows))] -fn main() -> anyhow::Result<()> { - anyhow::bail!("the live narrator smoke uses Starfire's DPAPI credential") -} - -#[cfg(windows)] -#[tokio::main] -async fn main() -> anyhow::Result<()> { - use chrono::Utc; - use ghostlight_dungeon::{ - domain::Campaign, - model::{DeepSeekPort, ModelPort}, - narrator::Narrator, - persistence::CampaignStore, - }; - use std::{path::PathBuf, sync::Arc, time::Instant}; - - let store_path = std::env::var_os("GHOSTLIGHT_NARRATOR_STORE") - .map(PathBuf::from) - .ok_or_else(|| anyhow::anyhow!("GHOSTLIGHT_NARRATOR_STORE is required"))?; - let secret = std::env::var_os("GHOSTLIGHT_DEEPSEEK_BLOB") - .map(PathBuf::from) - .unwrap_or_else(|| PathBuf::from(r"F:\GameCult\GhostlightDungeon\secrets\deepseek.dpapi")); - let store = CampaignStore::open(&store_path)?; - let campaign_id = store - .keys("campaign.v1")? - .into_iter() - .next() - .ok_or_else(|| anyhow::anyhow!("narrator smoke store has no campaign"))?; - let campaign = store - .load::("campaign.v1", &campaign_id)? - .map(|(_, value)| value) - .ok_or_else(|| anyhow::anyhow!("campaign disappeared"))?; - let model: Arc = Arc::new(DeepSeekPort::from_runtime_secret(secret)?); - let narrator = Narrator { - model, - model_name: "deepseek-v4-pro".into(), - verifier_model_name: "deepseek-v4-flash".into(), - }; - let started = Instant::now(); - let (projection, receipts) = narrator.project(&store, &campaign).await?; - for receipt in &receipts { - store.insert( - "persona_stage_receipt.v1", - "ghostlight.persona_stage_receipt.v1", - receipt.storage_key(), - receipt, - )?; - } - let result_path = store_path - .parent() - .unwrap_or_else(|| std::path::Path::new(".")) - .join(format!( - "narrator-repeat-{}.json", - Utc::now().format("%Y%m%d-%H%M%S") - )); - let result = serde_json::json!({ - "schema":"ghostlight.narrator_smoke.v1", - "elapsed_seconds":started.elapsed().as_secs_f64(), - "projection":projection, - "model_stage_receipts":receipts, - "campaign_revision":campaign.revision, - "result_path":result_path - }); - std::fs::write(&result_path, serde_json::to_vec_pretty(&result)?)?; - println!("{}", serde_json::to_string_pretty(&result)?); - Ok(()) -} diff --git a/crates/ghostlight-dungeon/src/domain.rs b/crates/ghostlight-dungeon/src/domain.rs index a9abe8b..8ba5322 100644 --- a/crates/ghostlight-dungeon/src/domain.rs +++ b/crates/ghostlight-dungeon/src/domain.rs @@ -848,18 +848,6 @@ pub struct NarrativeTurn { pub text: String, } -#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)] -pub struct NarrationProjection { - pub schema: String, - pub id: String, - pub campaign_id: Uuid, - pub source_revision: u64, - pub text: String, - pub event_ids: Vec, - pub model_receipt_hash: String, - pub published_at: DateTime, -} - #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)] pub struct CampaignLifecycleReceipt { pub schema: String, diff --git a/crates/ghostlight-dungeon/src/lib.rs b/crates/ghostlight-dungeon/src/lib.rs index 92a7194..708c301 100644 --- a/crates/ghostlight-dungeon/src/lib.rs +++ b/crates/ghostlight-dungeon/src/lib.rs @@ -13,7 +13,6 @@ pub mod legacy_transition; pub mod mesh; pub mod model; pub mod model_connector; -pub mod narrator; pub mod outcome; pub mod persistence; pub mod persona; diff --git a/crates/ghostlight-dungeon/src/main.rs b/crates/ghostlight-dungeon/src/main.rs index c1cffe2..6d3a138 100644 --- a/crates/ghostlight-dungeon/src/main.rs +++ b/crates/ghostlight-dungeon/src/main.rs @@ -16,7 +16,7 @@ use ghostlight_dungeon::{ assessor::ActionAssessor, compiler::{GestaltFissionRequest, OpeningRequest, OpeningSuggestion, WorldCompiler}, domain::{ - ActionIntent, Campaign, GestaltFissionPreview, NarrationProjection, RegionExpansionPreview, + ActionIntent, Campaign, GestaltFissionPreview, RegionExpansionPreview, RejectedProposalReceipt, WorldCommand, }, gestalt::GestaltPresencePlanner, @@ -31,7 +31,6 @@ use ghostlight_dungeon::{ DeepSeekPort, MODEL_CAPABLE, MODEL_FAST, ModelPort, ModelRuntimeStatus, OpenRouterPort, }, model_connector::CultMeshModelPort, - narrator::Narrator, persistence::CampaignStore, persona::PersonaProjectionEngine, registry::{CampaignRegistry, CampaignRuntime}, @@ -3406,23 +3405,7 @@ async fn surface( return (StatusCode::FORBIDDEN, error.to_string()).into_response(); } }; - let mut narrations = runtime - .store - .keys("narration_projection.v1") - .unwrap_or_default() - .into_iter() - .filter_map(|key| { - runtime - .store - .load::("narration_projection.v1", &key) - .ok() - .flatten() - .map(|(_, value)| value) - }) - .filter(|value| value.campaign_id == campaign.id) - .collect::>(); - narrations.sort_by_key(|value| value.source_revision); - let mut projected = player_surface_for_actor(&campaign, &viewer_actor_id, &narrations); + let mut projected = player_surface_for_actor(&campaign, &viewer_actor_id); if let Ok(Some((_, membership))) = runtime .store .load::( @@ -3753,7 +3736,7 @@ async fn approve_destination( }) .await { - Ok(value) => Json(player_command_projection(&value, None)).into_response(), + Ok(value) => Json(player_command_projection(&value)).into_response(), Err(error) => (StatusCode::CONFLICT, error.to_string()).into_response(), } } @@ -3854,7 +3837,7 @@ async fn approve_fission( if let Err(error) = refresh_mesh(&state).await { tracing::warn!(%error, "gestalt fission CultMesh publication failed"); } - Json(player_command_projection(&value, None)).into_response() + Json(player_command_projection(&value)).into_response() } Err(error) => (StatusCode::CONFLICT, error.to_string()).into_response(), } @@ -3921,45 +3904,6 @@ async fn resolve_npc_initiative( Ok(serde_json::to_value(resolved)?) } -async fn publish_latest_narration( - state: &AppState, - runtime: &CampaignRuntime, -) -> anyhow::Result> { - let campaign = load_campaign(&runtime.store)?; - let key = format!("{}:{}", campaign.id, campaign.revision); - if let Some((_, existing)) = runtime - .store - .load::("narration_projection.v1", &key)? - { - return Ok(Some(existing)); - } - let model = state - .model - .as_ref() - .ok_or_else(|| anyhow::anyhow!("narration requires the model provider"))?; - let narrator = Narrator { - model: model.clone(), - model_name: MODEL_CAPABLE.into(), - verifier_model_name: MODEL_FAST.into(), - }; - let (projection, receipts) = narrator.project(&runtime.store, &campaign).await?; - runtime.store.insert( - "narration_projection.v1", - "ghostlight.narration_projection.v1", - &projection.id, - &projection, - )?; - for receipt in receipts { - let _ = runtime.store.insert( - "persona_stage_receipt.v1", - "ghostlight.persona_stage_receipt.v1", - receipt.storage_key(), - &receipt, - ); - } - Ok(Some(projection)) -} - async fn committed_after_failure( state: &AppState, runtime: &CampaignRuntime, @@ -3985,20 +3929,13 @@ async fn committed_after_failure( &receipt, ); } - let narration = publish_latest_narration(state, runtime) - .await - .ok() - .flatten(); if let Err(error) = refresh_mesh(state).await { tracing::warn!(%error, "post-commit CultMesh publication failed"); } let message = format!( "The player action committed, but {stage} stopped: {reason}. Every world change remains separately receipted." ); - Json(player_command_projection_with_message( - result, narration, &message, - )) - .into_response() + Json(player_command_projection_with_message(result, &message)).into_response() } async fn propose_time_advance( @@ -4128,7 +4065,7 @@ async fn governed_campaign_command( { tracing::warn!(%error, "governed time advance mesh refresh failed"); } - Json(player_command_projection(&result, None)).into_response() + Json(player_command_projection(&result)).into_response() } Err(KernelError::Stale { expected, actual }) => ( StatusCode::CONFLICT, @@ -4319,7 +4256,7 @@ async fn command( ) .await { - Ok(Some(result)) => Json(player_command_projection(&result, None)).into_response(), + Ok(Some(result)) => Json(player_command_projection(&result)).into_response(), Ok(None) => ( StatusCode::SERVICE_UNAVAILABLE, Json(ErrorBody { @@ -4585,18 +4522,11 @@ async fn command( .await; } }; - let narration = - publish_latest_narration(&state, &runtime) - .await - .ok() - .flatten(); if let Err(error) = refresh_mesh(&state).await { tracing::warn!(%error, "post-command CultMesh publication failed"); } - return Json(player_command_projection( - &result, narration, - )) - .into_response(); + return Json(player_command_projection(&result)) + .into_response(); } Err(error) => { return committed_after_failure( @@ -4624,15 +4554,10 @@ async fn command( } } if presence_result.is_some() { - let narration = publish_latest_narration(&state, &runtime) - .await - .ok() - .flatten(); if let Err(error) = refresh_mesh(&state).await { tracing::warn!(%error, "post-command CultMesh publication failed"); } - return Json(player_command_projection(&result, narration)) - .into_response(); + return Json(player_command_projection(&result)).into_response(); } } } @@ -4641,20 +4566,12 @@ async fn command( &result, CommandResult::Committed { .. } | CommandResult::Created { .. } ) { - let narration = if should_react { - publish_latest_narration(&state, &runtime) - .await - .ok() - .flatten() - } else { - None - }; if let Err(error) = refresh_mesh(&state).await { tracing::warn!(%error, "post-command CultMesh publication failed"); } - Json(player_command_projection(&result, narration)).into_response() + Json(player_command_projection(&result)).into_response() } else { - Json(player_command_projection(&result, None)).into_response() + Json(player_command_projection(&result)).into_response() } } Err(error) => { @@ -4723,9 +4640,7 @@ async fn command( }) .await { - Ok(result) => { - Json(player_command_projection(&result, None)).into_response() - } + Ok(result) => Json(player_command_projection(&result)).into_response(), Err(recompile_error) => ( StatusCode::CONFLICT, Json(ErrorBody { @@ -4906,10 +4821,7 @@ fn gestalt_fission_preview_projection(preview: &GestaltFissionPreview) -> serde_ }) } -fn player_command_projection( - result: &CommandResult, - narration: Option, -) -> serde_json::Value { +fn player_command_projection(result: &CommandResult) -> serde_json::Value { match result { CommandResult::Assessed { assessment } => serde_json::json!({ "kind":"assessed", @@ -4919,7 +4831,6 @@ fn player_command_projection( "kind":"committed", "revision":receipt.revision, "receipt":receipt, - "narration":narration, }), CommandResult::ResolutionUpdated { receipt, .. } => serde_json::json!({ "kind":"resolution_updated", @@ -4950,10 +4861,9 @@ fn player_command_projection( fn player_command_projection_with_message( result: &CommandResult, - narration: Option, message: &str, ) -> serde_json::Value { - let mut projection = player_command_projection(result, narration); + let mut projection = player_command_projection(result); if let Some(object) = projection.as_object_mut() { object.insert("message".into(), message.into()); } @@ -5086,21 +4996,6 @@ async fn refresh_mesh(state: &AppState) -> anyhow::Result { for id in state.registry.list().await { let runtime = state.registry.runtime(id).await?; let campaign = load_campaign(&runtime.store)?; - let mut narrations = runtime - .store - .keys("narration_projection.v1")? - .into_iter() - .filter_map(|key| { - runtime - .store - .load::("narration_projection.v1", &key) - .ok() - .flatten() - .map(|(_, value)| value) - }) - .filter(|value| value.campaign_id == campaign.id) - .collect::>(); - narrations.sort_by_key(|value| value.source_revision); snapshots.push(CampaignMeshSnapshot { membership: runtime .store @@ -5110,7 +5005,6 @@ async fn refresh_mesh(state: &AppState) -> anyhow::Result { )? .map(|(_, membership)| membership), campaign, - narrations, evidence: runtime.store.load_all("vault_evidence_receipt.v1")?, commits: runtime.store.load_all("world_commit_receipt.v1")?, stages: runtime.store.load_all("persona_stage_receipt.v1")?, @@ -6708,20 +6602,18 @@ mod tests { }, campaign, }; - let projection = player_command_projection(&result, None); + let projection = player_command_projection(&result); assert_eq!(projection["kind"], "committed"); assert_eq!(projection["revision"], 1); let encoded = serde_json::to_string(&projection).unwrap(); assert!(!encoded.contains("Private state")); assert!(!encoded.contains("actors")); assert!(!encoded.contains("facts")); + assert!(!encoded.contains("narration")); - let created = player_command_projection( - &CommandResult::Created { - campaign: seed("Hidden seed"), - }, - None, - ); + let created = player_command_projection(&CommandResult::Created { + campaign: seed("Hidden seed"), + }); assert_eq!(created, serde_json::json!({"kind":"created"})); } @@ -6743,7 +6635,6 @@ mod tests { let projection = player_command_projection_with_message( &result, - None, "The player action committed, but reaction appraisal stopped.", ); diff --git a/crates/ghostlight-dungeon/src/mesh.rs b/crates/ghostlight-dungeon/src/mesh.rs index 1d81603..bc72938 100644 --- a/crates/ghostlight-dungeon/src/mesh.rs +++ b/crates/ghostlight-dungeon/src/mesh.rs @@ -1,8 +1,8 @@ use crate::{ domain::{ - Campaign, CellAppraisal, GestaltMaterializationReceipt, NarrationProjection, - RejectedProposalReceipt, ResolutionControlReceipt, ResolutionPlanReceipt, - StrategicActivityOutcome, StrategicTickReceipt, VaultEvidenceReceipt, WorldCommitReceipt, + Campaign, CellAppraisal, GestaltMaterializationReceipt, RejectedProposalReceipt, + ResolutionControlReceipt, ResolutionPlanReceipt, StrategicActivityOutcome, + StrategicTickReceipt, VaultEvidenceReceipt, WorldCommitReceipt, }, model::{ModelRuntimeStatus, ModelStageReceipt}, session_zero::{CampaignMembership, SessionZeroState}, @@ -51,7 +51,6 @@ impl Default for MeshRuntimeIdentity { pub struct CampaignMeshSnapshot { pub campaign: Campaign, pub membership: Option, - pub narrations: Vec, pub evidence: Vec, pub commits: Vec, pub stages: Vec, @@ -311,8 +310,7 @@ impl MeshPublisher { as i64; if let Some(membership) = &snapshot.membership { for member in membership.members.values().filter(|member| member.active) { - let surface = - player_surface_for_actor(campaign, &member.actor_id, &snapshot.narrations); + let surface = player_surface_for_actor(campaign, &member.actor_id); let key = format!( "eve:surface:ghostlight.campaign.{}.{}", campaign.id, member.member_id @@ -334,17 +332,13 @@ impl MeshPublisher { title: campaign.name.clone(), version: interface_version, updated_at: updated_at.clone(), - surface: player_surface_for_actor( - campaign, - &member.actor_id, - &snapshot.narrations, - ), + surface: player_surface_for_actor(campaign, &member.actor_id), }, &mut remote_messages, )?; } } else { - let surface = player_surface(campaign, &snapshot.narrations); + let surface = player_surface(campaign); let key = format!("eve:surface:ghostlight.campaign.{}", campaign.id); self.put_and_stage( &mut node, @@ -360,7 +354,7 @@ impl MeshPublisher { title: campaign.name.clone(), version: interface_version, updated_at: updated_at.clone(), - surface: player_surface(campaign, &snapshot.narrations), + surface: player_surface(campaign), }, &mut remote_messages, )?; diff --git a/crates/ghostlight-dungeon/src/narrator.rs b/crates/ghostlight-dungeon/src/narrator.rs deleted file mode 100644 index dd5a433..0000000 --- a/crates/ghostlight-dungeon/src/narrator.rs +++ /dev/null @@ -1,377 +0,0 @@ -use crate::{ - domain::{Campaign, NarrationProjection}, - model::{ModelPort, ModelStageReceipt, ModelStageRequest, run_validated_stage}, - persistence::CampaignStore, -}; -use anyhow::{Result, anyhow}; -use chrono::Utc; -use schemars::{JsonSchema, schema_for}; -use serde::{Deserialize, Serialize}; -use std::sync::Arc; - -#[derive(Clone)] -pub struct Narrator { - pub model: Arc, - pub model_name: String, - pub verifier_model_name: String, -} - -#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] -#[serde(deny_unknown_fields)] -struct NarrationVerification { - faithful_to_draft: bool, - prose: String, - unsupported_claims: Vec, -} - -impl Narrator { - pub async fn project( - &self, - store: &CampaignStore, - campaign: &Campaign, - ) -> Result<(NarrationProjection, Vec)> { - let player = &campaign.actors[&campaign.player_actor_id]; - let location = &campaign.locations[&player.location_id]; - let recent_events: Vec<_> = campaign.events.iter().rev().take(4).cloned().collect(); - let latest_turn = campaign.transcript.last().cloned(); - let publication = store - .load::( - "session_zero_publication.v1", - &campaign.id.to_string(), - )? - .map(|(_, value)| value); - let active_boundaries = store - .load::( - "active_contract_boundary_policy.v1", - &campaign.id.to_string(), - )? - .map(|(_, value)| value); - let aggregate_boundaries = active_boundaries - .filter(|active| { - publication.as_ref().is_none_or(|published| { - active.review_session_zero_id != published.session_zero_id - }) - }) - .map(|active| active.aggregate_boundaries) - .or_else(|| { - publication - .as_ref() - .map(|value| value.approved_brief.aggregate_boundaries.clone()) - }) - .unwrap_or_default(); - let visible_actors: Vec<_> = campaign - .actors - .values() - .filter(|actor| actor.location_id == player.location_id) - .map(|actor| { - serde_json::json!({ - "id": actor.id, - "name": actor.name, - "conditions": actor.conditions, - }) - }) - .collect(); - let public_slice = serde_json::json!({ - "viewer_actor": { - "id": player.id, - "name": player.name, - }, - "world_time": campaign.world_time, - "location": { - "id": location.id, - "name": location.name, - "persistent_features": location.persistent_features, - }, - "visible_actors": visible_actors, - "latest_events": recent_events, - "latest_committed_turn": latest_turn, - "campaign_contract": publication.as_ref().map(|value| &value.contract), - "aggregate_content_boundaries": aggregate_boundaries, - }); - let public_slice_json = serde_json::to_string(&public_slice)?; - let output = run_validated_stage( - self.model.as_ref(), - &ModelStageRequest { - stage: "narrator".into(), - model: self.model_name.clone(), - snapshot_binding: format!( - "campaign:{}:revision:{}", - campaign.id, campaign.revision - ), - lived_stream: format!( - "Narrate only latest_committed_turn and any latest_events it directly caused, in concrete, concise interactive-fiction prose. viewer_actor is the reader's character and the only actor that may be addressed in second person. If latest_committed_turn belongs to another visible actor, narrate that actor in third person and preserve their exact attribution; never transfer their speech, knowledge, uncertainty, choice, or action to the viewer. The campaign contract governs tone, pacing, focus, consequences, and DM style. Obey every aggregate content boundary: line excludes the topic, veil keeps it off-screen, ask_first permits no new depiction without a current explicit player acceptance. Never expose boundary attribution. Location, time, and visible actors are grounding constraints, not a request to restate every field. Do not repeat older setup, list routes, or recap unrelated world state. Do not mention JSON, state, commits, revisions, or the source representation. Every environmental noun, sensory adjective, object state, action, and consequence must be traceable to the supplied JSON. Do not invent lighting, temperature, sound, motion, posture, dialogue, private thoughts, expertise, geography, findings, or outcomes. It is better to be spare than to fabricate texture. Emit prose only.\n\n{}", - public_slice_json - ), - output_schema: None, - source_receipt_ids: campaign.branch_origin.evidence_receipt_ids.clone(), - temperature: Some(0.2), - max_output_tokens: Some(256), - }, - ) - .await?; - let text = output.narrative.trim(); - if text.is_empty() || text.starts_with('{') || text.contains("```json") { - return Err(anyhow!("narrator violated prose projection membrane")); - } - let verification = run_validated_stage( - self.model.as_ref(), - &ModelStageRequest { - stage: "narration_verifier".into(), - model: self.verifier_model_name.clone(), - snapshot_binding: format!( - "campaign:{}:revision:{}:narration-verifier", - campaign.id, campaign.revision - ), - lived_stream: format!( - "You are Ghostlight's independent narration verifier. The typed source slice and draft are projections of one already-committed world revision. Return the draft unchanged only when every concrete claim, outcome, actor attribution, object state, sensory detail, and causal implication is entailed by the source. Otherwise return minimal corrected interactive-fiction prose containing only entailed claims. Preserve an explicit committed success, mixed result, or failure exactly; later reaction speech or uncertainty cannot reverse it. Do not invent a more specific finding than the committed event or actor knowledge. Do not add atmosphere merely to improve style. faithful_to_draft is true only when prose is byte-for-byte the supplied draft. unsupported_claims contains short descriptions of removed or corrected claims and is empty when faithful. Return one JSON object only.\n\nTYPED SOURCE SLICE:\n{}\n\nDRAFT NARRATION:\n{}", - public_slice_json, - serde_json::to_string(text)? - ), - output_schema: Some(serde_json::to_value(schema_for!(NarrationVerification))?), - source_receipt_ids: campaign.branch_origin.evidence_receipt_ids.clone(), - temperature: Some(0.0), - max_output_tokens: Some(384), - }, - ) - .await?; - let verification_value: NarrationVerification = serde_json::from_value( - verification - .structured - .clone() - .ok_or_else(|| anyhow!("narration verifier produced no typed result"))?, - )?; - let verified_text = verification_value.prose.trim(); - if verified_text.is_empty() - || verified_text.len() > 2_000 - || verified_text.starts_with('{') - || verified_text.contains("```json") - || verification_value.unsupported_claims.len() > 8 - || verification_value - .unsupported_claims - .iter() - .any(|claim| claim.trim().is_empty() || claim.len() > 240) - || (verification_value.faithful_to_draft && verified_text != text) - { - return Err(anyhow!("narration verifier returned an invalid projection")); - } - let current = store - .load::("campaign.v1", &campaign.id.to_string())? - .map(|(_, campaign)| campaign) - .ok_or_else(|| anyhow!("campaign vanished during narration"))?; - if current.revision != campaign.revision { - return Err(anyhow!("narration snapshot became stale")); - } - let projection = NarrationProjection { - schema: "ghostlight.narration_projection.v1".into(), - id: format!("{}:{}", campaign.id, campaign.revision), - campaign_id: campaign.id, - source_revision: campaign.revision, - text: verified_text.into(), - event_ids: recent_events.into_iter().map(|event| event.id).collect(), - model_receipt_hash: verification.receipt.storage_key().to_owned(), - published_at: Utc::now(), - }; - Ok((projection, vec![output.receipt, verification.receipt])) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::{ - domain::{ActorState, BranchOrigin, Campaign, Location, NarrativeTurn}, - model::ModelStageRequest, - }; - use async_trait::async_trait; - use std::{ - collections::{BTreeMap, BTreeSet}, - sync::Mutex, - }; - - struct CaptureNarratorModel { - prompt: Mutex, - } - - struct CorrectingNarratorModel; - - #[async_trait] - impl ModelPort for CorrectingNarratorModel { - async fn run(&self, request: &ModelStageRequest) -> Result { - if request.stage == "narration_verifier" { - return Ok(serde_json::json!({ - "faithful_to_draft":false, - "prose":"The clinic director answers.", - "unsupported_claims":["The draft invented a damaged seal."] - }) - .to_string()); - } - Ok("The clinic director answers beside an invented damaged seal.".into()) - } - - fn provider(&self) -> &'static str { - "narrator-correcting" - } - } - - #[async_trait] - impl ModelPort for CaptureNarratorModel { - async fn run(&self, request: &ModelStageRequest) -> Result { - if request.stage == "narration_verifier" { - return Ok(serde_json::json!({ - "faithful_to_draft":true, - "prose":"The clinic director answers without moving the ledger.", - "unsupported_claims":[] - }) - .to_string()); - } - *self.prompt.lock().unwrap() = request.lived_stream.clone(); - Ok("The clinic director answers without moving the ledger.".into()) - } - - fn provider(&self) -> &'static str { - "narrator-capture" - } - } - - fn campaign() -> Campaign { - let actor = ActorState { - id: "player".into(), - name: "Player".into(), - location_id: "room".into(), - capabilities: BTreeSet::new(), - knowledge: BTreeSet::new(), - equipment: BTreeSet::new(), - conditions: BTreeSet::new(), - obligations: BTreeSet::new(), - relationships: BTreeMap::new(), - goals: vec![], - memories: vec![], - }; - Campaign { - schema: "ghostlight.campaign.v1".into(), - id: uuid::Uuid::new_v4(), - name: "Narrator test".into(), - revision: 0, - branch_origin: BranchOrigin { - canon_cutoff: "test".into(), - evidence_receipt_ids: vec![], - }, - world_time: Utc::now(), - tick_hours: 6, - player_actor_id: "player".into(), - locations: BTreeMap::from([( - "room".into(), - Location { - id: "room".into(), - name: "Room".into(), - container_id: None, - routes: BTreeMap::new(), - persistent_features: vec![], - }, - )]), - actors: BTreeMap::from([("player".into(), actor)]), - institutions: BTreeMap::new(), - clocks: BTreeMap::new(), - facts: BTreeMap::new(), - transcript: vec![], - last_player_activity: Utc::now(), - pending_ticks: 0, - away_ticks_processed: 0, - events: vec![], - news: vec![], - canon_candidates: BTreeMap::new(), - gestalts: BTreeMap::new(), - gestalt_members: BTreeMap::new(), - pending_world_proposals: vec![], - agency_profiles: BTreeMap::new(), - agency_relations: BTreeMap::new(), - gestalt_lineages: BTreeMap::new(), - resolution_policy: Default::default(), - resolution_pins: BTreeMap::new(), - resolution_cover: None, - strategic_tick_count: 0, - } - } - - #[tokio::test] - async fn narration_is_revision_bound_and_does_not_mutate_campaign() { - let dir = tempfile::tempdir().unwrap(); - let store = CampaignStore::open(dir.path().join("campaign.cc")).unwrap(); - let seed = campaign(); - store.create_campaign(&seed, &[], &[]).unwrap(); - let narrator = Narrator { - model: Arc::new(CaptureNarratorModel { - prompt: Mutex::new(String::new()), - }), - model_name: "fixture".into(), - verifier_model_name: "fixture".into(), - }; - let (projection, _) = narrator.project(&store, &seed).await.unwrap(); - assert_eq!(projection.source_revision, 0); - let persisted = store - .load::("campaign.v1", &seed.id.to_string()) - .unwrap() - .unwrap() - .1; - assert_eq!(persisted, seed); - assert!(store.keys("narration_projection.v1").unwrap().is_empty()); - } - - #[tokio::test] - async fn narrator_receives_exact_viewer_ownership_for_an_npc_turn() { - let dir = tempfile::tempdir().unwrap(); - let store = CampaignStore::open(dir.path().join("campaign.cc")).unwrap(); - let mut seed = campaign(); - let mut director = seed.actors["player"].clone(); - director.id = "clinic-director".into(); - director.name = "Clinic Director".into(); - seed.actors.insert(director.id.clone(), director); - seed.transcript.push(NarrativeTurn { - revision: 0, - at: Utc::now(), - speaker: "clinic-director".into(), - text: "I will keep the triage ledger.".into(), - }); - store.create_campaign(&seed, &[], &[]).unwrap(); - let model = Arc::new(CaptureNarratorModel { - prompt: Mutex::new(String::new()), - }); - let narrator = Narrator { - model: model.clone(), - model_name: "fixture".into(), - verifier_model_name: "fixture".into(), - }; - - narrator.project(&store, &seed).await.unwrap(); - - let prompt = model.prompt.lock().unwrap(); - assert!(prompt.contains("\"viewer_actor\":{\"id\":\"player\",\"name\":\"Player\"}")); - assert!(prompt.contains("\"speaker\":\"clinic-director\"")); - assert!(prompt.contains("the only actor that may be addressed in second person")); - assert!( - prompt - .contains("never transfer their speech, knowledge, uncertainty, choice, or action") - ); - } - - #[tokio::test] - async fn narration_publishes_the_verified_correction_and_binds_both_stage_receipts() { - let dir = tempfile::tempdir().unwrap(); - let store = CampaignStore::open(dir.path().join("campaign.cc")).unwrap(); - let seed = campaign(); - store.create_campaign(&seed, &[], &[]).unwrap(); - let narrator = Narrator { - model: Arc::new(CorrectingNarratorModel), - model_name: "fixture-pro".into(), - verifier_model_name: "fixture-flash".into(), - }; - - let (projection, receipts) = narrator.project(&store, &seed).await.unwrap(); - - assert_eq!(projection.text, "The clinic director answers."); - assert_eq!(receipts.len(), 2); - assert_eq!(receipts[0].stage, "narrator"); - assert_eq!(receipts[1].stage, "narration_verifier"); - assert_eq!(projection.model_receipt_hash, receipts[1].storage_key()); - } -} diff --git a/crates/ghostlight-dungeon/src/surface.rs b/crates/ghostlight-dungeon/src/surface.rs index 7f13568..a8c4ead 100644 --- a/crates/ghostlight-dungeon/src/surface.rs +++ b/crates/ghostlight-dungeon/src/surface.rs @@ -1,7 +1,7 @@ use crate::{ domain::{ - Campaign, GestaltMaterializationReceipt, NarrationProjection, RejectedProposalReceipt, - StrategicTickReceipt, VaultEvidenceReceipt, WorldCommitReceipt, + Campaign, GestaltMaterializationReceipt, RejectedProposalReceipt, StrategicTickReceipt, + VaultEvidenceReceipt, WorldCommitReceipt, }, model::ModelStageReceipt, }; @@ -28,17 +28,13 @@ pub fn rebase_campaign_surface_revision(source_version: u64, campaign_revision: .saturating_add(source_version % CAMPAIGN_REVISION_SCALE) } -pub fn player_surface(campaign: &Campaign, narrations: &[NarrationProjection]) -> Value { - player_surface_for_actor(campaign, &campaign.player_actor_id, narrations) +pub fn player_surface(campaign: &Campaign) -> Value { + player_surface_for_actor(campaign, &campaign.player_actor_id) } -pub fn player_surface_for_actor( - campaign: &Campaign, - viewer_actor_id: &str, - narrations: &[NarrationProjection], -) -> Value { +pub fn player_surface_for_actor(campaign: &Campaign, viewer_actor_id: &str) -> Value { let interface_version = campaign_interface_version(campaign); - let story = story_nodes(campaign, narrations); + let story = story_nodes(campaign); let player = &campaign.actors[viewer_actor_id]; let location = &campaign.locations[&player.location_id]; let mut present_characters = campaign @@ -325,33 +321,17 @@ fn eve_command(command: &str, payload_schema: &str, bindings: &[&str], authority json!({"schema":"gamecult.eve.command.v1","command":command,"payloadSchema":payload_schema,"captureBindings":bindings,"transport":"https-json","authority":authority}) } -fn story_nodes(campaign: &Campaign, narrations: &[NarrationProjection]) -> Vec { - let narrated_revisions = narrations - .iter() - .map(|narration| narration.source_revision) - .collect::>(); +fn story_nodes(campaign: &Campaign) -> Vec { let mut entries = Vec::new(); for (index, turn) in campaign.transcript.iter().enumerate() { - if turn.speaker == "world" && narrated_revisions.contains(&turn.revision) { - continue; - } entries.push(( turn.revision, - 0_u8, index, json!({"id":format!("turn-{}-{}-{}",turn.revision,index,turn.speaker),"kind":"text","props":{"value":format!("{}: {}",turn.speaker,turn.text)},"children":[]}), )); } - for (index, narration) in narrations.iter().enumerate() { - entries.push(( - narration.source_revision, - 1_u8, - index, - json!({"id":format!("narration-{}",narration.source_revision),"kind":"text","props":{"value":narration.text},"children":[]}), - )); - } - entries.sort_by_key(|(revision, phase, index, _)| (*revision, *phase, *index)); - entries.into_iter().map(|(_, _, _, node)| node).collect() + entries.sort_by_key(|(revision, index, _)| (*revision, *index)); + entries.into_iter().map(|(_, _, node)| node).collect() } pub fn operator_surface( @@ -487,7 +467,7 @@ mod tests { use chrono::Utc; #[test] - fn story_is_chronological_and_narration_replaces_same_revision_world_prose() { + fn story_is_chronological_and_uses_only_committed_turns() { let mut campaign = crate::resolution::tests::campaign(1, 1); campaign.transcript = vec![ NarrativeTurn { @@ -509,18 +489,7 @@ mod tests { text: "I answer directly.".into(), }, ]; - let narration = NarrationProjection { - schema: "ghostlight.narration_projection.v1".into(), - id: "narration-2".into(), - campaign_id: campaign.id, - source_revision: 2, - text: "The bounded outcome is visible.".into(), - event_ids: vec![], - model_receipt_hash: "sha256:test".into(), - published_at: Utc::now(), - }; - - let story = story_nodes(&campaign, &[narration]); + let story = story_nodes(&campaign); let values = story .iter() .map(|node| node["props"]["value"].as_str().unwrap()) @@ -529,11 +498,11 @@ mod tests { values, vec![ "player: I ask the question.", - "The bounded outcome is visible.", + "world: raw outcome", "npc: I answer directly." ] ); - assert!(!values.iter().any(|value| value.contains("raw outcome"))); + assert!(values.iter().all(|value| !value.contains("narration"))); } #[test] @@ -579,7 +548,7 @@ mod tests { }, ); - let surface = player_surface(&campaign, &[]); + let surface = player_surface(&campaign); assert_eq!(surface["viewer_actor_id"], "pilot-nyx"); assert_eq!(surface["player_location_id"], "center"); @@ -637,7 +606,7 @@ mod tests { }, ); - let surface = player_surface(&campaign, &[]); + let surface = player_surface(&campaign); let encoded = serde_json::to_string(&surface).unwrap(); assert!(!encoded.contains("SECRET_REMOTE_COUP_POSTURE")); @@ -667,7 +636,7 @@ mod tests { .knowledge .insert("sealed command wire".into()); - let encoded = serde_json::to_string(&player_surface(&campaign, &[])).unwrap(); + let encoded = serde_json::to_string(&player_surface(&campaign)).unwrap(); assert!(!encoded.contains("SECRET_COMMAND_MOVEMENT")); } @@ -700,7 +669,7 @@ mod tests { }, ]); - let encoded = serde_json::to_string(&player_surface(&campaign, &[])).unwrap(); + let encoded = serde_json::to_string(&player_surface(&campaign)).unwrap(); assert!(encoded.contains("The junction workers reopen the water line.")); assert!(!encoded.contains("SECRET_REMOTE_EVENT")); @@ -756,7 +725,7 @@ mod tests { }, ]); - let encoded = serde_json::to_string(&player_surface(&campaign, &[])).unwrap(); + let encoded = serde_json::to_string(&player_surface(&campaign)).unwrap(); assert!(!encoded.contains("PLAYER_PRIVATE_ACTIVITY_SUMMARY")); assert!(!encoded.contains("PLAYER_SPEECH_DUPLICATE")); @@ -789,7 +758,7 @@ mod tests { } crate::resolution::ensure_agency_profiles(&mut campaign); - let encoded = serde_json::to_string(&player_surface(&campaign, &[])).unwrap(); + let encoded = serde_json::to_string(&player_surface(&campaign)).unwrap(); assert!(encoded.contains("Local neighbors")); assert!(!encoded.contains("SECRET_REMOTE_POPULATION")); @@ -817,7 +786,7 @@ mod tests { }, ); - let encoded = serde_json::to_string(&player_surface(&campaign, &[])).unwrap(); + let encoded = serde_json::to_string(&player_surface(&campaign)).unwrap(); for binding in [ "time_advance_minutes", "destination_location_id", diff --git a/docs/architecture/ghostlight-dungeon-mvp.md b/docs/architecture/ghostlight-dungeon-mvp.md index 3b07c56..80a1369 100644 --- a/docs/architecture/ghostlight-dungeon-mvp.md +++ b/docs/architecture/ghostlight-dungeon-mvp.md @@ -134,8 +134,7 @@ The following may never decide or repair canonical campaign truth: - browser handlers and chat transport; - Eve renderers and command lowering; - model-provider responses; -- Projectors, Personas, Interpreters, narrators, retrievers, rerankers, and - verifiers; +- Projectors, Personas, Interpreters, retrievers, rerankers, and verifiers; - initiative and reaction selection; - scheduler loops and return-time catch-up calculations; - Vault providers and evidence caches; @@ -174,8 +173,8 @@ source intent outcome, and stores the roll and commit receipts atomically. - **Derived state:** priority ordering and the selected winner are calculations, not world truth and not commits. -- **Forbidden writers:** Persona output, the initiative selector, narrator, and - HTTP handler cannot begin or resolve an NPC action directly. +- **Forbidden writers:** Persona output, the initiative selector, and the HTTP + handler cannot begin or resolve an NPC action directly. - **Shared paths:** live reactions, interrupts, and future offscreen individualized actions all submit `ResolveNpcAction`; it applies the same assessment validation, d20 bands, and typed outcome rules as player attempts. @@ -205,31 +204,29 @@ transition. Return catch-up invokes that same command before the next fictional player action is admitted. Private assessment and resolution-policy edits do not enter catch-up because neither advances or enters the fiction. -### Narration projection authority +### Story projection authority -- **Owner:** committed campaign state and events own what happened; the - narrator owns only a readable projection of one exact revision. -- **Inputs:** a player-visible slice of location, visible actors, explicit - speech/stakes, recent committed events, and evidence receipts. -- **Outputs:** immutable `narration_projection.v1` CultCache rows bound to a - campaign ID and source revision, plus private model-stage receipts. -- **Derived state:** story prose and the Eve transcript card are projections; - neither is a world fact, actor memory, action, or correction path. -- **Forbidden writers:** narrator output cannot append events, speech, facts, - deltas, memories, clocks, topology, or campaign revision. -- **Shared paths:** player attempts, NPC attempts, waits, strategic ticks, and - other committed transitions invoke the same post-commit narrator projection. -- **Cut line:** the existing campaign transcript retains explicit speech and - deterministic stake text only. Generated connective prose lives outside the - campaign row and cannot be read back as canonical input except as a display - projection. +- **Owner:** the committed campaign transcript owns the exact player-visible + speech and outcome prose for each world revision. +- **Inputs:** revision-bound `NarrativeTurn` rows already admitted by the + `WorldKernel` transaction. +- **Outputs:** one deterministic chronological Eve story projection. No model + stage sits between committed prose and the player. +- **Derived state:** Eve text nodes and transport responses are disposable + lowerings; neither is a world fact, memory, action, or correction path. +- **Forbidden writers:** display projections cannot invent, replace, suppress, + summarize, or reinterpret a committed turn. +- **Shared paths:** every client—browser, native CultMesh, and generic Verse + consumer—receives the same ordered transcript through the provider surface. +- **Cut line:** historical `narration_projection.v1` rows are inert migration + evidence. The runtime neither reads nor writes them, and the narrator and + verifier model stages have no executable target. -The narrator rechecks the campaign revision after inference. Its typed public -slice identifies the exact viewer actor separately from the latest turn's -speaker. Second-person narration belongs only to that viewer; another actor's -speech, knowledge, uncertainty, choice, or action cannot be transferred to the -player by prose. Stale or malformed prose is discarded. Successful projections -survive refresh without acquiring write authority over the world they describe. +Outcome assessment and Persona stages already emit bounded natural prose. A +second generative rewrite added token cost and a new factual-authority failure +surface without owning any state. Exact transcript lowering makes invented +names, dialogue, injuries, and actions structurally unavailable to the display +layer. ### Cut line @@ -297,7 +294,7 @@ but it is not required to predict every future person at campaign creation. First-relevance identity admission is bound to the exact immediately committed player-speech turn. Existing dormant members may be recast after any relevant -committed foreground event, but an attempt result, narration, event summary, or +committed foreground event, but an attempt result, story text, event summary, or plural outcome phrase cannot authorize a new canonical person. One admitted speech may introduce at most one member delta; the kernel rederives that permission from the canonical transcript rather than trusting the planner or @@ -679,9 +676,9 @@ Authority map: actor knowledge, and the attempted effect. - Output: an assessment whose information deltas are a subset of existing accessible facts. -- Derived state: the visible stake and narration are projections of that exact +- Derived state: the visible stake and story are projections of that exact assessment and committed revision. -- Forbidden writers: Personas, Interpreters, assessors, narrators, and +- Forbidden writers: Personas, Interpreters, assessors, and `apply_world_effect` cannot create facts. - Shared path: player `Attempt` and `ResolveNpcAction` call the same fact-access validator and atomic commit primitive. @@ -698,7 +695,7 @@ later `WorldCommand`; it does not suppress perception for actors outside the current conversational focus. The primary player event commits before optional presence casting, reaction -appraisal, initiative, and narration. A failure in those later stages is stored +appraisal and initiative. A failure in those later stages is stored as a rejected-proposal receipt and returned as an accepted committed result with a visible warning. It cannot be reported as rejection of the already persisted player action, and a browser retry cannot duplicate that action. @@ -739,7 +736,7 @@ transport, sessions, and local rendering. It does not invent a parallel UI state model. The player HTTP command boundary returns a dedicated spoiler-safe projection: -assessments, public commit receipts, roll results, and narration. It never +assessments, public commit receipts, and roll results. It never serializes the canonical campaign snapshot. Full actor, institution, evidence, and model-stage state belongs to the authenticated operator projection only. Player and model strings enter the DOM through text nodes rather than HTML diff --git a/docs/architecture/ghostlight-transition-algebra.md b/docs/architecture/ghostlight-transition-algebra.md index edaaf28..d2e36d8 100644 --- a/docs/architecture/ghostlight-transition-algebra.md +++ b/docs/architecture/ghostlight-transition-algebra.md @@ -66,7 +66,7 @@ One successful commit produces, atomically: - the command or strategic receipt that caused the transition; - any knowledge-channel-aware news inputs derivable from committed events. -Eve, CultMesh, narration, and news projections refresh only after the commit. +Eve, CultMesh, story, and news projections refresh only after the commit. ### Derived and demoted state @@ -78,8 +78,9 @@ Eve, CultMesh, narration, and news projections refresh only after the commit. and do not become true because a model narrated them. - Simulation cells, covers, leases, salience, and detail debt choose inference resolution. They are not fictional world components. -- Transcript prose and narration are projections over committed events. They - do not repair or create state. +- The transcript contains exact committed speech and outcome prose. Eve lowers + it chronologically without a generative rewrite; display text cannot repair + or create state. - Actor equipment lists, institution resource lists, and Gestalt resource sets become projections over resource subjects plus custody. A resource does not change ontology when its owner changes. @@ -97,7 +98,7 @@ The migration is not complete while any of these can decide canonical state: - bespoke actor, Gestalt, or member movement and migration writers; - any Gestalt folding code that unions private knowledge, possessions, or pressure into a population; -- model output, browser payloads, narration, news generation, retrieval, or a +- model output, browser payloads, story rendering, news generation, retrieval, or a derived simulation cell. Bounded region expansion now lowers to the same batch primitive through typed diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 1f26bac..de4fe21 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -62,8 +62,10 @@ unanimity proof also remains unproven. only the kernel reducer can alter typed canonical components. Legacy effect enums are model-boundary migration input, not alternate physical laws. - Ghostlight owns the generalized Projector → Persona → Interpreter membrane. - Projectors, Personas, Interpreters, retrieval, narration, dice previews, and - browsers may propose or project; none may commit canonical state. + Projectors, Personas, Interpreters, retrieval, dice previews, and browsers + may propose or project; none may commit canonical state. The player story is + a deterministic lowering of exact committed transcript turns; no narrator + model owns or rewrites it. - Canonical actors, institutions, Gestalts, member deltas, knowledge, topology, and relationships persist independently of the derived simulation cover. Arena cells never become synthetic collective actors or union knowledge. @@ -222,6 +224,13 @@ messages. belongs to one exact reaction-wave revision: a new wave replaces the old set, and the kernel rejects resolution after any intervening revision. Same-wave retry remains valid without allowing stale Persona output to rebase. +- The same live transcript exposed a second derived-authority breach: a + two-stage narrator invented names, dialogue, and participation after the + kernel had committed a narrower event. The narrator module, verifier, smoke + target, runtime calls, response field, mesh snapshot lane, and surface + replacement logic are deleted. Historical narration rows remain inert in old + stores and are never projected. Browser and native clients now receive only + exact chronological committed turns. - Live refresh pressure reproduced and removed two contract faults: reuse of a private-command idempotency key across separately sealed attempts, and validation of a refresh receipt as if it carried the initial-login account @@ -284,10 +293,9 @@ Operational release and rollback truth remains in `gamecult-ops`. ## Next action -1. Complete the one-time Heimdall OAuth grant for the native client, fetch the - actor-filtered surface over CultMesh, and resume adversarial play without the - browser. -2. Repair the first compiler, world, action, or agency failure at its owning +1. Continue adversarial play through the authenticated native CultMesh client; + its Heimdall grant and Ghostlight app session are persisted in CultCache. +2. Repair the first compiler, world, action, identity, or agency failure at its owning state/projection seam; do not add output bans around missing context. 3. Then fork or compile a denser 20-plus-power Aetheria skeleton and pressure budgets 1, 4, 8, and 32 with real provider diff --git a/notes/ghostlight-current-system-map.md b/notes/ghostlight-current-system-map.md index ccb11dd..8b6ae13 100644 --- a/notes/ghostlight-current-system-map.md +++ b/notes/ghostlight-current-system-map.md @@ -715,8 +715,8 @@ until their verified expiry. Campaign access always comes from auth store is frozen rollback evidence and does not participate in admission. That boundary also projects less state outward than the kernel returns inward. -Player HTTP responses contain only assessment, public commit/roll receipts, and -narration. Canonical campaign state and spoiler-bearing actor or institution +Player command responses contain only assessment and public commit/roll +receipts. Canonical campaign state and spoiler-bearing actor or institution state are operator-only. Informational rolls add only their exact previewed finding to the acting character and a provisional branch fact. The assessor deterministically binds typed findings into visible stakes before validation, @@ -726,12 +726,13 @@ before generation. Only direct-seed source text enters causal world compilation; background and excluded sources remain coverage provenance and cannot donate story incidents or cast. -Player-facing narration is a verified projection. Pro drafts from the latest -causal committed turn; an independent Flash stage checks the draft against the -same actor-filtered state and returns either that exact draft or a minimal -grounded correction. Both receipts bind the published projection. Narration -cannot reverse the committed outcome band or invent locations, objects, -participants, or discoveries merely because they make prettier prose. +The player-facing story is the chronological lowering of exact committed +`NarrativeTurn` rows. Player speech, Persona speech, and resolved outcome prose +already enter the transcript through the kernel transaction that owns their +revision. The surface does not run a second narrator or verifier model, replace +world turns, or read historical `narration_projection.v1` rows. This removes two +calls per live turn and makes display-layer invention of names, dialogue, +injuries, participants, or actions structurally impossible. `ghostlight-campaign-inspect` is a read-only typed-store witness. It reports the latest strategic cover, attributed appraisals and inactions, activity outcomes, diff --git a/notes/ghostlight-implementation-plan.md b/notes/ghostlight-implementation-plan.md index 4f89716..a19c403 100644 --- a/notes/ghostlight-implementation-plan.md +++ b/notes/ghostlight-implementation-plan.md @@ -17,7 +17,7 @@ consequence authority. The hosted runtime owns persistent DM-led Session Zero, exact VoidBot evidence, campaign mailboxes, fiction-first d20 resolution, parallel Persona appraisal, -narration, reversible gestalt materialization, actor-bound membership, +exact committed story projection, reversible gestalt materialization, actor-bound membership, CultMesh/Eve publication, and away-time scheduling. One to eight authenticated players negotiate one shared contract and private character states before the host can atomically publish an unanimously approved seed. Strategic ticks now project six-axis @@ -115,7 +115,8 @@ must name the exact finding they commit, which the runtime binds into the player-visible stake before validation; and player HTTP command responses are spoiler-safe projections rather than serialized campaigns. The browser renders these projections as labeled, escaped human-readable controls, -and narration receives only the latest causal turn rather than a route dump. + and the player story lowers exact committed transcript turns without a + generative rewrite. World transition authority is now a closed semantic mutation algebra rather than four empirical effect universes. Foreground attempts, NPC initiative, diff --git a/state/map.yaml b/state/map.yaml index b6d75d2..4579849 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -76,6 +76,7 @@ live_architecture: - The mutation reducer validates a complete batch against an exact authority envelope on an isolated component overlay, advances each touched subject version once, and persists component state, authority, batch, mutation receipt, causal receipt, events, and aggregate compatibility projection atomically. Aggregate campaign rows are rejected by component-only mutation ingress. - WorldEffectDelta, ActorStateDelta, and StrategicOutcomeEffect are model-boundary migration inputs, not independent writers. Bounded region expansion lowers through typed place/proposition admission and topology mutations. Initial publication is a fresh-store creation transaction; named-person materialisation/folding is a resolution transaction that advances revision and resolution epoch, clears the cover, preserves the individual delta, and cannot rewrite Gestalt-wide knowledge, custody, pressure, or fictional time. - Ghostlight owns generalized Projector to Persona to Interpreter machinery; consuming Personas retain their own canonical minds and commit authority. + - The hosted player story is the chronological lowering of exact committed NarrativeTurn rows. No narrator or verifier model rewrites those turns; historical narration projections are inert and never enter Eve or CultMesh player surfaces. - Epiphany consumes the extracted Ghostlight projection crate at an exact Git revision while retaining her canonical Mind, effect admission, and consequence authority. - Gestalt Personas own shared population state; first-relevance individuation and later folding are revisioned WorldKernel commits, and durable member deltas preserve specific people between appearances. - The multiresolution agency graph derives a connected cohesive/arena cell cover from canonical actors, institutions, and gestalt leaves under a campaign-selected 1–128 pooled entitlement budget; provider concurrency is separate.