<?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: lingfengqaq</title>
    <description>The latest articles on DEV Community by lingfengqaq (@ksdf_lisjdf_769b87b7b966d).</description>
    <link>https://dev.to/ksdf_lisjdf_769b87b7b966d</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%2F4269215%2F157bcfd5-477a-41c5-b1cf-2e22c8d4628e.png</url>
      <title>DEV Community: lingfengqaq</title>
      <link>https://dev.to/ksdf_lisjdf_769b87b7b966d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ksdf_lisjdf_769b87b7b966d"/>
    <language>en</language>
    <item>
      <title>At Run 13,497, Kiro Disproved Our Own Theorem: Building PhantomFork for Kiroween 2026</title>
      <dc:creator>lingfengqaq</dc:creator>
      <pubDate>Fri, 27 Nov 2026 15:00:35 +0000</pubDate>
      <link>https://dev.to/ksdf_lisjdf_769b87b7b966d/at-run-13497-kiro-disproved-our-own-theorem-building-phantomfork-for-kiroween-2026-3d9f</link>
      <guid>https://dev.to/ksdf_lisjdf_769b87b7b966d/at-run-13497-kiro-disproved-our-own-theorem-building-phantomfork-for-kiroween-2026-3d9f</guid>
      <description>&lt;p&gt;&lt;em&gt;Written as part of the **Kiroween 2026 Hackathon&lt;/em&gt;* (&lt;code&gt;Skeleton Crew&lt;/code&gt; category + &lt;code&gt;Best Kiro Crew App&lt;/code&gt;).*&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Demo (zero login, zero API keys):&lt;/strong&gt; &lt;a href="https://phantomfork.vercel.app" rel="noopener noreferrer"&gt;https://phantomfork.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Main Skeleton Repo (MIT):&lt;/strong&gt; &lt;a href="https://github.com/lingfengQAQ/phantomfork" rel="noopener noreferrer"&gt;https://github.com/lingfengQAQ/phantomfork&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kiro Crew App Repo (MIT):&lt;/strong&gt; &lt;a href="https://github.com/lingfengQAQ/phantomfork-crew" rel="noopener noreferrer"&gt;https://github.com/lingfengQAQ/phantomfork-crew&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;2:09 HD Demo Video:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

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




&lt;h2&gt;
  
  
  The Problem: Postmortems Argue About Counterfactuals Without Proof
&lt;/h2&gt;

&lt;p&gt;Every incident postmortem ends with the same unprovable question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"If we had capped retry budget at 2 before the Postgres pool drained, would those 2,341 failed checkouts have survived?"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Normally you answer with intuition because the production incident is already dead and buried. For &lt;strong&gt;Kiroween 2026&lt;/strong&gt;, we built &lt;strong&gt;PhantomFork&lt;/strong&gt; — a deterministic discrete-event simulation skeleton (&lt;code&gt;@phantomfork/spine&lt;/code&gt;) and reusable React UI kit (&lt;code&gt;@phantomfork/ui&lt;/code&gt;) where you rewind a failure, inject one counterfactual intervention at a single tick, and get a deterministic proof of which failures vanish.&lt;/p&gt;

&lt;p&gt;Because we entered &lt;strong&gt;Skeleton Crew&lt;/strong&gt;, the exact same zero-dependency kernel drives two completely separate apps in one repo:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Incident Autopsy (&lt;code&gt;/autopsy/&lt;/code&gt;)&lt;/strong&gt; — An SRE war room opening in the middle of a &lt;code&gt;03:14&lt;/code&gt; checkout cascade (&lt;strong&gt;2,341 dead checkouts&lt;/strong&gt;). Scrub to tick &lt;code&gt;37&lt;/code&gt;, fork &lt;code&gt;$flag:retryBudget = 2&lt;/code&gt;, and watch dead requests roll to &lt;strong&gt;&lt;code&gt;0&lt;/code&gt;&lt;/strong&gt;, guided by &lt;strong&gt;The Coroner&lt;/strong&gt;, a deadpan ghost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manor Séance (&lt;code&gt;/seance/&lt;/code&gt;)&lt;/strong&gt; — A Gothic midnight murder mystery at Ashgrove Manor powered by the exact same kernel. Keep the library candle lit at tick &lt;code&gt;38&lt;/code&gt;: Clara spots Dr. Thorne spiking the brandy, Lady Ashgrove refuses the glass, and her verdict flips from &lt;strong&gt;&lt;code&gt;MURDERED&lt;/code&gt;&lt;/strong&gt; to &lt;strong&gt;&lt;code&gt;SURVIVED MIDNIGHT&lt;/code&gt;&lt;/strong&gt; under the disapproving gaze of &lt;strong&gt;Butler Wexley&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  What Changed How We Build With Kiro
&lt;/h2&gt;

