Our support prompt said never tell people to open a ticket, and 9 of its 21 recorded answers did
We rebuilt the support assistant inside CogniPrep this week. The old one had a rule in its prompt, in plain English: never tell the user to open a ticket, email us or contact support, because the app already shows that o
We rebuilt the support assistant inside CogniPrep this week. The old one had a rule in its prompt, in plain English: never tell the user to open a ticket, email us or contact support, because the app already shows that option when a human is needed.
The comment above the new prompt records what happened to that rule. Of the 21 answers we had saved from the old assistant, 9 said it anyway.
Nothing was wrong with the wording. A model asked in prose to avoid a phrase has nowhere else to put the thing it wants to say, so the phrase leaks out. This post is about what we did instead, and about the small script that stops it coming back.
Give the intent a place to go
The assistant wanted to say "a person needs to look at this". That is a real intent, and it was being expressed as sentences. So the reply is now a strict JSON schema with a closed action field, and the escalation is one of its values:
export const AGENT_ACTIONS = [
'none',
'escalate',
'mismatch_report',
'provider_swap',
] as const;
The model picks exactly one. The app, not the model, decides what each one looks like on screen: escalate shows the "talk to a person" option, mismatch_report shows the form that takes screenshots, provider_swap shows a card. The reply text is then free to just answer the question.
The prompt now says when each action applies, in a short list, instead of asking the model to hold a long list of things it must not say.
Parse it as if it will fail
Structured output makes bad replies rare. It does not make them impossible, so the parser treats the reply as untrusted:
export function parseAgentReply(content: string): AgentModelReply {
try {
// validate reply is non-empty text and action is in the list
} catch {
// fall through
}
return {
reply: "I'm not sure about that one, so I'll pass it to a person.",
action: 'escalate',
// ...
};
}
Anything malformed becomes an escalation. A broken reply therefore always ends at a person, never at a dead end. Lengths are clipped as well.
One more line in that parser is worth stealing. Our copy rules ban em dashes, and the model puts them in anyway, so the parser replaces them with a comma. It is a one-line regex, and it is the honest admission that some house rules are cheaper to enforce after the fact than to ask for.
The script that makes it a test
A prompt is code you cannot read the behaviour of, so we added pnpm support:eval. It replays 14 cases against the live prompt. The cases are paraphrased from real tickets, with invented accounts and no customer text stored, and each one declares which actions are acceptable.
Every reply, whatever the case, must also avoid a short list of patterns. They are the old failures written as regexes: "open a ticket", "contact support", "email us", "reach out", an em dash, a price with a currency symbol, and a promise that a refund "has been issued". The last two matter because prices depend on the visitor's country and the assistant cannot grant refunds.
A case can add its own bans. One is a customer who bought a bundle and asks whether they must pay again to see their percentile. The case forbids the assistant from telling them to buy the upgrade they already own. The old assistant did exactly that to paying users, because it could not see the account. The next post in this series is about how it sees the account now.
The whole run costs well under a cent. The script prints prompt tokens and cached tokens at the end, which is how we know the stable prefix of the prompt is being reused between calls. That is also why everything that changes per user goes after it, in later messages.
What I would tell you to copy
- If a rule is "never say X", ask what the model is trying to do when it says X, and give that a field.
- Parse model output like user input, with a fallback that is safe.
- Turn every incident into a replay case with a forbidden pattern. It takes minutes, and the next prompt edit cannot quietly undo it.
See it
The questions behind those cases are the ones on our help page, where the answers on pricing, refunds and the free allowance are published in full: cogniprep.app/help. Read the refund answer there, then think about why a support assistant must never improvise it. If you want to try the practice side of the product, the free account on cogniprep.app needs no card.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.