World's first open-source enterprise world model.
0040 · A chunk says where its words came from
- Status: Implemented · cuts 1–3, 2026-09-15 and 2026-09-16 (migrations 0058–0060)
- Written: 2026-09-13 (conventions in the README)
- Related: 0039 (#633, not merged yet) puts Docling
behind the block model as its cut 2 and leaves "evidence that points at a table cell or an image
region" to a later record — this is that record; 0020
is the read contract an auditor relies on; 0022
anchors a fact at the document that attests it; 0005 lists
document.no_text_layeras unwired; 0015 is the other queue a fact can wait in
Why a decision is needed
Everything after the parser eats text. Chunking, embedding, extraction, resolution, the temporal
engine and the derivations never look at a file; they look at chunks.text. That is why reading
audio and images is, at the wire, mostly configuration: a transcription endpoint speaks
OpenAI's /v1/audio/transcriptions, a vision model is a chat request with an image part, and
scans go through the Docling sidecar 0039 already plans. Point three more settings at three more
models and the pipeline runs unchanged.
That is also the problem. The pipeline will swallow a transcript, or a model's account of what a
bar chart shows, exactly as it swallows a sentence from a filing, and the ledger has no column
that could tell them apart afterwards. fact_evidence holds a chunk_id and a quote, and the
quote means one thing: the document says this. Text can now arrive four ways, and they are not
equally good evidence:
| origin | example | what the quote is | how a person checks it |
|---|---|---|---|
| stated | the body of a document | the words written | read the document |
| ocr | a scanned contract, a screenshot, a stamped page | the words written, as read (a misread digit is possible) | look at the page |
| transcribed | a meeting recording | the words of a transcript (names are the likeliest misses, and names are what extraction extracts) | listen to that stretch |
| described | a chart, a photo, a diagram | a model's paraphrase of a picture — nobody wrote or said it | cannot be checked word for word |
The first three keep the contract every quote in this base is held to. The fourth does not.
It matters more here than in a search index, because this ledger acts on what it is told. A
new fact closes the open interval it supersedes (reconcile_new_fact), a contradiction opens a
conflict, and derivations are built on premises. A vision model reading a value off a bar chart
gets digits wrong as a matter of course. Filed as an ordinary fact, that wrong value closes the
correct one it contradicts, and nothing in the stored rows says the closure rested on a picture.
And one part cannot wait for later: an anchor that is not stored at ingest cannot be recovered. A transcript saved without its segment times can never again be tied to the moment in the recording a person would need to hear.
Decisions
1. A chunk has an origin
chunks.origin is one of stated, ocr, transcribed, described, NOT NULL DEFAULT 'stated'; every existing row is stated, which is true. chunks.origin_model names the engine or
model that produced the text and is null for stated chunks. The model is kept so that a base can
be re-read when a better model arrives, and so that misreads can be counted per model rather than
argued about.
The origin lives on the chunk, not on fact_evidence. Every evidence row that cites a chunk
shares that chunk's origin, and evidence already reaches its document through the chunk. The
chunk is also the unit extraction reads (0039), so it is the unit whose reliability extraction
inherits.
2. The packer never mixes origins in one chunk
0039 reads a document into blocks and packs blocks into chunks. Blocks carry an origin, and a chunk holds blocks of one origin only. A described block is always its own chunk.
A description needs context to be read at all — a chart is meaningless without "Figure 3: revenue by region" — so a described chunk carries the heading breadcrumb 0039 gives every chunk, and the figure's caption. The whole chunk counts as described, caption included. That is deliberately conservative: the caption is still stated, and it still appears in its own stated chunk, where facts cited from it keep full weight.
Without this rule a fact extracted from a chunk that held a sentence and a description would cite the chunk, and the description would borrow the credibility of the sentence beside it.
3. A chunk points back into the original bytes
chunks.anchor is JSONB whose shape is fixed by the origin and checked:
| origin | anchor |
|---|---|
| stated | null — char_start / char_end already place it in the parsed text |
| ocr | {"page": n}, with "bbox": [x0, y0, x1, y1] when the engine gives one |
| transcribed | {"start_ms": n, "end_ms": n, "speaker": ["A", "B"]} — the speakers heard in the chunk, in order (revised with cut 3: required, and a list, because a chunk spans turns) |
| described | {"page": n, "image": i} for a PDF, {"part": "word/media/image3.png"} for an Office file, {} for a standalone image file |
The original is already kept: the document's blob, content-addressed and versioned in
document_versions. An anchor addresses bytes the base holds anyway, so reading media adds no
storage and no copy that could drift from its source. Images inside a document are not extracted
into blobs of their own.
Segment times are required of cut 3, not a nice-to-have, for the reason given above. Video, when
it comes, is a time range plus a frame: the transcribed and described shapes with start_ms.
Deciding the anchor now is what makes deferring video cost nothing.
4. A described observation cannot move the ledger by itself
Facts extracted from a described chunk are inserted with a confidence below
AUTO_CLOSE_MIN_CONFIDENCE. The temporal engine already refuses to auto-close on such a fact:
where it would have closed the open interval, it records a low_confidence conflict and a person
decides. No new branch in temporal.rs is needed.
Revised by 0045 cut 3, which took confidence out of the temporal engine. The guarantee is unchanged and now stands on the chunk's origin: the engine reads whether a row's evidence is described and opens a
described_evidenceconflict where it would have closed. This is the branch intemporal.rsthat this decision expected not to need. The confidence ceiling stays, below the review threshold, so the fact also shows up in the low-confidence queue. The fact still enters the graph, search and chat. It can be read, found and cited; it cannot, alone, rewrite what the ledger holds.
The conflict queue is the right place because it only sees the facts that would act. Most described facts collide with nothing and never appear there.
Only described gets the ceiling. OCR and transcription are readings of words with an anchor a
person can check. Their typical error is a misspelled name, which arrives as a separate entity and
goes through resolution and review, not as a closure of someone else's fact. A description is an
interpretation with nothing to check it against. Whether a misread digit in either should be
capped too is open (below), and is to be measured rather than assumed.
A consequence, checked in the code. A fact's confidence is set when it is first inserted. When
the same fact is observed again from the same start, insert_fact_inner returns the existing row
and leaves its confidence as it was. So a fact first seen in a chart and later stated in a
document stays below the threshold, and the conflict it opened waits for a person. This is safe,
and it depends on arrival order. Raising a fact's confidence when a better origin corroborates it
is not decided here.
5. Each modality has its own model settings
llm_settings already separates chat_* from embed_*. It gains transcribe_* and vision_*
(base URL, key, model) in the same OpenAI-compatible shape: transcription through
/v1/audio/transcriptions asking for segment timestamps, vision through a chat request with
image parts. OCR is the Docling sidecar of 0039's cut 2.
Revised 2026-09-15. Two changes to this decision, made by the maintainer before cut 2:
- OCR is a MinerU service, not a Docling sidecar. MinerU detects the page layout first
and then recognises each region, and returns Markdown plus a content list in reading order
with
page_idxand abboxper block. That is exactly the{"page", "bbox"}anchor above. Its VLM is not interchangeable with a generic vision model: the model behindmineru-apispeaks MinerU's own two-step protocol, and a generic model asked to "transcribe this page" gives neither the layout nor the boxes. So the setting isocr_*(the service URL and key), not a vision chat model; a generic vision model stays the reader for cut 4, descriptions. - A transcript must say who spoke (the first open question below, now decided). A
transcription endpoint that returns segments without speaker labels is treated like a
missing one: the recording is not read, and the alert says why. The database refuses a
transcribedanchor withoutspeaker.
Where a setting is empty, "fails with an alert" means degrades. The file is kept, and the
document stops at failed with documents.reader_needed set to the missing reader. It raises
one document.needs_reader alert and is not retried. Saving the setting queues those documents
again.
These are not a reuse of the chat model. A recording of a board meeting or a scanned contract is more sensitive than a paragraph of text, and a deployment will reasonably keep transcription and OCR on local models while chat goes to a hosted one. One setting would force the most sensitive material to wherever chat happens to live.
An empty setting turns that modality off. A file that needs it is not silently skipped: it fails
with an alert that names the missing model. For scans, that alert is the
document.no_text_layer 0005 still lists as unwired.
6. Reading media is a job
parse runs inside process_document under spawn_blocking, and it is pure local work. A model
call is not: it is rate-limited, times out, runs out of credit. A two-hour recording that fails at
ninety minutes must not start again from zero.
Media reading is therefore its own job, queued like extraction (#640), writing blocks as segments complete and resumable from the last one written, feeding the same chunker. Images inside one document are deduplicated by content hash across the base — a logo on fifty slides is one description — and skipped below a size floor. A per-document call budget reports what it skipped instead of dropping it quietly.
Cut 2, as built (2026-09-15). The job that waits is process_document itself rather than a
new job kind. It submits the file to POST /tasks, records the remote task on the document
(documents.reader_task: reader, service, task id, the file's sha256, when it was submitted),
and returns Deferred, which puts the job back in the queue without spending an attempt. Each
later run asks GET /tasks/{id} and either waits again or fetches the content list. A restart
resumes from the recorded task; a new file version or a different service discards it. A task
the service no longer knows is submitted again; a task it reports failed is cleared and takes an
ordinary retry; a task still unfinished after six hours fails the document for good. MinerU
returns the whole file at once, so "resumable from the last block written" is resuming from the
remote task: nothing is read twice unless the service lost it.
Segments are per page, not per region. Every region has its own box, and a segment per region would make every paragraph its own chunk. After packing, a chunk's anchor carries the union of the boxes of the regions it covers on its page. Page headers, footers and page numbers are dropped; tables become Markdown tables, so a long scanned table repeats its header across chunks like any other.
Cut 3, as built (2026-09-16). The request is OpenAI's /audio/transcriptions with
response_format=diarized_json and chunking_strategy=auto; each returned segment carries a
speaker, its text, and its start and end in seconds. Speakers go into the text, not only the
anchor: extraction reads words, and who promised delivery has to be on the line that says it.
Consecutive segments from one speaker join into a turn, and each turn starts Speaker A: with
the label the model gave — the prefix is structure, and no name is guessed. The whole recording
is one segment; after packing, a chunk's anchor carries the earliest start, the latest end and
the speakers heard in it. A segment with text and no speaker refuses the whole transcript
(NoSpeakers), which degrades like a missing model: the document waits with reader_needed = 'transcribe', the alert carries the reason, and saving a model queues it again.
A recording is read in one request, so it is not resumable within itself: a failure retries the whole file. Splitting audio needs a decoder the server does not carry; the endpoint's file limit (25 MB on OpenAI, about an hour of compressed audio) bounds what one request loses.
7. The read contract says it
The evidence API, the MCP tool results (quote, document_id and filename today) and the RDF
export (utopia:quote on each statement) gain origin, origin_model and anchor. An auditor
reading the export must be able to tell a sentence from a description without asking us, which is
0020's whole premise. A chat source cited from a described chunk is labelled as a description.
The interface — the origin on each evidence row, and the anchor that opens the page, the image or
the recording at start_ms — is a separate cut after the capability, not part of it.
Order of cuts
- The ledger shape.
origin,origin_model,anchor, the packer rule, the ceiling, the read contract. No media reader yet; everything that exists is stated, and says so. - Scans and document images through MinerU (revised from Docling):
ocr. The highest value — scanned contracts, stamped approvals, invoices, all of which fail today with no text layer — and the modality that keeps the verbatim contract. - Recordings:
transcribed, segment times and speakers required. - Charts, photos, diagrams:
described, under the ceiling. - Video: its audio track through 3, sampled frames through 4.
Open
Who said it.Decided 2026-09-15: a transcript without speaker labels is refused (decision 5). Whisper-compatible endpoints do not separate speakers. Without speakers, "Zhang San said he would deliver in Q3" and "Li Si said Zhang San would deliver in Q3" can be the same transcript line, and a meeting ingested that way attributes commitments to the wrong people — worse than extracting nothing. Cut 3 does not ship until this is decided: require an endpoint that labels speakers, or treat an unlabelled transcript's facts differently.- Corroboration. Whether a stated or OCR observation of a fact first seen in a description should raise its confidence (decision 4).
- Digits in OCR and transcripts. Whether low engine confidence on a segment (Whisper's
avg_logprob, an OCR word score) should cap facts from that segment the waydescribedis capped. The recall bench needs a scanned and a recorded sample before this is decided. - What gets embedded. An image reference or a long URL inside a chunk's text skews its vector. Whether the embedded text strips references is 0039's to answer.
- A recording's date. A container's creation time as a new
doc_time_source, and how it sits with 0022's rules, is decided with cut 3.
Alternatives
| Alternative | Why not |
|---|---|
Put the origin on fact_evidence |
Every row from one chunk would repeat it, and a chunk holding mixed origins could not be described honestly either way. The chunk is what extraction reads. |
| Treat every non-stated chunk as low confidence | Throws away OCR of a clean scan — verbatim and checkable — to guard against a risk that belongs to descriptions. |
| Keep descriptions out of the graph and in search only | Loses the chart that is the only place a figure is written down. The ceiling keeps them in without letting them act. |
Route described facts to pending_facts (0015) |
That queue waits for a nod on sentences a person said to the base. A single slide deck would bury those nods under hundreds of image facts, and a described fact is not anyone's assertion. |
| Copy images out as blobs of their own | The original file already holds them, content-addressed and versioned. An anchor into it costs nothing and cannot drift. |
| Reuse the chat model for vision and transcription | Sensitivity differs by modality, and one setting sends the most sensitive material wherever chat is hosted. |
Status history
The status line as it stood on 2026-09-27, before status lines were cut to one line:
Cut 1 implemented (2026-09-15) ·
chunks.origin/origin_model/anchorwith the anchor shape checked (migration 0058), the packer never mixes provenances (chunk_segments), the ceiling on described facts, origin in the evidence API, the MCP changes feed and the RDF export (utopia:evidenceOrigin) · a file that needs a reader no longer becomes garbage text: images and recordings are recognised by header or extension, a PDF with an empty text layer is a scan, and without the model the document fails once withdocuments.reader_neededand adocument.needs_readeralert · revised 2026-09-15: scans and images are read by a MinerU service instead of a Docling sidecar, and a transcript must label speakers · cut 2 implemented (2026-09-15): scans and images are read by a workspace's MinerU service (llm_settings.ocr_*, migration 0059), one segment per page with the covered regions' box in the anchor; the processing job waits on the service withDeferredand remembers the remote task on the document; saving the service queues the waiting documents again · the settings cards are their own interface cut · cut 3 implemented (2026-09-16): recordings are read by a workspace's transcription model (llm_settings.transcribe_*, migration 0060) through/audio/transcriptionswithdiarized_json; speakers are written into the text and a chunk's anchor carries its times and speakers; a transcript without speaker labels degrades like a missing model