Document extract (Huginn)
Overview
Huginn reads companies with extract enabled, downloads eligible Tower deposits, runs OCR, and writes business fields (displayLabel, auto-attributes) without changing the Box active upload target.
How it works
- Extract agent token → companies with
flags.extract.enabled(or one company for a company token). - Eligible listing uses enrich folder filters (
targetAutoAttributes,displayedCodes) andextract.prompt. POST /documents/:id/download-sessionreturns a presigned GetObject fromflags.extract.storageConfig(named upload config).PATCH /documents/:id/extractwrites fields; batches are recorded for reporting.
Key files
src/domains/company/extract*.ts— config, eligible, batchessrc/domains/document/extract-storage.ts— S3 GetObject presignsrc/domains/document/document.service.ts— download-session, extract write- Huginn worker (separate repo)
Technical decisions
flags.extract is opt-in plus storage read. Prompt and field set live on the enrich folder. Extract ignores drafts.