TRAIL writes content for brands: articles, card news, banners. Every one of those generators needs to know what the brand sells, what it has proven and what it must not say. The first version asked a language model to read the site and trusted the answer. This project replaced that trust with a pipeline in which a fact enters only with a quote that code can find in the page, and leaves with a record of where it was used.

  • RoleDesign and implementation, alone: survey, pipeline, storage, loader, tests
  • LineageAutoRAG and its MinSync, Jikji and Jev components, read and mapped mechanism by mechanism
  • StackPython, FastAPI, MongoDB with Beanie, an LLM extractor behind an adapter
  • StateReading, verification, storage, loader and trace are in production code. Hybrid retrieval and claim judging are specified and not built

The pipeline

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. Only ok pages go on. 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. Confirmed fields and their chunks go on. Use: load_brand_context is one loader for every generator; select_evidence runs config rc-0, field evidence then term overlap; generators are blog, card news and banner; the trace holds chunk ids, config version and a context hash; hybrid retrieval with sparse and dense search and rank fusion is specified and not built.
Figure 1. The pipeline in three bands. Grey and dashed means specified in the design and not built.

A readout takes a site URL. Each page passes a gate that separates a real page from an error, a bot check or an empty shell. Pages that pass are normalised and cut into chunks whose ids depend only on their content. A language model then proposes values for the brand’s fields, each with a sentence copied from the page. Code looks for that sentence in the page and for the value’s numbers in that sentence. What survives is written to the brand under rules that never let a machine overwrite a person.

On the other side, every generator calls one function. It returns the fields that are safe to use and the chunks that support them, and it records which chunks and which retrieval config went into each output.

What went wrong before

The design started from a review of the onboarding flow that found ten failures. Three of them explain the shape of the pipeline.

  • Invented proof. The model’s “proof points” became allowed facts with no check against the page. A quote the model supplies is not evidence until code has found it in the page.
  • Lost edits. A browser request carrying extracted values arrived after the customer had corrected a field, and put the model’s value back.
  • Evidence without an address. Source URLs were dropped after extraction, so nothing could be re-checked later.

Each has a named regression test now, listed on the status page.

What was borrowed, and what was not

I did not design this from a blank page. AutoRAG and three related components solve neighbouring problems: incremental indexing, pre-built lookups, and judging a claim against evidence. I read them and decided, for each mechanism, whether to adopt it, adapt it or leave it out, against one stated goal: getting brand knowledge into generated output, not building conversational search. Twenty-eight mechanisms were weighed. The table and the reasons are in the first deep dive.

Reading order

  1. PipelineThe stages, the readout job with its run id, the outcomes, and the decisions behind the shape.
  2. Reading the lineageTwenty-eight mechanisms: sixteen adopted, seven adapted, five excluded, each with its reason.
  3. The page gateSeven outcomes in a fixed order, and why a 200 response is not evidence.
  4. Chunks with content-hash idsCut points that come from the text, so an edit changes only the chunks it touches.
  5. Extraction with verbatim quotesA value is kept only if code finds its quote and its numbers.
  6. Writes that never overwrite a personOptimistic locking on a revision, and what happens when extraction disagrees with a human value.
  7. One loader, one versioned config, one traceWhat every generator receives and what is recorded with its output.
  8. Hybrid retrieval, specifiedThe config that is not built yet, and the offline evaluation that will choose it.
  9. StatusWhat is in code, what is only in the design, the ten regressions and the CV map.

Results in three lines

  • A brand fact now enters the system only with a quote that code re-found in the source page, and a number only if the quote contains it.
  • A value a person set is never replaced by a later reading of the site. A conflicting reading is kept as a candidate for that person to judge.
  • Each generated article, card set and banner carries the brand revision, the chunk ids and the retrieval config version that produced its context.

What this page does not claim

There are no retrieval quality numbers here, because the retrieval that would have them is not built. The numbers that appear in the design document for learned sparse models and hybrid search were measured by the projects I read, on their data. I cite them as theirs where they explain a decision and nowhere as mine.