Atris

Review an NDA against the playbook.
Done by an agent. Checked twice.

A verdict on every playbook rule, with each clause that breaks one quoted word for word for a person to decide.

Have Atris do this for you›

1

Real files in

  • nda.md
    A 17 section non-disclosure agreement sent by another company, with eight clauses that break the playbook, one required clause left out and two drafting slips. 79 lines, 6 KB.
  • playbook.md
    A company's written NDA playbook: 16 rules, each marked Must have or Must not have. 90 lines, 4 KB.

Sample data written by Atris. Not a real company.

2

Three steps

  1. 1.Read the playbook and the NDA
  2. 2.Test every playbook rule
  3. 3.Write the flags and the review

Claude Sonnet 5.5, 1 min 2 s. No web. It never saw the check.

3

Checked twice

  • ✓Passed: 16 of 16 playbook rules have exactly one row in flags.csv
  • ✓Passed: 16 of 16 statuses equal the status worked out from the NDA and the playbook
  • ✓Passed: 14 of 14 quotes appear word for word in the NDA
  • ✓Passed: 8 of 8 broken rules name the right section and quote the words that break the rule
  • ✓Passed: review.md names 9 of 9 rules that need a decision (8 broken, 1 missing)
  • ✓Passed: review.md reports 3 of 3 drafting slips found in the NDA (2 spellings of one party name, 1 reference to a section that does not exist)
  • ✓Passed: 2 of 2 quoted passages in review.md that hold a number are found word for word in the NDA or the playbook, with 20 of 20 figures in it found there too
  • ✓Passed: review.md opens by saying it is a first pass for a person to decide and not legal advice

Second review by Claude Opus 5.5: pass.

Then we broke a copy of the output 6 ways on purpose. The check caught 6.

