Skip to content

Commit 4e05f2f

Browse files
committed
release: v0.6.0 — /status calibration, status tray, logging, accuracy fixes
Features: - /status calibration for Claude usage: enter the session % from Claude Code's /status and TokenWatch back-solves your real effective limit so the displayed percentage tracks it (Settings -> Claude plan). - Status-colored tray icon (green/amber/red) on Windows/Linux, with a make-tray-icons script; falls back to the plain icon when absent. - Persistent main-process log at ~/.tokenwatch/logs/main.log (1 MB rotation) wired to global + IPC error paths; "Open logs" button in Settings. - Projected 30-day cost tile in Analytics. Fixes: - Stop showing fabricated demo data when there is no session history; render an honest zero state instead. - Ctrl/Cmd+2 no longer opens a blank screen; number shortcuts now map to the four visible tabs (Dashboard/Analytics/Terminal/Settings). - Surface in-app refresh/save toasts (were pushed into an unrendered queue and dropped). - Codex context-window % used cumulative session tokens (showed ~2890%); use the latest turn, clamped to 100%. - Analytics summary tiles now follow the 7d/30d toggle; keep the final X-axis label on 30d. - sessionTracker sorts sessions newest-first. Stability / cleanup: - Async Codex session file I/O (off the main thread) so a large archive doesn't block the UI on its 15s refresh. - Deterministic teardown on quit (clear timers + terminate ccusage worker). - Remove dead code: mock-data generators, unused LiveMonitoring and NotificationSystem components.
1 parent ca5f22f commit 4e05f2f

31 files changed

