All projects
Live

DocIQ

Ask any question about any document — get answers with exact citations from the text

Built in 4 hours
Next.jsAnthropic ClaudeDocument AITypeScriptStreaming

No server-side document storage

Exact citation requirement

3 sample document types

4-hour build time

01The Problem

Legal professionals spend hours manually reviewing documents to find the clause that answers a client question. Legal AI tools like Harvey AI cost thousands per month and require firm-wide deployment. The core intelligence loop — document text + question → cited answer — can be shipped in a day.

02The Approach

Built a two-panel interface: document on the left (paste text or load a sample), streaming chat on the right. The full document text is passed as context in every request — no chunking or vector retrieval for the demo size. Claude is instructed to answer only from the document and include exact quotes.

03Architecture Decisions

Full context window approach

For documents under ~100k characters, passing the full text in the system prompt is more reliable than RAG. No risk of missing a relevant clause because it wasn't in the top-5 retrieved chunks. Claude's large context window makes this practical.

Citation-enforced responses

The system prompt explicitly requires exact quotes from the document in every answer. This means every factual claim can be verified against the source — essential for legal and compliance use cases where accuracy is non-negotiable.

Privacy-first: no server-side document storage

Document text is sent in each request and never persisted server-side. Session ends, data disappears. Critical for legal documents where confidentiality requirements prohibit storing client data on third-party servers.

Three sample documents for immediate demo

An employment contract, a research paper abstract, and a product requirements doc let visitors try the tool immediately without needing their own document. The samples cover the three most common use cases.

04Key Insight

The instruction 'if the document doesn't contain the answer, say so clearly — don't speculate' sounds obvious but is the most important line in the prompt. Without it, models will synthesize plausible-sounding answers from their general knowledge. In document Q&A, that's actively harmful — the user needs to know what the document says, not what Claude knows.

05Why It Matters

A direct demo of the capability set Clio's Enterprise AI team builds at scale — document intelligence, citation-required responses, and privacy-first architecture. Builds something for an interview rather than describing what you could build.