INTRO
Dungeons & Datasets is a D&D campaign built to run unattended. AI models play the party and the dungeon master, and a deterministic 5e-light rules engine decides what happens. A player model chooses its action from the engine's menu or proposes an improvised one for the DM model to rule on, and every state change is an engine action, checked against the legal actions first.
The live page is the first milestone: the engine running in the browser, replaying one seeded combat. The rest is built in the same repository: the orchestrator that seats the models, per-player knowledge, the recorder and the spend ledger, and the station that streams beats over a WebSocket. The orchestrated show has played full episodes on a private server, and no public page shows it yet.
SECTION
The engine decides, the models play
The engine is seeded and deterministic, built on monster, class and condition data from the SRD. The engine package has no Math.random, Date or IO imports, and a lint rule enforces that, so a seed fixes the whole fight. When the live page shipped, seed 1 hashed its event log to 6560c7b62dc1642d in Node, the browser build replaying the same seed produced the same hash, and the deployed page still prints it. Later rule changes re-pinned that hash twice, each with its reason written beside the test. The live page is that replay: a static page that runs the engine in the browser and plays one seeded combat, with URL parameters for the seed, the encounter and a jump to the final state. No model takes part in it.

SECTION
Each player knows only what it knows
Each player's prompt is built only from that player's knowledge, and there is no shared world view. Its list of what it knows holds background facts from its character sheet and the monster lore, the reveals the DM's rulings addressed to it, and its own memory summary, one line per fact with the source of each. A DM ruling can reveal a fact to one player, and only that player's window shows it. A player who is down sees nothing that happens until it gets back up, only a note of how long it was out. Every line a model writes is sized for a speech bar under the speaker's portrait: each kind of line has a word cap, and every prompt says so. Reactions, huddles and interjections fire on deterministic triggers. A critical hit, a natural 1 or a party member going down opens a reaction. A huddle can follow the opening, or a round in which a party member went down or the party is losing. An interjection window opens only when a teammate knows something about the declared target that the actor does not, or when the action is an attack on the boss or an improvised use of a risky prop.

SECTION
Every model call is recorded and priced
Every model call is keyed by the sha256 of the model and the canonical request: role, messages, wire schema, token limit and effort. Outside show mode a recorded call replays at $0, and a changed prompt makes a new key, so only the calls that changed go live. Development runs default to the cheapest mode that exercises the code under test, from sim, which makes no model calls at all, up to show, which has to be typed. A daily ledger records one entry per live call and a $0 entry per replay. Before every live call the ledger is checked against the daily ceiling, $2.00 by default outside show. At the ceiling the call is refused, the encounter finishes on its fallbacks and the run exits with a partial report. Every run reports its calls by type, live against replayed, with the tokens and the spend.
SECTION
Built to run unattended
Every transcript entry is a beat with a sequence number per campaign, appended at once to beats.jsonl, and a restart continues from the last line. Browsers read the beats over a WebSocket: a client that reconnects with the last sequence number it saw gets every beat after it, from a ring buffer or from the file, then the live stream. The station writes a checkpoint before it appends the step's beats and before playback, atomically and with a sha256 per file, so a torn write is never loaded. On boot it rolls a half-written step forward and plays the beats that were generated but never played. A soak runs the Docker image with five reconnecting clients, kills the node process inside the container partway through and asserts the restart, gapless client streams and a check of the campaign data. The station has also run 24 hours unattended on a server in sim mode, with one forced crash mid-episode, and the campaign check passed on the beats it wrote.
OUTCOME
The engine also runs as an MCP server over stdio with six tools: new_combat, legal_actions, act, state, log and run_to_end. Combats are held in memory by id, so an agent such as Claude Code can start a fight, list the legal actions, act and read the log. A test drives a full combat through the tools and checks that its log equals the engine's direct log for the same seed.
