All packs
    Claude Code
    Intermediate

    The Law Firm OS

    the brain that runs a law firm

    Cover art for the The Law Firm OS Build Pack
    About an hour for setup, then thirteen prompts over four or five evenings
    $0 beyond Claude Code with OpenRouter free models; $10 of credit when the brief goes to a real partner; VPS or Mac mini optional
    13 prompts
    v1.0.0
    next.js
    postgres
    docker
    claude-code
    openrouter
    ollama

    A self-hosted operating system for a small law firm: intake, conflict checks, a weighted pipeline, matters, time and billing, and an append-only trust ledger the database enforces. One button ranks what the partner should handle today. Next.js, Postgres, Docker, Claude Code, from a clean machine.

    What you build

    PartWhat it isWhat it does
    EyesA Next.js dashboard, dark, dense, ledger-style numbersDashboard, Matters, Time and billing, Trust, Conflicts, Schedule, Team, Leads, Deals, Contacts, Email, Finance, Notifications. Every KPI carries a plain-language subtitle.
    BrainClaude Code, then an LLM through OpenRouter or OllamaClaude builds it. The runtime model writes the morning brief and per-matter briefs, behind a fallback chain that never fails silently and a validator that rejects any claim not in the data.
    MemoryPostgres, about twenty tables, money in centsLeads, deals, conflict checks, matters, deadlines, time, invoices, payments, trust ledger, events, briefs. Trust rows are never edited or deleted; no balance goes below zero. Postgres enforces it.
    The gateA conflicts check with fuzzy party matchingEvery party on a new matter is searched against every contact, company, adverse party and counsel the firm has ever recorded. Postgres refuses to open a matter without a cleared or waived check.
    Nervous systemOne intake door and one in-app event busPOST /api/leads/submit takes every future channel in one shape. Every module writes events; Notifications, Schedule and the brief read them. No external queue.
    The human boundaryApprove buttons on everything that leaves the buildingReminders go out on a click and count as sent only when confirmed. Trust moves to operating only against a paid invoice, on a click. The brief carries a drafting-assistance footer. No auto-send.

    Where this comes from

    Structure Webworks published "Operating a Law Firm with 31 AI Agents": a legal operating system where six departments — intake, a conflicts gate, a CRM pipeline, matters, time and billing, trust and finance — share one database and one event bus, and an orchestrator called Brief the Firm reads all of it and hands the managing partner a ranked decision list. The link is in the files box. It is a good map. The part worth copying exactly is the shape: every module feeds the next, and one button turns the data into a decision instead of another dashboard.

    Their article describes the dashboard as thirty-one agents. Look closely at their screenshots and the only model call on screen is the brief. This pack builds the same thing honestly: deterministic code gathers the facts, one LLM call ranks and writes, and a validator throws out any line that cites a matter, invoice or amount that is not in the data. The model writes the sentences. The database decides what is true.

    What you build

    When it runs, it feels like an office manager who read every file before you got in. A lead comes through one door and becomes a deal. The deal cannot become a matter until every party has been checked against everyone the firm has ever recorded, and Postgres refuses to open the matter if the check is not cleared. Hours become work in progress, work in progress becomes an invoice, the invoice ages into buckets, and a reminder gets drafted — but a human clicks Send, and the app will not say "sent" until someone confirms it went. Client trust money lives in an append-only ledger that cannot go below zero, and the reconciliation panel shows a difference rather than hiding it.

    Then you press one button. The brief comes back with a headline, a "deal with first" list with NOW / THIS WEEK / WATCH on each line, the owner, the reason, and a link to the record — and a footer that says it is drafting assistance, not legal advice. The one thing it deliberately does not do: touch a client, a court, a bank, or a bill on its own. There is no setting for that, and the prompts tell Claude not to add one.

    Do you need this? Be honest first

    If you are a solo practitioner with a dozen open matters and a practice-management subscription you already trust, keep it. This is for the small firm — one to fifteen attorneys — where the pipeline lives in a partner's head, the trust ledger is a spreadsheet nobody wants to touch, and deadlines get calendared by whoever remembers. It is also for the builder who wants to sell that firm a system it owns.

    You are building software for a law firm, not practicing law. The deadline rules ship as examples labeled as examples. Which rules apply, which bar regulates the trust account, and what "compliant" means is the firm's call and their lawyer's job. If you are not comfortable saying that out loud to a client, close the tab.

    What you need

    Pick the machine first:

    OptionGood forRuntime model
    Any laptop — Windows with WSL, Mac, or Linux with OmarchyLearning and buildingOpenRouter free models
    A Mac mini with 64 GB or moreRunning it in the office with local AI; client data never leavesOllama with qwen3:32b or llama3.3:70b
    A small VPSReachable from anywhere, 24/7OpenRouter

    Every option needs Claude Code logged in (Pro, Max or Team), Docker, Node and git. The pack assumes none of them are installed: the setup guide starts at "open a terminal" (or install one — Windows Terminal, Tabby, PuTTY, Terminal.app, or Super + Return on Omarchy) and ends when claude, docker and node all answer. It covers the OpenRouter account (free models first, $10 of credit when the brief goes to a real partner), Ollama on a 64 GB Mac, and a VPS if you go that way. Nothing of the author's is in it; every credential is yours.

    The setup guide is one HTML file you open in a browser. Every command has a copy button, every step has a checkbox, and a progress bar at the top shows how far along you are. Your progress is saved in that browser.

    What is in the zip

    law-firm-os/
      README.md               the document: what, why, hosting, the accounts, the folder map
      index.html              the clickable setup guide with all thirteen prompts (same as the browser link above)
      COSTS.md                every cost, with the date it was read
      CREDITS.md              where the idea comes from, what was verified, terms
      paths/                  one README per platform: Windows WSL2, Mac Apple Silicon, Linux Omarchy
      prompts/                00-project-brief ... 12-tests-and-smoke
      assets/                 the cover art
    

    What was verified and what was not

    The setup guide was opened in a real browser and driven by a script on 2026-08-30: the three platform tabs, the progress bar, the checkboxes, the saved progress, and the copy buttons all work — including from a downloaded file, where the modern clipboard API silently fails and the guide falls back to the older method. The install commands are the current official ones for WSL, Homebrew, Docker, nvm, pacman and Claude Code as of that date; they were not executed end to end on three fresh machines for this release.

    The thirteen prompts were written against a reviewed design and have not been run as a sequence. Every prompt ends with a "how you know it worked" check that you can see without reading code — Postgres rejecting an overdraw in its own words, a reminder turning into "send unconfirmed" when nobody confirms it, the brief refusing an invoice number that does not exist. Prompt 12 makes Claude break the code on purpose to prove the tests can fail. If a prompt breaks on your machine, post the full error and the platform in the community.

    Read the prompt before you run it

    Hand each prompt to Claude first and ask what it plans to build. Compare that to what the prompt says. A prompt costs a minute to fix. A wrong build costs an afternoon.

    More packs