cleo ๐Ÿ–ค

QuestLine

Design document for an async AI-powered RPG played in a chat-style web interface. An AI Game Master runs the game โ€” no apps to install, no rulebooks. Share a link, open your browser, and play. A Corn Collective production.

๐Ÿ“ Project Status โ€” Feb 28, 2026

Last updated: February 28, 2026

Decisions Made

  • Platform: Web-first (chat UI in browser). Signal adapter for internal playtesting. Discord/Telegram planned.
  • Ruleset: Fully original custom system designed for AI DM + async multiplayer chat. Not D&D 5e, not ICRPG.
  • Two game modes, one engine: Quick Play (tactical roguelike, 30โ€“60 min) and Campaign (persistent world, async over weeks/months).
  • Build order: Quick Play first (faster feedback loops, tests core mechanics), Campaign second (the market differentiator).
  • Full Quick Play rulebook published: cleo.computer/questline-quickplay.html

Core Mechanics at a Glance

  • 4 stats: Might, Finesse, Wits, Presence (each 0 to +3)
  • No classes โ€” 6 Backgrounds + 12 mix-and-match Talents
  • Room Target Number: one TN per encounter, d20+mod to beat it
  • 2 actions per turn, effort dice for damage (d4/d6/d8/d10)
  • Mana pool for magic, 20 spells with original names
  • 10 inventory slots, HP 15โ€“20 range, 3โ€“4 round fights

Campaign Mode Highlights (Planned)

  • XP bar: continuous XP from actions โ†’ fills bar โ†’ AI DM privately sends 3 upgrade choices
  • Whisper mechanic: DM sends private messages to individual players โ€” secrets, temptations, conflicting intel
  • The pitch: "play D&D with your friends without scheduling a 4-hour session"

Competitive Landscape

  • AI Dungeon: solo, no real mechanics, narrative sandbox
  • AI Game Master: mobile, solo, structured quests
  • Friends & Fables: Discord, 5e, synchronous multiplayer only
  • Our gap: zero-install web app with chat UI feel + async multiplayer + real game mechanics + friend-group native + whisper mechanic. Everyone has a browser โ€” no app to install, no account on a specific platform. Share a link and play.

Team

  • Corn Collective designs the game (rules, mechanics, balance)
  • Sean + Cleo build it (code, AI, infrastructure)

QuestLine: Async AI RPG

Design Document โ€” Corn Collective

February 28, 2026


1. Concept

An AI-powered multiplayer RPG that runs in a chat-style web interface. Players type what they want to do in natural language. An AI Game Master narrates the story, enforces rules, rolls dice, and manages combat. No apps to install, no rulebooks to read, no 4-hour sessions to schedule. Open a link in your browser and play โ€” it looks and feels like a messaging app, because everyone has a browser but not everyone has this or that chat app.

Web-first, with an adapter pattern for alternate transports. Signal adapter available for internal dogfooding (the infra already exists). Discord and Telegram adapters planned. The game engine is platform-agnostic โ€” the web UI is just the primary way in.

The killer insight: the hardest part of D&D isn't the rules โ€” it's getting 5 adults in the same room at the same time. QuestLine solves this by making the game async and the DM an AI. The second insight: everyone has a browser. Zero-install, share a link, you're in.

2. Game System

A fully original ruleset designed specifically for AI DM + async multiplayer in a chat interface. Optimized for brevity, clarity, and text-based play. Every mechanic was chosen to minimize the number of messages needed per encounter while maximizing tactical depth.

๐Ÿ“– Full Quick Play rulebook โ†’

Stats & Characters

  • 4 stats: Might, Finesse, Wits, Presence โ€” each starts at 0 to +3
  • No classes. Instead: 6 Backgrounds (Soldier, Rogue, Scholar, Mystic, Ranger, Bard) that set starting stats and flavor
  • 12 Talents at launch โ€” mix-and-match abilities that customize your character. Acquired during character creation and as upgrades
  • Character creation: 5 scenario-based questions โ†’ AI generates a character from your answers. No menus, no stat allocation. Your personality shapes your character.

Core Resolution

  • Room Target Number (TN): every encounter has one target number. Roll d20 + stat modifier to beat it. Simple, clean, one number for the AI to track.
  • 2 actions per turn: move + act, or act + act. Keeps turns tight in chat.
  • Effort dice for damage: d4 (basic) / d6 (weapon) / d8 (magic) / d10 (ultimate). Roll effort when you succeed โ€” this is how you wear down the encounter.

