Contract Smart Compare
Skill ID: contract-compare
Version: 1.0.0
Category: Document Processing
Overview
Contract Smart Compare is an AI-powered contract document comparison tool. Automatically identifies and highlights clause-level differences between two or more contract documents, generating structured diff reports.
Features
Smart Clause Extraction
- Automatically identifies numbered clauses (Article X, Section X, etc.)
- Supports PDF, DOCX, TXT formats
- OCR for image scans (PRO)
Precise Difference Detection
- Clause-by-clause comparison: Article X → Original → New
- Three categories: New / Deleted / Modified
- Multi-version timeline (PRO)
AI Risk Assessment (PRO)
- Automatic legal risk level (High/Medium/Low)
- Focus: liability, breach, payment clause changes
Key Clause Summary (PRO)
- AI-powered core clause extraction
- Quickly understand key changes per version
Multi-format Export
- Markdown diff report (all tiers)
- Excel diff list (PRO)
- Risk summary report (PRO)
Tiered Features
| Feature | FREE | PRO |
|---|
| File formats | TXT, DOCX | TXT, DOCX, PDF, JPG, PNG |
| File versions | 2 files | 3+ files |
| Diff classification | Basic | New / Deleted / Modified |
| Risk assessment | ❌ | ✅ High / Medium / Low |
| Key clause summary | ❌ | ✅ |
| Excel export | ❌ | ✅ |
| Monthly limit | 5 uses | Unlimited |
| Price | Free | $0.01 USDT / call |
Usage
Compare Two Contracts
python -m src.main compare contract_a.pdf contract_b.pdf \
--label-a "Version 1" --label-b "Version 2" -o diff_report.md
Multi-version Compare (PRO)
python -m src.main multi v1.pdf v2.pdf v3.pdf \
--labels "Draft" "Revised" "Final" \
--dates "2024-01-01" "2024-03-15" "2024-06-01" \
--output report.md --excel
Parse Contract Text
python -m src.main parse contract.pdf --max-chars 3000
Environment Variables
| Variable | Description | Required |
|---|
| OPENAI_API_KEY | OpenAI API Key | One of |
| ANTHROPIC_API_KEY | Anthropic API Key | One of |
| CLAUDE_MODEL | Model name (default: claude-sonnet-4-20250514) | Optional |
Billing (PRO calls):
| Variable | Description | Required |
|---|
| SKILL_BILLING_API_KEY | SkillPay Builder API Key | PRO |
| SKILL_BILLING_SKILL_ID | Skill slug (contract-compare) | PRO |
| FEISHU_USER_ID | User ID (auto-set by OpenClaw) | Auto |
Supported File Types
| Format | FREE | PRO |
|---|
| TXT | ✅ | ✅ |
| DOCX | ✅ | ✅ |
| PDF | ❌ | ✅ |
| JPG/PNG (OCR) | ❌ | ✅ |
Tech Stack
- PDF: PyMuPDF + pdfplumber
- Word: python-docx
- Encoding: chardet
- OCR: pytesseract + Pillow
- AI: OpenAI GPT-4o / Anthropic Claude (user-provided Key)
- Excel: openpyxl
Security
- Files stored in
/tmp/contract-compare/ (temp directory, auto-cleaned)
- API Keys are user-provided, never stored
- Strict path sanitization (only alphanumeric,
., _, - allowed)
- 10-second timeout on all HTTP requests
- No data retained after comparison
Billing
- FREE: 5 uses per month, no charge
- PRO: $0.01 USDT per call (deducted via SkillPay at skillpay.me/contract-compare)
Billing is triggered at the start of each PRO-tier comparison call. Balance is checked before charging; if insufficient, a top-up URL is returned.
Dev Mode: When SKILL_BILLING_API_KEY is not set, the tool runs in dev mode with full access (balance=999.0, no charge).
Installation
pip install -r requirements.txt
# OCR support (optional, for image scans):
# Ubuntu/Debian:
sudo apt-get install tesseract-ocr tesseract-ocr-chi-sim
# macOS:
brew install tesseract
Contract Smart Compare — AI-powered contract comparison for legal, procurement, and compliance teams.