Documentation
¶
Overview ¶
Package desktop reads the plan-usage history the Claude desktop app keeps on disk, so the dashboard can say whether your plan limits were spent somewhere other than Claude Code.
What this can and cannot tell you is the whole design constraint. The file holds nothing but a timestamp and two percentages — the five-hour and seven-day plan windows. There are no tokens, no cost, and no conversation content, so this can never say what the desktop app *cost*; it can only say how much of a window it consumed. Presenting it as anything more would be an invented number (engineering rule 6).
It is also written only while the app is running: on a real machine that meant 27 samples in a day where a five-minute interval would give ~290. So the reading is reported with its age, and a stale one says so rather than implying the number is current.
Nothing is stored. This is read on request, from a file the user's own machine already has — no new outbound call, no new database table.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrUnavailable means there is no readable history — the app is not installed, has never run, or keeps its data somewhere this build does not know about. It is not a failure: most users do not use the desktop app at all.
var Now = time.Now
Now is indirected for tests.
Functions ¶
This section is empty.
Types ¶
type Reading ¶
type Reading struct {
// FiveHourPct and SevenDayPct are percentages of each plan window, 0-100.
FiveHourPct int `json:"five_hour_pct"`
SevenDayPct int `json:"seven_day_pct"`
// At is when the app took the sample (unix ms).
At int64 `json:"at"`
// Stale is true when the sample is old enough that it likely predates the
// app being closed, so the figure describes the past rather than now.
Stale bool `json:"stale"`
}
Reading is the most recent plan-usage sample the desktop app recorded.