A chat widget that answers shoppers about products, sizing, shipping and their orders from the store's real data. It can only use five tools. It shows an order only when the order number and the email match. Every reply is checked in code before the shopper sees it, and anything it cannot do goes to a person.
This runs the repo's real tools, order check, guards and handoff logic in your browser, on the sample store (products from Shopify's public mock.shop, generated orders). Only the model is swapped for a simple keyword router, so the wording is plainer than Claude's — the point is to see the tool calls and checks on the right.
Most store inboxes are the same ten questions: where is my order, does it run small, how do returns work, do you have it in blue. Generic chatbots either cannot see the store's data or invent answers — a wrong price, a discount code that does not exist, "I've refunded you" when nothing happened. That costs more than the time it saves.
The widget on the repo's local demo page (server + widget, demo mode, products live from mock.shop).
productByIdentifier, order lookup, shop policies — validated against 2026-10).reply tool so the final answer arrives as structured data the guards can check.| Risk | Check |
|---|---|
| Showing someone else's order | lookup_order needs number + email; same "no match" answer for either wrong; locked after 3 failed tries; never returns address, payment or notes |
| Invented prices | Every $ amount in the reply must appear in a tool result or the policy text |
| Made-up discount codes | Any "code XYZ123" in a reply blocks it |
| "I've refunded your order" | First-person action claims are blocked — the agent has no tool that changes anything |
| Talking about an order it never verified | Order numbers in the reply must be in the verified set for this chat |
| Recommending a product it never looked up | Product cards only for handles a tool returned |
| Instructions hidden in reviews or messages | Reviews arrive as reviews_untrusted; the prompt says to treat them as data; the guards above hold either way |
A failed draft is never shown. The shopper gets "I've passed this to our team", and the ticket records which check failed — so the team sees the model's mistakes instead of the customer.
| What | Result |
|---|---|
| Unit tests (order access, lockout, guards, PII redaction, app proxy signature using Shopify's documented example) | 15 / 15 pass |
| Eval set: 20 conversations with exact expected facts (products, policies, orders, wrong email, address change, defect, injection) | 20 / 20 in demo mode |
| Same eval set with Claude | Not run yet — will be published with misses |
| Theme app extension (Theme Check) | 0 offenses |
| Installed on a real store | Not yet |
Demo-mode evals prove the tools, guards and wiring, not the model's judgement. The live number is the one that matters for a client, and it is the next step.
Drafted the tools, the agent loop, the widget, the backends and most tests from my spec; validated the GraphQL with the Shopify AI Toolkit.
Chose the five tools and what each may return, the "number + email" rule, the guard list, the handoff cases and the eval cases with their expected answers; reviewed and fixed the code.