<?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: Diannian1337</title>
    <description>The latest articles on DEV Community by Diannian1337 (@diannian1337).</description>
    <link>https://dev.to/diannian1337</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%2F4273293%2F3fef5c5e-5bf2-466c-bf49-a7ca9248c73a.png</url>
      <title>DEV Community: Diannian1337</title>
      <link>https://dev.to/diannian1337</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/diannian1337"/>
    <language>en</language>
    <item>
      <title>Hollow Lantern: building an AI werewolf game where only you remember, with Kiro</title>
      <dc:creator>Diannian1337</dc:creator>
      <pubDate>Mon, 30 Nov 2026 04:02:19 +0000</pubDate>
      <link>https://dev.to/diannian1337/hollow-lantern-building-an-ai-werewolf-game-where-only-you-remember-with-kiro-2ic7</link>
      <guid>https://dev.to/diannian1337/hollow-lantern-building-an-ai-werewolf-game-where-only-you-remember-with-kiro-2ic7</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is written as part of the &lt;strong&gt;Kiroween 2026 hackathon&lt;/strong&gt;. It covers how I built Hollow Lantern, a single-player social-deduction game where every other seat is an AI, and how I used Kiro to turn a pile of experiments into one portable desktop app.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjrn07e7f8op8h9vzoqwx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjrn07e7f8op8h9vzoqwx.jpg" alt="Hollow Lantern title screen" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Demo video (under 3 minutes):&lt;/strong&gt; &lt;a href="https://youtu.be/PD1OaQZGd3M" rel="noopener noreferrer"&gt;https://youtu.be/PD1OaQZGd3M&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code (MIT, with the &lt;code&gt;.kiro&lt;/code&gt; folder):&lt;/strong&gt; &lt;a href="https://github.com/Diannian1337/hollow-lantern" rel="noopener noreferrer"&gt;https://github.com/Diannian1337/hollow-lantern&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Download (Windows, one portable exe):&lt;/strong&gt; &lt;a href="https://github.com/Diannian1337/hollow-lantern/releases/tag/v0.1.0" rel="noopener noreferrer"&gt;https://github.com/Diannian1337/hollow-lantern/releases/tag/v0.1.0&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/PD1OaQZGd3M" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea: a werewolf game where only you remember
&lt;/h2&gt;

&lt;p&gt;On Halloween night the starliner &lt;em&gt;Hollow Lantern&lt;/em&gt; drifts powerless in a purple nebula. The guests wear masks, and some of the faces behind them are Wolves. You are the Lantern-keeper. Every other seat, 7, 9 or 11 of them, is played by a large language model with its own personality, secret role and plan. They talk, accuse each other, claim roles, lie, form alliances and vote someone into the Cold every day.&lt;/p&gt;

&lt;p&gt;Two things make it more than "werewolf with a chatbot":&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Time rewind.&lt;/strong&gt; When you die, your pumpkin-shaped pocket watch can take you back to an earlier moment of the same game, for time shards. The AIs remember nothing. You remember everything: who claimed what, who lied, who voted with whom. The random seed stays the same, so the same people make the same opening moves, and you get to change what happens next. The AI prompts never mention rewinding. It is purely your ability, and if you tell the crew "I've seen this before", they treat it like any other suspicious claim.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A post-game review that unmasks the liars.&lt;/strong&gt; After the ending, the review shows every character's true role and secret plan, lists every fake claim and false result together with what the liar was thinking at that moment, and marks each claim in the full log as TRUE or LIE. Playing against LLMs is much more fun when you can see afterwards how they fooled you.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The game is presented as a trial-style visual novel: an opening on the ship's bridge, character cards, the morning meeting, challenges and confrontations with witnesses, the vote, private talks in the cabins and the night. All characters, names and art are original.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgfxamnn52jdxwykaad4a.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgfxamnn52jdxwykaad4a.jpg" alt="An AI character speaks in the morning meeting" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Frankenstein
&lt;/h2&gt;

