FinalToken v1: Claude and Codex usage tracker with stats panel, pace popups and Stream Deck plugin #1

Closed
opened 2026-10-14 18:32:01 +02:00 by schmidt.florian · 10 comments
Owner

A small tray app that tracks Claude Code and Codex usage and limits. It never signs in to a provider and never handles a token: all data comes from the installed CLIs and the files they write.

Requirements (schmidt.florian, 2026-10-14)

  • R1 NativeAOT on the newest .NET; cross-platform, at least Windows 11 and CachyOS.
  • R2 No provider sign-in in the app, no API key or OAuth token: use the CLIs.
  • R3 Providers: at least Codex and Claude.
  • R4 Opening the app shows a comprehensive stats panel, history included.
  • R5 Small, non-intrusive popups remind the user when usage runs ahead of or behind the limit pace.
  • R6 A Stream Deck plugin shows selected stats on buttons.
  • R7 The app installs or updates the Stream Deck plugin automatically, as the user chooses.

The recorded decisions that implement these are in docs/decisions.md on the branch.

Plan

Branch 1-finaltoken-v1, worktree FinalToken-wt/1-finaltoken-v1. One PR.

  • Docs: AGENTS.md, requirements, decisions D1–D11, review workflow (orchestrator)
  • Tooling: tools/docs/check_docs.py with tests, tools/agent-review.sh (worker W0)
  • Foundation: solution, Core (model, pace, collectors, history store, refresh scheduler, snapshot), CLI, tests (worker W1)
  • Desktop app: stats panel with history, tray, settings, pace popups (worker W2)
  • Stream Deck plugin, packaging, installer and updater (worker W3)
  • Integration: Windows build, tests and NativeAOT publish; Linux NativeAOT build in an Arch container; screenshots; plugin install on the local Stream Deck
  • PR and agent review
A small tray app that tracks Claude Code and Codex usage and limits. It never signs in to a provider and never handles a token: all data comes from the installed CLIs and the files they write. ## Requirements (schmidt.florian, 2026-10-14) - **R1** NativeAOT on the newest .NET; cross-platform, at least Windows 11 and CachyOS. - **R2** No provider sign-in in the app, no API key or OAuth token: use the CLIs. - **R3** Providers: at least Codex and Claude. - **R4** Opening the app shows a comprehensive stats panel, history included. - **R5** Small, non-intrusive popups remind the user when usage runs ahead of or behind the limit pace. - **R6** A Stream Deck plugin shows selected stats on buttons. - **R7** The app installs or updates the Stream Deck plugin automatically, as the user chooses. The recorded decisions that implement these are in `docs/decisions.md` on the branch. ## Plan Branch `1-finaltoken-v1`, worktree `FinalToken-wt/1-finaltoken-v1`. One PR. - [x] Docs: `AGENTS.md`, requirements, decisions D1–D11, review workflow (orchestrator) - [x] Tooling: `tools/docs/check_docs.py` with tests, `tools/agent-review.sh` (worker W0) - [x] Foundation: solution, Core (model, pace, collectors, history store, refresh scheduler, snapshot), CLI, tests (worker W1) - [x] Desktop app: stats panel with history, tray, settings, pace popups (worker W2) - [x] Stream Deck plugin, packaging, installer and updater (worker W3) - [x] Integration: Windows build, tests and NativeAOT publish; Linux NativeAOT build in an Arch container; screenshots; plugin install on the local Stream Deck - [x] PR and agent review
schmidt.florian self-assigned this 2026-10-14 18:32:05 +02:00
Author
Owner

Claim — developer schmidt.florian.

  • Coordinator: Claude Code, claude-opus-5-5. Owns the issue, labels, commits, pushes, the PR and the review.
  • Workers: Codex CLI, gpt-6.1-sol, Standard tier, as T3 Code threads in project FinalToken. Reasoning effort high; xhigh for the scheduler, concurrency, networking and rework after a failed review. Workers leave changes uncommitted.
  • Reviewer: a fresh claude-opus-5-5 subagent at high effort, per docs/agents/review.md.
  • Branch 1-finaltoken-v1, worktree D:\Projects\CSharp\FinalToken-wt\1-finaltoken-v1.

Done so far: d3091cf and 1bf378e add AGENTS.md, docs/requirements.md, docs/decisions.md (D1–D11) and docs/agents/review.md.

Next, in parallel, on disjoint files in the same worktree:

  • W0 (high): tools/docs/check_docs.py and its tests, tools/gitea.sh, tools/agent-review.sh.
  • W1 (xhigh): solution, FinalToken.Core (collectors, store, scheduler, pace, snapshot, settings, contracts), FinalToken.Cli, tests, and placeholder projects for the app and the plugin.

Then W2 (desktop app) and W3 (Stream Deck plugin and installer) in parallel, each in its own project.

**Claim** — developer schmidt.florian. - Coordinator: Claude Code, `claude-opus-5-5`. Owns the issue, labels, commits, pushes, the PR and the review. - Workers: Codex CLI, `gpt-6.1-sol`, Standard tier, as T3 Code threads in project FinalToken. Reasoning effort high; xhigh for the scheduler, concurrency, networking and rework after a failed review. Workers leave changes uncommitted. - Reviewer: a fresh `claude-opus-5-5` subagent at high effort, per `docs/agents/review.md`. - Branch `1-finaltoken-v1`, worktree `D:\Projects\CSharp\FinalToken-wt\1-finaltoken-v1`. Done so far: `d3091cf` and `1bf378e` add `AGENTS.md`, `docs/requirements.md`, `docs/decisions.md` (D1–D11) and `docs/agents/review.md`. Next, in parallel, on disjoint files in the same worktree: - **W0** (high): `tools/docs/check_docs.py` and its tests, `tools/gitea.sh`, `tools/agent-review.sh`. - **W1** (xhigh): solution, `FinalToken.Core` (collectors, store, scheduler, pace, snapshot, settings, contracts), `FinalToken.Cli`, tests, and placeholder projects for the app and the plugin. Then W2 (desktop app) and W3 (Stream Deck plugin and installer) in parallel, each in its own project.
Author
Owner

W0 (tooling) finished and verified: 8533cfc, db890c5 add tools/docs/check_docs.py (0 errors on the tree, 15/15 unit tests), tools/gitea.sh and tools/agent-review.sh (refusal paths checked; no real review posted). Thread settled. W1 still running.

W0 (tooling) finished and verified: `8533cfc`, `db890c5` add `tools/docs/check_docs.py` (0 errors on the tree, 15/15 unit tests), `tools/gitea.sh` and `tools/agent-review.sh` (refusal paths checked; no real review posted). Thread settled. W1 still running.
Author
Owner

W1 foundation committed as 14223b0: solution, Core (collectors, store, refresh engine, pace, snapshot, settings, installer contract), finaltoken CLI and tests.

Verified by the coordinator on Windows: dotnet build 0 warnings; dotnet test 91/91 passed; dotnet publish src/FinalToken.Cli -r win-x64 NativeAOT with 0 warnings; a real finaltoken status run matches claude /usage. No source path opens a credential file.

Found in verification; W1 is reworking it now (same thread, xhigh):

  • history.json (19 MB after the first import here) is rewritten in full on every 60 s refresh, even with no new data: about 27 GB of writes a day while idle, growing with history. Inserts are linear, and every Codex event stores a limit sample.
  • On Windows, the atomic replace fails while a reader holds snapshot.json open without delete sharing, which the Stream Deck plugin will do.
  • Claude's <synthetic> entries are reported as malformed (20 here), and repeated diagnostics flood the bounded log.

Started in parallel in worktree FinalToken-wt\1-finaltoken-v1-ui (sub-branch 1-finaltoken-v1-ui, merged back by the coordinator):

  • W2 desktop app, gpt-6.1-sol high.
  • W3 Stream Deck plugin, installer and packaging, gpt-6.1-sol xhigh. W3 will install the plugin into the local Stream Deck 7.0.3 to check registration.
**W1 foundation committed** as `14223b0`: solution, Core (collectors, store, refresh engine, pace, snapshot, settings, installer contract), `finaltoken` CLI and tests. Verified by the coordinator on Windows: `dotnet build` 0 warnings; `dotnet test` 91/91 passed; `dotnet publish src/FinalToken.Cli -r win-x64` NativeAOT with 0 warnings; a real `finaltoken status` run matches `claude /usage`. No source path opens a credential file. Found in verification; W1 is reworking it now (same thread, xhigh): - `history.json` (19 MB after the first import here) is rewritten in full on every 60 s refresh, even with no new data: about 27 GB of writes a day while idle, growing with history. Inserts are linear, and every Codex event stores a limit sample. - On Windows, the atomic replace fails while a reader holds `snapshot.json` open without delete sharing, which the Stream Deck plugin will do. - Claude's `<synthetic>` entries are reported as malformed (20 here), and repeated diagnostics flood the bounded log. Started in parallel in worktree `FinalToken-wt\1-finaltoken-v1-ui` (sub-branch `1-finaltoken-v1-ui`, merged back by the coordinator): - **W2** desktop app, `gpt-6.1-sol` high. - **W3** Stream Deck plugin, installer and packaging, `gpt-6.1-sol` xhigh. W3 will install the plugin into the local Stream Deck 7.0.3 to check registration.
Author
Owner

