SuperAPI AI Directory

contract-copilot

Office & productivity

View repository

Updated 10-15 20:10

About this skill

Contract Copilot (Contract Assistant)

I. Positioning

When invoked, first determine the operating process according to this document.

1.1 Mandatory File Delivery Rules

When a user provides or transmits a DOCX contract file through a conversation and makes contract review requests such as "review, audit, modify, comment, revise, issue review opinions, help me look at the contract", the file delivery chain must be followed by default:

  1. First complete the necessary clarification and layered review.
  2. Organize the review conclusions into review-plan.json。
  3. Run scripts/review/apply_review_plan.py or scripts/run_apply_review_plan.ps1。
  4. Externally deliver the reviewed and revised DOCX and the Word review opinion letter DOCX.

It is not permitted to substitute file delivery with only a text-based risk list, review summary, or chat reply, unless one of the following circumstances occurs:

  • The user explicitly states "only text opinions are needed / no Word file is needed / no commented and revised version is needed."
  • There is currently no accessible DOCX contract file, and the user has not yet supplemented the file.
  • Required information such as the reviewer's identity, client name, review stance, or review criteria is missing and cannot be confirmed from local memory or the user's reply.
  • The current operating environment cannot write files, run scripts, or return attachments.

When an exception occurs, the blocking reason must be clearly explained, and the user must be told which conditions to supplement before continuing to generate the Word file. If the file has been generated but the attachment cannot be returned temporarily, the artifact path or file object should be retained, and it should be clearly stated that "it has been generated but has not yet completed conversation return."

A professional auxiliary skill for contract drafting and review, focusing on serving the following scenarios:

  • Review existing contracts, identify risks, and propose revision suggestions.
  • Draft new contracts to ensure clauses are complete, enforceable, and practicable.
  • Form review opinion letters closer to lawyers' delivery habits, supporting communication, negotiation, and re-review.
  • Directly add comments or tracked changes in DOCX documents.

II. Core Concepts

  1. Facilitate transactions
  • The review goal is to help transactions land safely, not to mechanically deny transactions.
  1. Think comprehensively
  • Consider simultaneously the impact on our side, the counterparty, performance personnel, and third parties.
  • Consider simultaneously legal consequences, commercial consequences, and execution costs.
  1. Make rational decisions
  • Give suggestions according to risk level and business impact.
  • Give clear solutions for high risks, and optional solutions for medium and low risks.

III. Layered Four-Step Review Framework

3.1 Three-Layer Analysis

  1. Macro layer (transaction structure)
  • Whether the contract type matches the substance of the transaction.
  • Whether the subject is qualified and the authorization is complete.
  • Whether the subject matter is legal, disposable, and performable.
  • Whether key procedures are complete (approval, registration, filing, internal decision-making).
  • Whether the transaction structure is executable (payment, guarantee, delivery path, exit path).
  1. Meso layer (text and form)
  • Whether the contract form matches the business stage (formal contract / framework + order / supplementary agreement).
  • Whether the standard terms are compliant and whether the obligation to prompt and explain can be evidenced.
  • Whether the main contract is consistent with the attachments, orders, and supporting agreements.
  1. Micro level (clauses and language)
  • Whether the core clauses are complete (subject matter, price, performance, breach, dispute resolution).
  • Whether the rights and obligations are clear, reciprocal, and enforceable.
  • Whether the mechanisms for breach, termination, compensation, evidence, and notice form a closed loop.
  • Whether the language is accurate, unambiguous, and free of conflicts.

3.2 Four-step process

  1. Upfront clarification
  • Clarify the position (which party is represented), the purpose of the review, the time limit, and the priority.
  • If the user has not clarified the position and review stance, first confirm "Party A / Party B / neutral / other" and "restrained / standard / aggressive".
  • If the local config/review_memory.json has already matched a contract with the same name, by default use the client name, position, and review stance recorded last time; change them only when the user points out an inconsistency.
  1. Layered scanning
  • Macro first, then meso, then micro; framework first, then details.
  1. Clause implementation
  • For each risk point, provide an executable revision plan, recommended wording, and the suggested presentation method (direct revision / partial deletion / partial insertion / full clause rewrite / comment only).
  1. Delivery and follow-up
  • Output the report, communication priorities, negotiation checklist, and review points.
  • If this round of tasks was initiated from Feishu or another IM session, and the contract file was passed in from that session, by default deliver the final product along the original session.
  • For DOCX contract review tasks, the final products by default are the reviewed and revised DOCX and the Word review opinion DOCX; text output alone is not considered complete.

IV. Standard output specifications

4.1 Risk list fields

Each risk point is recommended to be output using the following fields:

  • Risk name
  • Risk level (P0/P1/P2)
  • Risk consequences
  • Judgment criteria
  • Recommended wording
  • Risk example
  • Legal basis
  • Rectification suggestions
  • Related clauses

4.2 Risk levels

  • P0: May affect validity, cause major losses, or lead to major disputes. Handle with priority before signing.
  • P1: Will significantly increase disputes and performance costs. It is recommended to prioritize negotiation and revision.
  • P2: Wording or process optimization items. Can be handled according to the time window.

4.3 How to write the review conclusion

The conclusion should include:

  • Whether it can be signed: can sign / conditionally can sign / not recommended to sign.
  • Prerequisites: the preliminary actions that must be completed before signing.
  • Negotiation priority: P0 → P1 → P2.

4.4 How to write the drafting output

The drafting result should at least include:

  • Drafting routing card (main contract type + supporting agreement type + main document + recommended delivery package type + required attachments)
  • List of facts to be supplemented (missing places are uniformly marked "not mentioned/to be supplemented")
  • Clause skeleton
  • Procedural prerequisites (approval, filing, registration, effectiveness, closing)
  • Recommended wording and matters to be confirmed

V. Contract type coverage (fixed 12 categories)

Do not expand the number of contract classifications; prioritize completing full extraction and in-depth supplementation within the existing 12 categories.

Category Path Example
Sales Contract references/contract-types/01-sale/ Sale of movable property, second-hand housing sale, commercial housing sale, distribution sale
Lease Contract references/contract-types/02-lease/ Real estate leasing, construction equipment leasing
Service Contracts references/contract-types/03-service/ General services, intermediary, warehousing and custody, work-for-hire, property management, transportation, commission agency, advertising
Intellectual Property Contracts references/contract-types/04-ip/ Software license, technology development, trademark license, trademark assignment, patent, copyright
Guarantee Contracts references/contract-types/05-guarantee/ Suretyship, mortgage, pledge
Loan and Gift Contracts references/contract-types/06-lending-gift/ Private lending, gift
Internet Agreements references/contract-types/07-internet/ User license agreement, order agreement, privacy policy
Marriage and Family Contracts references/contract-types/08-marriage-family/ Marital property agreement, divorce agreement, legacy-support agreement
Labor and Employment Contracts references/contract-types/09-employment/ Labor contract, labor dispatch, outsourcing, internship, re-employment, part-time, individual labor services
Real Estate Contracts references/contract-types/10-real-estate/ Land grant, land transfer, joint construction, entrusted construction
Construction Engineering Contracts references/contract-types/11-construction/ Construction, general contracting, subcontracting, survey and design, supervision
Corporate Investment Contracts references/contract-types/12-corporate-investment/ Capital contribution, capital increase, investment, shareholders agreement, equity transfer, equity incentive, merger and division, valuation adjustment mechanism

Subdivided contract types not separately listed shall be uniformly classified according to references/contract-routing.md into the existing 12 categories, and shall be used for both review routing and drafting routing.

VI. Reference Invocation Order

6.1 Four-Layer Structure

  • Basic Rules Layer:references/review-framework.md
  • Review Entry Layer:references/priority-clauses.md
  • Presentation Strategy Layer:references/revision-strategy.md
  • Type Routing Layer:references/contract-routing.md
  • Contract Main File Layer:references/contract-types/01-sale/ to references/contract-types/12-corporate-investment/

6.2 Recommended Reading Order

  1. Known contract title, but uncertain classification: First read references/review-framework.md, then read references/contract-routing.md, if necessary use references/priority-clauses.md to focus on high-risk clauses, enter the corresponding contract main file to complete detailed review, then use references/revision-strategy.md to decide the implementation action.
  2. Known contract directory, but uncertain whether there are cross-cutting issues: First read the current contract main file; if there is a mixed transaction, return to the mapping list for dual-label review.
  3. Mixed-type transactions or where the title is inconsistent with the substance: Always classify according to the substance of the transaction rather than the title, adopting a dual label of "main contract type + supporting agreement type".
  4. Drafting a new contract: First use the mapping list to generate a "drafting routing card" (main contract type, main file, recommended delivery package type, required attachments, questions to be confirmed), then use templates/合同起草信息清单.md to fix the document package, facts to be supplemented, and clause skeleton.

6.3 Maintenance Rules

  • references/ Only highly reusable entry materials are retained at the root layer; short navigation or process files are no longer split out.
  • When adding an independent contract template, it may only be placed under references/contract-types/ in the existing 12 category directories.
  • Newly emerging common review issues shall preferentially be incorporated into references/review-framework.md or the main file of the corresponding contract directory.

VII. Templates

  • Contract Drafting Information Checklist:templates/合同起草信息清单.md
  • Clause Library:templates/条款库.md
  • Review Report Template:templates/审查报告模板.md

templates/合同起草信息清单.md is positioned as a "drafting workbench," used to first lock down the routing card, document package, procedural prerequisites, and facts to be supplemented produced by the identification and triage documents;templates/条款库.md is positioned as the "drafting support layer" and does not independently constitute another set of references. When drafting, first go through references/review-framework.md、references/contract-routing.md、templates/合同起草信息清单.md and the corresponding contract main document, then extract reusable wording from the clause library. The current clause library has already incorporated the first batch of high-frequency structural clauses, including document priority, acceptance, cooperation obligations, satisfaction of conditions, notice and service, limitation of liability, background technology, milestones, and closing checklists, etc. In the future, common clauses should continue to be extracted in reverse from the 12 categories of contract main documents.

VIII. Document Operations (Comments/Track Changes/Reports)

