Legal AI

RAG + LLM Wiki: building a verifiable ECHR case file

How OCR, LLM analysis, hybrid retrieval and structured memory turn thousands of pages into reviewable ECHR applications and bundles.

In complex litigation, the problem is not simply to “find a document.” A lawyer needs to understand what it proves, which proceeding it belongs to, who signed it, which people it concerns, which version of the law applied on the relevant date, and how the document fits into an argument that evolves over time. Manual filing starts to break down with hundreds of files. With thousands of pages, a single chat with a large language model is not enough either.

The LegalAZ platform addresses this problem by combining two complementary approaches. The first is retrieval-augmented generation, or RAG: the system retrieves relevant passages before asking a model to reason. The second uses an “LLM Wiki” pattern. Rather than treating every question as an isolated conversation, the platform maintains a structured, evolving representation of the case. RAG supplies local evidence; the wiki preserves global understanding.

Bilingual RAG + LLM Wiki architecture

EN — The pipeline combines extraction, retrieval and persistent case memory. FR — La chaîne associe extraction, recherche et mémoire structurée.

Ingestion begins with reliable text

A source can be a native PDF, a poor scan, a Word document, an HTML page or a protocol exported from a judicial videoconferencing system. Mistral OCR performs primary recognition for scanned and image-based PDFs. When useful text already exists, the platform can skip OCR and extract it directly. This distinction reduces cost and latency while avoiding damage to good digital text.

The result is not stored as one undifferentiated string. The system keeps page anchors, paragraphs and, when the source allows it, structural information. It also calculates a file fingerprint and looks for duplicates. In a case populated by several lawyers, courts and authorities, the same decision may appear under several filenames, with or without a translation. Deduplication prevents the evidence base from being artificially inflated and avoids unnecessary model calls.

LLM analysis of a legal document after Mistral OCR

Document analysis combines Mistral OCR, metadata, signatories, participants, summaries, legal references and semantic chunks. Demonstration screen with entirely synthetic data.

OCR is followed by a separate LLM analysis stage. The model does more than summarise. It extracts and normalises the document type, jurisdiction, date, language, decision or proceeding number, court, signatories, participants, outcome and cited legal provisions. Deterministic fallbacks supplement the model when a proceeding number, date or formal structure can be recognised more reliably by a rule.

Two levels of summary serve different tasks. A short summary makes it possible to scan hundreds of entries. An extended summary preserves the reasoning, evidentiary value, claims and outcome. A separate legal-basis analysis identifies the provisions cited in the source. Results are versioned, so running a better model or prompt does not silently erase the previous analytical state.

The practical benefit is immediate. Files stop being opaque names such as scan-final-2.pdf. They become, for example, an order made by a particular court on a specific date, in a particular proceeding, with a French translation available. Sorting, filtering, building a timeline and finding gaps all become natural operations.

Recognised text is split into chunks that preserve paragraphs, articles and sections where possible. Each fragment retains its source document, page, language and structural metadata. Embeddings support semantic retrieval, while lexical search catches details that vectors may blur: case numbers, institutions, dates and exact expressions. Results are fused and diversified so that a single document cannot occupy the entire context.

This matters in legal work. A persuasive answer should not come from the model’s general memory, but from identifiable case material and legal sources. The system therefore gives documents stable references, links excerpts back to pages and produces citations that a user can inspect. When a bundle is attached, the agent intelligently reduces general RAG and prioritises the table of contents, page manifest and included documents.

The case wiki: memory that survives the next question

RAG answers “where is the information?” It does not, by itself, answer “where are we in this case?” That is the role of the LLM Wiki layer. For each case—and for each outgoing document or bundle—the platform maintains a structured view of participants, proceedings, chronology, objectives, requirements, working decisions, strategy, open questions, lawyer feedback and matters requiring verification.

This changes the nature of the assistant. It can understand that an exhibit was excluded for a stated reason, that an argument needs further support before the next version, or that a question remains unresolved. It does not restart from zero in each chat. Lawyer memos and analytical notes are treated as analysis rather than evidence: their claims must be checked against primary documents. That separation is a significant methodological safeguard.