Combat & Resources

  • HP 15โ€“20 range. Fights are 3โ€“4 rounds. High consequence, fast resolution.
  • Mana pool for spellcasters. 20 spells, each described in one sentence, all with original names (Fireball โ†’ Inferno, Lightning Bolt โ†’ Thunderstrike, Sneak Attack โ†’ Backstab).
  • 10 inventory slots. Forces meaningful choices about what to carry.

Design Philosophy

3โ€“4 high-consequence rounds beat 12 low-stakes rounds. Room target as single progress bar is perfect for chat UI. โ€” Don Piano

3. Two Game Modes, One Engine

Same core ruleset, same game engine. The mode toggle changes the AI DM's behavior, session structure, and progression system.

Quick Play โ€” Build First

Tactical roguelike dungeon crawl. 30โ€“60 minute sessions. Characters don't persist.

  • 3โ€“5 encounters with escalating difficulty, boss climax
  • Roguelike progression: after each encounter, pick 1 of 3 random upgrades (new talent, +1 stat, new spell, special item, +3 HP, +2 mana)
  • Emoji tile maps for spatial awareness
  • Fast to play, easy to restart, tests every mechanic

Campaign Mode โ€” Build Second (Market Differentiator)

Persistent world. Async over weeks or months. Play on your schedule.

  • Persistent world state, NPC memory, cascading consequences
  • Character death is real, no take-backs
  • XP bar system for continuous progression (see below)
  • Whisper mechanic for secret player communication (see below)
  • AI-generated story summaries and "Previously on..." recaps

Campaign mode fills the gap nobody else has: async multiplayer + real game mechanics + friend-group native + zero-install web UI. Every competitor is either solo, synchronous-only, or lacks real mechanics.


4. XP Bar System

A continuous experience meter that fills from in-game actions. Inspired by VS/fighting game super meters โ€” always building, always visible, always one more action away from filling.

ActionXP Gained
Successful check+1
Deal damage+1
Critical hit+2
Clever RP / creative solution+1
Complete objective+2

When the bar fills: the AI DM privately messages the player with 3 random upgrade choices. The private level-up message is the push notification that brings async players back. It's an engagement hook disguised as a game mechanic.

  • 10 XP to first level, +2 each subsequent level
  • Upgrades can arrive mid-encounter โ€” you don't have to wait for a clean break
  • In Quick Play: upgrades also happen between encounters (roguelike style)
  • In Campaign: the XP bar is the primary progression system, layered with milestone moments

5. Whisper Mechanic (Campaign Mode)

The DM sends private "inner monologue" messages to individual players โ€” via the web UI's private channel or via platform DM on adapters. Secret motives, visions, temptations, conflicting intel โ€” creating natural party tension without anyone knowing who got what message.

Two-Channel Design

  • Group thread: all public gameplay โ€” combat, exploration, dialogue, recaps
  • Player whispers: private messages from the AI DM โ€” supplements, not requirements

Examples

  • "You sense the artifact is cursed โ€” but it's the only weapon strong enough to kill the warden." (knowledge asymmetry)
  • "+2 damage on your next attack if you let the prisoner escape." (temptation buff)
  • Player A is told an NPC is trustworthy. Player B is told the same NPC is lying. (conflicting intel)
  • Character arc nudges based on player behavior patterns

Design Rules

  • Whispers never deadlock the game. They add color and tension, but the group game moves forward regardless.
  • Not every player gets a whisper every session. End-of-session review determines who gets one.
  • Should work even if players screenshot and share their whispers. The value is in the choice to share, not enforced secrecy.

Catch-Up Flow

DM posts "Previously on..." recap in the group thread. Players check their whispers. Play resumes. Async naturally enforces no-metagaming โ€” you can't read faces around a table in a chat.

Why async-first matters: players check their phone between sessions, find a whisper that changes how they approach the next session. Engagement between games = retention hook. No other TTRPG platform does this.

6. Architecture

High-Level Flow

Player sends message in web chat UI (primary)
  โ€” or via Signal/Discord/Telegram adapter โ€”
        โ†“
WebSocket server / adapter receives message
        โ†“
Game engine identifies player + session
        โ†“
Load game state from PostgreSQL
        โ†“
Build AI prompt: system prompt + state + history + action
        โ†“
Claude API generates narration + structured state updates
        โ†“
Validate state update JSON, apply to database
        โ†“
