Generative AI and company data: private RAG, compliance and common sense
Your teams are already pasting contracts into public chatbots. Here is how a private RAG works, where to host it, what Law 09-08 and the GDPR imply, and the 8 questions to ask before you start.
By Sudo System Team
Security, Data & AI Practice
Tuesday morning. A sales assistant has to summarise a forty-page supplier contract before a meeting. She opens a free chatbot, pastes the text and gets a clean summary in thirty seconds. Nobody told her it was forbidden. Nobody gave her an alternative either. We come across this scenario in almost every company we work with, from trading firms to manufacturers. Generative AI is already inside your business, whether you decided it or not. The real question is whether it operates within a framework you control.
The real risk is not the one you expect
When AI and security come up, many executives picture a sophisticated cyberattack. The most common risk is far more mundane: well-meaning employees copying contracts, payslips, customer lists or technical drawings into public tools whose terms of use and hosting location they know nothing about.
Depending on the plan and settings, some consumer services may keep conversations, have them reviewed by humans or use them to improve their models. You then lose track of data that sometimes isn't even entirely yours: your customers', your employees', your partners'.
A flat ban does not work. We have seen it several times: prohibition pushes usage onto personal phones, which is worse. The sensible answer is to offer an internal tool that is as convenient as the public chatbot, but connected to your documents and hosted on your terms. That is exactly what a private RAG makes possible.
Private RAG, explained without jargon
RAG stands for Retrieval-Augmented Generation. Behind the acronym lies a simple idea: instead of asking a language model to answer from memory, you first feed it the right excerpts from your own documents, then ask it to answer only on the basis of those excerpts.
Indexing your documents
Quality procedures, contract templates, product sheets, internal memos, Odoo documentation: this content is split into passages, then turned into numerical representations that let you find a text by meaning, not just by exact words. This index stays on your premises or with the hosting provider you have chosen.
Retrieving the relevant passages
When an employee asks a question, for instance "what is the notice period in our distribution agreements?", the system retrieves the handful of closest passages from the index.
Answering with sources
The model writes an answer from those passages and states where each piece of information comes from: document name, section, version date. This is what changes everything. An employee can check in one click, and an answer without a source immediately becomes suspicious.
Respecting access rights
A well-designed RAG only shows each user the documents they would be allowed to see elsewhere. The accountant has no business seeing HR files; the salesperson has no reason to read employment contracts. This filtering must happen at search time, not afterwards. This is often where improvised projects fall apart.

Where to host: sovereign cloud, on-premise or open-source models
Hosting is not just a technical matter. It shapes your compliance, your costs and the quality of the answers. There is no universal right answer, only trade-offs to be made with your eyes open.
| Option | Strengths | Limits | Typical case |
|---|---|---|---|
| Major provider API, enterprise plan | Very capable models, fast set-up | Data processed outside Morocco, contractual dependency | Low-sensitivity documents, need for top quality |
| Sovereign cloud or local hosting provider | Controlled data location, identifiable counterpart | Sometimes narrower choice of models, variable cost | Personal data, regulated sectors |
| On-premise with an open-source model | Full control, no data leaves the building | Hardware investment (GPU), in-house skills required | Manufacturing, defence, highly confidential data |
In practice, we increasingly see hybrid architectures: the index and documents stay on local infrastructure, and only an open-source model, running on a dedicated server, generates the answers. Recent open models have become more than good enough to summarise, extract or answer questions over a document base, including in French. For a first project, a server with a mid-range GPU is often enough to serve a few dozen users.
Law 09-08, CNDP and GDPR: what to keep in mind
As soon as your documents contain personal data (names, contact details, salaries, health information), Morocco's Law 09-08 on the protection of individuals with regard to the processing of personal data applies. The CNDP, the Moroccan supervisory authority, oversees such processing: depending on its nature, it may require a prior declaration or authorisation. Transferring data abroad, which happens as soon as you use an API hosted outside Morocco, is also subject to specific rules.
If you work with European clients or partners, or process data about people located in the European Union, the GDPR may apply to you as well. Among other things, it requires data minimisation, purpose limitation, security and proper contracts with processors.
"The first question we ask is not 'which model?' but 'what data will actually flow through the system?'. In half of the cases, personal data can be removed or pseudonymised before indexing, and the size of the compliance problem changes completely." — a consultant from Sudo System's Security, Data & AI practice
Let us be clear: this article is not legal advice. Rules change, and how they apply depends on your business. Before any deployment involving personal data, have the set-up reviewed by a lawyer or specialised counsel, and check with the CNDP which formalities apply to your case.
An AI usage policy: short and actually applied
Technology is not enough. You also need to tell teams plainly what is allowed. A good policy fits on two pages, not twenty. It states which tools are authorised, which categories of data must never leave the company, who approves a new use case, and reminds everyone that an AI answer commits the person using it, not the machine.
Take the example of a manufacturing SME with around a hundred employees. It classified its information into three levels: public, internal, confidential. Public information can go into any tool. Internal information goes only through the in-house RAG assistant. Confidential data (payroll, client contracts, health data) is accessible only to authorised profiles, even within the internal tool. Three levels, one rule per level: everyone understood it in a single meeting.
Key takeaway — Banning AI drives usage into the shadows. Offering an internal assistant as easy as a public chatbot, framed by a short policy and strict access rights, reduces the risk far more effectively.
Eight questions to ask before launching an AI project
Before signing anything, we recommend going through these eight questions with management, IT and, ideally, your legal adviser.
- What specific business problem are we solving, and how will we measure the gain?
- Which documents will be indexed, and do they contain personal or sensitive data?
- Where will the data and models be hosted, and is there any transfer outside Morocco?
- Which CNDP formalities, and possibly which GDPR obligations, apply?
- How will existing access rights be replicated in the tool?
- Do answers systematically cite their sources, and who checks their quality?
- Who is responsible for updating the content when a procedure changes?
- What happens to the data, logs and index if we change provider?
If you cannot answer three or more of these questions, that is fine. It simply means a scoping phase is needed before talking technology.
Where to start, in practice
Our advice: pick a narrow, low-sensitivity scope, such as quality documentation or product sheets, and run a pilot of a few weeks with around ten users. Measure the time saved, the quality of the answers and the questions left unanswered. Write the policy in parallel, not afterwards. You will then have factual evidence to decide whether or not to extend to more sensitive data.
If you would like an outside perspective to scope this first pilot, the Sudo System team can help you lay the right technical and organisational foundations.