Skip to content

AI Review Queue

Generated legal work must not silently mutate case records, final documents, portal updates, or outbound communications. Use the AI review queue to put generated work in a pending state until an authorized reviewer approves it.

Storage

Current implementation stores queue records in Firm.settings.aiReviewQueue.requests. This avoids a launch-blocking migration and keeps all records firm-scoped. The helper API is isolated in src/lib/ai/review-queue.ts so the queue can later move to a first-class table without changing route callers.

Required Flow

  1. Generate AI output and return the shared ai envelope.
  2. Call createAIReviewRequest() for high-risk targets.
  3. Return review.requestId to the UI.
  4. Keep generated work in a pending/reviewing state.
  5. Approve, reject, request changes, or mark applied through POST /api/ai/review-queue.
  6. Only final mutation/send/publish paths should proceed after approval.

Target Types

Current Adoption

API

Only ADMIN, ATTORNEY, and SUPER_ADMIN can approve or reject. PARALEGAL can view and create review items but cannot approve them.

Source: docs/dev/ai-review-queue.md