The restorer and the historian Night inside a chapel. A single work lamp clamped to a scaffold lights a 15th-century fresco of St Michael weighing souls above a wool merchant at his table. In the lower centre a ragged hole in the paint is being repaired: its left side is already filled with fine vertical hatching that brings back the merchant's raised hand and balance, and its right side is bare plaster with red guide lines. A restorer in a white coat and a magnifier headband stands on the scaffold touching a brush to the edge of the hole, and reaches back with her other hand for a charcoal drawing on blue paper that a historian on the floor is passing up to her. Beside the historian is a trolley of grey archive boxes; a lancet window at left shows the dusk outside.
All posts

The Art Restorer’s Guide to RAG: Find, Match, Fill

A face painted from memory, a Rembrandt rebuilt from a copy, and a fresco archive that knows when to say “no record”. How retrieval-augmented generation works, and a small RAG assistant built the way a conservation studio works.

In August 2012, Cecilia Giménez, an 81-year-old amateur painter, set out to repair a fresco of Christ in the Sanctuary of Mercy in Borja, Spain. Elías García Martínez had painted it around 1930. Damp had lifted the plaster, and much of the face was gone.

She had good intentions and some experience with small repairs. What she did not have, taped to the wall beside her, was a picture of what the face used to look like. So she painted the face she imagined.

Within weeks the world was calling it “Ecce Mono,” the monkey Christ. The memes faded, the tourists stayed, and Giménez, who died in December 2025 at 94, lived to see her town treat her as the person who put it on the map.

Look at her result as an engineer would. It is confident. It is fluent. It is unmistakably a face. It is simply not that face. That is what a large language model produces when you ask it about something it has never seen: the most plausible face, painted from training, with no original to check against.

Today, a copy of the original image hangs in the church beside her version. That small fix, putting the source next to the brush, is what this post is about. It is called retrieval-augmented generation, or RAG.

By the end you will have a working RAG assistant called tratteggio, built for the archive of a 15th-century fresco. It finds the right drawing, photograph or condition report, answers only from it, cites it, and says “the archive has no record” when the basement is silent.

The restorer and the historian

Picture a master restorer in a Florentine studio. She knows colour theory, Renaissance brushwork, how egg tempera ages and how lime plaster cracks. Put any 15th-century panel in front of her and she can match the hand within a day.

Now bring her a fresco nobody has catalogued, with a hole the size of a dinner plate in the middle. Her skill tells her how to paint the missing part. It cannot tell her what was there. Left alone, she will paint something plausible: an angel, perhaps, where the original showed a wool merchant counting coins. It will be beautiful, and it will be wrong.

So the studio has a second person: an archival historian. While the restorer prepares her palette, the historian goes down to the climate-controlled basement. It holds thousands of guild ledgers, commission contracts and preparatory charcoal sketches. She finds the one sketch that shows the missing section, carries it upstairs, and tapes it to the easel.

The restorer’s skill is unchanged. What changes is the job. She no longer invents; she reconstructs what the sketch says was there, in the master’s hand. If the historian comes back empty-handed, a good restorer does not guess. She fills the hole with a neutral tone and writes “unknown” in the report.

That is the whole of RAG:

  • The restorer is the language model: enormous general skill, no knowledge of your private archive.
  • The historian is the retriever: she does not paint; she finds.
  • The sketch on the easel is the retrieved context, placed in the prompt.
  • The neutral fill is the refusal: no source, no answer.

Everything that goes wrong with RAG in production goes wrong in one of those four places. The historian brings the wrong sketch, an old sketch, or half a sketch. The restorer ignores the sketch and paints from memory anyway. Or nobody admits the basement had nothing.

Do you need a historian?

RAG is the right tool when the answer lives in records the model has never seen, those records pile up and replace each other, and someone needs to check where the answer came from. Outside that, a simpler tool usually wins.

