A production-ready legal AI assistant with intelligent document analysis, multi-agent orchestration, clause risk detection, and hybrid search capabilities.
- β Legal Research - Hybrid search (FAISS + BM25) with 1,200+ contract clauses
- β Document Drafting - AI-powered contract generation with streaming responses
- β Compliance Checking - GDPR/CCPA and jurisdiction-aware analysis
- β Clause Analysis - 4-tier risk scoring (low/medium/high/critical)
- β Risk Visualization - Interactive D3.js heatmap for clause-level risks
- β Document Upload - PDF processing and analysis
- β Streaming Responses - Real-time word-by-word generation
- π Summarization Agent - Extract headnotes, ratio decidendi, obiter dicta
- π― Precedent Reasoning Agent - Cross-case alignment, outdated precedent detection
- π Knowledge Graph Builder - Auto-builds graph of precedents and statutes
- π Redlining & Comparison Agent - ML-based clause alignment, risk-focused changes
- βοΈ Clause Generation Agent - Detect missing clauses, generate standard clauses
- π Regulatory Monitoring Agent - Track regulations, flag new requirements
- π² Monte Carlo Risk Agent - What-if scenario simulations
- π Multi-Agent Orchestration - LangGraph for complex workflows with state management
- π FAISS Vector Store - Semantic search with sentence transformers
- π― Hybrid Retrieval - Combines semantic (FAISS) + keyword (BM25) search
- π Real Legal Data - 1,200+ contract clauses from CUAD dataset
- βοΈ Jurisdiction-Aware - US, EU, UK legal rules
- π Cross-Consistency Checking - Multiple agents validate same clause
- π Graph-Based Workflows - LangGraph orchestration with conditional routing
Overall Completion: ~95% of core features
- β 16 Major Features Fully Implemented
β οΈ 5 Features Partially Implemented- β 4 Features Not Yet Implemented
See FEATURE_COMPARISON.md for detailed status.
For Docker:
- Docker Desktop installed and running
- At least 8GB RAM
- ~15GB free disk space
For Local Development:
- Python 3.11+ installed
- Node.js 18+ installed
- Ollama installed and running locally
Option 1: Docker (Recommended)
# Start Backend with Docker
docker-backend.bat
# Start Frontend with Docker (in another terminal)
docker-frontend.batOption 2: Local Development
# Start Backend locally
backend.bat
# Start Frontend locally (in another terminal)
frontend.bat- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
For detailed instructions, see QUICK_START.md.
LegisAI/
βββ backend/
β βββ main.py # FastAPI application (47 endpoints)
β βββ requirements.txt # Python dependencies
β βββ services/ # 14 AI agent services
β β βββ vector_store.py # FAISS integration
β β βββ hybrid_retriever.py # BM25 + FAISS
β β βββ clause_analyzer.py # Risk detection
β β βββ summarization_agent.py
β β βββ precedent_reasoning_agent.py
β β βββ knowledge_graph_builder.py
β β βββ redlining_comparison_agent.py
β β βββ clause_generation_agent.py
β β βββ regulatory_monitoring_agent.py
β β βββ monte_carlo_risk_agent.py
β β βββ langgraph_orchestrator.py # LangGraph workflows
β β βββ courtlistener_api.py
β βββ data/ # Vector store data
β βββ uploads/ # User uploads
βββ frontend/
β βββ src/
β β βββ pages/ # React pages
β β βββ components/ # UI components
β β βββ utils/ # Utilities
β βββ package.json
βββ backend.bat # Start backend locally
βββ docker-backend.bat # Start backend with Docker
βββ frontend.bat # Start frontend locally
βββ docker-frontend.bat # Start frontend with Docker
βββ docker-compose.yml # Full stack Docker setup
Windows Batch Files:
backend.bat- Start backend locallydocker-backend.bat- Start backend with Dockerfrontend.bat- Start frontend locallydocker-frontend.bat- Start frontend with Docker
Usage:
# Docker (Recommended)
docker-backend.bat # Terminal 1
docker-frontend.bat # Terminal 2
# Local Development
backend.bat # Terminal 1
frontend.bat # Terminal 2Full interactive API docs available at http://localhost:8000/docs when backend is running.
Research & Retrieval:
POST /api/research- Legal research with hybrid searchPOST /api/summarize/headnotes- Extract case headnotesPOST /api/summarize/ratio-decidendi- Extract legal reasoningPOST /api/precedent/align- Find supporting/weakening casesPOST /api/knowledge-graph/build- Build knowledge graph
Drafting & Contract Intelligence:
POST /api/draft- Generate legal documentsPOST /api/clauses/analyze- Clause risk analysisPOST /api/redlining/align- Compare two contractsPOST /api/clauses/generate- Generate missing clausesPOST /api/clauses/detect-missing- Detect missing standard clauses
Compliance & Risk:
POST /api/compliance/check- Compliance analysisPOST /api/regulatory/crawl- Monitor regulationsPOST /api/risk/monte-carlo- Risk scenario simulations
Orchestration:
POST /api/langgraph/comprehensive-analysis- Multi-agent comprehensive workflowPOST /api/langgraph/cross-consistency-check- Consistency validation workflowPOST /api/langgraph/research-and-draft- Research β draft β review workflowGET /api/langgraph/status- Orchestrator status
Document Management:
POST /api/upload- Upload documentsGET /api/analyze/{file_id}- Analyze uploaded document
- CUAD Dataset - 1,200+ contract clauses imported and indexed
- Vector Store - 1,267+ total documents (FAISS + BM25 indexed)
- CourtListener API - Real-time case law search (optional, requires API key)
- Regulations - GDPR, CCPA, US Code sections
Create backend/.env:
# Ollama Configuration
OLLAMA_HOST=http://ollama:11434 # Docker
# OLLAMA_HOST=http://127.0.0.1:11434 # Local
# CourtListener API (optional)
COURTLISTENER_API_TOKEN=your_api_token_here
# Application
PORT=8000
ENVIRONMENT=production# Start services
docker compose up -d
# View logs
docker compose logs -f
# Stop services
docker compose down
# Check status
docker compose ps- README.md - This file (main documentation)
- FEATURE_COMPARISON.md - Complete feature status and project progress
- QUICK_START.md - Quick setup guide
- CONTRIBUTING.md - Contribution guidelines
- COMPLEXITY_ANALYSIS.md - Code complexity metrics
- HOW_ORCHESTRATION_WORKS.md - Multi-agent orchestration guide
- LANGGRAPH_IMPLEMENTATION.md - LangGraph setup guide
- HOW_ORCHESTRATION_WORKS.md - Multi-agent orchestration guide
- Framework: FastAPI (Python)
- LLM: Ollama (local LLM hosting)
- Vector Store: FAISS (semantic search)
- Search: Hybrid (FAISS + BM25)
- Orchestration: LangGraph (graph-based workflows)
- API: RESTful with 47 endpoints
- Framework: React + TypeScript
- Build Tool: Vite
- Styling: TailwindCSS
- Visualization: D3.js (risk heatmap)
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
See CONTRIBUTING.md for details.
MIT License - See LICENSE file for details
For issues or questions:
- Create an issue on GitHub
- Check the documentation
- Review QUICK_START.md for troubleshooting
- Ollama for local LLM hosting
- FAISS for vector search
- LangGraph for multi-agent orchestration
- FastAPI for the backend framework
- React + Vite for the frontend
Built with β€οΈ for the legal community
Version: 4.0.0
Status: Production Ready (95% Complete)