The pipeline has two halves that meet at the brand document. The first half reads a site and writes verified values with their evidence. The second half is read by generators. Nothing in the second half fetches a page or calls an indexer, and nothing in the first half knows which generator will use its output.

Stages

Three rows of five boxes. Read: POST readout returns 202 and a run id and is then polled; the page gate has seven outcomes and one passes; normalise keeps headings and cuts boilerplate; chunk uses sec-line-cdc-v1 with stable ids; sources and chunks are kept per brand and never deleted. Extract and write: an LLM extractor returns a value and a verbatim quote; the quote check re-finds the quote in the page; the number check requires numbers to be in the quote; write rules apply a revision lock and protect human fields; brand fields carry origin, basis and evidence per field. Use: load_brand_context is one loader for every generator; select_evidence runs config rc-0; generators are blog, card news and banner; the trace holds chunk ids, config version and a context hash; hybrid retrieval is specified and not built.
Figure 1. The stages. Reading and extraction run in a background job per readout. Use happens later, each time a generator runs.
StageWhat it doesIn code
Gateclassifies each fetched page into one of seven outcomespage_gate.assess
Normalisedrops scripts, styles, navigation and frames; turns headings into # lines; removes repeated lineshtml_text, normalized_text
Chunkcuts at headings, then at lines chosen by a hash; gives each chunk a content-derived idchunk_text, chunk_id
Storerecords every page’s status; updates text and chunks only for an ok page whose hash changedrecord_pages
Extractone LLM call per field group, each value with a verbatim quotethe extractor adapter
Verifyre-finds the quote in the page and checks the value’s numbers against itverify, locate_quote, numbers_supported
Applywrites fields under a revision lock, keeps human values, files conflicts as candidatesapply_extraction, write_brand
Loadreturns usable fields and evidence chunks for a generation taskload_brand_context
Tracerecords brand revision, chunk ids, config version and a context hash with the outputContextTrace

A readout reads the home page and up to two more pages under the same owner key. The owner key is the host, or the host plus the store path on a marketplace, so two stores on one marketplace host are two brands and not one.

A readout is a job

Sequence diagram with five lifelines: web app, API route, readout job with a 10 second heartbeat, extractor with four field groups, and MongoDB. Step 1, the web app posts a readout with a URL. Step 2, the route answers 202 with a run id. In the background job: step 3, the job stores pages, sources and chunks; step 4, it asks the extractor for a value and quote per field; step 5, it verifies quotes and numbers itself; step 6, it applies the result if the run id is still current. Step 7, the web app polls with GET until the run is done, partial or failed.
Figure 2. A readout. The request returns a run id at once. The background job stores what it read, extracts, verifies, and applies its result only if its run id is still the brand's current one.

POST /api/brands/{brand_id}/readout takes a URL and a language, requires write permission and answers 202 with a run id. The client polls a second route until the run is done, partial or failed.

The run id is what keeps an old result from landing late. Starting a readout writes the new run id onto the brand, as a revisioned write. When a job finishes and tries to apply its extraction, the apply function compares its own run id with the brand’s.

def start_readout(brand: Brand, *, site_key: str, source_url: str) -> str:
    run_id = "run_" + uuid.uuid4().hex[:16]
    brand.readout_run_id = run_id
    ...

    if brand.readout_run_id != run_id:
        raise StaleRunError(run_id)

If a customer reads site A, then B, then A again, three jobs may finish in any order. Only the last one started matches the brand’s run id. The other two end as failed with the code superseded.

The job itself is watched the same way as other long work in the product. It sends a heartbeat every 10 seconds. A run with no heartbeat for 45 seconds is marked interrupted, which is what a process restart looks like from the outside. A run that exceeds 300 seconds times out.

Run outcomeMeaning
doneevery page was read and every field group returned
partiala subpage was not readable, or one field group failed
failed with no_contentthe root page was a bot check or an empty shell
failed with no_sitethe root page could not be fetched at all
failed with unsupported_sitea bare marketplace host with no store path
failed with supersededa newer readout was started for this brand
failed with interruptedthe process died while the run was in flight

Extraction in four groups

The extractor is called once per group of fields: basics, offer, market and direction. Four calls run concurrently. Each receives the first 4,000 characters of each page, up to 12,000 in total.

Factual and observed fields must come back as a value and a quote. The prompt asks for one sentence, copied without translation or ellipsis, and requires any number, certification or award in the value to appear in the quote. The market group, which covers competitors, personas, strategy and words to avoid, is inferred. Nothing on the page states those, so they have no quote and take a different path: they become candidates for a person to adopt or reject.

If a reply is cut off at the token limit, the group is retried once with an instruction to write shorter. A group that still fails is recorded as failed and the run ends partial, with the other groups applied.

What is stored

CollectionOne document isKey fields
brand_sourcesa page read for a brandsource key, URL, outcome, content hash, normalised text, time
brand_chunksa chunk of a pagechunk id, heading path, text, offsets, active or retired
brandsthe brandthe fields themselves, field_meta per field, candidates, revision, readout_run_id
brand_readout_runsone readoutstatus, error code, heartbeat

field_meta holds, for each field, where the value came from (extracted or user), on what basis (explicit, observed or inferred), whether it was reviewed (candidate or confirmed), the evidence, and the run and revision that wrote it. An evidence entry points at a source, a chunk, and character offsets into the stored text, and carries the quoted slice.

Chunks carry a unique index on brand and chunk id. Nothing in these collections is deleted by a readout. A chunk that disappears from a page is marked retired and can become active again if the text returns.

Design decisions

The brand’s fields are the source of truth, not a separate knowledge store. The first design had a store of knowledge items beside the brand. I dropped it before building and attached provenance to the fields the product already reads, so each fact exists once.

Extraction is applied on the server. The earlier flow had the browser receive extracted values and send them back in a save request. A late request could then overwrite a correction the customer had just made. Now the browser never writes extracted values. The server applies them under the write rules, where it can see who wrote each field.

The request returns at once and the client polls. A synchronous readout held a connection open for the whole read, and a proxy in front of the API closed long requests with a socket error. A job with a run id also gave stale results a clean way to be refused.

Four extraction calls, not one. A single call for every field was cut off at the token limit. Splitting by field group bounds each reply and lets one group fail without losing the rest.

Evidence is chosen by rule, not by a model, at generation time. The loader puts the must-have facts and the chunks that support them into the prompt directly. There is no online step where a model picks evidence, so the same brand and the same task produce the same context, and the context can be hashed and recorded.

Generation takes what is stored. If the stored knowledge is thin, the output says less. A generator is not meant to fetch a page in the middle of writing, which would make the output depend on the network at that moment.

What the shape leaves open

One exception to that last decision is still in the code. The blog writer keeps an older path that fetches the brand’s home page live, recorded in the design as an open decision. Until it is removed, an article can contain something the stored evidence does not account for.

A readout extracts from every readable page each time, even one whose content hash has not changed. The stored chunks are not rewritten in that case, but the extractor is still called. Skipping extraction for unchanged pages is in the design and not in the code.