← All posts

Giving AI assistants a proper knowledge base: an experiment

Most people use AI through a chat app that searches the web when it doesn't know. We tested what changes when it gets one fast, reliable source instead.

Most people use AI the simple way: they open ChatGPT or Claude and ask. When the model doesn’t know something, it searches the web. It opens a dozen pages of mixed quality, stitches together an answer, and presents it with the same confidence whether it found a primary source or a forum thread.

That works better than you’d expect. It’s also slow, and you usually can’t tell where the answer came from. So I wanted to test a simple idea: what if, instead of searching the web, the assistant had one fast tool that returned the exact source? Do the answers get better? Do they get faster? And what does it cost?

We tested it on everyday legal questions in Uzbekistan, a domain where the source matters and where people already ask AI. How much leave do I get? Can my landlord keep the deposit? What’s the fine for this?

99%of graded answers cited the governing article, against 77% with web search alone.
72%fewer web searches and page reads per answer.
2×faster: a median of 143 seconds instead of 297.

What we built

legalise is a connector for ChatGPT, Claude and any other assistant that supports MCP. It holds the Constitution and 19 codes from lex.uz, split into 7,260 articles, in Uzbek and Russian. Ask it something and it returns the exact text of the articles that answer the question, whether each one is in force, when it was last amended, and a link to cite.

The most useful decision came before any code: what not to build. No chat app, no advice on your specific case, no model of our own. People already have an assistant they like, and it already writes good answers. It just doesn’t have the right source in front of it. So the split is simple: the assistant writes the answer, and legalise supplies the law. Users don’t change how they work. They turn on a connector.

Mehnat kodeksi, 217-modda. Har yilgi asosiy eng kam mehnat taʼtilining davomiyligiAct and article
Current text, not amended since adoptionStatus
lex.uz/docs/-6257288#-6263022Link to cite
Har yilgi asosiy eng kam mehnat taʼtilining davomiyligi yigirma bir kalendar kunni tashkil etadi.The law, word for word
Figure 1. One legalise result: Labour Code, article 217. “The minimum annual leave is twenty-one calendar days.”

The test

The easiest way to fool yourself here is to test on the questions your search already handles well. So the test questions came first, and they came from people, not from the system:

  • 120 questions, written the way people actually type them: informal, sometimes misspelled, 40 each in Uzbek Latin, Uzbek Cyrillic and Russian. 96 are everyday questions, 12 rest on a false premise, and 12 are outside what legalise covers.
  • The right article for each question was found by reading the law itself, never by using our own search. Otherwise the answer key would quietly inherit the search’s mistakes.
  • One AI model answered every question twice: once with web search only, and once with web search plus legalise.
  • A different model graded every answer without knowing which version wrote it, and a stronger model re-checked the cases where they disagreed. Out-of-scope questions weren’t graded, and errors lost 6 more, which left 102 questions graded in both versions.

Results

Citations are where the difference is largest. With legalise, all but one graded answer named the governing article by act and number.

Web search only77%

79 of 102 answers

With legalise99%

101 of 102 answers

Figure 2. Answers that cite a governing article by act and number. Each square is 1%. The web-only version wasn’t asked to cite; more on that below.

Both versions were right most of the time, so the more interesting question is what kind of mistakes each one made. With legalise there were fewer wrong answers and fewer incomplete ones.

Web search only
4 wrong · 3 incomplete
With legalise
1 wrong · 2 incomplete
Figure 3. Flawed answers out of 102, after the re-check and one hand regrade (the tax question under Limits).

I want to be careful here, though. 7 flawed answers against 3 sounds like a big difference, but with 102 questions it isn’t statistically significant (p = 0.22). It could be real, and it could be noise. The honest claim is about citations, not correctness.

The result I didn’t expect was cost. With the law one call away, the model stopped searching around: it made far fewer web searches and page reads and finished in half the time.

Web searches and page reads per answer

Web search only
14.2
With legalise
4.0

Median time to answer

Web search only
297 s
With legalise
143 s
Figure 4. What an answer costs, on the 117 questions both versions answered. Fewer tool calls on 103 of them, faster on 90.
Measure Web search only With legalise Question by question
Cites a governing article 79 of 102 101 of 102 22 better, 0 worse · p < 0.001
Correct 95 of 102 99 of 102 5 better, 1 worse · p = 0.22
Web searches and page reads per answer 14.2 4.0 fewer on 103 of 117
Median time to answer 297 s 143 s faster on 90 of 117
Table 1. All the numbers in one place. p-values are exact two-sided sign tests on the questions where the two versions differed.

Limits

This was a first experiment, and it has real holes:

  • The citation comparison isn’t fair. The legalise version was told to cite its sources and the web-only version wasn’t. Some of that 77% vs 99% gap is the instruction, not the data. This is the weakest part of the test, and the first thing to fix.
  • One model, one run. We tested through an API, not inside ChatGPT or Claude, and ran each question once.
  • Our own answer key. We wrote the questions and picked the governing articles ourselves, with an AI model’s help on 28 of them. A lawyer hasn’t checked them yet.
  • Codes lag decrees. In one tax question, a May 2026 decree had already changed the rule. legalise returned the code’s older text, so we graded that answer wrong by hand. Having the official text isn’t the same as having the current rule.

This isn’t really about law

Law was just a convenient test bed. The pattern applies anywhere there’s an official source and a lot of people asking questions about it: tax rules, a product’s documentation, a company’s internal policies, a city’s bus timetable. In all of these the assistant already writes well. What it lacks is the right page, and the web is a slow, noisy way to find it.

My takeaway is that for most people, the next big improvement in their daily AI use won’t come from a smarter model. It’ll come from giving the model they already use a small, fast, trustworthy tool for the thing they ask about most. That’s cheaper to build than a new app, and nobody has to change how they work.

What I’d tell someone building something similar

  • Write the answer key before you build the search, and don’t use the search to write it. It’s slow and boring, and it’s the only reason I trust these numbers at all.
  • Grade blind, with a model from a different family than the one answering. Then the grader has no reason to prefer the answering model’s habits.
  • Report the boring number. The correctness gap was tempting to headline. p = 0.22 says I shouldn’t, so I don’t.
  • Decide what you won’t build. The whole project started as a short written brief, and its most important section was the list of things we wouldn’t do. I wrote more about that way of working in Getting coding agents to build what you meant.

Next up: three runs per question, an answer key checked by a lawyer, and the same test run inside ChatGPT and Claude themselves.

legalise returns articles of Uzbek law with a link to their source. It is not legal advice.