← to projects

RPGameBot

A text role-playing game in Telegram — the story is run jointly by more than a dozen AI agents.

When you play an AI role-playing game, the biggest pain is that the model hallucinates. Characters know things they aren’t supposed to know. Mages suddenly pull off the impossible. The story turns to mush after twenty turns.

A single AI that has access to everything is the main source of these hallucinations. We split it into roles, isolated the context, and put reviewers on both sides of the narrator — so the hallucinations are structurally ruled out.

architecture · 3 tiers
before the turn
Fatechance
Lore Keepercanon
Directorpacing
execution
GMnarrative
NPC × Neach with its own memory
after the turn
Archivistfacts
Scene Managerscene boundary
World Tickerthe world offscreen

The facts

What
a text role-playing game
in Telegram
Stack
Python · python-telegram-bot · Claude
Architecture
3 tiers · more than a dozen agents
Status
early concept · prototype works
Blocker
token cost — for the full scale
it needs resources I don’t have yet
The game’s contents are dimmed — the worlds are personal.

One turn

1
Fate rolls a die — whether a sudden complication hits the scene.
2
Lore Keeper and Director set the frame in parallel — canon and pacing.
3
GM writes the turn. It doesn’t make up the characters’ lines itself — it leaves markers, “so-and-so speaks here.”
4
The NPC agents fill in the markers — each from its own memory, in parallel.
5
Lore Keeper checks the finished turn. If canon is broken, the GM gets one shot to rewrite.
6
The reply goes to the player. In the background: the Archivist writes down the facts, the world graph updates, the NPCs reflect.

What’s beautiful inside

NPCs hear only what they could have heard

Every fact carries a list of witnesses — who was physically present. An NPC agent only gets the facts where it’s either a participant or on that list. A structural antidote to metagaming.

Memory by the Stanford Generative Agents formula

Each memory has two weights: recency (decaying with every turn that passes) and emotional charge. Relevance is computed by a formula, and the top 15 are picked. The old is forgotten, the important is held.

The world graph is derived from the facts

The source of truth is the structured facts after each turn. Everything is assembled from them: character relationships, chains of events, the state of the world. The model doesn’t remember the world — it queries the archive.

One shot to rewrite

If the keeper of canon spots a violation in a finished turn, the narrator gets one chance to fix it, with the problem pointed out explicitly. Not a loop. Like an editor with a writer: “fix this bit and let’s move on.”

The old in the new
An old genre, brought back to life through new technology.