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.

🪦 The idea: the network is optional

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

🧪 How Kiro builds: specs first, vibes never

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 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.

💀 Bug 1: two phones, one timestamp

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.

💀 Bug 2: the late phone gets ghosted

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.

💀 Bug 3: overdue while on time

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.

💀 Bug 4: the impersonation hole

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.

🎃 And then I made it spooky

Because it's Kiroween:

  • 🕷️ Spiders you can pull, candles you blow out, ghosts you poke
  • ⚡ Jump-scare page transitions with a rotating cast: bats, lightning, fog, eyes
  • 🔊 Zero audio files. Every whoosh, organ stab and bat squeak is synthesized live with Web Audio
  • 🌙 A topo map with a GPU night mode, plus sunset and weather that survive offline

🧠 What I learned

  1. Cheap models are great typists and bad skeptics. They implement exactly what the design says and never notice what it forgot to say.
  2. Write properties from the requirements, not the code. All four bugs passed tests derived from the implementation, and all four failed tests derived from the spec.
  3. Hooks are guardrails for headless agents. "Typecheck before you're allowed to stop" saved more turns than any prompt.

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.