How it works
A language model is every character's gut and the code is the physics. 46 pages on what that actually means: the model, the rules it answers into, the economy, and the machinery that streams one shared world to everybody watching it.
Every number on these pages is a number the running code uses. Where a figure was measured rather than chosen, the page shows the measurement.
The model
What an evaluation model is, why a simulation wants one instead of a chat model, and what a night costs.
What an evaluation model is
An evaluation model takes one shared state and a set of typed questions, and answers all of them in a single request. Each answer comes back as a full probability distribution instead of a sentence.
typesafe-ai/jev, and what Parlour uses it for
Jev is the evaluation model Parlour runs on. It answers nine typed questions per character per beat in one call, is billed on input tokens only, and costs roughly three cents for a five-minute party.
Evaluation model vs chat model
A chat model returns text you have to trust and parse. An evaluation model returns a probability per option, which is what lets a simulation put a real threshold on a decision instead of a vibe.
Typed questions: choice, score, boolean
Parlour asks three shapes of question: a choice over options, a score on ordered levels, and a boolean. The option sets are built per character per beat from the rules, so the model can only pick something legal.
Using distributions instead of picks
Because every answer is a distribution, the engine can scale an outcome by how sure a character was. A 0.95 read of an open host earns a bigger opening than a 0.55 one, so not every decision is equally committed.
The nine-question pack
Every character answers the same nine questions every beat, in one evaluation call: action, target, mask, hunger, threat, betrayal, two questions the room cares about, and what they have left afterwards.
The state object: what one character can see
Each call carries a JSON state built for one character: their own condition, the people in reach, what they can remember of the last few beats, and the arithmetic of the prize. Never the whole world, and never the rules.
Measuring a threshold instead of guessing it
To set a threshold on a model's answer, ask the same question across a ladder of hand-built situations, look at where the answers separate, and put the bar in the gap. A number picked by intuition usually sits where the model never goes.
Running it through the Vercel AI Gateway
Parlour reaches Jev through the Vercel AI Gateway with one server-side key, and reads live per-token prices from the Gateway's model catalogue, so the cost counter on screen is a real number and not a constant.
The house brain: running with no model at all
The house brain is a deterministic personality heuristic that answers the same nine questions and synthesises its own distributions, so the simulation stays watchable, and tunable, with no API key and no network.
What a live LLM simulation actually costs
A Parlour party runs five or six minutes on roughly 250–300 evaluation calls of about 3,000 input tokens each, which is three to four cents. Every watcher of a room shares one party, so the bill does not grow with the audience.
Two guard rails on a public LLM toy
Nothing ticks in a room nobody has opened. A party already under way plays to its end and then stops. A rolling hourly cap drops a room to the house brain past a fixed dollar figure.
The mechanics
Trust, heat and standing; alliances that pay; a betrayal bar that was measured; and the rules that overrule the model.
Personality as arithmetic, not flavour text
A character in Parlour is a class, meaning what they are allowed to do, plus a rig of code-level modifiers: prices halved or raised, moves forbidden, confidence floors, effects that bounce. No character has a personality paragraph.
coerce(): when the code overrules the model
coerce() is the last word on every decision. It drops forbidden actions, enforces gates and confidence floors, refuses moves the character cannot afford, and puts every override on screen in amber.
The betrayal bar, measured rather than guessed
An alliance dies when the model's P(better off without them) clears a bar: 0.42 in the pair rooms, 0.45 in the crew room. Both numbers came from asking the same question across a ladder of situations and putting the bar in the gap.
Trust, heat and standing
Three quantities carry the politics. Trust is private and pairwise, heat is how much attention is on you, standing is what the room thinks of you, and only trust can buy an alliance.
Blocs and crews: two shapes of alliance
In the pair rooms an alliance is two people who share heat and cover each other. In The Syndicate it is a crew of any size that splits a pot evenly, which turns every recruitment into a maths problem.
Why a crew may only lead by one
crewCap() stops a crew recruiting once it is two clear of the field, because without it the room finds a dull equilibrium where eleven people sit together, win every count, and each take ten chips.
Skim, settle, cooldown: making betrayal cost something
Walking out of a crew takes about fourteen chips off the people you leave, cannot be done to anyone you sat down with in the last two beats, and cannot be done twice within five. Together those put betrayal on a specific beat.
A refusal is an event
When somebody is turned down in public it costs them standing for every witness, warm people move toward them and cold people away, the room can see it on them for two beats, and the ticker names the rule that said no.
Rooms are data, physics is code
A room is a plain RoomSpec: cast, personality rigs, locations, an action menu, two room-specific questions, ticker templates. Adding one should mean adding one file and never touching the engine.
Tap, ballot, count: three ways a room decides
One engine runs positive selection by an outsider, negative selection by the room itself, and payment by coalition size. Which one a room uses inverts what every other rule in it is worth.
Two clocks: real time, not turns
Characters act on their own clocks. Each one wakes when its cadence comes round, makes its call, and moves the instant the answer lands, while the slow physics and the room's decisions run on beat boundaries.
What a beat is
A beat is the simulation's unit of slow time, fifteen seconds of wall clock and twenty or twenty-four to a party. It is the only moment at which heat cools, energy returns, trust drifts and a room makes a decision.
The village
Four hundred people, one closed economy, a brain you have to ration, and every way a village has starved.
A closed medieval economy, in real time
Two villages of about 220 people each run a complete production chain, field to mill to bakehouse and pasture to butcher, with floating market prices, daily wages, household purses, tax, tithe, and a winter every twelve days.
Four hundred agents, a few dozen guts
The village asks the model about roughly thirty people on a cadence, plus anyone at all who is facing a real choice, capped at two calls a second across the whole valley.
Calibrating against a chaos brain
Before trusting a real model with the village, every notable is fed a random whim each time they are asked. If two villages cannot survive three years of that, a real model will kill them on a bad afternoon.
Households, marriage, birth and death
The household is the unit. Everyone has parents, children, a surname, a purse and a larder; people court, marry, take a house, have twins or triplets, feud, sicken, are jailed, die, and are buried in the churchyard their kin visit on Sundays.
Land, building, and a house that grows
The village sells parcels along its lanes, and the ones nearer the green cost more. A family that buys one marks out a site the yard raises, walls first and roof at thirty timber and five stone, from hovel to house to second storey to manor.
The fever, and how it gets about
A fever is caught rather than rolled: it passes between people in the same place in the same hour, harder under a roof and harder again in a crowded one. Strangers carry it up the road, and a reeve can shut the square against it.
Who knows whom, cheaply
Every relationship is one number in a capped per-person map, written at midnight from the day's company: an evening at the same table, a shift at the same bench, a pew, a basket at the door, a fist. None of it is ever sent over the wire.
The crowd's hand
Every ninety seconds watchers are offered three things that could happen next: a fire at a named house, twins for a woman who is carrying, wolves, damp in the grain, soft rain, a pedlar, a feast. The one they pick happens.
The build
One world in memory, streamed; 3D that never feeds back; save files that are untrusted input; a year in a second.
One party in memory, streamed to everyone
A room is a single party held in server memory and streamed to every watcher, so everybody sees the same betrayal at the same moment and the model is paid for once per beat however many people are looking.
Server-sent events for a live simulation
Simulation frames go out over server-sent events, which are one-way, plain HTTP and reconnecting for free, because nothing a watcher does needs a socket and the little that does is an ordinary POST.
The 3D layer never feeds back
The browser receives zones and activities and decides everything about bodies: where they walk, which way they face, what gesture they make. Nothing in the rendering layer may write back to the simulation except a click to select.
Drawing four hundred people
The valley is a handful of instanced meshes, three for people and five for houses by tier and one for trees, with frustum culling off, world-sized bounding spheres set once, and clicks landing on invisible fat capsules.
Saving a party as one file
Save writes the whole night, full world state plus every ticker line with timestamps, as a single JSON document that reads as a transcript in any editor. Resume picks the night back up at exactly that beat.
A save file is untrusted input
parseParty rebuilds the world from createWorld and overlays only recognised fields, clamped, with every id checked against the room's own cast, locations, masks and actions. A hand-edited file may make a strange party but never a broken one.
Playing a whole world in the terminal
A party plays in the terminal with no browser and no server, and a village year plays in under a second. Both run on the same primitives as the live simulation, so a rule that works headless works live.
Why this app is pinned to one replica
The party lives in server memory and every watcher of a room shares it, so two replicas means one URL serving two different parties. railway.json pins numReplicas to 1 as a correctness constraint, not a cost saving.
Building one
The transferable half: why prompted characters converge, what to do when a simulation is flat, and what to build before you write a prompt at all.
Building an LLM simulation, in order
Write the resolution rules before you write a prompt. Build a world that plays without a model at all, replace the decision function with one, and measure every threshold against what the model actually returns.
Why eight prompted agents behave like one
Characters written as prompts converge because they are one model reading eight adjectives. Differences that survive contact with a situation have to live in the rules, in prices and gates and floors, and not in description.
Memory-stream agents and fixed decision heads
Generative-agent designs give each character a memory stream with retrieval, reflection and planning. Parlour gives everyone the same nine questions over a purpose-built state object, which is cheaper, steadier and less ambitious.
When it is boring, change the payout
A flat simulation is almost always a flat incentive. Tighten the prize, cap the dominant strategy, and give betrayal a deadline. The room here only became interesting when its payout rule changed.
Put the machine on screen
An AI product that hides its workings is asking to be taken on trust. This one shows the runners-up on every decision, every rule that overruled the model, which brain is answering, and what the session has cost so far.
What makes a simulation worth watching
One shared world instead of a private instance, a visible deadline so something is always about to happen, rules you can learn by watching them fire, and permission to walk away and come back to a story that carried on.
Looking for a single word rather than a page? The glossary defines everything this site uses in a way that is not obvious from English.