Architecture
System Overview
User → Next.js Frontend → FastAPI Backend
├── Document Ingestion (extract, chunk, embed)
├── ChromaDB Vector Store
├── Hybrid Retrieval (vector + BM25)
└── Tribunal Pipeline
├── Witness (grounded answer)
├── Claim Extraction
├── Prosecutor (objections)
├── Judge (verdicts)
└── Final RulingRetrieval Pipeline
Questions are embedded and matched against document chunks using semantic vector search. Hybrid mode combines vector similarity with BM25 keyword matching via reciprocal rank fusion for improved recall.
Agent Workflow
- Witness generates an answer from retrieved evidence only.
- Claims are extracted from the Witness answer.
- Prosecutor challenges each claim against evidence.
- Judge assigns verdicts and confidence scores per claim.
- Final Ruling revises unsupported claims out of the answer.
Data Privacy
Documents and chunk metadata are stored locally in ChromaDB and SQLite. By default, embeddings and tribunal LLM calls use OpenAI. For fully local inference, configure Ollama or local embeddings in the API environment—see docs/privacy-and-security.md.
Limitations
- Verdict quality depends on LLM capability and prompt adherence.
- Complex PDF layouts may lose structure during extraction.
- Evaluation metrics are heuristic, not ground-truth legal review.
- No reranking model in MVP (stretch goal).