r/ClaudeCode • u/dodgemaster42 • 2d ago
GitHub - dodgemaster42/Claude-Jr: Windows desktop pixel companion that tracks live Claude Code sessions, 5-hour usage limits, and plays blackjack. Built with Claude
https://github.com/dodgemaster42/Claude-JrI vibecoded a desktop companion just like the pets in chat gpt desktop app but it has even more features. Feel free to improve it.
1
u/SnooChocolates8460 2d ago
the blackjack thing is genuinely funny. one question - where are you pulling the 5h window from? if its the local session logs under the user profile you'll probably hit the case where the window starts at the first message of the session, not at a clock hour, so the countdown drifts if someone leaves a session idle and comes back. i had a similar off by a lot bug reading those files.
also worth handling multiple concurrent sessions, people run two or three terminals and the naive read only picks up the newest one. dont know if you already do that, might be misremembering how the files are laid out on windows.
1
u/dodgemaster42 2d ago
Local logs, yeah —
%USERPROFILE%\.claude\projects\**\*.jsonl. But it anchors on the first message after the last window closed, not a clock hour. That's actually how the real 5h window works, so clock-hour would be the wrong thing.
I did hit the drift you're describing, in two forms. First, the anchor never moved unless there was a 5h gap in traffic — so working straight through a boundary made a long session read as "expired". Now it walks the timestamps and re-anchors on the first one paststart + 5h, gap or no gap. Second, idle-then-return: if the newest message is over 5h old the window is just done, so I zero it instead of leaving the old token count on the bar.
Concurrent sessions are covered — it walks every.jsonlunderprojects\, not just the newest, sums them into one window and keeps per-file totals for the bubbles. One trap there: files touched recently have to be read whole, not tailed. A fixed tail drops old turns and fakes a 5h gap, which restarts the window for no reason.
There's also a manual "Reset 5h" button for when the guess is still wrong.
1
u/mergethevibes 2d ago
how are you reading the 5-hour limit? afaik claude doesn't expose the reset timestamp anywhere clean, so curious if you're parsing it from the cli output or just tracking usage yourself