Repository navigation
Conversation
Grok is already a first-party default agent, but the panel only shows subscriptions that have an omarchy-agent-usage-* collector. This adds the missing Grok one: local turn_completed stats from GROK_HOME/sessions, plus the weekly SuperGrok credit pool from the same billing endpoint as Grok's own /usage modal.
|
Could these billing percentage fields always be divided by 100, with regression cases at 0, 0.5, 1, 1.01 and 100? If another payload format uses fractions, that needs an explicit schema distinction rather than guessing from the value. |
|
Thanks, this was a valuable reference. Grok landed in the agents panel with #13992: its plan, the weekly credits meter from the same billing endpoint (showing 0% with the reset when |
Each Grok session keeps a usage.json, the ledger `grok usage` prints, with every finished turn's end time and tokens by model. The collector now reads it for tokens today, by day for the last week, and by model, with cached input kept apart, and counts today's prompts by the turns that ended today. Found in #12352's research. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…k through mise (#14004) * Let the agents in the panel be put in any order Drag an agent by its mark to move its section; the header it will land on lights up, and the move happens on release. Each agent's header is now a keyboard stop with its own highlight, and Ctrl+Up/Down moves the agent the cursor is in. The order is kept in agents/order.json beside the usage records. The key catcher turns Ctrl+Up/Down into a reorder only for panels that opt in. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Light only an agent's mark when the cursor or a drag is on it The mark is the handle the agent moves by, so the keyboard cursor and the drop spot while dragging box it alone rather than the header line. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Keep a lit agent mark's box from being clipped at the panel's edge The box overhangs the content's left edge, which the scrolling area clipped. The scrolling area now reaches a little into the panel's padding with the content shifted back, so nothing moves and the box draws whole. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Reuse a Grok session scan only on the day it was made A limits-only refresh just after midnight reused a scan from the evening before, which counted yesterday's sessions as today's. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Keep Ctrl+Up/Down from moving an agent when the cursor is outside one The hero's buttons and the starter tiles carry indices too, and the lookup read them as accounts, so with several accounts Ctrl+Up/Down on one of them moved an unrelated agent. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Report a failed mise update even after the Grok upkeep runs The Grok block ran after `mise up` and its last command set the script's status, so a failed tool update could read as a success to callers that warn about it. The update's own status is now the script's. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Unpack a Grok update into ~/.grok whatever GROK_HOME says The upkeep replaces ~/.grok's link, but the npm launcher unpacks into GROK_HOME when it's set, so with a custom home the link never came back at the new release and the old one was restored. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Hold off reordering agents while an account name is being edited Ctrl+Up/Down reached the key catcher during an inline rename, and moving the agent rebuilt its section, dropping the unfinished name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Install Grok through mise's first-party package The npm launcher keeps an old ~/.grok/bin binary because mise skips its postinstall. Use mise's grok tool, and drop the npm tool so its shim does not stay ahead of the stub. * Drop the npm Grok workarounds now that mise installs Grok itself With Grok installed through mise's first-party package, the CLI is the binary mise manages, so the update upkeep that repointed ~/.grok/bin and the shared bin directory for added Grok accounts have nothing left to do. omarchy-update-mise is back to running mise up and nothing else, and adding a first Grok account installs the same package. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Count Grok's tokens and prompts from its usage ledger Each Grok session keeps a usage.json, the ledger `grok usage` prints, with every finished turn's end time and tokens by model. The collector now reads it for tokens today, by day for the last week, and by model, with cached input kept apart, and counts today's prompts by the turns that ended today. Found in #12352's research. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Count cache writes in Grok's daily token totals Grok's totalTokens leaves cache writes out while the per-model buckets count them, so a turn with cache writes added less to its day than to its model. The day's total is now the sum of those same buckets. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Remove the npm launcher's old Grok binaries when moving to mise's Grok Omarchy's npm wrapper ran the binary the launcher unpacked into ~/.grok/bin, where x.ai's installer also puts a copy with a PATH entry ahead of mise. Once the wrapper is replaced, a binary left there would keep shadowing the mise tool, so the migration removes it. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Jesse Miller <[email protected]>
…k through mise (omacom#14004) * Let the agents in the panel be put in any order Drag an agent by its mark to move its section; the header it will land on lights up, and the move happens on release. Each agent's header is now a keyboard stop with its own highlight, and Ctrl+Up/Down moves the agent the cursor is in. The order is kept in agents/order.json beside the usage records. The key catcher turns Ctrl+Up/Down into a reorder only for panels that opt in. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Light only an agent's mark when the cursor or a drag is on it The mark is the handle the agent moves by, so the keyboard cursor and the drop spot while dragging box it alone rather than the header line. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Keep a lit agent mark's box from being clipped at the panel's edge The box overhangs the content's left edge, which the scrolling area clipped. The scrolling area now reaches a little into the panel's padding with the content shifted back, so nothing moves and the box draws whole. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Reuse a Grok session scan only on the day it was made A limits-only refresh just after midnight reused a scan from the evening before, which counted yesterday's sessions as today's. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Keep Ctrl+Up/Down from moving an agent when the cursor is outside one The hero's buttons and the starter tiles carry indices too, and the lookup read them as accounts, so with several accounts Ctrl+Up/Down on one of them moved an unrelated agent. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Report a failed mise update even after the Grok upkeep runs The Grok block ran after `mise up` and its last command set the script's status, so a failed tool update could read as a success to callers that warn about it. The update's own status is now the script's. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Unpack a Grok update into ~/.grok whatever GROK_HOME says The upkeep replaces ~/.grok's link, but the npm launcher unpacks into GROK_HOME when it's set, so with a custom home the link never came back at the new release and the old one was restored. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Hold off reordering agents while an account name is being edited Ctrl+Up/Down reached the key catcher during an inline rename, and moving the agent rebuilt its section, dropping the unfinished name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Install Grok through mise's first-party package The npm launcher keeps an old ~/.grok/bin binary because mise skips its postinstall. Use mise's grok tool, and drop the npm tool so its shim does not stay ahead of the stub. * Drop the npm Grok workarounds now that mise installs Grok itself With Grok installed through mise's first-party package, the CLI is the binary mise manages, so the update upkeep that repointed ~/.grok/bin and the shared bin directory for added Grok accounts have nothing left to do. omarchy-update-mise is back to running mise up and nothing else, and adding a first Grok account installs the same package. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Count Grok's tokens and prompts from its usage ledger Each Grok session keeps a usage.json, the ledger `grok usage` prints, with every finished turn's end time and tokens by model. The collector now reads it for tokens today, by day for the last week, and by model, with cached input kept apart, and counts today's prompts by the turns that ended today. Found in omacom#12352's research. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Count cache writes in Grok's daily token totals Grok's totalTokens leaves cache writes out while the per-model buckets count them, so a turn with cache writes added less to its day than to its model. The day's total is now the sum of those same buckets. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Remove the npm launcher's old Grok binaries when moving to mise's Grok Omarchy's npm wrapper ran the binary the launcher unpacked into ~/.grok/bin, where x.ai's installer also puts a copy with a PATH entry ahead of mise. Once the wrapper is replaced, a binary left there would keep shadowing the mise tool, so the migration removes it. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Jesse Miller <[email protected]>
Why
Grok is already a first-party default coding agent (
omarchy default agent grok). The agents bar widget is not “every installed agent”: it only shows subscriptions that have anomarchy-agent-usage-*collector writing JSON into~/.local/state/omarchy/agents/usage/.omarchy-agent-usage-updatediscovers collectors by globbing$OMARCHY_PATH/bin/omarchy-agent-usage-*. Claude, Codex, and Fireworks ship one. Grok did not. On a machine whose default agent is Grok, Claude/Codex/Fireworks still appear (they have collectors) and Grok does not, even with weeks of local CLI history and a live SuperGrok allowance.This is the designed extension point from the widget README:
A marketplace plugin cannot register a collector. Discovery is
$OMARCHY_PATH/bin/omarchy-agent-usage-*only.Tracked as suggestion #7198. Related collector PRs: #6485, #7200, #6902, #8280, #8649, #9840, #9924, #10074, #11539. This one is from a live diagnosis on Omarchy 4.0.4 + Grok 1.0.34 (SuperGrok Plus): the panel already had Claude, Codex, and Fireworks tabs, and Grok was the missing fourth.
What the panel shows
Once
omarchy-agent-usage-grokhas writtengrok.json, the existing panel grows a Grok tab with:No QML changes. The panel already watches whatever records land in the usage directory. Optional
assets/grok.svg/grok-light.svgfrom the official Grok mark; the bar glyph still stands in without them.How the numbers are made
Local stats
From
$GROK_HOME/sessions(default~/.grok/sessions/<cwd>/<id>/):updates.jsonlrows withmethod_x.ai/session/update/session/updateandsessionUpdate: turn_completed. That is the same billed usagegrok usage <session-id>prints, includinginputTokens,outputTokens,cachedReadTokens,cacheCreationTokens, and per-model buckets.prompt_idis one prompt; a retried turn with the same id replaces the previous count rather than doubling it.subagents/directories are not walked, so parent totals are not counted twice.usage.jsonwhen a session has noturn_completedrows (older sessions).GROK_HOMEis honored the wayCODEX_HOMEis.Token charts are this machine's Grok CLI sessions only. Work on grok.com, the Grok app, or another computer does not appear. That is the same local-vs-account split Claude's transcripts have.
Limits and plan
From the same billing document Grok's own
/usagemodal uses, authenticated with the OAuth session in~/.grok/auth.json:GET https://cli-chat-proxy.grok.com/v1/billing?format=credits→creditUsagePercent(weekly pool),currentPeriod.end(reset),productUsage[GrokBuild].usagePercentGET https://cli-chat-proxy.grok.com/v1/user?include=subscription→subscriptionTier(SuperGrokPlus→ SuperGrok Plus,XPremiumPlus→ X Premium+)creditUsagePercentis returned on a 0–100 scale (10 means 10%). The panel meters are 0–1, so values greater than 1 are divided by 100. Values already in 0–1 are left alone.A failed or unreachable probe sets
retryAdvisedand still shows local token stats. Without a signed-in CLI the collector still prints valid JSON (ready: false,Waiting for auth) so the update runner has something to write.Deliberate omissions
prepaidBalance: { val: 0 }on SuperGrok. Publishing that asbalancedraws Fireworks' credit ledger and reads as “Prepaid credits $0.00” for a subscription that is neither prepaid nor empty. Zero prepaid is omitted.GrokBuildproduct slice is added, so the coding-agent tab does not mix in grok.com chat.auth.json. An expired access token is a retry, not a rewrite of the user's login files.Files
bin/omarchy-agent-usage-grokomarchy agent usage-updatealready globsomarchy-agent-usage-*)shell/plugins/agents/assets/grok.svg(+-lighttwin)shell/plugins/agents/manifest.jsongrokby default; mention it in the widget descriptionshell/plugins/agents/README.mdGROK_HOME, billing source, and providers examplemanual/17-ai.mdtest/shell.d/agent-usage-grok-scanner-test.shTest plan
bash test/shell.d/agent-usage-grok-scanner-test.sh— no credentials → hidden record; one count perprompt_id; nestedsubagents/skipped; exclusive token buckets +usage.jsonfallback; SuperGrok Plus label; weekly10→0.1; Grok Build slice only; zero prepaid omitted;XPremiumPlus→X Premium+grok-4.6-buildpython3 -m py_compile bin/omarchy-agent-usage-grok./test/allon CIHappy to close this in favor of another collector PR if maintainers already have a preferred one in review; the billing shape and
turn_completedcontract above are the bits that were missing from a working Grok tab on this machine.