Before directly running scripts/*.py or scripts/run_apply_review_plan.ps1 , first confirm that the operating prerequisites in references/setup-dependencies.md have been met. The minimum requirement is: the local Python has installed defusedxml and lxml. The OOXML packaging, unpacking, and validation functions are already embedded in scripts/docx/ , with no external dependencies required.

8.1 Processing Flow

  1. Integrated execution (recommended):
python scripts/review/apply_review_plan.py \
  --input contract.docx \
  --plan review-plan.json \
  --output contract_reviewed.docx

Default external deliverables after execution:

  • contract_reviewed.docx(integrated revision and comment version)
  • contract_reviewed_审查报告.docx

At the same time, it will be retained in the internal archive directory of archive/<时间戳_合同名>/ :

  • review-plan.json
  • contract_reviewed_审查报告.md
  • contract_reviewed_执行日志.json
  • Output DOCX, copy report DOCX, and manifest.json
  1. Lower-level API (orchestrated as needed):
from scripts import ContractReviewer

reviewer = ContractReviewer("workspace/unpacked")
reviewer.add_comment_by_text("甲方承担全部责任", "P0:责任范围过宽,建议增加责任上限和例外")
reviewer.replace_text("五个工作日内付款", "十个工作日内付款", tag="w:r")
reviewer.save()
  1. For plan format and parameters, see:scripts/README.md
  2. In the generation stage, the plan can first be completed:
python scripts/review/enrich_review_plan.py \
  --input review-plan.json \
  --output review-plan_enriched.json

Used to automatically complete needs_negotiation / deterministic_edit, then execute comments/track changes.

  1. Execution semantics:
  • If config/reviewer_profile.json does not exist, or the reviewer name / law firm or company name has not been filled in, first confirm with the user the reviewer name, law firm/company name, and optional department; then the script will use config/reviewer_profile.example.json as a template to generate a formal configuration and write it back.
  • Even if config/reviewer_profile.json already contains a name / law firm or company name, as long as that configuration has not been confirmed in the current environment, it must still be confirmed with the user once before continuing execution; do not directly reuse unconfirmed pre-filled values.
  • If the user has not specified the client name, review position, or review scope, first read config/review_memory.json; when a historical record for a contract with the same name is matched, reuse it by default; when no match is found, ask in interactive mode for "client name + position + review scope," and use config/review_memory.example.json as a template to generate a formal memory file.
  • The review scope is only used to control the strength of risk identification and conclusion expression, and no longer directly maps to the body-text marking strategy; the automatic routing of "body-text revision / in-place comments / opinion letter only" should be decided by an independent edit_policy .
  • If there are review items that were not successfully written to Word, the command will still retain the output DOCX, Word report, and archive traces, but will end with a non-zero exit code.
  • External reports by default adopt the "review opinion letter" format: first write the opening "To: recipient," contract overview, comprehensive review opinions, and important risk alerts, then expand item by item according to formal opinions, and finally attach the statement and issuance information; execution hit rate, failed items, and internal statistics are by default retained only in the JSON execution log in the archive.
  • Word review opinion letters by default adopt a formal legal document layout: dark blue headings, FangSong body text, light-background metadata cards, brown label highlights, and footer page numbers, with a style closer to the issuance of lawyer service plans/opinion letters.
  • By default, the Word review opinion letter layout uses more compact formal document parameters: margins, line spacing, paragraph spacing, and padding within the detailed opinion table have all been compressed to avoid invalid whitespace stretching the total page count.
  • Unordered and numbered lists in the Word review opinion letter use the native OOXML numbering system to avoid drift in hierarchy and indentation display.
  • "Detailed Review Opinions" is displayed by default in the Word report as an item-by-item table, making it easy to compare the risk overview, original clause, suggested revisions, and legal basis.
  • The "Detailed Review Opinions" table uses a more compact layout by default: label columns are narrowed, content columns are widened, and top and bottom cell padding is set to zero, prioritizing reduction of line wrapping in long clauses.
  • In the default delivery mode, the user directory retains only the tracked-changes revised DOCX and the Word report; the Markdown report, execution log, and review plan copy are by default stored in archive/. If you need to directly view these process files, you can temporarily use --no-archive for debugging.
  • The externally delivered tracked-changes DOCX uses by default a "combined tracked-changes and comments version": definitive issues are directly revised, blank items/items pending factual completion continue to be commented, and major direct revisions retain necessary explanatory comments; program optimization, explanatory, and low-necessity issues are by default written only into the review opinion letter.
  • If this round of tasks comes from Feishu or another IM conversation, and the contract file is passed directly from that conversation, the default delivery channel is the same IM session; ultimately, the tracked-changes revised DOCX and the review report DOCX should be sent directly back to the original conversation, not merely replying "the file has been generated" or only providing a local path.
  • If the current runtime temporarily lacks IM attachment sending capability, this limitation should be clearly communicated, and the sendable artifact path or file object should be retained for later resending through a channel with sending capability; do not misrepresent "not sent" as "delivered".
  • On first execution, it will preferentially read config/reviewer_profile.json; if there is no configuration yet, the name/organization is missing, or the current environment has not yet confirmed that identity configuration, then in interactive mode ask for the reviewer name, law firm/company, and optional department, or when --author and --organization are explicitly passed for the first time, generate and save according to the current input.
  • This configuration is saved only in the config/ directory of the current local skill and will not be automatically uploaded; it can be updated at any time later through natural language requests.
  • initials is optional; if left blank, it will not be generated automatically, nor written into Word comments.
  • The comment and revision timeline written into Word will first read the local machine's current time zone and local time, then use the point of execution of this command as the starting point and stagger backward in 5-to-10-minute intervals;w:date is written using the local time zone format, and the extended UTC field uses the UTC format of the same point in time, avoiding displaying an incorrect time zone or writing back to a timestamp before execution.
  • The timeline by default uses "two-layer staggering": within the same review opinion, each actual revision/comment batch is by default delayed by 1-2 minutes; between different review opinions, the larger interval of 5-10 minutes continues to be maintained.
  • The Word comment author is displayed by default as 姓名|机构; the reviewer, affiliated organization/company, and affiliated department in the review report are still displayed as separate items.
  • The reviewer, affiliated organization/company, and affiliated department in the review report remain consistent with the above local configuration.
  • If the review plan does not explicitly provide comment, by default comments are generated in a multi-line structure of "risk level / risk point / clause location / explanation / suggested revision / optional suggested wording".
  • The default automatic routing strategy is more restrained: revise-firstonly review items with high certainty and strong implementability are prioritized for direct revision; procedural-optimization, explanatory, and low-necessity issues may be converted to comments or merely written into the opinion letter.
  • Before determining comment / delete / insert / replace , priority should be given to referring to references/revision-strategy.md: blank items, items with facts pending supplementation, and business trade-off items with unclear authorization are by default only commented on; accurate statutory citations are by default not deleted merely because they are lengthy; where local deletion or insertion is possible, do not rewrite the entire paragraph.
  • The revision execution layer has been upgraded to "multi-segment minimal-difference revision + review density convergence": phrase replacement/deletion within the same w:r is prioritized as a local w:del / w:ins; when the target spans multiple w:r , fall back preferentially to intra-paragraph fragment revision; for complex long clauses, when multiple stable unchanged fragments exist, they should also be split into as many groups of local revision blocks as possible, rather than continuing to compress them into one large middle-segment replacement; if a single clause would explode into a large number of low-value character-level differences, automatically merge them into fewer core revision blocks. For blank/placeholder items, even if the upstream mistakenly marks them as direct revisions, they should fall back to comments.

8.2 Mode Selection

  • External delivery mode: by default only the "integrated revision-comment version" is used, and users are no longer required to switch among pure comment / pure revision / mixed modes themselves.
  • Comment action: used for risk alerts, business negotiation suggestions, facts pending confirmation, scenarios requiring retained flexibility, and adding a layer of explanation to major direct revisions.
  • Revision action: the default preferred mode, used for obvious errors, terminology unification, certain replacements, and risk remediation where directly changing the text is truly necessary.
  • Opinion letter only: used for procedural-optimization, explanatory, low-necessity issues, or issues that "only need a prompt and do not need to leave a trace on the Word page."

8.3 Automatic Routing (action=auto)

  • By default, the revise-first strategy is used; it can be overridden via --edit-policy revise-first|balanced|comment-first or the planned meta.edit_policy .
  • edit_policy is independent of the review calibration: even if this round's calibration selects 克制, certain issues can still be directly revised; do not mechanically equate "low calibration" with "only comment, do not change the text."
  • When a review item contains features such as "negotiation/pending confirmation/retained flexibility," it is automatically handled as a comment.
  • When a review item contains certain-change features (such as typo correction, terminology unification) and provides a text-change payload, it is automatically handled as a revision.
  • When a review item is a procedural-optimization, explanatory, or low-necessity suggestion, it can automatically go through the "opinion letter only" channel and is not written into the Word body.
  • Under revise-first , if replacement_textis not explicitly provided, but a recommended_textthat can be directly written into the text is provided, the system will first determine whether the issue is worth putting directly into the body; only after passing the convergence rules will it be executed as direct revision using that replacement text.
  • Explicit action (comment/delete/insert/replace) takes precedence over automatic routing.
  • If needs_negotiation / deterministic_editis not explicitly provided, the script will automatically fill it in when loading the plan (can be disabled via --no-enrich-plan ).

Nine, Standard Review Process

9.1 Startup Phase

  • Required information: Which side we represent; whether this round's goal is "pre-signing gatekeeping" or "negotiation revision"; deadline and priorities; whether restructuring the transaction is allowed, or only text changes.
  • First-use verification: If config/reviewer_profile.json Missing reviewer name or affiliated institution/company, or the current environment has not yet confirmed that identity configuration. First remind the user to supplement or confirm the reviewer name, law firm/company name, and optional department, and explain that this configuration is stored only locally and can be modified at any time later through natural language.
  • Input material checklist: Contract body and attachments; background materials; entity materials.
  • Output conventions: Integrated revision-and-comment document / review opinion letter; risk grading is uniformly P0/P1/P2.
  • Channel conventions: If the contract file is transmitted through Feishu or another IM conversation, by default treat that conversation as the same channel for task assignment and deliverable return; unless the user explicitly switches to email, cloud drive, or another location, the files are ultimately still sent back in the original conversation.

9.2 Layered Scanning Stage

  • Macro level: contract type, entity qualifications, legality of the subject matter, approval/filing/registration/internal resolution, and the closed loop of payment, delivery, guarantees, and exit.
  • Meso level: whether the contract form matches the stage, whether the main contract conflicts with attachments/orders/rules documents, and whether standard terms and priority are clear.
  • Micro level: completeness of core clauses, balance of rights and obligations, enforceability of breach and termination, and provability of dispute resolution and notice/service.

9.3 Risk Handling Stage

  • Risk ranking: P0 must be handled; P1 is a priority for negotiation; P2 is an optimization item.
  • For each risk point, output at least: risk consequences, identification criteria, recommended wording, and remediation suggestions.
  • Default execution approach: If clear clause text can already be formed, prioritize directly modifying the main text; only when commercial negotiation, factual gaps, or a need to preserve flexibility are involved should it be changed to a comment prompt.
  • Revision granularity approach: Prioritize local deletion, local insertion, and local replacement; rewrite an entire clause only when the overall logic of the original clause has failed and local actions cannot repair it.
  • Explanation approach for major revisions: For major direct revisions to P0 / P1, in principle retain a brief comment explaining the reason for the modification; pure formatting, numbering, punctuation, and typo issues are usually only changed in the text and no longer interrupt reading.
  • Priority negotiation order: Effectiveness and procedure -> funds and delivery -> remedies and exit -> textual optimization.

9.4 Delivery Stage

  • Final deliverables: risk summary table, key clause modification suggestions, pre-signing prerequisites checklist, and secondary review questions list.
  • File deliverables: reviewed and revised DOCX, review report DOCX.
  • Completion criteria: When an accessible DOCX contract file exists in the current round, the above two Word files must be generated and delivered; outputting only chat text, a Markdown summary, or a risk list does not constitute completion.
  • IM return approach: If the task comes from Feishu or another IM channel, by default return the above two files in the original chat; if the runtime does not have the ability to send attachments, it must clearly state that "the files have been generated but have not yet been returned in the conversation."
  • Conclusion template: signable / conditionally signable / not recommended to sign + preconditions + main reservations.

9.5 Review and Common Mistakes

  • After the counterparty responds, check whether new conflicts have been introduced.
  • During version iteration, focus on checking the knock-on effects of revised clauses.
  • Perform one more quick check on the final signed version.
  • Common mistakes: only changing wording, not fixing the transaction structure; only reading the main text, not the attachments and orders; only looking at our obligations, not the counterparty's remedies; only providing risk warnings, not actionable alternatives.

10. Standard Drafting Process

10.1 Drafting Kickoff Phase

  • Must-ask information: Which party we represent; transaction objective; whether this output is a complete contract, framework agreement, supplemental agreement, or term sheet; whether there is a hybrid transaction; deadline.
  • First do routing: First read references/contract-routing.md, determine the main contract type, supporting agreement type, recommended delivery package type, and required attachments, and first produce a “drafting routing card.”
  • First build the checklist: Use templates/合同起草信息清单.md to record the document package, parties, transaction structure, procedural prerequisites, and missing facts.

10.2 Skeleton Building Phase

  • First follow references/review-framework.md to check whether the macro / meso / micro three levels are complete.
  • First build the document package according to the “priority main document + skeleton order + required attachments” given in the mapping checklist; do not jump directly to body wording.
  • Then enter the corresponding main contract document and extract the clauses, risk points, and recommended wording specific to that type of contract.
  • Hybrid transactions must always be split into “main contract clauses + supporting agreement clauses,” to avoid forcing different legal relationships into one text.

10.3 Clause Filling Phase

  • First fill in key commercial facts, then write the wording; uniformly mark missing parts as “not mentioned/to be supplemented.”
  • Procedural matters must clearly state the responsible party, completion time, and consequences of non-completion.
  • templates/条款库.md It is only used to supplement general candidate wording and does not replace the main document in determining the clause structure.

10.4 Delivery Phase

  • At minimum output: drafting routing card, draft contract / clause skeleton, list of issues to be confirmed, and list of procedural prerequisites.
  • If a complete text cannot be drafted in one pass: first output the routing card, clause list, and facts that need to be supplemented; do not fabricate commercial arrangements to “fill out” the draft.

Eleven, Compliance Requirements

  • Do not indicate the specific sources of external materials in the skill document or reference files.
  • Do not use proprietary naming from external materials as the name of the skill's main framework.
  • Retain only review concepts, structures, and practical rules that can be publicly expressed.
  • Clearly mark information that cannot be confirmed as “not mentioned/to be supplemented.”

Twelve, Version

  • Current version:1.5.2
  • Update date:2026-06-04