Lines changed: 823 additions & 779 deletions

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,49 @@ Pre-v0.1.0 history is the CCSeva lineage ([Iamshankhadeep/ccseva](https://github
99

1010
## [Unreleased]
1111

12+
## [0.6.0] — 2026-06-18
13+
### Added
14+
- **Persistent main-process log** at `~/.tokenwatch/logs/main.log`
15+
(1 MB rotation). The global `uncaughtException` / `unhandledRejection`
16+
handlers, startup, single-instance denials, and update/IPC errors now
17+
write here — packaged GUI builds previously discarded all console
18+
output. A new **Open logs** button in Settings opens the folder.
19+
- **`/status` calibration** for Claude usage. Plan token limits aren't
20+
published, so the percentage is an estimate; entering the session %
21+
from Claude Code's `/status` back-solves your real effective limit so
22+
future percentages track it. Settings → Claude plan → *Calibrate
23+
against /status*; clearable anytime.
24+
- **Status-colored tray icon** on Windows/Linux — the mark's accent
25+
turns green / amber / red at the safe / warning / critical
26+
thresholds (run `npm run make-tray-icons` to generate the assets;
27+
falls back to the plain icon when absent).
28+
- **Projected 30-day cost** tile in Analytics.
29+
30+
### Fixed
31+
- **No more fabricated numbers.** With no session history the dashboard
32+
showed demo data ($2.45 / 850 tokens / random charts); it now renders
33+
an honest zero state.
34+
- **Ctrl/Cmd+2 no longer opens a blank screen** — the unused `live`
35+
route is gone and the number shortcuts now map to the four visible
36+
tabs (1 Dashboard · 2 Analytics · 3 Terminal · 4 Settings).
37+
- **In-app feedback toasts are shown again.** Refresh / settings-save
38+
notifications were pushed into a queue that nothing rendered; they
39+
now route through the toaster.
40+
- **Codex context-window % was nonsensical** (cumulative session tokens
41+
÷ context window → e.g. 2890%); it now uses the latest turn's tokens,
42+
clamped to 100%.
43+
- **Analytics summary tiles now follow the 7d/30d toggle** (were hardcoded
44+
to 7 days), and the final day's X-axis label is no longer dropped on 30d.
45+
46+
### Changed
47+
- **Codex session parsing moved off the main thread** (async file I/O) so
48+
a large `~/.codex/sessions` archive no longer blocks the tray/UI on its
49+
15-second refresh.
50+
- **Deterministic teardown on quit** — all timers are cleared and the
51+
ccusage worker thread is terminated instead of relying on process exit.
52+
- Removed dead code: mock-data generators and the unused `LiveMonitoring`
53+
/ `NotificationSystem` components.
54+
1255
## [0.5.6] — 2026-04-19
1356
### Added
1457
- **Installed version readout** next to the "Check for updates now"

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,30 @@ The app reads your Claude Code usage history from `~/.claude/projects/**/*.jsonl
152152
| Window anchor | Top-right, near the menu bar | Near the tray icon, clamped to the active display |
153153
| Notifications | Native Notification Center | Toast center (requires `AppUserModelId`, set automatically) |
154154

155+
## FAQ
156+
157+
### Why doesn't the percentage match Claude Code's `/status`?
158+
159+
Because it **can't be derived exactly from local data.** Claude Code's JSONL logs only store raw per-message token counts (`input` / `output` / `cache_read` / `cache_creation`). The percentages, remaining quota, and reset times that `/status` shows are computed **server-side by Anthropic** (using an undisclosed, model-weighted formula and unpublished limits) and are only returned in API response headers — they are **never written to disk**.
160+
161+
So TokenWatch estimates the percentage as `tokens used ÷ plan limit`, where:
162+
163+
- **tokens used** excludes cache-read tokens. On a cache-heavy session these can be 95%+ of all tokens — including them would inflate the number ~10–100×, so they're left out (they're also weighted far below 1× by Anthropic's rate limiter).
164+
- **plan limit** is a community-estimated value (Pro / Max5 / Max20), not an official figure.
165+
166+
Both differ from Anthropic's own method, so the raw estimate will not line up with `/status`.
167+
168+
### How do I make the percentage track `/status`?
169+
170+
Use **calibration** (Settings → Claude plan → *Calibrate against /status*):
171+
172+
1. Run `/status` in Claude Code and note the **current session percentage** it shows.
173+
2. Enter that number in the calibration box and click **Calibrate**.
174+
175+
TokenWatch back-solves your real effective limit (`limit = tokens used ÷ percentage`) and remembers it, so future percentages track `/status`. It's a linear fit — most accurate near your current usage level, and you can **Clear** it anytime to return to the estimate.
176+
177+
> **Codex is different:** Codex CLI writes its authoritative rate-limit percentages (5-hour and weekly windows) into its session logs, so the Codex card's percentages already match `codex` `/status` with no calibration needed.
178+
155179
## Requirements
156180

157181
- macOS 10.15+ **or** Windows 10/11 (x64)

README.zh-CN.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,30 @@ Remove-Item -Recurse -Force "$env:LOCALAPPDATA\electron-builder\Cache\winCodeSig
152152
| 窗口锚定 | 右上角,靠近菜单栏 | 托盘图标附近,自动限制在当前显示器范围内 |
153153
| 通知 | 原生通知中心 | Toast 通知(需 `AppUserModelId`,已自动设置) |
154154

155+
## 常见问题
156+
157+
### 为什么百分比和 Claude Code 的 `/status` 对不上?
158+
159+
因为**它无法从本地数据精确复现**。Claude Code 的 JSONL 日志只记录每条消息的原始 token 数(`input` / `output` / `cache_read` / `cache_creation`)。`/status` 显示的百分比、剩余额度和重置时间是 Anthropic **在服务器端**算出来的(用的是未公开、按模型加权的公式和未公布的额度),只在 API 响应头里返回 —— **从不落盘**
160+
161+
所以 TokenWatch 用 `已用 token ÷ 套餐额度` 来估算百分比,其中:
162+
163+
- **已用 token** 不含缓存读取(cache-read)token。在缓存密集的会话里它能占到全部 token 的 95% 以上,算进去会让数字膨胀约 10–100 倍,因此排除(它在 Anthropic 的限流里权重也远低于 1×)。
164+
- **套餐额度** 是社区估算值(Pro / Max5 / Max20),并非官方数字。
165+
166+
这两点都和 Anthropic 自己的算法不同,所以原始估算值不会和 `/status` 对齐。
167+
168+
### 怎样让百分比贴近 `/status`
169+
170+
使用**校准**功能(设置 → Claude 套餐 → *按 /status 校准*):
171+
172+
1. 在 Claude Code 里运行 `/status`,记下它显示的**当前会话百分比**
173+
2. 把这个数字填进校准框,点击**校准**
174+
175+
TokenWatch 会反推出你真实的有效额度(`额度 = 已用 token ÷ 百分比`)并记住它,之后的百分比就会贴着 `/status` 走。这是线性拟合 —— 在你当前用量水平附近最准;随时可点**清除**恢复为估算值。
176+
177+
> **Codex 不一样:** Codex CLI 会把官方的限流百分比(5 小时窗口与每周窗口)写进自己的会话日志,所以 Codex 卡片的百分比无需校准就已经和 `codex``/status` 一致。
178+
155179
## 环境要求
156180

157181
- macOS 10.15+ **** Windows 10/11 (x64)

assets/tray-critical.ico

5.3 KB
Binary file not shown.

assets/tray-critical.png

566 Bytes
Loading

assets/tray-safe.ico

5.3 KB
Binary file not shown.

assets/tray-safe.png

582 Bytes
Loading

assets/tray-warning.ico

5.3 KB
Binary file not shown.

assets/tray-warning.png

585 Bytes
Loading

0 commit comments

Comments
 (0)