AI_TTRPG
AI-TTRPG · D&D 5e Rules Engine as a Deterministic, Auditable Tool
Agent Pipeline
Four-role pipeline for AI-assisted software engineering
Architect
Asks clarifying questions and explores alternatives before any code is written. Produces Architecture Decision Records (ADRs) and detailed specs.
Planner
Takes ADRs and specs as input. Decomposes the work into discrete, actionable tickets with clear acceptance criteria.
Executor
Implements tickets following established conventions. Always proposes a plan before touching the codebase.
QA Tester
Writes automated tests covering acceptance criteria, edge cases, and regressions after a feature is implemented. Does not modify feature code.
Reviewer
Validates code against the original acceptance criteria. Flags issues back to the Executor and provides final approval.
System Architect
Maps components, tiers, connections, and protocols. Produces or updates architecture.yaml when the system shape changes.
Custodian
Keeps CLAUDE.md under 200 lines, routes content to external files, and cleans up stale references.
Summarizer
Reads tickets, ADRs, specs, and git history to produce executive summaries of completed sprints or features. Writes output to summaries/.
System Architecture
Real-time voice-powered D&D Game Master that resolves combat mathematically while narrating outcomes naturally
Player Browser
clientWeb client for real-time bidirectional audio with the Game Master
Daily WebRTC ClientVoice Pipeline
servicePipecat-orchestrated pipeline that transcribes speech, classifies intent, calls the LLM, and synthesizes a spoken response
Pipecat 0.0.108 (Python)Semantic Router
engineVector similarity classifier that routes player utterances to GAME_ACTION or GENERAL intent in under 15ms
Redis Vector + fastembedMCP Bridge
serviceSSE-based client that forwards LLM tool calls from the voice pipeline to the rules engine over MCP protocol
SSE (Server-Sent Events)Rules Engine
engineDeterministic D&D 5e rules server — all dice rolls and damage calculations happen here so the AI cannot hallucinate outcomes; manages game lifecycle (create, load) and guards tool calls against no-active-game state
FastMCP + dnd-5e-coreGame State
dataPluggable store for characters, NPCs, and combat log — backend selected at startup via GAME_DB_PATH env var (SQLite in production, in-memory for local dev and CI)
Python (Protocol + InMemoryGameStateStore + SQLiteGameStateStore)Hub API
serviceREST API for game session management — CRUD operations on games, entities, and combat logs for the web hub UI (ADR-0005); real-time SSE event streaming (ADR-0007)
FastAPI (Python)Event Poller
serviceBackground task that polls event_outbox every 100ms and fans out persisted events to the EventBus for real-time synchronization (ADR-0007)
Python asyncioEvent Outbox Table
dataSQLite table in game.db that stores events inserted by MCP tools in the same transaction as entity mutations; acts as the single source of truth for propagating changes to clients (ADR-0007)
SQLiteGame Hub
clientWeb UI for between-session game management — browse, create, inspect, and delete campaigns (ADR-0005); live real-time updates from server events (ADR-0007)
Next.js + React (TypeScript)