&lt;p&gt;Before Kiro, writing an AI-assisted multi-package codebase usually turned into endless prompt reminders: &lt;em&gt;"Don't use &lt;code&gt;Math.random()&lt;/code&gt; inside domain rules, don't break the UI types, keep test suites isolated."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;With Kiro (&lt;code&gt;Kiro IDE&lt;/code&gt; + &lt;code&gt;Kiro CLI&lt;/code&gt; running &lt;code&gt;claude-opus-5.5&lt;/code&gt;), we inverted the workflow so the workspace itself enforced invariants while parallel agents worked in isolated worktrees:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;EARS Specs + Frozen Contracts First (&lt;code&gt;.kiro/specs/&lt;/code&gt;):&lt;/strong&gt; Five full specs (&lt;code&gt;spine-kernel&lt;/code&gt;, &lt;code&gt;ui-kit&lt;/code&gt;, &lt;code&gt;incident-autopsy&lt;/code&gt;, &lt;code&gt;manor-seance&lt;/code&gt;, &lt;code&gt;mcp-and-power&lt;/code&gt;) locked &lt;code&gt;packages/spine/src/types.ts&lt;/code&gt; and &lt;code&gt;packages/ui/src/types.ts&lt;/code&gt; &lt;em&gt;before&lt;/em&gt; parallel workers built both apps, MCP server, and Kiro Power.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Path-Scoped Steering (&lt;code&gt;.kiro/steering/&lt;/code&gt;):&lt;/strong&gt; Instead of stuffing a giant rules doc into every prompt, three targeted steering files activate &lt;em&gt;only&lt;/em&gt; when touching matching globs:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;**/domain/**&lt;/code&gt; loads &lt;code&gt;determinism-rules.md&lt;/code&gt; (rules may only read/write through &lt;code&gt;ctx&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**/*.test.ts&lt;/code&gt; loads &lt;code&gt;pbt-testing.md&lt;/code&gt; (write the property before the fix, preserve shrunk counterexamples);&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;**/copy.ts&lt;/code&gt; loads &lt;code&gt;ghost-voice.md&lt;/code&gt; (140-char cap, every ghost line tells you the next tap).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;PreToolUse&lt;/code&gt; Purity Hook (&lt;code&gt;.kiro/hooks/phantomfork-hooks.json&lt;/code&gt;):&lt;/strong&gt; &lt;code&gt;purity-guard&lt;/code&gt; intercepts proposed edits &lt;em&gt;before they touch disk&lt;/em&gt; (&lt;code&gt;exit 2&lt;/code&gt; with a haunted error message if &lt;code&gt;Math.random&lt;/code&gt;, &lt;code&gt;Date.now&lt;/code&gt;, &lt;code&gt;performance.now&lt;/code&gt;, or &lt;code&gt;new Date()&lt;/code&gt; appears in domain code). While testing against real Kiro CLI &lt;code&gt;fs_write&lt;/code&gt; payloads, we even caught that our initial hook script didn't inspect Kiro CLI's &lt;code&gt;file_text&lt;/code&gt; / &lt;code&gt;new_str&lt;/code&gt; fields — fixed and verified!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Letting Kiro Do the Search Over MCP (&lt;code&gt;.kiro/agents/outage-detective.json&lt;/code&gt;):&lt;/strong&gt; Rather than writing a brute-force parameter optimizer inside our TypeScript engine, we exposed 5 compact stdio MCP tools (&lt;code&gt;list_scenarios&lt;/code&gt;, &lt;code&gt;simulate&lt;/code&gt;, &lt;code&gt;fork&lt;/code&gt;, &lt;code&gt;diff&lt;/code&gt;, &lt;code&gt;explain&lt;/code&gt;, each response capped &lt;code&gt;&amp;lt; 8 KB&lt;/code&gt;). Our custom &lt;code&gt;outage-detective&lt;/code&gt; Kiro agent searches counterfactuals autonomously and discovers &lt;code&gt;set $flag:retryBudget = 2 @ t37&lt;/code&gt; (&lt;code&gt;1,119 &amp;lt; 1,136&lt;/code&gt; events) on its own.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Highlight: Run 13,497 Disproved Our Own Spec Theorem
&lt;/h2&gt;

