← All projects

Project case study

SimuHuma

A pixel-art town whose 14 software residents can arrive knowing nothing and learn it for themselves, built to study how AI agents learn and interact.

Role
Designer and sole developer
Status
Live
Timeline
August 2026 to present
Evidence
Residents who start knowing nothing found food on 27% to 34% of tries by their fifth to seventh day, against 11% to 13% with learning off.
Evidence
A local 4B model wrote all 105 decisions and 59 spoken lines in a recorded run of the written cast.
Evidence
605 API tests and 183 web tests passed on November 15, 2026.
Visit live project
multi-agent-systemsagent-memorybelief-diffusionsimulationreinforcement-learningfastapireactpixijs
SimuHuma
Project preview · SimuHuma

SimuHuma is a small town that runs on its own. It can run two ways. In the first, fourteen written characters wake up, go to work, eat, talk, pass on news and change their plans, and every one of them can be opened up to see what they know, what they believe, where each belief came from and why they did what they just did. In the second, which is what the live site shows now, the same fourteen bodies arrive with no names, jobs, homes or goals and have to work out the town for themselves. I designed and built it to learn how AI agents interact with each other, and what they can learn, when they have to live with what they remember.

Watch the live town

The question behind it

Most agent demos give each agent a running transcript and let a model improvise from it. That makes for lively conversation, but you cannot easily ask an agent why it believes something, who told it, or whether it was ever true. I wanted a world where those questions have answers.

So SimuHuma keeps two things strictly apart:

  • World truth. What actually happened, recorded by a deterministic simulation engine as an append-only event log.
  • Each resident’s subjective view. What that resident saw or was told, how confident they are, and the chain of sources behind it.

A resident can be wrong. A rumor can spread. A correction can arrive too late. Because the two layers never mix, the system can always show the gap between what is true and what a resident thinks is true.

My role

I designed SimuHuma and built it on my own: the simulation rules, the memory and belief model, the agency loop, the API, the observer interface and the research tooling. The pixel-art world, the resident cast and the research protocol are also my work.

How it works

The backend is a FastAPI service with a deterministic simulation kernel. Each tick moves the clock, runs resident routines and validates any action a resident proposes before it touches the world. Nothing a resident decides changes the world directly; it proposes, and the engine accepts or rejects.

Each resident has layered memory instead of one transcript: observations, episodes, semantic knowledge, beliefs with confidence and provenance, relationship memory, commitments, open loops and a short self-narrative. The agency loop turns events and need changes into options, picks a short plan with weighted choices and records the outcome so the resident can learn from it. Every decision keeps a trace of the terms that produced it.

The web client is React and TypeScript with PixiJS drawing the town. It streams world changes over a WebSocket and layers inspection tools around the map: a resident lens, a knowledge graph view, a scenario lab, a research lab and a replay lab.

Language models are optional. The same cognition interface can run on a deterministic mock, a local Ollama model, or an OpenAI-compatible or Gemini endpoint. Without a model, residents act on their needs, habits and weighted chance, and speak from templates shaped by their personalities. That costs nothing, which is why the public demo runs that way.

Starting from nothing

The written cast is still scripted underneath: Abigail opens the cafe at 7 because her schedule says so. I wanted residents that are not predetermined at all, so I built a newborn mode. It keeps the town and strips each resident back to a body.

A newborn gets hungry, tired and lonely. It can try four things anywhere (eat, rest, be with others, wait) or walk to a neighboring place, and it has the fruit-fly reflexes described below. That is all it is given. It sees places only as anonymous tokens like place-08, shuffled for every run, so nothing tells it which building is the cafe, when the pub opens, or that homes smell of food but never serve it. It has to find out by trying.

Each resident learns with a small table of how well each action has worked in each situation (Q-learning), plus a pull toward things it has not tried, the fly-brain urges, and replay of its own past outcomes so that value spreads back along a route faster. When one resident eats, anyone watching nudges their own idea of what that place is worth. That is the only way experience passes between them. The resident panel shows what each one has found out and the numbers behind its last choice.

Newcomer 07 selected in the live newborn town on day three, with the Learned tab showing the place as it knows it, place-08, what it is doing, the outcome of its last action, and the probabilities behind its last decision broken into learned value, curiosity and urge

To check that the learning is doing the work, I ran three towns for seven simulated days, then ran the same three towns again with learning switched off, so residents acted on curiosity and fly-brain urges alone.

Days 5 to 7, three towns Learning on Learning off
Tries that found food 27% to 34% 11% to 13%
Time spent starving over the week 19% to 23% 56% to 59%
In the same place as the same hour the day before 12% to 15% 6% to 7%

