Inspiration

Millions of Nigerians face legal problems every day — an illegal eviction, unpaid wages, a wrongful arrest — but real legal help is expensive, intimidating, and written in English legalese most people never learned to read. Meanwhile, everyone already has WhatsApp.

We wanted to collapse the distance between "my landlord just gave me 7 days to leave" and a formally drafted demand letter citing the actual section of the Lagos Tenancy Law — in the person's own language, in under two minutes. And for the Adaptive version, we asked a second question: what if the system didn't just answer, but got measurably better at reasoning about Nigerian law over time? That's where the Adaption (Adaptive Data) platform came in.

What it does

TheLaaw is a Claude-powered, multi-agent legal-rights assistant for everyday Nigerians, delivered over WhatsApp and the web.

  • Understands your situation in English, Pidgin, Yoruba, Igbo, or Hausa — by text or voice.
  • Researches real Nigerian law via a ChromaDB vector store of statutes (Lagos Tenancy Law 2011, Labour Act, Police Act 2020, ACJA, the 1999 Constitution).
  • Builds a legal argument, honestly rates your position (strong / moderate / weak), and explains it in plain language.
  • Drafts a ready-to-send .docx demand letter or complaint, naming both parties and citing specific sections.
  • Escalates emergencies (violence, arrest, <48h deadlines) with verified legal-aid contacts.

TheLaaw Adaptive adds the Adaption layer on top: an Adaption-optimized statutes knowledge base, a quality-metrics dashboard, a live Enhanced-mode toggle for before/after comparisons, and a data flywheel that turns every conversation into adapted training data. All AI answers and drafted letters follow ASD-STE100 Simplified Technical English rules for maximum clarity.

How we built it

  • Backend: Python + FastAPI, orchestrated with LangGraph as a 2-node graph — a Claude Haiku router that decides which agents run each turn, feeding a pipeline node that executes six agents (intake, escalation, research, reasoning, drafting, editing) in dependency-aware passes, parallelizing escalation + research with asyncio.gather.
  • AI: Claude (Haiku/Sonnet, Opus in production) via LangChain.
  • Knowledge: ChromaDB persistent vector store; Adaption datasets.run optimizes the statute chunks offline before embedding.
  • Channels: Evolution API v2 (WhatsApp) on Fly.io; Next.js 16 + React 19 + Tailwind on the web.
  • Voice: Spitch API for Nigerian-language transcription and synthesis.
  • Docs: python-docx (no system dependencies).
  • Adaptive layer: a fail-open AdaptionClient wrapping the official adaption SDK, per-turn quality metrics persisted to SQLite, and an offline pipeline for KB optimization and fine-tune JSONL export.

Challenges we ran into

  • Speed vs. depth: a naive pipeline re-ran analysis every turn. We fixed it by caching the legal_brief and relevant_statutes in the session so follow-up turns skip research and reasoning entirely.
  • Integrating a data platform, honestly: the Adaption SDK is dataset-centric (datasets.get/list/run), not a per-message rewriter. We resisted forcing a fake real-time endpoint and instead centered the integration on what the API is actually built for — offline KB optimization and a fine-tuning flywheel — with real-time enhancement left as an opt-in, clearly-marked path.
  • Never breaking the baseline: legal advice can't silently fail. Every enhancement is fail-open — no API key or a timeout means the app falls back to original behavior and never invents law.
  • Multilingual + a technical-writing standard: applying ASD-STE100 (an English standard) without flattening Pidgin/Yoruba personality took a deliberate reconciliation — strict STE for English documents, clarity principles carried into local-language chat.
  • Windows + Python 3.14 dependency friction, plus a leading-space SERVER_URL bug that quietly broke document downloads.

Accomplishments that we're proud of

  • A genuinely multi-channel assistant — the same brain answers on WhatsApp and web.
  • Real legal grounding, not vibes: every claim cites an actual statute section.
  • A measurable quality story — a live Enhanced-mode toggle and a /metrics dashboard let us show before/after gains, not just claims.
  • A self-improving flywheel: conversations become adapted training data.
  • Backward-compatible by design — the Adaptive build is a strict superset of the original, so nothing we added can break what already worked.
  • Voice and five Nigerian languages, so literacy and English fluency aren't barriers.

What we learned

  • Centralize the reasoning, not the branches. Letting an LLM router pick agents per turn made the system far more controllable than a fixed pipeline.
  • Match the tool to its real shape. Reading the Adaption docs changed our architecture — the highest-value integration was the one the API was actually designed for.
  • Fail-open is a feature, especially in legal tech. Degrading gracefully beats failing loudly.
  • Caching is a UX feature, not just an optimization — it's the difference between a 15-second wait and an instant reply.
  • Clarity is a design decision. ASD-STE100 and content-hugging chat bubbles both serve the same goal: make the law readable.

What's next for TheLaaw

  • Verify and expand the Adaption integration against the full SDK docs, and run the fine-tuning flywheel end-to-end on real conversations.
  • Grow the statute KB beyond Lagos to all 36 states + FCT, with state-specific tenancy and labour law.
  • Human-in-the-loop escalation — warm handoffs to LACON, NBA Pro Bono, and FIDA partners.
  • Deeper voice across all five languages, for low-literacy users.
  • A pilot with a Nigerian legal-aid NGO to measure real-world outcomes — cases resolved, letters sent, rights upheld.
  • On-device / low-bandwidth mode so the poorest users, on the weakest connections, still get help.

Built With

  • claude
  • fastapi
  • gemini
  • graphlang
  • next
Share this project:

Updates