Skip to content

Add a Grok collector for the agents usage panel - #9840

Closed
MahdiHedhli wants to merge 2 commits into
omacom:quattrofrom
MahdiHedhli:grok-agent-usage
Closed

MahdiHedhli wants to merge 2 commits into
omacom:quattrofrom
MahdiHedhli:grok-agent-usage

Conversation

@MahdiHedhli

@MahdiHedhli MahdiHedhli commented Sep 2, 2026 •

Copy link
Copy Markdown

Setup already offers Grok as a first-party default coding agent, but omarchy.agents never lights up for it. Collectors are discovered from $OMARCHY_PATH/bin/omarchy-agent-usage-*; there was no Grok one.

This adds omarchy-agent-usage-grok. It prints the same record contract the panel already understands — no QML changes.

Preferred channel: this gap is already tracked as suggestion #7198. Related collector PRs: #7200, #6902, #7393, #6485. Happy to treat this as extra verification / a source of patches (omp xai-oauth, ACP Money.val as cents) rather than a competing merge.

  • Local token stats come from $GROK_HOME/sessions billed updates.jsonl turn_completed rows (nested usage, or flat token fields / event_name). Cache read is split out of input. session_kind values that start with subagent are skipped.
  • Limits and plan come from Grok ACP _x.ai/billing (grok agent --no-leader stdio). Weekly/monthly pool → limits[]. Non-zero prepaid/on-demand leftover → balance. ACP Money.val is integer cents.
  • pi / omp (xai, xai-auth, xai-oauth) and OpenCode (providerID=xai) sessions are merged.
  • Optional assets/grok.svg / grok-light.svg from the official Grok mark.

Tests

test/shell.d/agent-usage-grok-scanner-test.sh

Standalone drop-in (user-space installer until this ships): https://github.com/MahdiHedhli/omarchy-agent-usage-grok

Setup already offers Grok as a default coding agent, but the bar widget
only lights up for Claude, Codex, and Fireworks. Scan billed
turn_completed rows under $GROK_HOME/sessions, merge pi/omp/OpenCode
xAI usage (including omp xai-oauth), and pull the SuperGrok weekly pool
from grok agent stdio _x.ai/billing. ACP Money.val is cents.
Skip task-completed prompt ids and fall back to cli-chat-proxy billing
when ACP omits the Grok Build / Chat / Imagine split.
@bjarneo

bjarneo commented Sep 20, 2026

Copy link
Copy Markdown
Member

Automated duplication check: this pull request looks similar to #9498, which covers the same Grok usage collector. I keep that one open and close this one to consolidate review.

If you feel this is the wrong decision, please open the PR again with a note on the difference.

@bjarneo bjarneo closed this Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants