LegalOSS133.3ktracked
Legal AI & NLP · Benchmarks & Datasets

legaliseMaintained

b1rdmania/legalise

Open-source governance layer for UK legal AI (evaluation release)

Legal AI & NLPBenchmarks & Datasetsaudit-trailfastapigovernancehuman-in-the-looplegal-ai

Legalise

⚠️ Evaluation release — a reference implementation, not production software. Not for live client matters. See docs/LIMITATIONS.md for what is and isn't ready.

An open-source workspace for AI-assisted legal work in England and Wales. It records sources, model calls, review, edits, and human sign-off against each matter.

Open source, runs locally, bring your own model key.

The Legalise workspace: a matter, a chat, and every answer pinned to its source


How it works

The loop is draft, cite, sign-off, audit. AI prepares an output inside a matter and cites the documents used. A named person reviews it and records a decision. The decision pins the reviewed output by hash.

flowchart LR
    A[Documents<br/>in the matter] --> B[AI drafts<br/>+ cites sources]
    B --> C[Named person<br/>reviews]
    C --> D[Sign-off<br/>pins output by hash]
    A -.-> R[(Append-only<br/>hash-chained record)]
    B -.-> R
    C -.-> R
    D -.-> R
Loading

Matter actions handled by Legalise write to an append-only, hash-chained audit log. The log is tamper-evident, not tamper-proof. See docs/TRUST.md for the claim boundary and open gaps.


What's in the repo

A worked evaluation workspace around the Khan v Acme sample matter:

  • Documents: upload, extraction, version history, disclosure flags, and owner-scoped original-file access.
  • Chat and skills: work against selected matter documents through a shared model gateway.
  • Review and sign-off: record signed, signed_with_observations, or rejected; pin the reviewed output by hash.
  • Activity and export: inspect the matter record and export its documents, outputs, sign-offs, source anchors, and audit data.

The runtime includes capability checks, matter privilege settings, an advice-boundary gate, and one model gateway for Anthropic, OpenAI, OpenRouter, and Ollama. Users bring their own model keys. Legalise does not provide model access.

Skills in a matter, each declaring what it reads, writes, and records

Skills arrive by import. The awesome-legal-skills (Lawve) catalogue is browsable in-app, and any public GitHub repo with a SKILL.md can be dropped in by URL (e.g. pre-motion). Each import becomes a draft pinned to a commit SHA. It must pass the admission flow and receive matter-level permissions before it can run.


What it records

  • Documents and source anchors used by a Legalise workflow.
  • Model, token, latency, posture, and prompt/response hashes for gateway calls.
  • Review decisions, tracked edits, sign-offs, and refusals.
  • An append-only audit row and hash-chain entry for recorded matter actions.

Each entry folds the previous entry's hash into its own, so changing one entry breaks the chain from that point on. That is what "tamper-evident" means here: not that the record can't be altered, but that alteration shows.

flowchart LR
    E1["Entry 1<br/>source.attached<br/>hash: a3f2…9c"] --> E2["Entry 2<br/>model.call<br/>hash: d81e…44"]
    E2 --> E3["Entry 3<br/>document.edited<br/>hash: 6b0a…e1"]
    E3 --> E4["Entry 4<br/>matter.signoff<br/>hash: f97c…08"]
    E1 -.->|prev hash| E2
    E2 -.->|prev hash| E3
    E3 -.->|prev hash| E4
Loading

A database superuser can rewrite unanchored history by disabling the controls. External anchoring is not built. See docs/TRUST.md.


Try it

legalise.dev hosts a guided demo of the Khan v Acme workspace and the architecture write-up. The hosted backend is currently turned off: there are no hosted accounts, model calls, or matter storage. Run the complete workspace locally or on your own infrastructure with your own model keys.

Email andrew@legalise.dev with questions.

Stack: Postgres, MinIO, Redis, Gotenberg, FastAPI, React.

