This prompt is designed for legal operations teams and contract analysts who need to extract structured clause records from merger and acquisition agreements. It targets the high-stakes workflow of M&A due diligence, where missing a material adverse change clause or misidentifying a termination right can carry significant financial and legal consequences. Use this prompt when you need a machine-readable inventory of key provisions, complete with full clause text, categorization, risk flags, and page citations. It is built for integration into a document processing pipeline where a human reviewer will validate outputs before they reach a decision-maker.
Prompt
Legal Clause Extraction Prompt for M&A Contracts

When to Use This Prompt
Defines the ideal user, required context, and critical boundaries for deploying the M&A clause extraction prompt in a production due diligence pipeline.
The ideal deployment context is a batch or streaming document ingestion system where each agreement is chunked, processed, and the extracted clauses are written to a review queue. The prompt expects a single, self-contained contract section as input—do not pass an entire 200-page purchase agreement in one call. You must provide a defined taxonomy of clause types (e.g., 'Material Adverse Change,' 'Termination Rights,' 'Indemnification') and a risk taxonomy (e.g., 'Unilateral Termination,' 'Uncapped Liability') as part of the [CONSTRAINTS] or [OUTPUT_SCHEMA] placeholder. The prompt will return a JSON array of clause objects, each with clause_type, full_text, risk_flags, page_citation, and a confidence score. A human reviewer must confirm or reject each extracted record before it enters a deal summary or risk matrix.
Do not use this prompt for generating legal advice, interpreting clause meaning, or making deal recommendations. It is an extraction tool, not a replacement for legal judgment. It will not catch novel or highly bespoke clause structures that fall outside the provided taxonomy. If a standard clause is missing from the document, the prompt will flag it as status: 'missing' rather than hallucinating text. Always pair this prompt with a validation layer that checks for schema compliance, missing required fields, and low-confidence extractions before routing records to human review. In regulated or litigation-sensitive contexts, ensure every extracted record retains its source page citation for auditability.
Use Case Fit
Where this prompt works and where it does not. Understand the operational boundaries before integrating legal clause extraction into a production M&A pipeline.
Good Fit: Structured M&A Agreements
Use when: processing definitive agreements (merger agreements, asset purchase agreements) with standard article numbering and defined terms. Guardrail: The prompt expects formal legal prose and explicit cross-references; it performs best on negotiated, signed PDFs rather than term sheets or emails.
Bad Fit: Unstructured Deal Communications
Avoid when: analyzing negotiation emails, markup drafts, or oral testimony. Guardrail: The prompt relies on document structure and defined-term conventions. For informal communications, route to a general entity extraction prompt with human review before treating output as a clause record.
Required Inputs
Risk: Incomplete extraction when inputs are missing. Guardrail: Ensure the prompt receives the full contract text, a target clause taxonomy, and a defined output schema. Missing page citations or defined-term glossaries degrade risk flag accuracy and downstream auditability.
Operational Risk: Missing Standard Clauses
Risk: The model may hallucinate a standard clause that is absent from the agreement. Guardrail: The prompt must distinguish 'clause not present' from 'clause not found.' Require a confidence flag and a null reason for every expected clause category, and never treat silence as affirmation.
Operational Risk: Cross-Reference Drift
Risk: Extracted clauses may point to incorrect sections when cross-references span multiple articles. Guardrail: Validate extracted section references against the document's table of contents. If the model cannot resolve a cross-reference, flag it for human review rather than guessing.
Human-in-the-Loop Threshold
Risk: Over-automation of high-stakes clause extraction without attorney review. Guardrail: Route any clause with a risk flag, low confidence score, or missing standard provision to a review queue. The prompt is an accelerator, not a replacement for legal judgment.
Copy-Ready Prompt Template
A production-ready prompt for extracting structured M&A clause records from full-text agreements, ready to be copied, adapted, and wired into a legal document processing pipeline.
This template is the core instruction set for an AI model to act as a precise legal clause extraction engine. It is designed to be strict: it demands verbatim text, rejects summarization, and requires the model to explicitly handle missing clauses and cross-references. The placeholders—[AGREEMENT_TEXT], [CLAUSE_TAXONOMY], [RISK_FLAG_TAXONOMY], and [OUTPUT_SCHEMA]—are the dynamic inputs your application must supply at runtime. Do not treat this as a conversational prompt; it is a machine-to-machine contract where the output must be valid, parseable JSON that conforms to the provided schema.
textExtract the following M&A contract clauses from the provided agreement text. Return a valid JSON object with a `clauses` array. For each clause found, include the clause category, a unique clause identifier, the full verbatim text of the clause, the starting page number, and any risk flags from the provided taxonomy. If a standard clause category is not present in the agreement, include it in a `missing_standard_clauses` array with a note. If a clause references another section, capture that cross-reference. Do not summarize or paraphrase clause text. Do not invent clauses not present in the source. If the text is ambiguous, set a `confidence` score between 0.0 and 1.0 and add an `ambiguity_note`. [AGREEMENT_TEXT] [CLAUSE_TAXONOMY] [RISK_FLAG_TAXONOMY] [OUTPUT_SCHEMA]
To adapt this template, start by defining your [CLAUSE_TAXONOMY] as a structured list of categories like ["Representations and Warranties", "Indemnification", "Material Adverse Change (MAC)"]. The [RISK_FLAG_TAXONOMY] should be a similar list of flags such as ["Uncapped Liability", "Double Materiality Trigger", "Survival Period > 18 Months"]. The [OUTPUT_SCHEMA] placeholder is critical for downstream reliability; replace it with a strict JSON Schema definition that includes required fields, types, and enum constraints for categories and risk flags. This ensures the model's output can be validated programmatically before it ever touches your database.
Before deploying, test this prompt against a golden dataset of 20-30 annotated M&A agreements. Measure extraction recall (did it find all clauses?), precision (did it hallucinate any?), and schema compliance (is the JSON valid?). A common failure mode is the model paraphrasing long clauses instead of extracting them verbatim; if you observe this, strengthen the constraint by adding a line: You will be penalized for paraphrasing. The 'clause_text' field must be a character-perfect substring of the source. Always log the raw model output and the final validated JSON for auditability, especially in legal workflows where provenance is non-negotiable.
Prompt Variables
Required inputs for the Legal Clause Extraction Prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to verify the input is correctly formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[CONTRACT_TEXT] | Full text of the M&A agreement to extract clauses from | AGREEMENT AND PLAN OF MERGER... [full document text] | Must be non-empty string. Check character length against model context window. Strip non-printable characters before insertion. |
[CLAUSE_CATEGORIES] | List of clause types to extract with definitions and priority | ["Indemnification", "Material Adverse Change", "Termination Rights", "Purchase Price Adjustment"] | Must be valid JSON array of strings. Each category must have a definition in [CATEGORY_DEFINITIONS]. Empty array allowed only for discovery mode. |
[CATEGORY_DEFINITIONS] | Legal definitions for each clause category to guide extraction | {"Material Adverse Change": "Provisions defining events or conditions that materially affect the target's business, financial condition, or operations"} | Must be valid JSON object. Keys must match [CLAUSE_CATEGORIES] exactly. Each value must be non-empty string. Missing definitions cause category-level extraction failures. |
[OUTPUT_SCHEMA] | JSON schema describing the required output structure | {"type": "object", "properties": {"clauses": {"type": "array", "items": {"type": "object", "properties": {"category": {"type": "string"}, "clause_text": {"type": "string"}, "page_citation": {"type": "integer"}, "risk_flags": {"type": "array", "items": {"type": "string"}}}}}} | Must be valid JSON Schema draft-07 or later. Required fields must be marked. Schema must include page_citation and risk_flags fields. Validate with JSON Schema validator before prompt assembly. |
[JURISDICTION] | Governing law jurisdiction for interpreting clause enforceability | Delaware General Corporation Law | Must be non-empty string. Used to contextualize risk flag generation. Null allowed if jurisdiction-agnostic extraction is intended. |
[RISK_FLAG_DEFINITIONS] | Taxonomy of risk flags with triggers and severity levels | {"unlimited_indemnity": {"trigger": "No cap on indemnification obligations", "severity": "high"}, "one_sided_termination": {"trigger": "Termination rights granted to only one party", "severity": "medium"}} | Must be valid JSON object. Each flag must have trigger and severity fields. Severity must be one of [low, medium, high, critical]. Empty object allowed if risk flagging is disabled. |
[MISSING_CLAUSE_BEHAVIOR] | Instruction for handling expected clause categories not found in the document | report_as_missing_with_confidence | Must be one of [report_as_missing_with_confidence, skip_silently, flag_for_review]. Controls whether absent clauses appear in output with null clause_text and confidence annotation. |
[CROSS_REFERENCE_RESOLUTION] | Whether to follow cross-references to other sections and include referenced text | Must be boolean. When true, model will attempt to resolve 'as set forth in Section X' references. Increases token usage and latency. Set false for strict section-bounded extraction. |
Implementation Harness Notes
Wire this prompt into a document processing pipeline, not a chat interface.
This prompt is designed for a document processing pipeline, not a conversational interface. The agreement text should be pre-processed to extract clean text with page markers before reaching the model. Use a structured output API (such as OpenAI's response_format with a JSON schema or a tool call with a strict schema) to enforce the output contract. After receiving the model response, validate the JSON against your schema. Check that every page field contains a number present in the source text. Check that every clause_text is a substring of the source agreement (or flag it for human review).
Log every extraction with the model version, prompt version, and agreement identifier. Route extractions with confidence below 0.8 to a human review queue. Never insert extracted clauses into a database or clause library without human approval. This is a high-stakes domain where errors can affect deal terms. Consider implementing a two-pass architecture: first extract clause candidates, then run a second verification pass that confirms each extraction against the source text and adjusts confidence scores.
For production deployment, implement retry logic with exponential backoff for transient API failures. Cache the pre-processed agreement text to avoid re-processing on retry. Monitor extraction completeness by tracking the ratio of expected clause types found versus missing. Set up alerts for schema validation failures, which often indicate prompt drift or model behavior changes. Always version your prompts and run regression tests against a golden set of agreements before deploying changes.
Expected Output Contract
Define the exact shape, types, and validation rules for the model's JSON response. Use this contract to build a downstream parser, validator, and retry logic.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
clause_id | string | Must match pattern | |
clause_category | enum | Must be one of: | |
clause_title | string | Non-empty string. Must be a concise, descriptive title derived from the clause heading or topic sentence. | |
full_text | string | Verbatim text of the clause from the source document. Must not be truncated. Length must be > 20 characters. | |
risk_flags | array of enum | If present, each item must be from: | |
page_citation | object | Must contain | |
cross_references | array of string | If present, each string must match the pattern | |
is_missing_standard_clause | boolean | Set to |
Common Failure Modes
Legal clause extraction from M&A contracts is brittle. Ambiguity, cross-references, and missing clauses break naive prompts. These are the most common production failure modes and how to guard against them.
Cross-Referenced Clause Fragmentation
What to watch: The model extracts a clause stub like 'as set forth in Section 8.2' but fails to resolve the cross-reference, leaving the extracted record incomplete. Guardrail: Add a post-extraction resolution step that searches the full document for referenced sections and merges the content before final output.
Missing Standard Clause Hallucination
What to watch: When a standard clause (e.g., 'Material Adverse Change') is absent from the contract, the model invents a generic version instead of returning a null or 'not present' flag. Guardrail: Explicitly instruct the model to return "status": "not_found" with a null payload if a clause is absent. Validate the output schema for non-null content in not-found records.
Page Citation Drift in Multi-Page PDFs
What to watch: The model cites the wrong page number, especially when the input text is concatenated from a PDF parser that misaligns page breaks. Guardrail: Pre-process documents to inject explicit page markers (e.g., [PAGE 12 START]) into the text stream. Validate that cited page numbers fall within the document's known page range.
Risk Flag Over-Sensitivity
What to watch: The model flags every clause as high-risk because it lacks the nuanced context of deal-specific thresholds or industry norms. Guardrail: Provide a defined risk taxonomy with specific criteria (e.g., 'uncapped indemnity', 'non-market earnout period > 3 years'). Use a second-pass classification prompt that only evaluates clauses against these concrete rules.
Defined Term Misinterpretation
What to watch: The model interprets a capitalized defined term (e.g., 'Business') using its general meaning rather than the contract-specific definition from the definitions section. Guardrail: Pre-extract the definitions section and inject the key defined terms and their meanings into the system prompt as a glossary before extracting the main clauses.
Output Truncation in Long Agreements
What to watch: For large M&A agreements (100+ pages), the model hits its output token limit and silently truncates the JSON array, producing a valid but incomplete extraction. Guardrail: Chunk the document by article or section and run extraction in parallel. Implement a post-processing check that verifies the number of extracted clauses matches the expected count of sections processed.
Evaluation Rubric
Use this rubric to test the quality of extracted clause records before integrating them into a production contract review pipeline. Each criterion targets a specific failure mode common in legal extraction tasks.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] exactly; all required fields are present. | JSON parsing error or missing required fields like | Automated schema validation against the target JSON Schema before any downstream processing. |
Citation Accuracy | Every | A | Manual spot-check of 10 random citations against the source PDF, plus an automated check for page numbers exceeding document length. |
Clause Text Fidelity | The | Paraphrased or summarized text appears in | Automated fuzzy string matching between the extracted |
Risk Flag Justification | Every clause flagged as | A | Automated check: if |
Missing Clause Handling | Standard clauses not found in the document are reported with | A missing standard clause is hallucinated with fabricated text or incorrectly marked as | Test with a document known to omit a specific standard clause; verify the output reports it as missing with no text. |
Cross-Reference Resolution | A clause defined by reference to another section includes the full text of the referenced section in | The | Test with a contract containing a defined term or obligation by reference; verify the resolved text is present in the output. |
Confidence Score Calibration | A | A high confidence score is assigned to a clause extracted from an illegible scanned page or a heavily redacted section. | Review a sample of 20 extractions with confidence scores, comparing the score to the actual clarity of the source text. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet) and a simple JSON schema. Focus on getting the clause categorization and risk flags right before adding complex validation. Start with a single contract type (e.g., asset purchase agreements) and 5-10 test documents.
Prompt modification
- Remove strict enum constraints on
clause_category; allow the model to suggest categories - Drop
page_citationrequirement if your test documents lack page numbers - Use a simplified output schema with only
clause_type,full_text, andrisk_flags - Add:
"If a standard clause is missing, mark it as 'NOT_FOUND' rather than omitting the field"
Watch for
- Missing schema checks leading to inconsistent field names
- Overly broad
risk_flags(e.g., flagging every indemnity clause as high risk) - Cross-reference resolution failures when clauses reference other sections
- Model inventing clause text for missing provisions instead of returning NOT_FOUND

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us