Challenge
A café in Estonia recorded kitchen stock consumption by hand, then re-entered it into its commercial POS/accounting system — slow, error-prone work that also required matching colloquial product names to formal catalogue entries in another language. Because write-offs change real inventory balances, correctness and operational safety were non-negotiable.
Solution
- Chat-first interface: a Telegram bot (python-telegram-bot, long-polling) where staff type “shift, product, quantity”; chefs get privileged commands for review and posting.
- LLM parsing: Claude interprets each free-form message against a live product catalogue, extracting shift, product, quantity and unit — with a human-in-the-loop confirmation step (inline ✅ / ❌ / ✏️ buttons) guarding every entry.
- Resilient POS integration: integrated the venue’s commercial POS/accounting system over its partner API (OAuth2 client-credentials); the catalogue is loaded per product group to surface warehouse items hidden by a storefront visibility filter. Documents are created as drafts only — never auto-posted (a deliberate safety decision).
- Alias layer with a single source of truth: colloquial names map to catalogue items; the source of truth lives in the POS product card, synced to a local cache every 15 minutes, with write-through on edits and self-learning from staff corrections.
- Unit-of-measure safety: validates the spoken unit against each item’s storage unit, converts (e.g. 500 g → 0.5 kg) and sums compound quantities (“1 kg 200 g” → 1.2 kg) to prevent mis-scaled write-offs.
- Disambiguation UX: ambiguous terms surface inline buttons to pick the exact product card.
- Duplicate protection tuned on real data: the same item with the same quantity within three minutes is caught at the moment of confirmation and must be confirmed again — a rule calibrated on the full entry history so that legitimate batch weighing is not flagged.
- Management view in a private chat: a button menu (every chef command is available as a button) with spend by shift and month-on-month comparison, the top items by write-off value, shifts still without a document, staff activity, and stock that has gone negative or is running low — all read back from the POS. The bot stays silent unless asked, by design.
- A targeted reminder learned from an incident: when nine days of shifts (330+ items) went unposted without anyone noticing, a daily reminder about unclosed shifts was added — sent only to the stock manager, not to everyone.
- Engineering rigour: 20+ Architecture Decision Records and a unit-test suite; deployed on a single Linux VPS via systemd with daily database backups.
Result
Running in production and used daily by kitchen staff: manual catalogue entry was replaced by chat-driven logging with chef confirmation. A group-based catalogue-loading fix increased API-visible items from ~76 to ~370, and management now sees spend, top items and stock problems from the same chat, without opening the POS.