export declare const ENTRY_DELIMITER = "\n\u00A7\n"; export type MemoryTarget = 'memory' | 'user'; export type MemoryStoreOptions = { /** Directory where MEMORY.md and USER.md live. */ dir: string; /** Char limit for MEMORY.md. Default 2200. */ memoryCharLimit?: number; /** Char limit for USER.md. Default 1375. */ userCharLimit?: number; }; export type MemorySuccessResult = { success: true; target: MemoryTarget; entries: string[]; usage: string; entryCount: number; message?: string; }; export type MemoryDriftError = { success: false; error: string; driftBackup: string; remediation: string; }; export type MemoryErrorResult = { success: false; error: string; matches?: string[]; currentEntries?: string[]; usage?: string; }; export type MemoryResult = MemorySuccessResult | MemoryDriftError | MemoryErrorResult; /** * Bounded curated memory with file persistence. * * Two parallel states: * - `_systemPromptSnapshot`: a sanitized prompt snapshot rebuilt explicitly * by `loadFromDisk()`. * - `memoryEntries` / `userEntries`: live state, refreshed by `read()`, * mutated by tool calls, and persisted to disk. */ export declare class MemoryStore { readonly dir: string; readonly memoryCharLimit: number; readonly userCharLimit: number; private memoryEntries; private userEntries; private systemPromptSnapshot; private loaded; constructor(opts: MemoryStoreOptions); /** * Load entries from MEMORY.md and USER.md, capture system prompt snapshot. * * Each entry is scanned for injection / promptware patterns at strict * scope; ANY match replaces the entry text in the snapshot with a * `[BLOCKED: …]` placeholder so a poisoned-on-disk file (supply chain, * compromised tool, sister-session write) cannot enter the system * prompt. Live state keeps the original so the user can inspect and * remove via `memory_read` / `memory_remove`. */ loadFromDisk(): Promise; /** Return frozen snapshot for system prompt injection. Empty string if no entries. */ formatForSystemPrompt(target: MemoryTarget): string; /** Combined memory + user snapshot block, with a blank line between them. */ formatAllForSystemPrompt(): string; /** Live entries, not the frozen snapshot. */ getEntries(target: MemoryTarget): string[]; add(target: MemoryTarget, content: string): Promise; replace(target: MemoryTarget, oldText: string, newContent: string): Promise; remove(target: MemoryTarget, oldText: string): Promise; read(target: MemoryTarget): Promise; private pathFor; private entriesFor; private setEntries; private charLimit; private charCount; private successResponse; private refreshLiveEntries; private rebuildSystemPromptSnapshot; private renderBlock; private saveToDisk; /** * Re-read entries from disk. Returns backup-path string when external * drift was detected (the on-disk file contains content that wouldn't * round-trip through the parser/serializer, OR an entry larger than the * store's char limit). Caller must abort the mutation when drift is * detected — flushing would discard the un-roundtrippable content. */ private reloadTarget; private detectExternalDrift; private withFileLock; } //# sourceMappingURL=store.d.ts.map