{
  "markdown": "# DancingElephant\n\n> **Legal AI that never forgets to check.** Research, drafting, and citation\n> verification for California solo and small firms — confidential client\n> information never leaves the lawyer's computer, and every citation is checked\n> against the official record. An elephant never forgets — and never fabricates.\n\nRebranded from **AskPauli** on 2026-08-18 for commercialization (mainstream\nrepositioning; new violet/teal/amber identity, Inter + Fraunces, line-elephant\nlogo — design source of truth in `docs/design-handoff/`). Previously renamed from\n**California Law Chatbot** on 2026-07-22. Originally built for Femme & Femme LLP;\ncommercialization assessment in `docs/commercialization-assessment-2026-07-16.md`.\n\n**This README describes the CURRENT system (V4, verified 2026-08-18).** The V1\nGemini/OpenRouter/CEB architecture was purged 2026-07-02 and its documentation\nremoved from this file 2026-07-24 — recover via git history (`git log --all`,\narchive tags). Deep architecture docs live in `openwiki/` (start with\n`openwiki/quickstart.md`); operator notes in `CLAUDE.md`.\n\n## What it is\n\n- **Two surfaces, one engine.** A web app (`dancingelephant.ai`, Vercel + Clerk +\n  Upstash; DNS on Cloudflare) and a **local-first macOS desktop app** (Tauri 2;\n  sessions, drafts, and audit logs in per-user SQLite under\n  `~/Library/Application Support/AskPauli/` — the directory name is kept from the\n  AskPauli era on purpose so existing installs retain their data; zero cloud data\n  stores; Upstash/Blob credentials are stripped at boot and the code fails closed\n  if any cloud path is reached). Legacy landing page: `askpauli.com` (rebrand +\n  redirect to dancingelephant.ai pending).\n- **Anthropic-direct agent loop** (`api/_lib/agentLoop.ts`): research, drafting,\n  and citation-verification workflows calling the Anthropic Messages API under\n  standard commercial terms + DPA (no training on API content). No other model\n  provider touches client content.\n- **Automatic latest-model adoption** (`api/_lib/modelResolver.ts`, 2026-07-22):\n  at boot, one background Models-API call resolves the newest model in each\n  approved family — Fable (research), Opus (unavailability failover), Sonnet\n  (quick mode + citation verifier) — cached, zero per-turn latency, pinned\n  known-good ids until resolution lands. `approvedModels.ts` remains the\n  fail-closed guard: families outside fable/opus/sonnet/haiku (and any\n  preview/mythos surface) are refused before a request is sent.\n- **Confidentiality-first pipeline**: on-device PII tokenization before any text\n  leaves the browser/app (`services/sanitization/`), a fail-closed server-side\n  regex backstop (`agentProxy.ts`), a server-authoritative compliance policy\n  engine (`api/_lib/compliance/policyEngine.ts` — matter modes, consent\n  hard-blocks, disclosures, lawyer-review gates), an outbound tool-query\n  exfiltration guard, and per-turn audit manifests recording the exact model\n  and policy applied.\n- **Verified citations**: CourtListener case-law search + a citation-verifier\n  sub-agent (newest Sonnet) + statute verification against official sources\n  (leginfo / Cornell LII / eCFR). CEB integration is permanently retired (their\n  ToS prohibits ingestion) — do not reintroduce.\n\n## Commands\n\nPackage manager **yarn 4**, Node **v24**. See `CLAUDE.md` for the verified list;\nhighlights:\n\n```bash\nyarn build              # vite build → dist/\nyarn dev:full           # local web dev (API :3000 + vite :5173)\nyarn desktop            # self-contained desktop dev (sidecar :8477 + native window)\nyarn desktop:app        # build → sign → NOTARIZE the distributable DancingElephant.app\nnode scripts/build-desktop-installer.mjs   # attorney installer zip (contains live keys — private channels only)\nyarn test:sanitization && yarn test:traps  # plus tests/*.test.mjs and runTrapsWire.mjs — keep 100% green\n```\n\n## Status (2026-08-18)\n\n- Production web: `https://dancingelephant.ai` (Vercel auto-deploy from `main`;\n  also `california-law-chatbot.vercel.app` and `chat.femmeandfemmelaw.com`).\n  DNS for dancingelephant.ai is on Cloudflare (nameservers titan/zelda) —\n  migrated off register.com's flaky nameservers; zone-migration script at\n  `scripts/migrate-dns-cloudflare.mjs`.\n- **DancingElephant rebrand shipped 2026-08-18**: all five surfaces reskinned\n  (violet #7C5CFC / teal / amber tokens in `tailwind.config.cjs`, Inter +\n  Fraunces, lucide icons, violet-gradient line-elephant logo), Pauli Murray\n  origin story and pink identity removed, attestation checkbox now required.\n  Design handoff (9 artboards + spec): `docs/design-handoff/`.\n- Desktop: notarized, Gatekeeper-accepted `DancingElephant.app` (bundle id\n  stays `com.askpauli.desktop` for data compatibility); installer zip at\n  `installer-pkg/dist/DancingElephant-Desktop-2026-08-18.zip` (**contains live\n  API keys — private channels only**). No auto-update yet (known gap).\n- Sanitization suite fully green (re-verified 2026-08-18 post-rebrand): wire\n  traps 120/120, analyze traps 120/120, unit tests 153/153, docx-surgery 50/50.\n- Pending: legacy `askpauli.com` landing-page rebrand + redirect; Clerk\n  application rename (dashboard-side; sign-in card still says \"California Law\n  Chatbot\"); Clerk → license-key auth, auto-update, discovery interviews.\n\n## 🚧 Architectural dead-ends — DO NOT REVISIT WITHOUT NEW EVIDENCE\n\nThis section exists so that future-Arjun and future-Claude don't re-litigate paths that were investigated and rejected. Each entry: **what we tried**, **why it didn't work**, **what would need to change before reconsidering**.\n\n### Claude Pro/Max subscription billing for V2 (2026-05-14)\n\n**What we tried.** Anthropic's June 15 2026 policy created a per-user Agent SDK credit on Claude subscriptions ($20 Pro / $100 Max 5x / $200 Max 20x per month). The hope was that each F&F attorney's V2 calls could bill against their own subscription credit, with auto-failover to F&F's API key when exhausted. We explored two architectures:\n\n- **Option B — browser-direct via `dangerouslyAllowBrowser`.** Each attorney's browser would call `api.anthropic.com` directly with their OAuth bearer token; the V2 server would only proxy tools + sanitization + audit. Preferred for invisibility.\n- **Option A — local proxy on each attorney's Mac.** A small daemon spawning Claude Code, with V2 cloud talking to it via WebSocket.\n\n**Why Option B doesn't work.** Empirically verified 2026-05-14 via three smoke tests:\n\n| Test | Result |\n|---|---|\n| `POST /v1/messages` with `Authorization: Bearer <oauth>` | HTTP 429 `rate_limit_error` — Anthropic intentionally rejects OAuth tokens on the standard messages endpoint |\n| `POST /api/oauth/claude_cli/create_api_key` with the same token | HTTP 403 `OAuth token does not meet scope requirement org:create_api_key` — Claude Code's OAuth is issued only with `user:inference` scope; the scope needed to mint a derived API key is not granted |\n| `@anthropic-ai/claude-agent-sdk` `query()` | HTTP 200 in ~8s — BUT a fetch-trace proved the SDK spawns the local `claude` binary as a subprocess (`child_process.spawn`). The success path runs **inside the Claude Code binary**, not over HTTP that a browser could replicate |\n\n**Conclusion: there is no documented or working browser-to-Anthropic OAuth-inference path.** The SDK works because it shells out to a locally-installed compiled binary; a browser cannot do that. Option B is permanently impossible against today's Anthropic auth surface.\n\n**Why Option A was rejected.** Architecturally possible but requires a local daemon installed per attorney machine + reachable from V2 cloud. For 2 attorneys, the ongoing operational cost (install/upgrade/rotate-token/handle-offline) outweighs the ~$400/mo savings the subscription credit would unlock. F&F's API key path (current production) is simpler and the firm can afford it.\n\n**What would change the calculus.**\n\n1. **Anthropic publishes a documented browser-OAuth-inference endpoint** — e.g., `api.anthropic.com/v1/oauth-messages` or a CORS-friendly authenticated endpoint. If that ships, Option B becomes viable.\n2. **Anthropic issues F&F a `org:create_api_key`-scoped OAuth client_id** — would unlock the OAuth → temporary API key exchange path, which is HTTP-based and browser-callable.\n3. **F&F grows past 5 attorneys** — operational cost of Option A's local daemon amortizes better; the $400+/mo savings starts mattering.\n4. **A binary alternative to the Claude Code CLI appears that runs in WASM or as a hosted service** — unlikely but would also unlock Option B.\n\n**Evidence to re-validate before reopening.** Re-run the three smoke tests in this section. If `POST /v1/messages` with an OAuth bearer ever returns 200 (not 429), or if a new Anthropic SDK appears that doesn't spawn a subprocess, the dead-end is gone and Option B is back on the table.\n\n**Filed as:** Phase 6 abandoned 2026-05-14. Tasks #117 (research) marked done; #118–#125 deleted. Commit: see V2 commit timeline.\n\n---\n\n",
  "bytes": 8987,
  "sha": "f8bdcf73455e44aea8a6d21f19f6a1647382d55c31fd039ddaaa73f160f6bf82",
  "repo_slug": "arjundivecha/california-law-chatbot",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/okf_arjundivecha_california_law_chatbot_open_c41282d5/readme"
}