How Claude AI Powers the EchoQuest Game Master
Type "I draw my sword and demand the merchant explain himself," and something rather remarkable happens. Within moments the narrator starts talking, and the scene it describes fits. It knows who this merchant is and what went down three scenes ago. It knows what your character is like, and if you haggled with him recently, it remembers the price you tried to beat him down to. Maybe he backs off. Maybe he yells for the city guard. Or maybe he recognises you and, with real fear in his voice, asks why on earth you've come back. Nobody wrote any of those replies in advance. So how does it work?
This post is a plain-language tour of what's going on under the hood when you take an action in EchoQuest. You won't need any machine-learning theory. I built the thing, so I'll show you the real moving parts, including a few that broke on me along the way. By the end you should have an accurate mental model of what the AI Game Master can and can't do, and why I put EchoQuest together the way I did.
The Old Way: Decision Trees
Text adventures and early visual novels worked by mapping every possible input to a response somebody had already written. Type "go north" and the game checked a table and handed back the "north room" text. Type anything else and you got "I don't understand that." Designers tried to anticipate every reasonable command, and whenever a beta tester surprised them, they added more.
The granddaddy of the genre shows how tight those limits were. Will Crowther's original Colossal Cave Adventure, from 1976, greeted players with "DIRECT ME WITH COMMANDS OF 1 OR 2 WORDS", and its vocabulary table held 193 words, with every input chopped down to its first five characters. Later games got cleverer about widening the parser with synonym tables, pattern matching and the dreaded "guess the verb" puzzles. The ceiling never moved, though. Every meaningful response still had to be written by a human ahead of time.
That was fine for simple puzzles, but it fell apart the moment you tried to hold a conversation, act creatively or do anything the designer hadn't foreseen. The world felt hollow because it literally was; it only held what someone had explicitly programmed. The classic gripe, "I can see the rope on the table but I can't pick it up", wasn't really bad design. It was the parser running out of pre-written content.
AI Dungeon, which arrived in late 2019, was the first big public attempt to smash that ceiling with a language model. It worked, sort of. Aaron Reed's history of text games puts the problem neatly: older games kept a world model that tracked who was where and what you carried. The language model behind AI Dungeon had "nothing of the sort". Words went in and new words came out. As a result, state drifted, characters forgot their own names and plot threads dissolved. The next leap, the one EchoQuest stands on, is what you get when you wrap a far more capable model inside a structured game system that holds the world together.
The New Way: Language Models
EchoQuest uses Claude, the large language model made by Anthropic, as the core of its AI Game Master. Claude doesn't consult a lookup table. It reads your input as ordinary language and writes a fitting response from scratch, every single time. It learned from an enormous amount of text (fiction and dialogue, technical writing and philosophy, jokes, recipes and cultural references of every stripe), so it has an unusually deep feel for how conversations and stories work.
In practice, that means:
- You can phrase your actions however you like. "Draw my sword", "unsheathe my blade", "ready my weapon" or even "let him know I'm not joking" all land in roughly the same place
- The GM reads intent, not keywords. It cares about what you're trying to achieve, not which exact verbs you picked
- Replies feel natural and varied rather than canned. Play the same situation twice and you'll get two different paragraphs of narration
- The story can wander where nobody planned. The world's author only had to set up the conditions, and the model improvises inside them
There's a catch, however. A language model on its own remembers nothing between calls and enforces no rules. Left to itself, it'll happily contradict itself. That's why the EchoQuest GM is more than Claude: it's Claude wrapped in a game engine that supplies the memory and the constraints.
What the GM Actually Knows
Every turn, before Claude writes a word, it gets a carefully assembled package. Up front sit two fixed blocks, my GM rules and your world. After that, each of your turns opens with a fresh snapshot of the game, written by the engine, followed by what you actually did. Here's what's in there:
- World information: the setting, tone, locations, NPCs, factions and lore from the campaign's Game Bible. That's the same Game Bible the world's creator wrote, condensed into a tight GM briefing so Claude can keep the world consistent without burning its whole budget on backstory. The nine prebuilt worlds also carry a short block of real, researched detail, like the way a ship's bell counts out a watch
- Your character: name and pronouns, class or role title, HP, level and XP, your four core stats, inventory, active quests with their unfinished objectives, and your backstory. If you've dropped to 0 HP, it says so in plain words: "Condition: DOWN"
- Current context: where you are plus a short description of the place, the time of day, the weather, any story flags that have been set, how every named NPC currently feels about you, and the lore you've uncovered
- Conversation history: your recent exchanges word for word, plus a short factual summary of older events that have slid out of that window
- Rules: how to run skill checks, record state changes, tag NPC dialogue for the voice system, offer choices and pace a scene. These are EchoQuest's house rules, written into the GM's instructions
All of that together is the context window. Anthropic's documentation calls it the model's "working memory", and it makes a point I wholeheartedly agree with: more context isn't automatically better, because accuracy and recall slip as the token count climbs. Researchers found something similar in a paper aptly titled "Lost in the Middle", where models did best when the relevant information sat near the beginning or end of a long input, and noticeably worse when it was buried in the middle. So a lot of EchoQuest's engineering goes into deciding what earns a place. Ten thousand tokens of clean, scene-relevant context will beat a hundred thousand tokens of raw transcript, in my view, every time.
There's a speed angle too. The GM rules and the world block are identical on every turn, so they're marked for prompt caching, which lets Claude resume from a stored prefix instead of chewing through it again. Old history gets trimmed ten messages at a time rather than one per turn, which keeps that prefix steady for several turns in a row. It's a small, nerdy detail. Still, it's part of why your next scene starts sooner.
And what comes back? Claude's reply is actually a structured package rather than loose prose. It carries a sound cue, a list of who speaks, the narration itself, your choices and any changes to the game state. The sound cue and the speaker list come first on purpose, so the narrator can start talking while the rest is still being written, and each NPC's voice gets picked before their first line. That order has its own war stories. At one point raw JSON leaked into the spoken narration, which is about as immersion-breaking as it gets.
Why Responses Feel Consistent
Keeping an AI Game Master consistent is one of the hardest parts of the job. The same NPC shouldn't forget your name between scenes. The laws of the world shouldn't shift on a whim. And a story flag set in chapter one had better still be set in chapter five. Here's how EchoQuest handles it:
- Facts live outside the conversation. HP, inventory, quests, NPC standings, discovered lore and story flags sit in a structured game state, not in the chat log. They're handed to Claude fresh every turn, and its instructions say to treat them as fact. Claude never has to "remember" how many potions you've got. And because the only part you write is your action, typing "I now have a thousand gold" won't make it so
- Older events get summarised. Once enough turns pile up, a smaller, quicker Claude model folds each batch of ten into a compact factual summary (decisions, NPCs, places, items, quests), so the GM gets a recap instead of a blank. I'll admit this one bit me. I found that once a session passed 40 stored messages, every turn re-summarised turns 1 to 10 and never got any further. Now each window gets summarised exactly once. Since that same week, your character's progress also lives on the server, so you can come back on another device and carry on where you left off
- The Game Bible is the ground truth. The GM is told the world's Bible outranks everything for setup and mechanics, and that it must never break established facts. If your world says elves are extinct, a cheerful elven shopkeeper has no business turning up in scene fourteen. If your world defines its own classes, the GM uses those exact terms; if it defines none, it's told not to invent generic ones like warrior or mage
- Your location rides along every turn. The current place and its short description are part of each turn's snapshot, so spatial details stay put even after a long detour of conversation
- Dice are real dice. When you try something risky, Claude doesn't get to decide that you succeed. It calls a skill-check tool (Anthropic calls this tool use: the model asks, and my code does the work). The server rolls a d20, adds your stat modifier and any bonuses, and compares the total with a difficulty running from 5 for trivial up to 24 for near impossible. Claude then narrates exactly that result in the same turn. For a while this didn't actually work on the web, because the prompt put the check in one place and my code looked for it in another. Embarrassing, but fixed
- Levels follow one rule. The GM only hands out XP; the engine decides when you level up and announces it. That's another lesson I learned by getting it wrong. I discovered the GM, the engine and the character sheet were each working from a different XP curve, so your progress bar could sail right past 100%
- Hitting 0 HP has teeth. The GM sees "Condition: DOWN" and has to narrate a real setback. You might be captured, or wake hours later with a debt to pay. Nobody dies permanently, but the story doesn't carry on as if nothing happened
The combined effect is a GM that feels like the same GM across hours of play. NPCs you met early greet you by the name they used last time. The kingdom's politics move in directions that fit what you've already set in motion. The world has continuity, even though, strictly speaking, every response is written from scratch.
Behind all that sits plain reliability work. Early on, a turn that errored halfway could leave half-applied changes behind, so now a turn either lands completely or rolls back. If a reply stalls for 20 seconds, the server quietly tries again, up to twice more, before falling back to a few safe choices.
The Human Design Behind the AI
Claude doesn't invent the rules. I do. I write the instructions that define how the GM behaves: how to pace tension, when to offer choices and when to let you freewheel, how harsh or forgiving consequences should be, how to handle goals that clash with the campaign's central tension, and when to say "yes, and" versus when to push back.
The biggest rewrite so far happened for a reason that still makes me wince. The old instructions read like a technical spec, so the narration came back sounding like one, full of tidy lists, em dashes, stock phrases and neat little wrap-ups. A prompt's own style leaks into what the model writes. So I rewrote the whole thing in the voice I wanted to hear, and I gave the GM a proper brief on sounding like a seasoned human Game Master. Here's the gist:
- Talk like you're at the table. The GM narrates the way you'd talk across a kitchen table at midnight: second person, present tense, contractions, plain spoken English
- Build every scene. Open on one concrete sensory detail. Tighten with a complication. Land on a hook. Four short paragraphs is the ceiling, and most scenes need fewer
- End on a question. Every scene closes with one direct question to you, and it changes from scene to scene: "Do you trust her?", "Left tunnel or right?". The choices themselves get read out separately
- Lean over the screen, rarely. Once a scene at most, the GM may step out of the story for a short aside, like "I'll give you this one: that lock's older than the hinges."
- Let NPCs have opinions. Characters speak in first person with their own rhythm and grudges. They dodge questions and lie when it suits them. The narrator, on the other hand, commits; no "perhaps" or "it seems"
- Pick the specific word. "Tar-black bilge water" beats "dark water". The GM is also told to borrow real crafts, tools and weather from real history, but never at the cost of being understood on first hearing
- Skip the machine tics. Rhythmic lists of three, stiff paired and balanced sentences, em dashes and a long list of worn-out phrases are all off limits. Any em dash that still sneaks through gets swapped for a comma or an ellipsis, so the words you hear match the words on screen
On top of that sit the practical rules. Whenever a character speaks, the GM tags the line with their name, like [Captain Voss]: "Drop your weapons." That tag is how the audio engine knows to switch voices, and I learned how much it matters the hard way. There was a stretch when NPC voices refused to switch at all, because the dialogue wasn't woven into the narration. Later I caught the voice parser ending a quote at the first apostrophe, so a line like "Don't move." changed voices halfway through a word. Other rules are about access. Every scene has to work for a listener with their eyes closed, so anything that only shows up as a colour or a shape also gets a sound, a texture or a smell. And each world's tone (cinematic, rules-light, crunchy, horror or mystery) nudges how the GM runs things.
Think of the result as a very skilled, very fast co-author. I set the creative constraints, and Claude fills in the story within them. It's genuinely inventive and comes up with twists and turns of phrase I'd never have thought to write, yet it's always creating inside a frame I shaped. That's the secret to a GM that keeps giving you the story you signed up for instead of sliding into generic fantasy mush by hour two. And I'm far from done tuning it. Honestly, the project's commit history reads like a diary of me catching the GM doing something I didn't like, then fixing it.
What This Means for You
When you sit down to play, you needn't think about any of this. You type or say what your character does, and the world answers. Still, knowing what's underneath helps you play to its strengths. Be specific about what your character wants. Refer back to earlier moments, because the GM really is listening. Ask NPCs questions you honestly don't know the answer to; the model is at its best when there's room to surprise you. You can also ignore the suggested choices completely, since the GM is told to honour whatever you type or say. And remember that the world has its own logic. If something feels off, ask about it in character. More often than not, what looks like a slip is a thread waiting to be pulled.
If a turn goes sideways, you've got a safety net as well: press U to undo your last turn, or R to hear the narration again. So, what's the first thing you'd say to that nervous merchant?
Ready to see it in action? Play a free session →
Related reading: Browse all EchoQuest blog posts.