Operational guide: setup, demo flow, configuration, and troubleshooting. For project framing and design rationale, see the README.
| Component | What it does | Port |
|---|---|---|
| FastAPI backend | Runs the Claude agent, handles file uploads | 8000 |
| React frontend | Upload UI + results dashboard | 3000 |
You need two terminals open, one for the backend, one for the frontend.
| Tool | Check | Install |
|---|---|---|
| Python 3.10+ | python3 --version |
python.org |
| Node.js 18+ | node --version |
nodejs.org |
| npm | npm --version |
comes with Node |
| Anthropic API key | console.anthropic.com |
cd clauseguard
cp .env.example .envOpen .env and replace your_api_key_here with your actual key:
ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxxxxxxxxxx
# From the clauseguard/ folder:
python3 -m venv venv
# Activate it:
source venv/bin/activate # Mac / Linux
# OR
venv\Scripts\activate # Windows
# Install dependencies:
pip install -r requirements.txt# Make sure you're in clauseguard/ with venv activated
uvicorn backend.main:app --reload --port 8000You should see:
INFO: Uvicorn running on http://0.0.0.0:8000
INFO: Application startup complete.
Leave this terminal running.
cd clauseguard/frontend
npm install
npm run devYou should see:
VITE v5.x ready in XXX ms
➜ Local: http://localhost:3000/
Your browser should open automatically. If not, go to http://localhost:3000.
- The app opens showing two upload zones
- Upload
sample_contracts/company_standard_terms.pdfon the left - Upload
sample_contracts/vendor_proposed_terms.pdfon the right - Click Analyze Contracts →
- Watch the progress bar as the agent calls each tool
- The full redline brief appears with all conflicts ranked by risk
All tuneable settings live in config.py:
| Setting | Default | Override |
|---|---|---|
| Model | claude-sonnet-4-6 |
Set CLAUSEGUARD_MODEL env var |
| Max output tokens | 32000 |
Edit MAX_TOKENS in config.py |
| Max file size | 10MB |
Edit MAX_FILE_SIZE in config.py |
| Max clauses per contract | 120 |
Edit MAX_CLAUSES in config.py |
To use a different model without editing code:
CLAUSEGUARD_MODEL=claude-opus-4-7 uvicorn backend.main:app --reload --port 8000Backend won't start:
# Make sure venv is activated, you should see (venv) in your prompt
# Then try:
pip install -r requirements.txt --force-reinstall"ANTHROPIC_API_KEY not found" error:
# Check your .env file exists and has no spaces around the = sign:
cat .env
# Should show: ANTHROPIC_API_KEY=sk-ant-...Frontend can't connect to backend (CORS error):
# Make sure backend is running on port 8000, not 8001 or another port
# Check Terminal 1 shows: Uvicorn running on http://0.0.0.0:8000"File too large" error:
- PDFs must be under 10MB
- If testing with large contracts, increase
MAX_FILE_SIZEinconfig.py
Analysis returns no conflicts:
- This can happen if the PDFs are scanned images (not text-based)
- The sample contracts included are text-based and will always produce results
- If testing with your own PDFs, make sure they are text-searchable
"Contract has N sections, only the first 120 were analyzed" warning:
- The agent caps extraction at 120 clauses per contract for token efficiency
- You'll see this warning in the progress bar if your contract is very long
- Increase
MAX_CLAUSESinconfig.pyif you need full coverage
npm install fails:
# Try clearing npm cache:
npm cache clean --force
npm install# From clauseguard/ folder:
node scripts/build_presentation.jsRequires pptxgenjs globally installed:
npm install -g pptxgenjs