More

Book a free call
Fixed price in writing before we start

Contract review against your playbook: clause by clause, with a gate for the lawyer

A contract lands in a folder, Claude extracts the clauses, an agent assesses each one against your negotiating positions, and code computes the verdict. While writing this up we found a bug in the published version that dropped two of every three assessments. We describe it here along with the fix.

Author

Published:
Last verified:
n8n version:
2.8.4

In short

What it does

  • Picks up a new contract from a Google Drive folder
  • Extracts clauses with a key sentence quoted word for word
  • Assesses each clause against your playbook and hard limits
  • Computes the verdict in code: a hard limit always means do not sign
  • Sends risky contracts to a reviewer and logs the result to a sheet

What it does not do

  • Is not legal advice and does not judge legal compliance
  • Cannot see dependencies between clauses
  • Does not read poor-quality scans reliably
  • Does not negotiate or send redlines

What it needs

  • n8n with LangChain nodes (tested on 2.8.4)
  • Google Drive and Google Sheets
  • An Anthropic API key
  • Your playbook and list of hard limits

Contract review against your playbook: clause by clause, with a gate for the lawyer

Most contracts a small company signs are variants of a few familiar templates. A lawyer reads them end to end, even though the risk usually sits in three places: the liability cap, data rights and termination terms. This n8n workflow does the first read against your playbook and puts in front of the lawyer only what departs from it.

Workflow canvas for contract review: downloading from Google Drive, extracting clauses, assessing each clause with an agent, the reviewer decision gate and writing to a sheet
Clauses are assessed one by one in a loop. Only a contract above the risk threshold goes to the reviewer.

Clause extraction: a word-for-word quote

The file from Google Drive goes to the Anthropic API as a PDF. The first call judges nothing; it only splits the contract into clauses. Each one gets a topic, a summary and one key sentence copied exactly from the document. That sentence is what the lawyer checks against the original.

If the response cannot be parsed or contains no clauses, the run fails on purpose:

silently continuing would produce an empty "no issues found" report — the most dangerous possible output for a contract review.

Assessment: one clause, one playbook

An agent assesses the clauses one at a time. It gets a description of our side of the contract, the playbook (for example: the supplier's liability cap is at least 12 months of fees, our data comes back to us in a usable format) and the hard limits, the things we never accept. It returns a position (matches_playbook, off_playbook, missing_protection and others), a severity and a concrete redline.

Two prompt rules do the most work: a missing protection the playbook requires is a finding, not an acceptable state, and the agent never claims something is legally compliant.

Code computes the verdict

collate-clause-findings.js
if (hardLimitBreaches.length) verdict = 'DO_NOT_SIGN';
else if (worst >= 4) verdict = 'DO_NOT_SIGN';
else if (worst === 3) verdict = 'NEGOTIATE_BEFORE_SIGNING';
else if (worst === 2) verdict = 'SIGN_WITH_NOTED_RISKS';
else verdict = 'CLEAN';

A hard-limit breach decides the outcome regardless of how the individual clause was scored. Anything other than CLEAN goes to a reviewer with three links: proceed, send for redlining, reject. If the decision does not arrive in a readable form, the workflow takes the cautious option, redlining.

The bug we found while writing this

We checked it on the loop with five clauses, the third of them a blocker. The agent's assessment was replaced with a fixed one, so the result depended only on the loop logic.

VersionClauses assessedVerdict
batches of 3 (published)2 of 5 (C1, C4)CLEAN
one clause per pass (fix)5 of 5DO_NOT_SIGN

The old version happened to lose the blocking clause and called the contract clean. The fix processes one clause per loop pass and removes the batch size setting. Run time does not change, because the agent assessed clauses one by one anyway. The fixed version is waiting for re-review in the n8n library.

Limitations

This is not legal advice. The verdict is a first-pass triage for a lawyer, not a replacement.

The agent sees one clause at a time. If the liability cap is defined in the definitions section at the start, the assessment of the liability clause may miss it.

Clause extraction has an 8,000-token response limit. With a very long contract the list may be cut off and the run ends with a parse error.

Decision links have no login, and chat apps may open them to build previews. Turn off link previews in the channel that receives these messages.

When it does not make sense

With a few contracts a year, the lawyer will read them in full anyway. The workflow makes sense with dozens of contracts, most on the other party's paper, and written-down negotiating positions. It is one of the three workflows we used to describe boundaries between agents. When review should run inside your document flow, with permissions and history, that is an AI process automation project.

How to cite this

Adrian Hunia (2026). Contract review against your playbook: clause by clause, with a gate for the lawyer. SEVENEDGE. https://sevenedge.pl/en/workflows/przeglad-umow-playbook-ai (accessed: November 5, 2026)

Sources

  1. Claude docs — PDF supportAPI docs
  2. n8n docs — AI Agentn8n docs
  3. n8n docs — Waitn8n docs

Who is behind this

Adrian Hunia

Co-founder of SEVENEDGE

Co-founder of SEVENEDGE. Designs and deploys business systems for small companies, from production management to time tracking. Works with Next.js, FastAPI and PostgreSQL. SEVENEDGE has no subcontractors — both owners write the code.

Related documents

Other workflows we documented the same way.

7SVENAI assistant, not a human

You are chatting with an AI assistant. Replies are generated by artificial intelligence (Cerebras) and may contain mistakes. Please do not share sensitive data in the chat.

Your personal data is controlled by SEVENEDGE ADRIAN HUNIA. We use your chat messages to answer your questions and, if you ask, to book a meeting. Details and your rights: Privacy policy.

Hi! I'm SVEN, the SEVENEDGE AI assistant. We build apps, SaaS and AI automations. How can I help?
SVEN, the SEVENEDGE mascot, looking through a requestSVEN, the SEVENEDGE mascot, thinking over a coffeeSVEN, the SEVENEDGE mascot, working at a laptop
Got an app idea?