/** * Thought quality — structural acceptance gate for model-generated cognition. * * Dream phases (refine, abstract) previously rejected LLM output via string * blocklists alone ("foreign thought markers"). Blocklists are brittle: they * encode one model's failure vocabulary and say nothing about whether the * thought is grounded in the evidence it claims to derive from. * * This module makes the quality decision structural: * * 1. Form checks — length bounds, sentence completeness, markdown leakage. * 2. Grounding — the fraction of the thought's content words that appear in * the evidence it was generated from. Generic LLM filler ("holistic * approach", "paradigm") shares almost no vocabulary with real evidence, * so it scores near zero regardless of which model produced it. * 3. Generic-phrase markers — retained as a *weak* signal (they were derived * empirically from real contamination incidents), but a single marker hit * no longer vetoes a thought that is otherwise well-grounded. * * Pure and synchronous: no providers, no I/O — trivially unit-testable. */ /** * Phrases characteristic of ungrounded LLM filler. Derived empirically from * dream-contamination incidents (Gemini + Ollama 14B, 2026-04-02). Weak * evidence individually — used in combination with grounding, never alone. */ export declare const GENERIC_PHRASE_MARKERS: readonly string[]; export interface ThoughtQualityOptions { /** * Texts the thought is supposed to be derived from (current definition, * observations, source concepts). When provided, grounding is enforced. */ evidence?: string[]; /** * Minimum fraction of the thought's content keywords that must appear in * the evidence (default 0.25). Lower this for deliberately abstractive * output (cross-domain synthesis legitimately introduces new vocabulary). */ minGrounding?: number; /** Require terminal sentence punctuation (default true) — rejects truncation. */ requireSentenceEnd?: boolean; /** Minimum character length (default 20). */ minLength?: number; /** Maximum character length (default 2000). */ maxLength?: number; } export interface ThoughtQualityResult { /** True when the thought passes all structural checks. */ ok: boolean; /** * Fraction of the thought's content keywords found in the evidence, * or null when no evidence was provided. */ grounding: number | null; /** Generic-phrase markers found in the thought (lowercased). */ generic_hits: string[]; /** Human-readable reasons for rejection (empty when ok). */ reasons: string[]; } /** * Keyword-overlap grounding: what fraction of the thought's content words * appear anywhere in the evidence? Returns 1 for an empty keyword set * (nothing to contradict grounding). */ export declare function groundingScore(text: string, evidence: string[]): number; /** * Assess whether model-generated text is acceptable as a stored thought. * * Decision rule: * - Form failures (empty, truncated, markdown-formatted, out of bounds) reject. * - Two or more generic-phrase markers reject. * - With evidence: grounding below `minGrounding` rejects, and a single * generic marker rejects when grounding is only marginal * (< minGrounding + 0.15). * - Without evidence: a single generic marker rejects (blocklist behavior is * retained where grounding cannot arbitrate). */ export declare function assessThought(text: string, options?: ThoughtQualityOptions): ThoughtQualityResult; //# sourceMappingURL=thought-quality.d.ts.map