Both groups found the food places. Learning is what made residents go back to them at the right time of day. It is also slow: after a week, a learning resident still starves about a fifth of the time and fails two of every three tries to eat.

A language-model mind on top

The learning table never reads a word, so it cannot name anything or say what it wants. For recorded runs I added an optional mind: a local model that sees only what the resident perceives and remembers, with nothing about the town, and can name itself and places, speak, keep a diary and set its own goals. On November 14, 2026, I ran a town for 45 minutes on my desktop with Qwen3 4B as the mind for six residents and the learning table alone for the other eight.

The model answered all 2,905 calls, in under a second each. It also made its residents worse at living. They found food on 2.8% of tries against 12.4% for the residents without a mind, starved for 71% of the run against 45%, and three of them collapsed from exhaustion. The mind kept choosing to eat wherever it stood, writing things like “I haven’t seen food in Haven Hall, so I decide to try to eat.” Four of the six named themselves Kai, each one gave every place it found the same name, and nearly every line spoken was a version of “I’m new here, can you tell me about this place?”

Newcomer 02’s Learned tab at the end of the mind run: it named itself Kael and its neighbors Milo, Lena and Marek, managed 28 meals in 591 tries, collapsed from exhaustion on day four, and named every place it found Cedar Hall

So the learning table now has a veto: the mind still decides, unless experience says its choice is clearly worse here than the table’s own pick. A resident also can no longer give two places or two people the same name. Those changes are tested but have not had a recorded run yet.

Two recorded runs of the written cast

Running a hosted model for 14 residents around the clock would cost hundreds of dollars a month, so I recorded runs on my own desktop instead. Each ran for about 46 minutes with every resident’s decisions coming from Qwen3 4B Instruct, served locally by Ollama on an RTX 3080, and a seed drawn at random. The clock ran at one simulated minute every two seconds, which covered day one at 8:58 AM through 7:18 AM on day two. A 14B model was the first choice but would not load on that machine at the time.

When something caught a resident’s attention, such as a neighbor walking past or a need running low, the model got that resident’s own memories, beliefs, goals and relationships and chose what to do: move somewhere, speak to someone nearby, watch, or wait. The engine checked every choice before applying it, and anything it refused fell back to the rule-based choice.

The town at 7:15 PM on day one of the second recorded run, with most residents gathered on the green to socialize and the status bar reading Backend ready with the model connected live

First run: the check rejected most of the talking

On November 13, 2026, the model wrote 79 of 112 decisions. The other 33 fell back to rules, and most of them were attempts to speak. Residents spoke 23 times, but only 6 of those lines were the model’s; the other 17 were template lines.

The cause was a mismatch, not the model’s judgment. It wrote a long rationale first and then left the listener and the words empty, or named a claim the resident could not back, and the check rejected the whole choice. I changed three things: the answer format now asks for the listener and the words before the rationale, small slips like a capitalized name are repaired, and a choice that still fails goes back to the model once with the reason before the fallback takes over.

Second run: every decision and line came from the model

On November 14, 2026, with that fix and a new random seed, the model wrote all 105 decisions and all 59 lines residents spoke on their own. None fell back to rules.

The reasoning got shorter and stayed in character. Deciding what Abigail should do when Elsa walked past, the model wrote that “Abigail’s goal to make the cafe a civic gathering place aligns with attending the meeting together.” Some lines carried their source with them, as when Lucien told Sam, “I heard abigail mentioned the noon town-hall meeting.” Early on day two, Abigail asked Lucien, “Would you be open to meeting at the town hall to talk about how we can make the cafe a place for everyone?”

Abigail selected among the residents gathered on the green during the second run, with her Decisions tab open beside the map: a decision at 6:06 PM on day one, triggered by Elsa walking past, with two sentences of reasoning from the model tying the town-hall meeting to her goal for the cafe

The second run also showed the next problem plainly. Every one of the 59 lines was about the town-hall meeting, and only 39 were distinct. The meeting time was the only claim residents had to share, so a small model kept coming back to it, and residents were still inviting each other to a noon meeting late at night and into day two. More things worth talking about, and a sense of what has already happened, matter more now than a larger model.

A fly’s brain under every resident

In the cast, Wren and Basil have an extra layer, and newborn residents all have it. Their basic drives (feeding, escape, grooming, moving and approaching others) come from a leaky integrate-and-fire simulation of the FlyWire fruit-fly connectome. The drives are felt urges, not knowledge: they re-weight choices the agency system already offered and can never change the world on their own.

