Skip to content

haragam22/ClauseCraft-AI

Repository files navigation

ClauseCraft AI 🏛️

An AI-powered policy navigator that simplifies complex legal jargon and helps citizens easily understand and apply for government schemes.

ClauseCraft AI is a multi-agent platform designed to democratize legal and civic information. By utilizing advanced Retrieval-Augmented Generation (RAG) and a deterministic validation engine, the system translates dense government policies into easy-to-understand, actionable guidance. It actively assists users by automating eligibility checks and providing step-by-step form-filling support — effectively bridging the gap between complex bureaucratic systems and everyday citizens who need access to these resources.


📌 What It Does

Citizens often struggle to navigate government schemes, legal documents, and policy language written in dense bureaucratic prose. ClauseCraft AI solves this by:

  • Policy Translation — Converts complex legal and government policy text into plain, accessible language anyone can understand.
  • Eligibility Automation — Automatically checks whether a user qualifies for a specific government scheme based on their inputs.
  • Form-Filling Assistance — Provides step-by-step guidance to help users correctly fill out government applications.
  • Multi-Agent RAG Pipeline — Uses a network of specialised AI agents backed by a Retrieval-Augmented Generation engine to deliver accurate, context-aware answers grounded in official documents.
  • Deterministic Validation — A rule-based validation layer ensures that outputs are factually consistent and policy-compliant before being shown to the user.

🛠️ Tech Stack

Layer Technology
Frontend Framework React 19
Language TypeScript 5.8
Build Tool Vite 6
AI / LLM Google Gemini API (@google/genai)
AI Architecture Multi-Agent RAG (Retrieval-Augmented Generation)
Validation Deterministic rule-based validation engine
Markup HTML5
Package Manager npm

🏗️ Architecture

The system follows a multi-agent pipeline where each agent is responsible for a specific stage of the user's query lifecycle.

┌─────────────────────────────────────────────────────────────┐
│                        USER INTERFACE                        │
│                  (React + TypeScript / Vite)                 │
└───────────────────────────┬─────────────────────────────────┘
                            │  User Query
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                     ORCHESTRATOR AGENT                       │
│         Routes query to appropriate specialised agents       │
└──────┬──────────────────────┬──────────────────────┬────────┘
       │                      │                      │
       ▼                      ▼                      ▼
┌─────────────┐    ┌──────────────────┐    ┌──────────────────┐
│   RETRIEVAL  │    │   ELIGIBILITY    │    │   FORM-FILLING   │
│    AGENT     │    │     AGENT        │    │     AGENT        │
│             │    │                  │    │                  │
│ Fetches     │    │ Validates user   │    │ Guides user      │
│ relevant    │    │ criteria against │    │ through required │
│ policy docs │    │ scheme rules     │    │ form steps       │
└──────┬──────┘    └────────┬─────────┘    └────────┬─────────┘
       │                    │                        │
       ▼                    ▼                        ▼
┌─────────────────────────────────────────────────────────────┐
│               GOOGLE GEMINI API (LLM Core)                   │
│         Synthesises retrieved context into plain-            │
│                 language responses                           │
└───────────────────────────┬─────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│             DETERMINISTIC VALIDATION ENGINE                  │
│     Ensures factual accuracy and policy compliance           │
│         before surfacing the response to the user            │
└───────────────────────────┬─────────────────────────────────┘
                            │  Validated Response
                            ▼
                    ┌───────────────┐
                    │     USER      │
                    └───────────────┘

Key Architectural Decisions

  • RAG over fine-tuning — Policy documents change frequently; RAG ensures answers are always grounded in the latest retrieved content without retraining.
  • Multi-agent separation — Isolating retrieval, eligibility checking, and form guidance into distinct agents keeps each concern focused and independently testable.
  • Deterministic validation layer — Sits downstream of the LLM to catch hallucinations and flag any response that contradicts established policy rules before it reaches the user.

🚀 How to Run

Prerequisites

Steps

1. Clone the repository

git clone https://github.com/haragam22/ClauseCraft-AI.git
cd ClauseCraft-AI

2. Install dependencies

npm install

3. Set up environment variables

Create a .env.local file in the project root and add your Gemini API key:

GEMINI_API_KEY=your_gemini_api_key_here

4. Start the development server

npm run dev

The app will be available at http://localhost:5173 by default.

Other Useful Commands

Command Description
npm run dev Start development server with hot reload
npm run build Build for production
npm run preview Preview the production build locally

📁 Project Structure

ClauseCraft-AI/
├── components/          # Reusable React UI components
├── services/            # Agent logic, API calls, RAG pipeline
├── App.tsx              # Root application component
├── index.tsx            # Application entry point
├── index.html           # HTML shell
├── types.ts             # Shared TypeScript type definitions
├── vite.config.ts       # Vite build configuration
├── tsconfig.json        # TypeScript compiler configuration
└── package.json         # Project dependencies and scripts

📄 License

This project is private. All rights reserved.


Built with ❤️ to make governance accessible to everyone.

About

This is a legal contract analyser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors