/** * Durability gate (FEAT-441) — single choke point for classifying * low-signal atom text before it is persisted at the distill store-write * site (`src/distill/stages/08-embed-index.ts`, immediately after the * ADR-006 erasure-replay filter, `memRepo.insertWithCreateEvent` call). * * AC-6: this is the ONLY module that owns the pattern-matching taxonomy — * no copy-pasted regex list may exist anywhere else (including the * `/remember` route, which bypasses this gate entirely by construction — * see `src/server/routes/search.ts:202` — not by re-implementing it). * * Taxonomy (fixed enum, matches FEAT-441's Requested-capability #1): * - ephemeral_state: "X is green/passing/running/present" — true only * at the instant it was written, stale the moment * CI re-runs. * - git_derivable: commit SHAs, "N files changed", branch/merge * status — already reconstructible from `git log`, * adds no signal a memory atom should carry. * - vacuous_negative: "no X identified/found" — records the absence of * a search, not a fact about the system. * - bare_todo: a short imperative command/todo with no why/how * ("Run memory test") — the *task* is ephemeral, * only the *reason* would be durable. * - path_fragment: a bare filesystem/transcript path with no * proposition attached (e.g. "src/foo.ts:84"). * * `ephemeral_state`, `git_derivable`, and `vacuous_negative` only fire on a * SHORT atom (<= SHORT_ATOM_MAX_WORDS) with no rationale marker attached — * the same protection `bare_todo` always had. A long, rationale-bearing atom * that merely mentions a commit SHA or a status word in passing (e.g. a * postmortem root-cause note) persists (2026-07-09 review HIGH fix). * * The rationale-marker check (`hasRationaleMarker`) requires the marker to * be in genuine causal proximity to the statement, not merely present * anywhere in the atom (FEAT-448, closing the FF-1 re-review gap): a * temporal "since" ("since 3pm"), a CLI flag's literal "--" ("--verbose"), * and a "because"/"reason" glued onto a contentless clause ("because * deploy", "because reasons") no longer count as an exemption. * * `classifyDurability` is the pure taxonomy check — always evaluates the * full pattern set regardless of gate mode. `gateDurability` applies the * `strict|lenient|off` mode on top of it: * - off: never gates (classifyDurability is not even called) — the * shipped default (AC-2: byte-identical to pre-FEAT-441). * - strict: gates on any of the 5 reasons. * - lenient: gates 4 of the 5 reasons (ephemeral_state, vacuous_negative, * path_fragment, bare_todo). git_derivable alone is held back * because a terse-but-durable decision or a rationale-bearing * command referencing a commit SHA is more plausible than a * terse-but-durable "is green" assertion (PM pre-mortem Q1, * 20260709T095000Z-pm-review-feat-441-deep-triage.md). * * RECALL-S2 (2026-07-13) moved `bare_todo` OUT of the lenient holdback and * into the always-gated set. Recorded decision (RECALL-S2 brief's "decide * deliberately" requirement): the live store's dominant junk class is * task-echo imperatives ("Configure X", "Approve production deployment.", * "$ bun run test") filed across command/todo/decision/event types alike — * holding bare_todo back from the *recommended* lenient mode left the * single biggest junk category ungated by default. A type-aware carve-out * for `command`-typed atoms (threading `mem.type` into `gateDurability`) * was considered and REJECTED: the evidence set's own "must die" examples * ("Rebuild", "$ bun run test") are themselves plausible `command`-typed * atoms, so a blanket type exemption would save exactly the junk it's * meant to catch. The genuine reusable command that must survive ("Run * tests with `bunx tsc --noEmit` for both tsconfig.json and * tsconfig.test.json") already does — not via its type, but because it is * content-rich enough to clear `BARE_TODO_MAX_WORDS` (11 words > the * 10-word cap) — the same content-based guard that protects every other * reason. `git_derivable` keeps its holdback unchanged: no counterexample * in the evidence set required moving it, and a terse commit reference is * still plausibly meaningful shorthand in a way a bare imperative rarely * is. */ export type GatedReason = 'ephemeral_state' | 'git_derivable' | 'vacuous_negative' | 'bare_todo' | 'path_fragment'; export type DurabilityGateMode = 'strict' | 'lenient' | 'off'; /** * Classify a single atom's text against the fixed 5-reason taxonomy. * Returns `null` when none of the low-durability patterns match (the atom * is durable and should persist). Order is fixed and deliberate — checked * most-specific-shape-first (path fragments have no whitespace at all) so * an atom can only ever match one reason. */ export declare function classifyDurability(text: string): GatedReason | null; /** * Apply a `distill.durabilityGate` mode on top of `classifyDurability`. * `off` short-circuits without even running the classifier — the * byte-identical-to-today guarantee (AC-2) holds regardless of pattern * tuning, since this is the single call site every mode funnels through. */ export declare function gateDurability(text: string, mode: DurabilityGateMode): GatedReason | null;