-
-
Landing: three dead formats (X12 ship notice, fax, chat card) stitched to one lot's toe-tag — Patient Zero.
-
Use with Kiro: the LOT ZERO power, the hosted MCP server, and Kiro's work counted from its own session logs.
-
Lot trace: 25 of 40 stores reached, affected links stitched; one click makes the FDA's files; 96.7% less food recalled.
-
Kiro Crew: the Recall Warden's scheduled drill ran end to end, with two supplier workers in parallel.
-
Kiro Web: cloud sessions ran in parallel on our repos; each opened a pull request that we merged.
Inspiration
I build software inside a food plant. When a lot goes bad, the question is simple — where did it come from, and where did it go? — and the answer is buried in EDI files from the 1970s, faxed certificates and photos of batch cards in a chat group. The US Food Traceability Rule (FSMA 204) will require that answer as an electronic sortable spreadsheet within 24 hours of an FDA request; FDA will not enforce it before 20 July 2028 (FDA proposed that date in August 2025, and Congress then directed FDA not to enforce the rule before it, Pub. L. 119-37). CDC estimates foodborne illness sickens 48 million people in the US each year (2011 estimates). LOT ZERO is for the food-safety or QA lead at a grower, packer or co-packer who gets that call.
How long does that answer take today? FDA's traceback experts reviewed three E. coli outbreaks linked to romaine lettuce in 2018 and 2019. Where lot codes were on the product, the whole supply chain was identified within 24 hours; from points of sale without lot codes, "identification of the entire supply chain took between 5 to 25 days" (Irvin et al., Journal of Food Protection 84:1340–1356, 2021, doi:10.4315/JFP-21-112, cited in the FSMA 204 final rule). LOT ZERO is built around that gap: get every record, however it arrives, onto a lot code, then trace.
What it does
LOT ZERO is a Frankenstein: it stitches the supply chain's undead formats — EDI X12 856/850, faxed certificates, messy CSV receiving logs and chat batch cards — into one GS1 EPCIS 2.0 traceability graph.
In plain words: an 856 is an electronic shipping notice and an 850 a purchase order; a 997 is the receipt the sender's system expects back. EPCIS is the GS1 standard record of where every lot went. FSMA 204 calls a lot code a TLC (traceability lot code), each step in a food's journey a CTE (critical tracking event: harvest, cool, pack, ship, receive, transform) and the facts recorded at each step KDEs (key data elements).
Why it is new: traceability networks work once every partner sends clean electronic data. Small suppliers send faxes, spreadsheets and chat photos. LOT ZERO starts from what actually arrives and keeps a person in the loop.
- Read the records you actually get (Upload records · Séance Intake). A hand-written X12 parser (it also drafts the partner's 997 back in X12), CSV headers mapped to FSMA KDEs, faxes read field by field with a confidence each, and batch cards sent by chat (Telegram/WhatsApp, signed webhooks) — nothing becomes a record until a person confirms it. On the public demo no model key is set, so the sample fax is read from a bundled, hand-labelled extraction (the screen says so); with an
ANTHROPIC_API_KEY, Claude's vision model reads your own faxes. - Watch for recalls that touch your suppliers (Recall Radar). Live openFDA food enforcement reports, fuzzy-matched against your suppliers and products. The demo's suppliers are invented, so its one match is a labelled sample; the live reports are real. Live reports that name a food your products contain, from a firm that is not your supplier, are listed apart as "category leads" (often none) and never counted as matches.
- Trace a lot both ways (Lot trace · Possession). Pick a contaminated lot and one sentence answers first ("Reached 30 locations and 25 of 40 stores through 2 DCs…"); below it, the affected links are stitched tier by tier, farm → cooler → plant → distribution centres → stores, and every link shows where its record came from (
X12 · ASN-…,FAX · 0.62). - Answer the FDA request on the clock (FDA 24-hour deadline · Doom Clock; Generate FDA export · Exorcise). The request starts a 24:00:00 countdown; one click produces the FDA sortable spreadsheet (CSV, XLSX), the same data in FDA's own template (one tab per CTE), an EPCIS 2.0 JSON-LD file and the hold lists — what every DC and store must pull, as printable "Hold and segregate" sheets. The clock freezes when all six files have arrived, and the panel reports the server's time to make them ("Six files generated in …").
- Recall only what is affected (Scope Shrink). Because LOT ZERO traces lots, not product names, the demo recall covers 2,544 lb at 25 stores instead of 76,704 lb at 40 stores — 96.7% less food recalled.
- Get the trace explained and checked (Investigation agents · Ghost Crew). Four agents (Tracer, Scribe, Herald, Auditor) investigate over the same MCP tools Kiro uses; the Auditor re-traces independently and code compares the results. The Herald drafts one hold request per DC or store, never sent. On the public demo, with no model key, the crew's narrative is written from templates (labelled on screen); the traces and the comparison are the engine's either way.
- Use it from Kiro (LOT ZERO power + hosted MCP server). A Kiro Power and a hosted MCP server (8 tools) let a QA team trace a lot, draft the FDA sheet and get hold lists from Kiro chat with nothing to install — see
/kiro. - Rehearse the recall every week (Recall Warden, a Kiro Crew app). A weekly mock-recall drill, one worker per supplier for data gaps and a daily openFDA watch, all on the hosted MCP server. It runs on a live Kiro Crew gateway: its drill traced a lot in 81.86 ms and reported 990 lb at 15 stores against 15,111 lb at 40 for a SKU-level recall. The read-only steps run unattended; exports, worker spawns and memory saves wait for a person's approval, and with them approved the full drill ran end to end.
- A lab, not a dashboard (the Stitched Lab look). Rebuilt by Kiro from a spec: a night-lab palette, a highly legible typeface, plain names first with the Halloween word as a quiet subtitle, affected links drawn as sutures, and Patient Zero's toe-tag on the landing page, stitched to the ship notice, fax and chat card that lead to it. The Lights On switch gives a plain theme with the same layout; WCAG AA text contrast in both themes.
Try it: https://lot-zero.onrender.com → Start the demo. No login. Sample files and a simulated chat message are one click away in Intake. Watch: https://youtu.be/yDU_7fRdNkM
How we built it
How Kiro built LOT ZERO
- Specs before code. 10 of our 17 specs were written in Kiro, with 578 of the 681 requirement lines; every task names its requirement.
- An auditor that can only read. Kiro's read-only agent checked our core through our own tools: 21 findings, 12 fixed by a Kiro bugfix spec, the other 9 documented.
- Hooks that protect the data. 7 hooks fired 1,265 times. When we told Kiro to overwrite our reference files, the hook blocked both the file edit and the shell command.
- Tests Kiro wrote. 107 of our 123 property tests. One agent planted 184 deliberate bugs in the EDI parser and closed every real gap with 37 new property tests.
- A redesign from a spec. 20 requirements; Kiro's design agent restyled every page through 3 review rounds, and Kiro added 75 browser checks (187 in all, no serious accessibility issues in either theme).
- Kiro Web. 4 cloud sessions, 3 of them in parallel; 3 pull requests merged, one a live check of the deployed app.
- Kiro Crew. The Recall Warden ran a full mock-recall drill on a live gateway, with two supplier workers in parallel; running it exposed 3 real bugs, which we fixed.
- The count. 31 Kiro sessions and 1,729 metered credits; Kiro's commits added 51% of all code lines.
Honest scope: the first version was written with Claude Code, another AI coding tool, from the same specs. Kiro did everything above after that, and every Kiro commit carries a Built-with: Kiro CLI (or Kiro Web) trailer, so its share is counted, not claimed (docs/kiro-evidence/SUMMARY.md).
The stack
- TypeScript monorepo: Next.js App Router web app; pure packages for X12, ingest, trace, export, radar and the seed.
- A deterministic trace engine (cycle-safe BFS, mass balance per transformation) is the single source of truth. The reference Postgres schema's recursive SQL trace functions are run in PGlite in tests and return identical lot sets.
- One MCP server,
lotzero-mcp(8 tools), used by Kiro during development, by the app's investigation agents and by the Kiro Crew app's drill. - 17 specs, 123 property-based tests, 1,082 Vitest tests in all (unit, route and property) and 187 Playwright tests, all passing on 30 Nov 2026. The full account of Kiro's part is in the Kiro write-up (
docs/KIRO_WRITEUP.md).
Challenges
- X12 delimiters are declared inside the file itself; the serializer must refuse values that contain them instead of emitting a corrupt file — property-based round-trip tests drove this.
- Keeping a 47-location chain readable: stores collapse into one group per distribution centre ("13 affected / 24").
- Trusting model extraction: confidence per field, a dashed "check this field" mark below 0.8, and no record until a human confirms.
- Being honest in a demo: every number is computed at runtime; synthetic data and sample records are labelled.
- Making Kiro's guard rails real: our golden-file hook never had to block anything until we asked Kiro to attack it, and our transcripts showed that hooks on the write tool never see files written through the shell.
Accomplishments
- Patient Zero traced across 7 lots, 30 locations and 25 of 40 stores, with the engine answering in milliseconds; the FDA sheet has 82 rows (every transformation input included) and the EPCIS file round-trips losslessly.
- Lot-level recall: 2,544 lb at 25 stores instead of 76,704 lb at 40 stores for a SKU + date-range recall — 96.7% less food recalled.
- 123 property-based tests; a real counterexample found and fixed in the first build (an unpaired Unicode surrogate in a lot code broke the EPCIS round trip). Kiro's read-only auditor agent ran three audits through our own MCP server (6, 3 and 21 findings); Kiro bugfix specs fixed the first nine and 12 of the 21, and the other 9 are recorded as known limitations with reasons.
- The live demo is checked against the golden files every 6 hours (8/8 checks passing) and the properties run 2,000 times nightly.
- 187 Playwright end-to-end tests for the judge path, intake and radar, keyboard-only, reduced motion, four widths and axe accessibility scans on every page in both themes; a Kiro design review took small touch targets from 112 to 0, and Kiro's redesign kept every page free of serious accessibility issues.
What we learned
- Lot codes are the whole game. FDA's own case studies show the gap between 24 hours and 5 to 25 days, and our engine shows the other half: once the records exist, a trace takes milliseconds. The hard part is turning a fax, a spreadsheet and a chat photo into records, with a person confirming each one.
- An agent with less power found more. Our
fda-auditorcan only read code and call our MCP tools. In its first session it found that our FDA sheet dropped transform inputs outside the trace, at least 1,040 lb of input lots, which no unit test of ours covered. - A guard rail that has never fired proves nothing. Our golden-file hook ran hundreds of times before it blocked anything. We learned what it could and could not see only by reading our own transcripts and by asking Kiro to attack it.
- Failing tests first. Every audit and review became a bugfix spec whose first task was a test that fails on the old code; in the core audit, 22 of 24 such tests failed before the fix. That is why we trust the fixes.
- Count, don't claim. We wrote a script that counts Kiro's work from the session transcripts and git. It corrected our own write-up more than once, from the number of sessions to the number of property tests.
What's next
What a real plant deployment needs first: persistent tenants (the Supabase schema already passes its trace-parity tests in CI), a live EDI connection, a real fax number and chat bot, and accounts with an audit trail. Then distributor receiving records, X12 810 invoices, and a timed mock-recall pilot with one small co-packer.
Built With
- anthropic-sdk
- exceljs
- fast-check
- gs1-epcis
- kiro
- kiro-cli
- kiro-crew
- kiro-powers
- kiro-web
- model-context-protocol
- next.js
- openfda
- pglite
- playwright
- postgresql
- react
- render
- tailwindcss
- typescript
- vitest
- x12-edi
- xyflow
- zod