The restorer’s question What the studio does Use
“What did this lost section show, and how do we know?” The historian fetches the drawing or photograph RAG
The work has only three records Pin all three to the easel Paste them into the prompt; no retriever needed
“Paint this in the manner of 1460s Florence” Train the restorer in that school Fine-tuning or a better prompt; the Night Watch team trained on Rembrandt’s own canvas for exactly this
“How many giornate across all our chapels?” Ask the registrar’s database SQL or an API, possibly called by the model as a tool
“What is egg tempera?” The restorer already knows Plain prompting

The second row has grown more often true as context windows have grown. The archive in this post holds 15 records and would fit in a single prompt today. A real studio holds decades of surveys, imaging studies and treatment records across hundreds of works, in several languages, and every new survey replaces an older one. That is when the historian earns her place.

From studio to pipeline

Every part of the studio has a counterpart in a RAG system, and each one is a module in tratteggio.

The studio as a RAG pipeline Find: 15 records become 36 cards; the historian's search filters by chapel and supersession, expands words with a thesaurus, and returns the top three by BM25. Match: a gate checks the best score; if it passes, the sources are numbered on the easel and a local model writes the answer. Fill: a provenance check confirms every sentence is cited and every number is in its source. Passing answers go out with citations. A failed gate, a failed check or a NOT_IN_SOURCES reply all end in the same neutral fill: the archive has no record. Find Match Fill the historian the easel and the brush the report Basement 15 records with chapel, date, supersession Catalogue cards 36 cards, one per ## section Historian’s search filters, thesaurus, BM25, top 3 Gate best card scores 3 or more? Easel sources taped up as [S1]–[S3] Brush local model, temperature 0 yes Provenance check cited? numbers in source? Answer with citations pass Neutral fill “The archive has no record…” fail no NOT_IN_SOURCES
The studio as a pipeline. Three different failures end in the same neutral fill.
In the studio In a RAG pipeline In tratteggio
The basement archive The document store archive.py loads contracts, drawings, photographs and condition reports with their metadata
Cutting a ledger into catalogue cards Chunking chunker.py splits by heading, never mid-section
The card catalogue The index (keyword, vector or both) catalogue.py, a BM25 index with an optional embedding index
The historian’s search Retrieval and ranking catalogue.search(), top-k with fused scores
“Only records for this chapel, only the latest survey” Metadata filters Chapel and superseded-record filters
Taping the sketch to the easel Prompt assembly with numbered sources easel.py
The restorer’s brush The language model A local model through Ollama
Neutral fill in the gap (tratteggio) Refusal when retrieval is weak tratteggio.py, a score gate before the model is called
The restoration report: what came from which source Citations and a faithfulness check provenance.py
The review board Evaluation eval.py: recall@k, MRR, refusal accuracy

The name comes from the last real story in this post. Tratteggio is the Italian technique of filling a loss with fine vertical hatching: from a few metres it reads as part of the painting, up close it is plainly a repair. It is the conservator’s way of saying “this part is not original” without leaving an ugly hole. A good RAG system needs the same habit.

The Night Watch: retrieve the copy, paint in the master’s hand

In 1715, Rembrandt’s The Night Watch (1642) moved to Amsterdam’s town hall and was cut down on all four sides to fit its new wall. The strips were never found. For three centuries, visitors saw a composition Rembrandt never painted, with the captain and lieutenant shoved toward the centre.

One thing survived: a much smaller copy of the uncut painting, made in the 17th century and attributed to Gerrit Lundens, on long-term loan from the National Gallery in London. That copy is the historian’s sketch. It shows what was in the missing strips.

It could not simply be enlarged. The Lundens copy differs in style, colour and perspective, and the Rijksmuseum’s senior scientist, Robert Erdmann, said a blown-up print would not match at all. So his team trained neural networks on Rembrandt’s own canvas to learn how Rembrandt painted, then had them repaint the strips from the copy. The fit was close enough that the model even reproduced the fine cracking of the original surface.

In June 2021 the printed strips went on display, hung to overlap the original without touching it.

Read that as a RAG design review:

  • Facts from retrieval. What the strips show came from the Lundens copy, not from the model’s imagination.
  • Fluency from the model. How they look, brushwork and palette, came from a model trained on the master.
  • Separation you can see. The new strips hang beside the original, clearly not part of it. That is a citation.
  • Quality capped by the source. Where Lundens was vague, the reconstruction is vague. No model fixes a poor sketch.

The last point is the one teams forget. RAG does not make a model truthful. It makes a model as truthful as the documents you hand it, which moves the hard work from the brush to the basement.

The week the archive assistant painted four wrong things

The rest of this post uses one fresco, invented for the purpose. The Lanaioli Chapel belongs to Florence’s wool guild. Its east wall, painted by Jacopo di Neri in 1462–64, shows St Michael weighing souls above a wool merchant at his counting table, the guild’s picture of honest trade. A 2019 survey found a lacuna of 38 by 41 cm in the lower centre. It takes the merchant’s head, his right hand and most of the table.

The studio’s basement holds 15 records: the 1462 contract, two preparatory drawings, a 1931 photograph, condition reports from 1952 and 2019, a 1953 treatment record, imaging and pigment studies, the guild’s ledger, a 1789 inventory, the studio’s retouching rules, and two records from a different chapel in Pistoia that happens to show the same subject.

Version one of the studio’s archive assistant was the RAG tutorial everyone writes first: cut every record into 300-character chunks, index them, send the top three to a model. A junior restorer at the easel asked it four questions in her first week.

The purse. “What was the merchant holding in his right hand?” The top card was the drawing for the Pistoia merchant: holding a purse in his left hand. The Lanaioli drawing, Disegno 14, shows a balance. The difference is the whole point of the picture. A balance says honest trade; a purse says greed.

The broken drawing. Why did Disegno 14 lose? The 300-character cutter had split its key sentence across two fragments, the first ending “a balance held up in his right ha”. Neither half ranked in the top three.

The 12 cm hole. “How big is the hole in the lower centre?” The top card was the 1952 condition report: a small loss of about 12 cm, near the merchant’s hand. The 2019 survey, 38 by 41 cm, came third. The 1952 report had been superseded for years, but nobody had taken it out of the index. A restorer who trusted it would prepare to repaint a hand and find a missing head.

The vault. “What is painted on the vault?” No record says. The retriever still returned its three best guesses, and the model described a deep azurite sky with gilded stars, a common Florentine scheme, plausible and unsupported. Borja again, with better technique.

In a real studio none of these would reach the wall: a senior conservator checks every reconstruction against the documents. But an assistant that has to be checked line by line is a second job, not a help. Mapped back to the studio, the four answers are four different failures:

Question What went wrong Studio failure
The purse A record from another chapel answered The historian fetched a sketch from the wrong chapel
The broken drawing Key sentence cut mid-word The sketch shattered, like Mantegna’s wall
The 12 cm hole Superseded report still indexed An earlier draft, filed beside the final survey
The vault Nothing relevant, answered anyway No sketch existed; the restorer painted an angel

The retrieval results above are not invented. Every one is reproduced by running tratteggio’s naive configuration against the same 15 records. The model’s replies are illustrative; what it was handed is real.

Building the studio, room by room

tratteggio is about 460 lines of Python with no dependencies beyond the standard library, plus Ollama for the model. The archive is small so you can read every record. Every failure below gets worse, not better, at 15,000 records.

The basement: records with provenance

Each record is a Markdown file with front matter. The metadata is not decoration; it is what lets the historian ignore the wrong chapel and the old report.

# archive/report-1952.md (front matter)
---
id: report-1952
title: Condition report, 1952
chapel: lanaioli
kind: condition
dated: 1952
superseded_by: survey-2019
---

Conservators already think this way: every condition report names the work, the date and the report it replaces. If your records do not, fix that before you touch a vector database. No retriever can filter on facts nobody recorded.

Cutting cards: what Mantegna’s fragments teach about chunking

