Skip to content

Clarify missing Claude quota data outside the account usage card #700

Open

Description

@jeromeetienne

Request

When Heidrun has no Claude quota information, the interface should identify which figures are unavailable and where they are expected to come from. It should not make the status sound like no Claude usage occurred.

Keep the account usage card unchanged. Put any explanation of the missing quota status outside that card.

The attached image shows the context for this request.

Quota status wording under discussion

Activity

  1. jeromeetienne commented on Oct 19, 2026

    @jeromeetienne
    ContributorAuthor

    Ways to get the quota on demand

    Each coding agent has a command that returns the live account quota at any time. The figures come from the provider, so they are there even when the agent was not used for months. Each command spends no tokens. Tested on 19 October 2026, on macOS, with Codex 0.163.0, Claude Code 2.1.302, and the Antigravity command line agy.

    Coding agent Command Time Output
    Codex codex app-server, then the JSON-RPC requests initialize and account/rateLimits/read on standard input 1.0 seconds JSON: rateLimits.primary.usedPercent, windowDurationMins, resetsAt (Unix seconds), planType
    Claude Code claude -p "/usage" --output-format json 3.8 seconds JSON, but the figures are text in the field result, for example "Current session: 6% used · resets Oct 19 at 5:29am (Europe/Paris)"
    Antigravity agy -p "/usage" --output-format json 2.7 seconds JSON: command.data.groups[].buckets[] with id, remaining_fraction, and reset_time (ISO 8601)

    Codex: reuse of a running server

    When a Codex server already runs, a program can ask it without starting a new process. On this computer, a managed Codex server (codex app-server --listen unix:// --managed-daemon) listens on the socket file ~/.codex/app-server-control/app-server-control.sock. The command codex app-server proxy connects to it. The socket speaks WebSocket, so the program sends a WebSocket handshake first. Plain JSON lines get no answer. With the handshake, the answer came in 0.5 seconds. When the socket file is missing, the program starts codex app-server for one question.

    Warning: claude -p fills the chat history

    Each run of claude -p "/usage" writes a chat session file in ~/.claude/projects/. A refresh every 5 minutes would add 288 empty chats each day to the Past chats sidebar section. This is not acceptable. The option --no-session-persistence of Claude Code should stop the file, but this is not tested.

    Other points

    • The text of Claude Code has no year and uses the local time zone, and a new version of Claude Code can change the wording at any time.
    • agy -p "/usage" returned an empty conversation_id. It is not checked whether it writes a file in ~/.gemini/antigravity-cli/conversations.
    • The Codex hooks and the Codex option notify do not receive the quota figures, so a Codex status line script is not possible. Sources: Codex configuration reference, Codex hooks guide.
  2. jeromeetienne commented on Oct 19, 2026

    @jeromeetienne
    ContributorAuthor

    Plan of the developer, and review

    Plan

    1. Heidrun gets the quota of each coding agent with the commands of the previous comment.
    2. Heidrun refreshes the figures every 5 minutes. A figure that is exact to the second is not needed.
    3. In the section "Coding agents" of the Settings window, the option "Monitor account quota" covers every coding agent that is on. The separate option "Track Antigravity quota" goes away: there is no option for Claude or for Codex, so Antigravity must not be the only one with an option.
    4. Heidrun shows the quota of each coding agent that is on in the status bar.

    Review (not decided yet)

    • Chat history: claude -p "/usage" writes a chat session file each time. This must be solved before the plan is built. Test --no-session-persistence first.
    • Keep the status line scripts: the scripts claude-statusline.sh and antigravity-statusline.sh also send the context window usage of each pane, which the usage wheel in the pane header shows. Without them, the Claude and Antigravity panes lose that wheel. The commands replace only the quota. The script can be installed by "Monitor account quota" for Antigravity, as it is for Claude today, so the settings stay the same for every coding agent.
    • Claude Code output is text: Heidrun must read sentences such as "resets Oct 19 at 5:29am", with no year. A new version of Claude Code can break this.
    • Refresh at start: also refresh when Heidrun starts, so the figures are there at once.
  3. jeromeetienne commented on Oct 19, 2026

    @jeromeetienne
    ContributorAuthor

    How Heidrun gets the quota and the context window today

    Claude Code

    • Heidrun copies claude-statusline.sh to ~/.config/heidrun/, and sets the option statusLine in ~/.claude/settings.json to run it. The code is in claude.rs. The option "Monitor account quota" installs it.
    • After each answer, Claude Code runs the script and gives it JSON on standard input: rate_limits.five_hour, rate_limits.seven_day, and context_window.used_percentage.
    • The script sends these figures to Herdr with herdr pane report-metadata, as the pane values hd_q5h, hd_q7d, and hd_ctx. Herdr sends an event, and Heidrun reads the values of the pane. There is no timer.
    • Heidrun keeps the newest quota figures in the local storage of the web page, so a restart starts from the last known figures.
    • No figures arrive before the first answer of a session, or when the script is not installed. The status bar then says "Claude quota: unspecified".

    Antigravity

    • Heidrun copies antigravity-statusline.sh to ~/.config/heidrun/, and sets the option statusLine in ~/.gemini/antigravity-cli/settings.json. The code is in antigravity.rs. The separate option "Track Antigravity quota" installs it.
    • After each answer, Antigravity runs the script with quota and context_window on standard input. The script sends them to Herdr as hd_agy_* and hd_agy_ctx. Heidrun reads them in the same way as for Claude, and keeps the newest quota in the local storage.

    Codex

    • Codex has no status line command, so there is no script. Codex writes its figures in its session log files, ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl, in the token_count events: rate_limits.primary, rate_limits.secondary, and info.model_context_window.
    • Heidrun reads the end of the 12 newest log files every 10 seconds, with a timer. The code is in usage.rs. Herdr gives only the Codex session identifier of each pane, which Heidrun uses to find the context window of that pane.
    • Heidrun ignores a log file that has not changed in the last 8 days. When Codex was not used in the last 8 days, there are no figures, and the card says "No data yet". The figures are not kept after a restart.

    The code that combines the three sources for the web page is in session.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions