Most "AI for lawyers" products are really just ChatGPT with a legal-sounding system prompt.
I didn't want to build that. A document that touches company law, tax, and labour law all at once needs someone who actually knows all three, not one generalist pretending to.
So LegalMind doesn't have one AI brain. It has 9.
The problem with one big agent
Think about what a single loan agreement actually touches in India. Banking regulation (RBI guidelines), company law (board resolution requirements), maybe FEMA if there's a foreign lender involved, maybe insolvency law if there's a default clause.
Ask one general-purpose model to check all of that in one pass, and it'll give you a reasonable-sounding answer that's shallow on at least half of it.
So instead, LegalMind has 9 separate specialist agents, each one only responsible for its own domain: Corporate/CS, Tax/CA, Labour law, IP, Real Estate, Banking/Finance, Insolvency, Data Privacy, and general contract law.
Each one is narrow on purpose.
How it decides which agents to actually trust
Here's the part that's genuinely a bit unusual. Instead of just running all 9 agents and averaging their answers, LegalMind borrows an idea from Particle Swarm Optimization, an algorithm originally built for numerical optimization problems, and repurposes it for deciding which agents' opinions matter most on a given document.
Every agent scores its own confidence on the document it's looking at. A banking agent looking at a loan agreement scores itself high. A labour law agent looking at the same document scores itself low, because there's nothing about POSH or PF in a loan agreement.
1┌──────────────────┐2 │ Your Document │3 │ (e.g., Loan │4 │ Agreement) │5 └────────┬─────────┘6 │7 ┌────────▼─────────┐8 │ PSO Supervisor │ ← scores + routes9 └────────┬─────────┘10 │11 ┌────────────────────┼────────────────────┐12 │ │ │13 ┌────▼────┐ ┌────▼────┐ ┌────▼────┐14 │ Banking │ │ Contract│ │ FEMA │15 │ (0.8) │ │ (0.95) │ │ (0.6) │16 └────┬────┘ └────┬────┘ └────┬────┘17 │ GLOBAL BEST │18 └────────────────────┼────────────────────┘19 ┌────────▼─────────┐20 │ Weighted │21 │ Synthesis │22 └──────────────────┘The agent with the highest confidence becomes the "global best" for that document, and the final answer gets weighted toward it, contract review at 45%, banking at 35%, FEMA at 20%, say, rather than every agent's opinion counting equally.
What the math actually looks like
Each agent's confidence updates like a particle's velocity in the original PSO algorithm:
1velocity = w * v + c1 * r1 * (personal_best - x) + c2 * r2 * (global_best - x)w is how much an agent sticks with its own prior read of the document. c1 pulls it toward its own best past analysis. c2 pulls it toward whichever agent currently looks most relevant. Run this for a couple of iterations and the swarm converges on which 4 agents actually matter for this specific document, instead of wasting time and tokens running all 9 in full every single time.
In practice, this means 60% faster analysis than running every agent sequentially, and noticeably better coverage than picking just one.
A real example
Feed LegalMind a loan agreement, and here's roughly what comes back:
1{2 "summary": "Loan agreement reviewed by 4 specialist agents",3 "key_issues": [4 "SARFAESI clause missing",5 "Interest rate exceeds RBI guidelines"6 ],7 "recommendations": [8 "Add Section 13(2) notice provision",9 "Revise interest to 12% p.a."10 ],11 "primary_domain": "banking",12 "contributing_agents": ["banking", "contract_review", "fema", "insolvency"]13}Notice it's not just "banking" that answered. Contract review, FEMA, and insolvency all had something small to add, because a real loan agreement genuinely touches all four.
Why this matters more than it sounds
This isn't really a legal-AI story. It's a "what do you do when one task needs several kinds of expertise at once" story, and I think it applies to more than just contract review.
Most multi-agent systems either pick one agent per query (fast, shallow) or run every agent every time (thorough, slow and expensive). Weighting by self-reported confidence, and letting that weighting decide compute allocation too, is a cheap way to get most of the benefit of "ask everyone" without the full cost of it.
Try it
LegalMind is live at legal.anshumansp.com. Upload a document and see which agents actually respond to it.
FAQ
What is LegalMind?
An AI platform for India's legal and compliance professionals that reviews documents, flags compliance risk, and drafts filings. Live at legal.anshumansp.com.
Why not just use ChatGPT for legal document review?
One general agent has to be equally good at company law, tax, labour law, IP, and banking at once. In practice it ends up shallow. Specialist agents go deeper.
What is Particle Swarm Optimization doing in a legal AI product?
It decides which specialist agents get listened to. Each agent scores its own confidence, and the final answer is weighted by that score instead of treating every agent equally.
Building multi-agent systems? Let's connect on LinkedIn or check out my other work on GitHub.
