flashbacker
Version:
Claude Code state management with session continuity and AI personas
52 lines • 1.55 kB
TypeScript
/**
* Session information for compaction detection
*/
export interface SessionInfo {
sessionId: string;
messageCount: number;
tokenUsage: number;
timestamp: number;
}
/**
* Model context window configuration
*/
export interface ModelConfig {
model: string;
contextWindow: number;
warningThreshold: number;
emergencyThreshold: number;
}
/**
* AutoContextManager handles token monitoring and compaction detection
* Based on Cline's context management patterns but adapted for Claude Code session logs
*/
export declare class AutoContextManager {
private projectDir;
constructor(projectDir: string);
/**
* Get current token usage from session logs
* Parses JSONL files for exact token counts from API responses
*/
getCurrentTokenUsage(): Promise<number>;
/**
* Get current session information
* Extracts session ID, message count, and token usage
*/
getSessionInfo(): Promise<SessionInfo>;
/**
* Check if todo update should be triggered
* Based on 80% threshold or message count intervals
*/
shouldTriggerTodoUpdate(): Promise<boolean>;
/**
* Get model configuration from settings
* Helper method for threshold calculations
*/
private getModelConfig;
/**
* Direct Claude to appropriate template based on context state
* Detects post-compaction scenarios and triggers session restoration
*/
directClaudeToMaintenanceTemplate(): Promise<void>;
}
//# sourceMappingURL=auto-context-manager.d.ts.map