← All case studies
AI Document & Knowledge Tools

LegalMaiA AI-powered legal drafting for the Indian legal market

A guided AI drafting copilot that turns a lawyer's plain-language case description into filing-ready Indian petitions grounded in the 2023 codes.

https://legalmaya-frontend-production-6704.up.railway.app/Open live ↗

The context

Indian litigators spend hours converting a client's story into correctly structured, registry-compliant drafts: choosing the right filing, citing the right sections under the brand-new BNS, BNSS, and BSA codes of 2023, and writing prayers and facts in the exact court-accepted format. Generic AI tools make this worse, hallucinating case types and leaning on the repealed IPC, CrPC, and Indian Evidence Act, which makes their output unsafe to file. LegalMaiA was built specifically for the Indian legal market to close that gap: a drafting copilot for litigation and pre-litigation work that keeps the advocate firmly in control while doing the structural heavy lifting.

The problem, precisely

·

Generic AI cites repealed law. Off-the-shelf tools draft against the old IPC, CrPC, and Indian Evidence Act, which have been replaced by the 2023 BNS, BNSS, and BSA codes. Drafts built on repealed statutes are unsafe to take to a registry.

·

Hallucinated filings break at the registry. Open-ended models invent petition types and section numbers. A draft that names a filing that does not exist, or maps it to the wrong forum, fails before it is ever heard.

·

Structure and format are unforgiving. Court captions, party lexicons, prayers, brief facts, and verification clauses each follow a precise registry-aware format. Getting any of these structurally wrong means rework and delay.

·

First drafts are slow and skill-bound. Turning a paragraph of facts into a correctly bundled, correctly cited first draft is time-consuming senior-advocate work, leaving juniors and solo practitioners without a reliable starting point.

What we built ✓ verified in code

A guided 9-step petition builder

A Next.js 'Digital Chamber' frontend walks the lawyer from synopsis through intake questions, document checklist, case-type selection, section mapping, bundling strategy, prayer drafting, and final export, with auto-save and the ability to resume an abandoned draft.

A catalogue-constrained AI drafting pipeline

A Django and Azure OpenAI backend orchestrates seven specialised generation stages, each with its own hand-tuned prompt, strict JSON output schema, and hard rules. Every suggested filing must come from a fixed Indian petition catalogue (roughly 199 to 216 templates) backed by real template data in the database, so the model cannot invent case types.

Post-2023 jurisdiction logic

Section mapping is built around the BNS, BNSS, and BSA codes of 2023 plus the CPC and a broad set of special statutes (HMA, CPA 2019, RERA, IBC, NI Act, Arbitration Act, and more), with the legacy IPC, CrPC, and Indian Evidence Act explicitly forbidden and a likely forum returned for each suggested filing.

Legal Notice and Consumer Complaint workflows

The same engine powers a Legal Notice generator with built-in email dispatch to the opposite party, and a Consumer Complaint generator built around the Consumer Protection Act, 2019 and the Consumer Protection Rules, 2020.

In-browser editing and export

Lawyers review and refine prayers and brief facts in a Tiptap rich text editor and export finished drafts to PDF or DOCX client-side, on a legal-document design system using High Court Blue and Merriweather typography.

How it works

  1. 1

    Start from a plain-language synopsis. The lawyer enters a free-text description of the matter plus objectives. Step 1 generates a short set of high-leverage, single-sentence intake questions that a senior advocate would ask, written as client-facing text.

  2. 2

    Build a tailored evidence checklist. From the answers, Step 2 infers the case posture and emits a de-duplicated documents and evidence checklist, flagging each item as critical or not and adding notes on how to obtain it, with special handling for electronic evidence.

  3. 3

    Suggest filings only from a fixed catalogue. Step 3 selects matching filings strictly from the Indian petition catalogue, returning the exact catalogue name, posture, reasons, likely forum, and documents needed, and can honour an 'avoid criminal' preference.

  4. 4

    Map the case to the 2023 codes. Step 4 maps applicable sections across BNS, BNSS, BSA, the CPC, and special statutes, returned in buckets, with a hard rule never to cite repealed law and to add a section only when fully sure of the number, caption, and fit.

  5. 5

    Compare scored bundling strategies. Step 5 proposes exactly three strategy options for bundling the chosen filings into petitions, each scored with computed pressure, speed, and complexity indices, while enforcing that civil and criminal matters are never mixed in one bundle.

  6. 6

    Draft prayers and brief facts, then assemble. Step 6 generates court-ready prayers from each template's verbatim skeleton and party lexicon, and Step 7 writes the numbered Brief Facts narrative. The system assembles the title, court caption, prayer, and verification into a final draft, with up to three AI retries and JSON validation for robustness.

The outcome

LegalMaiA is a drafting copilot purpose-built for post-2023 Indian law that produces structurally correct, registry-aware first drafts in minutes while keeping the advocate in control of every decision. By splitting the work into seven auditable, prompt-engineered stages instead of one open-ended request, it makes outputs reviewable and the pipeline debuggable step by step. Catalogue-constrained generation guards against hallucinated filings, the 2023 BNS/BNSS/BSA framework keeps citations current by construction, and quantified strategy scores help lawyers choose how to file. Resumable drafts, auto-save, ownership-checked records, and one-click PDF and DOCX export round out a platform that lowers the skill floor for a correct first draft without taking the lawyer out of the loop.

The stack ✓ verified in code

Next.js 14 + React 18 Shadcn/UI + Tailwind CSSZustand Tiptap + ZodSupabase

Want this for your business?

We design, build and ship production software and AI for founders — from first wireframe to live.

Book a free strategy call