Iskhak AsanovOpen to roles

aqlex: AI legal platform for Kyrgyzstan

A legal database and AI assistant for notaries, lawyers and compliance teams: 422K+ laws and court decisions, hybrid search, answers that cite specific articles, and AI review of client documents.

The problem

Legal professionals in Kyrgyzstan work with Russian and Kyrgyz texts spread across several official portals, with every historical edition of every act. Generic AI chatbots answer confidently and invent articles that don’t exist.

What I built

The first job was to put the law in one place. Scrapers harvested 422,644 documents from six official sources into one S3 bucket: the central legal database with every historical edition, 211,637 court decisions, Cabinet and presidential acts, and Supreme and Constitutional Court rulings. Document keys are disjoint by construction, so several machines write in parallel without coordination.

On top of the corpus:

  • A citation graph of 235,000+ links between legal acts, with imports that are safe to replay in any order.
  • Hybrid search: BM25 in OpenSearch plus dense vectors in Qdrant (Voyage embeddings). Each document is written to OpenSearch first and then Qdrant; if Qdrant fails, the OpenSearch entry is removed, so the two indexes never disagree.
  • Cited answers on the Claude API that point to specific articles, plus version history and side-by-side comparison of legal editions.
  • Document review. Users upload a contract, letter or claim as PDF/DOCX. The system finds every reference to Kyrgyz law, checks deterministically whether the act is in force and whether the article exists, then uses Claude to check whether each claim matches the law, with a second model re-checking every mismatch.
  • Production on our own servers in Kyrgyzstan, with passkey login and local payments.

The incident that shaped it

Early on, users received answers with claims about legal articles that were unconfirmed or missing from the actual law. For lawyers and notaries that is serious: our credibility dropped and retention fell.

We rebuilt the pipeline so every claim is checked against the source text, with a second model re-checking every mismatch. Retention recovered. That is why I now believe the definition of “correct” for an AI product must stay in-house.

How we know search is getting better

A retrieval change ships when the gold set says it’s better, not when a demo looks good. The gold set has 300+ queries broken down by user type (lawyer, HR, accountant, citizen), language and query type, with recall@10, MRR and nDCG tracked for every ranking change. Recall@10 is 0.84 for Russian queries and 0.98 for topical ones, and the weak spots (citation-style and “what changed” queries) are visible instead of hidden.

What I’d do differently

Language was assumed instead of modelled. The index was built Russian-first, with language baked into chunk IDs and a Russian analyzer, so the 211,637 court decisions that exist only in Kyrgyz are not yet searchable. The fix isn’t a flag; it needs language as a first-class field with its own analyzer. Next time I’d model language from day one.