# 🛡️ Bab Al-Aman (باب الأمان)
### The Gate of Safety — Sovereign AI Data Gateway for Morocco
> **"Un Maroc qui anticipe, des territoires qui raisonnent, une IA qui transforme."**
---
## 🎯 The Problem: The Silent Hemorrhage of Sovereign Data
Every day, thousands of Moroccan government employees in ministries and public agencies are seamlessly integrating AI into their workflows. In doing so, they inadvertently feed highly sensitive national data — budgets, confidential personnel records, strategic plans, and citizen information — directly into foreign commercial AI services like ChatGPT, Gemini, and Claude.
Once this data leaves Moroccan territory, it is stored on foreign servers outside national jurisdiction, potentially used for unauthorized model training, and subjected to foreign legal frameworks (e.g., the US CLOUD Act).
**These employees aren't malicious — they simply seek efficiency.** However, this shadow IT practice constitutes a severe violation of national data sovereignty and security directives.
## 💡 The Solution: Bab Al-Aman
**Bab Al-Aman** is an intelligent, transparent intermediary layer that sits between government users and external AI services. It acts as a **digital customs checkpoint for data bound for AI models**, automatically enforcing national security policies without hindering user productivity.
```mermaid
flowchart TD
User([Government Employee]) --> Gateway[Bab Al-Aman Gateway]
subgraph Engine [Classification Engine]
Gateway --> Classify{Sensitivity Check}
end
Classify -- "🟢 SAFE" --> ExtAI((External AI))
Classify -- "🟡 REDACT" --> Mask[Anonymize PII] --> ExtAI
Classify -- "🟠 SENSITIVE" --> LocLLM((Local Sovereign LLM))
Classify -- "🔴 SECRET" --> Block[Block + Alert]
```
### Core Features
| Feature | Description |
|---------|-------------|
| 🔍 **Zero-Latency Classification** | A high-speed local NLP/NER engine analyzes data sensitivity in real-time, assigning 5 risk levels (Public → Très Secret). |
| 🚦 **Dynamic Policy Enf …