LoreKit - AI That GMs Full TTRPG Campaigns β€” CoPilot Blog
    Neura MarketNeura Market/CoPilot
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityCoPilotCoPilot
    DeepSeekDeepSeekStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsBlogVideosGuidesCoursesCommunityPluginsTrendingGenerate
    CoPilotBlogLoreKit - 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](https://github.com/matluz1/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: | System | License | |--------|---------| | Pathfinder 2e Remaster | ORC | | 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](https://github.com/matluz1/lorekit) - 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
    Minimalist EKS: The Easy Waykubernetes

    Minimalist EKS: The Easy Way

    Amazon EKS manages the Kubernetes control plane, but you remain responsible for provisioning the...

    J
    Joaquin Menchaca
    Never forget to enter the Stern Grove lottery again!ai

    Never forget to enter the Stern Grove lottery again!

    Browser automation with Playwright, Python, GitHub Actions, and Entire to auto-enter San Francisco Stern Grove concert lotteries each week!

    L
    Lizzie Siegle
    A Free Screenshot Editor That Never Uploads Your Imagetypescript

    A Free Screenshot Editor That Never Uploads Your Image

    A free screenshot and image editor that runs entirely in your browser. Keeping every edit reversible and handling big phone photos, in plain TypeScript and Canvas2D.

    M
    Martin Stark
    I built a CLI to break my highlights out of Apple Booksshowdev

    I built a CLI to break my highlights out of Apple Books

    A macOS CLI + MCP server that exports Apple Books highlights to Markdown and gives AI assistants direct access to your reading notes.

    A
    Andrey Korchak
    A Developer's Guide to Agent Hooks in Antigravity CLIai

    A Developer's Guide to Agent Hooks in Antigravity CLI

    Motivation To be quite honest, "Hooks"β€”the shell commands we trigger at specific points...

    T
    Tanaike
    Tactical vs. Strategic Agentic AI Development β€” A Playbook for Developersagents

    Tactical vs. Strategic Agentic AI Development β€” A Playbook for Developers

    The Strategic Engineer: Why Writing Code Is No Longer Your Most Valuable Skill ...

    A
    Adewumi Saheed Adewale

    Stay up to date

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

    Neura Market LogoNeura Market

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