Skip to content

Commit 67aeecc

Browse files
committed
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
1 parent 7d947dc commit 67aeecc

29 files changed

Lines changed: 3527 additions & 2443 deletions

‎CLAUDE.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

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.
810

911
## Essential Commands
1012

@@ -52,7 +54,7 @@ The app follows standard Electron patterns with clear separation:
5254

5355
#### Service Layer (Singleton Pattern)
5456
- **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
5658
- **NotificationService**: Manages macOS notifications with cooldown periods and threshold detection
5759
- **ResetTimeService**: Handles Claude usage reset time calculations and timezone management
5860
- **SessionTracker**: Tracks user sessions and activity patterns for analytics
@@ -178,7 +180,7 @@ When using the `ccusage` package data-loader API:
178180

179181
### Settings Management & Plan Selection (Latest)
180182
- **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
182184
- **Custom Token Limits**: Custom plan option allows users to set non-standard token limits with validation
183185
- **Real-time Plan Display**: TerminalView now shows selected plan settings instead of just auto-detected plans
184186
- **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:
202204

203205
### Current Project Structure
204206
```
205-
ccseva/
207+
tokenwatch/
206208
├── main.ts # Electron main process with tray management
207209
├── preload.ts # Secure IPC bridge
208210
├── src/
@@ -262,7 +264,7 @@ Since there are no automated tests, manual verification checklist:
262264
8. **Data consistency**: Ensure displayed data matches `ccusage` output
263265
9. **Actual reset time accuracy**: Verify session-based reset times from active blocks
264266
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`
266268

267269
### Plan Management & Settings
268270
12. **Plan selection**: Test Auto-detect, Pro, Max5, Max20, and Custom plan options in SettingsPanel

‎LICENSE‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
MIT License
22

3-
Copyright (c) 2024 Claude Monitor
3+
Copyright (c) 2024 Claude Monitor (original CCSeva project)
4+
Copyright (c) 2026 TokenWatch contributors
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1819
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1920
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2021
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
22+
SOFTWARE.

‎README.md‎

Lines changed: 60 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,51 @@
1-
# CCSeva 🤖
1+
# TokenWatch
22

