CoachDiscoverMapCompareSavedAI LearningAI WeeklyAbout
← Back to library
Guide 03 · Advanced

Compound Queries and Metadata-Augmented AI

Once metadata is in place, you can layer filters, ask compound questions, and run business-intelligence queries against a document library. This is where AI stops feeling like chat and starts feeling like a database.

Takeaway 01
Compound queries chain a "define the universe" filter with an "analyze across it" read.
Takeaway 02
Dates buried in document text are unreliable; pre-extracted date columns are not.
Takeaway 03
Metadata-augmented AI knows the shape of your library before reading a single word.

Compound Queries — Define, Then Analyze

"Among all high-risk contracts, what percentage include indemnification clauses?" That single sentence is two problems in sequence: first define the universe (high-risk contracts), then analyze across it (count which include the clause). Standard chat AI tools fall down at the seam.

Without metadata you can't define the universe reliably — so the analysis runs on a wrong or partial set. Metadata locks the universe, so the analysis runs on the right documents every time.

In the demo the AI finds the 8 high-risk contracts via the metadata column, then reads those eight documents for indemnification language and calculates 7 out of 8. The result is repeatable and auditable — a real business-intelligence query against the library.

A common reflex is to write one giant prompt asking the AI to "find and analyze." It almost always fails on either side of the seam — picking the wrong universe or analyzing inconsistently. The two-step structure isn't pedantry; it's the whole reliability story.

Why Dates in Text Are a Trap

Ask "retrieve all joint venture agreements signed in Q4 of 2019" and you've combined a type filter and a date filter. The type filter is easy. The date filter is the problem in standard RAG.

Dates inside documents appear in every format imaginable — European, US, day-month-year, weekday-month-year, fiscal quarter. AI parsing them on the fly is noisy. A pre-extracted date column is exact.

Extraction at upload normalizes the date into a real date column. The query then becomes type = "JV" AND signed_date IN Q4 2019 — two filters, instant answer. No locale guessing, no missed formats, no contract slipping past because someone wrote "Q4 19" instead of "December 2019".

Where Standard RAG Falls Down

Standard retrieval-augmented generation (RAG) embeds chunks and pulls the most similar ones for each question. It's great for "explain X" but fragile for "filter by Y." Counts, aggregates, date math, negation, and compound conditions all break the pattern.

RAG is conceptual lookup. Metadata is structured filtering. Mature systems use both — RAG to read deeply within a small set, metadata to choose the set.

Without metadata, RAG has to guess which chunks to retrieve and may miss documents entirely because nothing in their text matches the query phrasing. With metadata, the universe is fixed first, then RAG reads only within it. Hit rates climb, hallucinations drop.

"Just put it all in the model context" is a tempting answer when context windows are large. It still hits scale, consistency, and cost problems — and worse, it gives no audit trail. Metadata-augmented retrieval is reproducible; one-shot whole-library prompts are not.

Metadata-Augmented AI — Knowing the Shape

The narrator's framing: regular AI reads documents and hopes to find the right ones. Metadata-augmented AI knows the shape of the library before reading a single word — how many documents exist, how they're classified, when they were executed, what risk they carry.

Do the extraction once. Build the shape. Every question afterwards can filter or aggregate against it. The foundation runs forever.

That's what makes the system reliable enough to act on in production. Legal, compliance, procurement, finance — any team that needs defensible answers gets them. Not because the AI is smarter, but because the AI is finally working against a structured representation of the library instead of a pile of text.

Flashcards — Advanced
03 · Advanced
Compound Query
tap to reveal →
A two-step query that first defines the universe via metadata (e.g. "high-risk contracts"), then analyzes within it (e.g. "how many include indemnification?").
← tap to flip back
03 · Advanced
Date Filter Problem
tap to reveal →
The failure mode where dates buried inside document text are formatted inconsistently. Extraction normalizes them into a real date column so filters become exact.
← tap to flip back
03 · Advanced
Standard RAG
tap to reveal →
Retrieval-augmented generation that pulls similar chunks for each question. Strong for conceptual lookup; weak for counts, dates, negation, and filtered aggregates.
← tap to flip back
03 · Advanced
Metadata-Augmented AI
tap to reveal →
AI that knows the shape of the library before reading any document — counts, classifications, dates, risks — because metadata was extracted once and now lives in columns.
← tap to flip back