← all work

Stencil

Invoice extraction where AI authors the rules once and a deterministic interpreter replays them for free.

[01]// SpecProduct · 2026
Domain
AI Engineering
Status
active
Stack
Python · FastAPI · Celery · Redis · MySQL · pymupdf · Next.js · TanStack Query

A compiler-style pipeline for document extraction. The first invoice of a new layout costs a model call, which produces a declarative extraction model; every invoice after that is executed by a generic interpreter with no API calls and reproducible output.

[02]// What it does differently3 decisions
  1. Per-invoice model cost drops to zero once a supplier layout is known
  2. Deterministic, reproducible extraction — the same PDF twice gives the same rows
  3. Adding a supplier is data, not code: profile JSON, no supplier-specific Python
[03]// Screens4 shots