&lt;p&gt;Property-based testing (&lt;code&gt;fast-check&lt;/code&gt;) was not just a checkbox — &lt;strong&gt;Kiro proved our own specification theorem wrong.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Our blueprint originally stated Property &lt;strong&gt;C5 (Causal Cone Soundness)&lt;/strong&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"If you cancel event &lt;code&gt;e&lt;/code&gt;, every divergent event in the forked timeline must lie inside &lt;code&gt;e&lt;/code&gt;'s forward causal cone (&lt;code&gt;impact(e)&lt;/code&gt;)."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With a simple random domain generator (~3.5 events), &lt;code&gt;fast-check&lt;/code&gt; agreed for 2,000 runs. Once we enriched the generator (branching spawns, depth up to 4, up to 119 events), &lt;code&gt;fast-check&lt;/code&gt; &lt;strong&gt;shattered C5 at Run 13,497 (seed &lt;code&gt;7&lt;/code&gt;) and shrank it in 88 steps&lt;/strong&gt; to three stark rules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a@1 writes k.
x@2 reads k; if k is unset, it spawns w@3, which writes j.
q@4 reads j and writes out.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Think about why that breaks the "theorem":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;parent&lt;/strong&gt; timeline, &lt;code&gt;a&lt;/code&gt; writes &lt;code&gt;k&lt;/code&gt;, so &lt;code&gt;x&lt;/code&gt; never spawns &lt;code&gt;w&lt;/code&gt;. Therefore &lt;code&gt;q&lt;/code&gt; is &lt;strong&gt;never&lt;/strong&gt; in &lt;code&gt;a&lt;/code&gt;'s forward causal cone &lt;code&gt;impact(a)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;When you &lt;strong&gt;cancel &lt;code&gt;a&lt;/code&gt;&lt;/strong&gt;, &lt;code&gt;k&lt;/code&gt; stays unset, so &lt;code&gt;x&lt;/code&gt; &lt;em&gt;creates&lt;/em&gt; &lt;code&gt;w&lt;/code&gt;, &lt;code&gt;w&lt;/code&gt; writes &lt;code&gt;j&lt;/code&gt;, and &lt;code&gt;q&lt;/code&gt; diverges!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Counterfactuals can create writers that never existed in the parent timeline.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We replaced C5 with sound &lt;strong&gt;bidirectional local causal closure&lt;/strong&gt; (every divergent event after &lt;code&gt;e.at&lt;/code&gt; has a divergent spawn parent or last writer in &lt;em&gt;either&lt;/em&gt; timeline), preserved both the shrunk seed-7 counterexample and a hand-minimized &lt;code&gt;"hidden-writer"&lt;/code&gt; test in &lt;code&gt;packages/spine/test/k7-conformance.test.ts&lt;/code&gt;, and updated our UI contract so &lt;strong&gt;&lt;code&gt;diff()&lt;/code&gt; is presented as ground truth and the causal cone as explanation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Meanwhile, &lt;strong&gt;Per-Event Common Random Numbers (&lt;code&gt;sfc32(domain.seed, event.id)&lt;/code&gt;)&lt;/strong&gt; guarantee non-interference across unrelated subsystems: &lt;code&gt;auth-svc&lt;/code&gt; heartbeat jitter in Incident Autopsy and Chef Moreau's kitchen timers in Manor Séance remain &lt;strong&gt;byte-identical&lt;/strong&gt; across every fork.&lt;/p&gt;




&lt;h2&gt;
  
  
  Taking It Into Kiro Crew (&lt;code&gt;phantomfork-crew&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;We also packaged the engine into a standalone persistent &lt;strong&gt;Kiro Crew App&lt;/strong&gt; (&lt;code&gt;https://github.com/lingfengQAQ/phantomfork-crew&lt;/code&gt;) using Kiro Crew's &lt;code&gt;@kirocrew/app-sdk&lt;/code&gt;, aiohttp &lt;code&gt;RouteRegistry&lt;/code&gt; hooks, owner-gated persistent ledger storage, stdio MCP server, and persistent &lt;strong&gt;&lt;code&gt;phantomfork-outage-detective&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;phantomfork-timeline-auditor&lt;/code&gt;&lt;/strong&gt; Crew agents — so teams can dispatch autonomous postmortem investigations directly inside Kiro Crew.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try PhantomFork Yourself (Zero Setup)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Open &lt;strong&gt;&lt;a href="https://phantomfork.vercel.app" rel="noopener noreferrer"&gt;https://phantomfork.vercel.app&lt;/a&gt;&lt;/strong&gt; — land straight inside the &lt;code&gt;03:14&lt;/code&gt; checkout cascade, click &lt;strong&gt;&lt;code&gt;Fork @ tick 37: retryBudget = 2&lt;/code&gt;&lt;/strong&gt; to watch &lt;strong&gt;2,341 dead requests drop to 0&lt;/strong&gt;, then click &lt;strong&gt;Manor Séance&lt;/strong&gt; in the top bar to save Lady Ashgrove using the exact same engine.&lt;/li&gt;
&lt;li&gt;Or install the Kiro Power locally:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  git clone https://github.com/lingfengQAQ/phantomfork
  &lt;span class="nb"&gt;cd&lt;/span&gt; phantomfork &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm install &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm &lt;span class="nb"&gt;test&lt;/span&gt;   &lt;span class="c"&gt;# 129/129 green across 5 workspaces&lt;/span&gt;
  kiro-cli powers install ./power/phantomfork
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Happy haunting &amp;amp; deterministic forking! 👻🎃&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>testing</category>
      <category>showdev</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