&lt;p&gt;I entered the Frankenstein category because the game is stitched together from parts that do not normally live in one app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Three LLM providers in one engine.&lt;/strong&gt; Claude Haiku 5.5 is the default; DeepSeek Flash and GPT-6 Luna work too, behind one prompt layout. Every AI call returns structured JSON, and the engine, not the model, owns the truth: it checks every role claim against the rules, so a real Engineer can only report a real result, while Wolves and the Traitor are free to fake-claim.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt caching everywhere.&lt;/strong&gt; The shared rules and each character card are cached, and the speech log is laid out so each call reuses the previous prefix. While balancing the game I ran more than 200 full AI games, and a 10-player game costs about a quarter of a dollar with an 80% cache hit rate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local voices.&lt;/strong&gt; The AI characters speak English lines out loud with Kokoro-82M, a speech model that runs on the CPU through onnxruntime-node inside the game's Node server. No network, no key, 16 cast voices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A visual-novel UI with no build step.&lt;/strong&gt; Plain ES modules on a fixed 1600x900 stage, English and Simplified Chinese.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An Electron shell&lt;/strong&gt; that wraps all of the above into one portable exe. This is the part Kiro built.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How I split the work between AI agents
&lt;/h2&gt;

&lt;p&gt;The game itself grew in a "lab": a small local site where I could run AI-only games, read every prompt and every answer, and tune the rules. That phase was all experiments. Should Wolves be allowed to fake-claim on Day 1? (Yes, and it is the most fun part.) Why do humans win 81% of the time? (Not enough Wolves. Adding one brought it close to even.) Should the prompts ban stupid moves like "never vote for the Engineer"? (No. Hard bans kill variety; explaining the facts and letting the model reason works better.) I iterated on the engine and the browser UI with other AI coding agents (Claude) in parallel, several conversations at once.&lt;/p&gt;

&lt;p&gt;That left a real problem: a folder of Node scripts is not something a judge can double-click. I needed a desktop app that runs the unmodified game server, stores API keys safely, survives crashes and ships as one exe, built while other agents were still changing the game underneath it. That is the job I gave to Kiro, and I treated it as a separate product with its own spec.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spec-driven development: the desktop app
&lt;/h2&gt;

&lt;p&gt;The spec lives in &lt;code&gt;.kiro/specs/desktop-app/&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;requirements.md&lt;/code&gt;&lt;/strong&gt;: 13 requirements in user-story form with acceptance criteria. Start the game as a desktop app; a proper 16:9 window; every game feature works unchanged; key settings; the server process; menu and shortcuts; security; one portable exe; developer workflow and tests. Later: three AI providers, Settings reachable from inside the game, three fixed models with nothing to configure, and packaged voices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;design.md&lt;/code&gt;&lt;/strong&gt;: the architecture. The shell forks &lt;code&gt;game-ui/server.js&lt;/code&gt; unchanged with Electron's &lt;code&gt;utilityProcess&lt;/code&gt; on a free port, and shows the page through a private &lt;code&gt;hollow://game/&lt;/code&gt; scheme. That gives the page a stable origin, so saved settings and the rewind state survive port changes. Keys are encrypted with Electron's &lt;code&gt;safeStorage&lt;/code&gt; (Windows DPAPI) and redacted from every log line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;tasks.md&lt;/code&gt;&lt;/strong&gt;: 22 tasks, each ending with a &lt;strong&gt;"Done when"&lt;/strong&gt; check that Kiro had to run before ticking the box. Tasks 6 and 15 are checkpoints where Kiro stops and tells me what to try by hand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The biggest difference from vibe coding was that &lt;strong&gt;changes went into the spec, not into chat&lt;/strong&gt;. When I decided the release should be a single portable exe and nothing else, that became Requirement 11 and tasks 17 and 18. When the voices arrived, it became Requirement 13 and task 20. Each Kiro run started by reading the spec, so a new session never lost the reasons behind an earlier decision, and the design doc kept an "Amendment" section for every change of direction.&lt;/p&gt;

