/** * Transcript Scanner — Inventory and age-classification of Claude session transcripts. * * Implements the hot/warm/cold three-tier model from memory-architecture-spec.md §6: * - HOT (0–24h): Full JSONL retained; agents can re-read * - WARM (1–7d): Pending extraction; scheduled at session end * - COLD (>7d): brain.db entries only; raw JSONL deleted (tombstone in brain_obs) * * Storage layout scanned (§6.2): * ``` * ~/.claude/projects/ * / * .jsonl ← root-level main session transcript * / ← session UUID directory * subagents/ * agent-.jsonl ← subagent transcript * agent-.meta.json * tool-results/ * .json * ``` * * @see docs/specs/memory-architecture-spec.md §6.1–6.2 * @task T728 * @epic T726 */ /** Hot/warm/cold lifecycle tier for a transcript session. */ export type TranscriptTier = 'hot' | 'warm' | 'cold'; /** * Metadata for a single session transcript discovered on disk. */ export interface SessionInfo { /** Absolute path to the root session JSONL file. */ jsonlPath: string; /** Project slug (directory name under `~/.claude/projects/`). */ projectSlug: string; /** Session UUID extracted from the JSONL filename. */ sessionId: string; /** Last modified time of the JSONL file (ms since epoch). */ mtimeMs: number; /** Age of the session in milliseconds. */ ageMs: number; /** Lifecycle tier. */ tier: TranscriptTier; /** Size in bytes of the root JSONL file. */ bytes: number; /** * Absolute path to the session UUID directory (if it exists). * Contains `subagents/` and `tool-results/` subdirs. */ sessionDir: string | null; /** Size in bytes of the session UUID directory (including subagents). */ sessionDirBytes: number; } /** * Aggregate scan result: session inventory with tier-based grouping. */ export interface TranscriptScanResult { /** Total number of sessions found. */ totalSessions: number; /** HOT tier sessions (< 24h). */ hot: SessionInfo[]; /** WARM tier sessions (24h–7d). */ warm: SessionInfo[]; /** Total size of all discovered transcripts in bytes. */ totalBytes: number; /** Absolute path to `~/.claude/projects/`. */ projectsDir: string; } /** * Result of a transcript prune operation. */ export interface TranscriptPruneResult { /** Number of sessions pruned. */ pruned: number; /** Bytes freed. */ bytesFreed: number; /** Paths that were deleted (or would be deleted in dry-run). */ deletedPaths: string[]; /** Whether this was a dry-run (no filesystem mutations). */ dryRun: boolean; } /** * Classify a session age into a transcript tier. * * @param ageMs - Session age in milliseconds * @returns Lifecycle tier */ export declare function classifyTranscriptTier(ageMs: number): TranscriptTier; /** * Scan `~/.claude/projects/` and return a structured inventory of all * session transcripts, classified by hot/warm/cold tier. * * Does not modify any files. Safe to call at any time. * * @param projectsDir - Override the default `~/.claude/projects/` path (for testing) * @returns Transcript scan result with tier-classified session list */ export declare function scanTranscripts(projectsDir?: string): Promise; /** * Prune session transcripts older than `olderThanMs` milliseconds. * * Dry-run by default: pass `confirm: true` to perform actual deletion. * * Circuit breakers (from memory-architecture-spec.md §6.4): * - If `ANTHROPIC_API_KEY` is absent, only delete sessions older than 30d * (raw preservation fallback — skip extraction). * * @param opts - Prune options * @param opts.olderThanMs - Delete sessions older than this many milliseconds * @param opts.confirm - If true, perform actual deletion; dry-run if false * @param opts.projectsDir - Override `~/.claude/projects/` (for testing) * @returns Prune result with count, bytes freed, and deleted paths */ export declare function pruneTranscripts(opts: { olderThanMs: number; confirm: boolean; projectsDir?: string; }): Promise; /** * Parse a human-readable duration string into milliseconds. * * Supported formats: `7d`, `24h`, `30m`, `1d`, `14d`, `168h`, etc. * Used by `cleo transcript prune --older-than `. * * @param duration - Duration string (e.g. `"7d"`, `"24h"`, `"30m"`) * @returns Duration in milliseconds * @throws Error if the format is not recognized */ export declare function parseDurationMs(duration: string): number; //# sourceMappingURL=transcript.d.ts.map