Architecture

System architecture

A living loop. OpenLegal watches a local case repository, turns files into structured intelligence, researches authority, produces strategy — and routes every consequential step through a human gate with a full audit trail.

The loop

FILESYSTEM

Watch & bootstrap

A watcher detects new and changed matter files and bootstraps them into the intelligence ledger.

EVENT FABRIC

Every change is an event

Matters emit idempotent, serializable realtime events — each carrying a provenance record — that trigger the next stage.

KNOWLEDGE

Classify & connect

Extraction produces legal issues, entities, facts, and epistemic status; knowledge fabric keeps them connected and current.

INTELLIGENCE

Plan work

Case intelligence, research planning, and a decision engine convert gaps into research work items.

RESEARCH

Authority with provenance

Research consults an authority store; gaps, risks, and opportunities are surfaced with source provenance.

COUNCIL & STRATEGY

Debate, then plan

Specialist roles debate and red-team; a strategy engine produces options, war games, and contingencies.

HUMAN GATE

You decide

Approvals, drafts, and pause/resume are surfaced through the operations layer. Nothing proceeds unapproved.

AUDIT & MEMORY

Proven, then repeat

Hash-only invocation audit plus checkpoint memory close the loop: observe → act → learn → re-observe.

Operator surfaces

Three interfaces, one system. They share the same ledger, governance, and audit chain.

CLI

openlegal provides 12 commands covering health, diagnostics, status, analysis, audit, privacy, models, and the engine itself.

Terminal UI

API + Browser

A FastAPI application exposes 150+ routes for status, intelligence, research, council, strategy, living systems, and agents.

Browser UI

TUI

An interactive operations console for live monitoring. Present in the codebase; interactive session coverage is still being automated.

TUI

Resilience

PropertyBehavior
Idempotent eventsRe-applying an event yields the same state — no double counting, no drift.
Deterministic rerunsRe-running a synthetic workflow reproduces the same result.
RecoveryKill-and-restart resumes a healthy system; the loop re-initializes from the ledger.
Fail-closed routingUnknown model providers are blocked, never silently bypassed.
Honest statusDiagnostics report verified, partial, and blocked states without fabrication.

Boundaries

OpenLegal is a legal-intelligence operating system — it is not a lawyer and takes no irreversible action autonomously. The public website documents the product; the application runs locally; case data stays in the operator’s own repository.