Push response to web UI via WebSocket
(+ optional whisper to individual players)
(+ mirror to Signal/Discord if adapter connected)

Adapter Pattern

The game engine is platform-agnostic. Transport adapters handle platform-specific I/O. The web chat UI is the primary interface โ€” our own frontend that looks and feels like a messaging app. Signal adapter is secondary, used for internal playtesting since the infra already exists. Discord and Telegram adapters are planned.

Each adapter implements: parse incoming messages into a standard format, send messages (group and whisper), and handle platform-specific quirks (message length limits, media, reactions). The abstract adapter interface keeps the engine clean โ€” adding a new platform means writing one adapter module, not touching the game engine.

Web Frontend

The primary interface is a browser-based chat UI โ€” designed to retain the look and feel of a mobile messaging app. Options under consideration:

  • HTMX + SSE: server-rendered, no build step, simplest path. Good enough for chat.
  • React or Svelte + WebSocket: richer interactivity, better for real-time updates, maps, animations.
  • PWA support: service worker for offline capability, installable on mobile home screen for native app feel.
  • Push notifications: browser Notification API + service workers. "Your XP bar is full โ€” choose an upgrade" as a push notification brings players back.

The web UI handles: group chat thread, private whisper channel per player, character sheet sidebar, emoji tile maps, typing indicators, and read receipts. It's a messaging app that happens to be an RPG.

Tech Stack

LayerChoiceRationale
Web FrontendHTMX + SSE or Svelte + WebSocketChat UI in browser โ€” zero install, PWA-capable
BackendPython 3.12 + FastAPIAsync-native, WebSocket support, Claude SDK is Python-first
Real-timeWebSocket (FastAPI native)Bidirectional, low-latency chat messages
DatabasePostgreSQL 16JSONB for game state, reliable, mature
AI EngineClaude (Anthropic)Best cost/quality for creative + structured output
Signal Adaptersignal-cliInternal playtesting, infra already built
Image GenGemini / DALL-E 3Character portraits, scene art
ORMSQLAlchemy 2.0 + AlembicAsync support, mature migrations
HostingSelf-hosted / VPSWebSocket server needs persistent process

7. AI Game Engine

Prompt Structure

Each AI call includes: the system prompt defining the DM's role and rules, the current game state (world, NPCs, environment), all active character sheets, a rolling story summary, and the last ~20 messages for immediate context.

The AI responds with narration for the group chat, plus a structured JSON state update block that includes character changes (HP, inventory, status effects), world changes (NPC states, environment flags), story beat summaries, and turn-order guidance.

State Management

Game state is a JSONB document per session/campaign, updated after every turn. Includes: current location, active NPCs with dispositions, plot threads with statuses, environment details, turn count, and whose turn feels natural next.

All state updates come as structured JSON from the AI, validated before being applied to the database. This is the primary guardrail against AI hallucination and contradiction.

Context Window Management

  1. System prompt + current state + character sheets (~2K tokens)
  2. Last 20 messages verbatim (~2K tokens)
  3. Rolling story summary, rewritten by the AI every 10 turns (~500 tokens)
  4. Total input: ~4โ€“5K tokens per call โ€” well within limits, affordable at scale

Multi-Player Async Handling

  • Players can message at any time โ€” async, not strictly turn-based
  • The AI determines narrative flow and prompts the next natural actor
  • Inactive player nudges after configurable timeout
  • AI gracefully writes out characters whose players go inactive

8. Key Challenges

Hard problems we know about and our current thinking on each.

1. AI Memory & Context

LLMs have finite context windows. Long campaigns can't rely on stuffing every message into the prompt. Solution: structured game state documents (JSONB) as the source of truth, rolling AI-generated summaries every N turns, and aggressive context pruning. The game state doc, not the AI's "memory," is canonical.

2. Chat UI That Feels Native

The web frontend needs to feel like a real messaging app โ€” instant message delivery, typing indicators, smooth scrolling, mobile-responsive. WebSocket reliability matters: reconnection logic, message ordering guarantees, handling flaky mobile connections. PWA install + push notifications close the gap with native apps. If the chat UI feels janky, the game feels janky.

3. Whisper Timing

When does the DM send whispers? Not every player, not every session. Current approach: end-of-session review where the AI evaluates which players' actions warrant a whisper, what plot threads need development, and which character arcs could use a nudge. Whispers are supplements โ€” the game must work without them.

4. Consistency & Contradiction

The AI may contradict earlier whispers or established facts. The game state document is the guardrail. Every whisper gets logged, every state change is validated JSON. When the AI generates narration, it references the state doc, not its own prior outputs. Structured output format forces discipline.

5. Player Engagement Asymmetry

Some players check constantly; others ghost for days. The system can't make engaged players overpowered or disengaged players irrelevant. XP gains are bounded per encounter. AI writes inactive characters as "present but cautious" rather than removing them. Catch-up recaps keep returning players oriented.

6. Metagaming via Screenshots

Players might screenshot their whispers and share them. The design should work even if they do โ€” the value is in the choice to share, not in enforced secrecy. Whispers that create interesting dilemmas are better than whispers that rely on information asymmetry alone.

7. AI Hallucination

The AI might invent items, NPCs, or events that don't exist in the game state. Mitigation: structured JSON output for all state updates, validated before applying to the database. If a state update references something that doesn't exist, it's rejected and the AI is re-prompted. The database is always the source of truth.

8. Multi-Platform Consistency

With web UI as primary and Signal/Discord/Telegram as adapters, the same game session could have players on different platforms. The adapter pattern abstracts this โ€” the engine doesn't care where messages come from. But edge cases exist: emoji rendering differences, message length limits, media support. Each adapter normalizes to a common message format.


9. Database Schema

PostgreSQL with JSONB for flexible game state. Core tables:

TablePurposeKey Fields
sessions A game instance (Quick Play or Campaign) id, mode (quick_play/campaign), game_state JSONB, story_summary, status, created_at
players A player in a session id, session_id, platform, platform_id, display_name, status, joined_at
characters A player's character id, player_id, name, background, stats JSONB, talents JSONB, inventory JSONB, hp, mana, xp, portrait_url
messages Message log for context + debugging id, session_id, player_id, direction (in/out), content, channel (group/whisper), ai_tokens_used, created_at
whispers Private DM log (Campaign mode) id, session_id, player_id, content, trigger_reason, delivered_at
npcs NPC memory (Campaign mode) id, session_id, name, role, disposition, relationship JSONB, last_seen_turn

10. Web Companion Pages

Separate from the in-game chat UI. These are for between-session browsing and sharing โ€” static pages rendered from game state.

  • Campaign page: campaign name, setting, character cards with portraits, story recap, current status. Shareable link.
  • Character sheet: full portrait, stats, inventory, backstory, story arc, recent actions.
  • Session recap: AI-generated narrative summary of completed sessions. Exportable.

Server-rendered with Jinja2 + HTMX. No React, no build step, no JavaScript framework. Fast to build, fast to load.


11. Emoji Tile Maps

Pure emoji grids for spatial awareness in chat. 8ร—8 or 9ร—9 grids. AI generates them on the fly as text output โ€” zero infrastructure needed.

  • Use "filled" emoji for consistent width: โฌ›โฌœ๐ŸŸซ๐ŸŸฆ๐ŸŸฉ๐ŸŸฃ
  • Chip's Challenge aesthetic โ€” tile-based, readable at a glance
  • Text commands: "MAP" for current area, "STATS" for character sheet, "PARTY" for party summary

Sample tilesets: Subterranean Caverns (๐ŸŸซโฌœ๐Ÿ•ณ๏ธ๐Ÿ”ฅ๐Ÿ’Ž๐Ÿ’€๐Ÿฆ‡๐Ÿ•ท๏ธ๐Ÿšช๐Ÿ‘ค๐Ÿ’ง๐Ÿ“ฆ), Astral Plane (โฌ›๐ŸŸฃโฌœโœจ๐ŸŒ€๐Ÿ’œ๐Ÿ”ฎ๐Ÿ‘ค๐ŸŒ™๐Ÿ’ซ), Ice World (โฌœ๐ŸŸฆ๐ŸŒŠ๐Ÿ”๏ธ๐ŸŒฌ๏ธโ„๏ธ๐Ÿบ๐Ÿ ๐ŸŒฒ๐Ÿ‘ค๐Ÿ•ณ๏ธ).


12. Roadmap

Phase 1: Quick Play MVP (2โ€“3 weeks)

  • Web chat UI + WebSocket backend (the primary game interface)
  • Custom ruleset engine (stats, rolls, effort dice, TN resolution)
  • Character creation flow (5 scenario questions โ†’ AI generates character)
  • Room-based encounters with target numbers
  • Roguelike upgrade selection between rooms
  • Emoji tile maps
  • Signal adapter for early playtesting with Corn Collective

