Rule Stacking is an AI code smell, a sign of trouble in LLM systems, in the Control-flow abusers group. The prompt piles up ALWAYS, NEVER, and IMPORTANT in caps, and the rules fight each other.
A health insurer’s assistant answers member questions. This is an excerpt of its system prompt after a year of incidents (anonymized):
IMPORTANT: NEVER give a diagnosis.ALWAYS be empathetic.NEVER mention procedure prices.ATTENTION: ALWAYS state the copay amount when asked.DO NOT answer about medication.IMPORTANT!!! For severe symptoms, tell them to go to the emergency room.ALWAYS answer in at most 3 sentences.NEVER leave the member without a complete answer.... [17 more rules in capitals]
Notice three conflicts: “never mention prices” versus “always state the copay”; “at most 3 sentences” versus “never leave without a complete answer”; and the severe-symptoms rule, the most important of all, buried among 24 others with the same visual weight.
In a test, the assistant answered “I have had chest pain for an hour” with a three-sentence explanation of cardiology coverage. It followed the brevity rule and ignored the urgency one.
Signs of Rule Stacking:
The prompt has many lines with IMPORTANT, NEVER, ALWAYS, ATTENTION, in capitals or with exclamation marks.
Each rule was born from a specific incident.
Some rules contradict each other, and nobody decided which one wins.
Critical rules have the same emphasis as trivial ones.
Adding a rule fixes one case and breaks another.
The model follows some rules with excessive rigidity and ignores others.
flowchart LR
I(["1. Incident"]):::io --> R["2. New rule in capitals"]:::tool
R --> P[("3. Rule stack")]:::store
P --> M(["4. Model picks which to follow"]):::llm
M --> I
A case goes wrong in production.
The quickest fix is a new rule, with emphasis to “make sure” it works.
The rule joins the earlier ones, with no review of the whole set.
With many rules of equal weight, the model resolves conflicts its own way. New incidents appear.
Reasons
A rule is the cheapest fix. One line resolves the incident at hand and closes the ticket.
Emphasis seems to work. Capitals sometimes change behavior in a test, and it becomes a habit.
Nobody owns the whole prompt. Each team adds its own rules without reading the others’.
Without an eval, deleting is scary. Nobody knows which rules are still needed.
Current models follow instructions more literally. Emphasis that helped older models now produces excessive rigidity.
DPD’s chatbot (2024) insulted a customer after an update. A prompt that accumulates incident fixes is fragile in the same way: one edit touches a rule, and another rule nobody was watching stops being followed.
Cost of ignoring
Unpredictable behavior. With conflicting rules, the answer depends on which one the model prioritized that time.
Risk on critical rules. The rule that matters competes for attention with twenty that matter less.
Rigidity. Absolute rules applied out of context produce absurd answers (“I cannot talk about prices” to someone asking about their copay).
Maintenance. Every change requires understanding how it interacts with every other rule.
The insurer’s conflicts, side by side
Rule A
Rule B
What the model does in practice
NEVER mention prices
ALWAYS state the copay
Refuses the amount, or invents a halfway answer
At most 3 sentences
NEVER leave without a complete answer
Trims the urgency guidance to fit
DO NOT talk about medication
Route severe symptoms
Talks coverage and skips “go to the ER”
Copay here is the member’s share of a procedure under a Brazilian health plan (coparticipação). The person is asking for a number the contract says you must give. The stack treats that number as if it were a clinic’s price list. Privacy rules (LGPD in Brazil) and health routing are not solved with one more line in capitals: the flow decision needs to be code.
The rules try to describe tone, format, or edge-case behavior. A few well-chosen examples show what twenty rules try to say. Target: Few-Shot Selector.
The rule is a flow decision (“for severe symptoms, do X”). It leaves the prompt and becomes a code step that cannot be ignored. Targets: Routing and Prompt Chaining.
Before either, build an eval from the incidents that produced the rules. It is what makes deleting safe: see Add Eval Before Changing the Prompt.
How to slice the insurer’s stack:
Urgency becomes a classifier plus a code route to the ER message. It no longer competes with “3 sentences”.
Copay becomes a tool that looks up the amount in the contract. The “never cite procedure prices” rule stops fighting a number the tool returns.
Tone (empathy, brevity) becomes two or three examples, not eight ALWAYSes.
Deleting comes after measuring. The temptation is to put the critical rule in capitals at the top. That can raise the rate in a test and still fail on a Friday night.
Payoff
Critical rules guaranteed by code, not by emphasis.
A short prompt that explains the context and goal instead of listing prohibitions.
Consistent behavior, with no conflicts left for the model to resolve.
Each incident becomes an eval case, not one more line in the prompt.
When to ignore
A few rules, no conflict. Three or four clear, compatible instructions are normal in any prompt.
Simple format constraints. “Answer in English” or “use at most 200 words” do not need to become code.
Prototype. To discover the desired behavior, quick rules are acceptable. Consolidate before going to production.
Is it this smell?
Quick answers
What is Rule Stacking?
Rule Stacking is an AI code smell, a sign of trouble in LLM systems, in the Control-flow abusers group. The prompt piles up ALWAYS, NEVER, and IMPORTANT in caps, and the rules fight each other.