Simulate how contract clauses play out under real-world scenarios. Upload a contract, select a stress-test scenario, and get a clause-by-clause walkthrough showing triggered obligations, timelines, liabilities, and risk areas.
Coming soon — a hosted version will be available at a public URL.
macOS / Linux:
./start.shWindows:
start.bat
The script will set up everything automatically (Python virtual environment, dependencies) and open the app in your browser. You'll need an Anthropic API key — the script will prompt you for it on first run.
# Create a .env file with your API key
echo "ANTHROPIC_API_KEY=your-key-here" > .env
# Start all services
docker compose upThen open http://localhost:8501 in your browser.
- Fork this repo on GitHub
- Sign up at Railway
- Create a new project from your fork
- Add the environment variable
ANTHROPIC_API_KEYin Railway's settings - Deploy — Railway will build and launch automatically
- Contract Parsing — Upload PDF or DOCX contracts. AI identifies and categorizes every clause.
- 5 Stress-Test Scenarios:
- Data Breach (notification obligations, liability caps, indemnification)
- Service Outage (SLA credits, termination rights, remediation)
- Termination for Convenience (notice periods, wind-down, survival clauses)
- IP Ownership Dispute (ownership, licensing, assignment)
- Force Majeure (qualification, mitigation, extended event termination)
- Clause-by-Clause Walkthrough — Step-by-step analysis with chain-of-thought reasoning
- Risk Assessment — Color-coded risk levels (low/medium/high) per clause and overall
- Streaming Results — See analysis in real-time as each clause is processed
With the API running, visit http://localhost:8000/docs for interactive Swagger documentation.
Key endpoints:
POST /contracts/parse— Upload and parse a contractGET /scenarios— List available scenariosPOST /simulations/run— Run simulation (returns SSE stream)
src/contract_simulator/
├── api/ # FastAPI routes and app
├── core/ # Config and security
├── models/ # Pydantic data models
├── services/ # Business logic (parsing, simulation)
└── prompts/ # LLM prompt templates
cs_frontend/ # Streamlit UI
data/scenarios/ # Scenario template definitions (JSON)
data/sample/ # Synthetic sample contracts
tests/ # pytest test suite
pip install -e ".[dev]"
pytest tests/ -v- Backend: Python 3.11+, FastAPI
- LLM: Anthropic Claude (Sonnet 4.6)
- Document Parsing: python-docx, pdfplumber
- Frontend: Streamlit
- Deployment: Docker, Railway
MIT — Copyright (c) 2026 Noam Raz and Pleasant Secret Labs