09Deep dive · compliance
Compliance that distills itself
When the knowledge base changes, the rules the agent has to follow get rebuilt on their own, and re-checked before any of them go live.
The problem
The rules an agent has to obey don't sit still. They come out of the shop's own knowledge base, and the shop edits it: a clinic adds a procedure, a distributor changes a payment term, and suddenly the agent is repeating a rule that no longer holds. Hand-keeping a separate list of what it must comply with guarantees that list drifts out of sync in the first busy week.
Constraints
- 01The rules derive from the source, they don't sit next to it. If compliance is a hand-kept copy, it lies the moment the base changes.
- 02Re-derive on its own when it changes. A human who has to remember to update the rules is a human who will forget.
- 03Audit before it goes live. Auto-generated rules that publish themselves unchecked are how a bad rule reaches a customer.
- 04Fail back to the old rules. If the new distillation doesn't pass the audit, the last good version stays in force. Never a gap.
Architecture
knowledge base changes
the shop edits its material — a price, a policy, a procedure
distill (after())
the rules the agent must obey are re-derived from the new source
audit
the new ruleset is checked before anyone talks to it
auto-publish if clean
passes → live; fails → the last good version stays
The trigger is the edit itself. The base changes, an after() job distills the new rules in the background, the audit checks them, and a clean audit publishes on its own. So the rules the agent obeys are always derived from the truth as it is now, not from a snapshot someone forgot to refresh.
The hard part
The hard part is that "re-derive on its own" and "never let a bad rule reach a customer" pull in opposite directions. Full automation is what keeps compliance honest, and it's also what would publish a subtly wrong distillation into production with nobody looking.
The way out was making the audit a gate, not a report. The distillation runs on its own, but it doesn't go live until it passes; if it fails, the previous good ruleset stays in force and the failure surfaces to me instead of shipping. It's precisely because the gate can say no that I can leave the automation this aggressive, re-deriving on every change.
Trade-offs
- Re-deriving on every change costs compute the shop never sees. It's cheaper than the alternative, which is the agent confidently quoting a rule that was retired last month.
- An automatic audit can be stricter than a human would be, and now and then it holds back a change that was fine. A false hold is safe; a false publish talks to a customer.
- Deriving the rules from the base couples the two, so you can't reason about compliance without reasoning about the source. That's correct: the source is why the rule exists.
What I'd do differently
I'd give the shop a preview of what changed. Right now the loop is invisible: they edit the base and the rules quietly re-derive. A diff saying "this edit changed these three rules the agent will now follow" would make a trustworthy process a legible one, and would catch the rare case where a well-meaning edit has a compliance consequence the author didn't intend.