Skip to content

feat: Litigation AI assistant + command center enhancements - #46

Merged
chitcommit merged 1 commit into
mainfrom
feat/litigation-assistant-and-command-center
Mar 22, 2026
Merged

chitcommit merged 1 commit into
mainfrom
feat/litigation-assistant-and-command-center

Conversation

@chitcommit

@chitcommit chitcommit commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Litigation AI page — 3-step evidence pipeline (Synthesize → Draft → QC) powered by Cloudflare AI Gateway, replacing standalone Gemini HTML dashboard
  • Command center redesign — ActionStream, SystemPulse, VitalSigns components for operational dashboard
  • Schema additions — chittyId columns on obligations/properties/legal_deadlines/documents, scrape_jobs migration
  • Infrastructure — fan-out dispatcher, job routes, expanded cron scheduling, MCP tool registration endpoints

Test plan

  • Verify npx tsc --noEmit passes (backend + UI)
  • Verify npx vite build succeeds
  • Test /litigation page renders with pipeline steps
  • Test synthesize/draft/qc endpoints against AI Gateway
  • Verify sidebar shows "Litigation AI" under Disputes group
  • Run migration 0013 against Neon DB

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Litigation Assistant: AI-powered synthesis, drafting, and QC scanning for legal communications
    • Command Center Dashboard: displays vital metrics, action stream, and system health monitoring
    • Job Management API: orchestrates scrape jobs and lifecycle tracking
    • Navigation reorganized into labeled category sections
  • Style

    • Enhanced dashboard styling and updated UI component layouts

- Add Litigation AI page with 3-step evidence pipeline (Synthesize → Draft → QC)
  using Cloudflare AI Gateway, replacing standalone Gemini-based HTML dashboard
- Add backend routes: POST /api/litigation/{synthesize,draft,qc}
- Add command center components (ActionStream, SystemPulse, VitalSigns)
- Add scrape jobs schema migration, fan-out dispatcher, job routes
- Add chittyId columns to obligations, properties, legal_deadlines, documents
- Expand cron with job scheduling capabilities
- Add MCP tool registration endpoints
- Redesign dashboard with command center layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chitcommit
chitcommit merged commit cdc4c60 into main Mar 22, 2026
10 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown
  1. @coderabbitai review
  2. @copilot review
  3. @codex review
  4. @claude review
    Adversarial review request: evaluate security, policy bypass paths, regression risk, and merge-gating bypass attempts.

@chitcommit
chitcommit deleted the feat/litigation-assistant-and-command-center branch March 22, 2026 07:17
@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 23b972c0-8e1a-4da4-9adc-e691198c0d8b

📥 Commits

Reviewing files that changed from the base of the PR and between 75a8e37 and 6311479.

📒 Files selected for processing (19)
  • migrations/0013_scrape_jobs.sql
  • src/db/schema.ts
  • src/index.ts
  • src/lib/cron.ts
  • src/lib/fan-out.ts
  • src/lib/job-dispatcher.ts
  • src/routes/jobs.ts
  • src/routes/litigation.ts
  • src/routes/mcp.ts
  • ui/src/components/Sidebar.tsx
  • ui/src/components/StatusBar.tsx
  • ui/src/components/command/ActionStream.tsx
  • ui/src/components/command/SystemPulse.tsx
  • ui/src/components/command/VitalSigns.tsx
  • ui/src/index.css
  • ui/src/lib/api.ts
  • ui/src/main.tsx
  • ui/src/pages/Dashboard.tsx
  • ui/src/pages/LitigationAssistant.tsx

📝 Walkthrough

Walkthrough

This PR introduces a comprehensive job-orchestration system for managing scrape operations, integrates fan-out notifications to downstream services upon scrape completion, adds an AI-powered litigation-assistance feature with synthesis and QC workflows, refactors the dashboard into a command-center layout with action streams and vital metrics, and exposes new job-management HTTP endpoints and MCP tools.

Changes

Cohort / File(s) Summary
Database Schema
migrations/0013_scrape_jobs.sql, src/db/schema.ts
Added cc_scrape_jobs table with job lifecycle tracking (status, attempts, timestamps), parent-job hierarchy, and performance indexes. Added chitty_id column (if missing) to cc_sync_log, cc_legal_deadlines, cc_properties, cc_documents, cc_obligations.
Job Dispatcher & Orchestration
src/lib/job-dispatcher.ts, src/lib/cron.ts
Introduced complete job-dispatching module with enqueue, execute, retry, and queue-processing operations. Updated runCronSync to dispatch jobs instead of direct synchronous calls for utility_scrape, court_docket, and monthly_check phases; added syncMonthlyChecksViaDispatcher helper.
Fan-Out Integration
src/lib/fan-out.ts
Added fan-out orchestration to route scrape-completion results to Intelligence, Calendar, Triage, and Ledger services concurrently; all downstream errors are logged without failing main execution.
API Routes: Jobs & Litigation
src/routes/jobs.ts, src/routes/litigation.ts
Exposed job-management endpoints (GET/POST /jobs, queue processing, dead-letter handling, retry) and litigation-assistance endpoints (/synthesize, /draft, /qc) calling external AI gateway.
MCP Tools
src/routes/mcp.ts
Added five new MCP tool definitions and handlers for scrape-job management: query_scrape_jobs, get_scrape_job, retry_scrape_job, get_dead_letters, enqueue_scrape_job.
Main Server Setup
src/index.ts
Mounted new route groups (/api/litigation, /api/v1 jobs routes); updated cron handler to pass execution context to runCronSync.
Dashboard & Layout
ui/src/pages/Dashboard.tsx, ui/src/main.tsx
Replaced focus-mode dashboard with command-center layout featuring VitalSigns, ActionStream, SystemPulse, and morning-brief panels. Removed FocusModeProvider. Added /litigation protected route.
UI Components
ui/src/components/command/ActionStream.tsx, ui/src/components/command/SystemPulse.tsx, ui/src/components/command/VitalSigns.tsx, ui/src/components/Sidebar.tsx, ui/src/components/StatusBar.tsx
Introduced new command-center components (ActionStream with obligation/dispute/deadline/recommendation/queue items, SystemPulse with sync status and cron schedule, VitalSigns with health metrics). Reorganized Sidebar into nav groups; removed focus-mode toggle from StatusBar.
Litigation Assistant
ui/src/pages/LitigationAssistant.tsx
Added new page implementing 4-stage litigation drafting pipeline (intake, synthesize facts, draft email, risk QC scan) with error handling and inline tag rendering.
UI Styling & Client
ui/src/index.css, ui/src/lib/api.ts
Added CSS for command-center components (vital-signs-strip, morning-brief, stream-item, stream-badge, stream-action variants, pulse-card primitives). Added API client methods for litigation endpoints.

Sequence Diagram(s)

sequenceDiagram
    actor Cron as Cron Scheduler
    participant JobDisp as Job Dispatcher
    participant DB as Database
    participant Client as Scraper/Router Client
    
    Cron->>JobDisp: enqueueJob(type, target, options)
    JobDisp->>DB: INSERT into cc_scrape_jobs (queued status)
    DB-->>JobDisp: jobId
    JobDisp-->>Cron: jobId
    
    Cron->>JobDisp: processQueue()
    JobDisp->>DB: SELECT jobs WHERE status='queued' LIMIT N
    DB-->>JobDisp: jobs[]
    
    loop For each job
        JobDisp->>DB: UPDATE status='running'
        JobDisp->>Client: execute scrape (job.type, job.target)
        alt Success
            Client-->>JobDisp: { data, recordsSynced }
            JobDisp->>DB: INSERT results, UPDATE status='succeeded'
        else Failure
            Client-->>JobDisp: error
            JobDisp->>DB: UPDATE attempt++, reschedule or status='dead_letter'
        end
    end
    
    JobDisp-->>Cron: { processed, succeeded, failed }
Loading
sequenceDiagram
    participant JobDisp as Job Dispatcher
    participant DB as Database
    participant FanOut as Fan-Out Orchestrator
    participant Intel as Intelligence Service
    participant Cal as Calendar Service
    participant Triage as Triage Service
    participant Ledger as Ledger Service
    
    JobDisp->>DB: UPDATE job status='succeeded', store result
    JobDisp->>FanOut: fanOutScrapeResult(jobId, jobType, result, ...)
    
    FanOut->>Intel: POST /agents/intelligence/observe
    FanOut->>Cal: POST /agents/calendar/create (if court_docket + hearing date)
    FanOut->>Triage: router.classifyDispute() (if entries present)
    FanOut->>Ledger: POST /entries (audit log, if CHITTYLEDGER_URL set)
    
    par All downstream calls concurrent
        Intel-->>FanOut: 200 OK
        Cal-->>FanOut: 200 OK
        Triage-->>FanOut: 200 OK
        Ledger-->>FanOut: 200 OK
    end
    
    FanOut-->>JobDisp: Promise<void> (no failure propagation)
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Poem

🐰 A queue of jobs, so neat and tidy,
Dispatched with care through cron each Tuesday,
Fan-out whispers to friends nearby—
Intelligence, Calendar, Ledger rejoice!
Litigators draft with AI's voice,
While dashboards pulse with vital grace. ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/litigation-assistant-and-command-center

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@chitcommit
chitcommit restored the feat/litigation-assistant-and-command-center branch March 22, 2026 10:31
@chitcommit
chitcommit deleted the feat/litigation-assistant-and-command-center branch March 22, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant