Essay 108 min read

What the Model Is Allowed to Write

By Paulo R.Software engineer and founder of Lucimark.

A paper speech bubble offers three times that the open appointment book beside it shows as taken.

In short

In a booking assistant, a single language model that understands and answers the customer breaks three things: facts that already live in the clinic’s catalog, actions that change the calendar, and the many ways people phrase the same request. Tredane follows the classic architecture of task-oriented dialogue systems instead: cheap rules first, a classifier that only returns a label, fixed routines that read the catalog, and a model that writes prose only for open questions. Deciding where the model goes is a product decision.

A customer writes to a beauty clinic on WhatsApp: “show me the calendar.”

It is one of the simplest requests the clinic receives. In one of the versions we tested, it went to the language model that wrote replies, and the model answered generously. It described free slots, suggested times and offered buttons. None of it came from the clinic’s calendar. The model had produced what a helpful reply to “show me the calendar” usually looks like.

Nothing in the reply was absurd. That was the problem. A customer had no way to tell the invented times from real ones.

We are building Tredane, a platform that organizes customer conversations and appointments for aesthetic clinics over WhatsApp, with AI assistance. That reply forced a question that has shaped the assistant’s design ever since:

what, exactly, should the model be allowed to write?

Three things a single model gets wrong

The tempting design is one model that reads the message and writes the answer. It is fast to build and impressive in a demo. In a clinic, it breaks three things.

A fact is not prose. Price, duration, what a treatment includes, opening hours and the cancellation policy already live in the clinic’s catalog. If a model writes them, it can invent or omit them. Checking the text afterwards helps, but a check is not a source. The right price is the one in the catalog, not the one a sentence happens to contain.

An action is not conversation. Booking a slot changes the clinic: a room, a professional, sometimes a deposit. Free text should never authorize that change on its own. In Tredane the chat informs and directs. Booking, rescheduling and cancelling happen on the customer’s own web page, behind an “Open calendar” button, and the confirmation happens there.

A phone displaying an arrow button sits beside an appointment calendar with a time slot and a checkmark.
Figure 1 The chat takes the customer to the calendar. Confirmation happens on the customer’s booking page.

A paraphrase is not coverage. Rules and word lists are precise when they match and blind when they do not. “I want to book” is easy. “Show me the calendar”, “got anything Tuesday?” and “do you do [service X]?” each arrive in a dozen forms. If what the rules miss falls through to a model that writes, the customer sees invented text, extra buttons, or a handoff to the team that nobody asked for.

So the engineering problem changes. It is no longer making the assistant sound human. It is choosing the right routine for each message without letting the model write what the catalog already knows.

An old architecture, a new component

None of this is new. Long before large language models, assistants built to complete a task, such as booking a flight or setting an alarm, were designed as a chain of separate components. Jurafsky and Martin’s Speech and Language Processing describes the best-studied version, the dialogue-state architecture (draft of 19 August 2026). One component understands the message, another tracks what has been established so far, a third decides what to do next, and a fourth produces the sentence. The authors add that in industry, rules and machine learning are often combined inside each component.

The arrival of language models did not make that structure obsolete. It changed what fills each component. Two examples show the direction. Rasa, an open-source framework for building assistants, describes its current approach, CALM, as using a model to interpret the user while business logic runs in predefined steps, with templated replies by default. Anthropic’s guide to building effective agents (December 2024) names the same move “routing”: classify an input, then send it to a specialized follow-up task. It also recommends the simplest solution that works.

That is not the only path in the market. Much of the industry is moving the other way, towards a single agent that understands, decides and writes. For open-ended work that can make sense. For a clinic with a closed catalog and actions that occupy real rooms, we chose the layered design deliberately. The choice is the point of this essay: someone had to decide where the model belongs.

One message, block by block

Here is the path a message takes through Tredane’s assistant today.

