Prototypes FrontdeskP31 · Email answered by SI
The server

What the inbox server holds

The emails, the clinic’s calendar in SQLite, the replies a person sent, the audit log and the eval runs, read every 2 seconds. The agent runs in the Worker and calls its tools on the Durable Object.

MeasureCount

The calendar

Bookings

TimePhysiotherapistCustomerTreatmentStatus

Sent replies

SentToSubjectEdited

Latest audit entries

TimeEmailStepResult

Every route

MethodRouteWhat it does
How Frontdesk is built
  1. An email is read by a model on Cloudflare Workers AI (zai-org/glm-5.3; when it gives no answer in 30 seconds, qwen/qwen3.8-27b is asked instead), which answers with JSON in a fixed shape: the intent from a list of twelve, the language, the urgency, the customer’s name, the treatment, the therapist whose work fits, and the days and hours asked for. A value outside the shape is dropped.
  2. The passages come from the clinic’s 10 documents with BM25 over their words, in the Worker. BM25 rather than embeddings: the documents are a few dozen short passages, a score can be shown and checked, the same email finds the same passages on every run, and it costs no model call. A Danish email is met with a list of Danish words and their English words, and each intent adds the documents it always needs.
  3. The code, not the model, chooses the tools from the intent: a booking finds free slots and holds one, a cancellation finds the sender’s booking and cancels it, a move does both. The model never calls a tool. A cancellation is refused for a booking that is not the sender’s own, whatever the email asks.
  4. A tool changes nothing for good. A hold and a cancellation wait in the calendar until a person approves the reply, and are undone when the draft is discarded or the email is read again.
  5. The model drafts the reply from the passages and the tool results, and lists each passage it rests on. Code then checks the draft: each cited passage exists, every amount in it is in a cited passage, a price or a rule cites a passage, no refund is promised, a held time is named, no booking or cancellation is claimed that the tools did not make, and the reply is in the email’s language. A draft that fails is written once more with the reasons; if it fails again it is marked Check, and the server refuses to approve it until a person edits it.
  6. Text in an email that tries to give the agent instructions is found by code before the model reads it. The tools that change bookings are then off for that email, and the audit log says why. There is no tool that pays money back.
  7. Every model step, tool call, guard and approval is written to the audit log with its time. The evals run the agent over twenty labeled emails, each in a calendar of its own, and score intent, tools, citations, language, guards and what must not happen.
  8. Without an AI binding the Worker answers 503, and the inbox, the calendar and the replies a person writes still work.