create-ai-chat-context-experimental
Version:
Phase 2: TypeScript rewrite - AI Chat Context & Memory System with conversation extraction and AICF format support (powered by aicf-core v2.1.0).
90 lines • 2.68 kB
TypeScript
/**
* This file is part of create-ai-chat-context-experimental.
* Licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later).
* See LICENSE file for details.
*/
import type { Result } from '../types/result.js';
export interface DropoffStats {
sessionFiles: number;
mediumFiles: number;
oldFiles: number;
archiveFiles: number;
movedToMedium: number;
movedToOld: number;
movedToArchive: number;
compressed: number;
timestamp: string;
}
export interface SessionAge {
filePath: string;
fileName: string;
sessionDate: string;
date: Date;
ageInDays: number;
currentFolder: 'sessions' | 'medium' | 'old' | 'archive';
targetFolder: 'sessions' | 'medium' | 'old' | 'archive' | null;
}
export declare class MemoryDropoffAgent {
private aicfDir;
private sessionsDir;
private mediumDir;
private oldDir;
private archiveDir;
private aicfWriter;
constructor(cwd?: string);
/**
* Run dropoff process: analyze ages, move files, compress content
*/
dropoff(): Promise<Result<DropoffStats>>;
/**
* Analyze all session files across all folders
*/
private analyzeAllSessions;
/**
* Analyze a single session file and determine its age and target folder
*/
private analyzeFile;
/**
* Move session file and compress content based on target folder
* NOW USES aicf-core FOR ENTERPRISE-GRADE WRITES:
* - Thread-safe file locking (prevents corruption)
* - Atomic writes (all-or-nothing)
* - Input validation (schema-based)
* - PII redaction (if enabled)
* - Error recovery (corrupted file detection)
*/
private moveAndCompress;
/**
* Compress to SUMMARY format (2-7 days)
* Keep: Only conversations with explicit decisions or actions
* Remove: Conversations with "No explicit decisions" and "No explicit actions"
*/
private compressToSummary;
/**
* Compress to KEY POINTS format (7-14 days)
* Keep: Only DECISIONS and ACTIONS columns, remove TITLE and SUMMARY
*/
private compressToKeyPoints;
/**
* Compress to SINGLE LINE format (14+ days)
* Keep: Only one line per conversation with timestamp and summary
*/
private compressToSingleLine;
/**
* Get folder path by name
*/
private getFolderPath;
/**
* Get all .aicf files in a directory
*/
private getAicfFiles;
/**
* Count files in a directory
*/
private countFiles;
/**
* Ensure all directories exist
*/
private ensureDirectories;
}
//# sourceMappingURL=MemoryDropoffAgent.d.ts.map