/** Max bytes (UTF-8) for INDEX.md to inject into system prompt (CC uses 25KB, we use 12KB). */
export declare const INDEX_MAX_CHARS = 12288;
/** Max lines for INDEX.md injection. */
export declare const INDEX_MAX_LINES = 200;
/** Max chars for a single topic file. */
export declare const TOPIC_FILE_MAX_CHARS = 8192;
/** Root directory: <project>/.qlogicagent/memory/ */
export declare function getMemdirPath(projectRoot: string): string;
/** Full path to INDEX.md */
export declare function getIndexPath(projectRoot: string): string;
export interface MemdirFileInfo {
    name: string;
    /** Size in bytes */
    size: number;
    /** Last modified ISO timestamp */
    modifiedAt: string;
    /** First non-empty line (preview) */
    preview?: string;
}
export interface MemdirResult {
    ok: boolean;
    message: string;
    /** File path relative to memdir */
    file?: string;
    /** Current INDEX.md char usage */
    indexUsage?: string;
}
export declare function isMemoryContentSafe(text: string): boolean;
export declare class Memdir {
    private readonly root;
    private indexCache;
    constructor(projectRoot: string);
    /** Get the root directory path of this MEMDIR. */
    getRootPath(): string;
    /** Ensure memdir exists with a default INDEX.md if missing. */
    ensureInitialized(): void;
    /**
     * Get INDEX.md content for system prompt injection.
     * Truncated to INDEX_MAX_CHARS / INDEX_MAX_LINES.
     */
    getIndexForPrompt(): string;
    /** Get raw INDEX.md content (untruncated). */
    getIndexRaw(): string;
    /** Get INDEX.md usage stats. */
    getIndexUsage(): {
        chars: number;
        lines: number;
        percent: number;
    };
    /** Append a line/entry to INDEX.md. */
    addToIndex(content: string): Promise<MemdirResult>;
    /**
     * Auto-compact INDEX.md by removing oldest non-structural entries to make room.
     * Returns the compacted content with the new entry appended, or null if impossible.
     *
     * Entry-aware: removes complete logical entries (a non-indented line plus its
     * continuation lines that start with whitespace/'-') to avoid half-entries.
     */
    private autoCompactIndex;
    /** Replace text in INDEX.md (str_replace semantics). */
    replaceInIndex(oldText: string, newText: string): Promise<MemdirResult>;
    /** Remove text from INDEX.md. */
    removeFromIndex(oldText: string): Promise<MemdirResult>;
    /** List all memory files (excluding INDEX.md). */
    listFiles(): Promise<MemdirFileInfo[]>;
    /** Create a new topic file. Fails if it already exists. */
    createFile(name: string, content: string): Promise<MemdirResult>;
    /** Write/overwrite a topic file. Auto-splits if content > 8KB. */
    writeFile(name: string, content: string): Promise<MemdirResult>;
    /**
     * Auto-split: write oversized content into numbered part files.
     * e.g. "lesson-docker.md" → "lesson-docker-1.md", "lesson-docker-2.md"
     */
    private writeFileSplit;
    /** Read a topic file. */
    readFile(name: string): Promise<{
        ok: boolean;
        content?: string;
        message: string;
    }>;
    /** Delete a topic file. INDEX.md cannot be deleted. */
    deleteFile(name: string): Promise<MemdirResult>;
    /** Search all memory files for keyword matches. Returns matching snippets. */
    searchLocal(query: string): Promise<Array<{
        file: string;
        snippet: string;
        score: number;
    }>>;
    private writeIndex;
    private writeIndexUnlocked;
    private ensureDir;
    /** Append an entry to the file listing section of INDEX.md (idempotent). */
    private appendIndexEntry;
}
