Goal: the grammar-first decoder generates from a retrieved fact's meaning, not just the
prompt's words — so Kai is *correct*, not only fluent. Salad is fixed; this is the next tier.
---
Universe::predictive_query / predictive_query_by_source returns ranked QueryHits (each has text, a SparseVec, score, source, keywords). It can be
filtered to source == "truth-anchor" — i.e. retrieve facts, not chatter.
[internal module] = 52 curated facts, [internal module] = 108 truth-anchor claims. Honest catch: they are almost all about
Kai himself ("KAI is not an LLM", "KAI is a Rust system", "Universe is generative memory").
A grep for cat / vowel / two-plus-two / four = 0. So today he only *knows* himself.
StatLexicon::generate_grammar_first(meaning, seed, params, mw, gw, info)— transcripts nominate, meaning steers. This is what fixed the salad.
try_grounded_generation (behind [config flag]) re-orders a retrieved cell's *words* with word_calculus::assemble. It reshuffles the fact rather than
*generating from* it — keep as a fallback, not the target.
---
Wire retrieval → the grammar-first decoder so the *meaning spine is a fact*:
1. Retrieve. For the prompt, run predictive_query; prefer truth-anchor / high-score hits.
2. Ground the meaning. Build the decoder's meaning vector from the retrieved fact's text
(encode_sentence(fact)), optionally blended with the prompt. Meaning = the fact.
3. Seed + steer from the fact. Open on the fact's key noun; add a fact-cosine term to the
candidate scoring so the chain expresses the fact instead of drifting into corpus filler
("…anniversary gift…"). This is the fix for the mid-sentence drift you saw.
4. Confidence gate (honesty).
("From what I understand…"), or say he doesn't know. Never state a guess as fact.
Plugs into voice.rs generate_raw_thought, in the grammar-first block, behind a flag
(default OFF, byte-identical when off).
---
Track A — code (wire retrieval → generator). Buildable now. With the 52 self-facts it will
immediately make him answer self-questions correctly *and* freshly — "are you an LLM?",
"what are you?", "what is the Universe?" become grounded fluent sentences, not chatter. That's a
real, demonstrable win on day one.
Track B — data (grow the truth store). This is the true ceiling. Grounding can only make him
correct on topics that exist in the store. For "what is a cat" to be right, a cat fact must
be there. Path: curate world facts and --truth-import them (the pipeline exists). This is
DATA work, not decoder work — and it's what turns grounded-Kai from "knows himself" into
"knows things."
---
generate_grammar_first as meaning +seed. Flag-gated. *Measure:* does grounded output contain the fact's content words?
fact. *Measure:* topicality / factual-word retention vs L3a.
zero confident-wrong answers on prompts with no fact.
of general questions.
--gen-probe)Add a grounded A/B: for prompts that DO have a truth-claim (start with the self-questions), print
ungrounded vs grounded output + whether the fact's key terms survived. Same honest, deterministic
harness we used to prove the salad fix.
The mechanism is a clean, contained code change and it will work — I can prove it on his
self-knowledge immediately. Broad correctness is a data problem (52 facts, all about himself).
So L3 is ~40% decoder wiring, ~60% growing the truth store. Anyone who tells you the decoder alone
makes him "know things" is selling hopium.