Implement Turbine Legal matter command center

✅ merged · #1 · beautech-aero/legal-platform ← beautech-aero/legal-platform · opened 19d ago by igor-ctrl · merged 19d ago by igor-ctrl · self · +17,274-16,464 across 110 files · ↗ on GitHub

From the PR description

Summary

This PR turns the Mike fork into the first Turbine Legal matter command center for Beautech's aviation-leasing legal team.

It keeps the existing projects foundation compatible, but shifts the preferred product surface to Matters. V1 now supports Salesforce Opportunity intake, matter lifecycle metadata, S3-backed working documents, Dropbox archive/import/publish scaffolding, DocuSign envelope tracking/archive scaffolding, and matter-grounded AI workflows for contract review work.

What Changed

  • Rebranded the user-facing product from Mike to Turbine Legal across app chrome, metadata, prompts, generated-document metadata, env examples, and docs.
  • Added /matters routes and frontend pages while preserving /projects compatibility.
  • Added matter lifecycle fields and tables for external links, activity events, tasks, Dropbox file links, DocuSign envelopes, and encrypted integration connections.
  • Added Salesforce Opportunity search/intake flow for creating or linking matters and refreshing copied metadata.
  • Added admin integration connection scaffolding for Salesforce, Dropbox Business, and DocuSign using encrypted token storage.
  • Added Dropbox matter-folder link/import/publish scaffolding with sync timestamps and conflict metadata.
  • Added DocuSign envelope link/status/webhook/archive scaffolding.
  • Added the matter command center UI, Salesforce intake modal, matter metadata/status panels, task/activity surfaces, and integration cards.
  • Fixed matter document upload behavior so uploads target matter documents, surface UI errors, validate S3 config clearly, and write folder structure metadata as valid JSONB.
  • Kept S3 as the authoritative working/version store and documented Dropbox as explicit archive/import/publish, not continuous sync.
  • Reworked API key/profile handling so server-level OpenAI/Anthropic keys are recognized, per-user encrypted keys still override them, and provider availability is visible in /account/models without exposing secrets.
  • Removed Gemini path and added OpenAI/Anthropic provider abstraction, LLM concurrency limiting, and OpenAI max_completion_tokens handling for current GPT chat models.
  • Added Turbine Legal system prompt, matter-context prompt extension, built-in legal workflows, review-table prompts, and workflow tool loading.
  • Added PRD and release plan docs, including Word round-trip, WOPI feasibility, WOPI host, Word add-in, and future AI model/effort-control roadmap.

Notes For Review

  • The active database needs the Turbine Legal matter migration applied, especially backend/migrations/001_turbine_legal_matter_extensions.sql, before matter creation flows that write lifecycle columns will work.
  • DOCX upload stores the original file even if LibreOffice is missing, but PDF preview conversion requires soffice on the backend host.
  • Dropbox Business tokens are expected to be team-scoped. The integration path should use DropboxTeam(token).as_user(member_id) and validate with team/token/get_authenticated_admin.
  • OpenAI is currently fixed for the max_tokens vs max_completion_tokens issue. The next model-policy pass should verify exact provider IDs before switching runtime config to Claude Opus 4.7 / Sonnet 4.6 / Haiku 4.6 and GPT-5.5-only.
  • WOPI and the Word add-in are intentionally documented future phases, not part of this V1 implementation.

Verification

  • npm run build --prefix backend
  • Frontend TypeScript check passed during implementation: ./frontend/node_modules/.bin/tsc --noEmit --project frontend/tsconfig.json
  • Focused frontend lint passed on touched model/profile files during implementation.
  • git diff --check
  • Live S3 bucket preflight succeeded during upload debugging.
  • Matter upload path was exercised locally after the SQL schema update.

Known Follow-Ups

  • Full frontend lint still has existing repo-wide React Compiler/ESLint debt; keep focused lint/type checks on changed files until that is cleaned up.
  • npm run build --prefix frontend previously reached the optimized production build step and timed out in the local agent environment; rerun in CI/Vercel.
  • Add focused smoke tests for matter create, document upload, version upload, Salesforce intake mapping, Dropbox import/publish metadata, DocuSign webhook/archive, and matter access control.
  • Remove or gate development-only system-prompt logging before production deployment.
  • Build the R4A model settings workstream: exact model ID verification, reasoning-effort controls, Fast Mode toggle, persistence, and adapter wiring.

Our analysis

Pivot the Mike fork into Turbine Legal matter command center — read the full analysis →

Think the analysis missed something the PR description covers?

Commits in this PR (1)

SHA Subject Author Date
22f9039d Implement Turbine Legal matter command center igor-ctrl 2026-05-07 ↗ GitHub

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-1.md from inside the repo you want the changes in.

⬇ Download capture-pull-1.md