← back to the Yarns brief
Yarns · System diagrams

Facts in code,
judgment in the model.

● LIVE ON HUGGING FACE · SOURCED GRAPH · READ-ONLY SAFETY GATE · NO MODEL AT RUNTIME

A cosmos of cinema you travel by thread. Every connection you pull on — even an interpretive one — is a sourced, cited, traversable edge, not a fact a model made up. The spine is one rule: everything deterministic — the graph, the safety gate, the lineage trace — is pure code and authoritative. Claude is reserved for the two things code can't do: turning a question into a precise query, and turning a cited payload into prose. These five diagrams trace exactly where that line falls.

Blue — deterministic, computed in code
Amber — Claude · the judgment
Coral — refused in code (the gate says no)
01 / 05 — THE CORE LOOP

A question becomes a cited answer, with the model only at the two edges.

When you ask Yarns something, Claude turns the question into a precise graph query — and that's the last word it gets until the end. The query passes a read-only gate, the graph executes it and returns a cited payload, and only then does Claude write the prose from that payload. The facts come from the graph; the model never sources them itself. Most of the time there's no model at all — film cards are pre-written and served straight from disk.

You ask Claude · judgment Deterministic — computed in code Claude · judgment Question "how do these two worlds connect?" Claude → query INTENT → CYPHER proposes a read Read-only gate PURE PYTHON validate · allow / refuse Graph KUZU · READ-ONLY traverse → cited payload Claude → prose PAYLOAD → WORDS writes from sources Cited answer every claim → its edge "a reading · NN%" where read Most cards skip the model entirely film card → pre-written voice content, served from disk

The model touches the loop at exactly two points — question → query and payload → prose — and the read-only gate sits between them and the database so a proposed query can never write. Everything in the middle is deterministic graph work. Open a film card and usually there's no model at all: the words were written once and stored.

02 / 05 — THE READ-ONLY GATE

A model-written query is never trusted on faith — code decides if it may run.

Claude proposes a query; it does not get to execute one. Every proposed query runs a gauntlet of pure-Python checks first — blank the string literals, catch smuggled comments, scan for any write token, reject multiple statements, verify every label against the real schema. Pass all five and it runs read-only. Fail any one and it's refused before it touches the database. The adversarial battery that proves it is CI-blocking and must pass 100%.

Proposed query from Claude Pure-Python validator — five sequential checks 1 · Blank literals hide string contents 2 · Comment smuggle no hidden payload 3 · Write tokens CREATE/SET/DELETE? 4 · One statement no multi-statement 5 · Schema labels only real node types Run read-only ALL FIVE PASS Refused — never reaches the database ANY ONE CHECK FAILS · the gate says no

This is the line between "an AI with database access" and a safe one. The model can propose anything; the gate is pure Python, deterministic, and the only thing that can hand a query to the engine — and only ever a read. The battery of attacks it must block lives in CI and is green or the build fails.

03 / 05 — SOURCED EDGES

A fact is structural. A reading carries its receipts. Neither is allowed to be invented.

Two kinds of connection live in the graph. A fact edge — shared actor, sequel-of, same director — is structural and checkable. An interpretation edge — a shared archetype, an echoed arc — is the interesting kind, and the one a model loves to fabricate. So every interpretation edge must carry a rationale, a confidence, and a citation, and the card shows it as "a reading · 82%" — never as fact. No source, no edge.

Fact edge — structural, checkable Neo Keanu Reeves PLAYED_BY from credits · verifiable Interpretation edge — a reading, worn honestly Neo The Chosen One EMBODIES · "a reading · 82%" rationale + confidence + citation Every reading must carry · rationale — why it holds · confidence — how strongly · source_tier — where from shown as a reading, never fact Missing a citation? Rejected no source, no edge — a fabricated parallel has nothing to point at

This is the whole moat. A model asked for parallels will produce confident fiction; Yarns only lets an interpretation into the graph if it can point at a source, and it always wears the "a reading" label so it's never confused with a structural fact. No source, no edge.

04 / 05 — GENERATED ONCE, STORED

The words are written once, offline, and committed. The live app reads them off disk.

Every synopsis, saga, crucial scene, fun fact, actor bio, and character card is generated once, offline, grounded in the committed corpus — then stored as compressed bundles right in the repo. At serve time the app just reads them from disk: a film card opens with zero network calls and zero token spend. The deployed app needs no model at runtime. The only place a model lights up live is the optional natural-language ask — and only with a key, capped at three asks per visitor a day.

Offline — once, by hand, before deploy Committed corpus sourced facts · YAML Claude grounded generation Stored bundles synopses · sagas · facts compressed · in the repo Runtime — every visitor App reads disk NO MODEL CALLED Film card opens zero network · zero tokens instant Optional — the natural-language "ask" lights up only when a key is present · the lone live model call capped at 3 asks per visitor per day · per-IP ledger

Determinism here isn't only reliability — it's economics and speed. Because the voice content is generated once and stored, the live cosmos is free to run and instant to open, and the only live model call is an opt-in ask behind a hard per-visitor cap.

05 / 05 — THE GRAPH

One cosmos of typed nodes and edges — and every card is a door into it.

Underneath the spinning poster-globes is a single embedded graph: universes, films, series, actors, characters, and archetypes as first-class nodes, wired by fact and interpretation edges. It's built from human-editable seed YAML at boot and opened read-only to serve. So "click an actor for every face they've worn" or "click a character for their thread" is a graph traversal, not a guess — and the rabbit holes go deep: 3,280 actors and 3,958 characters are nodes you can fall into, 1,385 of them in the MCU alone.

Seed YAML editable · diffable build at boot → Kuzu — embedded graph · read-only at serve Universe Film Series Actor Character Archetype fact edges (grey) · interpretation edges (amber) 20 archetypes · embodiment + arc-echo readings 32 universes · 327 films & series · sourced Actor → every face worn one traversal across the whole cosmos Character → sourced bio & thread 3,017 pre-generated sourced cards The myth underneath archetypes & arc echoes across worlds

The graph is the source of truth and the reason the connections are real: a face, a thread, a shared archetype is a traversal over typed nodes, not a sentence a model improvised. Edit the cosmos by editing YAML and rebuilding — version-controlled, reviewable, sourced.