import type { Check } from '../types.js'; /** * issue #200: the "Entity relations extraction" canary (checks/entity- * relations.ts) reported GREEN for weeks while ~87% of memories were * receiving zero entities, because it only asked "do relation rows exist at * all" — a question the ~13% that DID work could always answer yes to. This * check asks the question that check never did: what FRACTION of memories * are actually getting linked, right now. * * Deliberately windowed on the most recent `RECENT_MEMORY_WINDOW` memories * (see that constant's doc comment for why COUNT-tail, not calendar-time), * NOT the all-time unlinked total `queryEntityLinkage` (dashboard.ts) * computes. The store has 11,032 historical unlinked memories the operator * has explicitly ruled out backfilling ("before it was mostly trash", * issue #200 correction comment) — an all-time rate would stay permanently * red on a perfectly healthy install and train the operator to ignore this * row exactly the way the old canary trained them to trust a green one. * The all-time count is still surfaced in the message (via * `queryEntityLinkage`) for context, but never gates ok/warn. * * Gated on the same MEANINGFUL_USAGE_THRESHOLD (20) floor every other * "built, wired, never invoked" canary in this file uses — a brand-new or * low-activity install legitimately has too few recent memories for a * percentage to mean anything and must not warn (ADR-015: "a rolling rate * crossing a floor is the signal, not any individual zero"). * * On WARN, reads `entity_link_drops` (migration 036, * src/storage/entity-link-log.ts) over the same window's time span as a * tie-breaker — mirrors `checkEntityRelations`'s use of * `relation_guard_drops`: drops > 0 means entities ARE being emitted and a * write is failing; drops == 0 too means the model itself is emitting * nothing for these atoms (issue #200's actual root cause — num_ctx * truncation + a dropped temperature option starving extraction of the * entities[] array entirely). */ export declare function checkEntityLinkRate(dataDir: string, encryptionEnabled: boolean): Check;