Temporal law and lawyer-authored analysis

Law is not static. Applying the current wording of a code to an event from 2019 may be misleading. The knowledge base distinguishes statutes, regulations, judgments and procedural guidance. It can cache an official statutory revision for a chosen date and build a temporal legal history relevant to the case.

The firm’s own analysis sits alongside this corpus: memoranda, research, strategy and approved terminology. The layers remain distinct. Official text is a source; legal analysis is intellectual work that must be confirmed; a case document remains evidence. The model receives rich context without flattening the hierarchy of authority.

From analysis to an ECHR application and bundle

The end product is not an elegant chat answer. The platform is designed to produce deliverables: draft applications, memoranda, translations, exhibit lists and bundles for the European Court of Human Rights. Outgoing documents use Markdown as their source of truth, with version history, change notes and a comparison view.

Day-to-day convenience comes from small connections between these capabilities. A lawyer can filter documents by proceeding, type, date or processing state; see whether a French translation exists; open the precise page behind a citation; compare a revised application with its source version; and move from a search result to the relevant bundle entry without rebuilding context manually. Long-running OCR, analysis and assembly tasks are handled as background jobs with visible status, retry information and auditability. Stable labels let a team refer to the same exhibit consistently across several conversations. The interface is multilingual, while the underlying corpus can combine Ukrainian, French and English sources. This does not eliminate review work, but it removes much of the mechanical navigation that interrupts legal reasoning.

Review is equally concrete: counsel can distinguish model-generated analysis from source text, inspect the analytical version in use, and return from a proposition to the exact document page before approving it for an application or bundle.

A bundle is a structured object, not a simple PDF merge. It contains groups, documents, fragments, ordering, multilingual descriptions and evidentiary objectives. During assembly, the platform creates a cover page, table of contents, continuous pagination, page ranges and a manifest linking every bundle page to its source page. References can be recalculated after regeneration.

The system has already processed approximately 20,000 pages and produced several bundles, the largest exceeding 1,900 pages. Its largest matter contains more than 2,000 documents, ranging from 1 to 600 pages, across three languages. Volume alone does not prove legal quality, but it does show that the architecture supports work that cannot reasonably be handled by copying and pasting. Human review remains decisive for exhibit selection, classification of Convention violations, exhaustion analysis and final drafting.

Assembly of a paginated and traceable ECHR bundle

The structure, continuous pagination and source-page manifest make the generated bundle reviewable. Demonstration screen with entirely synthetic data.

Confidentiality, privilege and anonymisation

The platform processes highly sensitive material. Its architectural principle is separation: case-scoped data, object storage, access controls, audit logs, versions and processing traceability. Lawyer work product is identified as such and does not automatically become evidence. A production deployment can additionally require encryption, limited retention, chosen data residency, private or local models and a contractual prohibition on training with firm data.

The current state must nevertheless be described precisely. Automatic anonymisation is not enabled in this test version because it was not part of the initial specification. Public screenshots therefore require manual review and redaction. A production module can add entity detection, consistent pseudonymisation, an encrypted mapping table, export profiles and four-eyes approval. The task is broader than hiding a name: signatures, identifiers, metadata, faces, addresses and indirect re-identification all need attention without destroying the legal coherence of the file.

Augmentation, not automated judgment

The value of the architecture comes from the way its layers reinforce each other. Mistral OCR makes the material readable. LLM analysis turns files into legal objects. RAG retrieves verifiable passages. The wiki preserves the evolving understanding of the case. The temporal knowledge base places the law on the correct date. Finally, the production engine turns the material into versioned applications and bundles.

The result is faster work, but more importantly, more explainable work. Each stage leaves a trace, each citation can return to a page and each editorial decision can be discussed. This combination—generative intelligence, structured memory and documentary discipline—turns a folder of files into a living case file without removing the lawyer’s responsibility for analysis and judgment.

AI7 designs this kind of specialised document system around the corpus, required standard of evidence and confidentiality constraints. If your team handles matters that have outgrown general-purpose tools, you can describe the use case.

Oleksii Burlakov
Written by Oleksii Burlakov

Founder of AI7. Product strategy, business tools and controllable AI systems.