Conversation
The 60-second status bar poll (readAllUsage) and the burn-rate prediction (readRecentCosts) read and parsed every session file under ~/.claude/projects/ on each pass, including months-old history that cannot affect any aggregation window. - findAllJsonlFiles() now takes an optional mtime cutoff (epoch ms); session files are append-only, so a file not modified since T cannot contain entries with timestamps after T - readAllUsage skips files untouched for over 7 days (+1h margin) - readRecentCosts skips files untouched for over its 30-min window (+60s margin) - wasJsonlUpdatedRecently rewritten on top of the same filter - Unit tests for the filter (temp HOME with fresh + backdated files) - docs/DATA.md: new mtime-based file skipping section Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ZLCLQeudf1LQBnBSyyr4f
This was referenced Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The 60-second status bar poll (
readAllUsage) and the burn-rate prediction (readRecentCosts) read and parsed every session file under~/.claude/projects/on each pass — including months-old history that cannot affect any aggregation window. On installations with a long Claude Code history this is the dominant cost of the poll loop.Approach
findAllJsonlFiles()gains an optionalnewerThanMscutoff that skips files whosemtimeis older. This is safe for time-windowed aggregation because session JSONL files are append-only: a file not modified since time T cannot contain entries with timestamps after T. Every cutoff keeps a safety margin.readAllUsage(60s poll, widest window 7d)now − 7d − 1hreadRecentCosts(burn rate, 30-min window)window start − 60swasJsonlUpdatedRecentlyThe heatmap already had an equivalent mtime filter (0.4.x); this brings the remaining readers in line.
Tests / Docs
HOMEwith a fresh file and a 10-day-backdated file (fs.utimes), asserting unfiltered vs. filtered results andwasJsonlUpdatedRecentlybehaviour.docs/DATA.md: "mtime-Based File Skipping" section with the caller/cutoff table and the always-keep-a-margin rule.CHANGELOG.md: Unreleased → Performance entry.npm run lint✅,npm run compile✅, unit suites (37 tests) ✅ via mocha. The@vscode/test-electronrunner cannot download VS Code in this sandbox; please rely on CI for the extension-host suites.🤖 Generated with Claude Code
https://claude.ai/code/session_012ZLCLQeudf1LQBnBSyyr4f
Generated by Claude Code