-
-
Analyze contract text directly in ClauseGuard and receive evidence-backed risk findings, explanations, and actionable obligations.
-
Upload a PDF contract and let ClauseGuard extract, analyze, and verify risky clauses against the original document evidence.
-
ClauseGuard’s landing page introduces the evidence-first approach to AI-powered contract risk analysis.
Inspiration
Contracts contain important obligations, deadlines, restrictions, and risk clauses, but finding the terms that actually require attention can take significant time.
We wanted to build something more useful than a generic AI contract summarizer.
The key question became:
If AI flags a risky clause, how can we verify that the finding is actually supported by the original contract?
That question led to ClauseGuard — an evidence-first contract analysis tool that combines AI-assisted interpretation with deterministic source verification.
Instead of simply asking an AI model to summarize a contract, ClauseGuard asks the model to identify potential risks, obligations, and deadlines, then verifies the supporting evidence against the original contract text before presenting the finding as verified.
Our guiding principle became:
AI proposes. Deterministic verification checks. ClauseGuard presents verified findings.
What it does
ClauseGuard turns a contract into a structured, evidence-focused review report.
Users can provide:
- DOCX
- TXT
- Pasted text
The current prototype focuses on five contract risk categories:
- Automatic renewal
- Termination
- Payment
- Liability & indemnification
- Data & privacy
It also extracts contractual obligations and deadlines, helping separate potential risks from actions that the contract actually requires someone to perform.
The core workflow
Contract
↓
Document Extraction
↓
AI Analysis
↓
Structured Findings
↓
Zod Validation
↓
Deterministic Evidence Verification
↓
Verified Risk Report
Every verified finding contains:
- Risk severity
- Contract section
- Exact source evidence
- Plain-language explanation
- Suggested review action
The most important part is the verification layer.
If the AI produces a finding whose cited evidence cannot be matched to the original contract text, ClauseGuard rejects that finding from the verified results instead of presenting unsupported text as verified evidence.
This creates a clear boundary between AI interpretation and source-grounded verification.
AI proposes → deterministic verification checks → UI presents verified findings.
ClauseGuard is designed as an informational contract-analysis tool, not a replacement for qualified legal advice.
How we built it
ClauseGuard was built as a full-stack Next.js application using:
- Next.js 16
- React 19
- TypeScript
- Tailwind CSS
- OpenAI Responses API
- Zod
- pdf-parse
- Mammoth
- Node.js
- Vercel
The frontend provides a focused interface for analyzing pasted contracts and uploaded documents.
Document processing
Different input formats are converted into source text before entering the same analysis pipeline:
- PDFs are extracted with
pdf-parse - DOCX files are converted to raw text with
Mammoth - TXT files are read directly
- Pasted contracts are analyzed directly
The extracted contract text is then sent to the OpenAI Responses API with a strict structured output schema.
The AI is required to return structured information including:
- Overall risk
- Summary
- Findings
- Severity
- Contract section
- Evidence
- Explanation
- Suggested action
- Obligations
- Deadlines
We use Zod to validate the returned structure before the results reach the verification layer.
Deterministic evidence verification
After schema validation, ClauseGuard performs a separate verification step.
For each finding:
AI-generated evidence
↓
Normalize evidence
↓
Normalize original source
↓
Case-insensitive source matching
↓
Evidence found?
┌────┴────┐
YES NO
↓ ↓
Verified Rejected
The verification step does not use another AI model.
It directly checks whether the cited evidence can be located in the supplied source text.
This means the AI does not have unrestricted authority over what ultimately appears as a verified finding in the report.
The application also validates supported file types, upload size, minimum source text length, structured AI output, and source evidence.
Challenges we ran into
1. Making AI output traceable
The biggest challenge was preventing the model from producing plausible-sounding findings that were not actually supported by the contract.
An LLM can generate a convincing explanation even when the underlying statement is not present in the source.
For a legal-document workflow, that creates a fundamental trust problem:
Where exactly did the AI get this finding from?
We addressed this by separating AI reasoning from evidence verification.
The model can propose a finding, but the application independently checks whether its cited evidence exists in the original source before presenting it as verified.
2. Supporting multiple document formats
PDF, DOCX, TXT, and pasted text have different ingestion paths.
Rather than building separate analysis systems for each format, we designed the backend around a common source-text pipeline:
PDF / DOCX / TXT / Text
↓
Source Text
↓
Common AI Pipeline
↓
Common Verification
This keeps document ingestion separate from analysis and makes the system easier to extend.
3. Making structured AI output reliable
Free-form model responses are difficult for a frontend to consume consistently.
We therefore constrained the AI to a structured schema and validated the result with Zod before allowing it into the rest of the application.
This gave us a predictable contract between the AI layer, verification layer, and UI.
4. Keeping the scope focused
We deliberately avoided trying to build an “AI lawyer” or a massive legal knowledge platform during the hackathon.
Instead, we focused on one concrete workflow:
Evidence-backed contract risk detection and obligation tracking.
That constraint helped us build a complete working prototype rather than a collection of disconnected features.
Accomplishments that we're proud of
We are proud that ClauseGuard goes beyond simple contract summarization and demonstrates a complete working pipeline:
Document
↓
Extraction
↓
AI Analysis
↓
Schema Validation
↓
Evidence Verification
↓
Human-readable Report
Key accomplishments include:
- Built a working full-stack contract analysis application
- Added PDF, DOCX, TXT, and pasted-text support
- Implemented structured AI contract analysis
- Added five focused contract risk categories
- Added risk severity classification
- Added obligation and deadline extraction
- Implemented deterministic source-evidence verification
- Added rejected-finding tracking
- Built an evidence-focused results interface
- Added structured AI output validation
- Deployed the application for live use
Most importantly, the system is built around a simple principle:
A finding is only presented as verified when its cited evidence can be traced back to the original contract text.
What we learned
Building ClauseGuard reinforced an important lesson:
Adding AI to a workflow is not the same as making the workflow trustworthy.
For applications that work with important documents, the surrounding system matters just as much as the model.
We learned how to combine:
- Probabilistic LLM interpretation
- Structured JSON output
- Runtime schema validation
- Deterministic source verification
- Human-readable evidence presentation
We also learned that giving an AI system more authority is not always the best architecture.
A more controllable approach can be:
AI generates useful candidates
↓
Deterministic software validates them
↓
Human reviews the supporting evidence
This became the central design philosophy behind ClauseGuard:
Use AI for interpretation, but keep critical verification in deterministic software.
What's next for ClauseGuard
The next step is to expand ClauseGuard's document-analysis and verification capabilities while keeping the evidence-first architecture intact.
Potential improvements include:
- More contract risk categories
- Stronger clause and section mapping
- Visual highlighting of source clauses
- Better handling of complex document structures
- Exportable risk reports
- Contract comparison and version tracking
- More detailed obligation timelines
- Additional deterministic validation rules
- OCR support for scanned documents
- Support for larger and more complex agreements
The long-term goal is not simply to generate more AI output.
It is to make contract analysis more transparent, traceable, and easier for a human reviewer to inspect.
Built for LexHack 2026
ClauseGuard was built for LexHack 2026, focused on:
AI × Law × Civic Technology
The project combines legal-document automation with an AI safety principle: generated findings should have a visible path back to their source evidence.
Rather than positioning AI as a replacement for legal professionals, ClauseGuard focuses on improving the first-pass contract review workflow and giving human reviewers clearer evidence to inspect.
Final Thought
The central idea behind ClauseGuard is simple:
Don't just ask AI what your contract says. See exactly why it flagged it.
ClauseGuard — Evidence-first contract analysis.
Built With
- ai
- analysis
- api
- contract
- css
- generative
- legaltech
- mammoth
- next.js
- node.js
- openai
- pdf-parse
- react
- tailwind
- typescript
- vercel
- zod