Moroccan Legal AI Assistant powered by Controlled Retrieval-Augmented Generation
Live Demo · Architecture · Legal Coverage · Evaluation · Local Development · License
OpenLegaMa v1.0.1 · Stable Maintenance Release
OpenLegaMa is a multilingual Moroccan legal AI assistant that provides
structured and sourced legal information through controlled retrieval over
a curated corpus of official Moroccan legal texts.
When verified evidence is insufficient, it prefers controlled abstention
over unsupported legal generation.
Présentation en français
OpenLegaMa est un assistant juridique marocain multilingue. Il distingue les explications générales, les demandes nécessitant une clarification, les références exactes et les questions qui doivent être reliées à des sources officielles. Il ne remplace pas un professionnel du droit.
OpenLegaMa is an engineering project focused on one difficult question:
How can a legal assistant remain useful without pretending that fluent model output is automatically legally reliable?
The stable v1.0 architecture combines deterministic query routing, a curated legal corpus, exact-reference validation, relevance filtering, structured conversation state and claim-to-citation controls. It answers general legal questions without forcing retrieval, retrieves official Moroccan law when a precise rule is requested, asks for missing facts before applying a rule to a personal case, and explicitly reports a corpus gap when verified evidence is unavailable.
This is a Stable MVP Release, not a final or legally exhaustive system. Future v1.1, v1.2 and potential v2.0 releases may extend the corpus and the evaluation framework.
Eight production views present the main user workflows. Select any screenshot to open the full-resolution image.
The name OpenLegaMa combines three ideas:
- Open — making legal information easier to access and understand;
- Lega — the legal domain at the core of the project;
- Ma — Morocco, reflecting the assistant's specialization in Moroccan law.
OpenLegaMa therefore represents an accessible gateway to structured Moroccan legal information.
In this name, Open describes accessibility of legal information. It does not mean that the source code is open source. OpenLegaMa is proprietary software and is distributed under the terms in LICENSE.
Accessing and explaining Moroccan law presents several technical and legal information challenges:
- official legal information is distributed across multiple texts and portals;
- users often do not know which law or article governs their question;
- general-purpose language models may fabricate legal references;
- personal legal situations are often missing decisive facts;
- legal conclusions require traceable and relevant sources;
- different versions of a rule may apply depending on the date of the facts;
- a legally relevant question may concern a source that is absent from the active corpus;
- multilingual questions should lead to consistent legal routing in French, Arabic and English.
OpenLegaMa was designed to reduce these risks by separating understanding, routing, retrieval, evidence validation and answer generation.
The project has six primary objectives:
- Provide clear general legal explanations without arbitrary citations.
- Retrieve official Moroccan legal material for precise Moroccan-law questions.
- Reject false laws and articles deterministically.
- Ask targeted clarifying questions before applying a rule to incomplete personal facts.
- Attach every important Moroccan legal claim to relevant accepted evidence.
- Expose the limits of the active corpus instead of claiming complete legal coverage.
- Controlled Moroccan legal RAG.
- Exact law and article reference lookup.
- Deterministic rejection of false legal references.
- Source cards with
C1,C2, and related citation markers. - Question-document and question-article relevance filtering.
- Controlled abstention through
CORPUS_GAP. - Separation between
OUT_OF_SCOPEand missing corpus coverage. - Domain-specific intelligent clarification.
- Structured legal conversation memory.
- Multilingual French, Modern Standard Arabic and English responses.
- Arabic RTL interface support.
- Darija and Latin-script Darija query normalization.
- General legal explanations without unnecessary retrieval.
- Project-information routing without legal RAG.
- Bounded conversation history.
- Request, user-message and assistant-message association protection.
- Responsive professional web interface.
- Legal-code browsing and exact article search.
Document Analysis is not available in v1.0. Agentic RAG is not part of the stable v1.0 architecture.
flowchart TD
U[User] --> UI[Next.js Chat Interface]
UI --> API[Chat API]
API --> N[Language and Query Normalization]
N --> R{Semantic Intent Router}
R --> PI[PROJECT_INFO]
R --> GA[GENERAL_ASSISTANT]
R --> GE[GENERAL_LEGAL_EXPLANATION]
R --> CR[CLARIFICATION_REQUIRED]
R --> ER[EXACT_LEGAL_REFERENCE]
R --> SR[SIMPLE_MOROCCAN_LEGAL_RAG]
R --> PC[PERSONAL_LEGAL_CASE]
R --> CG[CORPUS_GAP]
R --> OS[OUT_OF_SCOPE]
R --> SF[SAFETY_REFUSAL]
ER --> LC[(Active Legal Corpus)]
SR --> LC
PC --> LC
LC --> RT[Retrieval]
RT --> AR[Article Ranking]
AR --> RF[Relevance Filtering]
RF --> G[Grounded Answer Generation]
G --> CV[Claim and Citation Validation]
CV --> A[Answer with C1 / C2 / ...]
PI --> A
GA --> A
GE --> A
CR --> A
CG --> A
OS --> A
SF --> A
OpenLegaMa is therefore not a direct Question → LLM → Answer pipeline.
Routing and evidence controls determine whether a model may answer, whether
retrieval is required and whether a citation is permitted.
flowchart TD
Q[Original Question] --> LD[Language Detection]
LD --> NM[Multilingual Normalization]
NM --> CI[Canonical Legal Intent]
CI --> DD[Jurisdiction and Domain Detection]
DD --> MF{Critical personal facts missing?}
MF -- Yes --> CL[CLARIFICATION_REQUIRED]
MF -- No --> XR{Explicit legal reference?}
XR -- Yes --> EV[Deterministic Existence Validation]
EV -- Invalid --> RJ[Reject reference without substitute citation]
EV -- Valid --> RE[Exact Article Retrieval]
XR -- No --> HY[Hybrid Legal Retrieval]
RE --> RA[Relevant Legal Articles]
HY --> RA
RA --> RG[Question-Document and Article Relevance Guard]
RG --> ES{Evidence sufficient?}
ES -- No --> GAP[CORPUS_GAP]
ES -- Yes --> GC[Grounded Context]
GC --> AG[Answer Generation]
AG --> CC[Claim-to-Citation Validation]
CC --> SA[Sourced Answer]
The processing stages are deliberately separated:
- Language detection preserves the user's response language.
- Normalization creates a shared semantic representation for French, Arabic, English and supported Darija forms.
- Canonical intent detection identifies the legal concept independently of surface wording.
- Domain and jurisdiction detection prevents unrelated retrieval.
- Fact sufficiency checks request clarification before a personal legal conclusion.
- Exact lookup or hybrid retrieval chooses deterministic article access or broader legal search.
- Relevance guards reject sources that do not support the question.
- Claim validation limits citations to evidence actually used by the answer.
Only active legal documents can support a legal conclusion. Quarantined, pending or merely inventoried registry references are excluded.
| Mode | Purpose | Retrieval | Example |
|---|---|---|---|
GENERAL_ASSISTANT |
Handles greetings and project-level conversational turns. | No | “Bonjour.” |
GENERAL_LEGAL_EXPLANATION |
Explains general legal concepts or legal professions without asserting a precise Moroccan rule. | No | “Can a lawyer guarantee winning a case?” |
SIMPLE_MOROCCAN_LEGAL_RAG |
Answers a sufficiently precise Moroccan legal question from accepted official sources. | Yes | “How often must a monthly employee be paid in Morocco?” |
PERSONAL_LEGAL_CASE |
Processes a personal case when enough relevant facts are available. | Yes when facts are sufficient | “I was dismissed after a disciplinary hearing; how must the decision be delivered?” |
EXACT_LEGAL_REFERENCE |
Validates and retrieves an explicit law or article. | Deterministic | “What does Article 62 of the Labour Code provide?” |
CLARIFICATION_REQUIRED |
Requests only the critical missing facts needed before retrieval or application. | No | “My employer dismissed me. Is it legal?” |
CORPUS_GAP |
Reports that a valid Moroccan legal question lacks sufficient active verified evidence. | Retrieval attempted first | “How can I recover my impounded car?” |
OUT_OF_SCOPE |
Rejects a genuinely non-legal or non-supported-purpose request. | No | “How do I cook a tajine?” |
SAFETY_REFUSAL |
Refuses harmful or abusive assistance. | No | “How can I falsify a contract?” |
PROJECT_INFO is a dedicated canonical intent handled through the general
assistant path. It answers questions about OpenLegaMa without legal retrieval.
The active corpus is a generated, structured collection of selected official Moroccan legal texts. Each active record can include:
- an internal stable identifier;
- official title and instrument number;
- legal domain;
- source institution and URL;
- indexed article sections;
- language;
- corpus and legal status;
- known date or version metadata;
- known amendment, implementation, repeal or transitional relationships;
- temporal-verification status.
Corpus activation is intentionally different from registry inventory. A PDF can be known to the registry while remaining unavailable to retrieval because it has not passed extraction, structure, provenance or activation checks.
Primary project data:
src/data/legal-corpus.generated.jsonsrc/data/legal-registry.generated.jsonsrc/data/legal-registry-summary.generated.jsonsrc/data/legal-temporal-reviews.json
The corpus must be regenerated through the project scripts rather than edited manually.
OpenLegaMa currently relies on a curated corpus of official Moroccan legal texts. It does not yet cover the entirety of Moroccan law. When sufficiently relevant and verifiable sources are not available in the active corpus, the system prefers to abstain rather than generate unsupported legal claims or display irrelevant citations.
Current generated project data:
| Indicator | Current value |
|---|---|
| Active legal texts | 30 |
| Indexed legal articles | 7,708 |
| Official legal references tracked in the internal registry | 867 |
| Domains represented in the active corpus | 27 |
| Temporally verified active texts | 0 |
| Active jurisprudence decisions | 0 |
| International convention references inventoried | 306 |
| Active international conventions | 0 |
| Active standalone implementing decrees/orders | 0 |
A registry reference is not necessarily an active, indexed or temporally validated legal source. Registry entries can represent laws, dahirs, decrees, orders, conventions, language variants or separate versions. These units vary substantially in size and legal scope.
OpenLegaMa therefore never claims that 30 / 867 measures a percentage of all
Moroccan law.
See:
docs/legal-coverage.mdfor the complete generated inventory, domain matrix and known gaps;/coveragefor the in-app coverage dashboard.
Important gaps currently include:
- road traffic law and vehicle-impound implementing rules;
- taxation and broader customs coverage;
- insurance;
- health law;
- social protection;
- energy;
- agriculture;
- broader transport regulation;
- regulated legal professions;
- judicial organization;
- sectoral regulations and official circulars;
- active jurisprudence;
- active international conventions;
- implementing decrees;
- historical and temporally validated legal versions.
Example 1 — Vehicle impound
OpenLegaMa recognizes a vehicle-impound question as Moroccan law. However,
Law No. 52-05 and implementing Decree No. 2-10-312 are not active in the
current corpus, so the system returns CORPUS_GAP rather than inventing the
release procedure.
Example 2 — Exact notice period
Article 43 of the Moroccan Labour Code is available, but Decree No. 2-04-469 is not active. OpenLegaMa can explain the general duty to respect notice while explicitly declining to invent the exact regulatory notice scale.
Systematic temporal verification is not yet complete. None of the 30 active texts is currently marked as temporally verified end to end.
OpenLegaMa does not claim that every active text is fully up to date for every date of facts. Future corpus work must strengthen:
effective_from;effective_to;- publication and entry-into-force dates;
- amendments;
- repeals;
- transitional provisions;
- historical article versions;
- official-gazette references.
When temporal applicability cannot be verified, the system must expose that uncertainty rather than present a version as certain.
OpenLegaMa uses selected official Moroccan sources, particularly:
- the Moroccan Ministry of Justice legal portal, Adala;
- the Secrétariat Général du Gouvernement and Bulletin Officiel references;
- official URLs and source metadata stored with active corpus records.
Every legal source card distinguishes:
- the instrument title;
- article or section;
- source institution;
- official URL;
- excerpt used for the response;
- citation identifier such as
C1.
The project does not treat a search-engine result, an unofficial blog or a user document as an official legal source. Availability in the internal registry alone is not enough for legal activation.
Controlled abstention is an expected safety behavior, not a hidden failure.
OpenLegaMa prefers:
I do not have enough verified active sources to confirm this rule.
over:
- hallucinating a law or article;
- extrapolating an unsupported amount, deadline or procedure;
- citing a loosely related article;
- presenting an unverified legal version as current;
- pretending that the corpus is complete.
The vehicle-impound scenario is a concrete example: the router recognizes the legal domain, but the answer stops when the required official instruments are not active.
OpenLegaMa separates legal scope from document availability.
"How do I cook a tajine?"
→ OUT_OF_SCOPE
"How can I recover my impounded car in Morocco?"
→ valid Moroccan legal question
→ ROAD_TRAFFIC_LAW
→ CORPUS_GAP because active verified sources are insufficient
OUT_OF_SCOPE means that the request is genuinely outside OpenLegaMa's
Moroccan legal purpose. CORPUS_GAP means that the question is legally
relevant but cannot be answered safely from the active corpus.
This distinction prevents a missing document from being misreported as a non-legal question.
OpenLegaMa does not resend an indefinitely growing raw conversation to the model. It separates:
- Structured legal case state, containing relevant legal facts.
- A bounded recent-message window, used only when conversational context is needed.
The structured state can preserve:
currentIntent;previousIntent;currentDomain;previousDomain;- legal submatter;
- jurisdiction;
- personal-case facts;
- pending clarification;
- facts already requested;
isPersonalCaseContinuation;memoryRelevanceScore.
Memory is merged only when the new message is a genuine continuation of a compatible legal case. A change from dismissal to salary payment, for example, must not reuse dismissal-specific missing facts.
Current verified history budgets:
| Context layer | Maximum messages | Maximum characters | Per-message maximum |
|---|---|---|---|
| Client transport history | 16 | 18,000 | 4,000 |
| Model history | 12 | 12,000 | 4,000 |
The transport removes source cards, long legal excerpts already shown in the UI, technical traces, UI metadata and unrelated old answers. Automated tests verify that the compact serialized message history remains below 24 KB in the large-metadata scenario covered by the suite.
Each request also receives a unique requestId, userMessageId and
assistantMessageId. A response can replace only the assistant placeholder
associated with the same identifiers, protecting rapid or out-of-order chat
requests.
User:
هل يمكن للمشغل فصل الأجير دون إشعار مسبق؟
Processing:
- Language → Arabic.
- Jurisdiction → Morocco.
- Domain → Labour law.
- Intent → dismissal without notice.
- Retrieval → Moroccan Labour Code.
- Candidate articles → 43, 51, 61 and 62.
- Question-article relevance validation.
- Grounded Arabic answer generation.
- Claim-to-citation validation.
- Final answer with
C1,C2, and official source cards.
User:
Quelle est la procédure de divorce au Maroc ?
Processing:
- Language → French.
- Domain → Family law.
- Intent → Moroccan divorce procedure.
- Retrieval → Family Code.
- Selection of procedural articles only.
- Structured answer covering jurisdiction, filing, conciliation and judicial decision, with details qualified by the type of divorce.
- Source cards with the relevant official excerpts.
User:
Mon entreprise m'a renvoyé hier. Est-ce légal ?
The system does not immediately apply a generic dismissal rule. It asks for the contract type, seniority, stated reason, hearing, written decision, notice and relevant date before retrieval.
Retrieval is useful only when a question requires authoritative corpus evidence. For greetings, project information and general legal concepts, forced retrieval can introduce irrelevant statutes and reduce clarity.
Stable canonical intents make behavior testable across paraphrases and languages. Specific procedures receive priority over broad personal-case classification, preventing a complete procedural question from being intercepted by an unnecessary clarification.
An explicit law or article is normalized and checked before semantic search. If the reference does not exist in the requested instrument, OpenLegaMa rejects it without substituting a similar-looking article.
Personal legal outcomes often depend on contract type, dates, notice, procedure, evidence and jurisdiction. Asking only the critical missing facts is safer than silently inventing them.
A source can mention the same topic without supporting the generated claim. OpenLegaMa therefore separates document retrieval, article relevance and claim-to-citation support.
No citation is better than an irrelevant citation. CORPUS_GAP makes the
system's documentary limit explicit and auditable.
One describes the nature of the question; the other describes the availability of evidence. Conflating them hides legitimate legal coverage gaps.
Raw history can contaminate a new topic with old facts. Structured memory preserves only compatible legal facts and pending clarifications.
Bounded context reduces request size, provider cost, language contamination and the risk of attaching irrelevant old answers to a new question.
French, Arabic and English formulations of the same legal question should follow the same route and retrieve the same legal rule. Language is preserved for the answer, while intent and domain are normalized.
An experimental Agentic RAG workflow was evaluated during development. Black-box testing revealed unstable routing, unnecessary retrieval, citation drift and conversation inconsistencies. It was removed from the stable v1.0 architecture because deterministic routing and controlled retrieval produced more predictable and auditable behavior on the current corpus.
A partial document-analysis prototype was evaluated during development. It was removed from v1.0 because PDF/DOCX support, document memory, structured clause extraction and controlled document-to-law comparison were not mature enough for the release quality target.
Official availability, text extraction, article structure, provenance, legal activation and temporal validation are separate quality gates. Adding more PDFs without those controls would create apparent breadth without dependable retrieval.
The release workflow executes:
npm run checkThis command runs:
- TypeScript checking without emission;
- ESLint;
- the complete automated Node test suite;
- corpus reproducibility checks;
- registry synchronization checks;
- ingestion queue and staging checks;
- temporal-review validation;
- retrieval benchmark thresholds;
- independent holdout checks;
- generated legal-coverage consistency;
- a complete production build.
Current validation status:
| Check | Current result |
|---|---|
| Automated tests | 143 / 143 passing |
| TypeScript | Passing |
| ESLint | Passing |
| Production build | Passing |
| Curated benchmark cases | 610 |
| Independent holdout cases | 120 |
| Holdout legal matters | 27 |
| Holdout linguistic forms | 5 |
The suite covers:
- multilingual routing;
- exact and false legal references;
- citation integrity and relevance;
- legal conversation state and topic changes;
- long-context trimming;
- rapid and out-of-order request association;
- Arabic legal-language quality;
OUT_OF_SCOPEandCORPUS_GAP;- corpus, registry and ingestion integrity.
Automated tests and benchmarks reduce regressions but do not replace validation by qualified Moroccan legal professionals.
Current generated reports are stored in
benchmarks/results/.
| Metric | Current result |
|---|---|
| Evaluated cases | 610 |
| Document recall at 5 | 100% |
| Exact article recall | 100% |
| Citation integrity | 100% |
| Citation entailment on measured claims | 100% |
| Temporal coverage | 0% |
| Metric | Current result |
|---|---|
| Cases | 120 |
| Matters covered | 27 |
| Linguistic forms | 5 |
| Document recall on retrieval cases | 100% |
| Exact article recall on article cases | 100% |
| Answers pending human legal review | 116 |
These numbers measure the current evaluation datasets and pipeline behavior. They are not a claim of universal legal accuracy, complete Moroccan-law coverage or professional legal validation. The zero temporal-coverage result is intentionally reported rather than hidden.
OpenLegaMa supports:
- French;
- Modern Standard Arabic;
- English;
- Arabic Darija query understanding;
- Latin-script Darija query understanding.
The answer language follows the user's language. Arabic responses pass a quality guard intended to reject unexpected writing systems, inconsistent terminology and avoidable repetition. Official citations remain linked to the available official source language; Darija is an explanation and query language, not an official version of a legal instrument.
Current safeguards include:
- server-side request validation;
- a 256 KB JSON body limit;
- a 3,000-character question limit;
- a 4,000-character per-message transport limit;
- bounded client and model histories;
- control-character sanitization;
- structured provider errors and HTTP statuses;
- request/message identity validation;
- active-corpus-only legal citations;
- separation between source content and system instructions;
- controlled provider retries;
.env.localand other environment files excluded from Git;- secret-free
.env.example; - password hashing and local encrypted prototype storage.
The current authentication and conversation architecture still relies primarily on browser storage. This is suitable for a demonstrable MVP, not a multi-user legal production service. A public production deployment would need server-side identity, database-backed authorization, retention controls, monitoring, backups, incident response and a formal security review.
Only technologies present in the current project are listed:
| Layer | Technology |
|---|---|
| Web framework | Next.js 16 |
| UI runtime | React 18 |
| Language | TypeScript 5 |
| Styling | Tailwind CSS 4 |
| UI components | Base UI, Lucide React, local component system |
| LLM provider | Groq SDK |
| Corpus pipeline | TypeScript and Python scripts |
| Language detection | franc plus project normalization rules |
| Testing | Node.js test runner with tsx |
| Email integration | SendGrid, optional for password reset |
| Legal retrieval | Local controlled RAG over generated official-source data |
The openai package is present in project dependencies but is not the active
chat provider in v1.0.
OpenLegaMa/
├── benchmarks/
│ ├── results/ generated benchmark reports
│ └── *.json curated and holdout datasets
├── docs/
│ ├── legal-coverage.md generated legal coverage report
│ └── screenshots/ release screenshots
├── public/ static application assets
├── scripts/ corpus, registry and evaluation tools
├── src/
│ ├── app/
│ │ ├── api/chat/ chat API
│ │ ├── chat/ assistant interface
│ │ ├── codes/ legal-code browser
│ │ └── coverage/ legal coverage page
│ ├── components/ reusable interface components
│ ├── data/ corpus, manifests and registries
│ ├── hooks/ shared client hooks
│ └── lib/ routing, RAG, safety and services
├── tests/ automated Node tests
├── .env.example secret-free configuration template
├── CHANGELOG.md release history
├── LICENSE proprietary license
├── README.md
├── SECURITY.md vulnerability reporting policy
└── package.json
- Node.js 20 or a compatible release;
- npm 10 or a compatible release;
- Python 3.11+ for corpus and registry checks;
- a Groq API key for generated chat responses.
git clone https://github.com/YOUSSEF-BT/OpenLegaMa.git
cd OpenLegaMa
npm install
cp .env.example .env.local
npm run devOpen http://localhost:3000.
npm run dev # development server
npm run build # production build
npm start # production server
npm run typecheck # TypeScript validation
npm run lint # ESLint
npm test # automated tests
npm run check # complete release validation
npm run audit:prod # production dependency audit
npm run coverage:docs # regenerate legal coverage report
npm run coverage:docs:check # verify coverage report freshness
npm run benchmark:evaluate # curated retrieval benchmark
npm run benchmark:holdout # independent holdout benchmarkCopy .env.example to .env.local:
# Required for generated chat responses
GROQ_API_KEY=your_groq_api_key
# Public, non-secret availability flag for password-reset email delivery
NEXT_PUBLIC_PASSWORD_RESET_EMAIL_ENABLED=false
# SendGrid integration retained for future reactivation
SENDGRID_API_KEY=your_sendgrid_api_key
SENDGRID_FROM_EMAIL=your_verified_sender@example.com
SENDGRID_FROM_NAME=OpenLegaMa
# Public application URL
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Prototype client-side local encryption passphrase
NEXT_PUBLIC_ENCRYPTION_KEY=your_local_development_passphraseAny variable prefixed with NEXT_PUBLIC_ is exposed to the browser and must
never contain a server secret. Do not commit .env.local, API keys, access
tokens, production exports or personal user data.
- OpenLegaMa does not cover all Moroccan law.
- The active legal corpus is curated and partial.
- Some implementing decrees and regulatory texts are missing.
- Systematic temporal validation is incomplete.
- Historical legal versions are not validated end to end.
- Jurisprudence is not active in v1.0.
- International conventions are inventoried but not active.
- Sectoral coverage varies substantially.
- Legal outcomes depend on facts, evidence, procedure, applicable versions and judicial interpretation.
- Model output can still be incomplete or incorrect.
- Automated benchmarks do not replace professional legal validation.
- OpenLegaMa does not replace a lawyer or qualified legal professional.
- Document Analysis is not available in v1.0.
- Agentic RAG is not part of the stable v1.0 architecture.
- Browser-based prototype identity and storage are not production-grade multi-user infrastructure.
- Password reset email delivery is implemented through SendGrid. The current SendGrid trial has expired, so transactional email delivery is temporarily disabled until the email provider is reactivated or replaced.
- The underlying password-reset integration remains in the codebase for technical review, but it is not currently enabled in the public deployment.
- progressive corpus expansion;
- additional implementing regulations;
- stronger temporal validation;
- additional legal domains;
- improved official-source metadata;
- larger independent multilingual evaluation;
- blind review by qualified Moroccan legal professionals;
- stronger deployment, monitoring and server-side identity foundations.
The following are research directions, not commitments or currently available features:
- much broader Moroccan legal coverage;
- historical legal versions;
- amendment and repeal graph;
- jurisprudence integration;
- Court of Cassation decisions;
- international conventions with ratification and reservation metadata;
- verified sectoral legal sources;
- PDF/DOCX legal document analysis;
- structured clause extraction;
- document question answering;
- controlled comparison between uploaded documents and official Moroccan law;
- stronger temporal reasoning;
- a possible new Agentic RAG research track only if future unchanged benchmarks prove it superior to deterministic v1 routing without increasing irrelevant citations.
English
OpenLegaMa provides general legal information based on a curated corpus of official Moroccan legal sources. It does not provide legal representation and does not replace advice from a qualified legal professional. Legal outcomes depend on the facts, evidence, applicable versions of legal texts and judicial interpretation.
Français
OpenLegaMa fournit des informations juridiques générales à partir d’un corpus sélectionné de sources juridiques marocaines officielles. Il ne fournit pas de représentation juridique et ne remplace pas la consultation d’un professionnel du droit qualifié. L’issue d’une situation juridique dépend notamment des faits, des preuves, des versions applicables des textes et de l’interprétation judiciaire.
العربية
يوفر OpenLegaMa معلومات قانونية عامة استناداً إلى مجموعة منتقاة من المصادر القانونية المغربية الرسمية، ولا يقدم تمثيلاً قانونياً ولا يعوض استشارة مهني قانوني مؤهل. وتعتمد مآلات القضايا القانونية على الوقائع والأدلة والنسخ الواجبة التطبيق من النصوص والتفسير القضائي.
OpenLegaMa is proprietary software.
Copyright © 2026 Youssef Bouzit. All rights reserved.
The complete OpenLegaMa source code is publicly available in this repository for technical review, portfolio demonstration and recruitment evaluation.
OpenLegaMa remains proprietary software. Public availability of the source code does not grant permission to redistribute, modify, sublicense, commercialize or create derivative works without prior written authorization from the copyright holder.
The availability of this source code on GitHub does not constitute an open-source license. A public GitHub repository can still be viewed, cloned and forked through GitHub functionality under GitHub's Terms of Service; the proprietary license is a legal restriction rather than a technical access control.
Official Moroccan legal texts and third-party dependencies remain subject to their own legal status and licenses. OpenLegaMa does not claim ownership of official legislation.
See LICENSE for the full proprietary terms.
External contributions are not accepted by default. GitHub Issues may be used for reproducible bug reports, product feedback and professional discussion, but opening an issue does not grant any right to modify or reuse the source code. Professional collaboration and permission requests should be directed to the project owner through the verified profiles below.
Youssef Bouzit
Creator and Developer of OpenLegaMa