On 11 March 1944, Allied bombs aimed at Padua’s rail yards hit the Eremitani church and shattered Andrea Mantegna’s frescoes in the Ovetari Chapel. Citizens dug 80,735 fragments out of the rubble, the smallest the size of a coin. They sat in crates for decades.

What made them usable again was a set of black-and-white photographs taken in the 1920s. Physicist Domenico Toniolo and mathematician Massimo Fornasier wrote software that compared each scanned fragment against the photographs to find where it belonged. The reconstruction went on show in 2006, fragments set into their places on photographic panels.

Two lessons carry straight into chunking. A fragment without its context is nearly useless: it took a picture of the whole wall to place it. And the size of the pieces was decided by a bomb, not by the content. A 300-character chunker is a bomb. It cut Disegno 14 at “a balance held up in his right ha”.

Two ways to cut the same record On the left, a 300-character cutter splits Disegno 14 in the middle of the word hand: the first fragment ends 'a balance held up in his right ha' and the second begins 'nd and an open ledger'. On the right, one heading card keeps the whole Description section together, labelled with the record title and heading. Two ways to cut the same record Disegno 14, study for the merchant 300-character fragments …study for the wool merchant in the lower register of the Lanaioli Chapel fresco. ## Description The merchant is seated, facing left, with a balance held up in his right ha nd and an open ledger on the table before him. A small dog lies at his feet. Squaring lines show the drawing was transferred to the wall. ## Notes … cut here Heading cards Disegno 14, study for the merchant > Description The merchant is seated, facing left, with a balance held up in his right hand and an open ledger on the table before him. A small dog lies at his feet. Squaring lines show the drawing was transferred to the wall. Title and heading travel with the text, the way each Mantegna fragment travelled with its photograph.
The 300-character cutter splits Disegno 14 mid-word. A heading card keeps the description whole and labelled.

tratteggio cuts along the structure the cataloguer already gave the record, one card per ## section, and every card carries its record title and heading, the way each Mantegna fragment carried its photograph.

# tratteggio/chunker.py (excerpt)
def by_heading(records):
    """One card per ## section, so a description never splits mid-sentence."""
    chunks = []
    for rec in records:
        heading, lines = None, []
        for line in rec.body.splitlines() + ["## "]:
            if line.startswith("## "):
                if heading and lines:
                    slug = heading.lower().replace(" ", "-")
                    chunks.append(Chunk(f"{rec.id}#{slug}", rec, heading, " ".join(lines).strip()))
                heading, lines = line[3:].strip(), []
            elif line.strip() and not line.startswith("# "):
                lines.append(line.strip())
    return chunks

# What the index sees for each card:
#   "Disegno 14, study for the merchant > Description\nThe merchant is seated, facing left, ..."

The 15 records become 36 cards instead of 23 fragments. Heading cards alone lifted recall a little, from 72% to 78% (see the review board below). Their bigger value is that the next two rooms can act on them.

The catalogue: BM25 with filters

The historian’s first tool is a keyword catalogue. BM25 scores a card higher when it contains the query’s rarer words, and does not reward long cards just for being long. The important part is the two filters, applied before ranking.

# tratteggio/catalogue.py (excerpt)
def search(self, query, k=3, chapel=None, current=False, thesaurus=False):
    if thesaurus:
        query = expand(query)
    keep = [i for i, c in enumerate(self.chunks)
            if (chapel is None or c.page.chapel in (chapel, "studio"))
            and (not current or c.page.current)]
    kw = self.bm25(query)
    order = sorted(keep, key=lambda i: -kw[i])
    if self.vectors is not None:          # optional: hybrid search
        order = self._fuse(query, keep, order)
    return [Hit(self.chunks[i], kw[i], r + 1) for r, i in enumerate(order[:k])]

chapel="lanaioli" removes the Pistoia records: the wrong chapel. The studio’s own retouching rules are tagged studio and always pass. current=True removes any record with a superseded_by: the 1952 report. A test pins both ways. Unfiltered, the purse and the 12 cm hole come first. Filtered, they never appear.

The class also accepts an Ollama embedder for hybrid search, fusing keyword and vector rankings by reciprocal rank. It is in the code and its fusion logic is tested, but every number in this post is keyword-only.

The thesaurus: when the restorer’s words are not the archive’s

Filters fixed the wrong chapel and the old report. They did not fix vocabulary. The restorer says “hole”; the survey says “lacuna”. She says “scales”, “underdrawing”, “white crust”; the records say “balance”, “sinopia”, “efflorescence”. Keyword search cannot connect words that share no letters.

Museums met this problem long before software did. They keep controlled vocabularies, such as the Getty’s Art & Architecture Thesaurus, so that different words for the same thing lead to the same records. tratteggio has a tiny one of its own:

# tratteggio/thesaurus.py (excerpt)
TERMS = {
    r"\b(hole|gap|missing|damaged area)\b": "lacuna loss",
    r"\b(flaking|peeling|coming off)\b": "lifting",
    r"\bscales\b": "balance",
    r"\b(sketch|study)\b": "drawing disegno",
    r"\bunderdrawing\b": "sinopia infrared",
    r"\bblue\b": "azurite ultramarine",
    r"\bwhite (crust|bloom|deposits?)\b": "efflorescence salts",
    # ...
}

It lifted recall from 81% to 88%. The four misses that remain are the instructive part. “In the 1950s” never matches “1953”. “The 18th century” never matches “1789”. “Dark and dirty” misses “darkened and trapped dirt”, and “face” misses “facing”. Dates and word forms are vocabulary too. A better stemmer would fix two of them. The dates need embeddings, or a model that rewrites the question before the search. Embeddings are the learned version of the thesaurus: they connect “hole” to “lacuna” without a rule, at the cost of being harder to inspect when they get it wrong.

The easel: sources taped up, numbered

The prompt does four things: it labels every source, it forbids outside knowledge, it gives the model a fixed word for silence, and it tells it what to do when records disagree.

You are the studio archivist for the Lanaioli Chapel fresco.
Answer ONLY from the numbered sources below. Do not use outside knowledge.
After every sentence, cite the source it came from, like [S1].
If the sources do not answer the question, reply exactly: NOT_IN_SOURCES
Keep the answer under 80 words.
If sources disagree, prefer the most recent record and say so.

Each source arrives as [S3] Disegno 14, study for the merchant > Description followed by its text. The title matters here as much as in the index. If a filter ever misses, a model that sees “Drawing for the Pistoia merchant” above a paragraph is far less likely to paint that purse into Florence.

Tratteggio: Cimabue’s honest gap

On 4 November 1966 the Arno flooded Florence. In the Basilica of Santa Croce, Cimabue’s 13th-century painted Crucifix stood in the water, and nearly half its paint was lost. Umberto Baldini, who ran the Uffizi’s conservation studios, and Ornella Casazza led the restoration.

They did not repaint Christ’s missing face and body as Cimabue might have painted them. Nobody knew exactly what was there, and inventing it would have been a forgery. Instead they filled the losses with fine hatched strokes of colour that let the eye read the whole figure from a distance and show, up close, exactly where the original stops. The crucifix went back to Santa Croce, rigged with cables to hoist it clear if the river ever rises again.

tratteggio refuses in two places. First, before the model is called, if the best card scores below a threshold. The refusal text is the studio’s own retouching rule:

# tratteggio/tratteggio.py
REFUSAL = "The archive has no record that answers this. Fill with a neutral tone; do not invent forms."

def gate(hits, threshold):
    return bool(hits) and hits[0].score >= threshold

Second, after the model answers, if it said NOT_IN_SOURCES or failed the provenance check below. Either way the restorer sees the same honest gap, and the log records why.

The restoration report: provenance

The last room checks the model’s work before the restorer sees it. Every sentence must cite a source, and every number in a sentence must appear in the source it cites.

