/** * memory_critique (KARPATHY_LAYERS Feature 3) — Verifier layer. * * The "second AI critic" Karpathy recommends, but grounded in *verified project * memory* rather than another model's opinions. Given a summary of what an agent * did (and the files it touched), it surfaces: * - guardrail violations (kind=GUARDRAIL, level never/ask-first) * - confirmations (memory the work is consistent with) * - contradictions (in-scope rules the summary doesn't appear to honor) * - missing coverage (changed files with no memory → ask the user) * * Matching is heuristic (keyword overlap + scope) layered on real retrieval — * deliberately conservative: it raises questions, the agent decides. */ import type { MemoryStore } from "../db/store.js"; import type { GuardrailLevel, MemoryEntry } from "../types.js"; export interface CritiqueInput { summary: string; filesChanged: string[]; } export interface CritiqueResult { guardrailsViolated: Array<{ memory: MemoryEntry; level: GuardrailLevel; concern: string; }>; contradictions: Array<{ memory: MemoryEntry; concern: string; }>; confirmations: Array<{ memory: MemoryEntry; }>; missingCoverage: string[]; } /** * Critique a unit of work against project memory. Async because it folds in * semantic recall when embeddings are configured (degrades to keyword-only). */ export declare function critique(store: MemoryStore, input: CritiqueInput): Promise;