Open-Source-Legal/OpenContracts

The open document intelligence platform for builders and hackers - DMS for the agentic world

What it solves

OpenContracts provides a structured substrate for document intelligence, moving beyond simple file storage to create a programmable citation graph. It solves the problem of "leaf" documents (like PDFs) that lack connections to other documents, statutes, or precedents, which often leads AI agents to hallucinate edges or fail when encountering unresolved references.

How it works

The system transforms a repository of documents into a navigable graph where documents are nodes and citations are edges. It uses a a modular pipeline for parsing, embedding, and thumbnailing documents.

Key components include:

  • Citation Graph: Automatically detects and resolves statutory citations to create a web of references.
  • AI Agents: Python-based agents that can reason over the curated citation graph and provide grounded, cited answers.
  • MCP Server: A Model Context Protocol implementation that allows external AI tools (like Claude or Cursor) to search the corpus and walk citation edges without custom glue code.
  • Structured Extraction: A "fieldset" system that uses LLM-powered queries to extract specific data across hundreds of documents into a grid for human review.
  • Human Annotation: A layer where humans define label schemas and annotate precise text spans on PDFs, providing the ground truth that AI agents build upon.
  • APIs: A GraphQL and REST API that exposes the entire graph for external applications.

Who it’s for

It is designed for teams working with large-scale document repositories, such as legal archives, research libraries, engineering knowledge bases, or internal policy folders, who need tot turn their documents into a machine-readable and human-navigable knowledge graph.

Highlights

  • Model Context Protocol (MCP): Native support for bringing your own agent via a standardized server.
  • Human-in-the-loop: Treats human annotation as the ground truth for the citation graph.
  • Layout-faithful PDFs: Precise text-to-coordinate mapping for annotations on PDFs.
  • Version-controlled Corpuses: Git-like branching and forking for document collections and their annotations.
  • Pluggable Pipeline: Swappable parsers and embedders for different file formats.

Related

  • Project
  • Project
  • Project
  • Project
  • Project