Repository navigation
token-bar 0.3.0: a fast status, and warnings for desktop users - #9
Merged
Merged
Conversation
…3.0)
On a busy machine every run re-read and re-parsed the whole last week of
session logs: 1.84 GB, about 21 seconds for /token-bar:token. Now lines
that can't hold usage are skipped before parsing, and the scan remembers
how far it got in each log file (logs only grow at the end) so later runs
read only what was added: about 0.1 seconds, with the first run about 9.
Checked against the original scan on real logs: identical requests and
tokens. A last line still being written waits for next time, a file that
got shorter is read again, and a damaged or too-short cache is ignored.
The 80% and 90% heads-up used live numbers only, so the desktop app never
got it. It now uses the synced estimate when there are no fresh live
numbers, says so ('around 82% (estimate)'), and never warns from a
calibration that was not synced. The hook also notes when it runs, and a
new hook-check command says when, so we can tell whether hooks fire in the
desktop app. Tests, README and skill updated, version 0.3.0.
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's new
/token-bar:tokenis fast. On a busy machine every run re-read and re-parsed the whole last week of session logs. On a real 6 GB~/.claude/projectsfolder (1.84 GB, 209 files modified in the last 7 days) that took about 21 seconds.~/.claude/token-bar/scan_cache.json. Logs only grow at the end, so later runs read only what was added.Heads-up warnings for desktop users. The 80% / 90% warning used live numbers only, so the desktop app never got it. It now uses the synced estimate when there are no fresh live numbers, and says so ("Weekly usage is around 82% (estimate)"). It never warns from a calibration that was not synced, because a false alarm is worse than none. Live numbers still win when fresh. About 0.12 s per message on real data.
hook-check. The hook notes when it runs, andtoken_bar.py hook-checksays when, so we can tell whether hooks fire in the desktop app. This is not yet confirmed.Checks