-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Problem
Session mirror logs grow unbounded and accumulate noise, especially from early versions before the cursor-tracking ANSI parser was implemented.
Current state:
- 111,423 lines across 10 session mirror files
- Largest single session: 49,607 lines (1.5MB)
- Current session: 10,518 lines (550KB)
- Much of the older content is garbage — raw ANSI artifacts, spinner frames, duplicated lines from before
mirror_strip_ansi()was implemented
The session mirror tab (tail -f) becomes slow and hard to navigate in long sessions. The log files on disk accumulate without cleanup.
Proposed Solutions
1. Log Rotation (Within a Session)
- Cap mirror log at N lines (e.g., 5,000) or N MB (e.g., 2MB)
- When the cap is hit, rotate: rename current to
session-{ts}.1.log, start fresh - Or truncate the top (oldest content) and keep the bottom (most recent)
tail -fhandles rotation gracefully withtail -F(follows file name, not inode)
2. Session Startup Cleanup
- On launch, archive or delete session mirror logs older than N days
- Or compress old logs (
gzip) - Add a
--keep-days <N>flag (default: 7)
3. Smarter Filtering (Reduce Volume)
- The cursor-tracking parser already filters a lot, but long sessions still produce thousands of lines
- Consider rate-limiting mirror writes (e.g., flush every 500ms instead of every PTY read)
- Deduplicate more aggressively — current dedup window is 32 lines, could be larger
- Skip writing during heavy TUI repaints (detect rapid cursor-home sequences)
4. Summary Mode
- Instead of raw transcript, periodically write a summary line:
[09:15:23] Working on: updating CLAUDE.md files (5 tool calls in last 2 min) - Would require tracking tool call patterns, but dramatically reduces volume
Immediate Quick Win
Delete/archive the pre-parser garbage logs. Everything before the cursor-tracking parser was added is mostly unreadable noise.
Acceptance Criteria
- Session mirrors stay under a reasonable size (configurable)
- Old logs are cleaned up automatically
-
tail -fremains responsive in long sessions - No data loss for recent session content
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels