ai-triage

ai-triage reads every email and attachment in a shared inbox, pulls out the fields you care about with a quote behind each value, and sends anything uncertain to a person. Documents arrive through read-only Gmail sync, Postmark forwarding, an upload page, or a REST API that accepts PDFs, Word files, images, and .eml messages. A model classifies each document and extracts fields against a JSON Schema, then plain code checks the quotes exist, required fields are present, invoice totals add up, and the sender is authenticated. Auto-approval is earned per document type, switched on only after you measure accuracy on labeled data and freeze a threshold. Reviewers see the source with quotes highlighted beside an editable form with failed checks marked, and keyboard shortcuts approve, reclassify, or reject. Approved results reach your system as signed webhooks with an idempotency key, delivered at least once and retried with backoff. Evals run the production pipeline over labeled dev, calibration, and test splits, with threshold sweeps, reliability tables, and run-to-run diffs. Your own document types are defined in the UI, from starters like purchase order, receipt, credit note, and insurance claim. Any of Claude, OpenAI, DeepSeek, OpenRouter, or a local model can do the reading, and optional OCR covers scans and photos. Workspaces separate teams, with Google sign-in, invitations, and TOTP two-factor for admins. Running on a dedicated VPS on RepoCloud with guaranteed CPU, RAM, and SSD, full root SSH access, and a browser serial console. MIT licensed.

ai-triage
ai-triage
ai-triage
ai-triage
ai-triage

Benefits

  • It never acts on a guess
  • Each extracted value must quote the source and the quote must be present; schema, arithmetic, confidence, and sender checks run as plain code, and any failure goes to a person first.
  • Automation is earned per type
  • Every document type starts with human review; auto-approval turns on only after you pick a threshold on one split, freeze it, and confirm it on another with sample sizes and error bars.
  • Your inbox, your model, your data
  • Run it on your own server with Claude, OpenAI, DeepSeek, OpenRouter, or a local model; secrets are encrypted at rest, and webhooks refuse private addresses unless you allow them.
  • Safe delivery to your systems
  • An approval binds to the exact revision on screen, stale approvals are refused, and the signed webhook carries an idempotency key so your receiver can ignore retries and redeliveries.

Features

  • Hono API, Next.js Review UI
  • A TypeScript monorepo with a Hono API, a Next.js web app, and a separate worker, managed with pnpm and Turborepo and checked with Biome, Vitest, and Playwright.
  • Postgres Queue and Row Security
  • Postgres with Drizzle and pg-boss holds documents and the job queue; each pipeline step saves and queues the next in one transaction, with row-level security isolating workspaces.
  • Provider-Agnostic Model Layer
  • Adapters cover the Anthropic API and OpenAI-compatible endpoints for OpenAI, DeepSeek, OpenRouter, and local servers like Ollama and vLLM; Ajv validates every answer against the JSON Schema.
  • Optional PaddleOCR-VL Scans
  • A llama.cpp container serves PaddleOCR-VL 1.6 on Vulkan, NVIDIA, or CPU so scans and photos become text whose quotes can be verified.
  • Caddy HTTPS and triage CLI
  • Docker Compose runs the app, worker, Postgres, file storage, and Caddy with automatic HTTPS; a ./triage command handles status, logs, backups, restores, and upgrades.
  • Prometheus Metrics and Health
  • JSON logs, Prometheus metrics at /api/metrics behind a bearer token, health and readiness endpoints, and a System health page show queues, workers, and spend.

Apps Similar to ai-triage