Inferensys

Prompt

Legal Clause Extraction Prompt for M&A Contracts

A practical prompt playbook for using Legal Clause Extraction Prompt for M&A Contracts in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

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.

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.

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.

PRACTICAL GUARDRAILS

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.

01

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.

02

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.

03

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.

04

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.

05

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.

06

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.

PROMPT PLAYBOOK

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.

text
Extract 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.

IMPLEMENTATION TABLE

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.

PlaceholderPurposeExampleValidation 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.

PROMPT PLAYBOOK

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.

IMPLEMENTATION TABLE

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 ElementType or FormatRequiredValidation Rule

clause_id

string

Must match pattern CLAUSE-[0-9]{4}. Unique per extracted clause within the response.

clause_category

enum

Must be one of: Representations_and_Warranties, Covenants, Conditions_Precedent, Indemnification, Termination, Definitions, Governing_Law, Other.

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: Uncapped_Liability, One-Sided_Termination, Vague_Materiality, Missing_Remedy, Unusual_Governing_Law. Empty array is allowed.

page_citation

object

Must contain page_number (integer, >= 1) and paragraph_index (integer, >= 1). Both fields are required.

cross_references

array of string

If present, each string must match the pattern Section [0-9]+(\.[0-9]+)*. Empty array is allowed. Null is not allowed.

is_missing_standard_clause

boolean

Set to true if a standard M&A clause (e.g., 'Assignment') is expected but not found in the document. Defaults to false.

PRACTICAL GUARDRAILS

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.

01

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.

02

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.

03

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.

04

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.

05

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.

06

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.

IMPLEMENTATION TABLE

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.

CriterionPass StandardFailure SignalTest 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 clause_text or clause_category.

Automated schema validation against the target JSON Schema before any downstream processing.

Citation Accuracy

Every page_citation maps to a page in the source document where the clause text appears verbatim.

A page_citation references a page number outside the document range or a page containing unrelated text.

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 clause_text field contains an exact, character-for-character copy of the text from the source document.

Paraphrased or summarized text appears in clause_text instead of the original wording.

Automated fuzzy string matching between the extracted clause_text and the source document text at the cited page.

Risk Flag Justification

Every clause flagged as high_risk: true includes a non-empty risk_rationale field grounded in the clause text.

A high_risk clause has a null, empty, or generic risk_rationale like 'standard clause'.

Automated check: if risk_flag is high, then risk_rationale must be a non-null string with a minimum length of 20 characters.

Missing Clause Handling

Standard clauses not found in the document are reported with status: 'missing' and a null clause_text.

A missing standard clause is hallucinated with fabricated text or incorrectly marked as status: 'present'.

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 clause_text.

The clause_text contains only a pointer like 'See Section 2.1' without the resolved content.

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 confidence score of 0.9 or above corresponds to a clearly identifiable, unambiguous clause; scores below 0.7 indicate significant ambiguity.

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.

ADAPTATION OPTIONS

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_citation requirement if your test documents lack page numbers
  • Use a simplified output schema with only clause_type, full_text, and risk_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
Prasad Kumkar

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.