My AI Wrote a Bug That Would Have Let Strangers Fake Your Safety Check-In A developer built Afterlife Kit, an open-source offline-first app skeleton for #Kiroween using Kiro, a spec-driven AI IDE, and documented four bugs the AI agent introduced that were caught by property-based tests before release. The failures included a hybrid logical clock that could issue duplicate timestamps, a relay paging scheme that dropped edits from the longest-offline device, an overdue alarm measured from the last check-in instead of the next checkpoint's ETA, and ECDSA check-ins vulnerable to public-key swapping under another member's id. The fixes included the textbook HLC receive rule, keying batches by server arrival time, and deriving self-certifying member ids from the signing key. It's 6:41 PM on Halloween. Maya is somewhere on Blackwood Ridge. Her phone shows no service. At home, Mom's phone shows nothing either. Every app they own died the second the signal did. That's the moment I built for. Afterlife Kit is an open-source skeleton for apps that keep living when the network dies. I built it for Kiroween with Kiro, a spec-driven AI IDE. This is the story of the four bugs the AI wrote, and how the specs caught every one before a user ever could. Most apps treat the server as the truth and your phone as a window onto it. Lose the window and you lose everything. Afterlife Kit flips that: the device is the truth. Every change is written to an operation log on the phone IndexedDB the instant you tap. When any phone catches a bar of signal, the changes travel through a ~100-line relay and merge on every other phone. Two very different apps run on the same skeleton: | ๐Ÿฆ‡ Ghost Trail | ๐Ÿ•ฏ๏ธ Ledger After Dark | |---|---| | Group safety check-ins for no-signal hikes | Credit ledger for corner shops | | Real topo map, downloaded for offline use | Photo receipts on every entry | | Overdue alarm on every synced phone | Reminders on SMS, WhatsApp, LINE, WeChat | | Every check-in signed by the phone's own key | 10 languages, Arabic and Urdu right-to-left | I didn't start in a chat box. I started in: .kiro/ โ”œโ”€โ”€ steering/ product.md ยท tech.md ยท structure.md โ† the rules every agent run follows โ”œโ”€โ”€ specs/ โ”‚ โ”œโ”€โ”€ sync-core/ requirements EARS ยท design ยท tasks โ”‚ โ””โ”€โ”€ ghost-trail/ requirements EARS ยท design ยท tasks โ””โ”€โ”€ hooks/ tests on save ยท typecheck on stop ยท secret guard ยท boundary review Requirements are written in EARS, so they're testable sentences: WHEN now the next checkpoint's ETA + 15 min grace THE SYSTEM SHALL mark the member overdue. The design turns those into correctness properties , and each property becomes a fast-check https://fast-check.dev test that throws hundreds of random histories at the code. Then I let Kiro's agent loose, headless, on a cheap model, one spec phase per run. A hook re-ran the property tests on every file save, and another blocked the agent from finishing while the types were broken. The agent's code passed every example test. The properties did not pass. The hybrid logical clock HLC is the heartbeat of the merge. Kiro's version could hand two phones the same timestamp , so a merge could silently pick the wrong value. One property, "receive always produces a clock strictly greater than both inputs" , failed in three steps. The fix was the textbook HLC receive rule. This one scared me. Three replicas, one with a clock 3 ms behind: replica 2 writes + pushes โ†’ replica 0 pulls cursor jumps ahead replica 1 writes older clock + pushes โ†’ replica 0 pulls โ†’ never sees it ๐Ÿ’€ The relay was paging by the phones' clocks. The phone that was offline the longest the exact user this kit exists for lost its edits. The spec said to key batches by server arrival time . The property made the gap impossible to miss. CP0 at 11:00, CP1 at 12:00. Hiker checks in at CP0 at 11:00. On time. now = 11:12 โ†’ "OVERDUE" ๐Ÿฆ‡๐Ÿฆ‡๐Ÿฆ‡ The agent measured lateness from the last check-in , not the next checkpoint's ETA . Every hiker would have triggered a bat-swarm alarm 15 minutes after every check-in. Kiro's own seven properties passed. Three more properties written straight from the requirement text failed instantly. Requirement 5 says "Only you can check in as you." Kiro implemented ECDSA signatures and five properties, all green. I added a sixth: a check-in is valid only if the signing key belongs to that member id. It failed immediately. Ids were random, so anyone who could edit the shared member list could swap their own public key under Maya's id and sign "I'm OK" as her . On a safety app. The fix: make ids self-certifying. id = base64url SHA-256 ${crv}:${x}:${y} .slice 0, 22 Swap the key and you're out. Every phone checks it before trusting a signature. Because it's Kiroween: The whole thing sync engine, two apps, 40 tests, 29 property checks ran on Kiro's free credits. The specs did the thinking, so the model only had to type. Built for Kiroween 2026 Skeleton Crew . Map data ยฉ OpenStreetMap contributors, OpenTopoMap.