# tratteggio/provenance.py (excerpt)
NUM = re.compile(r"\d+(?:\.\d+)?")

def check(answer, hits):
    problems = []
    for s in sentences(answer):
        cited = [int(n) for n in re.findall(r"\[S(\d+)\]", s)]
        if not cited:
            problems.append(f"uncited: {s!r}")
            continue
        text = " ".join(hits[n - 1].chunk.text for n in cited)
        for num in NUM.findall(re.sub(r"\[S\d+\]", "", s)):
            if num not in text:
                problems.append(f"{num} is not in the cited source: {s!r}")
    return Report(not problems, problems)

It is crude, and deliberately so. It cannot tell whether a sentence means what its source says. But it catches the measurement that sends a restorer to the wall unprepared. Given “The loss is about 12 cm across [S1]”, with the 2019 survey as S1, it reports 12 is not in ['S1'] and the restorer gets the refusal instead.

It is also strict. “He holds a balance [S3]. It was a common emblem of honest trade.” fails, because the second sentence cites nothing. True, perhaps, but not from this archive, and that is the line the studio wants held.

Running it

git clone https://github.com/Kunal-Vyas/blog-tools
cd blog-tools/tratteggio
python make_archive.py               # writes the 15 records
python -m pytest -q tests            # 8 passed
python -m tratteggio.eval            # the numbers in the next section
ollama pull llama3.2
python -m tratteggio "What was the merchant holding in his right hand?"

Add --dry-run to see what the historian fetched without calling the model:

$ python -m tratteggio "What was the merchant holding in his right hand?" --dry-run
#1   4.72  disegno-15#description
#2   4.19  survey-2019#losses
#3   3.95  disegno-14#description
gate: open (threshold 3.0)

The right card is there, but third. The angels’ drawing wins on “holds” and “right”, and the survey wins on “right hand”. A model reading all three should answer from S3, and the provenance check holds it to whatever it cites. That third-place finish is exactly what the next section measures.

The review board: measure the historian before the restorer

With filters and the thesaurus, the right card reached the top three for 28 of 32 answerable questions, up from 23, and no Pistoia or superseded card reached the top three at all. Measure retrieval first: if the sketch never reaches the easel, no prompt can save the answer.

eval.py asks 32 questions a restorer would ask at the easel, each paired with the phrase the right card must contain, plus 8 questions the archive cannot answer. Recall@3 is the share of questions where that phrase is in the top three cards. Trap rate is the share of questions where a Pistoia record or a superseded report reached the top three. MRR, which rewards ranking the right card higher, rose from 0.59 to 0.76 across the same four steps.

Retrieval scores by configuration Recall at three: A 0.72, B 0.78, C 0.81, D 0.88. Trap rate: A 0.38, B 0.34, C 0.00, D 0.00. Adding the chapel and superseded filters in C removes every wrong-chapel and out-of-date card from the top three. Recall rose slowly; the traps disappeared at once 32 answerable questions, top three cards Recall@3: right card in the top three Trap rate: wrong chapel or old report in top three 0% 25% 50% 75% 100% A. 300-character chunks, no filters 72% 38% B. Heading cards, no filters 78% 34% C. + chapel and superseded filters 81% 0% D. + thesaurus 88% 0%
Each configuration adds one change. The filters in C remove every wrong-chapel and out-of-date card from the top three.

The pattern is worth noticing. Heading cards helped a little. Filters barely moved recall but erased the trap rate, which is the number that puts a purse in the merchant’s hand. And the biggest single gain came from the least glamorous fix, a hand-written word list.

The gate is a trade-off, not a fix. With configuration D, this is what each threshold does:

The gate trade-off As the threshold rises from 2 to 6, answerable questions still answered fall from 32 to 27, 24, 19 and 12 of 32, while unanswerable questions refused rise from 0 to 4, 6, 7 and 8 of 8. The default threshold of 3 answers 27 and refuses 4. Every point the gate refuses costs real answers Configuration D, by score threshold 0% 25% 50% 75% 100% 2 3 (default) 4 5 6 Minimum BM25 score of the best card 32/32 0/8 27/32 4/8 24/32 6/8 19/32 7/8 12/32 8/8 answerable questions still answered unanswerable questions refused
Raising the threshold refuses more unanswerable questions, and more real ones with them.

At 3, the gate refuses the signature, the vault, earlier restorers and the merchant’s name. Four get through because they share strong words with real records: the merchant’s eyes, a copy in another museum, the dog’s head, and the cost of the 1953 treatment. That last one scores 5.78, higher than most real answers, because the treatment record matches every word except “cost”. Those four rely on the second line of defence: the NOT_IN_SOURCES instruction and the provenance check. A score gate is the first filter, not the last.

The dog’s head is a fair grey case. The 1931 photograph says the head was already damaged, so the honest answer is “the archive never shows it intact”. That is still a refusal to invent, which is the behaviour being tested.

Two cautions before you quote these numbers anywhere. I wrote the thesaurus and picked the threshold after looking at these same 40 questions, which is how you overfit. A real studio keeps a held-out set it never tunes against. And 40 questions is a smoke test. A real review board would be built from a few hundred questions conservators actually asked, refreshed with every new survey.

A studio you can carry

tratteggio uses only the Python standard library so that every room is visible in a few dozen lines. Each room has a production equivalent you would reach for in a real conservation department:

tratteggio room What it does here What you would use at scale
archive.py Markdown records with front matter An export from the collection management system, with work ID, record type, date and supersession enforced at entry
chunker.by_heading One card per ## section Structure-aware splitters (Markdown or HTML header splitters in LangChain or LlamaIndex), with token limits for long reports
catalogue.py (BM25) In-memory keyword index OpenSearch or Elasticsearch BM25, or Postgres full-text search
OllamaEmbedder + fusion Optional vector search, rank fusion pgvector, OpenSearch k-NN or a managed vector store; hybrid search built in
thesaurus.py Hand-written synonyms The Getty vocabularies plus the studio’s own glossary, embeddings, or a cross-encoder reranker
tratteggio.gate Score threshold A reranker score threshold, which is better calibrated than raw BM25
provenance.py Citations and number checks The same checks, plus an LLM-as-judge faithfulness score on sampled answers
eval.py 40 hand-written questions A labelled set of questions conservators actually asked, with a held-out split, rerun whenever records are added

The last row matters most. Every campaign adds records: a new survey, a new imaging study, a treatment that replaces the last one. An evaluation that runs only when someone remembers is a basement nobody has inventoried.

The restorer’s ledger

RAG did not make the studio’s assistant a better painter. The model was always skilled. RAG made it accountable: every answer now points at a record a conservator can pull from the basement, and when there is no record, it says so.

What it fixed, and what it did not:

Studio lesson tratteggio fix Still open
Borja: a face painted from memory Answer only from numbered records The model can still misread a record it cites
Night Watch: facts from the copy, style from the model Retrieval supplies facts, the model supplies wording Answers are only as good as the records
Mantegna: fragments need their photograph Heading cards carrying record title and heading Very long reports still need splitting
The wrong chapel, the old report Chapel and superseded filters Only works if every record is tagged correctly
The restorer’s words A thesaurus (or embeddings) Dates and word forms still slip through
Cimabue: an honest gap Score gate, NOT_IN_SOURCES, provenance check Four of eight unanswerables pass the gate

If you take one thing from this post, take the order of work. Tag your records. Measure retrieval. Only then tune the prompt. Most teams do it backwards, because the prompt is the part that looks like AI.

The code is in blog-tools beside sumbisori, sugarshack and scriptorium.

Sources

The Lanaioli Chapel, its fresco, the painter Jacopo di Neri and the studio’s archive are fictional. Borja, the Night Watch, the Ovetari Chapel and the Santa Croce Crucifix are real.