KNOWLEDGE.md/DESIGN.md: new data contradicting or refining old data is normal operation, classified deterministically - temporal change (qualifiers, both coexist), supersession (subsumption test, supersedes link), real contradiction (conflict row, surfaced, never auto-resolved), retraction (TMS flag). Untyped qualifiers default to exposed conflict. Schema gains ref_date/supersedes/preferred/retraction_reason. ARCHITECTURE.md/ALGORITHM.md: INTAKE - the boundary before the loop; floop may accept 1M-token inputs over a 64k-window model: original stored whole on disk, deterministic format detection, structural splitting for known formats, staged LLM compression for unknown, goal separated from material early. Reception typing now operates on clean typed state.
116 lines
6.8 KiB
Markdown
116 lines
6.8 KiB
Markdown
# 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):
|
|
|
|
1. **Real contradiction** — same subject+relation, same reference time, different values.
|
|
Detection is structural at merge time. A `conflict` row 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.
|
|
2. **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.
|
|
3. **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.
|
|
4. **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:
|
|
|
|
1. **Search & fetch** (engine): Wikipedia first (trusted-domain list in config), general
|
|
web later. Documents stored whole with checksums.
|
|
2. **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.
|
|
3. **Extract** (LLM Signature): per chunk, propose typed candidates — (subject, relation,
|
|
object/value+unit, verbatim span). Bounded retries on malformed output.
|
|
4. **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.
|
|
5. **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; re-fetch policy is future work (a source older
|
|
than its field's decay rate should be re-consulted).
|
|
- The KG is floop's memory, not a world model: it holds what floop has had reason to
|
|
fetch, verify and keep. |