Repository navigation
Add a Grok usage collector for the agents panel - #7784
shawnyeager wants to merge 1 commit into
Conversation
The panel already draws any record that lands in ~/.local/state/omarchy/agents/usage/. This ships the missing omarchy-agent-usage-grok collector, brand marks, and tests. Local stats come from documented Grok sessions under $GROK_HOME. Each turn_completed event is one prompt. Cache reads are split out of input so the four panel buckets stay exclusive. Sessions labeled subagent or subagent_fork are skipped so parent totals are not counted twice. Limits and the plan label come from the same cli-chat-proxy endpoints Grok's /usage command uses. The weekly SuperGrok pool is a limit; a zero prepaid ledger is omitted rather than shown as $0.00 remaining. The live product string subscription_tier_display is preferred over rewriting SuperGrokPro.
There was a problem hiding this comment.
Pull request overview
Adds Grok usage, limits, and plan data to the existing agents panel.
Changes:
- Adds the Grok collector with session scanning, caching, authentication, and billing support.
- Enables Grok by default with dark/light icons.
- Adds documentation and comprehensive scanner tests.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 4 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
bin/omarchy-agent-usage-grok |
Implements Grok usage collection. |
test/shell.d/agent-usage-grok-scanner-test.sh |
Tests scanner, billing, auth, and failures. |
shell/plugins/agents/manifest.json |
Enables Grok by default. |
shell/plugins/agents/README.md |
Documents Grok integration. |
shell/plugins/agents/assets/grok.svg |
Adds the dark-surface icon. |
shell/plugins/agents/assets/grok-light.svg |
Adds the light-surface icon. |
manual/17-ai.md |
Lists Grok as supported. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| today="$(date +%Y-%m-%d)" | ||
| timestamp="${today}T12:00:00Z" |
|
Closing in favor of #6902, which already has the collector, community verification, and an author taking patches onto the branch. The one extra this PR had — skip Grok 1.0.x |
What
Adds
omarchy-agent-usage-grokso the existingomarchy.agentspanel grows a Grok tab the same way it already does for Claude, Codex, and Fireworks. No QML change: the panel draws any record that lands in~/.local/state/omarchy/agents/usage/.How
$GROK_HOME(default~/.grok). Eachturn_completedevent inupdates.jsonlis one prompt. Cache reads are split out ofinputTokensso the four panel buckets stay mutually exclusive.session_kind: subagent; older builds usedsubagent_fork. Parentturn_completedalready includes finished child spend, so counting the child file would double tokens and invent extra prompts.event_name: turn_completed, and a flat token ledger on the update object itself (no nestedusage)./usagecommand uses (/v1/billing?format=creditsand/v1/settings). The live product stringsubscription_tier_displayis preferred (SuperGrok Heavyhere);SuperGrokProfrom/v1/useris the fallback. The collector only reads the OIDC token already stored in~/.grok/auth.json. It never writes credentials and does not refresh them — that stays withgrok login.$0.00remaining. Prepaid / leftover on-demand credits still become abalancewhen the billing payload actually has them.assets/grok.svgplus a light-surface twin, and enablesgrokin the widget defaults.Verified on a live SuperGrok Heavy login (Grok 1.0.5): the collector printed a ready record with SuperGrok Heavy, a Weekly 15% meter, 548 prompts across 54 parent sessions, tokens by day, and tokens by model (
grok-4.5-build,grok-4.6-build).Related collectors already in review: #6902, #6485, #7393, #7200, #6477. This one is the 1.0.5 session kind (
subagent, not onlysubagent_fork) plussubscription_tier_display. Happy to close in favor of whichever lands.Tests
Covers empty/unauthenticated records, per-turn summing and dedupe,
subagentandsubagent_forkskip,GROK_HOME, weekly/on-demand/balance mapping, SuperGrok Heavy labeling, SuperGrokPro fallback, a zero SuperGrok prepaid ledger, expired tokens,--limits-onlycache reuse, event_name/flat ledger, and transport vs HTTP error handling.