ReguDrift AI is an institutional-grade, asynchronous compliance auditing platform. It is engineered to ingest complex internal organizational policy documents, index their logical clauses semantically, and perform high-fidelity, agent-in-the-loop audits against incoming regulatory directives and bulletins (such as SEBI, SEC, GDPR, or SOC2).
The system automates the detection of compliance gaps, calculates drift indices, maps severities, and delivers interactive technical remediation blueprints (as Infrastructure-as-Code or application-level patch scripts) along with boardroom-ready compliance dossiers.
- Multi-Tier Service Orchestration: Fully containerized microservices architecture.
- Asynchronous Policy Chunker & Ingestion: Async parser that processes PDF/TXT documents, segments them into logical hierarchies (Chapters, Sections, Clauses), hashes each clause deterministically (SHA-256) to prevent deduplication, and generates 3072-dimensional vector embeddings.
- Agentic Planner-Executor Audit Loop: An LLM-powered state machine (
PlanCreation->ContextRetrieval->GapAnalysis->FinalReport) that reasons about compliance alignment, maps specific deviations, and outlines remediation paths. - Git CI/CD Integration ("The Commit Blamer"): Attaches Git commit tracking metadata (
commit_hash,author_name,commit_timestamp,branch_name) directly to compliance runs and specific drift remediation blocks, providing instant traceability for infrastructure-as-code audits. - Historical Trend Analytics Service: Aggregates compliance run histories chronologically by date. Dynamically calculates a
global_health_score(100% baseline, deducting 15% perCRITICAL, 10% perHIGH, 5% perMEDIUM, and 2% perLOWseverity drift) and trackstotal_critical_drifts. - Role-Based Access Control (RBAC) System: Enforces endpoint access verification using HTTP headers (
X-User-Role) or query params (role):Auditor: Read-only access to health endpoints and the historical compliance analytics feed.SecOps_Admin: Full write access allowing policy ingestion, audits, database resets, and connection updates.
- Immersive Bento HUD Dark Mode: A modern, high-density Bento Grid dashboard in deep space dark mode featuring:
- Floating Glass Header: Hosts navigation tabs, live health connections, and the RBAC role switcher.
- Sonar Radar Scanner: Dynamic rotating circular SVG scanning animation showing active audit progress.
- Interactive Git Graph: Clickable vertical SVG commit graph that dynamically blame-traces commits and updates dashboard compliance metrics.
- Comparative Diff Inspector: Side-by-side color-coded policy alignments highlighting exact drift lines and Git metadata context tags.
- Cloud Shell Terminal: Monospace console replica (Terraform/Python) supporting boardroom PDF downloads.
ReguDrift AI is deployed in a fully production-hardened network environment on Google Cloud:
- Production Frontend Console (Next.js): https://regudrift-console-567903226702.asia-south1.run.app
- Production REST API Gateway (FastAPI): https://regudrift-web-567903226702.asia-south1.run.app
- Compute Instance (Qdrant DB): An
e2-mediumContainer-Optimized OS VM running in private subnet10.0.1.0/24, with a 30GB Persistent SSD storage mount. - Cloud SQL (PostgreSQL): PostgreSQL 15
db-f1-microdatabase instance with private-IP VPC Peering. - Serverless VPC Access: Serverless Connector
regu-vpc-conn(10.8.0.0/28) routes Cloud Run traffic privately into the VPC. - Cloud NAT Gateway: Connects the private VM subnet to
regudrift-routerandregudrift-natto allow outbound Docker Hub pulls securely. - Secrets Store:
GEMINI_API_KEYis securely injected into FastAPI containers directly from Secret Manager at runtime.
To trigger automated rolling updates to Google Cloud Run, push commits directly to the GitHub main branch. Google Cloud Build (cloudbuild.yaml) automatically runs:
- Compiles backend and frontend docker containers.
- Pushes compiled images to Artifact Registry.
- Executes rolling updates (
gcloud run deploy) for both target services.
graph TD
A[User Web Client] -->|Port 443| B(Next.js 14 Bento Grid Frontend)
B -->|REST / CORS| D(FastAPI Gateway API)
D -->|Semantic Retrieval| E(Qdrant Vector DB on GCE VM)
D -->|CRUD / Runs logs| F(Cloud SQL PostgreSQL DB)
D -->|Async Embeddings / JSON Schemas| G(Google Gemini AI Engine)
d:\Problem Project\
βββ DESIGN.md # Visual system design tokens source of truth
βββ requirements.txt # Pinned backend dependencies
βββ Dockerfile # Multi-stage secure FastAPI container build
βββ cloudbuild.yaml # Google Cloud Build CI/CD script
βββ terraform/ # Terraform provision scripts (optional reference)
β βββ provider.tf
β βββ variables.tf
β βββ vpc.tf
β βββ database.tf
β βββ qdrant_vm.tf
β βββ cloud_run.tf
βββ regudrift/
β βββ config/
β β βββ settings.py # Pydantic Settings & environment variables
β βββ core/
β βββ agent/
β β βββ schemas.py # Structured Output Pydantic schemas
β β βββ orchestrator.py # Planner-Executor agentic state machine
β βββ database/
β β βββ session.py # Async SQLAlchemy PostgreSQL/SQLite database engine
β β βββ models.py # Declarative ORM models (Runs, Gaps, Documents)
β β βββ service.py # Async database transactions manager
β βββ ingestion/
β β βββ parser.py # Async PDF/TXT document parser and sliding chunker
β βββ retrieval/
β β βββ embedder.py # Batch embedder using google-genai SDK
β βββ vector/
β βββ base.py # Vector database abstraction definition
β βββ qdrant_service.py # Async Qdrant integration
βββ frontend/
βββ package.json # Next.js configurations & scripts
βββ tailwind.config.ts # Tailwind parameters mapping colors
βββ Dockerfile # Multi-stage Node.js alpine build configuration
βββ src/
βββ app/
β βββ layout.tsx # App wrapper with custom fonts (Inter, JetBrains Mono)
β βββ page.tsx # Bento Grid dashboard, Git Graph, and Radar Scanner
βββ components/
β βββ Sidebar.tsx # Floating glass top header bar component
β βββ MetricCards.tsx # Bento metric cards and sparkline trend component
β βββ Remediation.tsx # Obsidian Cloud Shell monospace terminal console
βββ lib/
βββ api.ts # Axios network client bridge
- Endpoint:
POST /api/v1/compliance/ingest - Content-Type:
multipart/form-data - Headers:
X-User-Role: SecOps_Admin(Required) - Fields:
document_id(string): Unique identifier for the policy.file(file): Uploaded PDF or TXT file.
- Description: Parses the uploaded policy into semantic chunks, generates vector embeddings, indexes them into Qdrant, and creates a relational entry.
- Endpoint:
POST /api/v1/compliance/analyze - Content-Type:
application/json - Headers:
X-User-Role: SecOps_Admin(Required) - Payload:
{ "update_text": "Regulatory directive bulletin text...", "commit_hash": "a1b2c3d4", "author_name": "Dev DevOps", "commit_timestamp": "2026-07-17T12:00:00Z", "branch_name": "release/v1.1" } - Description: Triggers the Planner-Executor agentic state machine. Performs semantic lookup, conducts comparative alignment analysis, writes the audit output, and returns a detailed compliance gap report with Git blamer tags.
- Endpoint:
GET /api/v1/analytics/compliance-history - Headers:
X-User-Role: AuditororSecOps_Admin(Required) - Description: Aggregates compliance runs chronologically by date tracking global health scores, critical drifts, and timestamps.
- Endpoint:
GET /health - Description: Performs automated connection checks. Returns
{ "status": "healthy" }if all internal adapters are healthy.
The application uses custom dark-mode Bento HUD style tokens configured directly in Tailwind:
- Base Canvas: Midnight Deep Space (
#030712) - Surfaces: Obsidian Graphite Glass (
#090F1C) - Outlines: Slate Blue outlines (
#1E293B) - Accents: Cyber Cyan (
#00F0FF), Glowing Violet (#8B5CF6), Hot Magenta (#F43F5E), and Emerald (#10B981).
When leveraging structured outputs, Pydantic's automatic nested serialization includes $defs, $ref, and "title" keys in its generated JSON schema. The Google GenAI Python SDK (types.Schema) fails when encountering these keys, throwing schema validation exceptions.
ReguDrift AI solves this by introducing recursive schema preprocessing in the orchestrator before sending payloads to the model:
- Reference Inlining: Resolves all
$reflinks and inlines nested definitions usinginline_refs(). - Key Sanitization: Recursively traverses the schema dictionary to prune all
"title"keys usingclean_schema_for_gemini(). This outputs a completely flat, valid JSON schema structure matching the exact constraints of the Gemini engine.