Why it was needed
The problem
A contract tool that is right most of the time is useless to a lawyer. One invented clause and the whole product loses their trust.
The challenge was never generating text. It was making the output reliable enough that a professional would put their name under it.
The system
What I built
Retrieval over real contract knowledge
Drafting and analysis run on retrieval, with hybrid Postgres full-text and trigram search, so answers are grounded in source material instead of the model's memory.
Three layers of validation
Every output passes a schema check, then a semantic check. What the checks cannot clear is escalated to a human. Reviewers spend their time on the hard cases, not on proofreading the easy ones.
Drafting and analysis in one place
The same platform writes a new contract from a brief and reviews an existing one, so a team does not need one tool to draft and another to check.
A full product, not a demo
Analysis, generation, accounts and the delivery pipeline on Next.js and GCP, owned from the first commit to production.
Step by step
How it runs
A contract or a brief comes in
The user uploads a contract to review, or describes the agreement they need.
Retrieval grounds the work
Hybrid search pulls the relevant source material, so the model works from text it can point to.
The model drafts or analyses
Output is produced in a fixed structure, not free text.
Schema check
The output has to match the expected structure. Anything malformed is caught here.
Semantic check
A second pass checks meaning, not format: whether the output says what it is supposed to say.
Human escalation, only when needed
What the checks cannot clear goes to a person. Everything else goes straight to the user.
Where the judgment went
The hard parts
Trust is the product
In most software a small error rate is acceptable. In a contract, one invented clause ends the relationship. Every design decision started from that: constrain the output, check it twice, and show a human only what needs a human.
Search that finds the exact clause
Legal text punishes fuzzy matching. Full-text search finds the exact term, trigram search survives typos and variants, and the two together beat either one alone.
What came of it
The outcome
500+users, contracts about 40% faster
- 500+ users.
- Contracts produced about 40% faster.
- Output trustworthy enough for lawyers to sign off on.
