Skip to content

feat: Litigation AI assistant and command center enhancements - #47

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 Assistant page (/litigation) — AI-powered legal assistant with case context, document analysis, and deadline tracking via new /api/litigation/* routes
  • Command Center dashboard overhaul — redesigned Dashboard with ActionStream, SystemPulse, and VitalSigns components for real-time operational awareness
  • Job dispatcher system — fan-out job execution engine (job-dispatcher.ts, fan-out.ts) with scrape job tracking, cron Phase 11 integration, and /api/jobs/* management routes
  • Database migration 0013cc_scrape_jobs table for tracking scrape job lifecycle
  • 4 new MCP toolslitigation_query_deadlines, litigation_analyze_document, litigation_get_case_context, litigation_draft_response
  • Sidebar navigation update — added Litigation Assistant route, improved active state handling

Test plan

  • Verify npm run dev starts without errors
  • Confirm Dashboard loads with new command center components
  • Test /litigation page renders and AI assistant chat works
  • Validate /api/jobs CRUD endpoints
  • Run npm run ui:build to confirm frontend compiles
  • Verify migration 0013 applies cleanly on Neon
  • Test new MCP tools via /mcp endpoint

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Litigation Assistant with AI-powered email synthesis, drafting, and quality control scanning for legal correspondence
    • Introduced scrape job management system with enqueue, execution, retry, and dead-letter queue capabilities
    • Redesigned Dashboard as "Command Center" featuring vital signs metrics, action stream, and system pulse monitoring
  • UI/UX

    • Reorganized sidebar navigation into grouped sections (Money, Intelligence, System)
    • Updated Dashboard with mission control-style layout showing cash runway, disputes, and urgent deadlines
    • Removed focus mode toggle from status bar
  • Chores

    • Added scrape job scheduling database infrastructure
    • Extended data tables with identity binding columns

- 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 e891b36 into main Mar 22, 2026
27 of 28 checks passed
@chitcommit
chitcommit deleted the feat/litigation-assistant-and-command-center branch March 22, 2026 10:32
@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.

@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.

@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: 57d49de1-b807-4204-a601-e6883b2da114

📥 Commits

Reviewing files that changed from the base of the PR and between cdc4c60 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 job queue orchestration system for scrape tasks with status lifecycle and retry tracking, refactors cron jobs to dispatch work asynchronously, adds a litigation assistant API with synthesis and QC, and redesigns the dashboard into a command-center interface with vital signs, action stream, and system pulse monitoring.

Changes

Cohort / File(s) Summary
Database & Schema
migrations/0013_scrape_jobs.sql, src/db/schema.ts
New cc_scrape_jobs table with job lifecycle (queued/running/completed/dead-letter), retry tracking, and scheduling. Added chitty_id column to five existing tables for identity binding. Indexes on status+timestamp, job type, and chitty_id.
Job Dispatcher System
src/lib/job-dispatcher.ts, src/lib/fan-out.ts
Comprehensive job queue API: enqueue/execute/process operations, status queries, dead-letter handling, and retry logic with exponential backoff. Fan-out module dispatches scrape results to Intelligence, Calendar, Triage, and Ledger services via concurrent Promise.allSettled.
Cron & Server Integration
src/lib/cron.ts, src/index.ts
Refactored three cron jobs (utility_scrape, court_docket, monthly_check) to enqueue work instead of executing directly. Pass ExecutionContext to enable async fan-out completion handling. Added routes for litigation and job management.
API Routes
src/routes/jobs.ts, src/routes/litigation.ts, src/routes/mcp.ts
New job-management endpoints (list, fetch, retry, enqueue, process-queue). Litigation routes synthesize facts, draft emails, and perform QC via AI gateway. MCP tools for job querying/retry/enqueue with validation.
Command Center UI Components
ui/src/components/command/ActionStream.tsx, ui/src/components/command/SystemPulse.tsx, ui/src/components/command/VitalSigns.tsx
New ActionStream aggregates obligations/disputes/deadlines/recommendations into urgency-sorted action cards with inline buttons. SystemPulse shows sync status, queue stats, and retry controls. VitalSigns renders cash, 30D-due, runway, disputes, overdue, and system health as compact metrics.
Dashboard & Styling
ui/src/pages/Dashboard.tsx, ui/src/index.css
Replaced focus-mode UI with command-center layout combining VitalSigns, morning brief dismissal, ActionStream, and SystemPulse. Data loading now concurrent (dashboard/syncs/queue). Added extensive CSS for action stream, badges, pulse cards, and glow shadows.
Litigation Assistant & UI Updates
ui/src/pages/LitigationAssistant.tsx, ui/src/components/Sidebar.tsx, ui/src/main.tsx, ui/src/components/StatusBar.tsx, ui/src/lib/api.ts
New 4-step litigation pipeline (intake → synthesize → draft → QC). Sidebar reorganized into nav groups with /litigation link. Removed focus-mode toggle from StatusBar. API client adds litigation methods.

Sequence Diagram(s)

sequenceDiagram
    participant Cron
    participant JobDispatcher
    participant JobQueue as Database
    participant Scraper as Scraper/Router
    participant FanOut
    participant Services as Downstream Services

    Cron->>JobDispatcher: enqueueJob(jobType, target)
    JobDispatcher->>JobQueue: INSERT into cc_scrape_jobs
    JobQueue-->>JobDispatcher: jobId
    
    Cron->>JobDispatcher: processQueue()
    JobDispatcher->>JobQueue: SELECT queued/retrying jobs
    JobQueue-->>JobDispatcher: job rows
    
    loop For each job
        JobDispatcher->>JobQueue: UPDATE status='running', started_at=NOW()
        JobDispatcher->>Scraper: executeScrape(jobType, target)
        Scraper-->>JobDispatcher: { recordsSynced, result }
        JobDispatcher->>JobQueue: UPDATE status='completed', result, completed_at
        JobDispatcher->>FanOut: fanOutScrapeResult(context)
        par Concurrent downstream
            FanOut->>Services: POST to Intelligence
            FanOut->>Services: POST to Calendar
            FanOut->>Services: POST to Triage
            FanOut->>Services: POST to Ledger
        end
    end
    
    JobDispatcher-->>Cron: { processed, succeeded, failed }
Loading
sequenceDiagram
    participant User
    participant UI as Litigation UI
    participant API as Backend
    participant AIGateway as AI Gateway

    User->>UI: Enter raw notes
    User->>UI: Click Synthesize
    UI->>API: POST /litigation/synthesize
    API->>AIGateway: POST /compat/chat/completions
    AIGateway-->>API: synthesis (markdown)
    API-->>UI: { synthesis }
    UI->>UI: Render synthesis with tags
    
    User->>UI: Set recipient/focus, click Draft
    UI->>API: POST /litigation/draft
    API->>AIGateway: POST with synthesized facts
    AIGateway-->>API: draft email (plain text)
    API-->>UI: { draft }
    UI->>UI: Render draft with copy button
    
    User->>UI: Click QC
    UI->>API: POST /litigation/qc
    API->>AIGateway: POST comparison request
    AIGateway-->>API: JSON array of flags
    API-->>UI: { flags, warning? }
    UI->>UI: Render QC report per flag
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Poem

🐰 A queue of scrapes, oh what a delight!
Jobs hop in line, each status in sight.
Litigation drafts with AI's gentle touch,
The command center hops—control systems clutch! ✨

✨ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

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