docs: contradiction taxonomy for the KG; INTAKE component
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.
This commit is contained in:
+36
-20
@@ -6,28 +6,44 @@ stopping, failure, and how every LLM call gets its context composed.
|
||||
## 0. The whole machine in one paragraph
|
||||
|
||||
A goal arrives (a question to answer, a tool to call, a chat to hold, a maintenance task
|
||||
to run). floop never "thinks a goal through" in one pass: the goal reduces to open
|
||||
questions until one is small enough for a single expert call; answers flow back up and are
|
||||
assembled into the response. Three kinds of parts do the work. **The LLMs** propose: read
|
||||
the request, type the response expected, decompose the goal into subquestions, translate
|
||||
between language and formal formats, compose the final prose. They never decide, never
|
||||
compute, never assert facts. **The engines** — solvers, provers, retrieval, the knowledge
|
||||
graph — do the deciding: deterministic, typed inputs in, typed payloads and traces out.
|
||||
**The machine** — plain fixed code — owns the state: the open-question stack, the
|
||||
dependency order, the budget, the retries, the stopping rule, and the per-call context
|
||||
composition. One law runs through everything: a claim enters the state only as a typed row
|
||||
with provenance — never as free-form model prose.
|
||||
to run) — possibly wrapped in far more material than the model's window holds, and of
|
||||
unknown format. The **INTAKE** stage resolves the boundary first: the original is stored
|
||||
whole on disk, known formats are split structurally by fixed code, unknown formats are
|
||||
compressed in stages (chunked summarization within the window, a cheaper large-window
|
||||
model fronting the first pass if configured), and the request itself — the goal — is
|
||||
separated early from the material it refers to. Only then the loop starts. floop never
|
||||
"thinks a goal through" in one pass: the goal reduces to open questions until one is
|
||||
small enough for a single expert call; answers flow back up and are assembled into the
|
||||
response. Three kinds of parts do the work. **The LLMs** propose: read the request, type
|
||||
the response expected, decompose the goal into subquestions, translate between language
|
||||
and formal formats, compose the final prose. They never decide, never compute, never
|
||||
assert facts. **The engines** — solvers, provers, retrieval, the knowledge graph — do the
|
||||
deciding: deterministic, typed inputs in, typed payloads and traces out. **The machine** —
|
||||
plain fixed code — owns the state: the open-question stack, the dependency order, the
|
||||
budget, the retries, the stopping rule, and the per-call context composition. One law
|
||||
runs through everything: a claim enters the state only as a typed row with provenance —
|
||||
never as free-form model prose.
|
||||
|
||||
## 1. RECEPTION — typing the goal
|
||||
## 1. RECEPTION — intake, then typing the goal
|
||||
|
||||
A request arrives with (possibly) a tool list. One LLM call reads it and declares the
|
||||
**response type expected by the requester**: `answer` (a question to answer), `tool_call`
|
||||
(an action to take), `chat` (conversation to hold), `meta` (a floop-maintenance task),
|
||||
`plan_only` (a plan without execution). This typing annotates the goal — like
|
||||
`answer_type`, it may be tightened later by evidence. It is NOT a path switch: whatever
|
||||
the type, the goal is served by the same loop below. The typing costs one cheap call and
|
||||
buys a contract: the output is checked against the declared type on arrival, and a
|
||||
mismatch is a refusal-replan, not a silent guess.
|
||||
INTAKE (ARCHITECTURE.md §3) runs first, always: whatever arrives — a short question, or a
|
||||
million-token document with the request buried at the end — is stored verbatim as a run
|
||||
artifact; known formats are split structurally (JSON walked, markdown sectioned, plain
|
||||
text sentence-split), unknown formats are compressed in stages within the model's window
|
||||
(chunked summarization; a cheaper large-window model may front the first pass); and the
|
||||
goal is separated from the material early, by a bounded LLM task when the boundary is not
|
||||
structurally obvious. The material becomes typed rows pointing into the stored original;
|
||||
the goal drives the loop.
|
||||
|
||||
Then the typing call, which now operates on clean typed state rather than raw text: a
|
||||
request arrives with (possibly) a tool list. One LLM call reads the goal statement and
|
||||
declares the **response type expected by the requester**: `answer` (a question to
|
||||
answer), `tool_call` (an action to take), `chat` (conversation to hold), `meta` (a
|
||||
floop-maintenance task), `plan_only` (a plan without execution). This typing annotates the
|
||||
goal — like `answer_type`, it may be tightened later by evidence. It is NOT a path switch:
|
||||
whatever the type, the goal is served by the same loop below. The typing costs one cheap
|
||||
call and buys a contract: the output is checked against the declared type on arrival, and
|
||||
a mismatch is a refusal-replan, not a silent guess.
|
||||
|
||||
## 2. The main loop
|
||||
|
||||
|
||||
@@ -74,6 +74,38 @@ be far larger than any window. What is bounded is **each call's input**.
|
||||
used by the composer; prompt-assembly failures are visible (logged, budgeted retries),
|
||||
not silent.
|
||||
|
||||
### Intake — composing the boundary (the first call's window)
|
||||
|
||||
floop may receive an input far larger than the window of the model it runs: as a drop-in
|
||||
LLM it can accept a context of, say, 1M tokens while the model it calls has 64k — and the
|
||||
input is free text of unknown format: JSON, markdown, or a huge document with a question
|
||||
at the end. The **INTAKE** component resolves this before anything else runs:
|
||||
|
||||
1. **Keep the original whole, on disk.** The machine's memory is unlimited; the input is
|
||||
stored verbatim as a run artifact and becomes machine state, referenced by id. No LLM
|
||||
ever needs to see all of it at once.
|
||||
2. **Deterministic format detection first, always.** Fixed code probes for known formats:
|
||||
JSON (parse it), markdown/XML (structure), code (fences, shebang), plain text. Format
|
||||
detection is a computation, not a judgement — no LLM in it.
|
||||
3. **Known format → structural splitting.** JSON walks the object; markdown splits at
|
||||
headings; documents split at section/sentence boundaries. Structure discovered by code
|
||||
is trusted and typed into rows, each carrying a pointer into the stored original.
|
||||
4. **Unknown or unstructured → staged LLM compression.** When no structure is found, the
|
||||
input is compressed in stages: chunked summarization (chunks sized to the model's
|
||||
window, map-reduce over them), optionally fronted by a cheaper model with a larger
|
||||
window for the first pass if one is configured. Each stage's output is checked and
|
||||
typed; because the original stays on disk, compression is always re-derivable —
|
||||
lossless at the source, lossy only in what the LLM kept, and logged as such.
|
||||
5. **Extract the goal early.** On every path, one bounded early task separates the
|
||||
request itself (the question at the end of the document, the instruction in the
|
||||
message) from the material it refers to: the goal drives the loop, the material
|
||||
becomes typed evidence rows.
|
||||
|
||||
Intake's output is typed machine state — the goal statement plus rows pointing into the
|
||||
stored original — and from there per-call context composition (above) governs every call.
|
||||
Intake is logged like everything else, and it is the same law at the boundary as inside:
|
||||
the LLM sees a purpose-built context; the machine holds the whole.
|
||||
|
||||
## 4. The evidence table — the machine's working memory
|
||||
|
||||
One table per run, append-only, visible to every component. Each row: an id, a type, a
|
||||
|
||||
@@ -33,6 +33,36 @@ quantities carry values AND units (the bridge to analytic/numeric computation);
|
||||
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:
|
||||
|
||||
@@ -58,7 +58,11 @@ documents(id, url, source, fetched_at, sha256, trusted, text_path)
|
||||
chunks(id, doc_id, section_path, position, char_start, char_end, sha256)
|
||||
quotes(id, doc_id, chunk_id, verbatim, url, access_date) -- canonical text
|
||||
nodes(id, norm_name, sort, mentions++ ) -- entity index
|
||||
edges(src_node, rel, dst_value, dst_node?, quote_id, subject?, extraction_confidence, retracted)
|
||||
edges(src_node, rel, dst_value, dst_node?, quote_id, subject?, extraction_confidence,
|
||||
ref_date?, -- temporal qualifier: the value's reference time
|
||||
supersedes?, -- edge id this refines (subsumption, case 3)
|
||||
preferred, -- default: the supersedes target is preferred
|
||||
retracted, retraction_reason?) -- TMS flag (case 4), never a delete
|
||||
conflicts(nodeA, rel, valueA, valueB, nodeA_quote, nodeB_quote) -- surfaced, never resolved silently
|
||||
```
|
||||
|
||||
@@ -69,9 +73,14 @@ conflicts(nodeA, rel, valueA, valueB, nodeA_quote, nodeB_quote) -- surfaced, ne
|
||||
This is the bridge to `analytic`/`numeric`: knowledge extracts typed
|
||||
quantities; those experts compute on them. Neuro-symbolic payoff, by design.
|
||||
- Duplicate edge from two sources = **corroboration count** on the edge. Same
|
||||
subject+relation with two different literal values = never merged — a
|
||||
`conflicts` row is created and surfaced, exactly the "never silently pick a
|
||||
side" law the machine already uses for user rows.
|
||||
subject+relation with two different literal values = never merged — the
|
||||
store **classifies** (KNOWLEDGE.md §2 "the four cases"): temporal change by
|
||||
qualifiers (both coexist, each with its period), supersession by subsumption
|
||||
test (supersedes link, preferred flag), and real contradiction → a
|
||||
`conflicts` row, surfaced, never silently resolved — the same "never silently
|
||||
pick a side" law the machine uses for user rows. Untyped qualifiers default
|
||||
to the contradiction case: a visible conflict is preferred to a guessed
|
||||
temporality.
|
||||
- Entity node identity, draft: `(normalized_name, sort)` with normalization =
|
||||
casefold + punctuation strip. Entity resolution is hard; the draft merges
|
||||
ONLY on normalized-name equality within the same sort. Everything else stays
|
||||
|
||||
Reference in New Issue
Block a user