Essay · agentic systems

The Constrained Expert System

The dream is an AI you describe a problem to, and it builds the whole solution. I think that's the wrong target. The right one is stranger: an AI limited more than a human developer, not less — and it may be the thing that finally closes the gap between the people who understand the problem and the people who build the software.

constrain more, not less LLM at authoring time, not decision time meta-DSL once, instances forever worked proof: clinical
Where I'm coming from

The gap I lived — Drools & jBPM

Years ago I built expert systems on JBoss Drools and jBPM — a production rules engine (real DRL rules, decision tables) and a BPM workflow layer, sold as the way to finally close the gap between business and IT.

The pitch was intoxicating: business analysts would author the rules, the engine would execute them, developers would step back. It did not happen. What I learned building those systems is that the gap didn't close — it just moved:

  • DRL was "for business analysts," but in practice only developers could author and maintain it. So the expert still had to route their knowledge through a developer — the gap relocated, it didn't vanish.
  • That routing was the knowledge-acquisition bottleneck: the expert explained, a developer translated to rules, slowly and lossily, and the expert couldn't verify the result.
  • Rule bases exploded. Hundreds of interacting rules, Rete conflict-resolution surprises, and no regression net — change one rule and pray. They rotted.
  • jBPM's "no-code" leaked at every edge: the process model still needed developers to wire service tasks, data mappings, and integrations.

The problem was never the engine or the DSL. It was the human bottleneck in authoring and maintaining the rules — and the expert's inability to self-serve.

Hold that thought. It is the entire argument, because it names the one thing an LLM is unusually good at — and it is not "writing your app."

The seduction

The LLM-as-compiler trap

The fashionable dream is the LLM as a universal compiler: describe any problem in English, receive code, data pipelines, and deployment. No formalism, no constraints — natural language in, working system out.

It is seductive and, as a general target, wrong. An unbounded generator is ungrounded (it invents entities, APIs, and assumptions that don't exist), unreliable (ask twice, get two systems), and non-reproducible (there's no artifact a human can certify — only an output you re-roll). For anything that has to be trusted, that's disqualifying.

LLM as compiler problem LLM code? pipeline? deploy? ??? Constrained expert system problem LLM⊂ ontology rule deterministic
Left: unbounded → ungrounded. The compiler dream fans out into artifacts nobody can certify. Right: bounded → grounded. The LLM generates one ontology-constrained rule, checked and deterministic. Same model; radically different trust.
The thesis

Constrain the AI more, not less

Here is the inversion. A good human developer isn't valuable because they can write anything — they're valuable because they work inside an architecture: the data model, the APIs, the domain's rules. The constraints are what make their output trustworthy.

So the move isn't to free the AI from those constraints. It's to bind it tighter — to make it play with configurations and building blocks, not raw code; to make it a rule generator bounded by an ontology, not a compiler bounded by nothing. Every prior attempt to close the business–IT gap — Drools/jBPM, classic expert systems, model-driven development, low-code, DSLs — reached for exactly this constrained shape. They all stalled on the same rock: someone still had to acquire the knowledge and maintain the rules, and that someone was a scarce human.

◆ Why this time is different
The LLM doesn't change the target — the constrained expert system was always the right target. It changes the economics of authoring. Translating an expert's knowledge into grounded rules, keeping them in sync as the domain shifts, and explaining them back — the exact bottleneck that killed the predecessors — is the one thing an LLM is unreasonably good at. Not building the app. Authoring the rules for a machine that runs them.
The core distinction

Keep the LLM out of the decision loop

This is the sentence the whole idea rests on. The current wave of "LLM + your data" systems keeps the model on the hot path: every decision is a fresh generation. That's why they're hard to trust — a per-query answer is non-reproducible and unaccountable.

Invert it. Put the LLM at authoring time — where it drafts and maintains the rules, with a human expert approving — and take it out of the loop at decision time, where the approved rules execute deterministically. Ask the system the same question twice and get the same answer, every time, from logic a human signed.

AUTHORING TIME · LLM present expert + LLMdraft rules gatevalidate approvesign-off DECISION TIME · LLM absent inputa case rules rundeterministic answer approved artifact
The LLM is a tool the expert uses to write the rules — then it leaves. Everything trustworthy happens on the right, where no model is in the loop: same input, same output, from logic a human approved.

This one move buys reproducibility, an audit trail, and a defensible artifact — the three things a hot-path LLM cannot give you, and the three things a regulated domain demands.

◆ One honest boundary
"Deterministic" is a claim about the rule logic. Feeding it real-world inputs — mapping a messy record to the ontology's terms — is a problem so classic it has a name (Arden's "curly braces," which we'll meet again), and that mapping can still need fuzzy or LLM-assisted extraction. Determinism lives downstream of the mapping; the mapping is where the meta-DSL's data bindings — and the residual effort — actually sit.
The mechanism

Meta-DSL once, instances forever

The hardest part of every expert system was defining the DSL — the vocabulary and building blocks the rules are written in. Get it wrong and everything downstream is wrong; getting it right took standards committees years. That's the rock to get past, and the trick is to split the problem in two.

STEP 1 · define once (high-touch) expert + LLMvisual · reversible the meta-DSLontology + blocks iterate STEP 2 · instantiate forever (low-touch) a protocol(NL) LLM fillsan instance rule instancegated reuse many instances · one meta-DSLeach cheap, grounded, versioned
Define the meta-DSL once, high-touch and reversible; instantiate cheaply forever. The expensive, expert-heavy act happens a single time per domain; every feature after is a bounded fill-in-the-blanks the LLM does and a human approves.