33
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4-
[![GitHub release](https://img.shields.io/github/release/Iamshankhadeep/ccseva.svg)](https://github.com/Iamshankhadeep/ccseva/releases)
5-
[![Build Status](https://img.shields.io/github/actions/workflow/status/Iamshankhadeep/ccseva/ci.yml?branch=main)](https://github.com/Iamshankhadeep/ccseva/actions)
6-
[![Downloads](https://img.shields.io/github/downloads/Iamshankhadeep/ccseva/total.svg)](https://github.com/Iamshankhadeep/ccseva/releases)
7-
[![macOS](https://img.shields.io/badge/macOS-10.15%2B-blue)](https://github.com/Iamshankhadeep/ccseva)
8-
[![Windows](https://img.shields.io/badge/Windows-10%2F11-0078D4)](https://github.com/Iamshankhadeep/ccseva)
4+
[![Windows](https://img.shields.io/badge/Windows-10%2F11-0078D4)](#installation)
5+
[![macOS](https://img.shields.io/badge/macOS-10.15%2B-blue)](#installation)
96

10-
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-
![Dashboard](./screenshots/dashboard.png)
15-
![Analytics](./screenshots/analytics.png)
16-
![Terminal](./screenshots/terminal.png)
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.
178

189
## Features
1910

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
3223

3324
## Installation
3425

35-
### macOS
26+
### Windows
3627

37-
Download the latest release from [GitHub Releases](https://github.com/Iamshankhadeep/ccseva/releases):
38-
- **Apple Silicon**: `CCSeva-darwin-arm64.dmg`
39-
- **Intel**: `CCSeva-darwin-x64.dmg`
28+
Download the latest release from GitHub Releases:
29+
- **Installer**: `TokenWatch-Setup-<version>-x64.exe` (NSIS, custom install directory, desktop & start-menu shortcuts)
30+
- **Portable**: `TokenWatch-Portable-<version>-x64.exe` (no installation required)
4031

41-
### Windows
32+
Windows 10 / 11 (x64).
4233

43-
Download the latest release from [GitHub Releases](https://github.com/Iamshankhadeep/ccseva/releases):
44-
- **Installer**: `CCSeva-Setup-<version>-x64.exe` (NSIS, supports custom install directory)
45-
- **Portable**: `CCSeva-Portable-<version>-x64.exe` (no installation required)
34+
### macOS
4635

47-
Windows 10 / 11 (x64) are supported.
36+
- **Apple Silicon**: `TokenWatch-darwin-arm64.dmg`
37+
- **Intel**: `TokenWatch-darwin-x64.dmg`
4838

49-
### Build from Source
39+
### Build from source
5040

5141
```bash
52-
git clone https://github.com/Iamshankhadeep/ccseva.git
53-
cd ccseva
54-
npm install # applies patches/ccusage+*.patch via postinstall
42+
git clone <this-repo>
43+
cd tokenwatch
44+
npm install # also applies patches/ccusage+*.patch via postinstall
5545
npm run build
5646
npm start
5747
```
5848

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-
6749
Packaging:
6850

6951
```bash
@@ -72,6 +54,14 @@ npm run dist:win # Windows NSIS installer + portable exe
7254
npm run dist # Current platform (auto)
7355
```
7456

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+
7565
#### Windows packaging prerequisites
7666

7767
`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:
@@ -87,28 +77,24 @@ Remove-Item -Recurse -Force "$env:LOCALAPPDATA\electron-builder\Cache\winCodeSig
8777

8878
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).
8979

90-
### Development
91-
92-
```bash
93-
npm run electron-dev # Watch build + launch Electron with reload
94-
```
95-
9680
## Usage
9781

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)
10186

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.
10388

10489
### Platform differences
10590

10691
| Behavior | macOS | Windows |
10792
|---|---|---|
10893
| 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) |
10994
| Tray icon | Empty (text-only) | PNG / ICO icon (`assets/tray.ico`) |
95+
| Window chrome | Custom title bar (no native) | Custom title bar with minimize / maximize / close buttons |
11096
| 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) |
11298

11399
## Requirements
114100

@@ -119,17 +105,27 @@ The app automatically detects your Claude Code configuration from the `~/.claude
119105
## Tech Stack
120106

121107
- 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).
124122

125123
## License
126124

127-
MIT License - see [LICENSE](LICENSE) file for details.
125+
MIT License — see [LICENSE](LICENSE).
128126

129127
## Credits
130128

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.
134130

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).

‎electron-builder.json‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"appId": "com.ccseva.app",
3-
"productName": "CCSeva",
2+
"appId": "com.tokenwatch.app",
3+
"productName": "TokenWatch",
44
"directories": {
55
"output": "release"
66
},
@@ -22,16 +22,16 @@
2222
"gatekeeperAssess": false,
2323
"extendInfo": {
2424
"LSUIElement": true,
25-
"CFBundleDisplayName": "CCSeva",
26-
"CFBundleName": "CCSeva",
27-
"CFBundleExecutable": "CCSeva",
28-
"NSHumanReadableCopyright": "Copyright © 2024 CCSeva. All rights reserved.",
25+
"CFBundleDisplayName": "TokenWatch",
26+
"CFBundleName": "TokenWatch",
27+
"CFBundleExecutable": "TokenWatch",
28+
"NSHumanReadableCopyright": "Copyright © 2026 TokenWatch contributors. All rights reserved.",
2929
"CFBundleDocumentTypes": [],
3030
"LSMinimumSystemVersion": "10.15.0"
3131
}
3232
},
3333
"dmg": {
34-
"title": "CCSeva",
34+
"title": "TokenWatch",
3535
"icon": "assets/icon.icns"
3636
},
3737
"win": {
@@ -54,10 +54,10 @@
5454
"allowToChangeInstallationDirectory": true,
5555
"createDesktopShortcut": true,
5656
"createStartMenuShortcut": true,
57-
"shortcutName": "CCSeva",
57+
"shortcutName": "TokenWatch",
5858
"installerIcon": "assets/icon.ico",
5959
"uninstallerIcon": "assets/icon.ico",
60-
"uninstallDisplayName": "CCSeva"
60+
"uninstallDisplayName": "TokenWatch"
6161
},
6262
"portable": {
6363
"artifactName": "${productName}-Portable-${version}-${arch}.${ext}"

0 commit comments

Comments
 (0)