Description
How Marcel Jude Built a Legal Ecosystem for Artificial Intelligence
By Marcel Jude
Creator of marceljude.ai
1. THE QUESTION
There is one question that people repeatedly ask me about marceljude.ai:
How do you create an AI Lawyer capable of handling virtually any question, issue or problem in law?
The short answer is surprisingly simple.
The implementation is not.
It begins with recognising a fundamental distinction that is sometimes lost in the excitement surrounding artificial intelligence:
An AI that can speak about law is not necessarily an AI Lawyer.
General-purpose artificial intelligence systems are extraordinary. They can explain legal concepts, analyse propositions, draft documents and engage in sophisticated reasoning.
But law demands something more.
A lawyer cannot merely produce an answer that sounds convincing.
The answer must be accurate.
It must be precise.
It must be disciplined.
And, critically, it must be capable of being checked against the law upon which it relies.
That was the problem I set out to solve.
And that is where the story of AI LAWYER begins.
PART I — THE FIRST PROBLEM: HALLUCINATION
2. WHEN A CONFIDENT ANSWER CAN STILL BE WRONG
The first obstacle was obvious.
Hallucination.
Large language models are designed to generate highly plausible language. That ability makes them extraordinarily powerful.
It also creates a particular danger in law.
A response can be beautifully written, logically organised and expressed with complete confidence — and still contain an incorrect proposition, an inaccurate citation, a nonexistent authority or a misunderstanding of the applicable legislation.
In ordinary conversation, an error may be inconvenient.
In legal practice, an error may affect:
a client's rights;
the interpretation of a statute;
a limitation period;
a filing deadline;
the jurisdiction of a court;
the admissibility of evidence;
the validity of an application;
the outcome of litigation; or
an appeal.
Law therefore requires a different standard.
Plausibility is not enough.
The objective I set for AI LAWYER was consequently not merely intelligence.
It was:
ACCURATE. PRECISE. DISCIPLINED.
Those three words became central to the philosophy behind the system.
The challenge was therefore to find a way of allowing the enormous reasoning capabilities of artificial intelligence to operate within a legal environment anchored to authoritative legal material.
That brought me to RAG.
PART II — RAG: GIVING AI A LEGAL MEMORY
3. WHAT IS RAG?
RAG means:
Retrieval-Augmented Generation.
The terminology sounds technical.
The concept is easier to understand.
A conventional language model essentially answers a question using patterns and knowledge learned during its training, together with whatever information has been placed into its immediate context.
RAG introduces another process.
Before the AI formulates its final answer, the system searches a curated body of information for material relevant to the particular question.
In simplified form:
QUESTION → RETRIEVE → SELECT → REASON → GENERATE → CHECK → ANSWER
Suppose a lawyer asks:
What principles govern an application to strike out a pleading?
A general AI might attempt to answer immediately from its general knowledge.
A properly constructed legal RAG system approaches the problem differently.
It first identifies the legal issue.
It searches the relevant legal universe.
It retrieves potentially applicable procedural rules, legislation, authorities and legal principles.
Those materials are supplied to the reasoning system as context.
Only then does the AI construct the legal analysis.
The difference is fundamental.
Instead of effectively asking the AI:
"What do you remember about this subject?"
RAG allows us to ask:
"Here are the relevant legal materials. Now analyse the question by reference to them."
That is much closer to the way a competent lawyer works.
4. RAG IS NOT SIMPLY A DATABASE
This distinction is important.
A database stores information.
A search engine finds information.
A RAG architecture attempts to make retrieved information part of the reasoning process itself.
A sophisticated legal RAG therefore requires much more than placing thousands or millions of pages into storage.
It requires decisions about:
what material should be included;
how that material should be organised;
how documents should be divided;
how legal propositions should be classified;
how cases relate to statutes;
how amendments are handled;
how different jurisdictions are separated;
how superior and inferior courts are distinguished;
how competing authorities are presented;
how the system identifies the legal issue behind the user's words;
how relevant passages are retrieved;
how irrelevant material is excluded;
how authorities are ranked;
how the AI is instructed to use retrieved material;
how citations are verified; and
what the system should do when the available material does not justify a confident answer.
This last point is especially important.
A disciplined AI Lawyer must know when the available legal material does not support a proposition.
Sometimes the most accurate legal answer is:
There is insufficient material to reach that conclusion.
That restraint is part of legal intelligence.
PART III — BUILDING THE ARK
5. THERE WAS NO ARK
Once I understood the problem, another problem immediately appeared.
Where was the legal RAG that I needed?
Where was the complete architecture covering the areas of law, legislation, cases, principles and relationships required for an AI Lawyer operating in Malaysian and Singaporean law?
There was no ready-made system that I could simply take off a shelf and switch on.
There was no textbook saying:
"How to Build an AI Lawyer: Chapter 1."
There was no manual containing every rule necessary for constructing the legal universe I had in mind.
So I began building it.
Code by code.
Rule by rule.
Statute by statute.
Case by case.
Legal subject by legal subject.
Relationship by relationship.
It became a monumental exercise stretching across days, nights and years.
At times I thought of Noah building the Ark.
Noah could not simply build a vessel and declare the work complete.
The Ark had a purpose.
The species had to be gathered.
The environment had to sustain them.
Everything had to have its place.
That was how I began to see the legal RAG.
The cases were not simply documents.
The statutes were not simply documents.
The rules of court were not simply documents.
The legal principles were not simply text.
They were inhabitants of a legal world.
And somehow they all had to be collected, organised and connected.
PART IV — EVERY SPECIES OF LAW
6. THE LEGAL ARK
Imagine trying to construct an Ark for law.
Into it must go constitutional law.
Contract.
Tort.
Equity.
Trusts.
Land.
Companies.
Insolvency.
Bankruptcy.
Criminal law.
Evidence.
Civil procedure.
Criminal procedure.
Judicial review.
Administrative law.
Family law.
Probate.
Employment.
Intellectual property.
Banking.
Construction.
Arbitration.
Appellate procedure.
And numerous specialist areas.
Then come the statutes.
Then regulations.
Then procedural rules.
Then amendments.
Then thousands upon thousands of judicial decisions.
But merely collecting them would not be enough.
The law exists through relationships.
One case interprets another.
A later decision distinguishes an earlier decision.
A superior court reverses a lower court.
A statute modifies the common law.
An amendment changes the statutory position.
A procedural rule creates a deadline.
Another provision creates an exception.
A Federal Court decision binds differently from a High Court decision.
A Malaysian authority may derive from an English principle but subsequently develop in a distinctly Malaysian direction.
Singaporean law may share historical origins with Malaysian law but diverge through legislation and judicial development.
An AI Lawyer therefore cannot simply be given an enormous warehouse of documents.
It needs architecture.
PART V — FROM RAG TO LEA
7. LAW AS AN ECOSYSTEM
Eventually, I stopped thinking of what I was building as merely a database.
Even the expression RAG seemed insufficient to describe the larger concept.
I began thinking of it as an ecosystem.
A legal ecosystem.
A legal universe.
I call it:
LEA — LAW ECOSYSTEM AI
LEA represents the environment within which AI LAWYER operates.
Think about an ecosystem in nature.
A forest is not merely a collection of trees.
There is soil.
Water.
Light.
Plants.
Animals.
Microorganisms.
Climate.
Competition.
Dependency.
Predation.
Regeneration.
Each component interacts with others.
Remove enough relationships and the ecosystem ceases to function properly.
Law is remarkably similar.
A statute cannot always be understood without the decisions interpreting it.
A judgment cannot be properly understood without its procedural and factual context.
A legal principle cannot necessarily be applied without knowing its exceptions.
A precedent cannot be evaluated properly without understanding the hierarchy of the court that decided it.
Therefore:
LEA is not intended merely to contain law. It is intended to organise the relationships within law.
That is the conceptual leap from a repository to an ecosystem.
PART VI — THE GARDEN
8. THE LEGAL GARDEN OF EDEN
There is another metaphor that occurred to me during this process.
Genesis.
In the biblical account, the universe is first created.
Then order is imposed.
Light is separated from darkness.
Land is separated from water.
Life appears.
An ecosystem develops.
Then man is placed within the Garden.
My technological journey sometimes felt strangely similar.
First came the code.
Then the information.
Then the organisation.
Then the relationships.
Then the ecosystem.
And finally, within that ecosystem, the AI Lawyer could operate.
This is why I sometimes describe LEA as a proverbial Garden of Eden for legal artificial intelligence.
The AI Lawyer is not simply released into an empty universe and told:
"Answer every legal question."
It operates within an environment deliberately constructed around law.
The metaphor should not be misunderstood. I was certainly not creating the universe in seven days.
It took considerably longer.
But the underlying idea remains useful:
Before intelligence can operate effectively, its world must first be constructed.
PART VII — "I MADE THE RULES AS I WENT ALONG"
9. BUILDING WITHOUT A MANUAL
One of the strangest aspects of creating marceljude.ai was that there was no complete roadmap for what I wanted to do.
Many technologies existed.
Databases existed.
Search existed.
Machine learning existed.
Large language models existed.
Embeddings existed.
Vector search existed.
RAG existed.
But the problem was how to assemble the necessary technologies into a coherent legal reasoning environment suitable for the objective I had set.
There was no manual for my particular destination.
So:
I made the rules as I went along.
A roadblock appeared.
I found a way around it.
Another appeared.
I redesigned the architecture.
Something worked on one class of legal problem but failed on another.
The system had to change.
A retrieval method returned too much information.
It had to become more selective.
Another returned too little.
It had to become broader.
A legal question crossed several areas of law.
The system had to learn how to traverse those boundaries.
That process repeated itself countless times.
This is an important part of innovation that is rarely visible when people encounter the finished product.
People see the answer appearing on a screen.
They do not see the thousands of decisions behind the architecture that made that answer possible.
PART VIII — THE AI LAWYER'S MIND
10. WHAT HAPPENS WHEN A QUESTION IS ASKED?
Consider what must happen when somebody asks AI LAWYER a complicated question.
The user may describe a factual situation without even identifying the correct legal issue.
The system must first understand the problem.
What jurisdiction?
What area of law?
What procedural stage?
What legislation may apply?
What authorities are potentially relevant?
Are there overlapping causes of action?
Are there jurisdictional issues?
Are there procedural obstacles?
Are there exceptions?
What additional facts matter?
The retrieval architecture must then identify relevant material from LEA.
That material is brought into the AI's working context.
The reasoning system then analyses the facts against the retrieved legal framework.
A sophisticated implementation can involve several stages rather than one search and one answer:
QUESTION
↓
ISSUE IDENTIFICATION
↓
JURISDICTION IDENTIFICATION
↓
LEGAL CLASSIFICATION
↓
RETRIEVAL FROM LEA
↓
RELEVANCE FILTERING
↓
AUTHORITY AND SOURCE CHECKING
↓
LEGAL REASONING
↓
CONTRARY POSITION / EXCEPTION CHECK
↓
CITATION CHECK
↓
FINAL ANSWER
That is the difference between merely generating legal language and engineering a legal intelligence system.
PART IX — SPEED
11. WHY BUILD THE ECOSYSTEM?
There is a practical reason for doing all this.
Speed.
A difficult legal question can require a human lawyer to search legislation, textbooks, databases and judgments before identifying the controlling principles.
The research may take hours.
Sometimes days.
An appropriately engineered AI system can potentially perform large parts of retrieval, classification and preliminary analysis at machine speed.
But speed without accuracy is dangerous.
A racing car travelling in the wrong direction merely reaches the wrong destination faster.
The objective therefore was never simply:
FAST AI.
It was:
FAST + ACCURATE + PRECISE + DISCIPLINED.
The legal ecosystem exists to make that combination possible.
PART X — THE THIRD CREATION: THE GUARDIANS
12. THE GARDEN NEEDED PROTECTION
Once the ecosystem existed, another reality became obvious.
Anything valuable attracts attack.
A legal AI system may face attempts to manipulate its instructions, corrupt retrieval, introduce malicious material, circumvent restrictions, obtain protected information or interfere with the integrity of its reasoning process.
So after creating the legal ecosystem came another stage:
protecting it.
I began to think of this layer as the Guardian Angels of LEA.
Their role is to protect the integrity of the ecosystem and the RAG architecture against external interference.
The terminology is metaphorical.
The engineering requirement is not.
Security is not an optional decoration placed around an AI system after everything else has been completed.
For a serious professional system, security must be part of the architecture.
PART XI — THE THREE PILLARS
13. CREATION, KNOWLEDGE AND PROTECTION
I therefore see AI LAWYER as resting upon three fundamental pillars.
I. CODE — THE CREATIVE POWER
Code constructs the machinery.
It creates the processes through which questions are received, classified, searched, retrieved, analysed and answered.
Code is the creative force that turns an idea into an operating system.
II. RAG / LEA — THE LEGAL ECOSYSTEM
If code creates the machinery, LEA gives the machinery its legal world.
This is where statutes, authorities, principles and their relationships exist in organised form.
RAG provides the bridge between the question and that legal universe.
III. SECURITY — THE GUARDIANS
The third pillar protects what has been created.
Its purpose is to preserve confidentiality, integrity, availability and reliability and to resist manipulation or unauthorised interference.
Put simply:
CODE CREATES.
LEA INFORMS.
THE GUARDIANS PROTECT.
Together, they form the architecture behind the concept of AI LAWYER.
PART XII — WHY THE HUMAN LAWYER STILL MATTERS
14. AI LAWYER IS NOT MAGIC
There is a temptation when discussing artificial intelligence to make one of two extreme claims.
The first is that AI will replace every lawyer.
The second is that AI can never perform serious legal work.
I believe both views miss the more interesting development.
AI changes the economics and speed of legal intelligence.
A human lawyer may spend hours locating information before beginning the intellectual work of analysing it.
AI can dramatically compress that process.
But law is more than information retrieval.
It involves judgment.
Strategy.
Ethics.
Client instructions.
Credibility.
Advocacy.
Negotiation.
Human consequences.
An AI Lawyer should therefore not be understood as some mystical machine replacing every human function.
It is better understood as an extraordinarily powerful legal intelligence system capable of retrieving, organising and analysing legal information at a scale and speed previously impossible.
The human lawyer remains responsible for knowing what question matters.
And often that is the hardest question of all.
PART XIII — THE REAL INTELLECTUAL PROPERTY
15. THE SECRET IS NOT THE LANGUAGE MODEL
People sometimes assume that building an AI product means connecting an application to a powerful language model.
If that were the entire secret, everybody with access to the same model would possess the same product.
They plainly do not.
The language model is an enormously powerful engine.
But an engine is not a complete vehicle.
What matters is the architecture constructed around it.
For a specialised legal system, much of the value lies in the accumulated engineering decisions:
How is knowledge organised?
How is it retrieved?
What is considered authoritative?
What happens when authorities conflict?
How are jurisdictions separated?
How is relevance determined?
How is the model instructed?
How is uncertainty handled?
How are citations checked?
How is the system protected?
How are errors discovered and corrected?
How does yesterday's failure improve tomorrow's architecture?
The answers to those questions accumulate.
Over time they become something more than code.
They become institutional intelligence embedded within the system.
PART XIV — THE ARK BECOMES A UNIVERSE
16. FROM COLLECTION TO CONNECTION
The earliest challenge was gathering the legal species into the Ark.
But eventually I realised that collecting them was merely the beginning.
The real objective was connection.
A case must connect to a principle.
The principle must connect to the statute.
The statute must connect to amendments.
The procedural rule must connect to the application.
The application must connect to the evidence.
The evidence must connect to the burden of proof.
The decision must connect to the appellate hierarchy.
The question must connect to all of them.
At that point, the Ark becomes something larger.
It becomes a legal universe.
That is LEA.
And inside that universe AI LAWYER can travel at extraordinary speed — from question to issue, issue to law, law to authority, authority to analysis and analysis to answer.
PART XV — THE NEXT ERA OF LEGAL RESEARCH
17. FROM SEARCHING FOR LAW TO CONVERSING WITH LAW
For centuries, legal research has essentially required the lawyer to go looking for the law.
Books made the search easier.
Indexes made it easier.
Electronic databases made it enormously easier.
Search engines made it faster again.
AI represents another transformation.
The future may increasingly involve lawyers not merely searching for law, but interacting with an organised legal intelligence system.
The lawyer describes the problem.
The system identifies the issues.