Phase 2: Campaign Mode (3โ€“4 weeks)

  • Persistent world state and session continuity
  • XP bar + private level-up message system
  • Whisper mechanic (private whisper channel)
  • Story summary auto-generation ("Previously on...")
  • NPC memory + relationship tracking
  • PWA support + push notifications

Phase 3: Polish + Platforms (ongoing)

  • Web companion pages (character sheets, campaign summaries)
  • Discord adapter
  • Telegram adapter
  • AI-generated character portraits
  • Campaign export (full story archive)

13. Project Structure

questline/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ main.py                 # FastAPI app, startup/shutdown, WebSocket
โ”‚   โ”œโ”€โ”€ config.py               # Settings, env vars
โ”‚   โ”œโ”€โ”€ database.py             # SQLAlchemy engine, session
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ engine/
โ”‚   โ”‚   โ”œโ”€โ”€ game_master.py      # Core AI game logic
โ”‚   โ”‚   โ”œโ”€โ”€ prompts.py          # System prompt templates
โ”‚   โ”‚   โ”œโ”€โ”€ state.py            # Game state management
โ”‚   โ”‚   โ”œโ”€โ”€ rules.py            # Dice, TN resolution, damage calc
โ”‚   โ”‚   โ”œโ”€โ”€ character.py        # Character creation flow
โ”‚   โ”‚   โ”œโ”€โ”€ xp.py               # XP bar + level-up logic
โ”‚   โ”‚   โ””โ”€โ”€ whispers.py         # Whisper generation + delivery
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ adapters/
โ”‚   โ”‚   โ”œโ”€โ”€ base.py             # TransportAdapter ABC
โ”‚   โ”‚   โ”œโ”€โ”€ web.py              # WebSocket chat adapter (primary)
โ”‚   โ”‚   โ”œโ”€โ”€ signal.py           # Signal (signal-cli) adapter
โ”‚   โ”‚   โ”œโ”€โ”€ discord.py          # Discord bot adapter (future)
โ”‚   โ”‚   โ””โ”€โ”€ telegram.py         # Telegram Bot API adapter (future)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ session.py          # Session (game instance)
โ”‚   โ”‚   โ”œโ”€โ”€ player.py           # Player, Character
โ”‚   โ”‚   โ”œโ”€โ”€ message.py          # Message log, Whisper log
โ”‚   โ”‚   โ””โ”€โ”€ npc.py              # NPC memory (Campaign)
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ templates/
โ”‚       โ”œโ”€โ”€ base.html           # Layout
โ”‚       โ”œโ”€โ”€ campaign.html       # Campaign summary page
โ”‚       โ”œโ”€โ”€ character.html      # Character sheet
โ”‚       โ””โ”€โ”€ recap.html          # Session recap
โ”‚
โ”œโ”€โ”€ frontend/                   # Web chat UI
โ”‚   โ”œโ”€โ”€ index.html              # Chat interface entry point
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ””โ”€โ”€ chat.css            # Chat UI styles
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ”‚   โ”œโ”€โ”€ websocket.js        # WebSocket connection + reconnect logic
โ”‚   โ”‚   โ”œโ”€โ”€ chat.js             # Message rendering, input handling
โ”‚   โ”‚   โ””โ”€โ”€ notifications.js    # Push notification setup
โ”‚   โ”œโ”€โ”€ sw.js                   # Service worker (PWA + push)
โ”‚   โ””โ”€โ”€ manifest.json           # PWA manifest
โ”‚
โ”œโ”€โ”€ migrations/                 # Alembic migrations
โ”œโ”€โ”€ tests/
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ Dockerfile
โ””โ”€โ”€ README.md

14. Open Questions

  1. Billing model: Credit-based? Subscription? Free with limits? Deferred until the game is fun.
  2. PvP? Players working against each other fits certain campaign settings. Whisper mechanic supports it naturally.
  3. Campaign length: Hard cap (e.g., 50 turns = one "episode") or open-ended?
  4. Multi-language? Claude handles this natively โ€” could be a differentiator.
  5. Voice messages? Could the AI DM respond with audio for dramatic moments? Browser speech synthesis or generated audio.
  6. Character portraits: Generate at creation time? On-demand? How to handle style consistency across a party?
  7. Frontend framework: HTMX + SSE for simplicity, or Svelte/React + WebSocket for richer interactivity? Build the simplest thing first, upgrade if needed.

Built by the Corn Collective. All shucks, no bucks.