Objective
Contract review is finding the clauses that deviate from your playbook. Keyword rules break on paraphrase; a "limitation of liability" can be written a hundred ways. This recipe matches each clause to your playbook risk patterns by meaning, so a reviewer sees the risky and non-standard language first — inside your environment, so privileged text never leaves.
Step 1: A playbook of risk patterns with embeddings
DROP TABLE IF EXISTS clause_playbook;
CREATE TABLE clause_playbook (
rule_id TEXT PRIMARY KEY,
risk TEXT,
pattern TEXT,
emb VECTOR(384)
);
INSERT INTO clause_playbook VALUES
('R-01','uncapped liability',
'The party accepts unlimited liability with no cap on damages for any breach.',
EMBED('The party accepts unlimited liability with no cap on damages for any breach.')),
('R-02','auto-renewal',
'This agreement renews automatically for successive terms unless cancelled in advance.',
EMBED('This agreement renews automatically for successive terms unless cancelled in advance.'));