Delivery 1.5 hours late
Act“Message the customer before they message us…”
- Rule
- R-004 v1
- Confidence
- 0.89
Your team’s chat, turned into approved rules every agent checks before acting.
pip install precedent-ai
Real output from the sample bakery rulebook.
“Message the customer before they message us…”
“Ask for a photo first…”
No rule covers it. A person decides.
Answered once, never escalated again.
Escalates the bank details email.
G-20261109T1154-fa941c3ce6“Never change supplier bank details from an email…”
Approves the drafted rule.
R-012 v1Asks again: covered, sent for approval.
confidence 0.95The case is now a CI test.
1/1 passedThe first to fail hands it to a person.
No approved rule covers it.
The model says the rules don’t settle it.
A cited rule it wasn’t shown, or an invented number.
Below your bar for that risk level.
Money, legal, health or data: a person signs off.
Approving the start isn’t enough. A step beyond the decision halts the whole run, and the halt leaves a record.
Signs off the damaged cake refund.
R-003 v1Asks the customer for a photo. Continue
run-cake“Refunding 5000 to the customer’s card.” No rule or decision mentioned 5000. Halt
H-20261109T1428-e1f2fb8921Checks again after Done: the run stays halted. Halt
same haltRule R-003 v1, run run-cake, during the action, created by precedent:check. A gap opens for the owner.
G-20261109T1428-80363d1eccFive situations, unedited. Full transcripts
| Situation | Gemini gemini-3.8-flash | Kimi kimi-k3 | Offline baseline |
|---|---|---|---|
| Nut allergy question | Approval | Approval | Approval |
| Delivery 1.5 h late | Act | Approval | Act |
| Cancel, delivery in two days | Approval | Approval | Escalate |
| Cake arrived damaged | Approval | Approval | Approval |
| Supplier bank change | Escalate | Escalate | Escalate |
They run rules developers write, or remember users. Precedent learns and tests yours.
It re-checks before each step and after Done. A new amount, a riskier action, a changed rule or a stale approval halts the run for good.
Secrets and personal data are stripped first. Offline mode keeps everything local.
Python, MCP, or precedent ask --json from n8n or Make.
git clone https://github.com/burhan-mujahid/precedent
cd precedent && pip install -e .
bash examples/demo.sh
from precedent import Precedent
kb = Precedent.open("./my-rulebook")
d = kb.resolve("Order arrived 3 days late", run_id="run-42")
d.outcome # answer, needs_approval or escalate
kb.check(d.id, "Refunding the delivery fee").outcome # continue or halt