Step 1 is the one place you spend real expert time: co-design the meta-DSL with the LLM through a visual, reversible wizard — go forward, go back, watch the model take shape, ground every term in the ontology. Step 2 reuses that fixed meta-DSL to generate an instance per feature, at near-zero cost.

◆ "Fixed" means versioned, not frozen
A meta-DSL still evolves as the domain does. "Fixed" has to mean versioned + migratable: when the meta-DSL ships a v2, existing instances migrate. Skip this and you've rebuilt the maintenance rot that killed Drools rule bases.
The worked proof

Where it gets real: clinical protocols

Pick a domain that is unforgiving and already semi-formal, and the whole argument stops being abstract. Clinical-protocol checking is that domain — and it comes with a graveyard that proves both the doability and the "why now."

The ruins tell you what to do

This has been attempted, formally, for thirty years: Arden Syntax (HL7 Medical Logic Modules — literally a clinical rule DSL), GLIF, PROforma, SAGE, and today's CDS Hooks / FHIR Clinical Reasoning. These are the constrained-expert-system idea, minus the LLM. Two lessons fall out of the wreckage:

  • The solution shape is known and bounded — eligibility criteria, dosing rules, decision trees. A rule/constraint object, not arbitrary code. That's the doability proof: we're filling a known shape.
  • They stalled on authoring, not execution. Arden's infamous "curly-braces problem" — mapping each rule to a site's actual data was manual agony — is the knowledge-acquisition bottleneck by another name. And FHIR + SNOMED/LOINC already give us the grounding ontology, so the LLM generates against real, bound terms — and anything unbound is flagged.

The one-line framing: Arden Syntax, but the LLM is the medical knowledge engineer — grounded in FHIR/SNOMED, and every rule gated by a clinician.

Trust, without a black box

Clinical is unforgiving: one hallucinated dosing rule and the system is radioactive. So a clinician can't rubber-stamp raw logic — they review the way guideline committees already do: behaviour and evidence. The lean bar needs no patient data and no solver:

LLM draftsa rule instance + citation + test vignettes clinicianreviews · edits · signs approveddeterministic eval guidelineupdate = diff a guideline update re-runs the vignettes → the clinician approves a diff, not the whole thing
The clinician reviews behaviour + evidence, never naked logic. Every rule arrives with its guideline citation and a set of test vignettes; the clinician edits the vignettes (the load-bearing human act) and signs; the approved instance runs deterministically. Updates return as diffs.
◆ Honest about the load-bearing part
In this lean version, cross-rule contradictions are caught by vignette coverage and the reviewer — not proven absent. The clinician-edited vignette carries the trust. That's not a hidden weakness; it is the human-in-the-loop the whole thesis rests on. (A symbolic consistency-prover over the boolean eligibility logic, and a retrospective-cohort shadow mode, are the credible next rungs — not the ask.)
Buildable today

The building blocks already exist

The reason I'm confident this isn't another beautiful stall: the component categories it needs already exist and are reusable. We built Context Graph as a decision-aware knowledge graph, and it happens to supply most of the generic machinery — the authoring, grounding, and governance plumbing — that a system like this leans on. Not the clinical system; its scaffolding.

The pattern needs…Context Graph has, today
NL → grounded rules, dry-runRuleAuthor — generates a business-rules DSL rule and dry-runs it against sample cases (the same shape as vignette testing)
the ontology boundarya typed ontology that validates & coerces what generation writes
per-rule citationssupporting_sentences / provenance on every edge
governed approvalthe rules gate + lifecycle (draft → approved → superseded)
the update-as-diff loopversioned ontology & rules

The table is the generic plumbing. The clinical layer is net-new: a FHIR/SNOMED-bound ontology, the clinical rule language itself, the vignette format, and the visual, reversible meta-DSL studio (Step 1's UX) with a span-level citation review surface — plus, for the roadmap, the consistency-prover. Notably, none of that is AI magic; it's mostly bookkeeping and interface over machinery that runs on localhost right now.

Why it matters

The payoff: two tiers, one closed gap

Land this and you get a two-tier world. Experts — a clinician, an underwriter, a compliance officer — use the define-once studio to build a domain application by declaring its objects, rules, and building blocks, with the LLM doing the translation they could never do alone. Non-experts then use those applications without touching code or infrastructure, trusting them because every rule is grounded, cited, and signed.

That's the gap — the one Drools and jBPM and every expert system reached for and couldn't close — finally closing. Not because the AI got powerful enough to build anything, but because we got disciplined enough to let it build almost nothing: just the rules, for a machine that runs them, checked by the human who owns the risk.

◆ The one-sentence version
Stop trying to make the LLM a compiler. Make it the world's fastest knowledge engineer, bound by an ontology, kept out of the decision loop, and gated by a human — and the thirty-year-old dream of closing the business–IT gap stops being a pitch and becomes an engineering problem.

Part II — the regulatory & business case — is Adoptable by Design. This essay is also a companion to The Fourth Element and the Context Graph architecture. The clinical design — meta-DSL primitives, the studio, the consistency-prover — is a further follow-up; this is the argument for why it's worth building.

↑ Top