In the pricing case, the leak was found after the fact: a corridor per category, drawn from the quotes that had already gone out. This engine is the corridor at the moment the quote is written. Inside it, the quote goes. Below it, the quote asks permission and must say why. Below the margin floor, it does not go at all. And a monitor watches the stream for the rep whose discounts are quietly growing. It is running below, in your browser, on 600 quotes you can make as generous as you like.
Pricing leaks are polite. Nobody steals; a rep gives 4% to close by Friday, then 6% because last time worked, and by the quarter's end the "habit" is the price. In the pricing case, a pocket-price waterfall found that money after it was gone and a corridor per category stopped the bleed — quote-to-order conversion rose 27%, because a quote inside a corridor is a quote the customer does not haggle with. The Pricing Guardrail is that corridor made into a gate: three outcomes at quote time, a reason code on every request, a 4-hour SLA that escalates itself, and a tie-out that will not publish the week's numbers if the decisions do not add up. SEAL and WATCH of the Leak Ledger, written as rules.
The engine is deliberately boring: no price optimisation, no model of willingness to pay, no threshold tuned by feel. The corridor is arithmetic on cost, the reason codes are three words, the approval probabilities are printed, and the drift monitor is one z-score whose formula sits in the table below. That is what makes a guardrail survivable: when it stops a quote, the rep can see which sentence stopped it and what price would have passed.
| STEP | RULE | WHAT IT DOES |
|---|---|---|
| Corridor | Per category, as a share of list: floor = ceil(cost ÷ 0.9 × 100) ÷ 100; target = floor + 0.10; ceiling = list | Five corridors from five cost ratios (55–71% of list). Change cost and the corridor moves; nothing else does. |
| 1 · BLOCK | Quoted share < cost × 1.03 | Below the margin floor. The quote is re-priced to the corridor floor and never reaches the customer. |
| 2 · APPROVE | Quoted share ≥ floor | Inside the corridor. Goes out in under a second, no human involved. |
| 3 · NEEDS APPROVAL | Else, with one reason in this order: VOLUME (qty ≥ 12) · COMPETITOR (a competitor quote is attached) · STRATEGIC (a flagged account) · NO REASON | A request with a reason. No reason → declined automatically, re-priced to the floor. |
| SLA | The approver answers within 4 h with p = 0.8; otherwise the request escalates one level | A request never sits. The escalation is counted, because escalations are how you find the approver who is the bottleneck. |
| Grant | Granted with p = 0.7 VOLUME · 0.85 COMPETITOR · 0.9 STRATEGIC; declined → re-priced to the floor | The synthetic approver. In life the probabilities are the approvers' own history. |
| Drift monitor | From a rep's 10th quote: z = (mean of their last 10 discounts − mean of the category means of those 10 quotes) ÷ (population sd of all discounts so far ÷ √10); flag when z > 2 | Names the rep and the quote that did it. It cannot tell drift from habit — a rep who always discounted heavily is flagged at their 10th quote, which is the point. |
| Margin protected | Σ over blocked + declined quotes of (floor − quoted share) × list × qty, net of an assumption printed on the slider: re-pricing to the floor loses 15% of those deals, and a lost deal forgoes the margin it carried as quoted | The number the page leads with. Gross is in results.json too. |
| Tie-out | 600 = approve + granted + declined + escalated → granted + escalated → declined + blocked | If it breaks, the week's report is not published. |
# the gate, in this order — the sentence a sales head can disagree with (engine.py) if Q["share"] < C["cost"] * block_mult: Q["decision"] = "BLOCK"; Q["outcome"] = "REPRICED"; return # below the margin floor if Q["share"] >= C["floor"]: Q["decision"] = "APPROVE"; return # inside the corridor Q["decision"] = "NEEDS_APPROVAL" if Q["qty"] >= 12: Q["reason"] = "VOLUME" elif Q["competitor"]: Q["reason"] = "COMPETITOR" elif Q["strategic"]: Q["reason"] = "STRATEGIC" else: Q["reason"] = "NO REASON"; Q["outcome"] = "AUTO_DECLINED"; return escalated = rng.random() >= SLA_P # answered within 4 h with p 0.8 granted = rng.random() < GRANT_P[Q["reason"]] # 0.7 · 0.85 · 0.9 by reason
Run the stream to see what the gate stops.
Two things to try. Switch the guardrail off and the big number turns into the margin that leaks: the same 600 quotes, the same reps, nobody asking. Then drag the corridor floor to cost ÷ 0.85: the floors rise, the blocks and requests multiply, and margin protected climbs — but watch the approval load per week and the deals-lost slider, because a corridor tight enough to catch everything is a corridor the sales team routes around. The floor is a business decision, so it is a slider, not a constant.
| WHEN | WHAT HAPPENS | WHO SEES IT |
|---|---|---|
| At quote time | The quoted price meets the category corridor inside the quoting tool. APPROVE goes out; NEEDS APPROVAL opens a request with its reason; BLOCK re-prices to the floor and says which sentence did it. | The rep, in under a second, with the price that would have passed. |
| Within 4 h | The SLA clock. An unanswered request escalates one level and is counted as an escalation against the approver. | The approver, then their manager. The escalation count is how you find the bottleneck. |
| Nightly | The drift monitor recomputes every rep's last-ten z against the population; the day's decisions are tied out: quotes = approve + granted + declined + escalated + blocked. Any gap → no publish. | The sales head gets the flagged reps with the quote that flagged them. A tie-out failure is the engine finding a bug in itself. |
| Weekly | Three numbers on one page: requests per week, margin that still leaked on granted requests, reps flagged. The corridor is not touched. | Leadership — the WATCH stage of the Leak Ledger. |
| Monthly | Corridor review: floors move only when cost moves. A floor that is asked for permission more than five times a week is a floor to revisit, not to route around. | Finance and sales, together, with the leak-by-rep table on the table. |
The corridor found the leak once; the guardrail keeps it found. The value is not the ₹1.6 lakh this stream protected in twelve weeks — it is that the request carries a reason, the reason carries a probability, the block carries the price that would have passed, and the rep whose habit is drifting is named at their 34th quote instead of at the year-end review. Make the floor a decision, the reason a word, and the tie-out refuse to lie, and the discount stops being the price.
Discounts that nobody approved? A pricing guardrail is a two-to-four-week SEAL: your categories, your costs, your reason codes — a corridor inside the quoting tool, an SLA that escalates itself, and a monitor that names the drift before the quarter does.
Start with a TRACE → engine.py README results.json The case it came from →