Repository navigation
docs(legal): say that app.fctl.sh keeps Claude plan usage - #10
Merged
Merged
Conversation
app.fctl.sh now keeps how much of each Claude plan's usage limits is used, as sessions last report it (hyperstructure/fctl#6): what it stores, how long, and that the export includes it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kalaspuff
pushed a commit
to hyperstructure/fctl
that referenced
this pull request
Oct 18, 2026
…#58) People can now see how much of their Claude plan is left before they start work. Sessions already report Claude's `rate_limit_event`s; fctl now keeps the latest reading of each plan limit per Claude connection and shows it under each connection in Settings → Claude, in one line under the task box on the floor (for the connection new sessions use), and in `fctl claude status`. Fixes #6 ## What happens 1. **Claude reports it.** Claude Code writes a `rate_limit_event` when a limit's status changes. Recent versions also write one whenever the five-hour or weekly window moves by a percent, with `rate_limit_info.unifiedWindows` (`five_hour`, `seven_day`, each with `utilization` and `resetsAt`) beside the top-level `rateLimitType`, `status`, `utilization` and `resetsAt` of the limit closest to stopping requests. I took the shape from the schema in Claude Code 2.1.302. fctl-agent already passes these messages on as events, so hosts and agents don't change. 2. **SessionDO turns each into readings** (`fctl_domain::usage::readings`): one per limit (the five-hour window, the week, a model's own weekly limit), with the share used, when it resets, and Claude's status for the limit it names. Paid extra usage (`overage`) is not a plan limit, so it is left out. The event comes from the sandbox, so odd values are dropped (names other than `[a-z0-9_]{1,40}`, shares outside 0 to 10, times that aren't positive), and one event adds at most eight limits. 3. **D1 keeps the latest per credential** (`claude_usage`, migration 0008). Each credential has one row per limit, written for the credential the session runs on now (a resumed session runs on the resumer's). A reading replaces the row only if it arrived later. Removing a connection or deleting the account deletes the rows (`ON DELETE CASCADE`). 4. **People see it.** `/auth/me` returns the readings on each credential (`ClaudeCredentialInfo.usage`, a subquery in the query that already loads credentials). FleetDO sends a `claude_usage` feed message to the owner's open apps, so Settings and the floor update while sessions run. Readings change only while sessions run, so the apps say when a session last reported them. A window whose reset time has passed shows as started over instead of keeping its old share. A limit counts as close from 80 % or when Claude warns, and as used up at 100 % or when Claude rejects requests. Why use what sessions report instead of asking Anthropic: it is what the issue asks for, it makes no extra calls with people's tokens, and it works for both kinds of connection (a long-lived token can't read claude.ai's usage endpoint). ## Web app - **Settings → Claude**: under each connection, one meter per limit with "42% used · resets at 3:40 PM" (amber when close, pink when used up) and "Reported by a session 3 minutes ago". A connection without readings says it gets them once a session runs on it. - **The floor**: under the task box, "Claude plan · 5-hour 8% · Weekly 37%" with small meters, for the default connection and linking to Settings. When a limit is used up: "Your 5-hour limit is used up. Sessions you start now pause until it resets at 3:40 PM." When it is close: "84% of your 5-hour limit is used. It resets at 3:40 PM." - The meters re-render every minute, so a window that resets while the page is open shows it. The feed patches the `me` query; no new socket. ## CLI `fctl claude status` prints the limits under each connection; `--json` now includes `usage`: ``` ● fake-claude · setup_token · inference only 5-hour limit 8% used, resets in 4h 50m Weekly limit 37% used, resets in 3d 19h reported by a session just now ``` At a limit, the line reads `5-hour limit limit reached, resets in 1m`; once the window passes, `5-hour limit started over just now`. ## Also - The account export has a `claude_plan_usage` section. - fake-claude reports usage on every turn except `limit` and `crash`, the way Claude Code does. The windows follow the clock, so every session reports the same numbers and `cargo xtask dev` shows them. - Docs: a Plan usage section in architecture.md, plus getting-started.md, cli.md and development.md. ROADMAP ticks #6. - Privacy: app.fctl.sh now stores plan usage, so hyperstructure/fctl-site#10 adds it to the privacy policy (what is stored, how long, and that the export includes it). Merge the two together. ## Compatibility - Additive only: `ClaudeCredentialInfo.usage` is optional, `PlanLimit` and `LimitStatus` are new, and the `claude_usage` feed message goes only to the web app, whose older tabs ignore it. Hosts and agents need no update. - Deploying applies D1 migration `0008_claude_usage.sql` (`cargo xtask deploy` applies migrations first). No Durable Object binding or migration tag changes. ## Verification - `cargo xtask check` passes: fmt, generated types, Biome and TypeScript, Clippy (native and wasm), every Rust and web test, and the production web build. - New tests: `fctl_domain::usage` (10): the 2.1.302 shape, the older top-level-only shape, a limit reached without a share, overage and bare statuses ignored, odd values dropped, the eight-limit cap, rows as D1 returns them, labels, standings and merging. `web/src/lib/usage.test.ts` (5): labels, standings, meter fill, which limit to warn about, reset phrases. - End to end with `cargo xtask dev`: - A session's first turn stored `five_hour` 7 % and `seven_day` 37 % for its credential, and `fctl claude status` showed them. - `limit` gave "limit reached, resets in 1m" and paused the session. After the reset, the limit showed "started over". - With the floor open in Chromium (Playwright), starting a `limit` session changed the strip to "used up" and showed the sentence 312 ms later, without a reload. - A session on a second credential stored its readings on that one only. Removing the credential deleted its rows (checked in local D1), and the export lists the rest with ISO times. ## Screenshots I took them at 8ef3fd4 against `cargo xtask dev` with fake-claude, with `main` (012337e) on the same control plane for the before shots. This session can't attach them: `gh pr edit --attach` answers "unsupported authentication type" with the GitHub App's token (#40). They are in the session (https://app.fctl.sh/s/ses_01M56GBDBASVNSG4VJ7A671F4K). What they show: - **Floor, light, before and after.** After adds one quiet line under the task box: "Claude plan", then "5-hour" with a short meter and "8%", then "Weekly" with a meter and "37%". Nothing else on the page moves. - **Floor, dark.** The same line in `ink-3`, readable but quieter than the task box. - **Floor with the 5-hour limit used up, light and at 390 px dark.** The 5-hour meter fills in pink and says "used up". Under it, in pink: "Your 5-hour limit is used up. Sessions you start now pause until it resets at 04:12 AM." At 390 px the line wraps after the 5-hour meter, with the sentence below. - **Settings → Claude, light, before and after.** After adds, under the connection's row and aligned with its name: "5-hour limit", a meter, and "8% used · resets at 09:00 AM"; "Weekly limit", a meter, and "37% used · resets Thu at 12:00 AM"; then "Reported by a session just now". The section's description gains one sentence. - **Settings → Claude at 390 px, dark.** Each limit's detail moves under its meter. The 5-hour window shows "Started over just now" with an empty meter, because its reset had passed. Session: https://app.fctl.sh/s/ses_01M56GBDBASVNSG4VJ7A671F4K --------- Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <[email protected]>
kalaspuff
deleted the
fctl/23-look-into-https-github-com-hyperstructur
branch
October 18, 2026 11:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
app.fctl.sh now keeps how much of each Claude plan's usage limits is used, as sessions last report it (hyperstructure/fctl#6). The privacy policy says so:
Nothing new reaches anyone else: the readings come from sessions' own Claude output, and fctl asks Anthropic for nothing more.
updatedstays 2026-10-18, which is today.Merge it with hyperstructure/fctl#58, which starts storing the data.
Session: https://app.fctl.sh/s/ses_01M56GBDBASVNSG4VJ7A671F4K