Local fork

  1. Clone.

    git clone https://github.com/b1rdmania/legalise
    cd legalise
  2. Run quickstart. It copies .env if needed and starts the compose stack.

    ./scripts/quickstart.sh

    To skip local image builds when published images are available:

    LEGALISE_USE_PREBUILT_IMAGES=true ./scripts/quickstart.sh
  3. Create the first account. Open http://localhost:3000 and sign up. In local dev the first user is verified, seeded with Khan v Acme, and promoted to workspace admin automatically. No bootstrap CLI step is needed.

  4. Run the loop. The five steps the workspace exists for, in order:

    1. Create a matter — or open the seeded Khan v Acme.
    2. Add documents — drag/drop into the matter; bodies are extracted.
    3. Ask the assistant — Chat over the documents you select.
    4. Run a skillSkills → Add skill to inspect a Lawve skill, convert it to a governed draft, run the trust ceremony, enable it on the matter, then run it from chat.
    5. Sign the output, then export the working pack — review the output and record a sign-off, then export the matter ZIP (documents, audit trail, outputs, sign-off records, source anchors, integrity flag).
  5. Check the stack with legalise doctor. Inspection only; verifies the database is reachable, migrations are current, MinIO is responding, plugins are mounted, and the v2 manifests validate.

    docker compose -f infra/docker-compose.yml exec backend python -m app.tools.doctor

To check the fork end-to-end without driving the UI by hand, run ./scripts/smoke.sh. It runs the same Playwright first-run spec as CI (truncates the local database; see the script's prompt).

Manual local path

If you don't want quickstart to clone the skills catalogue or start compose:

  1. Copy env.

    cp .env.example .env
  2. Bring the stack up.

    docker compose -f infra/docker-compose.yml up -d
  3. Register the first user at http://localhost:3000. With LEGALISE_DEV_AUTO_ADMIN_FIRST_USER=true (the local default), that user becomes workspace admin. With the flag off, run the bootstrap CLI after signup:

    docker compose -f infra/docker-compose.yml exec backend \
        python -m app.tools.bootstrap_admin --email you@example.com

Self-hosting notes

  • Deploying your fork to Fly: change app = "legalise-backend" in backend/fly.toml before fly deploy.
  • GHCR images are published by .github/workflows/container-images.yml as multi-arch (linux/amd64 + linux/arm64, incl. Apple Silicon). Local quickstart builds from source by default; set LEGALISE_USE_PREBUILT_IMAGES=true to pull the published images instead.
  • For setup problems, run legalise doctor and open an issue if a fresh fork won't come up.
  • Backup, restore, and operations runbooks are maintained outside this public repo. Open an issue if you're self-hosting and need them.

Status

Evaluation release. Not for live client matters.

NB — the honest state of it. The audit engine is complete and strong. The document editor, the LLM layer, and matter organisation are about 80% there. Chasing a perfect open-source legal workspace was draining time in a lane that's already crowded, so treat this as an open experiment: come in as a contributor and close the gap, or take the audit engine and plug it into the workspace you already have. Throw the repo at your LLM and see what it thinks.

The hosted backend is built and functional, but switched off — self-hosting is the supported path. If you'd run the hosted version as a pilot, email andrew@legalise.dev.

  • What works is in the CHANGELOG, and you can run all of it: the full matter loop, audited retrieval, sign-off, export, and a deterministic eval harness (agent-kit) that gates grounding, refusal, and audit-chain integrity in CI.
  • What's deliberately out of scope, or not production-grade, is in docs/LIMITATIONS.md — gaps first.
  • What's planned is in docs/ROADMAP.md.

Docs

Start with docs/:

Operator material is maintained outside this public repo. Open an issue if you're self-hosting and need something that isn't here.

Contributing

You don't need to touch the core. The easiest ways in: practitioner feedback (no code, corrections with authority attached), a one-row eval case, or a governed legal skill built in your own repo and listed in the community catalogue with a one-row PR. The ladder, the ground rules, and the dev setup are in CONTRIBUTING.md; skill authoring is in docs/BUILDING_SKILLS.md.

Caveat

Not legal advice, not a law firm, not for live client matters. Real regulated use needs the firm's own supervision, policies, model-key posture, and professional controls.

Licence

Apache 2.0. See LICENSE.

Maintainer

@b1rdmania. Open an issue, or get in touch if you're a UK solicitor wondering what your AI did with the client documents.

Forks are independent deployments, not operated, reviewed, or endorsed by the maintainer unless stated.


The one-minute demo

The loop end to end: open source, the workspace, skills installing with explicit grants, the record building step by step, and the tamper-evident chain.

https://github.com/b1rdmania/legalise/raw/master/docs/media/legalise-demo.mp4

Watch the Legalise demo

Or watch it with sound on legalise.dev.