A blocky, third-person 3D law office that runs on your Mac. Seven staff characters walk the floor and do real work in the software a small firm already uses:
| Character | Role | What they actually do |
|---|---|---|
| Desmond Hale | Managing Attorney | Delegates discovery to the team and gives final review |
| Imani Brooks | Senior Associate | Researches at the library terminal with real CourtListener opinions and statute text, and checks every quote word-for-word |
| Priya Raman | Associate | Turns Imani's memo into a formatted Word + PDF motion, then checks it against the rendered pages |
| Theo Navarro | Senior Paralegal | Extracts discovery requests word-for-word and screens for privilege |
| Rosa Delgado | Paralegal | Assembles a Bates-labeled proposed production and privilege log |
| DOCKET | Intake robot | Reads Outlook, matches each e-mail to a Clio matter, OCRs the attachments, and spots what's missing |
| STAPLE | Filing robot | Files originals and cleanly renamed copies to OneDrive, then writes Clio notes and follow-up tasks |
Everything the firm produces is labeled DRAFT. The app never sends, serves, files or signs anything.
You don't need any accounts to try it. With no credentials, every connector runs in a clearly labeled DEMO mode with a fake Clio, a local mailbox and a local "OneDrive". Connect your real accounts one at a time when you're ready.
Everyone and everything in the demo case (In re Marriage of Hartley, Travis County, Texas) is fictional. This is a demo and teaching project, not legal software. Nothing it produces is legal advice, and every draft needs review by a licensed attorney.
- Requirements
- Quick start (demo mode, no accounts)
- Connecting your real accounts
- Playing the demo case
- Controls
- Commands
- Configuration reference
- Troubleshooting
- Privacy and security
- How it fits together
- More docs · License
- macOS. Some scripts use the Mac
opencommand and Homebrew paths. Other systems may work but haven't been tested. - Node.js 24 or newer. The server uses Node's built-in SQLite and runs TypeScript directly. Check your version with
node -v. - Document tools from Homebrew:
brew install poppler tesseract # PDF text/rendering + OCR for photos and scans
brew install --cask libreoffice # renders Word drafts to PDFIf LibreOffice lives somewhere unusual, set SOFFICE_PATH in .env to the full path of soffice.
git clone https://github.com/YASAM1/blocklaw.git
cd blocklaw
npm install
cp .env.example .env # leave the blanks blank for now: that's DEMO mode
npm run fixtures # builds the fictional case packet + demo-email-kit/
npm run seed # creates the demo matters and folders (in DEMO mode, locally)
npm run dev # server on :8791 + game on http://localhost:5173Open http://localhost:5173 and click Enter the Firm.
To watch a workflow run offline, press Q and click Drop next demo email. DOCKET picks it up within a few seconds.
The badges in the top-right corner (and the C panel) show each connector's mode: LIVE, DEMO, OFF or ERROR.
Each connector switches from DEMO to LIVE on its own as soon as its credentials are in .env. You can connect any subset: for example, Claude and CourtListener only, with Clio and Outlook left in demo mode.
| Service | What the game uses it for | Cost | Time to set up |
|---|---|---|---|
| Claude (Anthropic API) | Character dialogue, matching, classification, research memos, drafting | Pay-as-you-go API usage | 2 min |
| CourtListener | Live case-law search and opinion text | Free account | 2 min |
| Clio Manage | Matters, contacts, tasks, notes, the case and fee boards | Needs a Clio account | 10 min |
| Microsoft 365 | Reading the intake mailbox (Outlook) and filing documents (OneDrive) | Needs a Microsoft account | 15 min |
All credentials go in the .env file in the project folder. That file is git-ignored, so it never reaches GitHub. Restart npm run dev after editing .env.
This app writes to your real accounts. Here's exactly what it can do:
| Service | Reads | Writes | Never does |
|---|---|---|---|
| Clio | Matters, contacts, tasks, notes, users, bill payment allocations, revenue report | Creates demo matters, contacts, tasks and notes; completes tasks it started; npm run reset deletes records the app created |
Writes to any matter that isn't a tagged demo matter (refused in code), or creates bills or payments |
| Outlook | Messages and attachments in one folder, received after your last seed/reset |
Can save a draft (for example, a document request to a client). npm run reset deletes drafts it created |
Send, reply or forward. Those endpoints are blocked in code, and the app doesn't ask for Mail.Send |
| OneDrive | Its own BlockLaw Demo/ folder |
Creates folders and uploads files under BlockLaw Demo/ only |
Touch files outside that folder |
Strong recommendation: use a sandbox or test account for Clio and Microsoft 365 (a Clio trial or developer account, and a Microsoft 365 developer tenant or spare mailbox). Never point this at a mailbox or Clio account that holds real client data. Real client documents would be sent to the Anthropic API for processing.
Claude powers everything the characters say and write.
-
Go to console.anthropic.com, sign in, and add a payment method under Billing.
- A Claude.ai or Claude Code subscription does not include API access. You need an API key from the Console.
-
Open API Keys → Create Key. Copy the key (it starts with
sk-ant-). -
Add it to
.env:ANTHROPIC_API_KEY=sk-ant-...your key... -
Optional tuning:
Setting Default What it does AI_MODELclaude-sonnet-5-5Main model for drafting and reasoning AI_FAST_MODELclaude-haiku-5-5Cheaper model for quick classification and chat AI_MAX_CALLS_PER_HOUR80Hard cap, so a runaway loop can't run up a bill AI_MAX_CONCURRENT2Parallel calls
Claude is only called when a task step needs it or you type a request. It is never called per frame, per movement, or for idle chatter. The C panel in the game shows the number of calls and the estimated cost so far. To keep spending predictable, also set a monthly limit under Console → Billing → Limits.
CourtListener, from the non-profit Free Law Project, provides the case law Imani researches.
-
Create a free account at courtlistener.com/sign-in and confirm your e-mail.
-
Open your profile menu → Developer Tools → API Token (direct link) and copy the token.
-
Add it to
.env:COURTLISTENER_API_TOKEN=your-token -
Test it (uses 2 API calls):
npm run check:courtlistener
Good to know:
- The app throttles itself to 4 calls a minute and 100 a day (
COURTLISTENER_PER_MINUTE,COURTLISTENER_PER_DAY), which stays under CourtListener's limits for free accounts. - Every response is cached in
data/cache/courtlistener/, so repeat runs of the same research cost nothing. - Coverage caveat: CourtListener's state family-law coverage is incomplete, and it doesn't tell you whether a case is still good law. Every research memo says so. Always confirm authorities in a citator before relying on them.
Clio supplies the matters, contacts, tasks and notes, plus the two wall boards in the office.
Step 1: Create a developer application in Clio
-
Sign in to Clio Manage as an admin. Go to Settings → Developer Applications (
https://app.clio.com/nc/#/settings/developer_applicationsin the US) and click Add. -
Fill in:
- Name:
Block & Associates(anything works) - Website URL:
http://127.0.0.1:8791 - Redirect URI:
http://127.0.0.1:8791/api/auth/clio/callback(this must matchCLIO_REDIRECT_URIexactly)
- Name:
-
Under Permissions, choose:
Permission Access Matters Read / Write Contacts Read / Write Tasks Read / Write Notes (Communications) Read / Write Users Read Billing (bills, allocations) Read Reports Read / Write (the fee board requests Clio's revenue report) Documents Read Clio's permission labels change from time to time. If a call later fails with
403 ForbiddenError, add the missing permission, save, and reconnect. Clio fixes the permissions at the moment you authorize. -
Save, then copy the App Key (client ID) and App Secret.
Step 2: Add the keys to .env
CLIO_CLIENT_ID=your-app-key
CLIO_CLIENT_SECRET=your-app-secret
CLIO_REGION=app.clio.com # EU: eu.app.clio.com · Canada: ca.app.clio.com · Australia: au.app.clio.com
CLIO_REDIRECT_URI=http://127.0.0.1:8791/api/auth/clio/callbackStep 3: Sign in
Stop the game server first (Ctrl+C). The sign-in helper briefly uses the same port, 8791. Then:
npm run connect:clioYour browser opens Clio's consent screen. Approve it, and you'll see "Block & Associates is connected to Clio". The tokens are saved in the local database (data/blocklaw.db) and refresh themselves automatically.
Already have tokens from another tool? You can put
CLIO_ACCESS_TOKENandCLIO_REFRESH_TOKENin.envinstead of runningconnect:clio.
Step 4: Create the demo matters
npm run seedThis creates six fictional matters (Hartley, Hartley Family Trust, Nguyen, and others). Their descriptions are tagged [BLOCKLAW DEMO], and the seed adds their contacts and a few realistic tasks. It is safe to run again: it reuses what already exists. The app only ever writes to these tagged matters.
What appears in the game:
- Open Matters board: the demo matters with their real Clio tasks and due dates. Set
CLIO_BOARD_SCOPE=opento show all open matters instead (read-only for non-demo matters). - Firm Vision board: calendar-year collected fees, worked out from Clio's payment allocations as
payment applied × (services subtotal ÷ bill total). It excludes unpaid invoices, expenses, tax, interest, credit notes and unapplied trust money. Press E at the board to see the definition and breakdown. Reconcile it against Clio's own Revenue report before you rely on it. - Clio triggers: create a Clio task on a demo matter whose name starts with
@game(for example@game summarize the matter status), and the crew picks it up as a job. When they finish, they mark the task complete and leave a result note.
DOCKET watches one Outlook folder for new mail, and STAPLE files documents to OneDrive. Both go through Microsoft Graph.
Step 1: Register an app in Microsoft Entra
-
Go to entra.microsoft.com → Identity → Applications → App registrations → New registration.
-
Name:
Block & Associates. For Supported account types, pick one:- Accounts in this organizational directory only, for a work/school Microsoft 365 tenant (recommended; this is what was tested), or
- Accounts in any organizational directory and personal Microsoft accounts, if you want to use an Outlook.com account.
-
Click Register, then copy the Application (client) ID from the Overview page. If you chose a single tenant, also copy the Directory (tenant) ID.
-
API permissions → Add a permission → Microsoft Graph → Delegated permissions. Add:
User.ReadMail.ReadWriteFiles.ReadWrite.Alloffline_access
Don't add
Mail.Send. The app has no sending code at all. If your organization requires it, click Grant admin consent.
Step 2: Choose a sign-in style
| Option A: Device code (simplest) | Option B: Web app with a client secret | |
|---|---|---|
| In Entra | Authentication → Advanced settings → Allow public client flows = Yes | Authentication → Add a platform → Web, redirect URI http://localhost:3000/api/graph/oauth/callback. Then Certificates & secrets → New client secret and copy the Value |
In .env |
MS_CLIENT_ID, MS_TENANT. Leave MS_CLIENT_SECRET blank |
MS_CLIENT_ID, MS_TENANT, MS_CLIENT_SECRET, MS_REDIRECT_URI |
| Sign-in | The terminal shows a code to enter at microsoft.com/devicelogin | A browser window opens; approve it |
MS_CLIENT_ID=00000000-0000-0000-0000-000000000000
MS_TENANT=common # or your tenant ID / domain; use "consumers" for personal accounts only
MS_CLIENT_SECRET= # Option B only
MS_REDIRECT_URI=http://localhost:3000/api/graph/oauth/callback
OUTLOOK_FOLDER=Inbox # the folder DOCKET watches
ONEDRIVE_ROOT=BlockLaw Demo # everything is filed under this OneDrive folder
OUTLOOK_POLL_SECONDS=60Client secrets expire (6–24 months, depending on what you chose). When yours does, create a new one and update .env.
Step 3: Sign in
npm run connect:microsoftSign in as the mailbox the robots should watch. The terminal confirms ✔ Connected to Microsoft as … and lists the permissions that were granted. Tokens are stored only in data/blocklaw.db.
Step 4: Run (or re-run) the seed
npm run seedThis creates BlockLaw Demo/ in OneDrive with one folder per matter:
BlockLaw Demo/
└── <matter number>-Hartley In re Marriage of Hartley/
├── 00 Originals (as received)
├── 01 Client Documents
├── 02 Discovery Received
├── 03 Drafts
├── 04 Production
└── 05 Research
Important: the robots only process mail received after the last npm run seed or npm run reset. Mail already in the folder is never touched.
npm run statusThis prints each connector's mode (LIVE / DEMO / OFF / ERROR) and the account it's signed in as. In the game, press C for the same view, and click Re-check connections after any change.
You can force a mode for any connector in .env:
CLIO_MODE=auto # auto | live | fixture | off
MICROSOFT_MODE=auto
COURTLISTENER_MODE=auto
AI_MODE=autoauto (the default) means LIVE when credentials exist and DEMO otherwise. fixture forces DEMO mode even when you have credentials, which is handy for rehearsing.
The demo tells one connected story: Lauren Hartley sends her divorce documents → opposing counsel serves discovery → the firm researches and drafts a Motion for Temporary Orders.
npm run fixturesbuilds the fictional case packet and ademo-email-kit/folder holding three ready-to-send e-mails, each with attachments. The kit is git-ignored because it contains your mailbox address.- With Outlook connected, send the kit's e-mails from a different mailbox to the one the robots watch:
- #1 Client documents: 8 messy attachments (a phone photo of a pay stub, a duplicate statement, a hidden prompt-injection line). DOCKET OCRs, classifies, renames, skips the duplicate, ignores the injection, and asks for what's missing.
- #2 Discovery requests: from opposing counsel. Desmond delegates. Theo extracts 22 requests word-for-word, Rosa Bates-labels the production, and Imani drafts responses.
- #3 Signed copy: ambiguous on purpose. DOCKET asks you which Hartley matter it belongs to instead of guessing.
- Talk to Imani (press E) → Assign a task → Research & draft the temporary orders motion.
- Look at the results: in the game (T tasks, L log, the boards), in OneDrive (
BlockLaw Demo/), and in Clio (the Hartley matter's Notes and Tasks).
In DEMO mode, skip the sending and use Q → Drop next demo email.
Starting over: stop the server, then:
npm run reset # preview only: shows what would be removed
npm run reset -- --confirm # clears the last run, keeps the seeded matters
npm run reset -- --all --confirm # also removes the seeded matters and contactsThe reset only removes records this app created.
A full scene-by-scene tour is in docs/FILMING.md.
| Move | W A S D (Shift = sprint, Space = hop) |
| Camera | Arrow keys (← → orbit, ↑ ↓ tilt), mouse (click to capture, Esc to release), wheel (zoom) |
| Talk / interact | E: characters, boards, computers, the mail sorter |
| Switch character | 1–7 or Tab, or click a portrait |
| Full screen | F11 (Mac: fn+F11), Shift+F, or the ⛶ button |
| Celebrate | G or the 🎉 button (everyone gathers in reception and dances) |
| Panels | O firm overview · T tasks · L activity log · C connections · Q intake queue · B case board · H help |
Sit at any desk computer (E) to open BlockOS: Clio and Outlook at every desk, plus CourtListener on the library terminal. Each app shows your live data, and its Open in … ↗ button opens the real web app in a new tab.
| Command | What it does |
|---|---|
npm run dev |
Local server + game with hot reload (http://localhost:5173) |
npm start |
Production build served by the local server (http://127.0.0.1:8791) |
npm run play |
Opens the game in an immersive app window (no tabs or address bar). -- --kiosk locks it full screen (quit with ⌘Q) |
npm run fixtures |
Builds the fictional case packet and demo-email-kit/ |
npm run email-kit |
Rebuilds only demo-email-kit/ |
npm run seed |
Creates or reuses the demo matters, contacts, tasks and OneDrive folders (safe to re-run) |
npm run reset |
Preview a reset. Add -- --confirm to apply it, or -- --all --confirm to also remove the seeded matters |
npm run connect:clio |
Sign in to Clio (stop the server first) |
npm run connect:microsoft |
Sign in to Outlook/OneDrive |
npm run status |
Connection check for every service |
npm run check:courtlistener |
CourtListener token check |
npm test |
Unit tests (engine, matching, fee math, extraction, connector failures) |
npm run typecheck |
TypeScript check |
Everything lives in .env. See .env.example for the full annotated list. Highlights beyond the connector settings above:
| Setting | Default | What it does |
|---|---|---|
PORT / HOST |
8791 / 127.0.0.1 |
Local server address. Keep HOST on 127.0.0.1 so only your own machine can reach it |
MAX_CONCURRENT_TASKS |
4 |
Jobs the crew works on at once |
TASK_MAX_ATTEMPTS |
3 |
Retries before a task is marked failed |
DEMO_STEP_DELAY_MS |
900 |
Pause between workflow steps so the movement is watchable. Set 0 for speed |
AUTO_POLL_INBOX |
true |
Check Outlook automatically. Set false to trigger polls by hand (Q → Poll mailbox now) |
FIRM_NAME, FIRM_ATTORNEY_NAME, FIRM_ATTORNEY_BAR_NO, FIRM_ADDRESS, FIRM_PHONE, FIRM_EMAIL |
Block & Associates, PLLC / blank |
The signature block on drafts. Blanks show as [bracketed placeholders] |
BATES_PREFIX |
HARTLEY |
Prefix for Bates numbers on the production |
CLIO_BOARD_SCOPE |
demo |
demo = tagged matters only; open = all open matters on the case board |
CLIO_DEMO_TAG |
[BLOCKLAW DEMO] |
The tag that marks a matter as safe for the app to write to |
SOFFICE_PATH |
auto-detected | Path to LibreOffice's soffice |
| Problem | Fix |
|---|---|
| A badge says ERROR | Press C to see the message, or run npm run status |
Clio: 403 ForbiddenError |
Add the missing permission to your Clio developer app, then run npm run connect:clio again |
Clio: redirect_uri mismatch |
CLIO_REDIRECT_URI must match the app's Redirect URI character for character (watch 127.0.0.1 vs localhost) |
connect:clio fails with EADDRINUSE |
The game server is still running on port 8791. Stop it first |
Microsoft: AADSTS7000218 (client_assertion or client_secret required) |
You're using device code but the app isn't a public client. Turn on Allow public client flows, or add a secret (Option B) |
Microsoft: AADSTS50011 (redirect URI mismatch) |
Add http://localhost:3000/api/graph/oauth/callback as a Web redirect URI, or change MS_REDIRECT_URI to match |
Microsoft: AADSTS65001 / consent required |
An admin needs to click Grant admin consent on the app's API permissions page |
Outlook web shows TenantAccessBlockedException |
The tenant's Microsoft 365 subscription has lapsed. Reactivate it under admin center → Billing → Your products. Mail sent while blocked must be re-sent |
| DOCKET ignores an e-mail | Only mail received after the last seed/reset, in OUTLOOK_FOLDER, is processed. Press Q → Poll mailbox now to check immediately |
| A task failed | T → Retry. It resumes after the last step that succeeded and repeats nothing |
| Drafts have no PDF | Install LibreOffice (brew install --cask libreoffice) or set SOFFICE_PATH |
| Photo/scan text is missing | Install Tesseract (brew install tesseract) |
| CourtListener says the budget is used up | Wait for the per-minute or per-day window to reset. Repeat searches come from the cache |
| AI calls stopped | You hit AI_MAX_CALLS_PER_HOUR. Wait, or raise the limit |
- Secrets stay local. API keys live in
.env, and OAuth tokens live indata/blocklaw.db. Both are git-ignored, and neither is ever sent to the browser. - The server listens on
127.0.0.1only by default, so other devices on your network can't reach it. - Where your data goes. Document text, e-mail content and matter details are sent to the Anthropic API for processing. Search queries go to CourtListener. Nothing else leaves your machine except calls to Clio and Microsoft themselves. Review Anthropic's data-use terms before using this with anything sensitive, and don't use it with real client data.
- Hard guardrails in code: Outlook send/reply/forward endpoints are blocked; Clio writes are refused unless the matter is tagged as a demo matter; OneDrive writes stay inside
ONEDRIVE_ROOT; nothing is ever billed, filed or served. - Prompt-injection handling. Instructions found inside e-mails and documents are treated as data, logged, and listed in the Clio intake note. They never change what the robots do.
- Generated files (
data/,demo-email-kit/,dist/) are git-ignored.demo-email-kit/contains your mailbox address, so don't commit it.
browser (Three.js game, BlockOS, boards) ──/api + SSE──▶ local Node server (no external infra)
├─ task engine (SQLite: states, steps, side-effect ledger)
├─ workflows: intake · discovery · research & drafting
├─ connectors: Clio · Outlook/OneDrive (Graph) · CourtListener · Claude
└─ documents: pdftotext/tesseract OCR · docx · LibreOffice PDF · pdf-lib Bates · raster redaction
server/ local API, task engine, workflows, connectors, document tools
src/ the game (Three.js world, characters, UI, BlockOS)
shared/ types and the character roster shared by both
demo/ the fictional Hartley case: case data, e-mails, document packet
scripts/ seed, reset, connect, status, fixtures, play
tests/ unit tests and smoke scripts
docs/ setup reference, demo walkthrough, licenses, API research notes
- docs/SETUP.md: a shorter connector reference
- docs/FILMING.md: a scripted, shot-by-shot demo of every workflow
- docs/LICENSES.md: art, sound, library and legal-source licensing
- docs/research/api-reference.md: the Clio, Graph, CourtListener and Anthropic API notes the connectors were built from
- docs/research/texas-travis-sources.md: the Texas and Travis County sources used for the demo motion
MIT. The art and sound are generated in code; see docs/LICENSES.md for third-party libraries and legal sources.
Clio, Microsoft 365, Outlook, OneDrive, CourtListener and Claude are trademarks of their respective owners. This project is not affiliated with or endorsed by any of them.