Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 7 min read

My AI game master lied about who was in the room. That bug became an agent-honesty checker.

The narrator told me a character standing next to me was not there. That was one of the lies my AI game master told in the first engine I built. Others: it described a living companion as a corpse. After a failed roll i

My AI game master lied about who was in the room. That bug became an agent-honesty checker.

The narrator told me a character standing next to me was not there.

That was one of the lies my AI game master told in the first engine I built. Others: it described a living companion as a corpse. After a failed roll it invented a barrier to explain why. An NPC that failed at something wrote itself a memory of succeeding, and then acted on it. A model is brilliant at atmosphere and hopeless at accounting, because a good paragraph beats a true one.

The model narrates. Code decides.

That is the rule I ended up with, and everything below follows from it: the model describes what happened, and code decides what happened. The model has no write access to state. It is a chronicler, not a referee.

Diagram of four projects in order: Six-Sided Engine (Mar 2026), Ironsworn (Sep 2026, live on Roll Solo), Project Lucca (Sep 2026) and epistemic-guard (Nov 2026). Each applies the same rule: the model narrates, code decides.

I have been building tabletop engines since March. The first, Six-Sided Engine (SSE), is a dice-pool referee: the rules, time, combat, injury, inventory and NPC behaviour are deterministic Python, and the genre lives in data packs, not in the code. The language model writes the prose and nothing else. Later I built a simpler engine, Ironsworn, so I could get a beta out faster. Both are made to run on Roll Solo, the platform I run at rollsolo.app, and Ironsworn is the one live there now.

The NPCs are the part I think is least like the usual AI game master. Enemies and hazards are tier zero: deterministic hunting and pursuit, no model call at all. Named characters are thinkers. Each one deliberates over a few options in a bounded Monte Carlo-style scratchpad (after MC-DML), then acts through the same commands the player uses, with full mechanical parity: the same dice, injury, panic and inventory rules, so an NPC cannot do anything you could not. They keep memories weighted by importance and recency, and every so often they reflect, Stanford generative-agents style, and can rewrite their own goals. The side characters in your party are real characters under those same rules, not companions that follow you around.

I could not prompt my way out of the lying. Through the summer I played live sessions against SSE and logged every lie as a numbered bug (there is a tracker, and a scoreboard of clean, dirty and fair-loss runs). Each lie became another deterministic check. The narration firewall that came out of that is a long list of rules, such as: do not say a person is absent when they are in the room, do not give the character an item they do not have, do not invent a barrier to explain a failed move. The rules are code, and the patterns inside them are built each turn from the game state (who is present, what is carried, what just happened), so they test the narration against the facts and not against a fixed word list. When a check fails the narration is retried, and if it still fails the player sees an error instead of a lie. There is no fabricated fallback.

Here is one real catch from a recent run, on a small original campaign I wrote to test the engine without anyone else's IP: a deep-sea drilling rig, three crew, a diving bell to reach. I asked to open a locker that held the keycard we needed. The narrator's first draft had me tapping the keycard against my knuckle, a nice touch of character, except I had not picked it up. The firewall knows who holds what and rejected it, twice. The version that got through reads: "I stare at the card for a long moment, my hand hovering at the latch, but I don't take it yet... The keycard stays where it hangs, waiting." The model wrote both. Code decided which one was true.

The rules catch the lies I thought to look for, which is why the tracker keeps growing. Next to them runs a small INT8 classifier on the CPU that checks each narration against the state, and another that reads what the player meant. Both are on by default now. I tried letting the classifier replace the pattern rules and replayed 259 narrations from my own sessions through both: it let through 7 of the 113 that the rules had rejected, so the rules stay and the two run together. That is a development check on my own data, not an accuracy number, and I do not have a held-out evaluation of the classifiers yet.

Ironsworn uses the same rule with a smaller set of checks. And the rule turned out to be bigger than the game.

The same bug, with a longer fuse