W3 (Stream Deck) verified and committed on the sub-branch as 084ac97 (+ 04d187c, executable bit): SDK-v2 NativeAOT plugin with six SVG metrics and a local property inspector, transactional installer for Elgato Stream Deck and OpenDeck (native and Flatpak), and tools/publish.py.

W3's evidence: 130/130 tests on the shared tree; publish.py win-x64 with 0 warnings (plugin 6.8 MB); a real install and update into the local Stream Deck 7.0.3, whose log shows Plugin 'de.finalfactory.finaltoken' connected. Not verified: OpenDeck on Linux and pressing a physical key.

Follow-ups for the integration round:

  • Snapshot.AppPath defaults to the reading process's own path, and the CLI writes its own path. A key press can therefore start the wrong program. The engine should take the app path from its host and keep it across CLI refreshes.
  • FinalToken.exe (app) and finaltoken.exe (CLI) collide on Windows file systems. Rename the CLI assembly instead of renaming it in publish.py.
  • W3's test restarted Stream Deck from a harness with a temporary FINALTOKEN_DATA_DIR in its environment. The coordinator restarts it normally during integration.
**W3 (Stream Deck) verified and committed** on the sub-branch as `084ac97` (+ `04d187c`, executable bit): SDK-v2 NativeAOT plugin with six SVG metrics and a local property inspector, transactional installer for Elgato Stream Deck and OpenDeck (native and Flatpak), and `tools/publish.py`. W3's evidence: 130/130 tests on the shared tree; `publish.py win-x64` with 0 warnings (plugin 6.8 MB); a real install and update into the local Stream Deck 7.0.3, whose log shows `Plugin 'de.finalfactory.finaltoken' connected`. Not verified: OpenDeck on Linux and pressing a physical key. Follow-ups for the integration round: - `Snapshot.AppPath` defaults to the reading process's own path, and the CLI writes its own path. A key press can therefore start the wrong program. The engine should take the app path from its host and keep it across CLI refreshes. - `FinalToken.exe` (app) and `finaltoken.exe` (CLI) collide on Windows file systems. Rename the CLI assembly instead of renaming it in `publish.py`. - W3's test restarted Stream Deck from a harness with a temporary `FINALTOKEN_DATA_DIR` in its environment. The coordinator restarts it normally during integration.
Author
Owner

W1 store rework verified and committed: c2f97e9, with D5 updated in c633c2b.

Coordinator checks on Windows: dotnet build 0 warnings; dotnet test 111/111; AOT CLI publish 0 warnings; check_docs 0 errors.

Measured on this machine:

  • First import: 26 s (was 34 s).
  • An idle refresh on a frozen copy of the sources changes only snapshot.json (1,086 B); history files are untouched.
  • W1's measurements: today and week totals match the old store exactly; panel queries take under 21 ms cold and under 0.4 ms warm.
**W1 store rework verified and committed:** `c2f97e9`, with D5 updated in `c633c2b`. Coordinator checks on Windows: `dotnet build` 0 warnings; `dotnet test` 111/111; AOT CLI publish 0 warnings; check_docs 0 errors. Measured on this machine: - First import: 26 s (was 34 s). - An idle refresh on a frozen copy of the sources changes only `snapshot.json` (1,086 B); history files are untouched. - W1's measurements: today and week totals match the old store exactly; panel queries take under 21 ms cold and under 0.4 ms warm.
Author
Owner

W2 (desktop app) verified and committed. Merged into 1-finaltoken-v1 as 183247b (pushed), together with W3's work.

Coordinator checks on the merged tree:

  • dotnet build: 0 warnings.
  • dotnet test: 152/152 (Core 112, CLI 7, Stream Deck 19, App 14).
  • check_docs: 0 errors.
  • tools/publish.py win-x64: 0 warnings, about 45 MB with the plugin folder.
  • The published app shows the panel with this machine's real data. A native PrintWindow capture is in the runs folder.

Verification found these; W1 integration round started (xhigh):

  1. Bug: Claude's limit probe returns nothing when the GUI app hosts the engine. Claude shows "Unavailable". The CLI on the same data directory probes Claude fine.
  2. The /usage parser reports 16 diagnostics per probe for the expected "What's contributing" section.
  3. Bug: appPath in the snapshot (the reader's own path as the default, and the CLI's path after a CLI refresh).
  4. CLI assembly renamed to finaltoken-cli, because FinalToken.exe and finaltoken.exe collide on Windows.
  5. Day series in local days to match "Today".
  6. Remove the dev-only legacy store migration.
  7. A user README.

