17 KiB
GhostlightDungeon MVP — Starfire-Hosted AI Dungeon Master
Summary
Build GhostlightDungeon inside GameCult/Ghostlight: a persistent, Vault-grounded, single-player narrative simulation with a private web chat interface for two testers.
The runtime will be a Rust daemon on Starfire. It will own world compilation, typed CultCache state, d20 resolution, NPC Persona loops, offscreen simulation, narration, and Eve/CultUI publication. A thin TypeScript browser client will lower the Eve surface and submit typed commands.
Ghostlight’s existing v0 schemas and training fixtures remain evidence and regression material; they do not become runtime authorities.
Authority and invariants
- The per-campaign
WorldKernelis the sole owner of canonical state and revision numbers. - Player commands, NPC actions, scheduled ticks, travel, waits, imports, and reloads all enter the same
WorldCommand → validate → atomic commitpath. - Projectors, Personas, Interpreters, retrieval, initiative, narration, news generation, dice previews, and the browser may propose or project state; none may commit it.
- Scenes are derived from persistent occupancy, topology, perception, and current events. Leaving a location does not delete it.
- RAG evidence remains owned by the Vault provider. For Aetheria, Ghostlight consumes VoidBot’s canonical retrieval service and stores only exact evidence receipts used by each campaign—never a rival semantic index.
- Every campaign branches from canon at creation. Later historical records describe the baseline trajectory, not an outcome the player must be railroaded into.
- Improvised facts are explicitly branch-local. Broadly useful gaps become reviewable canon candidates, never silent Vault edits.
- Player text describes an attempt, not a completed fact. Impossible actions do not receive a roll.
- Model failures, malformed outputs, stale projections, or retrieval outages produce no partial world mutation.
Implementation changes
Runtime and persistence
- Add a Rust 2024 workspace using Tokio/Axum, the Rust CultCache/redb backend, CultMesh/CultNet publication, and a provider-neutral model port.
- Store service state under
F:\GameCult\GhostlightDungeon:- service/control and schema catalog
.cc; - one row-oriented
.ccstore per campaign; - exact Vault evidence receipts;
- private model-stage records and commit receipts;
- exported campaign and canon-candidate bundles.
- service/control and schema catalog
- Route all writers through an in-process campaign mailbox. Background ticks and HTTP commands cannot race or repair each other afterward.
- Publish the player surface, operator inspector, health, scheduler pressure, model receipts, and command results through CultMesh/Eve. HTTP health remains a probe of that state, not separate truth.
Vault and world compiler
- Define a generic
VaultProvidercontract for source search, surrounding context, source witnesses, authority lanes, temporal scope, and exact-document retrieval. - Implement the bundled Aetheria adapter against VoidBot’s streamable MCP endpoint at Starfire loopback.
- At campaign creation:
- Retrieve broad Aetheria evidence and generate three distinct suggested openings across different eras, places, and pressures.
- For the selected opening, generate three source-grounded player roles plus a custom-role path.
- Alternatively compile a fully custom who/where/when/goal description.
- Produce an approval preview containing the initial topology, cast, institutions, capabilities, clocks, evidence coverage, gaps, and branch-local assumptions.
- Commit only after approval.
- Materialize a bounded playable region and surrounding institutional pressure graph, not the entire universe. New destinations compile on demand and attach to stable containment, route, distance, and travel-time records.
- Automatically improvise reversible local texture as provisional branch fact. Material gaps in geography, mechanics, institutions, or extraordinary abilities require approval before the world seed or action is admitted.
- Store useful gaps as
CanonCandidaterecords with originating campaign, evidence, conflicts, proposed wording, and affected Vault sources. The lab can review and export Markdown plus.ccevidence; it cannot edit AetheriaLore or open PRs.
Persona and world action loop
Population scaling uses reversible gestalt materialization. A crowd, village, crew, or corporation may act offscreen through one gestalt Persona. When a specific member becomes relevant, the WorldKernel materializes an individual from the gestalt baseline plus a persistent member delta and current scene. When relevance expires, it folds individual consequences back into that delta, admits only reviewed aggregate learning to the gestalt, and removes the active simulation slot. The member delta remains durable so returning to the person reconstructs the same individual rather than a fresh approximation.
Gestalt projection, relevance detection, and merge proposals cannot commit.
MaterializeGestaltMember and DematerializeGestaltMember use the normal
revisioned WorldCommand path. A named member's relationships, memories,
possessions, injuries, promises, and identity never become disposable gestalt
texture.
Live turns run a structured gestalt-relevance planner after the player event
and before NPC appraisal. Its atomic ReconcileGestaltPresence command can
materialize newly relevant members and fold irrelevant members back into their
persistent deltas. The planner may propose presence only; it cannot promote
population-wide learning or mutate state directly.
World compilation seeds collective populations and a bounded roster of durable member identities. Population-scale capabilities, knowledge, resources, goals, and pressures belong to the gestalt. A member record owns identity, memories, relationships, possessions, injuries, obligations, last known location, and additions to or removals from the shared baseline. Materialization is a derived composition of those two owners; the temporary actor slot owns neither source. Dematerialization deletes only that slot after atomically updating the member delta. Strategic ticks address the gestalt and its dematerialized deltas rather than iterating every member as a live Persona.
Ghostlight owns its own generalized projection machinery:
- Projector converts the actor’s permitted typed slice, memories, perceived events, relationships, goals, and retrieved knowledge into a private lived narrative stream.
- Persona receives only that narrative stream and responds naturally—no schemas, action DSL, or raw state.
- Interpreter extracts typed private deltas, explicit speech, reaction priority, and
WorldActionProposalcandidates. - WorldKernel validates spatial reach, knowledge, custody, resources, capability, opposition, and state version before committing anything.
All affected scene participants appraise a committed event in parallel. Actor-private deltas commit against their own snapshot versions; initiative then chooses compatible reactions or actions for world resolution. This ensures present characters continue perceiving and reacting even when another character currently holds conversational focus.
Canonical NPC consequence is serialized one opportunity at a time. The
deterministic initiative projection chooses the highest-priority stable winner;
BeginNpcAction verifies that exact proposal against the committed wave,
consumes its siblings, and advances the revision. The chosen NPC then traverses
the same assessment and server-side d20 path as the player without resetting
player-activity or away-time state.
Use DeepSeek’s current API directly:
deepseek-v4-flash, non-thinking: Projectors, Interpreters, retrieval planning/reranking, verification, and offscreen actors.deepseek-v4-pro, non-thinking for live work: world compilation, action assessment, live Personas, and narration.- Structured stages use JSON Output followed by local schema validation. Empty or malformed output receives one same-snapshot retry, then fails without mutation.
- Record provider, model, request hash, source receipts, latency, output hash, validation result, and state version. Never persist or display
reasoning_content.
DeepSeek currently documents both V4 model IDs, streaming, and JSON output through its OpenAI-compatible Chat Completions API. Models, Chat API, JSON Output.
Fiction-first d20 resolution
- Provide separate
AssessandAttemptcommands. Assessment never becomes visible to NPCs or changes state. - An assessment contains:
- normalized intent and intended effect;
- admissibility or the missing permission;
- DC on the 5/10/15/20/25/30 resistance scale;
- itemized contextual modifiers with state or evidence references;
- modifier total capped at ±10;
- effect ceiling;
- success, mixed-result, and failure stakes;
- campaign revision and expiring assessment digest.
- Contextual modifiers come from capabilities, knowledge, tools, access, assistance, leverage, position, opposition, injuries, and conditions. There are no base attributes.
- Confirmation checks the assessment revision, obtains a server-side OS-random d20, and atomically stores the roll receipt and world transition.
- Outcomes:
- total ≥ DC + 10: strong success;
- total ≥ DC: success;
- total within 5 below DC: mixed result;
- lower: failure with the previewed consequence.
- Natural 20/1 moves one outcome band, but cannot make an impossible action possible or exceed its effect ceiling.
- Stale assessments are recompiled rather than rebased.
- Overreach returns explicit sacrifices or bargains that could admit a new assessment.
- Speech and its intended effect are separated: the character may successfully say something while failing to persuade, deceive, or intimidate.
Every roll band carries a prevalidated WorldEffectDelta. The MVP vocabulary
can change local conditions and relationships, move the acting character over
an existing route, advance known clocks, or change a known institution's
posture. The chosen band and its delta commit atomically with the roll receipt;
stake prose alone never impersonates world mutation.
Away-time world agency
- The daemon owns a five-minute scheduler pulse. Campaigns enter away simulation after fifteen minutes without player activity.
- Each real hour awards one strategic tick, capped at eight pending ticks per absence. The compiled campaign chooses the in-world tick duration; default is six hours.
- Background simulation affects remote actors, institutions, resources, movement, bargains, investigations, preparation, recruitment, obstruction, and clocks. The absent player is never puppeted or directly harmed.
- The scheduler and return-time catch-up invoke the same
AdvanceStrategicTickcommand. Catch-up processes missed ticks before accepting the next player action. - Live play has inference priority; background work stops launching new calls while a player turn is active.
- Offscreen events generate information-channel-aware news leads. On return, the player may receive newspapers, reports, messages, or rumors only when the character has access to them; the news layer cannot reveal omniscient state.
Web laboratory and hosting
- Build the interface as a Ghostlight-owned
gamecult.eve.surface.v1document and lower it with Eve’s pinned browser renderer. - Provide:
- generated-opening and custom-start compiler;
- narrative transcript and composer;
- Assess, Attempt, confirm-roll, revise, and Wait controls;
- character ledger for capabilities, equipment, conditions, obligations, relationships, and known facts;
- location/time/pressure display;
- news and rumor drawer;
- named campaign creation, fork, reset, and
.ccexport; - optional operator inspector for evidence, topology, state versions, model receipts, rejected proposals, and private spoiler traces.
- Do not expose model chain-of-thought or secrets.
- Serve the embedded web bundle on TCP
8831. Firewall access is limited to Starfire’s private LAN and10.77.0.0/24; no public listener or Yggdrasil web gateway is added. - Use two single-use invite links that establish separate HttpOnly sessions. Campaigns are single-player; simultaneous co-op is outside the MVP.
- Install
GhostlightDungeonas an automatic Windows service under a dedicated virtual service identity. ACL the runtime root to administrators and the service identity. - Read the DeepSeek key from stdin during setup, protect it with machine-scoped DPAPI plus file ACLs, and never place it in source, arguments, logs, or environment projections.
- Build immutable release directories from the exact Git commit, switch the active release atomically, record provenance in CultCache, and configure service restart recovery.
Repository and operational documentation
- Implement on
codex/ghostlight-dungeon-mvp, with coherent foundation, runtime, interface, and deployment commits pushed to GitHub. - Add the authoritative GhostlightDungeon architecture/build document and update Ghostlight’s system map, implementation plan, handoff, state map, and evidence ledger.
- Keep Starfire service/firewall/tunnel ownership in
gamecult-ops, with a deployment and rollback runbook. - Before live VoidBot integration, resolve the current Yggdrasil inventory/DNS split and independently verify the offered SSH host fingerprint. Then repair the tunnel task’s stale
E:\Projectspath toF:\Projects, restore127.0.0.1:17875/mcp, and update ops truth. Never bypass host-key verification or revive Starfire’s retired VoidBot/Qdrant writers.
Public contracts
ghostlight.vault_manifest.v1,vault_evidence_receipt.v1,world_compile_preview.v1campaign.v1,world_fact.v1,location.v1,actor_state.v1,institution_state.v1,relationship_state.v1,world_clock.v1,event.v1player_action_assessment.v1,roll_receipt.v1,world_commit_receipt.v1persona_stage_receipt.v1,actor_state_delta.v1,world_action_proposal.v1narration_projection.v1strategic_tick.v1,news_issue.v1,canon_candidate.v1rejected_proposal_receipt.v1,campaign_lifecycle_receipt.v1gestalt_persona_state.v1,gestalt_member_delta.v1,gestalt_materialization_receipt.v1- Existing
gamecult.eve.surface.v1andgamecult.eve.command.v1
Publish JSON Schema only as the schema catalog. Runtime documents and exports use MessagePack-backed CultCache .cc; JSON exists only at browser, MCP, and model-provider boundaries.
Test and acceptance plan
- Unit-test every schema, redb/CultCache round trip, optimistic commit, topology invariant, knowledge gate, DC/modifier rule, outcome band, roll receipt, branch fact, and scheduler budget.
- Use injected clocks, RNG, Vault provider, DeepSeek transport, and persistence ports.
- Prove malformed/empty DeepSeek JSON, timeout, retrieval loss, daemon restart, stale assessment, stale Persona output, and concurrent scheduler/player commands cannot partially mutate state.
- Run existing Pallas, Lucent, and Corvid fixtures as regression scenarios, even though hosted opening suggestions are generated.
- Acceptance scenarios:
- compile an obscure Aetheria time/place or return an honest evidence-gap preview;
- leave a location, advance the world, and return to the same geometry and inhabitants;
- show reactions from every affected present actor;
- prevent an NPC from acquiring unearned knowledge or expertise;
- reject impossible action claims and offer explicit bargains;
- preview and confirm a fully receipted d20 action;
- observe institutions exploiting, resisting, or redirecting the protagonist;
- produce material offscreen changes and accessible news after absence;
- reload/fork/export a campaign without losing continuity;
- verify two invite sessions and rejection of unauthenticated access.
- Performance targets under a healthy provider:
- first progress update within 300 ms;
- all actor stages execute in parallel waves;
- a four-actor live turn completes within 20 seconds;
- background inference yields immediately to live work.
- Final deployment smoke verifies service restart, LAN and WireGuard access, blocked public access, DeepSeek inference, VoidBot-grounded retrieval, scheduler continuation, state persistence, CultMesh/Eve publication, and exact deployed commit provenance.
Assumptions and exclusions
- Aetheria is the only bundled Vault adapter, but no compiler logic is Aetheria-specific.
- Generated suggestions plus unrestricted custom compilation replace fixed featured openings.
- No D&D classes, spell slots, six-ability statistics, or 5e sheet are canonical in the MVP. The typed character ledger remains sufficient for later D&D-shaped projections.
- No arbitrary Vault upload/import UI, multiplayer campaign, voice, image generation, direct canon mutation, or public internet exposure.
- The live deployment requires a DeepSeek key and restoration of the trusted VoidBot retrieval crossing; fixture-backed development may proceed before those two setup gates.