Search Evidence Classifier (search/evidence.ts)

gbrain · src/core/search/evidence.ts · typescript · MIT
ai, search, tag:evidence, tag:classification, tag:matching, tag:safety

Classifies and stamps search results with evidence metadata explaining match strength and duplication safety. Reuse when building search systems requiring explainable matching and duplicate prevention.

// Source: https://github.com/garrytan/gbrain | License: MIT | Copyright 2026 Garry Tan
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * T4 — evidence + create_safety contract (retrieval-maxpool incident).
 *
 * The incident's ROOT behavior: the agent read a single blended score (0.64)
 * and decided "no strong match, safe to write a new page" — then wrote a
 * duplicate on top of a fully-developed concept page. A blended RRF/cosine
 * score is not a calibrated probability (Codex#5), so keying the
 * don't-duplicate decision off a raw threshold is fragile.
 *
 * The fix (Codex#6): tell the agent WHY a result matched, not just a number.
 * `evidence` names the strongest signal that surfaced the page; `create_safety`
 * is the derived "is this page already here?" hint 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key