/** User override 2026-09-10: the policy's 12-month window is now 6 months. */ export declare const MEMORY_ROTATION_RETENTION_MONTHS = 6; export declare const MEMORY_ROTATION_ARCHIVED_DIRNAME = "archived"; /** Default reference-grep roots, relative to the project root. */ export declare const MEMORY_ROTATION_REFERENCE_ROOTS: readonly ["src", "skills"]; export type MemoryRotationTier = 'A' | 'B' | 'C' | 'D'; export type MemoryRotationAction = 'archive' | 'delete-candidate'; export interface MemoryRotationCandidate { name: string; filePath: string; tier: MemoryRotationTier; tierReason: string; action: MemoryRotationAction; reason: string; ageDays: number; ageBasis: 'frontmatter' | 'mtime'; } export interface MemoryRotationExcluded { name: string; filePath: string; tier: MemoryRotationTier; reason: string; } export interface MemoryRotationReport { apply: boolean; projectRoot: string; memoryDir: string; archivedDir: string; retentionMonths: number; referenceRoots: string[]; /** Every memory file on disk, bucketed by resolved tier. */ tierCounts: Record; /** Concrete actionable list: tier-C archives + tier-D delete-candidates. */ candidates: MemoryRotationCandidate[]; /** Paths actually moved into `archived/` (apply only). */ archived: string[]; /** Candidates dropped by a safety gate, each with the reason. */ excluded: MemoryRotationExcluded[]; /** True when `--apply` declined to act. */ refused: boolean; refusalReasons: string[]; /** Safety-gate failures that block `--apply` (e.g. unverifiable grep root). */ gateFailures: string[]; warnings: string[]; } export interface MemoryRotateOptions { projectRoot: string; apply?: boolean; /** Override the retention window (months). Defaults to 6. */ retentionMonths?: number; /** Override the reference-grep roots (tests). Defaults to `/src`, `/skills`. */ referenceRoots?: string[]; /** Injectable clock (tests). */ now?: Date; } /** * Read an explicit tier from raw frontmatter. Accepts nested * `metadata.tier:` and top-level `tier:`; first valid value wins. */ export declare function readExplicitTier(frontmatter: string): MemoryRotationTier | null; /** * Resolve the age of a memory. Prefers a frontmatter `updatedAt:` / * `updated:` / `modified:` ISO date; falls back to file mtime. Returns the * basis so the report can state which was used. */ export declare function resolveMemoryAge(frontmatter: string, filePath: string): { date: Date; basis: 'frontmatter' | 'mtime'; }; /** * Whether a memory is pinned in the generated `MEMORY.md` index. Pinning is * substring-based on the filename stem: the generated index links every * entry as `[](.md)`, so a stem hit means the entry is surfaced. */ export declare function isPinnedInMemoryIndex(memoryIndexText: string, stem: string): boolean; /** * Reference grep: does any file under the given roots mention the memory's * filename stem? Returns the matching absolute paths (sorted, deduped). * A missing root is NOT silently a pass — the caller turns that into a gate * failure so `--apply` refuses rather than archiving an unverified memory. */ export declare function findReferenceHits(stem: string, roots: readonly string[]): string[]; /** * Plan (and with `apply: true`, perform) a tier-driven rotation pass. * Always returns the full envelope; `apply` only controls whether tier-C * archives are moved. */ export declare function executeMemoryRotate(options: MemoryRotateOptions): MemoryRotationReport;