You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TokenWatch 0.1.0 — UI redesign, rename, mini HUD, i18n
A ground-up rebrand on top of the Windows port work:
UI
- Full Claude/Anthropic warm-parchment design system (serif headlines,
terracotta accents, ring shadows, no cool greys)
- Replaced all rainbow-gradient icon pills with lucide line icons on warm
sand discs
- Dashboard: serif metric numbers, dual circular rings (token usage +
5-hour session reset countdown), centered
- Analytics: terracotta mono-tone charts, warm model distribution donut,
editorial segmented controls, metric cards with badges
- Terminal: Claude dark-section treatment (near-black + warm silver),
monospace key-value rows with dot leaders
- Settings: serif titles, lucide section icons, restyled Switch with
clear terracotta/sand contrast
- Frameless window with custom title bar; header is the drag region,
interactive controls opt out; fixed header (never scrolls)
- Mini HUD: optional always-on-top 220x64 widget with 3 content modes
(percent / percent+cost / percent+cost+burn rate); persists position
i18n
- react-i18next; English + 简体中文; auto-detect + manual override in
Settings; applies before first paint
Rename (CCSeva -> TokenWatch)
- package.json, electron-builder, AppUserModelID, tray tooltip, window
title, screenshots path, login item, HTML title, i18n strings, README,
CLAUDE.md, LICENSE (original copyright preserved per MIT)
- Settings / caches moved from ~/.ccseva to ~/.tokenwatch (pricing patch
updated to match)
Fixes
- Timezone bug: daily grouping now uses local date (not UTC) so "today"
matches the user's clock
- Per-entry grouping (not block.startTime) so sessions spanning midnight
split cleanly into correct days
- Tooltip i18n for the dashboard ring status
- Redundant /Windows/native title bar removed; custom min/max/close
buttons with close-hover terracotta
Copy file name to clipboardExpand all lines: CLAUDE.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Project Overview
6
6
7
-
CCSeva is a macOS menu bar Electron application that monitors Claude Code usage in real-time. The app uses the `ccusage` npm package API to fetch token usage data and displays it through a modern React-based UI with tabbed navigation, analytics, notifications, and visualizations.
7
+
TokenWatch is a cross-platform (Windows + macOS) tray/menu-bar Electron application that monitors Claude Code usage in real-time. The app uses the `ccusage` npm package API to fetch token usage data and displays it through a warm Claude-inspired React UI with tabbed navigation, analytics, notifications, and visualizations.
8
+
9
+
TokenWatch started as a Windows port of [CCSeva](https://github.com/Iamshankhadeep/ccseva) (MIT), with a full UI redesign, frameless custom title bar, i18n, worker-thread parsing, and local ccusage performance patches.
8
10
9
11
## Essential Commands
10
12
@@ -52,7 +54,7 @@ The app follows standard Electron patterns with clear separation:
52
54
53
55
#### Service Layer (Singleton Pattern)
54
56
-**CCUsageService**: Uses the `ccusage` npm package data-loader API to fetch usage data, implementing a 30-second cache. Now supports plan configuration and actual session-based reset times.
55
-
-**SettingsService**: Manages user preferences persistence to `~/.ccseva/settings.json` including plan selection, custom token limits, timezone, and reset hour settings
57
+
-**SettingsService**: Manages user preferences persistence to `~/.tokenwatch/settings.json` including plan selection, custom token limits, timezone, and reset hour settings
56
58
-**NotificationService**: Manages macOS notifications with cooldown periods and threshold detection
57
59
-**ResetTimeService**: Handles Claude usage reset time calculations and timezone management
58
60
-**SessionTracker**: Tracks user sessions and activity patterns for analytics
@@ -178,7 +180,7 @@ When using the `ccusage` package data-loader API:
178
180
179
181
### Settings Management & Plan Selection (Latest)
180
182
-**Claude Plan Settings**: Added comprehensive plan selection in SettingsPanel with Auto-detect, Pro, Max5, Max20, and Custom options
181
-
-**Persistent Settings**: Extended SettingsService to save plan preferences to `~/.ccseva/settings.json` with backward compatibility
183
+
-**Persistent Settings**: Extended SettingsService to save plan preferences to `~/.tokenwatch/settings.json` with backward compatibility
182
184
-**Custom Token Limits**: Custom plan option allows users to set non-standard token limits with validation
183
185
-**Real-time Plan Display**: TerminalView now shows selected plan settings instead of just auto-detected plans
184
186
-**Settings UI Enhancement**: Professional plan selection dropdown with token limit display and current plan detection
@@ -202,7 +204,7 @@ When using the `ccusage` package data-loader API:
202
204
203
205
### Current Project Structure
204
206
```
205
-
ccseva/
207
+
tokenwatch/
206
208
├── main.ts # Electron main process with tray management
207
209
├── preload.ts # Secure IPC bridge
208
210
├── src/
@@ -262,7 +264,7 @@ Since there are no automated tests, manual verification checklist:
262
264
8.**Data consistency**: Ensure displayed data matches `ccusage` output
263
265
9.**Actual reset time accuracy**: Verify session-based reset times from active blocks
264
266
10.**Session tracking**: Confirm session data persistence and analytics
265
-
11.**Settings persistence**: Confirm plan and preference settings save to `~/.ccseva/settings.json`
267
+
11.**Settings persistence**: Confirm plan and preference settings save to `~/.tokenwatch/settings.json`
266
268
267
269
### Plan Management & Settings
268
270
12.**Plan selection**: Test Auto-detect, Pro, Max5, Max20, and Custom plan options in SettingsPanel
A beautiful menu bar / tray app for tracking your Claude Code usage in real-time. Monitor token consumption, costs, and usage patterns with an elegant interface.
11
-
12
-
## Screenshots
13
-
14
-

15
-

16
-

7
+
A warm, editorial tray app that keeps a quiet eye on your Claude Code token usage. Lives in the system tray on Windows / menu bar on macOS, shows real-time consumption, cost, and burn rate, and stays out of the way the rest of the time.
17
8
18
9
## Features
19
10
20
-
-**Real-time monitoring**- Live token usage tracking with 30-second updates
21
-
-**Menu bar / tray integration**- Percentage indicator with color-coded status (macOS); hover tooltip + dynamic context menu (Windows)
22
-
-**Smart plan detection**- Auto-detects Pro/Max5/Max20/Custom plans
23
-
-**Usage analytics**- 7-day charts, model breakdowns, and trend analysis
24
-
-**Smart notifications**- Alerts at 70% and 90% thresholds with cooldown
25
-
-**Cost tracking**- Daily cost estimates and burn rate calculations
26
-
-**Instant cold start**- Persists the last snapshot to disk so subsequent launches render the full UI immediately, then refresh in the background
27
-
-**Single-instance lock**- Relaunching the app surfaces the existing window instead of opening a second tray icon
28
-
-**Launch on startup***(optional)* - Start CCSeva minimized to the tray when you sign in (Settings → Launch on Startup)
29
-
-**Standalone window mode***(optional)* - Switch the tray popup to a normal resizable window with a taskbar entry (Settings → Standalone Window)
30
-
-**Worker-thread parsing**- ccusage JSONL parsing runs in a `worker_threads` worker so the tray and UI stay responsive while large histories load
31
-
-**Beautiful UI**- Gradient design with glass morphism effects
11
+
-**Live tray display**— hovering the tray icon shows the current usage percentage and cost; click to open the full view
12
+
-**Parchment UI**— warm Claude-inspired design system (serif headings, terracotta accents, ring shadows) instead of the usual cool-grey dashboard look
13
+
-**Standalone window mode**— optional normal resizable window with a taskbar entry, in addition to the default tray-anchored popup
14
+
-**Instant cold start**— persists the last snapshot to disk so subsequent launches render the full UI immediately, then refresh in the background
15
+
-**Worker-thread parsing**— ccusage JSONL parsing runs in a `worker_threads` worker so the tray and UI stay responsive while large histories load
16
+
-**Smart plan detection**— auto-detects Pro / Max5 / Max20 / Custom from actual usage, or pick one manually
17
+
-**Analytics**— 7-day and 30-day trends as area / line / bar, model distribution donut, per-hour burn rate, plan utilization, depletion prediction
18
+
-**Terminal view**— a calm monospace readout for when you just want the numbers
19
+
-**Smart notifications**— alerts at 70% and 90% thresholds with cooldown
20
+
-**Single-instance lock**— relaunching surfaces the existing window instead of spawning a duplicate tray icon
21
+
-**Launch on startup***(optional)* — starts minimized to the tray when you sign in
22
+
-**i18n**— English and 简体中文, auto-detected from the system
32
23
33
24
## Installation
34
25
35
-
### macOS
26
+
### Windows
36
27
37
-
Download the latest release from [GitHub Releases](https://github.com/Iamshankhadeep/ccseva/releases):
npm install # applies patches/ccusage+*.patch via postinstall
42
+
git clone <this-repo>
43
+
cdtokenwatch
44
+
npm install #also applies patches/ccusage+*.patch via postinstall
55
45
npm run build
56
46
npm start
57
47
```
58
48
59
-
> **Note**: `npm install` runs `patch-package` on `postinstall` to apply a small local patch to ccusage (`patches/ccusage+18.0.8.patch`). The patch does three things:
60
-
>
61
-
> 1.**Skip the pre-read file sort** — `loadSessionBlockData` was opening and streaming every JSONL file just to find its earliest timestamp, then opening each file again to read entries. `identifySessionBlocks` already sorts entries by timestamp internally, so the pre-sort is redundant. Cuts cold-start I/O in half.
62
-
> 2.**Parallelize file processing** — the upstream serial `for (const file of sortedFiles) await processJSONLFileByLine(file, ...)` is replaced with a bounded `Promise.all` (cap: 32 concurrent files) to keep libuv's I/O thread pool busy.
63
-
> 3.**Persist LiteLLM pricing to disk** — the upstream fetcher re-downloads pricing from GitHub on every run. We cache the response at `~/.ccseva/pricing-cache.json` with a 24h TTL and skip the network round-trip when the cache is fresh. Cost calculation accuracy is unchanged.
64
-
>
65
-
> Typical impact on a 1,700-file history: cold start ~49s → ~12–30s depending on disk cache state. Subsequent runs also avoid the 1–5s LiteLLM fetch.
66
-
67
49
Packaging:
68
50
69
51
```bash
@@ -72,6 +54,14 @@ npm run dist:win # Windows NSIS installer + portable exe
72
54
npm run dist # Current platform (auto)
73
55
```
74
56
57
+
> **Note**: `npm install` runs `patch-package` on `postinstall` to apply a small local patch to ccusage (`patches/ccusage+18.0.8.patch`). The patch:
58
+
>
59
+
> 1.**Skips the pre-read file sort** — `loadSessionBlockData` opens and streams every JSONL file just to find its earliest timestamp, then opens each file again to read entries. `identifySessionBlocks` already sorts entries by timestamp internally, so the pre-sort is redundant. Cuts cold-start I/O in half.
60
+
> 2.**Parallelizes file processing** — the upstream serial `for (const file of sortedFiles) await processJSONLFileByLine(file, ...)` is replaced with a bounded `Promise.all` (cap: 32 concurrent files) to keep libuv's I/O thread pool busy.
61
+
> 3.**Persists LiteLLM pricing to disk** — the upstream fetcher re-downloads pricing from GitHub on every run. We cache the response at `~/.tokenwatch/pricing-cache.json` with a 24h TTL and skip the network round-trip when the cache is fresh. Cost calculation accuracy is unchanged.
62
+
>
63
+
> Typical impact on a 1,700-file history: cold start ~49s → ~12–30s depending on disk cache state. Subsequent runs also avoid the 1–5s LiteLLM fetch.
64
+
75
65
#### Windows packaging prerequisites
76
66
77
67
`electron-builder` creates symbolic links while extracting the `winCodeSign` helper on Windows. If the build fails with `Cannot create symbolic link : 客户端没有所需的特权` (or similar), enable one of the following:
We don't ship signed Windows binaries; unless you set your own certificate, builds skip code signing automatically (`CSC_IDENTITY_AUTO_DISCOVERY=false` is safe to set if you see signing prompts).
89
79
90
-
### Development
91
-
92
-
```bash
93
-
npm run electron-dev # Watch build + launch Electron with reload
94
-
```
95
-
96
80
## Usage
97
81
98
-
1.**Launch** - CCSeva appears in your menu bar (macOS) or notification area / system tray (Windows).
99
-
2.**Left-click the tray icon** - Toggle the main window.
100
-
3.**Right-click the tray icon** - Context menu: current usage %, cost, Open, Refresh, Quit.
82
+
1.**Launch** — TokenWatch appears in your menu bar (macOS) or notification area / system tray (Windows)
83
+
2.**Left-click the tray icon** — toggle the main window
84
+
3.**Right-click the tray icon** — context menu: current usage %, cost, Open, Refresh, Quit
85
+
4.**Drag the window** — the header is the drag handle (frameless window with custom Claude-styled controls)
101
86
102
-
The app automatically detects your Claude Code configuration from the `~/.claude` directory (Windows: `%USERPROFILE%\.claude`) and refreshes every 30 seconds.
87
+
The app reads your Claude Code usage history from `~/.claude/projects/**/*.jsonl` and refreshes every 30 seconds.
103
88
104
89
### Platform differences
105
90
106
91
| Behavior | macOS | Windows |
107
92
|---|---|---|
108
93
| Tray label (% / $) | Rendered as text directly in the menu bar via `Tray.setTitle`| Shown in the tooltip on hover and in the right-click context menu header (Windows tray icons cannot display text) |
| Window chrome | Custom title bar (no native) | Custom title bar with minimize / maximize / close buttons |
110
96
| Window anchor | Top-right, near the menu bar | Near the tray icon, clamped to the active display |
111
-
| Notifications | Native Notification Center | Toast center (requires `AppUserModelId`, set automatically by the app) |
97
+
| Notifications | Native Notification Center | Toast center (requires `AppUserModelId`, set automatically) |
112
98
113
99
## Requirements
114
100
@@ -119,17 +105,27 @@ The app automatically detects your Claude Code configuration from the `~/.claude
119
105
## Tech Stack
120
106
121
107
- Electron 36 + React 19 + TypeScript 5
122
-
- Tailwind CSS 3 + Radix UI components
123
-
- ccusage package for data integration
108
+
- Tailwind CSS 3 with a custom Claude-inspired warm palette
109
+
- Radix UI primitives
110
+
- i18next + react-i18next
111
+
- ccusage for usage data (with local performance patches via patch-package)
112
+
113
+
## Data stored locally
114
+
115
+
TokenWatch keeps small files under `~/.tokenwatch/`:
116
+
117
+
-`settings.json` — user preferences (language, plan, display mode, etc.)
118
+
-`stats-cache.json` — last-known usage snapshot, used to render the UI instantly on cold start
119
+
-`pricing-cache.json` — LiteLLM model pricing table, 24h TTL
120
+
121
+
Nothing is sent anywhere else — the only network call is ccusage's pricing fetch from GitHub (cached).
124
122
125
123
## License
126
124
127
-
MIT License - see [LICENSE](LICENSE) file for details.
125
+
MIT License — see [LICENSE](LICENSE).
128
126
129
127
## Credits
130
128
131
-
Built with ❤️ using [Electron](https://electronjs.org), [React](https://reactjs.org), [Tailwind CSS](https://tailwindcss.com), and [ccusage](https://github.com/ryoppippi/ccusage).
132
-
133
-
---
129
+
TokenWatch is based on [CCSeva](https://github.com/Iamshankhadeep/ccseva) by **Iamshankhadeep** (MIT). The Windows port, warm-parchment UI redesign, worker-thread parsing, ccusage performance patches, frameless custom title bar, and i18n support were added on top of that foundation.
134
130
135
-
**Note**: This is an unofficial tool for tracking Claude Code usage. Requires a valid Claude Code installation and configuration.
131
+
Built with [Electron](https://electronjs.org), [React](https://reactjs.org), [Tailwind CSS](https://tailwindcss.com), [Radix UI](https://www.radix-ui.com), [lucide-react](https://lucide.dev), and [ccusage](https://github.com/ryoppippi/ccusage).
0 commit comments