Run strategic politics across sustained waves

This commit is contained in:
Meta Vens 2026-08-27 02:13:11 +02:00
commit 80ad2593ff
5 changed files with 265 additions and 105 deletions

View file

@ -21,6 +21,9 @@ async fn main() -> anyhow::Result<()> {
"The sovereign deep-hold diverted the White Root aquifer. Two tithe caravans have vanished, the charcoal guilds threaten secession, and somebody pawned the regent's rain seal."
.into()
});
let wave_count = bounded_environment_usize("GHOSTLIGHT_STRATEGIC_WAVES", 1, 1, 8)?;
let max_rejected_pulses_per_wave =
bounded_environment_usize("GHOSTLIGHT_STRATEGIC_MAX_REJECTED_PULSES_PER_WAVE", 2, 0, 4)?;
let root = std::env::var_os("GHOSTLIGHT_LIVE_FIRE_RESULT_ROOT")
.map(PathBuf::from)
.unwrap_or_else(|| {
@ -43,9 +46,7 @@ async fn main() -> anyhow::Result<()> {
location_ids: vec!["depot".into(), "yard".into()],
public_channels: vec!["root-wire broadsheet".into()],
});
let player_location = campaign.actors[&campaign.player_actor_id]
.location_id
.clone();
let player_before = campaign.actors[&campaign.player_actor_id].clone();
let store = CampaignStore::open(root.join("campaign.cc"))?;
store.create_unadmitted_fixture_campaign(&campaign, &[], &[])?;
let model = model_selection.open()?.ok_or_else(|| {
@ -55,107 +56,237 @@ async fn main() -> anyhow::Result<()> {
model_selection.credential_path.display()
)
})?;
let newspaper_title = std::env::var("GHOSTLIGHT_STRATEGIC_NEWSPAPER_TITLE")
.unwrap_or_else(|_| "The Underdeep Clarion".into());
let started = Instant::now();
let output = propose_resolution_wave(
model,
Arc::new(SnapshotPermit::new_resolution(
store.clone(),
campaign.id,
campaign.revision,
campaign.resolution_policy.resolution_epoch,
)),
&campaign,
)
.await?;
let plan = ghostlight_dungeon::resolution::validate_and_resolve_wave(&campaign, &output.wave)?;
let material_activity_outcomes = plan
.activity_outcomes
.iter()
.filter(|outcome| {
!matches!(
outcome.effect,
ghostlight_dungeon::domain::StrategicOutcomeEffect::NoMaterialChange { .. }
let kernel = WorldKernel::start(store.clone());
let mut wave_reports = Vec::with_capacity(wave_count);
for wave_index in 1..=wave_count {
let previous_news_count = campaign.news.len();
let mut rejected_pulses = Vec::new();
let output = loop {
match propose_resolution_wave(
model.clone(),
Arc::new(SnapshotPermit::new_resolution(
store.clone(),
campaign.id,
campaign.revision,
campaign.resolution_policy.resolution_epoch,
)),
&campaign,
)
})
.count();
if plan.institution_actions.is_empty()
&& plan.gestalt_actions.is_empty()
&& plan.gestalt_migrations.is_empty()
&& plan.actor_moves.is_empty()
&& plan.member_migrations.is_empty()
&& material_activity_outcomes == 0
{
anyhow::bail!(
"strategic model resolved no material offscreen change: direct transitions were empty and every selected activity outcome was no_material_change"
);
}
for stage in &output.stages {
store.insert(
"persona_stage_receipt.v1",
"ghostlight.persona_stage_receipt.v1",
stage.receipt.storage_key(),
&stage.receipt,
.await
{
Ok(output) => break output,
Err(error) if rejected_pulses.len() < max_rejected_pulses_per_wave => {
let pulse = rejected_pulses.len() + 1;
std::fs::write(
root.join(format!(
"wave-{wave_index:02}-rejected-pulse-{pulse:02}.txt"
)),
error.to_string(),
)?;
rejected_pulses.push(serde_json::json!({
"pulse":pulse,
"world_revision":campaign.revision,
"resolution_epoch":campaign.resolution_policy.resolution_epoch,
"error":error.to_string(),
}));
}
Err(error) => return Err(error),
}
};
std::fs::write(
root.join(format!("wave-{wave_index:02}-preflight.json")),
serde_json::to_vec_pretty(&serde_json::json!({
"wave_index":wave_index,
"world_revision":campaign.revision,
"resolution_epoch":campaign.resolution_policy.resolution_epoch,
"cover":&output.wave.cover,
"appraisals":&output.wave.appraisals,
"activity_outcomes":&output.wave.activity_outcomes,
"private_cell_traces":&output.private_cell_traces,
"model_stage_receipts":output.stages.iter().map(|stage|&stage.receipt).collect::<Vec<_>>(),
"rejected_pulses":&rejected_pulses,
}))?,
)?;
let plan =
ghostlight_dungeon::resolution::validate_and_resolve_wave(&campaign, &output.wave)?;
let material_activity_outcomes = plan
.activity_outcomes
.iter()
.filter(|outcome| {
!matches!(
outcome.effect,
ghostlight_dungeon::domain::StrategicOutcomeEffect::NoMaterialChange { .. }
)
})
.count();
if plan.institution_actions.is_empty()
&& plan.gestalt_actions.is_empty()
&& plan.gestalt_migrations.is_empty()
&& plan.actor_moves.is_empty()
&& plan.member_migrations.is_empty()
&& material_activity_outcomes == 0
{
anyhow::bail!(
"strategic wave {wave_index} resolved no material offscreen change: direct transitions were empty and every selected activity outcome was no_material_change"
);
}
for stage in &output.stages {
store.insert(
"persona_stage_receipt.v1",
"ghostlight.persona_stage_receipt.v1",
stage.receipt.storage_key(),
&stage.receipt,
)?;
}
let committed = kernel
.command(WorldCommand::AdvanceStrategicTick {
expected_revision: campaign.revision,
source: TickSource::Scheduler,
plan: None,
model_receipt_hash: Some(output.aggregate_receipt_hash.clone()),
resolution_wave: Some(output.wave.clone()),
})
.await?;
let CommandResult::Committed {
campaign: advanced, ..
} = &committed
else {
anyhow::bail!("strategic wave {wave_index} did not commit")
};
if advanced.actors[&advanced.player_actor_id] != player_before {
anyhow::bail!("strategic wave {wave_index} puppeted the absent player")
}
let mut issue_campaign = advanced.clone();
issue_campaign.news = advanced.news[previous_news_count..].to_vec();
if issue_campaign.news.is_empty() {
anyhow::bail!("strategic wave {wave_index} produced no gated news")
}
let issue = ghostlight_dungeon::newspaper::compose_world_newspaper(
&issue_campaign,
format!("{newspaper_title} — Issue {wave_index}"),
24,
)?;
let issue_path = root.join(format!("newspaper-wave-{wave_index:02}.md"));
std::fs::write(
&issue_path,
ghostlight_dungeon::newspaper::render_world_newspaper_markdown(&issue),
)?;
wave_reports.push(serde_json::json!({
"wave_index":wave_index,
"elapsed_seconds":started.elapsed().as_secs_f64(),
"world_revision_before":campaign.revision,
"world_revision_after":advanced.revision,
"model_receipt_hash":output.aggregate_receipt_hash,
"model_stage_receipts":output.stages.iter().map(|stage|&stage.receipt).collect::<Vec<_>>(),
"rejected_pulses":rejected_pulses,
"plan":plan,
"commit":committed,
"issue":issue,
"issue_path":issue_path,
}));
campaign = advanced.clone();
std::fs::write(
root.join("status.json"),
serde_json::to_vec_pretty(&serde_json::json!({
"schema":"ghostlight.live_strategic_smoke_status.v1",
"state":"running",
"waves_completed":wave_index,
"waves_requested":wave_count,
"world_revision":campaign.revision,
"event_count":campaign.events.len(),
"news_count":campaign.news.len(),
"updated_at":Utc::now(),
}))?,
)?;
}
let kernel = WorldKernel::start(store.clone());
let committed = kernel
.command(WorldCommand::AdvanceStrategicTick {
expected_revision: 0,
source: TickSource::Scheduler,
plan: None,
model_receipt_hash: Some(output.aggregate_receipt_hash.clone()),
resolution_wave: Some(output.wave.clone()),
})
.await?;
let CommandResult::Committed {
campaign: advanced, ..
} = &committed
else {
anyhow::bail!("strategic command did not commit")
};
if advanced.actors[&advanced.player_actor_id].location_id != player_location {
anyhow::bail!("strategic tick puppeted the absent player")
}
if advanced.news.is_empty() {
anyhow::bail!("accessible offscreen events produced no gated news")
}
let newspaper = ghostlight_dungeon::newspaper::compose_world_newspaper(
advanced,
std::env::var("GHOSTLIGHT_STRATEGIC_NEWSPAPER_TITLE")
.unwrap_or_else(|_| "The Underdeep Clarion".into()),
24,
&campaign,
&newspaper_title,
wave_count.saturating_mul(24),
)?;
let newspaper_path = root.join("newspaper.md");
std::fs::write(
&newspaper_path,
ghostlight_dungeon::newspaper::render_world_newspaper_markdown(&newspaper),
)?;
let first_plan = wave_reports[0]["plan"].clone();
let first_commit = wave_reports[0]["commit"].clone();
let first_model_receipt_hash = wave_reports[0]["model_receipt_hash"].clone();
let model_stage_receipts = wave_reports
.iter()
.flat_map(|wave| {
wave["model_stage_receipts"]
.as_array()
.into_iter()
.flatten()
.cloned()
})
.collect::<Vec<_>>();
let result = serde_json::json!({
"schema":"ghostlight.live_strategic_smoke.v1",
"schema":"ghostlight.live_strategic_smoke.v2",
"scenario_id":scenario_id,
"pressure":pressure,
"wave_count":wave_count,
"campaign_id":campaign.id,
"elapsed_seconds":started.elapsed().as_secs_f64(),
"model_runtime":model_selection.status("configured"),
"model_receipt_hash":output.aggregate_receipt_hash,
"model_stage_receipts":output.stages.iter().map(|stage|&stage.receipt).collect::<Vec<_>>(),
"plan":plan,
"event_count":advanced.events.len(),
"news_count":advanced.news.len(),
"model_receipt_hash":first_model_receipt_hash,
"model_stage_receipts":model_stage_receipts,
"plan":first_plan,
"commit":first_commit,
"waves":wave_reports,
"event_count":campaign.events.len(),
"news_count":campaign.news.len(),
"newspaper":newspaper,
"newspaper_path":newspaper_path,
"player_location_unchanged":true,
"commit":committed,
"player_state_unchanged":true,
"store":root.join("campaign.cc")
});
std::fs::write(
root.join("result.json"),
serde_json::to_vec_pretty(&result)?,
)?;
std::fs::write(
root.join("status.json"),
serde_json::to_vec_pretty(&serde_json::json!({
"schema":"ghostlight.live_strategic_smoke_status.v1",
"state":"complete",
"waves_completed":wave_count,
"waves_requested":wave_count,
"world_revision":campaign.revision,
"event_count":campaign.events.len(),
"news_count":campaign.news.len(),
"updated_at":Utc::now(),
"result_path":root.join("result.json"),
"newspaper_path":&newspaper_path,
}))?,
)?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}
fn bounded_environment_usize(
name: &str,
default: usize,
minimum: usize,
maximum: usize,
) -> anyhow::Result<usize> {
let value = std::env::var(name)
.ok()
.map(|value| value.parse::<usize>())
.transpose()
.map_err(|error| anyhow::anyhow!("{name} is not an integer: {error}"))?
.unwrap_or(default);
if !(minimum..=maximum).contains(&value) {
anyhow::bail!("{name} must be between {minimum} and {maximum}")
}
Ok(value)
}
fn default_runtime_root() -> std::path::PathBuf {
#[cfg(windows)]
{

View file

@ -1340,7 +1340,7 @@ fn execute(
id: format!("news:{}:{}", event.id, stable_channel_id(channel)),
at: campaign.world_time,
channel: channel.clone(),
headline: event.summary.clone(),
headline: crate::newspaper::committed_event_headline(&event.summary),
event_ids: vec![event.id.clone()],
reliability: "committed public channel".into(),
});

View file

@ -28,6 +28,29 @@ pub struct WorldNewspaperArticle {
pub event_ids: Vec<String>,
}
pub fn committed_event_headline(summary: &str) -> String {
const MAX_HEADLINE_CHARS: usize = 96;
let summary = summary.trim();
if summary.chars().count() <= MAX_HEADLINE_CHARS {
return summary.to_owned();
}
let mut headline = summary.chars().take(MAX_HEADLINE_CHARS).collect::<String>();
let semantic_cut = headline
.rfind(|character: char| matches!(character, ';' | ':' | ',' | '—'))
.filter(|cut| *cut >= MAX_HEADLINE_CHARS / 2);
let word_cut = headline
.rfind(char::is_whitespace)
.filter(|cut| *cut >= MAX_HEADLINE_CHARS / 2);
if let Some(cut) = semantic_cut.or(word_cut) {
headline.truncate(cut);
}
headline = headline
.trim_end_matches(|character: char| character.is_whitespace() || character == '.')
.to_owned();
headline.push('…');
headline
}
pub fn compose_world_newspaper(
campaign: &Campaign,
title: impl Into<String>,
@ -218,4 +241,18 @@ mod tests {
let error = compose_world_newspaper(&campaign, "The Clarion", 8).unwrap_err();
assert!(error.to_string().contains("unknown event"));
}
#[test]
fn committed_event_headline_is_a_bounded_prefix_not_a_second_story() {
let summary = "The Mossglass Regency opens the rain-seal reliquary before the full assembly, admits that the seal is missing, and accuses three caravan clerks who disappeared before dawn.";
let headline = committed_event_headline(summary);
assert!(summary.starts_with(headline.trim_end_matches('…')));
assert!(headline.ends_with('…'));
assert!(headline.chars().count() <= 97);
assert_ne!(headline, summary);
assert_eq!(
committed_event_headline("The seal is gone."),
"The seal is gone."
);
}
}

View file

@ -463,37 +463,29 @@ action-bound named person can emerge publicly, retain identity, enter the next
resolution cover, and act from her own authority. The generated newspaper
contains her public appointment but does not expose her later private movement.
The completed Codex Connector-backed Rainless Marches witness used exact
Ghostlight source `8940efca0ff669f4681c99a7ff371fa8f0b76516`, connector
`2f29b90eebd8fc1bbdc07cdd22ac4883f16849a5`, `gpt-5.6-luna`, and admitted
caller `ghostlight-dungeon-yggdrasil`. The 65.2456-second run selected four
actions across four cell pipelines and 22 stages; one semantic-invalid verifier
result corrected validly. It committed two institution actions, one actor
communication, one Gestalt communication, two outcomes, six events, and five
newspaper articles; `thornweald-assembly-convenor` emerged and materialized;
the player remained unchanged. Local witnesses:
`F:\GameCult\GhostlightDungeon\acceptance\rainless-codex-20260827\{result.json,newspaper.md,campaign.cc,SHA256SUMS}`.
Remote witnesses:
`/var/lib/gamecult/ghostlight-dungeon/acceptance/rainless-codex-20260827/`.
SHA-256: result
`964a306287da03c7c92f41eb025d8049c63673e2dd8e1bffdd29490fe61315c5`;
newspaper
`6577b4abea3cc5e9ddd625676c3b4728d1dd8b25e3974f2f5112dc4dafd076ca`;
campaign
`dd19ee14e2a014a02cf142ebcbde224e3034f2e11a4f34721ef00471005c6569`;
binary
`35e62eb71d0ead30e7e7aa860b04e7757e6f3d9f83b034f8fee6bc06cc38332f`.
The earlier DeepSeek 402 remains historical route evidence, not a current
blocker.
The accepted one-revision Rainless Marches provider baseline is recorded in
`state/evidence.jsonl` and
`F:\GameCult\GhostlightDungeon\acceptance\rainless-codex-20260827\SHA256SUMS`.
It proves provider routing, one valid semantic correction, atomic world commit,
five provenance-bound articles, and one named emergence with player state
unchanged. It does not prove sustained political evolution or editorially
distinct prose: all five rendered articles repeat their headline as their body.
1. Have the game-side adapter lower its authored hierarchy into the published
1. Define and run a bounded multi-revision Codex-backed political acceptance
with recurring named figures, evolving institutional consequences, exact
public provenance, and player-owned truth unchanged.
2. Independently review successive newspaper artifacts for political
continuity, useful distinction between developments, and editorial interest.
Newspaper presentation may interpret committed public evidence but may not
invent canonical facts.
3. Have the game-side adapter lower its authored hierarchy into the published
generic schemas; keep projection and economy translation consumer-owned.
2. Prove one consumer-owned effect crosses that public API, changes two foreign
4. Prove one consumer-owned effect crosses that public API, changes two foreign
political layers, causes one durable named figure to emerge and later act,
and returns attributed news or intent without mutating Delvehold-owned truth.
3. Leave the unpublished Mars seed and Kalsa refuge expansion unapproved unless
5. Leave the unpublished Mars seed and Kalsa refuge expansion unapproved unless
the operator explicitly admits either; retain Kalsa as regression evidence.
4. Keep `gamecult-ops` synchronized with every executable deployment and model
6. Keep `gamecult-ops` synchronized with every executable deployment and model
transport change. Use Idunn on Yggdrasil for all builds and deployments.
Do not weaken actor custody, private projection, unanimous approval,

View file

@ -200,7 +200,7 @@ active_subgoals:
- Keep the selectable Kalsa Vault's Public player-safe and Spoilers GM-only evidence lanes intact through Git/Obsidian sync, retrieval, exact receipts, and player projection. Do not import it into the read-only Aetheria recovery index or create a rival Ghostlight semantic index.
- Grow the 36-case candidate agency corpus toward 300 reviewed, behaviorally distinct attempts that either compose from existing primitives, produce an explicit bargain, or falsify the algebra.
- Pressure live campaign compilation and play from exact Vault evidence; reject honest gaps instead of borrowing a nearby fixture, cast, or geography.
- Retain the completed Codex Connector-backed sparse-world, iterative-civic, emergence, and five-article newspaper run as provider regression evidence; next pressure longer political horizons and the Delvehold-owned adapter without adding consumer-specific Ghostlight paths.
- Retain the completed one-revision Codex Connector-backed sparse-world and five-article run as provider regression evidence; next prove sustained political continuity and independently reviewed newspaper quality across multiple committed revisions without adding consumer-specific Ghostlight paths.
- Optimize stable-prefix cache reuse and work per token without removing context needed for goals, promises, relationships, knowledge, or exact permissions.
- Keep every model stage proposal-only; malformed, stale, cross-slice, or semantically invalid waves must leave campaign state and fictional time unchanged.
- Complete separate-account co-op privacy, actor-binding, unanimity, and restart proof when suitable testers or controlled account fixtures are available.
@ -323,6 +323,6 @@ data_flow:
- If state grows faster than understanding, cut it back.
current_status:
summary: Ghostlight's generic consumer boundary admits sparse WorldSeeds without forged civic runtime state, validates externally owned subject snapshots against the resulting world, runs the same hundreds-class parallel cell machinery used by Dungeon, and exposes an authority-gated newspaper projection over committed NewsIssue rows whose exact cited Events expose the same public channel. Headlines, channel, and reliability come from committed news state; article bodies, datelines, and event provenance come from the cited committed events. Sparse inhabited places compile a versioned civic apparatus and later passes deepen that exact apparatus. Local acceptance proves 1,000 subjects across 200 concurrently dispatched cells, two-wave durable named-person emergence and action, nonempty consumer newspaper provenance, semantic civic receipt binding, and continuing public civic knowledge. The provider-backed Rainless Marches run completed against exact Ghostlight source 8940efca0ff669f4681c99a7ff371fa8f0b76516 through Codex Connector release 2f29b90eebd8fc1bbdc07cdd22ac4883f16849a5 using gpt-5.6-luna and admitted caller ghostlight-dungeon-yggdrasil. In 65.2456 seconds, four cell pipelines selected four actions across 22 stages, recovered one semantic-invalid verifier result through a valid correction, and committed two institution actions, one actor communication, one Gestalt communication, two activity outcomes, six events, and five NewsIssue-backed newspaper articles while leaving the player unchanged. Named figure thornweald-assembly-convenor emerged and materialized. Witness: F:\GameCult\GhostlightDungeon\acceptance\rainless-codex-20260827\result.json; result SHA-256 964a306287da03c7c92f41eb025d8049c63673e2dd8e1bffdd29490fe61315c5, newspaper 6577b4abea3cc5e9ddd625676c3b4728d1dd8b25e3974f2f5112dc4dafd076ca, campaign dd19ee14e2a014a02cf142ebcbde224e3034f2e11a4f34721ef00471005c6569, binary 35e62eb71d0ead30e7e7aa860b04e7757e6f3d9f83b034f8fee6bc06cc38332f. Yggdrasil still serves immutable Ghostlight release fdb6352e0dfdd0eeb129020ea9dea0b6225eccf9; Dungeon play remains regression pressure, and unpublished Mars and Kalsa destination previews remain unapproved.
next_action: Use the completed Codex Connector-backed Rainless Marches sparse-world/newspaper witness as the provider regression baseline. Next let the Delvehold-owned adapter lower its authored hierarchy and Greathold boundary through the published generic schemas, then prove admitted Greathold effects change independent foreign political layers and return exact attributed proposals without mutating Delvehold-owned truth. Continue adversarial single-player Dungeon play as regression pressure; preserve provider identity, semantic-correction receipts, and exact event/news provenance.
summary: Ghostlight's generic consumer boundary admits sparse WorldSeeds without forged civic runtime state, validates externally owned subject snapshots against the resulting world, runs the same hundreds-class parallel cell machinery used by Dungeon, and exposes an authority-gated newspaper projection over committed NewsIssue rows whose exact cited Events expose the same public channel. Headlines, channel, and reliability come from committed news state; article bodies, datelines, and event provenance come from the cited committed events. Sparse inhabited places compile a versioned civic apparatus and later passes deepen that exact apparatus. Local acceptance proves 1,000 subjects across 200 concurrently dispatched cells, two-wave durable named-person emergence and action, nonempty consumer newspaper provenance, semantic civic receipt binding, and continuing public civic knowledge. The one-revision provider-backed Rainless Marches baseline completed against Ghostlight source 8940efca0ff669f4681c99a7ff371fa8f0b76516 through Codex Connector 2f29b90eebd8fc1bbdc07cdd22ac4883f16849a5 using gpt-5.6-luna; it committed five provenance-bound articles and one named emergence while leaving player state unchanged. Full stage receipts, counts, paths, and hashes live in the accepted evidence record and F:\GameCult\GhostlightDungeon\acceptance\rainless-codex-20260827\SHA256SUMS. This baseline proves provider routing, semantic correction, and atomic public-news projection; it does not prove sustained political evolution or editorially distinct newspaper prose. Yggdrasil still serves immutable Ghostlight release fdb6352e0dfdd0eeb129020ea9dea0b6225eccf9; Dungeon play remains regression pressure, and unpublished Mars and Kalsa destination previews remain unapproved.
next_action: Use the accepted one-revision Rainless witness as the provider baseline. Next define and execute a bounded multi-revision Codex-backed newspaper acceptance. Require recurring named figures and institutions to carry consequences forward, exact event/news provenance, unchanged player-owned truth, and independent artifact review of whether successive issues are politically legible, non-redundant, and worth reading. Do not use headline/body inequality as a proxy for editorial quality or let newspaper presentation invent world facts. Preserve provider identity and semantic-correction receipts.
gestalt_population: Gestalt Personas own shared population baselines; persistent member deltas own named individuality; WorldKernel materialization and approval-gated fission preserve lineage and identity. Materialisation/folding changes only representation and the exact member delta, advances resolution epoch, and retires the old cover; it has no Gestalt-wide effect authority. Selected actionable member exceptions are mandatory Projector perspective owners, so aggregation cannot silently erase their decision. Presence projection is limited to nearby active leaves and exact-location dormant members, includes reciprocal player relationship evidence, and may propose an earned cast without committing it. Simulation cells are derived covers only.