Open-Source-Legal/OpenContracts
The open document intelligence platform for builders and hackers - DMS for the agentic world
What it solves
OpenContracts provides a programmable citation graph for document repositories. It solves the problem of documents being stored as isolated files (leaves) rather than connected nodes, which often leads to AI agents hallucinating references or failing to resolve citations. By creating a structured substrate of citations and human-verified annotations, it allows teams to navigate complex document webs—such as legal archives, research libraries, or internal policies—with high precision.
How it works
The system transforms a corpus of documents into a navigable graph where documents are nodes and citations are edges. It uses a modular pipeline for parsing, embedding, and thumbnailing, and supports a pluggable architecture for custom components.
Key technical surfaces include:
- AI Agents: Python-based agents that reason over the citation graph and provide grounded, cited answers.
- MCP Server: A Model Context Protocol server that allows AI tools like Claude or Cursor to search the corpus and walk citation edges without custom glue code.
- Structured Extraction: A system to run natural-language queries across hundreds of documents using Celery workers to populate a spreadsheet-style grid for human review.
- API Layer: A typed GraphQL and REST API that powers the React UI and external applications.
Who it’s for
- Legal and Research Teams: Those managing large archives of statutes, court opinions, or contracts that require precise cross-referencing.
- Developers: Those building AI-powered document intelligence tools that need a grounded substrate for agents.
- Knowledge Managers: Teams maintaining internal policy bases or engineering knowledge bases where relationships between documents are critical.
Highlights
- Human-in-the-Loop: Treats human annotation as the ground truth, allowing AI to build upon verified data rather than replacing it.
- MCP Integration: Native support for the Model Context Protocol for seamless agentic access.
- Version-Controlled Corpuses: Supports forking, branching, and history tracking for document collections (similar to git).
- Layout-Faithful Annotation: Precise text-to-coordinate mapping for PDFs to ensure annotations remain accurate to the original layout.
- Multimodal Search: Combines vector embeddings and full-text search across documents and annotations.