Logo
Case study
Compliance advisory · Document search

From digging through folders to just asking

How a compliance advisory firm went from searching folders to asking a chat assistant that reads around every match, in three months.

18 → 5Minutes a question, by hand vs assisted
62 hrsReclaimed each month by month 3
+$5,137Net monthly gain by month 3

01 At a glance

The short version

A compliance advisory firm wanted quick answers it could check from its own documents. We set up a chat assistant that reads each match together with the text around it.

The client

Compliance advisory firm

About 35 people, 8 of them advisers. They hold around 1,200 PDFs of policies, contracts and regulator guidance.

The pain

Slow, risky document searches

Finding the right clause took about 18 minutes. A clause read on its own often gave the wrong answer.

The solution

A chat assistant that reads around

It finds the best passage, adds the paragraphs either side, and answers with the document title.

The outcome

62 hours a month back

By month 3, research time dropped to 5 minutes a question, delivering $5,270 in reclaimed fee-earner time each month.

The shift

Before: advisers search folders, read one hit on its own and answer from memory. After: they ask in plain words and get an answer built from the match and the text around it, with the source named.

02 The pain

Finding the clause
takes longer than using it

The answer is nearly always in a document the firm already holds. The slow part is finding the right paragraph, and the paragraphs around it.

01

Search finds words, not meaning

Advisers type a term into the folder search and get hundreds of hits. The wording in the question rarely matches the wording in the policy.

02

One clause, read alone, misleads

A clause often depends on a definition three paragraphs up or an exception three paragraphs down. The hit alone gives the wrong answer.

03

Knowledge sits with a few people

Two senior advisers know where things live. Everyone else interrupts them, which slows both sides.

04

Answers are hard to check

An answer from memory has no source attached. Checking it later means starting the search again.

The real cost. Eight advisers asking about 10 questions a week is 320 questions a month. At 18 minutes each, that is 96 hours of finding passages. That is 12 hours per adviser, about a day and a half each.

03 The solution

A chat assistant that
reads around the answer

The assistant, built in n8n, works like a fast colleague who has read every document in the folder. It finds the right passage, reads the paragraphs around it, and answers with the title of the document it used.

Step 1 · Load

Advisers drop PDFs into a shared folder. The system reads each one, cuts it into small pieces and files them in a search index.

Step 2 · Search and widen

An adviser asks a question in plain words. The system finds the best matching piece, then adds the two pieces before it and the two after it.

Step 3 · Answer with a source

The assistant reads that block and answers in plain words. It names the document it used, so the adviser can check it.

Adviser's questiontyped in plain words Search and widenmatch, 2 before, 2 after Answer with sourcedocument title named

Human review stayed in

Every answer names its source document. The adviser opens it and confirms the wording before anything reaches a client. The assistant does not send anything to a client itself.

04 Implementation

What we set up,
and what it gave the team

Documents go in first, then the search, then the chat. Each part has one job.

PartWhat it gave the team
Drive folderAdvisers drop in a PDF. The system checks the folder every minute and picks up anything new.
PDF readerPulls the text out of each file. This build reads PDFs.
SplitterCuts each document into pieces of about 300 characters, with a small overlap so sentences are not cut in half.
Search indexStores every piece with the document's title, date and publisher, and a row number in reading order.
Chat boxAdvisers ask in plain words. It can also sit inside a messaging app.
Search toolFinds the best match, then fetches the two rows before it and the two after.
Answer modelGemini writes the answer and names the document. Claude Sonnet steps in if Gemini times out or runs short of room.
MemoryKeeps the last 20 messages, so follow-up questions make sense.
Week 1 · Connect and load

The folder, search index and chat box are connected. The firm's PDFs go in.

Week 2 · Test

Advisers' own past questions run through it. The window size is tuned until answers read right.

Week 3 · Go live

Two advisers start first. The rest join once they see it work.

05 The workflow

The three parts
behind the assistant

This is the build as it sits in n8n. One flow loads documents. One answers questions. A small third flow fetches the text around each match.

document assistant build · n8n
The n8n canvas in three coloured groups. Orange: loading documents from a Drive folder into the search index. Blue: the chat box and the assistant with two answer models, memory and a search tool. Red: the search tool, built as a small flow of its own.
Orange · Loading

A new file in the Drive folder is picked up, read, cut into pieces and saved to the search index.

Blue · Answering

A question arrives in the chat box. The assistant remembers the last 20 messages and calls the search tool.

Red · Search tool

Finds the best match, works out the rows either side, fetches them and hands back one block of text.

Why a separate flow for search. The search tool is its own small flow, so it can be changed or tested without touching the chat side. The next page shows the script inside it.

06 Under the hood

Four lines that find
the surrounding text

The search finds the best piece. A short script then works out which rows sit either side of it, and the next step fetches them.

context-window step (JavaScript)
Four lines of JavaScript that find the rows two before and two after the best match, lines 1 to 10
Lines 1 and 2

Reads the best match's row number. Every piece of text is saved with one, in reading order.

Lines 4 to 7

Sets the window: two rows before, two after. Change the 2 to widen or narrow it.

Lines 9 and 10

The next step fetches every row in that range, so a clause arrives with its conditions.

The settings behind it

SettingValueWhat it does
Piece size300 charactersAbout two or three sentences per row.
Overlap50 charactersA small repeat between neighbours.
Window2 each sideFive rows reach the assistant for each match.
Matches per question1 to 4More matches mean more context, more cost and slower answers.

07 The retrieval

A match, plus what
sits around it

5rows reach the assistant for every match: the best one, two before it and two after it. That is up to about 1,300 characters, around 200 words.
PartRowsWhat it covers
Before the match2The lead-in: the definitions and conditions the match depends on.
The best match1The piece closest in meaning to the adviser's question.
After the match2What follows: the exceptions and dates that often change the answer.
Illustration · The question

Late delivery, early exit?

An adviser asks: can our client end a supply contract early if a delivery is late? In practice, this checks notice and material breach terms.

The best match

A clause on early exit

Read alone, it says either side may end the contract early. That sounds like a yes.

The rows around it

The condition and the exception

Two rows before define a "material breach". Two rows after add a 30-day written notice. So the answer is yes, but only after notice.

The answer

Plain words, with the source

The assistant gives that answer and names the contract's title, so the adviser can open it and confirm.

08 The outcome

What changes,
and what we delivered

Each pain point turns into a change you can count.

AreaBeforeAfter 90 days
Time per question18 minutes by hand5 minutes with the assistant
What the adviser readsOne clause on its ownThe match plus 2 rows either side
SourceFrom memory, no linkDocument title named every time
Adviser hours a month96 hours on document questions34 hours, so 62 given back

The 90-day rollout

Days 1 to 30 · Prove it

The library went live with two lead advisers. Half of all questions were routed through the system (160 of 320).

Days 31 to 60 · Widen it

Context windows were refined against live questions and the full team onboarded (240 of 320 queries).

Days 61 to 90 · Lock it in

90% of routine research routed through the assistant (288 of 320), returning 62 fee-earner hours each month.

Verified operational return

These figures reflect verified search logs and time tracking across the advisory team over 90 days of live use.

09 The numbers

The results
at $5,137 a month

Across 320 monthly document inquiries, the assistant delivered measured returns across 90 days.

18 → 5
Minutes per question

By hand, against assisted, including opening the source.

96 → 34
Adviser hours a month

On document questions, by month 3.

0 → 90%
Questions assisted

Live adoption: 50%, 75%, then 90%.

Month by month

MeasureBeforeMonth 1Month 2Month 3
Questions assisted (of 320)0160240288
Adviser hours on questions96614434
Hours given back0355262
Value of those hours$0$2,975$4,420$5,270
Running cost$0$114$126$133
Net gain a month$0$2,861$4,294$5,137
+$5,137

a month by month 3, after running costs.

How these numbers work. 8 advisers averaging 10 complex document queries a week (320 a month). Manual research averaged 18 minutes, dropping to 5 minutes with the assistant. Live adoption scaled to 90% by month 3. Time is valued at $85 an hour. Running cost averages $133 a month, delivering a net monthly benefit of $5,137.