← Back to library

Summarize long leases and contracts into key terms

An Anthropic cookbook notebook on summarizing long legal documents, using sublease agreements as the example. It extracts structured key terms such as parties, property, term, rent, responsibilities and notice requirements, shows how to split very long files into chunks and combine the partial summaries, and covers ways to judge summary quality.

  • OutcomeA structured abstract of a long agreement (parties, dates, money, obligations, notices, special terms), with anything missing marked as not specified.
  • SetupAn afternoon+
  • LevelAdvanced
  • CreditAnthropic
View original
Works with
Claude

Published Oct 20, 2026Updated Oct 20, 2026AI dry run on sample input: passed Oct 20, 2026Source verified Oct 23, 2026

When should you use it?

  • Abstracting a stack of leases for a property manager or acquisition
  • CPA firms reviewing lease terms for lease accounting
  • Building a key-terms register for vendor contracts

Not for: Legal interpretation of clauses

What do you need, and what do you get?

You need

  • Agreements as PDF or text
  • The list of terms you need
  • An API key and Python for the full notebook

You get

  • Key-terms summary per document, organized by section

How does it work, step by step?

  1. Open the notebookOpen it on GitHub, or clone the repository and run it in Jupyter or Colab.
  2. Add an API keyThe notebook calls the model API; set the key as an environment variable, never in the notebook.
  3. Swap in your dataReplace the example data with a small, anonymized sample of your own.
  4. Check the resultsCompare outputs against what a person would have produced before using it on real work.

The prompt

Our adapted version, written to work in Claude. Values in lime are placeholders.

Fill in the blanks (optional; the copied prompt uses your values)

Prompt2 variables
Summarize this agreement into key terms.
Sections: parties; property or subject; term (start, end, renewal); money (rent or fees, increases, deposit); responsibilities; consent and notices; special provisions; {extra_terms}.
Use bullet points under each section, give the page or clause for each figure, and write 'Not specified' where the document is silent.

Agreement:
{agreement_text}

The original workflow is published by Anthropic on GitHub (anthropics/claude-cookbooks). Open it there to install or import it; the prompt above is our own adaptation.

What can go wrong?

  • Check every date and amount against the document; summaries can drop a digit.
  • Scanned leases need good text extraction first.

Our take

Lease and contract abstraction is slow, repetitive and billable, which makes it a good fit for a structured summary that a person then checks. What the notebook adds over a quick 'summarize this' is structure: a fixed list of sections, an explicit 'not specified' for missing terms, and methods for checking quality. The 'not specified' rule matters most, because an abstract that silently skips a missing renewal clause is worse than none. In our dry run on a sample 14-page commercial sublease, our prompt extracted parties, premises, a 36-month term, rent with a 3% annual increase, the deposit, maintenance split and notice addresses, and marked the renewal option as not specified, which was correct. Have someone tick each figure against the page number before the abstract goes into a register. For a portfolio, keep every abstract in the same format so you can compare terms across leases, such as notice periods and renewal dates, in a single table.

Where the time goes back: Abstracting a lease drops from an hour of reading to a check of a structured draft.

FAQ

Can it handle a 60-page lease?
Yes; the notebook shows splitting long documents into chunks, summarizing each and combining them. In a chat assistant with a long context window, a single pass often works.
Is this legal advice?
No. It produces an abstract for a person to check; interpretation stays with a qualified professional.

Source and credit

This playbook is based on work by Anthropic. We summarize it and link to it and write our own adapted prompt.

Original
Summarization guide · anthropics/claude-cookbooks
Creator
Anthropic
Published on
GitHub (anthropics/claude-cookbooks)
Original date
Aug 7, 2024
License
MIT
Originally for
Claude
AI dry run
Oct 20, 2026: passed. Dry-run tested by our AI test agent on sample input. Page/clause cited per figure; missing term marked.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

The original is licensed under the MIT License (Copyright (c) 2023 Anthropic). Modified: our adapted prompt and summary are our own wording; the original is unchanged at the source link.

Are you the creator? Claim or correct this page.

More in Legal

All 12 Legal playbooks →

Related playbooks

LegalPrompt✓ AI dry run

Mark which steps an agent may draft, suggest or never touch

Before an agent joins a business process, have an assistant break the process into its steps and sort each one into three groups (the agent may prepare it, the agent may only suggest and a person decides, or people only), with anything that commits money, signs, certifies or releases confidential information forced into the people-only group and an accountable role named for each.

Credit: Jaime Gracia

Minutes
LegalPrompt✓ AI dry run

Clean up a contract draft before it goes out

Run a mechanical review on a draft agreement and get a list of broken definitions, bad cross-references and precedent leftovers to fix.

Credit: u/Plus-Problem-8575 on r/legaltech

Minutes
LegalWorkflow✓ AI dry run

File a trademark with an assistant guiding each step

Have an assistant walk you through a USPTO trademark application field by field, explain each choice and draft the answers, while you review and submit it yourself.

Credit: Brannon McAllister (@brannonmc)

An afternoon+
Operations & AdminWorkflow✓ AI dry run

Compress two years of curriculum into one

Give an AI the full curriculum for an accelerated class, have it remove overlap, schedule the year, and build tests, worksheets and optional practice games.

Credit: Jon Hegreness (@JonHegreness_AZ)

An afternoon+