Deeper · Law firm on retainer

Clawern

A second product in the same repository. Where Lavern is interactive, Clawern is autonomous: it watches a folder, reads what lands there, curates findings against an institutional memory, and delivers a bundle without a human in the loop until review time.

Where it runs

Entirely on the user's own machine. There is no Clawern server. The whole product is a Node.js process bundled into a CLI binary (npm run claw or the installed claw command), with src/claw/index.ts as the entry point.

Daemondaemon.ts registers a macOS LaunchAgent plist; daemon-systemd.ts is the Linux equivalent. Both restart Clawern on boot and on crash. Logs go to local files.
Filesystem watchwatcher.ts uses chokidar to watch a local folder — debounced, symlink-guarded. Default inbox sits inside ~/.lavern/ (override with LAVERN_CLAW_DIR).
In-process pipelineWhen a file lands, watchman.tsprocessor.ts runs the parse / infer / dispatch loop in-process. LLM calls go out to Anthropic (or Ollama on the same machine for hybrid / local mode); everything else stays local.
State on diskDocument registry, precedent board, audit log, daily backups, profile, deliveries — all flat files and JSON under ~/.lavern/.
Network surfaceOutbound only — LLM APIs, Telegram, optional webhook. No inbound ports unless the user starts the local dashboard.

Control surfaces, all polling locally

The privacy story is direct: data never leaves the user's disk unless explicitly escalated to a frontier model — and even then via the anonymisation step.

Lighthouse architecture

Added in commits 4455d89 → 2276bae after a v1 → v3.4 evaluation arc on 10 CUAD contracts. The pipeline has three named stations and a memory store:

Watchmanwatchman.ts + watcher.ts. Filesystem watch with debounce and symlink protection. Hands new arrivals to the Reader.
Readerreader-templates.ts + processor.ts. Parses, infers document type, dispatches to the right analysis path.
Curatorcurator.ts. Reconciles new findings against the precedent board — dedup, decay, surface what matters.
Precedent boardprecedent-board.ts. Cross-document finding store, O(1) dedup, relevance search, decay + compaction.

Institutional memory

The precedent board is what makes the law-firm framing literal. Every finding written for a client gets persisted with provenance. Later documents query that history — have we seen this clause before? what did we say last time? did the counterparty accept the redline? Decay rules prevent the store from drifting; compaction keeps it small.

Modes of operation

Multi-client isolation

client-registry.ts partitions everything by client: directories, profiles, budgets, precedent shards. No cross-client reads. A finding from Client A never surfaces in Client B's review.

Operational surface

daemon.ts + daemon-systemd.tsmacOS LaunchAgent and Linux systemd unit management
notify.tsWebhook + macOS native notifications, with dedup and redaction (heartbeat, precedent match)
telegram-bot.ts + notify-telegram.tsTwo-way Telegram bot — receive alerts, issue commands, scan-on-demand
audit.tsAppend-only JSON-lines audit trail with rotation
backup.tsDaily state snapshot, 30-day retention
diff.tsFindings diff across review sessions — added / resolved / changed
events.tsClawEventBus singleton for real-time WebSocket streaming to the dashboard
menubar/Native macOS SwiftUI status-bar app — polls Claw API every 30s, document counts, budget gauge, daemon status, quick actions

Dashboard surface

viz/src/claw/ mirrors the daemon with Overview (Portfolio Intelligence), Documents (inline error recovery), Deliveries (change detection), Precedents, and Config. Same event stream the menu bar app polls.