&lt;p&gt;The "Done when" checks also turned up real platform bugs that I would never have found by reading code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On Windows, &lt;code&gt;setAspectRatio(16/9)&lt;/code&gt; applies to the outer frame, not the content, so the game area came out 1430x776. Kiro measured it and computes the frame ratio from the current size instead.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;utilityProcess&lt;/code&gt; has no pid until the process has really started, so an early force-kill silently did nothing.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app.getLocale()&lt;/code&gt; is empty before &lt;code&gt;ready&lt;/code&gt;, so the error page showed English on a Chinese PC.&lt;/li&gt;
&lt;li&gt;The portable exe unpacked to a fixed temp folder. Double-clicking twice made the second launcher overwrite the first one's files mid-start, and the server failed with &lt;code&gt;ERR_MODULE_NOT_FOUND&lt;/code&gt;. Kiro read electron-builder's NSIS source and found that only &lt;code&gt;unpackDirName: true&lt;/code&gt; gives each launch its own folder.&lt;/li&gt;
&lt;li&gt;Speech synthesis blocked the server's main thread for a few seconds, the server reset reused keep-alive sockets, and the page got 502s. Kiro reproduced it in plain Node, and the proxy now opens a fresh loopback connection per request.&lt;/li&gt;
&lt;li&gt;In Electron 45, &lt;code&gt;protocol.handle&lt;/code&gt;'s request signal never fires when the page aborts a request, so dropped voice lines were still synthesized. Kiro wired &lt;code&gt;webRequest&lt;/code&gt; aborts through to the upstream request instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cold start went from about 70 seconds (first broken build) to about 8 to 10 seconds with a 250 MB exe that includes a 100 MB speech model. Kiro measured where the time went (the default 7z mode writes the whole payload to disk three times) and switched the portable to &lt;code&gt;useZip&lt;/code&gt;, which writes each file once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steering: boundaries made the biggest difference
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.kiro/steering/&lt;/code&gt; holds five files. &lt;code&gt;product.md&lt;/code&gt;, &lt;code&gt;story.md&lt;/code&gt;, &lt;code&gt;structure.md&lt;/code&gt; and &lt;code&gt;tech.md&lt;/code&gt; are always included; &lt;code&gt;desktop.md&lt;/code&gt; uses &lt;code&gt;inclusion: fileMatch&lt;/code&gt; on &lt;code&gt;desktop/**&lt;/code&gt;, so the shell conventions load only when Kiro works there.&lt;/p&gt;

&lt;p&gt;The single rule that mattered most was in &lt;code&gt;structure.md&lt;/code&gt;: &lt;strong&gt;&lt;code&gt;lab/&lt;/code&gt; and &lt;code&gt;game-ui/&lt;/code&gt; are read-only for Kiro, because other agents own them.&lt;/strong&gt; Without it, an agent asked to "make the desktop app work" will happily patch the game it wraps, and then the next sync from the lab overwrites the patch. With it, Kiro had to work around problems inside &lt;code&gt;desktop/&lt;/code&gt; and write anything it needed from the game into &lt;code&gt;desktop/NOTES-for-game-ui.md&lt;/code&gt;. That file became a clean hand-off channel between agents: 14 notes, such as "the voice synthesis blocks the server thread, move it to a worker", "Watch mode needs a click without Auto, judges may think it is stuck", and "the shell treats a game as finished only when the page requests &lt;code&gt;?final=1&lt;/code&gt;; keep that contract". The game side picked them up, and resolved ones are marked in the file. Exactly once, in run 6, I granted an explicit exception, so Kiro could add the desktop bridge lines to the title screen and Options. That exception is written down in the notes too.&lt;/p&gt;

&lt;p&gt;Other steering rules that paid off:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never open, print or copy &lt;code&gt;lab/.env&lt;/code&gt; (it holds a real key); test only with Mock games and fake keys.&lt;/li&gt;
&lt;li&gt;Every file in English (I chat with Kiro in Chinese, but the repo is for judges).&lt;/li&gt;
&lt;li&gt;Late in the project: &lt;strong&gt;automated runs are always minimized and muted.&lt;/strong&gt; I was using the same PC while Kiro ran its end-to-end tests, and test windows kept jumping in front of me and talking. Kiro wrote a test window mode (&lt;code&gt;HL_TEST_WINDOW=minimized&lt;/code&gt;: show inactive, then minimize, never focus, auto-cancel native dialogs, mute audio) and added the rule to &lt;code&gt;desktop.md&lt;/code&gt; so every future run follows it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Hooks: tests that run themselves
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.kiro/hooks/desktop-tests.json&lt;/code&gt; has three hooks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PostFileSave&lt;/strong&gt; and &lt;strong&gt;PostFileCreate&lt;/strong&gt; on &lt;code&gt;desktop/src&lt;/code&gt;, &lt;code&gt;desktop/scripts&lt;/code&gt; and &lt;code&gt;desktop/test&lt;/code&gt;: run the desktop unit tests with plain &lt;code&gt;node --test&lt;/code&gt;. It uses node rather than npm because PowerShell's execution policy blocks &lt;code&gt;npm.ps1&lt;/code&gt;, which Kiro found out the hard way in run 1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PostTaskExec&lt;/strong&gt;: after every spec task, run the contract test. It starts the real &lt;code&gt;game-ui/server.js&lt;/code&gt; exactly the way the shell does and plays a short offline game over its API. Since the game was changing under the shell all week, this caught drift between the game, the engine and the shell immediately instead of at packaging time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By the last run the suite was 190 unit tests, 11 contract tests and 13 Playwright end-to-end tests that drive the packaged app, plus a release test script covering cold start, double launch, clean quit, voices and the review page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ten headless runs with the Kiro CLI
&lt;/h2&gt;

&lt;p&gt;All ten build runs went through the Kiro CLI in headless mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kiro-cli chat --v3 --no-interactive --trust-all-tools --trust-workspace --model claude-opus-5.5 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; kiro-runs\prompt-NN.txt &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; kiro-runs\run-NN.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each run got a short prompt file: what changed since the last run, numbered goals, and the rules repeated. Each run ended with a report: what was built, every check that passed with timings, and a section called "could not verify", which I read first. All ten prompts and full logs are committed in &lt;code&gt;kiro-runs/&lt;/code&gt;, so anyone can follow how the desktop app was built step by step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Scaffold, pure modules test-first, server process, &lt;code&gt;hollow://&lt;/code&gt; scheme, main window (checkpoint).&lt;/li&gt;
&lt;li&gt;Logging, key storage, Settings and error pages, menu, crash recovery, packaging, e2e test, hooks, docs.&lt;/li&gt;
&lt;li&gt;Splash screen and safe double launch for the portable exe.&lt;/li&gt;
&lt;li&gt;Per-provider key fields for three AIs, faster cold start, full release test.&lt;/li&gt;
&lt;li&gt;Rebuild for the engine's automatic provider choice.&lt;/li&gt;
&lt;li&gt;Portable exe only; Settings reachable from inside the game.&lt;/li&gt;
&lt;li&gt;Exactly three fixed AIs with nothing to configure; a Settings warning while a game is running.&lt;/li&gt;
&lt;li&gt;Packaging the local voices and the post-game review; cold start from 30 s down to 6 to 9 s.&lt;/li&gt;
&lt;li&gt;The voice worker thread in the package; page aborts reach the server.&lt;/li&gt;
&lt;li&gt;Minimized, muted test mode.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why the CLI? The runs were long (12 to 80 minutes), I wanted a log of every one, and I wanted to start them minimized and keep using my PC. The headless mode with a prompt file made each run reproducible and easy to review afterwards. The spec and steering files did the heavy lifting, so the prompts stayed short.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I did not use (yet)
&lt;/h2&gt;

&lt;p&gt;I did not build custom agents, MCP servers or Kiro powers for this project, and I used example-based tests rather than property-based tests. With more time, the first thing I would try is property-based tests for the engine's claim validator and vote rules, where the space of game states is too big to cover by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Give each agent a fence.&lt;/strong&gt; Read-only folders plus a notes file worked better than any amount of "please be careful".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put decisions in the spec.&lt;/strong&gt; Chat is forgotten; a requirement with a "Done when" check is not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask for "could not verify".&lt;/strong&gt; The most useful part of every Kiro report was the list of things it could not check. That list told me exactly what to test by hand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For LLM games, explain, don't forbid.&lt;/strong&gt; The AI crew got more interesting every time I replaced a rule like "never do X" with the fact that makes X a bad idea.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkosz7qbv0vcphqpyv1nl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkosz7qbv0vcphqpyv1nl.png" alt="Post-game review: every mask taken off" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading. If you try the game, die at least once. That is when it gets interesting.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written for the Kiroween 2026 hackathon.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>kiro</category>
      <category>kiroween</category>
      <category>gamedev</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
