How manankapoor23/claudget works
Purpose and Entry Points
claudget is a local desktop monitor for Claude Code usage: transcript-derived token/cost analytics plus optional official plan-limit polling. The primary app starts in Electron main at packages/desktop/src/main/index.ts; its renderer starts at packages/desktop/src/renderer/main.tsx. Framework-independent usage logic is exported from packages/core/src/index.ts.
Core Data Engine
The core package owns discovery, parsing, normalization, pricing, aggregation, and refresh orchestration without Electron or React dependencies. packages/core/src/engine.ts coordinates snapshots; packages/core/src/discover.ts locates Claude project transcripts; packages/core/src/parse.ts reads JSONL content. It treats local Claude data as read-only and supports an overridden Claude directory.
Local Analytics Pipeline
Transcript events flow from filesystem discovery into parsed usage records, then aggregation into totals, model splits, session blocks, burn rate, hourly history, and estimated cost. packages/core/src/aggregate.ts is the analytical boundary, while packages/core/src/pricing.ts applies bundled or overridden pricing from packages/core/src/pricing.data.ts. File watching and periodic rescans are managed by packages/core/src/watch.ts, so UI consumers receive refreshed snapshots rather than raw filesystem events.
Official Usage and Credentials Boundary
Official plan usage is isolated from local analytics. packages/core/src/credentials.ts obtains the Claude Code OAuth credential from platform storage; packages/core/src/official/client.ts calls Anthropic’s usage endpoint; packages/core/src/official/normalize.ts turns endpoint responses into internal data. This path reaches api.anthropic.com, is configurable/disableable, rate-limited with backoff, and can retain cached values when unavailable.
Desktop Process Architecture
Electron main owns privileged OS integration and lifecycle: window creation in packages/desktop/src/main/window.ts, tray and global controls in packages/desktop/src/main/tray.ts, and config persistence in packages/desktop/src/main/config-store.ts. packages/desktop/src/main/ipc.ts exposes controlled operations to the UI, while packages/desktop/src/preload/index.ts provides the renderer’s narrowed bridge. Budget threshold evaluation and native notifications reside in packages/desktop/src/main/budget-alerts.ts.
Renderer and Presentation
The React renderer consumes IPC-backed snapshot/config state through packages/desktop/src/renderer/store.ts and packages/desktop/src/renderer/lib/api.ts. packages/desktop/src/renderer/App.tsx selects dashboard, compact, and settings views. Domain panels such as packages/desktop/src/renderer/components/LocalPanel.tsx, packages/desktop/src/renderer/components/OfficialPanel.tsx, and packages/desktop/src/renderer/components/BudgetPanel.tsx keep local metrics, remote limits, and alerts visually distinct.
Runtime, Packaging, and Website
The monorepo uses Node/npm workspaces, TypeScript, tsup for core builds, Electron/Vite for the desktop runtime, and electron-builder packaging defined by packages/desktop/electron-builder.yml. Release automation is in .github/workflows/release.yml, targeting macOS universal DMG, Windows installers/portable builds, and Linux AppImage. The independent marketing site is a Next.js application rooted at website/app/page.tsx, with release metadata handling in website/app/lib/release.ts.
Main entry points: engine.ts Snapshot engine · main/index.ts Electron main · src/index.ts Core exports · discover.ts Transcript discovery
Components 25
Core analytics
Framework-independent usage engine.
- Core exports
packages/core/src/index.ts - Snapshot engine · Coordinates analytics and refreshed snapshots.
packages/core/src/engine.ts - Transcript discovery · Supports an overridden Claude directory.
packages/core/src/discover.ts - JSONL parser
packages/core/src/parse.ts - Usage aggregation · Produces totals, model splits, sessions, burn rate, and history.
packages/core/src/aggregate.ts - Pricing engine · Uses bundled or overridden pricing data.
packages/core/src/pricing.ts - Bundled pricing
packages/core/src/pricing.data.ts - Watch and rescan · Publishes refreshed snapshots rather than raw file events.
packages/core/src/watch.ts - OAuth credentials · Reads Claude Code OAuth credentials from platform storage.
packages/core/src/credentials.ts - Official usage client · Rate-limited polling with backoff and cached values.
packages/core/src/official/client.ts - Official usage normalize
packages/core/src/official/normalize.ts
Desktop runtime
Electron main, bridge, and React UI.
- Electron main · Privileged desktop lifecycle entry point.
packages/desktop/src/main/index.ts - Window and tray · Creates windows, tray, and global controls.
packages/desktop/src/main/window.ts - Config and budget alerts · Persists config and issues native threshold notifications.
packages/desktop/src/main/budget-alerts.ts - Controlled IPC
packages/desktop/src/main/ipc.ts - Preload bridge · Narrows renderer access to main-process operations.
packages/desktop/src/preload/index.ts - React renderer
packages/desktop/src/renderer/main.tsx - Snapshot and config state · Consumes IPC-backed state.
packages/desktop/src/renderer/store.ts - Dashboard and panels · Separates local metrics, official limits, and budget alerts.
packages/desktop/src/renderer/App.tsx
Delivery
Packaging, release automation, and marketing site.
- Desktop packaging · Defines desktop distribution artifacts.
packages/desktop/electron-builder.yml - Release workflow · Builds macOS, Windows, and Linux releases.
.github/workflows/release.yml - Marketing site · Independent product website.
website/app/page.tsx - Release metadata
website/app/lib/release.ts
Other components
- Claude transcripts · Read-only Claude Code project data.
- Anthropic usage API · Optional official plan-limit endpoint.
Connections 25
- Core exports → Snapshot engine: exports
- Claude transcripts → Transcript discovery: scanned
- Transcript discovery → JSONL parser: transcript files
- JSONL parser → Usage aggregation: usage records
- Bundled pricing → Pricing engine: rates
- Usage aggregation → Pricing engine: usage totals
- Watch and rescan → Snapshot engine: refreshes
- Snapshot engine → Transcript discovery: coordinates
- Snapshot engine → Usage aggregation: builds snapshot
- OAuth credentials → Official usage client: OAuth credential
- Official usage client → Anthropic usage API: polls
- Anthropic usage API → Official usage normalize: usage response
- Official usage normalize → Snapshot engine: official limits
- Electron main → Window and tray: owns
- Electron main → Controlled IPC: exposes operations
- Electron main → Config and budget alerts: runs
- Core exports → Electron main: analytics snapshots
- Controlled IPC → Preload bridge: approved API
- Preload bridge → Snapshot and config state: IPC-backed state
- React renderer → Snapshot and config state: initializes
- Snapshot and config state → Dashboard and panels: snapshot and config
- Core exports → Config and budget alerts: usage totals
- Desktop packaging → Release workflow: build configuration
- Release workflow → Release metadata: release data
- Release metadata → Marketing site: displayed by