CogniVerdict is an advanced legal intelligence and analytics platform designed to analyze complex case documents, perform entity-relationship mapping on a knowledge graph, detect contradictions and biases, and dynamically compute prosecution strength and case-agnostic conviction probabilities.
The platform provides a complete end-to-end pipeline—from raw case text ingestion to interactive graph visualization, conversational legal advisory, expert feedback calibration, and automated benchmarking against ground-truth legal metrics.
Below is the conceptual flow of the CogniVerdict pipeline:
- Document Chunking: Raw case documents (PDFs, text files, JSON dossiers) are uploaded and segmented into semantic chunks.
- Entity & Relation Extraction: CogniVerdict calls the Cognee Cloud REST API to extract nodes (suspects, victims, witnesses, physical evidence, digital logs) and construct directed edges representing legal relationships.
- UUID to Name Resolution: Because graph databases internally identify nodes by database UUIDs, CogniVerdict features a translation layer that dynamically maps UUIDs to human-readable names before feeding relationship contexts to the LLMs. This prevents ID leaks and keeps testimonies readable.
- Case Selection: A centralized interface where legal analysts can select from active cases (e.g.,
CASE_001throughCASE_011). - Dynamic Legal Briefs: Generates three levels of summaries using the NVIDIA LLM API:
- Quick Summary: A concise 150-word overview of the case.
- Standard Brief: A structured 400-word brief highlighting key parties and timelines.
- Detailed Brief: A comprehensive 1000-word analysis with deep breakdowns of evidence, motives, and contradictions.
- Interactive Graph Visualizer: A custom D3.js force-directed mindmap showing nodes and relationships directly from Cognee Cloud.
CogniVerdict implements a parallelized multi-agent reasoning architecture that evaluates case facts and graph topologies:
- Parallel LLM Orchestration: Runs contradiction analysis, motive extraction, and witness bias detection concurrently using Python's
asyncio.gatherpipeline. This architecture reduces processing latency from ~45 seconds to under 15 seconds, preventing cloud load-balancer and gateway timeouts. - Explainable Evidence Mapping: Links raw vector chunks back to the original documents (e.g.
WS-005.json). When the dashboard displays motive or timeline contradictions, investigators can click to view the actual source text, eliminating opaque "chunk index" references. - Core Reasoning Agents:
- Contradiction Detection: Cross-references timelines, statement changes, and physical logs (e.g. CCTV vs testimony) to flag logical inconsistencies.
- Motive Detection: Deduces driving incentives, emotional drivers, and revenge indicators for each key subject.
- Bias & Credibility Extraction: Detects witness self-interests, coercion flags, and familial relations.
- Contextual QA: Allows users to chat with an AI legal assistant regarding the facts of the active case.
- Semantic Retrieval: Merges graph entities and relationships with chunk-retrieval vectors to build an augmented LLM context, ensuring answers are grounded directly in the case files.
- Calibrating the Engine: Since LLMs can misinterpret legal nuances, the Feedback Panel allows senior human attorneys to override automatic scores and entities.
- Adjustable Parameters:
- Add/modify suspect names.
- Adjust witness consistency scores (e.g., overriding a witness from
lowtohighcredibility). - Add custom evidence weights.
- Correct contradiction or motive annotations.
- Real-Time Recalculation: Adjustments submitted to the panel instantly trigger a recalculation in the scoring pipeline, immediately updating conviction probabilities on the dashboard.
CogniVerdict uses a deterministic scoring engine that processes the LLM-extracted legal signals combined with human feedback.
- Witness Credibility: Computes a score based on statement consistency, independence (deducting penalties for biases like familial relations, bribery, or coercion), and any expert overrides.
- Prosecution Strength: Calculates a weighted score of all incriminating evidence (factoring in admissibility and witness credibility).
- Conviction Probability: Combines prosecution strength with suspect-specific motives and overall case contradictions to produce a final conviction likelihood percentage.
To prevent the engine from overfitting to specific cases, CogniVerdict features a continuous evaluation suite that measures performance across multiple test dossiers.
- Ingest the Case:
- Locate or download the target case folder (e.g.,
CASE_010) from the GitHub repository'scasesdirectory. - Open the upload interface in the platform, and upload all documents located under the
documents/folder of that specific case. - Crucial: Adhere strictly to the naming convention. When uploading, specify the case name to exactly match the case ID (e.g., name it
case_010orCASE_010).
- Locate or download the target case folder (e.g.,
- Run the Benchmark:
- Wait for the upload and Cognee ingestion processing to finish (status shows
COMPLETED). - Go to the Benchmarking Panel on the UI.
- Select the case name (e.g.,
CASE_010) from the benchmarking dropdown list. - Click Run Case Benchmark to execute the continuous evaluation and generate performance metrics.
- Wait for the upload and Cognee ingestion processing to finish (status shows
- Evaluation Metrics:
- Suspect Accuracy: Validates if the correct suspect is identified.
- Retrieval Recall@k: Measures the percentage of ground-truth case facts present in retrieved chunks.
- Contradiction F1: Compares LLM-detected contradictions against ground-truth contradictions.
- Witness Accuracy: Validates correct witness identification.
- Conviction MAE (Mean Absolute Error): Measures the drift (in percentage points) between the calculated conviction probability and the actual bench-marked verdict. Target accuracy is < 10.0pp MAE.
CogniVerdict uses Cognee Cloud as its primary long-term memory layer, calling its endpoints to ingest case files, retrieve factual context, refine graph structures, and prune invalid statements.
remember()(via/api/v1/remember):- Purpose: Ingests case documents (dossiers, logs, witness statements) and builds the initial knowledge graph memory.
- Integration: Triggered when a new case is uploaded (
POST /api/v1/cases/upload). Cognee chunk-analyzes the text, extracts key legal entities, and maps their relationships.
recall()(via/api/v1/recall):- Purpose: Performs semantic, vector-based, and graph-completion searches against ingested cases.
- Integration:
- Powering the Advisory Chat (
POST /api/v1/cases/{id}/chat) to query specific files for context. - Retrieving relevant document chunks inside the Reasoning Pipeline to generate case signals, contradictions, and detailed summaries.
- Powering the Advisory Chat (
improve()(via/api/v1/improve):- Purpose: Triggers a post-ingestion enrichment pipeline (Memify) to optimize, cluster, and restructure the graph database's memory representation.
- Integration:
- Exposed via the backend endpoint
POST /api/v1/cases/{id}/improve. - Automatically triggered when expert feedback is submitted to the Feedback Panel (
POST /api/v1/cases/{id}/feedback), restructuring the case graph memory to align with corrected entities and relationships.
- Exposed via the backend endpoint
forget()(via/api/v1/forget):- Purpose: Deletes/prunes specific entities, document chunks, or the entire dataset from the graph database.
- Integration:
- Exposed via the backend endpoint
POST /api/v1/cases/{id}/forgetto wipe case memory. - Used during expert corrections inside the Feedback Panel to prune discredited evidence nodes and invalid witness statements from the case graph memory (
memory_only=True).
- Exposed via the backend endpoint
- Backend: Python 3.10+, FastAPI, Uvicorn, httpx, Pytest
- Frontend: Next.js 14, React 18, TypeScript, Tailwind CSS, Lucide Icons, D3.js
- Services: Cognee Cloud (Graph and Vector DB), NVIDIA NIM API (
meta/llama-3.1-70b-instruct), Local Ollama (fallback)
- Navigate to the
backend/directory:cd backend - Copy the environment variables template and fill out your API credentials:
Make sure to configure your
cp .env.example .env
COGNEE_API_KEY,COGNEE_API_URL, andNVIDIA_API_KEY. - Install dependencies:
pip install -r requirements.txt
- Start the backend dev server:
python3 run.py
- Navigate to the
congnegal/directory:cd congnegal - Install npm packages:
npm install
- Run the development server:
npm run dev
- Open http://localhost:3000 in your browser to view the platform.
To run the automated legal benchmarks locally and print metrics/logs in real-time, execute:
python3 backend/test_benchmarking.py
