Repository navigation
NU-006 Format extraction seam: md, txt, docx, pdf #20
Description
Part of #30.
Convert every supported format to one common markdown form, so a single deterministic header
parse serves all of them.
Build
file_extractor map:
.md,.txt— passthrough..docx—DocxReader..pdf— LlamaParse withresult_type="markdown", off by default..doc— not supported. No LlamaIndex reader exists; it needs LibreOffice.
State landed → extracted → parsed. extracted is its own persisted state because LlamaParse is
a network call with independent failure and retry semantics.
Why the normalisation seam exists after all
An earlier decision deferred the Raw Ingest Agreement seam: one source, one producer, one
consumer — it was not earning its keep. Four input formats feeding one Compiler is exactly the
heterogeneity that seam exists for, so it is retained. Reversed on new information.
LlamaParse returning markdown is worth more than its free credits: headings become real headings,
so the header parse, the Content Header rules, and A2's author_source="extracted" work
identically for a PDF and a .md file.
§5.1 constraint — not optional
LlamaParse is a third-party cloud service. PRD §5.1 promises "the only outbound traffic is
whatever the customer explicitly configures — LLM provider, embedding provider." So it is a
configurable extractor that is off by default in shipped configuration, enabled for
development against our own fixtures only. No real customer document may pass through it in a
demo. file_extractor is a dict, so "configurable, off by default" costs the same as hardcoding.
A local PDF path is on the critical path to shipping, not polish — no customer deployment can
parse PDFs until it exists.
No OCR
A scanned PDF is an image and extracts to near-nothing. That must fail loudly, never reach a
reviewer as an empty review item.
Definition of done
- All four formats converge on the same header-parse code path with no format-specific branching
past extraction. - Before LlamaParse is enabled in any environment (including dev/test), verify its current
per-page credit cost against live pricing rather than assuming a rate — credits are consumed per
page and vary by parse mode (docs/tracer-bullet-01.md§7). - A scanned/near-empty PDF fails loudly rather than producing an empty review item.
Closes
A11 (non-blocking, so a LlamaCloud timeout can never invalidate a graph finding).
Activity
[-]Format extraction seam: md, txt, docx, pdf[/-][+]NU-005 Format extraction seam: md, txt, docx, pdf[/+][-]NU-005 Format extraction seam: md, txt, docx, pdf[/-][+]NU-006 Format extraction seam: md, txt, docx, pdf[/+]