LoreKit - AI That GMs Full TTRPG Campaigns — Stable…
    Neura MarketNeura Market/Stable Diffusion
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityStable DiffusionStable Diffusion
    DeepSeekDeepSeekCoPilotCoPilotMidjourneyMidjourney
    View All Directories
    OverviewPromptsBlogVideosGuidesCoursesCommunityModelsLoRAsComfyUI WorkflowsTrending
    Stable DiffusionBlogLoreKit - AI That GMs Full TTRPG Campaigns
    Back to Blog
    LoreKit - AI That GMs Full TTRPG Campaigns
    opensource

    LoreKit - AI That GMs Full TTRPG Campaigns

    Matheus Luz April 4, 2026
    0 views

    An open-source engine that turns AI into a real Game Master - with deterministic dice, persistent NPCs, and full campaign tracking.


    title: LoreKit - AI That GMs Full TTRPG Campaigns published: true description: An open-source engine that turns AI into a real Game Master - with deterministic dice, persistent NPCs, and full campaign tracking. tags: opensource, python, ai, gamedev series: "LoreKit: AI-Powered TTRPG"

    "You push open the iron door. The hinges scream. Inside, the throne room stretches wide - cracked marble, toppled pillars, and at the far end, an ogre chieftain sitting on a chair made of shields. He looks up. He doesn't seem surprised."

    You: I draw my sword and step forward.

    The GM calls encounter_start, rolls initiative, places you in the Entrance zone and the ogre in the Throne Room. Combat begins.

    That's not a scripted demo. It's a real session - an AI running a tabletop RPG campaign through a terminal, using the same kind of tools a human GM would: dice, character sheets, initiative trackers, story notes. Except these tools are MCP endpoints, and the GM is Claude.

    I built LoreKit to make this work.

    What is LoreKit

    LoreKit is an open-source TTRPG game engine designed for AI agents. It tracks everything needed to run full campaigns: characters, sessions, story arcs, regions, combat encounters, NPC memories, and more.

    The AI doesn't wing it. It connects to an MCP server and uses tools the way a human GM would use a VTT - rolling dice, starting encounters, tracking story arcs. Most of the heavy lifting is abstracted. Resolving an attack is a single tool call that handles the roll, damage, conditions, and state updates. An NPC interaction call assembles context, spawns the NPC agent, and stores new memories. The GM calls the shots. The tools handle the complexity.

    The key design decision: the AI handles narrative, but a deterministic engine handles all the math. The GM never picks numbers. It never "decides" damage. It calls the rules engine, gets results, and narrates what happened. If something goes wrong - a failed tool call, an unexpected result - the GM stops, tells the player what happened, and waits. No silent fixes. No narrative smoothing.

    <!-- IMAGE: Screenshot of TUI showing a combat exchange with dice results visible -->

    What the GM Actually Does

    When you send a message, the AI Game Master:

    • Narrates the world, NPCs, and consequences of your actions
    • Calls tools to roll dice, resolve attacks, apply damage, track conditions
    • Manages story - sets up adventures, tracks acts and regions, logs timeline events
    • Spawns NPCs as independent agents with their own personality, memory, and goals
    • Enforces rules via the cruncher engine - a standalone, zero-dependency rules calculator

    What it does NOT do:

    • Pick numbers. Every stat, bonus, and roll comes from the engine
    • Control your character. You decide what your PC does
    • Hallucinate rules. All mechanics come from system pack definitions (JSON files)

    What It Looks Like

    You play through a terminal TUI built with React and Ink. It starts the engine, spawns the GM, and streams the session as text.

    <!-- IMAGE: GIF of TUI gameplay showing a full exchange - player input, GM narration, tool calls, dice results -->

    The flow is simple: you type what your character does, the GM responds. Behind the scenes, tool calls fire, the database updates, and the narrative reflects what actually happened mechanically.

    <!-- IMAGE: Screenshot showing the HUD - character status, HP, conditions -->

    Two Packages, One Engine

    LoreKit ships as two Python packages:

    cruncher - a standalone, zero-dependency rules engine. It parses formulas, stacks modifiers, rolls dice, builds characters, and computes derived stats. Pure computation: dataclasses in, dataclasses out. No database, no network, no AI.

    lorekit - the full MCP game engine. Session management, combat orchestration, NPC agents, narrative tracking, semantic search. It depends on cruncher for all mechanical resolution.

    This separation matters. The AI never touches the math. It calls tools, and those tools call cruncher, and cruncher returns deterministic results. The AI's job is to make those results feel like a story.

    Game Systems Are Data, Not Code

    LoreKit ships with two game systems:

    SystemLicense
    Pathfinder 2e RemasterORC
    d20 Hero SRD (3e)OGL 1.0a

    Both are defined entirely in JSON - attributes, formulas, actions, tables, build rules, stacking policies. The engine doesn't know what Pathfinder is. It knows variables, formulas, and constraints. You could define your own system from scratch.

    Combat currently uses zone-based positioning inspired by theater of the mind - no grid yet. Grid combat, a Discord bot, premade adventures, and support for other AI agents (Codex, Gemini CLI) are on the roadmap.

    Try It Tonight

    Head over to the repo - the README has setup instructions. Once you're running, make tui starts the terminal interface. The GM agent sets up the session and asks what kind of adventure you want.

    <!-- IMAGE: Screenshot of the TUI at session start - the GM asking what system/adventure the player wants -->

    What's Coming Next

    This is Part 1 of a 4-part series. Next week, I'll dig into how the deterministic engine works - how a formula like floor(level / 2) + dex_mod gets parsed, evaluated, and fed back to the AI so it never has to guess what your attack bonus is.

    If you try it, drop a comment - I'd love to hear how your session went.


    LoreKit is Apache 2.0 licensed. System pack data (Pathfinder 2e, d20 Hero) is governed by its own license (ORC, OGL 1.0a) found in each system's directory.

    Tags

    opensourcepythonaigamedev

    Comments

    More Blog

    View all
    Context bankruptcy: The case for strategic forgetting for AI Agentsai

    Context bankruptcy: The case for strategic forgetting for AI Agents

    Most of us have seen a coding agent fail to complete a task we know it can do. We just don't...

    J
    James O'Reilly
    Parallel Compliance Engine: Drive-to-Sheets Multi-Agent Orchestrationgooglecloud

    Parallel Compliance Engine: Drive-to-Sheets Multi-Agent Orchestration

    When building Generative AI applications, developers often encounter a massive bottleneck: sequential...

    A
    Aryan Irani
    Is It Ethical to Post and Ask About Circuits on Dev.to?discuss

    Is It Ethical to Post and Ask About Circuits on Dev.to?

    I’ve been thinking about sharing some electronic circuit posts on Dev.to — small circuits, DIY...

    C
    codebunny20
    The One-Click Exporter: AI Studio Antigravity, Probed to Its Limitsagents

    The One-Click Exporter: AI Studio Antigravity, Probed to Its Limits

    What nobody tells you about exporting your multi-agent prototype to a local workspace. Every...

    L
    leslysandra
    Guarding the till while autonomous data agents do the diggingagenticarchitect

    Guarding the till while autonomous data agents do the digging

    Autonomous agents are genuinely good at answering messy business questions. Give one an LLM and a set...

    S
    Sireesha Pulipati
    Return on Attention: Why AI Code Reviews Are Wearing Us Outai

    Return on Attention: Why AI Code Reviews Are Wearing Us Out

    PR volume went up, ticket quality didn't, and the gap got filled with LLMs on both sides of the review: bots reviewing, bots replying, bots occasionally arguing with bots about priorities that only existed in a teammate's head. Our CEO named the actual problem, and it's bigger than code review.

    C
    christine

    Stay up to date

    Get the latest Stable Diffusion prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Stable Diffusion and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this Stable Diffusion resource

    • Automate Your Scheduled Email Campaigns with n8nn8n · $15.99 · Related topic
    • Automate Mautic Email Campaigns with Google Sheets Datan8n · $6.37 · Related topic
    • Meta Ad Automation: Streamline Your Ad Campaignsn8n · $19.99 · Related topic
    • Automate Real Estate Marketing with AI-Driven Email and Voice Campaignsn8n · Free · Related topic
    Browse all workflows