/** * Core memory management operations. * * Manages branch-specific CLAUDE.md files: * - save: Current CLAUDE.md -> .claude/memories/{branch}.md * - load: .claude/memories/{branch}.md -> CLAUDE.md * - list: Show all stored branch memories * - copy: Duplicate memory from one branch to another * - delete: Remove a branch's memory * - clean: Remove memories for branches that no longer exist * - restore: Restore from a backup */ import type { Config } from "./config.js"; export interface MemoryInfo { branch: string; fileName: string; filePath: string; size: number; lastModified: Date | null; isCurrent: boolean; } export interface SaveResult { branch: string; filePath: string; backedUp: boolean; } export interface LoadResult { branch: string; filePath: string; fallback: boolean; fallbackBranch?: string; } export declare class MemoryManager { private readonly repoRoot; private readonly config; constructor(repoRoot: string, config: Config); /** Absolute path to the memory storage directory */ get memoryDir(): string; /** Absolute path to the active CLAUDE.md file */ get memoryFilePath(): string; /** Absolute path to the backup directory */ get backupDir(): string; /** Get the storage path for a branch's memory file */ branchMemoryPath(branch: string): string; /** * Save the current CLAUDE.md to a branch-specific memory file. */ save(branch: string, description?: string): Promise; /** * Load a branch-specific memory file into CLAUDE.md. * Falls back to default branches if configured. */ load(branch: string): Promise; /** * List all stored branch memories with metadata. */ list(currentBranch?: string): Promise; /** * Copy memory from one branch to another. */ copy(sourceBranch: string, targetBranch: string): Promise; /** * Delete a branch's memory file. */ delete(branch: string): Promise; /** * Remove memories for branches that no longer exist locally. * Returns the list of cleaned branch names. */ clean(existingBranches: string[]): Promise; /** * List available backups for a branch. */ listBackups(branch?: string): Promise<{ branch: string; fileName: string; filePath: string; timestamp: string; }[]>; /** * Restore a branch's memory from the most recent backup. */ restore(branch: string): Promise; /** * Check if a branch has a saved memory. */ exists(branch: string): Promise; /** * Check if the active CLAUDE.md file exists and has content. */ hasActiveMemory(): Promise; /** * Prune old backups, keeping only the most recent N per branch. * Returns the number of backups removed. */ pruneBackups(keepPerBranch?: number): Promise; /** * Backup the current CLAUDE.md before overwriting it. */ private backupCurrentMemory; } /** * Strip the metadata comment header that we add when saving. * Only strips lines matching our specific markers, NOT arbitrary HTML comments. * This preserves any user HTML comments in their CLAUDE.md. */ export declare function stripMetadataHeader(content: string): string;