A Linux package build and an app start under Xvfb in an Arch container are running in parallel.

**W2 (desktop app) verified and committed.** Merged into `1-finaltoken-v1` as `183247b` (pushed), together with W3's work. Coordinator checks on the merged tree: - `dotnet build`: 0 warnings. - `dotnet test`: 152/152 (Core 112, CLI 7, Stream Deck 19, App 14). - check_docs: 0 errors. - `tools/publish.py win-x64`: 0 warnings, about 45 MB with the plugin folder. - The published app shows the panel with this machine's real data. A native PrintWindow capture is in the runs folder. Verification found these; **W1 integration round** started (xhigh): 1. **Bug:** Claude's limit probe returns nothing when the GUI app hosts the engine. Claude shows "Unavailable". The CLI on the same data directory probes Claude fine. 2. The `/usage` parser reports 16 diagnostics per probe for the expected "What's contributing" section. 3. **Bug:** `appPath` in the snapshot (the reader's own path as the default, and the CLI's path after a CLI refresh). 4. CLI assembly renamed to `finaltoken-cli`, because `FinalToken.exe` and `finaltoken.exe` collide on Windows. 5. Day series in local days to match "Today". 6. Remove the dev-only legacy store migration. 7. A user README. A Linux package build and an app start under Xvfb in an Arch container are running in parallel.
Author
Owner

Integration status (branch at 15c7e68, pushed). Commits since the last note:

  • 50ac2aa: GUI Claude probe fix and other integration fixes.
  • 4f4ed5f: decisions updated.
  • 5c5973a: popup dates and chart ticks.
  • 15c7e68: one version source, 1.0.1.

Verified by the coordinator:

  • Windows (published 1.0.1 package):
    • The panel shows real data for both providers: Claude with three windows, Codex week.
    • The app path is correct, and a second start activates the first and exits in 1.0 s.
    • Real pace popups ("Claude · Ahead … 100% at 16.10.2026 09:17") stack at the bottom right.
  • R7 on the local Stream Deck 7.0.3, Automatic mode:
    • The app replaced the stale test plugin 1.0.0.1 with 1.0.1.0 and restarted Stream Deck.
    • Stream Deck logs Plugin 'de.finalfactory.finaltoken' connected, and the plugin logs registered.
    • The app showed "Plugin installed successfully."
    • In Ask mode, the "Version 1.0.1.0 is ready — Update / Not now" popup showed.
  • Linux (Arch container, distro SDK 10.0.112, Xvfb):
    • Build 0 warnings and 161/161 tests on 4f4ed5f.
    • publish.py linux-x64 works.
    • The CLI and the app parse a frozen copy of real Claude and Codex data and render the panel on X11.
  • Tests: 174/174 on 15c7e68 in 3 runs; W1 reports 20 runs with 0 failures. One unexplained failure of 1 in 173 was seen once and not reproduced.

Bug found during the R7 check; W1 is fixing it: a settings.json that lacks any property falls back entirely to defaults. Every future release that adds a setting would silently reset all user settings.

**Integration status** (branch at `15c7e68`, pushed). Commits since the last note: - `50ac2aa`: GUI Claude probe fix and other integration fixes. - `4f4ed5f`: decisions updated. - `5c5973a`: popup dates and chart ticks. - `15c7e68`: one version source, 1.0.1. Verified by the coordinator: - **Windows (published 1.0.1 package):** - The panel shows real data for both providers: Claude with three windows, Codex week. - The app path is correct, and a second start activates the first and exits in 1.0 s. - Real pace popups ("Claude · Ahead … 100% at 16.10.2026 09:17") stack at the bottom right. - **R7 on the local Stream Deck 7.0.3, Automatic mode:** - The app replaced the stale test plugin 1.0.0.1 with 1.0.1.0 and restarted Stream Deck. - Stream Deck logs `Plugin 'de.finalfactory.finaltoken' connected`, and the plugin logs `registered`. - The app showed "Plugin installed successfully." - In Ask mode, the "Version 1.0.1.0 is ready — Update / Not now" popup showed. - **Linux (Arch container, distro SDK 10.0.112, Xvfb):** - Build 0 warnings and 161/161 tests on `4f4ed5f`. - `publish.py linux-x64` works. - The CLI and the app parse a frozen copy of real Claude and Codex data and render the panel on X11. - Tests: 174/174 on `15c7e68` in 3 runs; W1 reports 20 runs with 0 failures. One unexplained failure of 1 in 173 was seen once and not reproduced. **Bug found during the R7 check; W1 is fixing it:** a `settings.json` that lacks any property falls back entirely to defaults. Every future release that adds a setting would silently reset all user settings.
schmidt.florian removed the model/gpt-6.1-sol label 2026-10-14 21:24:28 +02:00
Author
Owner

