AI / Regulated domainArchitecture record

Legal Research & Compliance Assistant

In a regulated domain, an unsourced answer is worse than no answer, so this system is built around provenance rather than around a model. Sources are registered against a jurisdiction and an issuing authority before anything is fetched; a policy gate decides whether a given source may be ingested; and raw material is stored content-addressed by hash, so the exact bytes behind any citation can be produced later. It is explicitly positioned as decision support, not as a substitute for a licensed attorney — the output is a cited answer and a review packet, not advice.

73
Python files
in the source tree
11
Subsystems
registry through review
5
Jurisdiction scopes
country → supranational
SHA-256
Artifact addressing
content-addressed
Repository shape

Python package with subsystems for source registry, acquisition, normalisation, retrieval, guardrails, model gateway and attorney review

How this is presented

Documented as an architecture record. The provenance chain is the product; a hosted question box would hide exactly the part worth showing.

The chain from official source to cited answer

Every arrow preserves provenance. Follow either the ingestion path or the answering path and note that nothing skips the registry.

Source registryService

Jurisdictions, issuing authorities and their published sources, with uniqueness enforced.

Client surfaceServiceWorker / jobData storeExternal
Admitting a source

Why nothing enters the corpus by accident.

Highlights

Every answer is traceable to a stored snapshot of an official source — citations point at bytes, not at a URL that may have changed.
An explicit ingestion policy gate decides whether a source may be acquired at all, rather than scraping first and filtering later.
Content-addressed raw storage: artifacts are keyed by SHA-256, so tampering is detectable and duplicates collapse naturally.
Jurisdiction modelling spans country, subdivision, municipality, regulator and supranational scopes, because legal authority genuinely nests that way.
Guardrails and domain packs constrain answers to the corpus rather than letting the model improvise.
Produces attorney review packets — the output is designed to be checked by a professional, not to replace one.

Provenance first, answers second

The pipeline runs registry → policy gate → acquisition → normalisation → retrieval → guarded answer. Nothing can be cited that was not first registered, permitted and snapshotted, which makes the trust chain auditable end to end.

Source registry

Records jurisdictions, the authorities that issue law within them, and the sources those authorities publish.

  • Jurisdictions span country, subdivision, municipality, regulator and supranational scopes.
  • Authorities are scoped to jurisdictions; sources are scoped to authorities.
  • Uniqueness constraints prevent the same source being registered twice under different names.

Acquisition and policy gate

Decides what may be fetched, then fetches and stores it immutably.

  • The gate is consulted before any request is made.
  • Approved HTTP sources are acquired automatically; others are imported manually.
  • Raw artifacts are stored content-addressed with hash metadata.

Normalisation and retrieval

Turns heterogeneous raw material into a traceable, searchable corpus.

  • Normalisation preserves the link back to the originating artifact.
  • Snapshots capture the state of a source at a point in time.
  • Domain packs scope retrieval to a practice area.

Answering and review

Produces cited answers, issue checklists and attorney review packets.

  • Guardrails constrain claims to what the corpus supports.
  • The model gateway isolates provider specifics from the rest of the system.
  • Output is framed as decision support requiring professional review.

Every subsystem in the provenance chain

Eleven subsystems, ordered by where they sit in the chain from official source to cited answer. Nothing can be cited that did not pass through the earlier stages. 11 units across 4 groups.

Registry

1
source_registry

Acquisition

3
acquisitionnormalizationsnapshot

Answering

4
retrievallegal_researchmodel_gatewayguardrails

Output & scope

3
attorney_reviewdomain_packsoperations

Stack by layer

Registry
Jurisdiction recordsAuthority recordsSource recordsUniqueness constraints
Acquisition
Policy gateHTTP acquisitionManual importSHA-256 artifact store
Processing
NormalisationSnapshottingRetrievalDomain packs
Answering
Model gatewayGuardrailsCitation bindingAttorney review packets

Delivered work

Registry and acquisition

  • Jurisdiction, authority and source records with uniqueness constraints.
  • Ingestion policy gate consulted before any acquisition.
  • HTTP acquisition for approved sources plus a manual import path.
  • Content-addressed raw artifact storage with SHA-256 metadata.
  • Administrative CLI for registering and listing sources.

Corpus and answering

  • Normalisation preserving links back to originating artifacts.
  • Snapshotting so a source's state at a point in time is recoverable.
  • Retrieval scoped by domain packs.
  • Guardrails, model gateway and attorney review packet generation.

Modules and demo strategy

Policy gate

Decides what is allowed into the corpus.

  • Runs before acquisition, not after.
  • Makes the corpus defensible rather than merely large.

Content-addressed storage

Makes citations resolvable to exact bytes.

  • Hash addressing detects tampering and deduplicates naturally.
  • The foundation of the whole provenance claim.

Jurisdiction model

Represents how legal authority actually nests.

  • Country, subdivision, municipality, regulator and supranational scopes.
  • Sources inherit meaning from the authority that issued them.

Frontend documentation format

How this project is presented

The provenance chain shown as a flow, since it is the entire value proposition.
Positioning stated plainly: decision support, not legal advice.
Verified subsystem and file counts.