import type { Check } from '../types.js'; /** * WARNs when the ADR-010 usefulness feedback loop has demonstrably NEVER * received a POSITIVE signal despite meaningful daemon activity — the bug * found live in production 2026-07-12: GET /profile returned 30 entries, * every single one pinned at the Laplace prior 0.5 (0 recall_used events, * ever). The mechanism itself is sound (see tests/e2e/usefulness-feedback- * loop.e2e.test.ts — submit_feedback/mark_memory_used, invalidate_memory/ * supersede_memory, and usefulnessScores() all work correctly when actually * invoked); this check exists because CI cannot catch "wired but nobody * calls it" — only live usage data can, and only doctor sees live usage data. * * issue #190 (2026-07-13): the ORIGINAL version of this check treated * `usedDistinct > 0 || correctedDistinct > 0` as "the loop is alive" — which * a live daemon satisfied with `(0 used, 854 corrected)` and reported GREEN. * Every one of those 854 corrections turned out to be consolidate.ts's own * auto-merge superseding its own near-duplicates (`correctionSource: * 'consolidation_auto'`, see memory-events.ts) — the system deduplicating * itself, not a human or agent saying "this was wrong". A loop that can only * ever demote (corrected keeps incrementing) and never promote (used stays * frozen at 0) is a one-way punishment term wearing a learning label, and the * canary that exists specifically to catch "built, wired, never invoked" was * itself fooled by exactly that pattern. Fix: `hasPositiveSignal` below is * `usedDistinct > 0` ALONE — corrections, of any source, never count as * evidence the loop is alive. correctedDistinct is still surfaced (split by * source) for visibility, but no longer gates ok/warn. * * Reads ALL-TIME totals (feedbackLoopSummary — no sinceMs window), because * "has this ever happened even once" is a different question than "what's * the 7d rate" (that's checkUsefulness, which stays purely informational). * Gated on the same MEANINGFUL_USAGE_THRESHOLD (20) floor checkAutoCapture * uses, applied to BOTH active memory count AND distinct atoms actually * served from a recall/search surface — a brand-new install, or one whose * owner has never recalled anything yet, legitimately has zero feedback and * must not warn. * * Uses buildMemoryHealthCheap() (not ...Full()) — this check only ever reads * report.activeCount, and the cheap tier already returns that via an * index-backed COUNT(*) (countActiveAndArchived). The full tier's extra * byType/byScope group-bys and staleness distribution are O(N) scans this * check never uses; checkMemoryHealth already pays that cost once per doctor * run for its own reporting, so calling ...Full() here would be a second, * redundant full-tier computation for one integer. */ export declare function checkUsefulnessFeedbackLoop(dataDir: string, encryptionEnabled: boolean): Check;