A law firm has often already produced some of the work it will need tomorrow: notes, contracts, submissions, correspondence and analysis. Yet that knowledge remains scattered across its document management system, or DMS. The aim is not to hand every matter to a chatbot. It is to find the right material, within the right scope, to help a lawyer prepare their work.

Here is a reference architecture for designing this local engine. It describes design choices and controls to verify; it does not report a client deployment or measured results.

Start with a working question

For a new commercial dispute, the team may need a previously reviewed clause, a comparable timeline or a note on a procedural issue. The assistant can suggest relevant passages, compare versions and prepare a list of documents to review. Each suggestion links to the original document, its version and, where possible, the relevant page.

Search is limited to sources authorised for the task. Technical access to a matter does not by itself justify reusing it for another: firm policies, conflicts of interest and obligations attached to the information must be considered. A collection of approved templates and internal notes can provide a simpler starting scope than opening every archive.

RAG: retrieve before drafting

Retrieval-augmented generation, or RAG, retrieves relevant passages and supplies them to the model alongside the question. The model prepares an answer using that context. This does not in itself require retraining a model on the firm’s files.

We would start by combining exact-word search with semantic search. The former remains valuable for a document reference or contractual wording; the latter helps find an idea expressed differently. The final ranking must be assessed against real user questions, not just examples chosen for a demonstration.

An answer with sources can still be wrong or incomplete. The system must distinguish a retrieved extract from a summary or suggestion. If it cannot find sufficient supporting material, it should say so rather than invent a reference.

What must actually stay local

Installing the model on a firm’s server is not enough if another component sends documents to a provider. For a workflow that does not export matter content, we would keep the following inside the technical environment controlled by the firm:

  • Text extraction and OCR for scanned documents.
  • Creation of vector representations, also called embeddings.
  • Search indexes and associated metadata.
  • Passage ranking and the model generating the answer.
  • Histories, logs, caches and backups containing firm information.

Outbound traffic is filtered and verified. Updates are organised separately from matter processing. Telemetry, support tools and monitoring are part of the inventory: an error report containing a document extract can itself disclose data. A vector index is still data to protect, not an anonymised version of the documents.

HTTPS does not mean the provider sees nothing

TLS encryption protects data in transit. With a conventional external AI API, the receiving service obtains the data needed for processing and may process it in plaintext in its environment. Encrypting the connection does not by itself meet a requirement to keep matter information out of third-party systems.

For the sensitive document workflow described here, the rule would be simple: no documents, extracts or questions revealing the matter are sent to an external model. If the local engine is unavailable, the system reports that it is unavailable; it does not silently switch to a remote service.

Apply permissions before retrieval

The assistant uses the person’s identity and the firm’s permissions. Restrictions apply when selecting documents: filtering only the final answer would be too late if unauthorised passages had already entered the model’s context.

Permission changes and deletions must propagate to indexes, caches and stored results. Tests also look for indirect leaks: the title of a restricted matter, the existence of a client or an extract retained in a shared history. The technical service’s access to the DMS should be limited to the intended scope.

An MCP server connects; it does not open everything

An MCP server can expose specific functions: search authorised sources, open a passage and retrieve a document’s version. We would favour a read-only first version with distinct tools and explicit permissions. Adding a note or document later would require a separate workflow and appropriate approval.

MCP is neither an automatic confidentiality barrier nor blanket permission to act. Authentication, checks on every tool and protection against malicious instructions hidden in documents remain necessary. A document is a source to analyse, not an instruction that can expand the assistant’s permissions.

Leave room for external AI without mixing workflows

The firm may have other needs: preparing generic training material, producing an institutional visual or working with a public corpus whose usage rights have been checked. Those tasks can use a separate workflow authorised by firm policy, with evaluated providers and contractual terms.

Switching from a local to an external workflow should not depend solely on whether a name appears. A timeline, amount or combination of facts may identify a matter. Pseudonymisation does not guarantee anonymity. For sensitive matters, we would retain local processing rather than promise that a simple filter removes every risk.

What to measure before rolling out

A pilot should support a decision. Using an authorised corpus and questions prepared by the team, we would measure:

  • Time needed to find a relevant document.
  • Retrieval quality and accuracy of cited references.
  • Ability to recognise an unsupported answer.
  • Verification and correction work remaining for the lawyer.
  • Access refusals and absence of leaks between scopes.
  • Response time under concurrent use and running cost.

Hardware depends on document volume, formats, the model and concurrent users. A local engine requires computing capacity, maintenance and version management. Neither free software nor a quick demonstration establishes the service’s operating cost.

A working tool under the firm’s responsibility

Local processing reduces some external data flows; it does not automatically make a system compliant or reliable. The firm must define purposes, authorised users, retention periods and responsibilities with the relevant advisers. A data protection impact assessment should be considered according to the processing risks. Checking sources and whether the law remains current is essential: a DMS also contains analysis that is no longer suitable.

The objective is to make knowledge more accessible, not to delegate a legal decision. The lawyer reads the documents, checks the reasoning and decides how to use suggestions. We would first aim for a reliable research assistant within a limited scope before adding drafting or action capabilities.

Define a first scope with Kasual

We can scope a local document assistant, connect a DMS and design the agents and tools needed to run it. The starting point: a frequent task, an authorised corpus, identified users and success criteria. Explore our approach to applied AI, business agents and APIs and integrations.

Sources and technical references

Sources consulted on 23 November 2026. These resources inform the design; they do not certify the proposed architecture.

All articles