A production-quality, self-hosted, and 100% offline RAG (Retrieval-Augmented Generation) assistant designed specifically for law firms and corporate legal departments.
AegisAI ensures absolute confidentiality: all client case files, documents, evidence, schedules, and credentials remain entirely on local hardware, protected by state-of-the-art offline security layers.
Recently completely overhauled for maximum performance, zero regression, and a stunning glassmorphic UI. ⚡
- ⚡ Hyper-Optimized Performance Engine: Deep multi-threaded OCR, SQLAlchemy DB index tracking, and backend JSON response GZIP compression for lightning-fast speeds.
- 🔒 Zero-Internet Confidentiality: Works 100% offline. Bypasses external API and download dependencies via a built-in pre-bundled model and a custom offline embedding function.
- 📡 eCourts API Sync & Local Data Locking: Automatically syncs hearings, benches, and details from the official eCourts platform via Case Registration Number (CNR). Data is locked locally.
- 🛡️ Multi-User RBAC & 2FA/MFA: Dynamic role-based access control (
Admin,Lawyer,Auditor) with integrated two-factor authentication via PyOTP. - 🚨 Panic Button (Secure Workspace Wipe): Instantly scrubs active database records, deletes the local vector store, and generates a sealed AES-256 recovery archive.
- 💬 Citation-Aware Legal RAG Chat: Local AI model answers queries grounded directly on uploaded case files (PDF/TXT), providing exact page-by-page references.
- 📊 Dynamic Billing & GST Invoices: Track hours logged per matter, define billable rates, and generate formal GST-compliant PDF/HTML invoices.
graph TD
User([User]) -->|Interact| Electron[Electron Desktop Window]
Electron -->|Render Static| React[Next.js React Frontend: Port 3000]
React -->|HTTP / JSON / JWT| FastAPI[FastAPI Backend Server: Port 8000]
FastAPI -->|Auth / Logs / Metadata| SQLite[(Local SQLite Database)]
FastAPI -->|Dynamic AES-256 Encryption| EncryptedFS[Encrypted Local Storage]
subgraph Offline Ingestion & Embedding Pipeline
FastAPI -->|Text Extraction| Extractor[PDF/TXT Processor]
Extractor -->|Local Deterministic Split| Chunker[Recursive Chunker]
Chunker -->|Offline Hashing Embedder| Chroma[(Local Chroma Vector DB)]
end
subgraph Local Inference Orchestration
FastAPI -->|Semantic Context| RAG[RAG Orchestrator]
RAG -->|OpenAI-Compatible API / MLX GPU| LMStudio[LM Studio Engine: Port 1234]
RAG -.->|Fallback / Multi-Runtime| Ollama[Ollama Service: Port 11434]
end
- UI Client: Next.js (React 19) + Vanilla CSS premium glassmorphic UI + Electron desktop wrapper
- Backend: FastAPI (Python 3.12+) with GZIP payload compression
- Database: SQLite (SQLAlchemy ORM)
- Vector Database: ChromaDB (configured for persistent local filesystem mode)
- Primary Inference Engine: LM Studio (
qwen2.5-coder-14b-instruct-mlx,qwen3-14b-mlx, etc.) via OpenAI-compatible endpoints (/v1/chat/completions) with Apple Silicon MLX GPU acceleration and token streaming - Fallback Inference Engine: Ollama (
deepseek-r1:8b,llama3.2:3b,qwen2.5-coder:3b, etc.) - Security & Encryption: PyJWT + PyOTP + bcrypt + cryptography (AES-256 Fernet ciphers)
AegisAI includes fully automated, self-bootstrapping startup scripts for both Windows and macOS.
git clone https://github.com/Coderaryanyadav/AegisAI.git
cd AegisAI- macOS / Linux:
chmod +x start.sh ./start.sh
- Windows: Double-click
start.bator run in Command Prompt:start.bat
Note
The scripts will automatically verify Python 3, create a virtual environment
(venv), install backend requirements, compile aegis_frontend/node_modules,
spin up the FastAPI server, and launch the Next.js frontend on
http://localhost:3000.
AegisAI includes an ultra-thorough, 36-step end-to-end API integration validation suite covering user signup, 2FA generation, data locking, encrypted file vault ops, RAG Q&A, and panic wipes.
To run the integration verification test suite:
- Ensure the FastAPI backend is running.
- Execute the test runner:
PYTHONPATH=. ./venv/bin/python tests/ultra_hardcore_test.pyBuilt with 🖤 for absolute legal confidentiality.