OpenContracts: Instructions file for Claude Code

CLAUDE.md

OpenContracts CLAUDE.md is an instructions file for Claude Code from Open-Source-Legal/OpenContracts. It costs 9,286 tokens per session, scanned B, original, MIT.

Project instructions for OpenContracts, an open-source platform that analyses PDFs and text documents. The project uses Django and GraphQL on the back end, PostgreSQL for data, and React with TypeScript on the front end.

In plain words
What is it for?
Use it when changing OpenContracts, especially when running tests, checking TypeScript, using pre-commit checks, or working on its Django back end and React front end.
Why use it?
It records the repository’s rules, required checks, and important commands so code changes follow the project’s expectations.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is Open-Source-Legal/OpenContracts's own configuration. It tells Claude Code how to work on OpenContracts itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything OpenContracts configures →

About the project

OpenContracts is an open-source document intelligence platform that turns document collections into searchable citation graphs with annotations, structured extraction, and AI agents. Builders and teams use it to work with unstructured documents through APIs, an MCP server, or a web interface. The catalogue entries extend the platform with agent, instruction, and rule workflows.

Open-Source-Legal/OpenContracts · 1,468 stars · on GitHub · open-source-legal.github.io

Reuse

Borrowing it

Nothing to install: this file belongs to Open-Source-Legal/OpenContracts. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Open-Source-Legal/OpenContracts/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/Open-Source-Legal/OpenContracts

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for OpenContracts CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/open-source-legal/opencontracts/claude-md.svg)](https://agentmods.dev/instructions/open-source-legal/opencontracts/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/open-source-legal/opencontracts/claude-md"><img src="https://agentmods.dev/badge/instructions/open-source-legal/opencontracts/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 9,286 This file is loaded in full into every session.
When invoked 9,286 The same file — it is already loaded in full.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.09286 $0.09286
Opus 5 $0.04643 $0.04643
Sonnet 5 $0.01857 $0.01857
Haiku 4.5 $0.00929 $0.00929

Measured 8d ago against content hash 7001225d1433, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade B, and why

OpenContracts CLAUDE.md scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo systemctl stop docker && sudo systemctl stop docker.socket && sudo ip link delete docker0 2>/dev/null || true && sudo iptables -t nat -F && sudo iptables -t nat -X && sudo iptables -t filter -F && sudo iptables -t f

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- For verifying just the GraphQL response without the full frontend, `curl` with the session cookie also works:
CLAUDE.md · 596 lines

How it starts

The opening of the file, as written. The whole thing — 596 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

OpenContracts is an MIT-licensed enterprise document analytics platform for PDFs and text-based formats. It features a Django/GraphQL backend with PostgreSQL + pgvector, a React/TypeScript frontend with Jotai state management, and pluggable document processing pipelines powered by machine learning models.

Baseline Commit Rules

  1. Always ensure all affected (or new) tests pass - backend tests suite should only be run in its entirety for good reason as it takes 30+ minutes.
  2. Always make sure typescript compiles and pre-commits pass before committing new code.
  3. Never credit Claude or Claude Code in commit messages, PR messages, comments, or any other artifacts. This includes Co-Authored-By lines, "Generated by Claude", etc.

Essential Commands

Backend (Django)

# Run backend tests (sequential, use --keepdb to speed up subsequent runs)
docker compose -f test.yml run django python manage.py test --keepdb

# Run backend tests in PARALLEL (recommended - ~4x faster)
# Uses pytest-xdist with 4 workers, --dist loadscope keeps class tests together
docker compose -f test.yml run django pytest -n 4 --dist loadscope

# Run parallel tests with auto-detected worker count (uses all CPU cores)
docker compose -f test.yml run django pytest -n auto --dist loadscope

# Run parallel tests with fresh databases (first run or after schema changes)
docker compose -f test.yml run django pytest -n 4 --dist loadscope --create-db

# Run specific test file
docker compose -f test.yml run django python manage.py test opencontractserver.tests.test_notifications --keepdb

# Run specific test file in parallel
docker compose -f test.yml run django pytest opencontractserver/tests/test_notifications.py -n 4 --dist loadscope

# Run specific test class/method
docker compose -f test.yml run django python manage.py test opencontractserver.tests.test_notifications.TestNotificationModel.test_create_notification --keepdb

# Apply database migrations
docker compose -f local.yml run django python manage.py migrate

# Create new migration
docker compose -f local.yml run django python manage.py makemigrations

# Django shell
docker compose -f local.yml run django python manage.py shell

# Code quality (runs automatically via pre-commit hooks)
pre-commit run --all-files

Read the full file on GitHub · 596 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 596 lines · 9,286 tokens per session scan B 7001225d1433

Subscribe to this mod's changes

OpenContracts CLAUDE.md is an instructions file published in the GitHub repository Open-Source-Legal/OpenContracts (1,468 stars, last pushed today), licensed MIT. It adds 9,286 tokens to every session, about $0.0464 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens