Install
openclaw skills install contract-risk-analyzerContract Risk Analyzer · 合同风险智能审查 — 上传合同PDF,AI自动提取关键条款并标注风险点,输出结构化风险报告(文本摘要 + 关键条款表格 + 🔴🟠🟡三级风险列表)。支持采购/销售/服务/劳动/租赁/保密协议6种合同类型。触发词:合同审查、合同风险、合同分析、合同检查、合同审核
openclaw skills install contract-risk-analyzerTrigger Keywords / 触发词: 合同审查、合同风险、合同分析、合同检查、合同审核、contract review、contract risk
When to use / 何时使用:
上传合同 PDF → AI 分析 → 输出结构化风险报告(文本摘要 + 关键条款表格 + 风险点列表)
The user uploads a PDF file. Download it to /tmp/contracts/ using the appropriate tool:
feishu_im_bot_image or feishu_im_user_fetch_resource with type=fileweb_crawl or fetchStore the file in /tmp/contracts/<uuid>.pdf.
Try in order:
PyMuPDF (fitz) — best for text-based PDFs:
import fitz
doc = fitz.open(pdf_path)
text = "\n".join(page.get_text() for page in doc)
pdfplumber — good for tables:
import pdfplumber
with pdfplumber.open(pdf_path) as pdf:
text = "\n".join(page.extract_text() or "" for page in pdf.pages)
OCR (pytesseract) — for scanned/image PDFs:
pdf2image or PyMuPDF renderIf text extraction fails completely or yields < 50 characters, inform the user that the PDF may be a scanned image requiring OCR, and offer to process with OCR.
Use the AI model to classify the contract type from extracted text:
Also detect language: 中文 / English / Bilingual.
Build a structured prompt for the AI model. Use model parameter from user's session or default to minimax/MiniMax-M2.
Prompt Structure:
# Contract Risk Analysis
## Contract Type: [detected type]
## Language: [Chinese / English / Bilingual]
## Contract Text:
[extracted text, truncated to last 8000 characters if too long]
---
Please analyze this contract and return a structured JSON report:
{
"summary": "200-word-or-less summary of the contract's core content",
"contract_type": "detected contract type",
"language": "detected language",
"key_terms": {
"parties": ["Party A", "Party B", ...],
"contract_value": "amount if stated, otherwise 'Not specified'",
"payment_terms": "payment conditions summary",
"duration": "contract duration/term",
"termination": "termination conditions",
"breach_penalties": "breach of contract penalties",
"dispute_resolution": "dispute resolution clause",
"governing_law": "applicable law/jurisdiction"
},
"risk_report": [
{
"level": "HIGH", // HIGH / MEDIUM / LOW
"category": "payment/termination/liability/confidentiality/other",
"title": "Risk title",
"description": "Detailed risk description",
"clause_reference": "Which clause/section this risk comes from",
"recommendation": "What the user should do about this risk"
}
],
"overall_score": 1-10, // Risk score: 1=very low risk, 10=very high risk
"overall_assessment": "Brief overall risk assessment paragraph"
}
IMPORTANT:
- Be strict and thorough — do not minimize real risks
- Classify risks as HIGH only if they involve significant financial loss, legal liability, or irreversible consequences
- If no risks found, return empty risk_report array
- This is NOT legal advice — include a disclaimer in the response to the user
Render the results as a well-formatted markdown report:
## 📄 合同风险审查报告
**合同类型:** [类型]
**语言:** [语言]
**整体风险评分:** [X/10] — [低/中/高]
---
### 📋 文本摘要
[200字以内摘要]
---
### 🔑 关键条款
| 条款 | 内容 |
|------|------|
| 当事人 | ... |
| 合同金额 | ... |
| 付款条件 | ... |
| 合同期限 | ... |
| 违约责任 | ... |
| 解除条款 | ... |
| 争议解决 | ... |
| 适用法律 | ... |
---
### ⚠️ 风险点列表
#### 🔴 高风险 (X项)
1. **[风险标题]**
- 条款来源:第X条
- 风险描述:...
- 建议措施:...
#### 🟠 中风险 (X项)
...
#### 🟡 低风险 (X项)
...
---
⚠️ **免责声明:** 本报告仅供参考,不构成法律建议。如有法律疑问,请咨询专业律师。
---
📊 **统计数据**
- 文本字数:X字
- 检测到风险:X项(高X / 中X / 低X)
- 合同语言:中文/英文
- 分析时间:YYYY-MM-DD HH:mm
/tmp/contracts/<uuid>_report.md| Feature | FREE | STD (¥9.9) | PRO (¥29) | MAX (¥69) |
|---|---|---|---|---|
| Monthly limit | 3 contracts | 30 contracts | 200 contracts | Unlimited |
| Contract types | Other only | All 6 types | All 6 types | All 6 types |
| Summary + Risk list | ✅ | ✅ | ✅ | ✅ |
| Key terms table | ❌ | ✅ | ✅ | ✅ |
| Excel report export | ❌ | ✅ | ✅ | ✅ |
| Batch processing | ❌ | ❌ | ✅ | ✅ |
| Risk comparison | ❌ | ❌ | ✅ | ✅ |
| API priority | ❌ | ❌ | ❌ | ✅ |
For FREE tier: skip the key terms table, only deliver summary + risk list.
Check the user's token prefix in their session context or configuration:
CONTRACT-MAX → full accessCONTRACT-PRO → PRO featuresCONTRACT-STD → STD featuresCONTRACT-FREE or none → FREE tierIf monthly limit is exceeded, inform the user and suggest upgrading.
| Error | Handling |
|---|---|
| PDF extraction yields < 50 chars | Offer OCR processing; if OCR also fails, report failure and suggest providing a text-based PDF |
| AI analysis fails | Return error message; suggest retrying |
| Unsupported file type | Inform user only PDF is supported |
| Token validation missing | Default to FREE tier |
/tmp/contracts/ (auto-cleanup optional)_report.md suffixPyMuPDF (fitz) + pdfplumberpytesseract + pdf2image (with chi_sim+eng language packs)openai Python packagecsv module for Excel CSV formatcontract-risk-reviewerscripts/analyze_contract.pyfitz, pdfplumber, pytesseract, pdf2image, openai如需购买收费版,请访问 YK-Global.com