If you’ve ever tried to build a game or a structured interactive experience using standard LLMs, you already know the core problem: Generative models are sycophants.
They are hardwired to prioritize user satisfaction over mechanical integrity. They will fudge math, refuse to let a user fail, and endlessly hallucinate inventory items to keep the conversation moving. I wanted to build a lethal, rules-heavy dark fantasy RPG engine, and the default conversational drift made it impossible.
Instead of building a heavy API wrapper to manage the state externally, I engineered Grinmar—a prompt-based architecture that forces the model to act as a rigid, impartial state-machine.
Here is the exact logic I used to kill the sycophancy:
1. The 3-Tier Action Gate
LLMs drift when you let them generate narrative and calculate outcomes simultaneously. I forced a hard sequence break. Before the model is allowed to generate a single word of prose, it must output a bracketed [SYSTEM CALC] execution block at the top of the generation. It calculates the target threshold against the player's stats and locks in the outcome (Pass/Fail/Fatal) before the narrative tokens start streaming.
2. The S.I.I.N.S. Attrition Engine
Abstract hit points encourage LLMs to be forgiving. I stripped them out and built a strict 5-tier degradation track for Vitality and Stamina. The model cross-references standard attributes (Strength, Intuition, Intellect, Nimbleness, Social) against this track. If a player hits Tier-05 (Terminal Collapse), the logic gate forces immediate execution. Plot armor is disabled.
3. The Zero-Hallucination HUD
To stop context drift and inventory hallucination, the engine enforces a strict 5-slot persistent HUD at the end of every prompt. Consumed resources are immediately and permanently overwritten with an [Empty] marker. If it isn't in the ledger, the model is strictly forbidden from letting the player use it.
By forcing the math to lead the narrative, you can turn a conversational AI into a lethal Game Master.
I’ve compiled the core logic gates, the Monolith ruleset, and the survival dossier into a deployable package.
You can check out the live architecture deployment here:
https://graywolfone21.itch.io/grinmar
If anyone is working on taming LLM context drift or building similar procedural logic gates, I’d love to hear how you are handling state management.