What it wrote. Lines 13 to 21 of review.md, copied from the file.
- P-02 (Section 2): Information is protected only if marked "Confidential", or, if oral, identified as confidential at the time and summarized in a written notice within ten (10) days. Playbook asks: protect any information a reasonable person would understand to be confidential.
- P-03 (Section 3): Lists three exclusions (public, already known, received from a third party). There is none for information the recipient developed independently. Playbook asks: add the missing exclusion.
- P-07 (Section 6): Duties continue for five (5) years after the agreement ends. The longer period for trade secrets is acceptable, but 5 years for everything else is over the 3 year limit. Playbook asks: 3 years after the agreement ends.
- P-09 (Section 8): Either Party may use Residuals (information retained in the unaided memory of the recipient's personnel) for any purpose. Playbook asks: delete the clause.
- P-11 (Section 11): Larkfield may not solicit or hire Brennick employees it dealt with, during the term and for twelve (12) months after. The bar runs one way only, against Larkfield. Playbook asks: delete the clause.
- P-12 (Section 12): The Recipient pays liquidated damages of $250,000 for each breach of Section 4. Playbook asks: delete the fixed sum, and keep the injunction wording if they want it (the injunction sentence in Section 12 is acceptable).
- P-13 (Section 13): Larkfield needs Brennick's written consent to assign, but Brennick (spelled "Brennick System LLC" there) may assign to any affiliate or successor without consent. Playbook asks: the same assignment wording for both parties.
- P-14 (Section 14): Governed by Texas law, with exclusive courts in Travis County, Texas. Playbook asks: Delaware law; New York is acceptable. The playbook says nothing about venue, so the venue is not judged here.
- P-16 (missing): No clause lets the recipient disclose information when a law, court order or regulator requires it. Playbook asks: add a required disclosure clause with prompt notice.

How this was run

An AI agent on Claude Sonnet 5.5 was given a folder with the files below and a three-step flow, and nothing else. It had no web access and never saw the check. The check was written before the run and made stricter after it. It works the answer out again from the input files. Then Claude Opus 5.5 reviewed the result against the inputs. The input files are sample data written by Atris, with the problems a real week has planted in them.

Run 1 of 1 on 1 December 2026. The agent took 1 min 2 s.

What the second review verified

  • All 16 playbook rules appear once in flags.csv, in order. All 14 quotes match the NDA word for word, in the section named (checked with a script).
  • Statuses match a fresh read of the NDA. P-06 is ok because the 'two (2) years' term equals the 2 year limit. P-08 is ok because the 'thirty (30) days' return period equals the 30 day limit. P-07 breaks because the duty lasts 'five (5) years', over the 3 year limit. P-12 breaks because Section 12 sets 'liquidated damages of $250,000'. P-14 breaks because Section 14 picks Texas law. P-16 is missing because the NDA has no clause for disclosure required by law.
  • The counts in review.md are right: 7 ok, 8 breaks and 1 missing, which adds up to 16. All 9 rules marked breaks or missing are listed with their section and what the playbook says to ask for.
  • The drafting slips are complete. Section 13 spells the name 'Brennick System LLC' instead of 'Brennick Systems LLC'. Section 12 refers to 'Section 19', but the NDA only has Sections 1 to 17. The only other section references point to Section 4, which exists.

What this run does not show

  • Each playbook rule is tested by a word pattern written for this kind of clause, so a breach worded in an unusual way could go unseen.
  • The agreement and the playbook are samples with planted problems that are cleaner than a real negotiated draft.
  • The check was made stricter after the run to test quoted words and figures in the review, then the same output was graded again.

Would the check catch a wrong answer?

A check that cannot fail proves nothing. After the run we took a copy of the output, broke it one small way at a time and ran the check again. It caught 6 of 6. The check was made stricter after the first try at this, and the same untouched output was graded again.

Open every file

flow.md · the three steps the agent followed
# Review an NDA against the playbook

function: legal
for: the contracts manager or company lawyer who approves NDAs
goal: Every playbook rule has a verdict on this NDA, and every clause that breaks a rule is quoted word for word, ready for a person to decide.

## 1. Read the playbook and the NDA
Read input/playbook.md and input/nda.md from start to finish. The playbook is the company's own written
rules. Each rule has an id, a type (Must have or Must not have), the rule and what to ask for. The NDA
is the other company's draft. Its clauses are numbered sections. This is a first pass for a person
who decides. Do not give legal advice and do not judge anything the playbook does not cover.

## 2. Test every playbook rule
Give each playbook rule exactly one status:
- For a Must have rule: `ok` when the NDA has words that fully meet the rule. `breaks` when the NDA
  covers the subject but falls short of the rule. `missing` when no clause in the NDA covers the
  subject at all.
- For a Must not have rule: `breaks` when the NDA contains the thing. `ok` when it does not.
A limit written as "no more than" is met by a number equal to the limit. Judge each rule on what the
clause actually does, not on its heading or on a single word that sounds alike.
For every `breaks`, find the section and copy the full sentence that breaks the rule. For every `ok`
on a Must have rule, copy the full sentence that meets it. A quote is one unbroken passage copied
character for character from the NDA, with nothing added, cut or reworded.

## 3. Write the flags and the review
Write output/flags.csv with columns rule_id,status,clause,quote,why. One row per playbook rule, in
playbook order. clause is the section number alone, like 7. quote is the copied passage. why is one
plain sentence that names the number, place or party that decides the status. Leave clause and quote
empty for `missing` and for `ok` on a Must not have rule.
Write output/review.md for the person who decides. The first line must read exactly:
First pass for a person to decide. Not legal advice.
Then give the count of rules with each status. Then one line for every rule that is `breaks` or
`missing`: the rule id, the section, what the NDA says and what the playbook says to ask for. Then a
part called Drafting slips: every party name that is spelled more than one way (give each spelling
and its section) and every reference to a section number that is not in the NDA. Report slips, do
not fix them.

## Done looks like
- Every playbook rule appears once in flags.csv with a status.
- Every quote can be found word for word in the NDA, in the section named.
- review.md lists every rule that needs a decision and every drafting slip.
input/nda.md · 79 lines, 6 KB
# Mutual Non-Disclosure Agreement

This Mutual Non-Disclosure Agreement (the "Agreement") is entered into as of November 16, 2026 (the "Effective Date") between Brennick Systems LLC, a Texas limited liability company with offices at 4100 Calder Row, Austin, Texas ("Brennick"), and Larkfield Analytics, Inc., a Delaware corporation with offices at 77 Tolland Street, Hartford, Connecticut ("Larkfield"). Brennick and Larkfield are each a "Party" and together the "Parties".

## 1. Purpose

The Parties wish to explore a possible business relationship under which Larkfield would provide data analysis services to Brennick (the "Purpose"). In the course of those discussions each Party may disclose Confidential Information to the other.

## 2. Confidential Information

"Confidential Information" means any non-public business, technical or financial information that a Party (the "Discloser") discloses to the other Party (the "Recipient") in connection with the Purpose, provided that the information is marked "Confidential" at the time of disclosure or, if disclosed orally, is identified as confidential at the time of disclosure and summarized in a written notice delivered to the Recipient within ten (10) days.

## 3. Exclusions

Confidential Information does not include information that the Recipient can show by written records: (a) is or becomes generally available to the public other than through a breach of this Agreement; (b) was already lawfully known to the Recipient before the Discloser disclosed it; or (c) was lawfully received from a third party that had no duty of confidentiality to the Discloser.

## 4. Obligations of the Recipient

The Recipient shall (a) use the Confidential Information only for the Purpose; (b) protect it using the same degree of care it uses to protect its own confidential information of a similar kind, and in no event less than reasonable care; and (c) disclose it only to those of its employees, officers and professional advisers who need to know it for the Purpose and who are bound by confidentiality duties at least as protective as those in this Agreement. The Recipient is responsible for any breach of this Agreement by a person to whom it discloses Confidential Information.

## 5. Term

This Agreement begins on the Effective Date and continues for two (2) years, unless a Party ends it earlier by giving thirty (30) days written notice to the other Party. Ending this Agreement does not affect Confidential Information already disclosed.

## 6. Survival

The Recipient's obligations under Section 4 continue for five (5) years after this Agreement expires or is ended. For any Confidential Information that is a trade secret, those obligations continue for as long as the law protects it as a trade secret.

## 7. Return of Materials

Within thirty (30) days after a written request from the Discloser, the Recipient shall return or destroy all Confidential Information in its possession and confirm in writing that it has done so. The Recipient may keep one archival copy to the extent required by law or by its written records retention policy, and that copy remains subject to this Agreement.

## 8. Residual Knowledge

Nothing in this Agreement prevents either Party from using Residuals for any purpose. "Residuals" means information in intangible form that is retained in the unaided memory of the Recipient's personnel who have had access to the Confidential Information.

## 9. No License

All Confidential Information remains the property of the Discloser. Nothing in this Agreement grants the Recipient any license or other right in the Discloser's Confidential Information, patents, copyrights or trademarks, except the limited right to use the Confidential Information for the Purpose.

## 10. No Warranty

All Confidential Information is provided "as is". Neither Party makes any warranty, express or implied, about the accuracy or completeness of its Confidential Information.

## 11. No Solicitation

During the term of this Agreement and for twelve (12) months after it ends, Larkfield shall not solicit for employment or hire any employee of Brennick with whom it had contact in connection with the Purpose.

## 12. Remedies

The Parties agree that a breach of this Agreement may cause harm that money alone cannot repair, and that the Discloser may seek an injunction in addition to any other remedy, as further described in Section 19. In addition, the Recipient shall pay the Discloser liquidated damages of $250,000 for each breach of Section 4, which the Parties agree is a fair estimate of the Discloser's loss.

## 13. Assignment

Larkfield may not assign this Agreement without the prior written consent of Brennick. Brennick System LLC may assign this Agreement to any affiliate or successor without consent.

## 14. Governing Law and Venue

This Agreement is governed by the laws of the State of Texas, without regard to its conflict of laws rules. The Parties submit to the exclusive jurisdiction of the state and federal courts located in Travis County, Texas.

## 15. Notices

Notices under this Agreement must be in writing and sent to the address of the other Party stated above, or to another address that Party has given in writing. A notice sent by a recognized overnight courier is treated as received on the next business day.

## 16. No Obligation to Proceed

Neither Party is obliged to enter into any further agreement with the other. Each Party may end discussions about the Purpose at any time.

## 17. General

This Agreement is the entire agreement between the Parties on its subject and replaces all earlier discussions about it. It may be changed only in a writing signed by both Parties. If a court finds any part of this Agreement unenforceable, the rest remains in effect. A failure to enforce a right under this Agreement is not a waiver of that right. This Agreement may be signed in counterparts, including by electronic signature.

Brennick Systems LLC

By: ______________________  Name: ______________________  Title: ______________________

Larkfield Analytics, Inc.

By: ______________________  Name: ______________________  Title: ______________________
input/playbook.md · 90 lines, 4 KB
# Larkfield Analytics NDA playbook

Version 4, approved by the General Counsel on 2026-08-03. Use this playbook for every NDA sent to us on another company's paper. It tells the reviewer what we accept without asking, and what must go to Legal for a decision.

Each rule is one of two types.

- **Must have**: the NDA has to contain this.
- **Must not have**: the NDA is not allowed to contain this.

A limit written as "no more than" is met by a number equal to the limit.

## P-01 Both sides are protected
Type: Must have
Rule: The NDA protects information disclosed by either party. An NDA that protects only the other company's information breaks this rule.
Ask for: Make the definitions of the discloser and the recipient apply to both parties.

## P-02 No marking requirement
Type: Must not have
Rule: The NDA must not say that information is protected only if it is marked or labeled confidential, or only if spoken information is confirmed in writing afterwards. Our teams share information in calls and will not label it.
Ask for: Protect any information a reasonable person would understand to be confidential.

## P-03 Four standard exclusions
Type: Must have
Rule: The NDA lists all four standard exclusions: (1) information that is public, (2) information the recipient already knew, (3) information the recipient developed independently without using the other party's information, (4) information received lawfully from a third party.
Ask for: Add whichever of the four is not there.

## P-04 Reasonable care
Type: Must have
Rule: The recipient must protect the information with at least reasonable care.
Ask for: Add "and in no event less than reasonable care".

## P-05 Sharing limited to people who need it
Type: Must have
Rule: The recipient may share the information only with its own people and advisers who need to know it and who are bound to keep it confidential.
Ask for: Add a need to know limit.

## P-06 Agreement length
Type: Must have
Rule: The NDA states how long the parties will exchange information, and that period is no more than 2 years.
Ask for: A 2 year term.

## P-07 How long the duty lasts afterwards
Type: Must have
Rule: The NDA states how long the duty to keep information confidential lasts after the agreement ends, and that period is no more than 3 years. A longer period that applies only to trade secrets is acceptable.
Ask for: 3 years after the agreement ends.

## P-08 Return or destruction
Type: Must have
Rule: The discloser can ask for its information to be returned or destroyed, and the recipient has no more than 30 days to do it.
Ask for: Return or destruction within 30 days of a written request.

## P-09 No residuals clause
Type: Must not have
Rule: The NDA must not let a party freely use information that its people remember after seeing the other party's confidential information.
Ask for: Delete the clause.

## P-10 No license
Type: Must have
Rule: The NDA says that it gives the recipient no license or ownership in the discloser's information or intellectual property, beyond using it for the stated purpose.
Ask for: Add a no license clause.

## P-11 No hiring restrictions
Type: Must not have
Rule: The NDA must not stop us from soliciting or hiring the other company's people. Hiring restrictions belong in a services contract, if anywhere.
Ask for: Delete the clause.

## P-12 No fixed damages
Type: Must not have
Rule: The NDA must not set liquidated damages, a penalty or any fixed sum payable for a breach. A clause that lets a party ask a court for an injunction is acceptable.
Ask for: Delete the fixed sum. Keep the injunction wording if they want it.

## P-13 Assignment is even
Type: Must have
Rule: The NDA has an assignment clause that gives both parties the same rights. Either both need consent to assign, or both may assign to a successor. A clause that lets only one party assign freely breaks this rule.
Ask for: The same assignment wording for both parties.

## P-14 Governing law
Type: Must have
Rule: The NDA is governed by the law of Delaware or New York.
Ask for: Delaware law. New York is acceptable.

## P-15 No exclusivity
Type: Must not have
Rule: The NDA must not commit us to deal only with the other company, or stop us from talking to its competitors.
Ask for: Delete the clause.

## P-16 Disclosure required by law
Type: Must have
Rule: The NDA lets the recipient disclose information when a law, a court order or a regulator requires it, after giving the discloser prompt notice where the law allows.
Ask for: Add a required disclosure clause with prompt notice.
output/flags.csv · written by the agent, 17 lines
rule_id,status,clause,quote,why
P-01,ok,2,"""Confidential Information"" means any non-public business, technical or financial information that a Party (the ""Discloser"") discloses to the other Party (the ""Recipient"") in connection with the Purpose, provided that the information is marked ""Confidential"" at the time of disclosure or, if disclosed orally, is identified as confidential at the time of disclosure and summarized in a written notice delivered to the Recipient within ten (10) days.","Section 2 defines Discloser and Recipient as either Party, so both sides are protected."
P-02,breaks,2,"""Confidential Information"" means any non-public business, technical or financial information that a Party (the ""Discloser"") discloses to the other Party (the ""Recipient"") in connection with the Purpose, provided that the information is marked ""Confidential"" at the time of disclosure or, if disclosed orally, is identified as confidential at the time of disclosure and summarized in a written notice delivered to the Recipient within ten (10) days.","Section 2 protects information only if it is marked ""Confidential"" or, if oral, confirmed in a written notice within ten (10) days."
P-03,breaks,3,Confidential Information does not include information that the Recipient can show by written records: (a) is or becomes generally available to the public other than through a breach of this Agreement; (b) was already lawfully known to the Recipient before the Discloser disclosed it; or (c) was lawfully received from a third party that had no duty of confidentiality to the Discloser.,"Section 3 lists only three exclusions (public, already known, third party) and has none for independently developed information."
P-04,ok,4,"The Recipient shall (a) use the Confidential Information only for the Purpose; (b) protect it using the same degree of care it uses to protect its own confidential information of a similar kind, and in no event less than reasonable care; and (c) disclose it only to those of its employees, officers and professional advisers who need to know it for the Purpose and who are bound by confidentiality duties at least as protective as those in this Agreement.","Section 4(b) requires care ""in no event less than reasonable care""."
P-05,ok,4,"The Recipient shall (a) use the Confidential Information only for the Purpose; (b) protect it using the same degree of care it uses to protect its own confidential information of a similar kind, and in no event less than reasonable care; and (c) disclose it only to those of its employees, officers and professional advisers who need to know it for the Purpose and who are bound by confidentiality duties at least as protective as those in this Agreement.","Section 4(c) limits sharing to employees, officers and advisers who need to know and are bound to confidentiality."
P-06,ok,5,"This Agreement begins on the Effective Date and continues for two (2) years, unless a Party ends it earlier by giving thirty (30) days written notice to the other Party.","Section 5 sets a term of two (2) years, which equals the 2 year limit."
P-07,breaks,6,The Recipient's obligations under Section 4 continue for five (5) years after this Agreement expires or is ended.,"Section 6 sets 5 years after the agreement ends for general information, above the 3 year limit; only the trade secret period may be longer."
P-08,ok,7,"Within thirty (30) days after a written request from the Discloser, the Recipient shall return or destroy all Confidential Information in its possession and confirm in writing that it has done so.","Section 7 gives the Recipient thirty (30) days after a written request, which equals the 30 day limit."
P-09,breaks,8,Nothing in this Agreement prevents either Party from using Residuals for any purpose.,Section 8 lets either Party use information retained in the unaided memory of its personnel for any purpose.
P-10,ok,9,"Nothing in this Agreement grants the Recipient any license or other right in the Discloser's Confidential Information, patents, copyrights or trademarks, except the limited right to use the Confidential Information for the Purpose.",Section 9 grants the Recipient no license or other right beyond use for the Purpose.
P-11,breaks,11,"During the term of this Agreement and for twelve (12) months after it ends, Larkfield shall not solicit for employment or hire any employee of Brennick with whom it had contact in connection with the Purpose.",Section 11 bars Larkfield from soliciting or hiring Brennick employees during the term and for 12 months after.
P-12,breaks,12,"In addition, the Recipient shall pay the Discloser liquidated damages of $250,000 for each breach of Section 4, which the Parties agree is a fair estimate of the Discloser's loss.","Section 12 fixes liquidated damages of $250,000 for each breach of Section 4."
P-13,breaks,13,Brennick System LLC may assign this Agreement to any affiliate or successor without consent.,Section 13 requires Larkfield to get Brennick's consent to assign but lets Brennick assign freely.
P-14,breaks,14,"This Agreement is governed by the laws of the State of Texas, without regard to its conflict of laws rules.","Section 14 selects Texas law, not Delaware or New York."
P-15,ok,,,No clause commits Larkfield to deal only with Brennick or bars talks with competitors; Section 16 says neither Party is obliged to enter any further agreement.
P-16,missing,,,"No clause in the NDA lets the Recipient disclose information when a law, court order or regulator requires it."
output/review.md · written by the agent, 42 lines
First pass for a person to decide. Not legal advice.

NDA reviewed: Mutual Non-Disclosure Agreement between Brennick Systems LLC and Larkfield Analytics, Inc., dated November 16, 2026. Playbook: Larkfield Analytics NDA playbook, version 4.

## Counts (16 rules)

- ok: 7 (P-01, P-04, P-05, P-06, P-08, P-10, P-15)
- breaks: 8 (P-02, P-03, P-07, P-09, P-11, P-12, P-13, P-14)
- missing: 1 (P-16)

## Rules that need a decision

- P-02 (Section 2): Information is protected only if marked "Confidential", or, if oral, identified as confidential at the time and summarized in a written notice within ten (10) days. Playbook asks: protect any information a reasonable person would understand to be confidential.
- P-03 (Section 3): Lists three exclusions (public, already known, received from a third party). There is none for information the recipient developed independently. Playbook asks: add the missing exclusion.
- P-07 (Section 6): Duties continue for five (5) years after the agreement ends. The longer period for trade secrets is acceptable, but 5 years for everything else is over the 3 year limit. Playbook asks: 3 years after the agreement ends.
- P-09 (Section 8): Either Party may use Residuals (information retained in the unaided memory of the recipient's personnel) for any purpose. Playbook asks: delete the clause.
- P-11 (Section 11): Larkfield may not solicit or hire Brennick employees it dealt with, during the term and for twelve (12) months after. The bar runs one way only, against Larkfield. Playbook asks: delete the clause.
- P-12 (Section 12): The Recipient pays liquidated damages of $250,000 for each breach of Section 4. Playbook asks: delete the fixed sum, and keep the injunction wording if they want it (the injunction sentence in Section 12 is acceptable).
- P-13 (Section 13): Larkfield needs Brennick's written consent to assign, but Brennick (spelled "Brennick System LLC" there) may assign to any affiliate or successor without consent. Playbook asks: the same assignment wording for both parties.
- P-14 (Section 14): Governed by Texas law, with exclusive courts in Travis County, Texas. Playbook asks: Delaware law; New York is acceptable. The playbook says nothing about venue, so the venue is not judged here.
- P-16 (missing): No clause lets the recipient disclose information when a law, court order or regulator requires it. Playbook asks: add a required disclosure clause with prompt notice.

## Drafting slips

Party names spelled more than one way:
- Brennick Systems LLC: opening paragraph and signature block.
- Brennick System LLC (no "s" on "Systems"): Section 13.

Larkfield Analytics, Inc. is spelled the same way in the opening paragraph and the signature block. The short forms "Brennick" and "Larkfield" are defined terms, not spelling variants.

References to a section number that is not in the NDA:
- Section 12 refers to "Section 19". The NDA has Sections 1 to 17 only. Section 12 says the injunction is "further described in Section 19", and no such text exists.

Other section references (Section 4 in Sections 6 and 12) point to a section that exists.

These slips are reported, not fixed.

## Notes

- P-08 is ok: Section 7 allows 30 days, which meets the limit. Its archival copy exception is not covered by the playbook, so it is not judged here.
- P-15 is ok: no clause commits Larkfield to deal only with Brennick or limits talks with competitors. Section 16 says neither Party must enter any further agreement.
- Quotes for each rule are in flags.csv.
check.py · the check, written before the run
"""Works out each playbook rule's status from the NDA text itself, then compares it with what the agent wrote.

Every rule has a small test below that reads the NDA and returns (status, section number, the words
that decide it). Nothing here is a stored answer: change the NDA and the expected result changes.
"""
import csv, re, sys
from pathlib import Path

root = Path(sys.argv[1]); ok = True
def say(passed, text):
    global ok; ok = ok and passed; print(("PASS " if passed else "FAIL ") + text)
def norm(s):
    s = (s or "").replace("“", '"').replace("”", '"').replace("’", "'").replace("‘", "'")
    return re.sub(r"\s+", " ", s).strip().strip('"').strip()

nda = (root / "input/nda.md").read_text()
playbook = (root / "input/playbook.md").read_text()
rules = re.findall(r"^## (P-\d+) .*\nType: (Must have|Must not have)", playbook, re.M)
parts = re.split(r"^## (\d+)\. .*$", nda, flags=re.M)
sections = {parts[i]: norm(parts[i + 1]) for i in range(1, len(parts), 2)}

def find(pattern):
    """First section whose text matches: (section number, matched words, match object)."""
    for num, body in sections.items():
        m = re.search(pattern, body, re.I)
        if m:
            return num, m.group(0), m
    return None, "", None

def limit(pattern, most):
    num, words, m = find(pattern)
    if not m:
        return "missing", "", ""
    return ("ok" if int(m.group(1)) <= most else "breaks"), num, words

def present_is_ok(pattern):
    num, words, m = find(pattern)
    return ("ok", num, words) if m else ("missing", "", "")

def present_breaks(pattern):
    num, words, m = find(pattern)
    return ("breaks", num, words) if m else ("ok", "", "")

def exclusions():
    num, _, m = find(r"does not include")
    if not m:
        return "missing", "", ""
    body = sections[num]
    four = [r"public", r"already (lawfully )?known|knew", r"independently developed|developed independently", r"third party"]
    got = sum(1 for p in four if re.search(p, body, re.I))
    return ("ok" if got == 4 else "breaks"), num, "does not include"

def mutual():
    num, _, m = find(r'(\w+) Party \(the "Discloser"\) discloses to the other Party')
    if m:
        return "ok", num, m.group(0)
    num, words, m = find(r'\(the "Discloser"\)')
    return ("breaks", num, words) if m else ("missing", "", "")

def assignment():
    num, _, m = find(r"\bassign\b")
    if not m:
        return "missing", "", ""
    body = sections[num]
    one_sided = re.search(r"may not assign", body, re.I) and re.search(r"may assign this Agreement[^.]*without consent", body, re.I)
    return ("breaks" if one_sided else "ok"), num, "assign this Agreement"

def law():
    num, words, m = find(r"governed by the laws of the State of (New York|\w+)")
    if not m:
        return "missing", "", ""
    return ("ok" if m.group(1) in ("Delaware", "New York") else "breaks"), num, "State of " + m.group(1)

tests = {
    "P-01": mutual,
    "P-02": lambda: present_breaks(r"is marked .Confidential."),
    "P-03": exclusions,
    "P-04": lambda: present_is_ok(r"reasonable care"),
    "P-05": lambda: present_is_ok(r"need to know"),
    "P-06": lambda: limit(r"continues for \w+ \((\d+)\) years?", 2),
    "P-07": lambda: limit(r"continue for \w+ \((\d+)\) years? after", 3),
    "P-08": lambda: limit(r"within \w+ \((\d+)\) days after a written request", 30),
    "P-09": lambda: present_breaks(r"Residuals"),
    "P-10": lambda: present_is_ok(r"grants the Recipient any license"),
    "P-11": lambda: present_breaks(r"shall not solicit"),
    "P-12": lambda: present_breaks(r"liquidated damages"),
    "P-13": assignment,
    "P-14": law,
    "P-15": lambda: present_breaks(r"exclusivity|exclusive (dealing|basis|negotiat)|shall not (discuss|negotiate)[^.]* with any (other|competitor)"),
    "P-16": lambda: present_is_ok(r"court order|subpoena|(required|compelled) by (law|a court|a regulator)[^.]* to disclose|disclos\w+ (is |that is )?(required|compelled) by"),
}
want = {rid: tests[rid]() for rid, _ in rules}

path = root / "output/flags.csv"
if not path.exists():
    say(False, "output/flags.csv was not written"); sys.exit(1)
rows = list(csv.DictReader(path.open(newline="")))
got = {}
for r in rows:
    got.setdefault((r.get("rule_id") or "").strip(), []).append(r)
once = sum(1 for rid in want if len(got.get(rid, [])) == 1)
say(once == len(want) and set(got) == set(want), f"{once} of {len(want)} playbook rules have exactly one row in flags.csv")
row = {rid: (got.get(rid) or [{}])[0] for rid in want}

right = sum(1 for rid, (st, _, _) in want.items() if (row[rid].get("status") or "").strip() == st)
say(right == len(want), f"{right} of {len(want)} statuses equal the status worked out from the NDA and the playbook")

whole = norm(nda)
quotes = [(rid, norm(r.get("quote"))) for rid, r in row.items() if norm(r.get("quote"))]
found = sum(1 for _, q in quotes if len(q) >= 20 and q in whole)
say(bool(quotes) and found == len(quotes), f"{found} of {len(quotes)} quotes appear word for word in the NDA")

broken = [rid for rid, (st, _, _) in want.items() if st == "breaks"]
def pinned(rid):
    _, num, words = want[rid]
    q = norm(row[rid].get("quote"))
    clause = "".join(re.findall(r"\d+", row[rid].get("clause") or ""))
    return bool(q) and clause == num and q in sections[num] and norm(words).lower() in q.lower()
hit = sum(1 for rid in broken if pinned(rid))
say(hit == len(broken), f"{hit} of {len(broken)} broken rules name the right section and quote the words that break the rule")

review = (root / "output/review.md").read_text() if (root / "output/review.md").exists() else ""
decide = [rid for rid, (st, _, _) in want.items() if st != "ok"]
named = sum(1 for rid in decide if rid in review)
gone = sum(1 for st, _, _ in want.values() if st == "missing")
say(named == len(decide), f"review.md names {named} of {len(decide)} rules that need a decision ({len(broken)} broken, {gone} missing)")

names = {}
for m in re.finditer(r"Brennick Systems? LLC", nda):
    names[m.group(0)] = names.get(m.group(0), 0) + 1
bad_refs = sorted({"Section " + n for n in re.findall(r"Section (\d+)", nda) if n not in sections})
slips = (list(names) if len(names) > 1 else []) + bad_refs
seen = sum(1 for s in slips if s in review)
say(seen == len(slips), f"review.md reports {seen} of {len(slips)} drafting slips found in the NDA ({len(names)} spellings of one party name, {len(bad_refs)} reference to a section that does not exist)")

# Quoted words in review.md that hold a number must be real, and so must every figure in it.
sources = norm(nda) + " " + norm(playbook)
said = [q for ln in review.splitlines() for q in re.findall(r'"([^"]{3,})"', norm(ln)) if re.search(r"\d", q)]
true = sum(1 for q in said if q.strip(" .,;") in sources)
FIG = r"(?<![\w.-])\d(?:[\d,]*\d)?(?:\.\d+)?(?![\w-])"
known = {x.replace(",", "") for x in re.findall(r"\d[\d,]*(?:\.\d+)?", sources)} | {str(len(want)), str(len(sections))}
figures = [x for x in re.findall(FIG, review) if len(x) >= 2]
real = sum(1 for x in figures if x.replace(",", "") in known)
say(true == len(said) and real == len(figures),
    f"{true} of {len(said)} quoted passages in review.md that hold a number are found word for word in the NDA or the playbook, "
    f"with {real} of {len(figures)} figures in it found there too")

first = next((ln.strip() for ln in review.splitlines() if ln.strip()), "")
say(first == "First pass for a person to decide. Not legal advice.", "review.md opens by saying it is a first pass for a person to decide and not legal advice")
sys.exit(0 if ok else 1)

nda.md: sample data written by Atris. Fingerprint 7fe1a61c1504.

playbook.md: sample data written by Atris. Fingerprint 8e60369391f2.

flags.csv: written by the agent. Fingerprint da954a0d290f.

review.md: written by the agent. Fingerprint 9ae798ef4358.


More contracts and compliance work, and every other desk job

For agentsGitHub
What is AtrisBlogApp StorePricingPrivacyTerms