Inspiration
Halloween night reduces an entire tradition to a visual test. Under dim porch lights, fun-size wrappers squeeze ingredient lists onto glossy plastic folds in microscopic type, and a torn seam is easy to miss by touch alone. For a blind or low-vision child with a peanut, milk, or tree-nut allergy, sorting a candy bag means handing every single piece to someone else or living with guesswork.
We wanted to remove that barrier without stripping away the magic of the holiday. Instead of building a sterile utility screen, we imagined a haunted costume where every spooky detail carries real meaning for the friend or parent standing nearby, while voice, sound, and touch give complete independence to the person holding the treat.
What it does
Hold any treat in front of the camera and keep it still. Without pressing a button, the castle recognizes the treat, reads it, and speaks the name, kind, allergen status, and wrapper condition out loud.
- Dual-path identification checks visible barcodes locally against Open Food Facts for real product label data, and falls back to a vision model that reads unbarcoded wrappers and inspects whether the seal is intact.
- Strict three-tier verdicts ensure the app never guesses in favor of safety. Beware triggers if a user allergen is listed or likely, or if the wrapper looks opened, torn, or unwrapped. Ask someone triggers when there is no allergen label to verify, the confidence score falls short, or the camera cannot confirm the seal. Safe is spoken only when the wrapper is confirmed sealed and none of the user's allergens appear.
- Eyes-free interaction turns the entire camera window into the primary Read target, flanked by four stationary 64 px action tiles for Repeat, More, Haul, and Settings. Every verdict arrives as a clear spoken sentence, a distinct Web Audio cue, and a countable phone vibration pattern (one buzz for safe, two for ask someone, three long buzzes for beware).
- Low-vision craft renders Geist and Inter at 18 px or larger with 7 to 1 contrast across every surface, offers a one-tap toggle to Atkinson Hyperlegible, and hands speech over cleanly to VoiceOver, TalkBack, or NVDA whenever the built-in voice is muted.
- Functional costume places the app inside the wrought-iron gate of a painted Halloween night. Gate doors swing open in 3D when the camera starts, candlelight climbs the arch while a treat steadies, and the pillar lantern, lamp post, and Ghost Army silhouettes shift into the verdict color so a companion knows the result at a glance.
How we built it
We built Trick or Read inside Kiro, driving architecture, safety verification, accessibility, security hardening, and release packaging through Kiro's spec-driven workflow, steering documents, agent hooks, and Kiro CLI.
Frontend and hands-free detection. The interface runs on React 19 and strict TypeScript with Vite. Barcodes decode directly on device via the native BarcodeDetector API or a local ZXing WebAssembly build. To scan hands-free at almost zero CPU cost, frames are downscaled to a 64 by 48 buffer and converted to ITU-R BT.709 relative luma
$$L = 0.2126R + 0.7152G + 0.0722B$$
At 10 Hz, the detector tracks mean absolute frame-to-frame luma difference
$$\Delta L_t = \frac{1}{W \cdot H}\sum_{i=1}^{W \cdot H} \left| L_t(i) - L_{t-1}(i) \right|$$
Motion above 7 arms the detector only when the picture differs from the previous read by more than 9, preventing duplicate scans of the same candy bar. Holding steady (mean frame delta at or below 3.2) for 800 ms in adequate light (mean luma at least 38) triggers a read automatically.
Runtime backends and voices. Sensitive API keys never enter client bundles. A Bun server, on AWS, or the Electron main process proxies requests to Claude Haiku for wrapper inspection and ElevenLabs for natural English voices (Serena and Ana). Even with zero API keys configured, barcode scanning and local system speech work out of the box.
Painted night and 69 animated lights. The three-panel Halloween scene was composed so the haunted mansion, lantern stairs, and lavender moon frame the phone without hiding key art behind the screen. Light coordinates were extracted programmatically into sceneLights.ts so every window, jack-o'-lantern, and fairy light flickers or shifts color in real time, paired with ghosts traced from the public-domain WWII Ghost Army insignia.
Kiro specs, steering, and hooks. Six specifications in .kiro/specs governed the scanner, painted gate, desktop packaging, hosted worker, release security, and formal safety properties. Steering files in .kiro/steering locked in non-negotiable product and WCAG accessibility constraints across every turn, while five hooks in .kiro/hooks automatically enforced TypeScript checks, pure-logic tests, safety wording, accessibility audits on UI saves, and ghost placement bounds on the painted stage.
Challenges we ran into
Catching the hidden gap in "Safe." Our example-based unit tests covered opened wrappers, torn wrappers, low confidence, and missing labels, and every test passed. When we used Kiro to translate our steering rules into formal invariants with fast-check, each property ran against 2,000 randomized treats. One invariant failed immediately
$$\text{verdict}(r, A) = \text{Safe} \implies \text{wrapper}(r) = \text{sealed} \;\land\; \text{matches}(r, A) = \emptyset \;\land\; c(r) \ge 0.6$$
The shrunk counterexample revealed a treat with wrapper = "unknown", empty allergens, confidence = 0.6, and no user allergens set returning Safe. The rule required proof of a sealed wrapper, yet the code had only excluded known bad wrappers. Fixing the condition to reject any reading where wrapper !== "sealed" closed the loophole, and we updated the spoken output so users hear why the castle is asking them to check.
Custom Electron origins and click-through windows. Early transparent overlay experiments for drifting ghosts trapped mouse clicks on macOS, leading us to unify the desktop app into a single window with ghosts rendered inside the painted scene. During packaged Electron testing, a custom Electron protocol origin guard also failed silently because new URL(url).origin evaluates to the string "null" for custom schemes, blocking camera access until we caught and fixed it by running the compiled desktop bundle directly.
Audio race conditions. Unlocking browser audio on the first tap briefly interrupted the opening ElevenLabs speech clip and triggered a fallback to robotic system speech, requiring explicit sequencing between the gate sound and spoken feedback.
Accomplishments that we're proud of
- Formal safety verification that paid off. Property-based testing inside Kiro uncovered a real edge case that conventional unit tests missed, proving the safety invariant across thousands of combinations before a user ever heard a false reassurance.
- Every visual flourish earns its keep. Nothing in the Halloween scene is pure decoration. The gate doors, climbing candlelight, island wave, lantern colors, and blushing ghosts form a synchronized status display for sighted companions.
- Zero-key resilience across platforms. Whether running on Cloudflare Workers, in a mobile browser, or as a signed desktop build on macOS, Windows, or Linux, the core safety loop works even without API keys.
- Verified accessibility. Every region maintains strict contrast, keyboard parity, screen-reader announcements, reduced-motion respect, and zero
axeviolations.
What we learned
Encoding core product principles inside Kiro steering documents and automated hooks changes how fast an engineering loop stays safe. We never had to repeat that uncertainty must never be phrased as safety because the workspace rules carried that constraint into every edit. We also saw how dramatically spec-first development outperformed retroactive documentation, especially when hardening origin checks, Content Security Policies, and rate limits. Most of all, running the actual packaged artifact alongside property-based tests taught us that unit tests only check what you remembered to imagine, while real execution catches the quirks that diffs conceal.
What's next for Trick or Read
We plan to add on-device optical character recognition so wrappers without barcodes can still be read completely offline with no API key, expand voice localization starting with Portuguese, and run live usability sessions with blind and low-vision trick-or-treaters and their families to refine timing, phrasing, and haptic cues in real porch lighting.