Run G (log-10, Italy discharge) failed honestly-empty with the data in hand: Q1 ingested the length table of List of rivers of Italy and threw away the same article's 27-row discharge table (Po 1540, Tiber 239, Adige 235); Q5/Q6 re-searched from scratch, missed (the article says "flow", never "discharge"; Adige/Tiber carry the value only in infobox templates), and died on Drava/Inn fetches. §7 names the mechanism Emili steered: the SKIM — every fetched article is read structurally in passing (headings, table captions/headers, infobox keys, quantity-unit patterns), oriented to the current question AND the goal. Goal-relevant table rows are ingested opportunistically (zero LLM); prose leads are recorded, never preventively extracted; the router learns what was seen; a seen-articles index is consulted before network search; the persistent cache checks freshness by revision id. RUNLOG Run G records the failure chain (rebuilt against code + live Wikipedia) and the three-PR build order.
10 KiB
KNOWLEDGE.md — the knowledge substrate
floop's knowledge lives on disk, not in model weights. This document defines the store, how facts enter it, and how experts consult it.
1. The principle
Model weights are not a knowledge store. Anything floop claims to know must be traceable to a trusted source: extracted from a fetched document, checked against it, stored with provenance, and re-consulted from the store — never re-asserted from "model memory". This is the epistemic core of the architecture: LLMs handle the language of knowledge (find, extract, paraphrase-never, quote); algorithms handle its custody (checks, storage, retrieval, merging).
2. The store
A persistent, append-only store on disk (SQLite + JSONL mirror in the draft; see
code/knowledge/DESIGN.md for schema and trade-offs). Contents:
- documents — fetched source texts (url, source, access date, checksum, text).
- quotes — verbatim spans from documents (the canonical text of a fact; url + access date). Never paraphrased.
- nodes — entities (normalized name, sort: person, organization, concept, event, quantity, document, place, date, other).
- edges — typed relations between nodes (or to literal values), each pointing at the quote(s) that back it, with corroboration counts and extraction confidence.
- conflicts — same subject+relation with two different values: recorded and surfaced, never silently merged.
Laws of the store: append-only (corrections are retraction flags, never overwrites); every edge points at quotes (the quote carries the truth, the edge is the index); quantities carry values AND units (the bridge to analytic/numeric computation); conflicts are surfaced to the user, never auto-resolved; entity identity merges only on normalized-name equality within the same sort (conservative by design).
Contradiction is expected operation — the four cases
New data contradicting or refining old data is normal, not an error. The store never overwrites; it classifies, with deterministic tests (no LLM judgement):
- Real contradiction — same subject+relation, same reference time, different values.
Detection is structural at merge time. A
conflictrow links both edges; both remain queryable with their provenance, corroboration counts and dates. Nothing is auto-resolved: the probe returns both, the synthesis reports the discrepancy honestly, and the conflict becomes an offline lesson (a directed gather toward a more authoritative source). The exit of a conflict is more evidence, never a silent pick. - Temporal change — the value changed because the world did: "population 47M" vs "48M" is a time series, not a contradiction. Edges carry temporal qualifiers (the value's reference date); both values coexist, each valid in its period. Queries return the most recent by default — or the one valid at an asked-for time.
- Refinement (supersession) — the new fact subsumes the old: "won the Nobel" →
"won the Nobel in 1921 for the photoelectric effect". The deterministic test: same
subject+relation, the new object is the old plus additional qualifiers. The store
links them with
supersedes: the general edge stays (audit), the specific becomes preferred; queries return the preferred by default, history stays consultable. - Source retraction or retroactive check failure — the claim itself is withdrawn: the row gets a retraction flag with a reason (TMS, exactly as the evidence table does). Retracted rows are skipped by default queries and remain visible to audit.
Conservative rule: when the qualifiers needed to classify a pair are missing or untyped (a date that failed to parse as DATE), the pair is treated as case 1 — an exposed conflict. A visible conflict is preferred over a guessed temporality. (Reference model: Wikidata's statement ranks + qualifiers; we are stricter — no community, so floop never resolves, it only classifies deterministically or exposes.)
3. How knowledge enters (the gather pipeline)
Extraction is the generic expert shape, run per document:
- Search & fetch (engine): Wikipedia first (trusted-domain list in config), general web later. Documents stored whole with checksums.
- Chunk (engine): section-aware splitting sized to the model's window (~8k tokens target, hard cap per call config). Context composition applies here like everywhere: the extractor LLM sees the chunk plus its section path, not the whole document.
- Extract (LLM Signature): per chunk, propose typed candidates — (subject, relation, object/value+unit, verbatim span). Bounded retries on malformed output.
- Check (engine, the gate): verbatim containment — the span must be string-contained in the fetched document text; sort-checks on the relation's endpoints; trusted-source check; dedupe. Rejected candidates are counted, never silently dropped.
- Merge (engine): into the store; corroboration counts; conflicts recorded.
A fact that fails containment does not exist. This is the cheap, deterministic check that makes the KG trustworthy today, before any prover runs.
4. How knowledge is consulted (the probe)
KG-first: before any external fetch, an expert's question is matched to graph nodes (seeds from the question's mentions) and the neighborhood is traversed (BFS depth 1 with corroboration weighting in the draft; Personalized PageRank — HippoRAG's mechanism — is the planned upgrade, adopted when measured recall justifies it). The probe is an engine: no LLM inside. Multi-hop lives in the plan (one question referencing another's answer slot), never hidden inside the expert.
What the probe returns feeds the calling LLM as compact, purpose-built context: quoted spans with provenance, structured subgraphs sized to the window — not the whole store.
5. Knowledge growth over time
The store grows two ways: on-demand (a run's questions trigger gathers) and
offline — scheduled maintenance that fills gaps observed in past runs (entities
repeatedly unresolved, quotes whose checks failed, sources gone stale). Offline growth is
a meta goal (META.md §3): it uses the same gather pipeline, charged to a maintenance
budget, never inside a serving run.
6. Honest limits
- Extraction quality bounds KG quality: containment guarantees fidelity to the source, not source truth — a quote can faithfully carry a false claim.
- Entity resolution is conservative (name-equality only in the draft); distinct nodes for "Einstein" the person and near-miss names remain distinct until a measured linker exists.
- Freshness: access dates are provenance; the re-fetch policy is the revision-id check of the skim cache (§7) — deferred with the mechanism named, not a guess.
- The KG is floop's memory, not a world model: it holds what floop has had reason to fetch, verify and keep.
7. Skim — reading in passing, for the goal (2026-10-20)
A knowledge call answers its own subquestion, but the articles it fetches contain far more than that answer. The skim is the fast, structural read of every fetched article that happens in passing during the gather — oriented to the current question AND to the run's overall goal — so that information seen along the way is not thrown away when the call returns.
Why it exists (the Italy run, verified live). Q1 ingested the 22-row length table of "List of rivers of Italy" and early-exited; the same article's second table — "Rivers of Italy above 50 m3/s of average flow at the mouth", 27 rows, with every discharge value the goal needed — was discarded unread. Q5/Q6 then re-searched from scratch with no "discharge" vocabulary match (the article says "flow", 0 "discharge" occurrences) and failed honestly-empty. The data was in floop's hands at minute 2.
The skim sheet (per article, deterministic, zero LLM). Built from material
fetch_rich already downloads — no extra network calls:
- section headings and their term-hit counts;
- per table: caption, headers, row count;
- infobox parameter keys (and values for quantity params, units resolved);
- a term-hit map: question stems + goal stems + evidence entities + quantity-unit
patterns (
50 m3/sis a goal-relevant signal even where the words never appear — the section heading "List of Italian rivers above 50 m3/s" found the discharge table where keyword search could not); - links to other articles inside goal-relevant regions (harvest candidates, capped).
Harvest policy (the budget law).
- Relevant to the current question → the existing extract path, with chunks RANKED by the skim instead of first-N-in-document-order.
- Relevant to the goal but not the current question → typed table rows are ingested opportunistically (membership-grade ingestion, zero LLM: subject = entity column, relation = the value column's header, object = value + unit, quote = the stored row line, containment against the stored table text); prose leads are recorded, never preventively extracted — a later step pays only if it asks.
- Ambiguous side-tables → ONE bounded LLM call over the compact skim sheet (titles, captions, keys — never the article body). Deterministic detection first, LLM fallback only on ambiguity.
Notification (the loop knows what was seen). Every knowledge row's payload carries
a compact skim notice — what other goal-relevant material the fetched articles
contained and where it lives — rendered to the router's context and the run notes.
Later steps route with this knowledge instead of re-searching blind; the seen-articles
index is consulted before any network search. Hops still live in the plan (a seen lead
is a pointer, not an opened subquestion — the law stands).
Skim cache (per-run now, persistent later). The seen-articles index is per-run in
v0.1; the store's documents table (url, sha256, fetched_at) is the natural base for a
persistent article cache with skim sheets. Freshness check on access: one cheap
revision-id call (rvprop=ids, no content) — revid changed → re-fetch and re-skim;
unchanged → serve the cache. Zero staleness heuristics: the revision id is the
source's own version counter.
Not in v0.1 (name it, don't hide it). Embedding similarity for lead detection (deferred until lexical + structural skim recall is measured, like PPR); persistent cross-run cache (the schema base exists, the policy is §7's revision check); LLM-written summaries of skimmed articles (a summary is paraphrase — it can never be stored, only rendered for a call's context).