Running the full connectome live needs a 3.25 GB dataset and a separate brain service, and building the table took about 40 minutes on a desktop GPU. The project ships that precomputed response table, and the live demo reads from it, which is why it runs on a small container. In the cast, the fly-brain layer re-weights the rule-based decision loop, so it was switched off for the recorded cast runs. In newborn mode it is a reflex: one of the three things added up when a resident chooses.

Wren Halloway’s Brain tab in the resident lens: connectome drives with feeding at 90 percent and locomotion at 73 percent from the table fallback, and the stimuli from her last step, including food nearby and crowding

Scenarios, research and replay

The scenario lab holds prepared situations, such as a Valentine’s party, an election, a game of rumor telephone, a secret leak, a conflict, a scarcity crisis and a storm. Each one runs in mock mode with a fixed seed so it plays out the same way every time.

The scenario lab listing prepared scenarios including Valentine’s party, Election, Rumor telephone, Secret leak, Conflict and Scarcity, each with its seed, a 180 simulated minute duration and Run and Reset buttons, which are disabled in the watch-only demo

The research lab runs a fixed battery of four studies on how belief spreads: a true rumor, a false rumor, the timing of a correction, and contradictory testimony. Each study runs across fixed seeds and compares memory with provenance against simpler baselines. The thesis being tested is narrow on purpose: that tracking where a belief came from makes information spread more accountable without stopping it from spreading.

The replay lab treats the event log as immutable. You can pick any point in a run, read the events up to it and open an isolated branch from there without touching the original.

The replay lab showing run hearthmere-alpha with seed 42 in mock mode, an event-log hash, a cut point at the end of the run with 1,571 events, and the first events of the read-only prefix

Key decisions

  • Deterministic first. Without a model, seeded randomness means a run can be replayed exactly, which is what the research battery needs. A language model makes the town more vivid but harder to reproduce, so it stays optional.
  • Proposals, not actions. Residents never write to the world. Keeping one validator in charge of truth is what makes the belief traces honest.
  • Bounded knowledge. You can talk to a resident, but the reply is built only from that resident’s own retrieved memories and beliefs, and any record it cites must come from those lists. A reply that cites anything else is sent back once for repair and refused if it still does not comply.
  • A watch-only public demo. The public site gives every visitor the observer role. Starting, pausing, resetting, steering and branching runs all return 403, so the demo cannot be broken or abused, and it needs no sign-in.

Results

  • Newborn learning: measured offline on November 15, 2026, across three towns over seven simulated days, residents found food on 27% to 34% of tries by days 5 to 7, against 11% to 13% for the same towns with learning off.
  • Newborn mind: on November 14, 2026, a local 4B model as the mind for six residents answered 2,905 of 2,905 calls, and those residents found food on 2.8% of tries against 12.4% for the eight without one.
  • Recorded cast runs: on November 13, 2026, a local 4B model wrote 79 of 112 decisions and 6 of 23 spoken lines. On November 14, 2026, after the fix, it wrote 105 of 105 decisions and 59 of 59 lines.
  • Tests: on November 15, 2026, 605 API tests and 183 web tests passed. 3 API tests were skipped: two need PowerShell 7 and one needs a Postgres server.
  • Demo footprint: over 10 hours of newborn mode on November 15, 2026, Railway reported the API averaging under 0.01 of a CPU core and 0.24 GB of memory, about $2.50 a month. The written cast used about the same memory and roughly 8 times the CPU over the 24 hours before the switch.
  • Research findings: not yet measured. The battery runs, but I have not published results from it.

Limits and next steps

The public demo runs newborn residents with learning tables and fly-brain reflexes, and restarts with a new town every seven simulated days, about 2.8 hours. Nothing there speaks, because the mind runs only on my desktop. The learning is slow, partly because residents can tell day from evening from night but not 6:30 from 7:30, and they cannot plan a route, so value has to soak back along it through repetition. Durable storage on Postgres and the Neo4j graph projection are built but switched off in the demo to keep it free of infrastructure.

Next, I want to record a mind run with the veto on to see whether a mind can add names, speech and goals without costing a resident its meals, give residents a rough sense of time, and run the research battery across more seeds and publish the results. The full design, algorithm, decision log and results for newborn mode are written up in the project’s docs.

The connectome model builds on the FlyWire connectome (Dorkenwald et al. and Schlegel et al., Nature 2024) and the leaky integrate-and-fire model of Shiu et al. (Nature 2024). The precomputed response table is shared under CC BY-NC-SA 4.0.

Start a conversation

Talk with Leif about work like this.