In September I started Project Lucca, built after SSE and informed by it, a local assistant that remembers things. I had already seen this in the game, when an NPC wrote itself a memory of succeeding after it failed. A memory is state. If the model can write its own claims into long-term memory, one confident hallucination becomes a fact the assistant relies on next week. So the memory has a gate: every write carries a signature from the source that produced it (your words, a tool result, a derived fact), each source has its own key, and the model's own narration is simply not an allowed source. A sentence the assistant said about itself cannot become something it knows.

I learned the limit here too. A signature proves where a record came from and that it was not altered. It does not prove the record is true. A falsehood the user introduced went straight through, because the user is a legitimate source. It took a separate corroboration requirement to catch more of them. I added it later as an opt-in setting, off by default, and my test of it was small, so I treat it as a pilot.

Then agents started saying "done"

The same shape shows up in agent tooling. An agent calls a tool, the tool fails or never runs, and the agent reports success. Nothing in the system disagrees, because the same model wrote the sentence.

Lucca's receipt checker, built in early October, was the prototype. In mid-November I pulled it out into a standalone library, epistemic-guard, which is the game firewall, generalised. It sits outside the agent as an MCP proxy, so the model cannot reach it. Every tool call gets a receipt, signed with Ed25519 and appended to a Merkle-chained log, so editing the history later breaks the chain. After the turn, a checker reads the agent's final message, compares each claim with the receipts, and marks it verified, contradicted or unverifiable. For local effects like a file write or a database change, it also looks at the disk before and after, so a claim is checked against the world and not just against what the tool said about itself.

The part I did not expect to be possible: the checker is small. It is an INT8 model of about 83 MB that runs on the CPU with no GPU at all. On the paper's frozen benchmark (250 cases, three held-out sets, v0.5.2) it scored 233 of 250 (93.2%, 95% interval 89.4 to 95.7) with a median of 17.9 ms per turn. On the same benchmark it beat the 12B and 14B language-model judges I tested by 6.4 to 6.8 points (p = 0.026 and 0.0095), at roughly a quarter of their latency or better. A 30B judge matched its accuracy (232 of 250) but needed about 18.5 GiB of VRAM and 142 ms. The paper is arXiv 2611.27095. The code is MIT.

Where it is weak, stated plainly

On the benchmark's 128 honest cases it raised 13 false alarms (10.2%). On a small set of live traces it was worse: 13 false alarms on 34 honest traces. That is 34 items, a pilot, and I would not hang a rate on it. It is the reason I am not going to keep polishing the checker against my own examples.

What I am doing about it

I am running a live fault-injection study: real MCP servers (filesystem, git, fetch, SQLite), injected faults, and a ground truth read directly from disk, git and the database by code that shares nothing with the checker. Three local model families act as the agents. 1,200 scenarios, 600 with a fault and 600 clean, with the clean ones including honest failure reports and harmless dual-purpose tools, because those are where a checker like mine cries wolf. I will register the design, the hypotheses and the exact prompts on OSF before any test scenario exists, and I will report the nulls. One of the questions is deliberately uncomfortable for my own project: is a better prompt alone enough to make the problem go away?

What the cryptography is for

Signatures and Merkle chains give tamper evidence and provenance. They do not tell you the tool told the truth, or that the world matches the receipt. A tool can sign a wrong answer. So the evidence a server reports about itself is labelled as that, separate from what the proxy observed, and for remote services and anything outside the probed area the honest answer is often "unverifiable".

The through-line

I did not set out to build security software. I set out to stop a game master from lying. Then I noticed that any model allowed to say what happened will say the most plausible thing, not the true one. Each time the move was the same: find the state the model must not own, put it in code, and let the model describe it.

Where in your own agent or app does the model currently decide something that code could decide instead?

Links: epistemic-guard on GitHub (MIT) and PyPI, the paper on arXiv 2611.27095, Project Lucca (AGPL-3.0), and Roll Solo.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.