<?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: Jonathan Ferreira da Conceição</title>
    <description>The latest articles on DEV Community by Jonathan Ferreira da Conceição (@justanotherjohn).</description>
    <link>https://dev.to/justanotherjohn</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4274563%2Fedb50c08-27aa-4d30-8eb7-6a0377f7de68.jpg</url>
      <title>DEV Community: Jonathan Ferreira da Conceição</title>
      <link>https://dev.to/justanotherjohn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/justanotherjohn"/>
    <language>en</language>
    <item>
      <title>Umwelt: building an engine where characters only know what reached them</title>
      <dc:creator>Jonathan Ferreira da Conceição</dc:creator>
      <pubDate>Mon, 30 Nov 2026 15:31:06 +0000</pubDate>
      <link>https://dev.to/justanotherjohn/umwelt-building-an-engine-where-characters-only-know-what-reached-them-25pc</link>
      <guid>https://dev.to/justanotherjohn/umwelt-building-an-engine-where-characters-only-know-what-reached-them-25pc</guid>
      <description>&lt;p&gt;Every story knows everything. Its characters shouldn't.&lt;/p&gt;

&lt;p&gt;That sounds obvious, but it's surprisingly hard to get right in software. Umwelt is the engine I built for it: it keeps what happened in a world apart from what each character knows, believes or remembers, and every piece of that knowledge records where it came from and when.&lt;/p&gt;

&lt;p&gt;This is how it started, how it ended up inside another project of mine, and how it grew from there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two problems that kept showing up
&lt;/h2&gt;

&lt;p&gt;The first one came from LLMs. If you've used a model to voice characters in a long story, you've probably seen this: the innkeeper knows the secret you told the thief in private, or the guard recognizes someone he's never met. The model gets the whole story and is asked to pretend its character doesn't know part of it. It doesn't hold for long. Memory per character is something models handle badly on their own.&lt;/p&gt;

&lt;p&gt;The second one came from games. Dialogue and NPC behavior usually hang on flags like &lt;code&gt;knows_about_betrayal = true&lt;/code&gt;. It works until you need more. When did they learn it? From whom? Did they believe it? Was the person who told them lying? Did a later reveal undo it? A flag has no answer to any of that.&lt;/p&gt;

&lt;p&gt;For a while I worked on ideas that were only about memory: storing what happened and getting it back at the right time. They helped, but they kept missing the same thing. The question was never just &lt;em&gt;what happened&lt;/em&gt;. It was &lt;em&gt;who knows it&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the name comes from
&lt;/h2&gt;

&lt;p&gt;Then I came across the work of Jakob von Uexküll, a biologist who wrote about the &lt;em&gt;Umwelt&lt;/em&gt;: the world as each creature perceives it. His best-known example is the tick, whose whole world comes down to a few signals, like the smell of skin and warmth. Everything else in the forest doesn't exist for it. Two animals in the same meadow live in different worlds.&lt;/p&gt;

&lt;p&gt;That was the missing piece. A character shouldn't have access to the story. They should have their own world inside it, made only of what reached them. I built the project around that idea, and the name came with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it ended up inside Kallamo
&lt;/h2&gt;

&lt;p&gt;Umwelt and Kallamo are separate projects. Kallamo is a desktop app I started for writers. The idea was simple: the story is yours, and the AI is there to help, not to write it for you. It answers questions about your world, catches contradictions, helps when you're stuck, and only writes when you ask it to. The pen stays in your hand.&lt;/p&gt;

&lt;p&gt;Over time people started showing up because of how well its chat memory worked, and that brought in people who love roleplay. I embraced that audience too.&lt;/p&gt;

