/compare-contract-risk-migration-skill
Compare 2–5 versions of Chinese general-purpose commercial contracts that the user has explicitly ordered, and generate a traceable risk migration XLSX.
Safety Gate
Before reading any contract, state whether the current environment is local or a cloud-based agent. In a cloud environment, you must explicitly inform the user that the contract will be read by the cloud model and obtain their confirmation for this session. Do not preview, convert, or hash the contract without confirmation. It is recommended to first redact trade secrets and personal information.
Workflow
- Obtain from the user the explicit version order, analysis stance (buyer/seller/neutral), contract name, and attachment affiliation. Do not sort by filename or modification time on behalf of the user.
- Prompt the user to connect to legally authorized databases such as PKULaw, Wolters Kluwer (Wolters Kluwer), Yuandian Legal Intelligence, or other regulatory database MCP/API. If none is provided or all calls fail, use official public sources from the National People's Congress, the State Council, the Supreme People's Court, regulatory agencies, and similar bodies.
- Run
python3 scripts/run_pipeline.py prepare .... Useversion_label=file_pathfor each--versionparameter; use--attachment version_label=file_pathfor attachments. - Read
contract-bundle.jsonand its temporary Markdown. Readreferences/analysis-schema.mdfor the required output contract, and readreferences/risk-rules.mdfor deterministic risk floors. - First extract clauses by contract components and clause levels, then combine title, number, definition, cross-references, text similarity, and context to establish a stable
clause_id. Low-confidence or multi-candidate matches must be marked asNeeds manual confirmation. - Identify additions, deletions, modifications, moves, splits, merges, and restorations between adjacent versions. Format-only changes are listed separately; cross-reference failures caused by renumbering are substantive risks.
- The risk migration status can only be:
New risk,Risk increased,Risk reduced,Risk transferred,Risk eliminated,Risk continued,Risk recurring,Pending confirmation. The risk level can only be:High,Medium,Low. When a deterministic rule floor is triggered, do not downgrade the level. - Retrieve information only for high-risk changes, suspected mandatory regulatory issues, and matters that require determining legal effects. Read
references/source-policy.mdfor MCP/public fallback and provenance requirements. When sources conflict, keep them in parallel and mark them as needing manual confirmation. - Output modification direction and negotiation points, do not generate full replacement clauses. After generating JSON that complies with the analysis contract, run
python3 scripts/run_pipeline.py report ... --cleanup. - Only report to the user the output path, risk migration statistics, high-risk items, and pending matches; remind the user that the XLSX still contains trade secrets.
Boundaries
- Applicable to general-purpose commercial contracts such as sales, services, licensing, SaaS, and NDAs.
- For specialized contracts such as labor, investment and financing, M&A, construction, finance, and cross-border, only perform text migration and advise the user to seek specialized review.
- Do not modify original contracts, do not generate redlined DOCX, and do not judge signature authenticity, effectiveness status, or full compliance of unchanged clauses.
- Do not save account credentials, passwords, cookies, tokens, or MCP authentication information. Do not use model memory as a definitive legal basis.
- If neither network nor MCP is available, continue version comparison and clearly mark the unchecked scope in the report.
Gotchas
- MarkItDown does not guarantee stable original page numbers for PDF/DOCX; when positioning is unstable, write "page number needs manual confirmation."
- Clause renumbering, movement, splitting, and merging cannot be judged solely by line-by-line diff.
- The user-specified version order is the sole source of ordering; file timestamps are only recorded, not used for sorting.
- This skill only reviews risks arising from changes; it is not equivalent to a full contract review.