How SenseFrame Thinks: Hybrid Knowledge Retrieval over Public + Private Documents (Part 2)
In our previous post, we introduced SenseFrame, an AI-assistant for legal firms in South Africa. It’s a system we’re developing on behalf of local founders who bring decades of ‘on-the-ground’ legal experience from their own law practice based in East London. For anyone developing an AI/Software startup or pilot, you’ll know how critical it is to have a clear understanding of the lived experience of your users – the pressures, routines, and edge cases that shape their decisions.
Legal AI isn’t just about dropping a big model on top of a database. Attorneys need precise, verified, and context-rich answers. That meant building a pipeline capable of drawing connections across public legislation & judgements and a firm’s own private documents — without compromising confidentiality. It had to be fast, too.
Here’s how we approached it.
1. Bringing Public Law Into the Workflow (via Laws.Africa)
As mentioned in Part 1, SenseFrame integrates directly with Laws.Africa, a nonprofit that digitises and maintains African legislation and judgments in a structured, machine-readable form.
This gives attorneys:
- Up-to-date legislation and judgements
- Cleanly formatted, searchable text
And for us, it means reliable RAG pipelines over public law without developing an in-house system for scraping, processing and validating thousands of legal artefacts.
2. Ingesting Private Documents (Securely and Reliably)
Every firm has its own knowledge base — pleadings, contracts, memos, email correspondence, affidavits, discovery bundles. Collections for a single legal matter can quite easily exceed 100 documents, and that's not counting the public legislation and case law that might be relevant. That attorneys are able to read everything while holding it all in context, over many matters, is a feat of true mental tenacity. Thankfully, embedding models and modern RAG systems make this kind of work a lot easier.
We designed a pipeline that efficiently and safely processes hundreds of private documents at a time in order to make them searchable and understandable to the AI assistant. Broadly outlined:
- Receive bulk upload of PDFs, Word docs, images, and scans, etc.
- Runs optical character recognition (OCR) models to extract text from scanned PDFs and images
- Cleans, structures, and chunks large documents
- Encrypts everything at rest and in transit
- Tags and stores all artefacts with organisation-scoped metadata
- Embeds and indexes them into a private, searchable index
At this point, each firm effectively has two knowledge bases available to the assistant at query time:
- a shared public-law index (currently ~1,000 pieces of legislation, expanded into many smaller passages for retrieval), and
- its own private, firm-scoped index for matters (typically 30–100 documents per matter, again chunked into passages).
This ingestion flow is backed by strong POPIA-compliant safeguards, but we’ll unpack that more in Post 3.
3. Hybrid Retrieval: How SenseFrame Understands Questions
To ensure attorneys are able to receive accurate answers over a large corpus of private and public documents, we had to design a retrieval pipeline that was fast, secure and reliable. We used a hybrid RAG stack that blends the strengths of both neural and keyword search — essential for legal interpretation where meaning and specific phrasing both matter.
The pipeline looks like this:
- Semantic search using embeddings (captures ideas and meaning)
- Keyword search (ensures precision on terms of art, statutes, citations)
- Semantic re-ranking to select the most relevant passages
- Context compilation fed to the LLM
- Response generation with citations back to the user
Retrieval happens across both data sets — public law and a firm’s private corpus. Hybrid retrieval runs in ~100–300 ms at our current scale, with headroom to index millions of passages as firms grow — all on a standard Azure tier.
4. Why It Matters
Legal research often feels like panning for gold: there’s critical information hidden across potentially hundred of dense documents, and it takes time to find. With SenseFrame’s retrieval engine:
- Attorneys spend less time sifting and more time problem solving
- Public and private knowledge come together into a single interface
- AI responses are grounded in actual documents, not guesswork
In our next post, we’ll look at the privacy and infrastructure decisions that made all of this possible inside South Africa’s jurisdiction.
🧠 If you’re working on privacy-sensitive AI and knowledge systems in Africa or elsewhere, or have a project you’d like to kickstart, we’d love to connect
By Arkology Studio — purpose-led systems design & software engineering studio