AI Conflict Check for Law Firms in 90 Lines
A conflict check that normalizes names, pulls every matter that shares one with the new intake, and has Claude explain each hit under Model Rules 1.7, 1.9 and 1.10. The code runs to about 90 lines, and a lawyer still makes every call.
An AI-assisted conflict check normalizes names, pulls every past matter that shares a name with the new intake, and asks a model to explain each hit against Model Rules 1.7, 1.9 and 1.10. The model never clears a candidate. A lawyer reviews every hit and makes the conflict and waiver decisions.
A conflict check compares the people and companies in a new matter with every matter the firm has handled. The comments to Rule 1.7 put the duty this way: "To determine whether a conflict of interest exists, a lawyer should adopt reasonable procedures, appropriate for the size and type of firm and practice, to determine in both litigation and non-litigation matters the persons and issues involved."
An AI step fits inside that procedure in two places. It widens the name search so spelling differences don't hide a match, and it writes a short explanation for each hit so the reviewing lawyer starts from evidence. The decision on whether a conflict exists, and whether it can be waived, stays with a lawyer.
What the check has to find
Every state has its own version of the ABA Model Rules. The quotes here come from the North Carolina State Bar's published text, which keeps the Model Rules' numbering. Check your own state's wording before you set the review categories.
- Current clients (Rule 1.7): a lawyer may not take a matter directly adverse to a current client without that client's informed consent, even when the two matters have nothing to do with each other (comment [6]). A conflict also exists when the work could be materially limited by duties to another client, a former client, a third person or the lawyer's own interest. Paragraph (b) allows the representation only if the lawyer reasonably believes competent and diligent representation is possible, the law doesn't prohibit it, it doesn't involve one client's claim against another in the same proceeding, and each affected client gives informed consent, confirmed in writing.
- Former clients (Rule 1.9): a lawyer who represented a client may not later represent someone else "in the same or a substantially related matter" whose interests are materially adverse to the former client, unless the former client gives informed consent, confirmed in writing. Comment [3] says matters are substantially related if they involve the same transaction or legal dispute, or if there is a substantial risk that confidential information normally obtained in the earlier matter would materially advance the new client's position.
- Everyone in the firm (Rule 1.10): while lawyers are associated in a firm, none of them may knowingly take a matter that any one of them, practicing alone, would be barred from under Rule 1.7 or 1.9. The exceptions for personal-interest conflicts and for screening a lawyer who joins from another firm differ from state to state.
- Affiliates: comment [34] to Rule 1.7 says a lawyer who represents a corporation "does not, by virtue of that representation, necessarily represent any constituent or affiliated organization, such as a parent or subsidiary." A hit on a parent or subsidiary is a question for a lawyer, never an automatic answer either way.
Where a plain name search falls short
A basic conflict search matches text. It finds "Acme Corporation" when you type "Acme Corporation." It can miss "ACME Corp.", "John A. Smith" when the intake says "John Smith", "Bob Lee" when the old matter says "Robert Lee", and the same company appearing as an adverse party in one matter and a client affiliate in another. Each of those is a person or company the rules care about.
The build
The code below has four parts: name normalization, candidate search, an assessment from Claude for each candidate, and a ranked report. It leaves out the query that exports matters from your system, which depends on the product your firm runs. The export needs each matter's ID, title, status, practice area and every party with a role.
import Anthropic from "@anthropic-ai/sdk";
import { zodOutputFormat } from "@anthropic-ai/sdk/helpers/zod";
import { z } from "zod";
const client = new Anthropic();
type Party = { name: string; role: "client" | "adverse" | "affiliate" | "individual" };
type Matter = { id: string; title: string; status: "open" | "closed"; area: string; parties: Party[] };
type Intake = {
prospect: string;
aliases: string[];
adverseParties: string[];
affiliates: string[];
individuals: string[];
area: string;
summary: string;
};
// 1. Normalize names so "ACME Corp." and "Acme Corporation" compare as "acme".
const ENTITY_WORDS = new Set(["the", "inc", "incorporated", "corp", "corporation", "co", "company", "llc", "ltd", "limited", "lp", "llp", "plc"]);
const SUFFIXES = new Set(["jr", "sr", "ii", "iii", "iv"]);
const NICKNAMES: Record<string, string> = { bob: "robert", bill: "william", jim: "james", liz: "elizabeth", kate: "katherine" };
export function normalizeName(raw: string): string {
return raw
.toLowerCase()
.replace(/&/g, " and ")
.replace(/[^a-z0-9 ]/g, " ")
.split(/\s+/)
.filter((w) => w.length > 1 && !ENTITY_WORDS.has(w) && !SUFFIXES.has(w))
.map((w) => NICKNAMES[w] ?? w)
.join(" ");
}
function overlaps(a: string, b: string): boolean {
const ta = new Set(a.split(" "));
const shared = b.split(" ").filter((t) => ta.has(t)).length;
return shared > 0 && shared >= Math.min(2, ta.size);
}
// 2. Pull every matter that shares a normalized name with anyone on the intake.
export function findCandidates(intake: Intake, matters: Matter[]): Matter[] {
const names = [intake.prospect, ...intake.aliases, ...intake.adverseParties, ...intake.affiliates, ...intake.individuals]
.map(normalizeName)
.filter(Boolean);
return matters.filter((m) => m.parties.some((p) => names.some((n) => overlaps(n, normalizeName(p.name)))));
}
// 3. Ask Claude to explain each candidate. It never clears one.
const Assessment = z.object({
same_party: z.enum(["likely", "possible", "unlikely"]),
issue: z.enum(["current_client_adverse", "former_client_related", "affiliate_of_client", "personal_interest", "none_found"]),
rule_to_review: z.enum(["1.7", "1.9", "1.10", "none"]),
evidence: z.string(),
questions_for_reviewer: z.array(z.string()),
});
const SYSTEM = `You help a law firm's conflicts team triage one possible conflict.
You do not decide whether a conflict exists or whether it can be waived. A lawyer does.
Compare the new intake with the existing matter. Say how likely the names refer to the same
person or entity, which issue a lawyer should review under Rules 1.7, 1.9 or 1.10, and quote
the fields that support it. If the records show no link, return none_found and say why.`;
async function assess(intake: Intake, matter: Matter) {
const response = await client.messages.parse({
model: "claude-opus-5-5",
max_tokens: 16000,
output_config: { effort: "medium", format: zodOutputFormat(Assessment) },
system: SYSTEM,
messages: [{ role: "user", content: JSON.stringify({ intake, matter }) }],
});
return response.parsed_output; // null if the model refused or the output did not parse
}
// 4. Build the report. Every candidate stays on it, ranked for the reviewer.
export async function runConflictCheck(intake: Intake, matters: Matter[]) {
const order = { likely: 0, possible: 1, unlikely: 2 };
const rows = await Promise.all(
findCandidates(intake, matters).map(async (matter) => {
const assessment = await assess(intake, matter);
return { matter, assessment, rank: assessment ? order[assessment.same_party] : -1 };
}),
);
return rows.sort((a, b) => a.rank - b.rank);
}That is 85 lines. A few choices in it matter more than the line count.
The normalizer drops entity words, punctuation, suffixes such as "Jr." and single letters, so middle initials stop blocking a match. Its nickname table is a starting list. Add the names that show up in your own records.
The candidate search errs toward too many hits. A reviewer can dismiss a weak hit quickly, while a matter the search never returned gets no review at all.
The assessment uses structured outputs. Anthropic's documentation describes messages.parse with zodOutputFormat, which sends the schema in output_config.format and returns the validated result in parsed_output. When the model declines or the output fails to parse, parsed_output is null, and the report puts that matter at the top for a person to read in full.
The model's output only ever adds reasons to look at a matter. Every candidate the search found stays on the report, including the ones marked "unlikely", and the reviewer signs off on the full list.
Parents and subsidiaries
Many corporate links come from ownership, which a name search can't see. For public companies, Regulation S-K Item 601(b)(21) requires the annual report to list subsidiaries with their jurisdiction and the names they do business under, though subsidiaries that together would not be significant can be left off. Use that exhibit as a hint and ask about parents, subsidiaries and trade names at intake. A paralegal confirms the relationship before the matter clears. Under comment [34], an affiliate hit still goes to a lawyer to decide whether the affiliate counts as the client.
Protecting client information
The State Bar of California's generative AI guidance says a lawyer "must not input any confidential information of the client into a generative AI solution that may present material risks to confidentiality or security, absent informed client consent." It also says reasonable efforts take "more than reliance on generalized marketing assurances," such as reading the terms of use, the privacy policy and the vendor's documentation.
For this build, that means reading the terms for the API account you use. Anthropic's commercial terms say Anthropic "may not train models on Customer Content from Services." Keep the payload small as well. The check needs names, roles, practice area and a one-line description of the matter. The facts of the dispute can stay in your system.
Generative AI and the ABA Model Rules covers the competence and supervision duties that apply to the rest of the firm's AI use, and AI intake automation for law firms covers the intake form that feeds this check.
Rolling it out
Run the new check next to your current search on every new matter for a few weeks. For each intake, keep both candidate lists and note every matter the new list found that the old one missed, and every hit the reviewer dismissed. Use the dismissals to tune the nickname table and the entity words, and the new finds to show the risk partner what the change adds.
Once the reviewer trusts the report, it can replace the manual cross-referencing. Conflict decisions, waiver letters and screening memos stay with the lawyers who sign them.
Sources
- North Carolina State Bar, Rule 1.7 Conflict of Interest: Current Clients, with comments [3], [6] and [34] (checked 2026-12-02)
- North Carolina State Bar, Rule 1.9 Duties to Former Clients (checked 2026-12-02)
- North Carolina State Bar, Rule 1.10 Imputation of Conflicts of Interest: General Rule (checked 2026-12-02)
- State Bar of California, Practical Guidance for the Use of Generative Artificial Intelligence in the Practice of Law (duty of confidentiality) (checked 2026-12-02)
- Anthropic, Structured outputs (output_config.format, messages.parse and zodOutputFormat) (checked 2026-12-02)
- Anthropic, Commercial Terms of Service, section B (no training on Customer Content) (checked 2026-12-02)
- 17 CFR 229.601(b)(21), Regulation S-K exhibit listing a registrant's subsidiaries (LII) (checked 2026-12-02)
Get the next one.
Field notes from real deployments, written the way this one was. No schedule promised and nothing sold to you. Unsubscribe whenever.
Let's build yours.
Reading is the easy part. We do the work. Tell us what's broken and we'll tell you straight up whether we can help.
let's talk
