/** * The working-tree census (FR-12/FR-13, Story 4.3): a bounded, deterministic * fingerprint of everything under a search root, shared by the capture flush * (records it) and the search-ledger query (re-derives and compares it). * * The census is the negative cache's ENTIRE evidence (AD-6). A byte-identical * tree provably still returns zero for the recorded search — dirty-vs-clean is * irrelevant because the census reads the same working tree the search read, * and `head_oid` is deliberately never part of it (a rebase over an identical * tree changes head and nothing else). `mtime` is never consulted anywhere * here: it is the exact proxy AD-6 forbids. * * Determinism: entries are ordered by their forward-slashed relative path * (UTF-16 code-unit order — any total order works as long as it is stable on * the same machine over time; this one needs no locale and no case folding, * and folding would merge distinct files on case-sensitive filesystems). Each * entry contributes `relpath NUL kind:payload NUL size`, and entries join * with a double NUL. NUL (written as the six-character escape in this source, * per the repo's control-byte rule) is the one byte a path cannot contain, so * a hostile filename — including one carrying newlines or the literal text * "file:" — cannot forge another entry or shift a boundary. * * Exclusions are exactly two, and both are principled rather than tuned: * `.git` (object churn describes history, not the searched tree) and any * basename beginning `.cortex.` — Cortex must not observe its own exhaust: * the spool grows on every tool call and would invalidate every census one * turn after it was taken. Both sets are gitignored in practice, so the * search tool (ripgrep-backed, ignore-respecting) never saw them either. * Everything else — including gitignored build output — is INCLUDED: * over-strict invalidation costs a re-search; under-strict invalidation is * SM-C3. */ export declare const CENSUS_DEFAULT_MAX_FILES = 2000; export declare const CENSUS_DEFAULT_MAX_BYTES: number; /** * `Number`, never `parseInt`: `parseInt('2e6')` is 2, which would turn a * ceiling into a near-zero one (the third repo occurrence of this rule). * Anything non-integral, non-positive, or non-numeric falls back. */ export declare function resolveEnvCeiling(name: string, fallback: number): number; export declare function resolveCensusMaxFiles(): number; export declare function resolveCensusMaxBytes(): number; export interface CensusLimits { maxFiles: number; maxBytes: number; } export type RootCensus = { status: 'ok'; sha256: string; files: number; bytes: number; /** * Cortex runtime files skipped by `isExcludedBasename`, scope-relative. * * The exclusion is only sound if the SEARCH skipped them too, and the * review round disproved the assumption it shipped on: measured against * the real Grep tool, a token inside `.cortex.spool.jsonl` **is found** * in any repository whose ignore file has not been swept — which is * every fresh project, because hooks arrive machine-wide while the * ignore entries are written per-repo. So the caller must verify these * are genuinely unsearchable before asserting anything; an empty list * (every search rooted below the project root) needs no check at all. * `.git` is NOT reported: its contents were measured unsearchable. */ excludedCortex: string[]; } /** The root does not exist (or is not a file/directory) — a *provable* state. */ | { status: 'missing'; } /** The walk exceeded the limits before completing. */ | { status: 'overflow'; } /** Something under the root could not be fingerprinted (permissions, a * special file type, an entry that vanished mid-walk). Never an assertion * in either direction. */ | { status: 'unreadable'; }; /** * Fingerprint the tree under `absRoot`. A root that is a plain FILE is a * one-entry census — Claude Code's Grep accepts file targets, and a search * scoped to one file is the cheapest, most cacheable kind. */ export declare function computeRootCensus(absRoot: string, limits?: Partial): RootCensus; //# sourceMappingURL=census.d.ts.map