PR #2 opened: #2 (head 9f33dd8). All Codex worker threads have finished and are settled, so model/gpt-6.1-sol is removed. A fresh claude-opus-5-5 reviewer at high effort runs per docs/agents/review.md.

**PR #2 opened**: https://git.finalfactory.de/FinalFactory/FinalToken/pulls/2 (head `9f33dd8`). All Codex worker threads have finished and are settled, so `model/gpt-6.1-sol` is removed. A fresh `claude-opus-5-5` reviewer at high effort runs per `docs/agents/review.md`.
schmidt.florian added the model/gpt-6.1-sol label 2026-10-14 21:31:11 +02:00
Author
Owner

First agent review of PR #2: fail. It has 3 blocking findings (review comment on the PR):

  1. A Codex RPC error stops the refresh loop.
  2. Totals throws in zones where local midnight does not exist.
  3. Daily chart labels show UTC dates.

The coordinator checked all three against the code.

Rework: W1 (gpt-6.1-sol, xhigh) in thread ft1-w1-foundation, with failing tests first. It also takes four of the review notes: Claude installed with npm on Windows, the plugin crashing on a bad frame, XDG_CONFIG_HOME for autostart, and removing the unused stub and worker names. Deferred: scan-cursor pruning and query speed with a provider filter.

**First agent review of PR #2: fail.** It has 3 blocking findings (review comment on the PR): 1. A Codex RPC error stops the refresh loop. 2. `Totals` throws in zones where local midnight does not exist. 3. Daily chart labels show UTC dates. The coordinator checked all three against the code. Rework: W1 (`gpt-6.1-sol`, xhigh) in thread `ft1-w1-foundation`, with failing tests first. It also takes four of the review notes: Claude installed with npm on Windows, the plugin crashing on a bad frame, `XDG_CONFIG_HOME` for autostart, and removing the unused stub and worker names. Deferred: scan-cursor pruning and query speed with a provider filter.
schmidt.florian removed the model/gpt-6.1-sol label 2026-10-14 21:50:21 +02:00
Author
Owner

Agent review of PR #2 passed on fd30dfc (second review); the agent-review status is success. The PR is ready to squash-merge, which is the developer's call.

Final checks on fd30dfc:

  • Windows: build 0 warnings; 224/224 tests in 3 runs; check_docs 0 errors.
  • Linux (Arch container): build 0 warnings; 224/224; publish.py linux-x64 0 warnings.

Deferred notes from the reviews, not part of this PR:

  • Prune scan cursors for deleted source files.
  • Speed up the per-point model queries under a provider filter.
  • Back off when a refresh keeps failing; it currently retries every second.
  • The daily tooltip shows 00:00; a date-only format would read better.
  • Check the npm Claude Code layout on Windows against a real install.

Not verified: a real CachyOS KDE/XWayland session, OpenDeck on Linux, a physical key press, Windows autostart.

Machine state: Stream Deck runs normally (started from Explorer) with plugin 1.0.1.0 installed. No FinalToken process is left running.

All agent work is finished; the agent labels are removed.

**Agent review of PR #2 passed** on `fd30dfc` (second review); the `agent-review` status is success. The PR is ready to squash-merge, which is the developer's call. Final checks on `fd30dfc`: - **Windows:** build 0 warnings; 224/224 tests in 3 runs; check_docs 0 errors. - **Linux (Arch container):** build 0 warnings; 224/224; `publish.py linux-x64` 0 warnings. Deferred notes from the reviews, not part of this PR: - Prune scan cursors for deleted source files. - Speed up the per-point model queries under a provider filter. - Back off when a refresh keeps failing; it currently retries every second. - The daily tooltip shows `00:00`; a date-only format would read better. - Check the npm Claude Code layout on Windows against a real install. Not verified: a real CachyOS KDE/XWayland session, OpenDeck on Linux, a physical key press, Windows autostart. Machine state: Stream Deck runs normally (started from Explorer) with plugin `1.0.1.0` installed. No FinalToken process is left running. All agent work is finished; the agent labels are removed.
schmidt.florian removed the status/in-progressagent/florianmodel/claude-opus-5-5 labels 2026-10-14 21:53:32 +02:00
Sign in to join this conversation.