LoreKit - AI That GMs Full TTRPG Campaigns — Perplexity…
    Neura MarketNeura Market/Perplexity
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsGamesBlogVideosGuidesCoursesCommunityTrending
    PerplexityBlogLoreKit - 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
    Five Gemma-4 models, one accelerator: what porting E2B 31B to AWS Inferentia2 taught megemma

    Five Gemma-4 models, one accelerator: what porting E2B 31B to AWS Inferentia2 taught me

    I ported the whole Gemma-4 family — E2B, E4B, 12B, 31B, and the 26B-A4B MoE — to run on...

    X
    xbill
    Hey DEV, I'm Tobore. Let's actually connect.community

    Hey DEV, I'm Tobore. Let's actually connect.

    Hey DEV, I'm Tobore. Let's actually connect. I've been on here for a while now, mostly writing and...

    L
    Laurina Ayarah
    I burned through thousands of AI tokens. Then a friend did it for freeai

    I burned through thousands of AI tokens. Then a friend did it for free

    (yep, kinda clickbait, just for the funsies 😊) At the beginning of the year, I relaunched my...

    P
    Paulo Henrique
    Claude might be saturating your machineai

    Claude might be saturating your machine

    My laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit...

    S
    Sidhant Panda
    Automated GitHub Code Reviews Using Google Geminigithubactions

    Automated GitHub Code Reviews Using Google Gemini

    I Built a Thing! TL;DR — Google Gemini-based Pull Request reviews and Issue Triaging for...

    D
    Darren "Dazbo" Lester
    What is an "agentic harness," actually?ai

    What is an "agentic harness," actually?

    I've been hearing the word "harness" thrown around a lot lately. I assumed it just meant "the IDE" or...

    T
    Tilde A. Thurium

    Stay up to date

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

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Perplexity 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.

    Neura Market

    Custom AI Systems & Services

    Our team of experienced AI builders will help build custom AI systems, workflows, and solutions for your business.

    Request custom work

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this Perplexity resource

    • Automate SEO-Optimized Blog Creation with GPT-4, Perplexity AI & Multi-Language Supportn8n · $24.99 · Related topic
    • Automate SEO Blog Content Creation with GPT-4, Perplexity AI, and WordPressn8n · $24.99 · Related topic
    • Automate SEO Blog Creation + Social Media with GPT-4, Perplexity, and WordPressn8n · $24.99 · Related topic
    • Auto-Generate SEO Blog Posts with Perplexity, GPT, Leonardo & WordPressn8n · $14.99 · Related topic
    Browse all workflows