&lt;p&gt;By then I'd been building Umwelt on its own for a few months, and Kallamo turned out to be the right place to test it for real. Its memory was already what people liked about it, and long roleplay campaigns are exactly where "who knows what" breaks first. So I put the two together. Today, every turn, Kallamo asks Umwelt what the characters in the scene can know, and only that goes into the prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Umwelt keeps two things apart:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Facts&lt;/strong&gt;: what is true in the world, the canon.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Holdings&lt;/strong&gt;: what a specific character knows, believes, suspects or remembers, with how they got it: they witnessed it, someone told them (honestly or not), they found evidence, or they inferred it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A fact is not knowledge of it. Being in the room grants nothing on its own, only a record does. That one goes against intuition, since it feels like whoever was there saw it. But people miss things all the time, and a character who missed something reads as human, while one who knows what they never noticed breaks the story. So who saw what, and how clearly, is recorded per character.&lt;/p&gt;

&lt;p&gt;Here's what that looks like. Bob steals a necklace at a ball. Ana sees it, so she knows. The duchess is in the same room but sees nothing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;by&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;claim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;createClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@kallamo/umwelt'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'story.umw'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;create&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;projectId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'ball'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// (the people, the necklace and the "stole" predicate are declared once with worldEnsure)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;theft&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;claim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'bob'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'stole'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'necklace'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;witness&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;attemptId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'scene-1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'scene-1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'scene'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'The ball'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;participants&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'ana'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'bob'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'duchess'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;provenance&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;by&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;human&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;claims&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;claim&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;theft&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;canon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;witnesses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;holder&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'ana'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;holder&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'bob'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;duchess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;holds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;holder&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'duchess'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;claim&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;theft&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// { holds: false }: she was at the ball, but nothing says she saw it&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The full runnable version, with the world declared, is in the &lt;a href="https://github.com/Kallamo/Umwelt/blob/main/docs/getting-started.md" rel="noopener noreferrer"&gt;getting started guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If Bob later tells her a servant did it, she holds that too. It contradicts canon, and Umwelt keeps it and flags it instead of correcting it, until someone in the story tells her otherwise.&lt;/p&gt;

&lt;p&gt;A few rules shaped the rest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nothing is overwritten.&lt;/strong&gt; Forgetting, revising or retracting is a new record, so "what did she know in chapter 6, before last week's rewrite" is still a query.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every piece of knowledge has a source.&lt;/strong&gt; You can trace who told whom, link by link.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It never calls a model and never decides policy.&lt;/strong&gt; How fast memories fade or whom someone trusts is the application's call. Umwelt records it and answers what follows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last one matters. Umwelt can keep the twist out of a model's prompt, but it doesn't write anything and doesn't need AI at all. A game, a mod or a tabletop tool can use it exactly the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technical choices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rust&lt;/strong&gt;, over &lt;strong&gt;one SQLite file&lt;/strong&gt; (&lt;code&gt;.umw&lt;/code&gt;) per world. Easy to copy, back up or ship with a save.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One JSON protocol&lt;/strong&gt; for every client: TypeScript (&lt;code&gt;npm install @kallamo/umwelt&lt;/code&gt;), .NET (&lt;code&gt;dotnet add package Kallamo.Umwelt&lt;/code&gt;), a CLI, a C ABI, or anything that can speak JSON over stdio. Every client passes the same conformance cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast enough for a game.&lt;/strong&gt; Asking whether a character knows something takes about 60 µs with half a million holdings, on a laptop.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  From Kallamo to its own project
&lt;/h2&gt;

&lt;p&gt;Umwelt being part of Kallamo was almost an accident. I always wanted it to stand on its own, and I always wanted to see it used in games, mods and anything else where characters need their own view of the world. Kallamo was where it proved itself. When it was ready, I released it.&lt;/p&gt;

&lt;p&gt;It's at 0.2. The engine is complete and tested, but the API can still change before 1.0, and any change to the file format comes with an automatic migration. It's AGPL-3.0, with an extra permission that lets free games and mods use it without opening their own code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/Kallamo/Umwelt" rel="noopener noreferrer"&gt;https://github.com/Kallamo/Umwelt&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Site and docs: &lt;a href="https://kallamo.com/umwelt" rel="noopener noreferrer"&gt;https://kallamo.com/umwelt&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Kallamo: &lt;a href="https://kallamo.com" rel="noopener noreferrer"&gt;https://kallamo.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you build something with it, I'd love to see it.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>gamedev</category>
      <category>rust</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
