Uploaded PDF indexes now survive restarts in an atomically replaced durable store (CLAUSELENS_STORE_PATH, mounted by the supplied Compose stack). Extraction rejects oversized and extreme-page-count documents before indexing. Retrieval and final answers remain evidence-first: when no indexed passage clears the relevance threshold, the service refuses to invent an answer.
Open the full-resolution screenshot · Recruiter demo: ingest a PDF, ask a scoped policy question, then inspect citations, control findings and the processing trace.
▶ Watch the recorded working demo (5 seconds)
Deployment status: tested, containerized and ready for an AWS deployment; no public production endpoint is claimed yet.
ClauseLens AI turns policy documents into defensible, cited compliance briefs. Four transparent stages scope retrieval, rank evidence, detect control risks and verify citations. Deterministic local retrieval keeps decisions repeatable and removes model availability from the evidence path.
Traditional document chat can sound certain while using the wrong policy, department or jurisdiction. ClauseLens treats retrieval boundaries and citations as product requirements:
- PDF ingestion with type validation, text extraction, chunking and SHA-256 duplicate protection
- Metadata-scoped retrieval by department and jurisdiction
- Local vector search using deterministic hashed embeddings and cosine similarity
- Evidence-only answers that refuse when retrieval is weak
- Risk findings for privacy, supplier assurance and responsible AI controls
- Visible agent trace showing every decision step
- Production signals through health probes and Prometheus metrics
PDF / seeded policy
│
▼
extract → fingerprint → chunk → metadata index
│
question → Scope Agent → Retrieval Agent → Risk Agent → Citation Guard
│
▼
grounded brief + evidence
This project applies the robust ideas behind production RAG—fingerprinting, chunking, metadata filters, ranked retrieval and grounded generation—without copying a course application or requiring external infrastructure.
Requirements: Java 17 and Maven 3.9+.
mvn spring-boot:runOpen http://localhost:8081.
Useful endpoints:
GET /api/documents— list indexed policiesPOST /api/documents— upload a PDF with optional metadataPOST /api/query— generate an evidence briefGET /actuator/health— health probeGET /actuator/prometheus— metrics
Example:
curl -X POST http://localhost:8081/api/query \
-H "Content-Type: application/json" \
-d '{"question":"Can customer data be sent to a public AI tool?","department":"Engineering","jurisdiction":"Global"}'curl -X POST http://localhost:8081/api/documents \
-F "file=@synthetic-policy.pdf" \
-F "department=Security" \
-F "jurisdiction=EU" \
-F "version=1.0"Uploaded indexes are atomically persisted at CLAUSELENS_STORE_PATH. Production deployments should use an encrypted persistent volume, authenticated ingress and an organizational retention policy.
mvn verifyThe test suite covers metadata isolation, retrieval quality, refusal behavior, risk detection, citations, validation and REST responses.
docker compose up --build- Persistent pgvector adapter behind the existing retrieval interface
- Page-level PDF citations and highlighted evidence
- Version conflict and policy supersession detection
- OPA policy-as-code export
- OpenTelemetry traces for the agent pipeline
- Optional Spring AI provider adapter
ClauseLens AI is an educational decision-support system, not legal advice. Evidence may be incomplete or outdated. A qualified human must review the source policy and applicable law before acting. Never upload credentials, personal data or confidential production documents.
Contributions are welcome. Start with CONTRIBUTING.md and an open issue.
Apache License 2.0.