Guards come first. Before anything tries to understand the message, a set of checks runs: is the clinic’s assistant paused, did the customer ask it to stop, does the message touch a sensitive subject, does the customer need to be told they are talking to an AI? These branches are too important to compete with anything that guesses.

Rules and a lexicon try next. Cheap patterns in code catch the obvious cases: “I want to book”, “how much is the cleansing?”. When the message names a service in the catalog, this layer recognizes it. No model is called, so it costs nothing and its behavior can be audited line by line. In the vocabulary of the textbook, this and the next block together are the understanding component, often called NLU, for natural language understanding.

The classifier runs only if the rules did not resolve the message. It is a language model with a narrow job: read the message and return one label from a closed list, with a confidence score. Booking, rescheduling, cancelling, price, talking to the team, a question about the catalog, a question about the clinic, or “none of these”. It never writes the reply. A model that decides and writes in the same call is where invented times come from.

Fixed routines turn a label into a reply. For each closed label there is code that builds the sentence and the button from the catalog or from a link. Price comes from the price list. “What does it include?” comes from the treatment’s description, or from a fixed sentence saying the clinic has not recorded that fact. “Show me the calendar” gets a fixed sentence and the “Open calendar” button. This is the textbook’s policy and generation together, with generation reduced to filling a sentence the clinic can recognize.

A small memory sits to the side. After the customer asks “do you do [service X]?”, the next message is often “how much?”, without the name. So when a routine answers about a service, it records which service the conversation is about, and the next routine reads it. The model never writes this memory, and it does not rebuild it from the message history. This is the textbook’s state, and it gets an essay of its own in this series.

The writer handles only what is left. For a question outside the catalog and outside the closed labels, a language model writes the reply, grounded in the clinic’s information. A validator then rejects text that is invented or unsafe. If the writer fails, the customer receives a fixed sentence saying the assistant did not understand, and the team receives an alert. The assistant does not go silent.

Two more decisions frame the diagram. Each clinic runs isolated from every other, with its own data and its own conversation memory. And the system does not teach itself in production. Improvement is a loop the team runs: record what happened on each turn, sample the mistakes, label them, add them to a test corpus, and adjust thresholds, rules or prompts. Nothing changes in front of customers because a model “learned” something overnight.

Where people decided

Read the diagram again and look for the decisions that no model and no framework made.

Someone decided which requests are closed. That is not a technical property of a sentence. A price question is closed because the clinic has a price list and wants it quoted exactly. A comparison between two treatments stays open because there is no recorded answer, and a careful paragraph may help. Moving a request from one side to the other changes what customers read.

Someone decided the list of labels, and a rule about it: no new label without its routine already wired. It sounds like housekeeping. Without it, the classifier could correctly tag a message as a catalog question, find no code to answer it, and hand the turn to the writer. The label would be right and the customer would still read invented text.

In an open file box, each index card has an ochre tab. A loose tab sits on the desk.
Figure 3 Each label needs a routine in place before it can enter the flow.

Someone decided that the chat does not book. That decision removed a whole class of failures, because a misunderstood “yes” cannot occupy a room. It also cost something: one extra tap to the web page. Weighing that trade is a product judgment.

And someone has to decide which mistake is worse. The rules almost never send a booking link to a customer who only asked for information. They do miss paraphrases. That asymmetry is the reason the classifier exists. How much of one error the clinic will accept to reduce the other is not a question a model can answer for the clinic.

These are the decisions of a business analyst, a product manager and an engineer, whatever their titles are in a given team. The model makes the system more capable. It does not tell the system where its edges are.

The question that started this, what may the model write?, ends up with a short answer: only what nobody has already written down. Price, policy, hours and the calendar are already written. The model’s job begins where the catalog ends.

Deciding where the catalog ends is the next problem. It starts with a list of labels, and with the people who have to agree on what each one means.

A question to take with you

In your system, which sentences should no model ever be allowed to write?

Written by Paulo R. Software engineer and founder of Lucimark.

Follow new writing through RSS or get in touch on LinkedIn.