<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Matheus Luz</title>
    <description>The latest articles on DEV Community by Matheus Luz (@matluz).</description>
    <link>https://dev.to/matluz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F116286%2F02f37cb5-3309-414e-930d-7b64be231a4b.jpeg</url>
      <title>DEV Community: Matheus Luz</title>
      <link>https://dev.to/matluz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/matluz"/>
    <language>en</language>
    <item>
      <title>LoreKit - AI That GMs Full TTRPG Campaigns</title>
      <dc:creator>Matheus Luz</dc:creator>
      <pubDate>Sat, 04 Apr 2026 15:01:52 +0000</pubDate>
      <link>https://dev.to/matluz/i-built-an-ai-that-gms-full-ttrpg-campaigns-774</link>
      <guid>https://dev.to/matluz/i-built-an-ai-that-gms-full-ttrpg-campaigns-774</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"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."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; I draw my sword and step forward.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The GM calls &lt;code&gt;encounter_start&lt;/code&gt;, rolls initiative, places you in the Entrance zone and the ogre in the Throne Room. Combat begins.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://github.com/matluz1/lorekit" rel="noopener noreferrer"&gt;LoreKit&lt;/a&gt; to make this work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is LoreKit
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;The key design decision: &lt;strong&gt;the AI handles narrative, but a deterministic engine handles all the math.&lt;/strong&gt; 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.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the GM Actually Does
&lt;/h2&gt;

&lt;p&gt;When you send a message, the AI Game Master:&lt;/p&gt;

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

&lt;p&gt;What it does NOT do:&lt;/p&gt;

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

&lt;h2&gt;
  
  
  What It Looks Like
&lt;/h2&gt;

&lt;p&gt;You play through a terminal TUI built with React and Ink. It starts the engine, spawns the GM, and streams the session as text.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two Packages, One Engine
&lt;/h2&gt;

&lt;p&gt;LoreKit ships as two Python packages:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;cruncher&lt;/strong&gt; - 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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;lorekit&lt;/strong&gt; - the full MCP game engine. Session management, combat orchestration, NPC agents, narrative tracking, semantic search. It depends on cruncher for all mechanical resolution.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Game Systems Are Data, Not Code
&lt;/h2&gt;

&lt;p&gt;LoreKit ships with two game systems:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;System&lt;/th&gt;
&lt;th&gt;License&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pathfinder 2e Remaster&lt;/td&gt;
&lt;td&gt;ORC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;d20 Hero SRD (3e)&lt;/td&gt;
&lt;td&gt;OGL 1.0a&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Combat currently uses &lt;strong&gt;zone-based positioning&lt;/strong&gt; 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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It Tonight
&lt;/h2&gt;

&lt;p&gt;Head over to the &lt;a href="https://github.com/matluz1/lorekit" rel="noopener noreferrer"&gt;repo&lt;/a&gt; - the README has setup instructions. Once you're running, &lt;code&gt;make tui&lt;/code&gt; starts the terminal interface. The GM agent sets up the session and asks what kind of adventure you want.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Coming Next
&lt;/h2&gt;

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

&lt;p&gt;If you try it, drop a comment - I'd love to hear how your session went.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>python</category>
      <category>ai</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Is this project eligible for the #gftwhackathon ?</title>
      <dc:creator>Matheus Luz</dc:creator>
      <pubDate>Mon, 18 May 2020 13:11:12 +0000</pubDate>
      <link>https://dev.to/matluz/is-this-project-eligible-for-the-gftwhackathon-31j7</link>
      <guid>https://dev.to/matluz/is-this-project-eligible-for-the-gftwhackathon-31j7</guid>
      <description>&lt;p&gt;So, I've been thinking about a project for a while, and maybe this is a good moment to develop it.&lt;/p&gt;

&lt;p&gt;It is a Pronunciation Learning Web Platform, where the user will be prompted with an English word (like, say, "apple") and will try to pronounce it correctly. After that, the system will try to understand that pronunciation with Speech to Text technology and will return if the user has spelled it right or wrong, based on a parameter called "Confidence" in Speech To Text technologies.&lt;/p&gt;

&lt;p&gt;Since good STT is still a heavy and expensive technique, I'm planning to make two types of accounts, where:&lt;/p&gt;

&lt;p&gt;Free Account - Speech to Text will be done using the Web Speech API(&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API&lt;/a&gt;), where the user has to use a browser who have support for that technology.&lt;/p&gt;

&lt;p&gt;Paid Account - The user can use mostly any browser, and the Speech to Text will be done in a Server.&lt;/p&gt;

&lt;p&gt;I'm planning to make that distinction using the Web Monetization API. I still don't have a good understanding of how Licenses work, but I want to make it Open Source.&lt;/p&gt;

&lt;p&gt;Is this project viable for DEV's &lt;a href="https://dev.to/devteam/announcing-the-grant-for-the-web-hackathon-on-dev-3kd1"&gt;https://dev.to/devteam/announcing-the-grant-for-the-web-hackathon-on-dev-3kd1&lt;/a&gt; and Mozilla's &lt;a href="https://www.grantfortheweb.org/apply" rel="noopener noreferrer"&gt;https://www.grantfortheweb.org/apply&lt;/a&gt; Grant fort he Web? I'm asking cause even though I use Web Monetization, it does not seem like I'm helping with the distribution, and discoverability of content online.&lt;/p&gt;

&lt;p&gt;Is this project eligible?&lt;/p&gt;

</description>
      <category>gftwhackathon</category>
      <category>webmonetization</category>
      <category>help</category>
    </item>
    <item>
      <title>Is Preact SEO friendly?</title>
      <dc:creator>Matheus Luz</dc:creator>
      <pubDate>Wed, 01 Jan 2020 05:30:50 +0000</pubDate>
      <link>https://dev.to/matluz/is-preact-seo-friendly-1pbb</link>
      <guid>https://dev.to/matluz/is-preact-seo-friendly-1pbb</guid>
      <description>&lt;p&gt;I've been searching for this, but I can't find a definitive answer anywhere. Some posts seens to hint that preact can be good for SEO, but does it need to use SSR for it?&lt;/p&gt;

&lt;p&gt;How dev.to handles good SEO pages using preact? &lt;/p&gt;

&lt;p&gt;Considering that SSR is the answer, Does it need to have SSR in every page?&lt;/p&gt;

</description>
      <category>help</category>
    </item>
    <item>
      <title>Trying to understand Components (in general)</title>
      <dc:creator>Matheus Luz</dc:creator>
      <pubDate>Mon, 29 Jul 2019 22:49:30 +0000</pubDate>
      <link>https://dev.to/matluz/trying-to-understand-components-in-general-4eji</link>
      <guid>https://dev.to/matluz/trying-to-understand-components-in-general-4eji</guid>
      <description>&lt;p&gt;So, I'm still struggling to decide what makes a good component during the development of a web application. How do I know if my component is too big? or if it is too small? Does a component always have to be developed with reusability in mind? &lt;/p&gt;

&lt;p&gt;It would be a great help if there is some good learning resource to teach patterns in Components to understand the DOs and DONTs when creating a new component.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>discuss</category>
      <category>codequality</category>
      <category>help</category>
    </item>
  </channel>
</rss>
