Repository navigation
CLI: skip log files untouched since before the period - #3
Merged
Merged
Conversation
A one-day report read every Claude Code and Codex log on the machine and then dropped the old entries. A file last written before the period cannot hold an entry from it, so those files are no longer opened. On a Mac with about 7,400 log files, `tokenly 1 --by provider --json` went from 75 s to 8 s with the same totals.
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.
What changes
tokenly <days>read every Claude Code and Codex log file and only then dropped entries older than the period. A file last written before the period cannot hold an entry from it, soscan_claudeandscan_codexnow skip those files by modification time.On a Mac with about 7,400 log files,
tokenly 1 --by provider --jsonwent from 75 s to 8 s. The Anthropic totals of the two runs were identical; the OpenAI totals differed by the usage that live Codex sessions added during the slower run.Why now
Node Monitor's probe can run this command every five minutes to report a machine's last 24 hours of AI usage. At 75 s a run that was too heavy to repeat.
Limits
rsync -t) is skipped for short periods even if it holds recent entries.--quotais unchanged and still reads every Codex log.Checks