Skip to content

AI System, Prompts, Citations, Evals, and Approval Queue

This guide ties together the CaseSolo AI modules and the docs that already cover individual subsystems.

Core Modules

Related docs:

Prompt Standards

Prompts must be versioned and testable. A prompt change should identify:

Avoid embedding firm secrets, raw OAuth tokens, or private signed URLs in model input. Use document IDs, storage keys, citations, or short excerpts instead.

Citation Rules

Legal, medical, settlement, deadline, and case-strategy outputs should cite their source material. Citation payloads should include:

If a task requires citations and the system cannot find usable source material, the AI should refuse the cited claim or send the result to review.

Approval Queue

Generated legal work that mutates case state or leaves the system should pass through src/lib/ai/review-queue.ts unless a deterministic route explicitly marks the workflow as safe.

Use approval queue records for:

Approval records should preserve prompt version, model, tools, citations, cost, latency, actor, firm ID, case ID, and reviewer decision.

Evals

Evals should be deterministic and offline-friendly. Add fixtures when changing:

Run focused eval tests with:

npm run ai:evals

For launch-sensitive changes, also run:

npm run test:run -- src/__tests__/lib/ai-evals.test.ts

Governance Metrics

AI production readiness depends on measurable controls:

Do not treat a new AI workflow as launch-ready until it has a prompt owner, focused tests or evals, approval policy, and metric visibility.

Source: docs/dev/ai-system.md