Docket extracts fields from invoices and receipts, classifies each document, and files it according to YAML rules. Every applied move is recorded in SQLite and can be reversed with undo.
Plain-text examples are included, so the core workflow runs without OCR software.
python -m venv .venv
source .venv/bin/activate
pip install -e .
docpipe process examples/inbox --out /tmp/filed
docpipe process examples/inbox --apply --out /tmp/filed
docpipe search widgetsThe first command is a dry run. The second applies the moves and prints a run ID:
Moved 2 file(s). Run id: d15c5ff3
Use that ID to restore every file from the run:
docpipe undo d15c5ff3An input such as acme_invoice.txt can become invoices/2026/2026-07-acme-supplies-ltd-invoice-INV-1042.txt, depending on the routing rules.
The extractors identify vendor, date, total, and document number. Each field includes a confidence score. Date parsing supports ISO dates, US-style numeric dates, month names, and an optional day-first mode.
classify.py uses document keywords to choose invoice, receipt, contract, or other. routing.py renders the selected YAML filename template without touching the filesystem, which keeps route planning easy to test.
Applied documents are indexed in SQLite FTS5. Search results include matching snippets and the filed path.
The journal records source and destination paths for each move. Undo restores files in reverse order, and repeating the same undo does not damage already restored files.
pip install -e '.[ocr]'
sudo apt-get install tesseract-ocrPDF text uses pdfplumber. Images pass through grayscale conversion and adaptive thresholding before Tesseract reads them. These dependencies load only when the corresponding file type is processed.
pytest -qThe 14 tests cover field extraction, confidence values, classification, routing, FTS5 search, applied moves, exact file restoration, and idempotent undo.