1.8 KiB
1.8 KiB
Project: claude-usage-widget
A small always-on-top Windows desktop widget that visualizes local Claude Code usage — current 5-hour session block, 7-day rolling weekly window, and per-model token breakdown. Reads ~/.claude/projects/**/*.jsonl directly (via \\wsl$\<distro>\… from Windows). No Anthropic API. No auth.
Working agreement
- This is a git repo. Commit after each logical change with a one-line imperative message.
- Read
memory.mdat session start. Update it before ending the session. - Never commit secrets — see
.gitignoreand the rules in~/claude/CLAUDE.md.
Project-specific notes
- Stack: Tauri 2 (Rust + Svelte 5 + Vite + TS). Inline SVG for charts, no chart library.
- Build target: Windows
.exeonly. Develop the Rust + frontend code in WSL; dopnpm tauri dev/pnpm tauri buildon the Windows host (it needs MSVC toolchain + WebView2). - Data source:
~/.claude/projects/**/*.jsonl— assistant lines havemessage.usage.{input_tokens, output_tokens, cache_creation_input_tokens, cache_read_input_tokens}and arequestId/uuidfor dedupe (subagent transcripts in<sessionId>/subagents/<id>.jsonloverlap the parent). - Aggregation algorithm: ccusage-equivalent. 5-hour blocks are
floor_to_hour(first_ts) → +5h; new block on ≥5h gap or when previous block ends. Weekly is rolling 7 days. - Plan reference:
~/.claude/plans/snug-mapping-milner.md(the approved plan that drove this scaffold).
Run
# On the Windows host, from this directory:
pnpm install
pnpm tauri dev # iterate
pnpm tauri build # NSIS installer in src-tauri/target/release/bundle/nsis/
Verify
See memory.md and the plan file for the 10-step verification checklist (parse correctness, block boundary, dedupe, live tail, watcher fallback, autostart, etc).